/[svn]/gigedit/trunk/src/gigedit/ReferencesView.h
ViewVC logotype

Contents of /gigedit/trunk/src/gigedit/ReferencesView.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3364 - (show annotations) (download) (as text)
Tue Nov 14 18:07:25 2017 UTC (6 years, 5 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3232 byte(s)
* Added experimental support for upcoming GTK(MM)4
  (for now up to GTKMM 3.91.2 while still preserving backward compatibility
  down to GTKMM 2).
* Re-merged r2845 to compile now with and without Gtk "Stock ID" API
  (see also r3158).

1 /*
2 Copyright (c) 2014-2017 Christian Schoenebeck
3
4 This file is part of "gigedit" and released under the terms of the
5 GNU General Public License version 2.
6 */
7
8 #ifndef GIGEDIT_REFERENCESVIEW_H
9 #define GIGEDIT_REFERENCESVIEW_H
10
11 #ifdef LIBGIG_HEADER_FILE
12 # include LIBGIG_HEADER_FILE(gig.h)
13 #else
14 # include <gig.h>
15 #endif
16
17 #ifdef GTKMM_HEADER_FILE
18 # include GTKMM_HEADER_FILE(gtkmm.h)
19 #else
20 # include <gtkmm.h>
21 #endif
22 #include "wrapLabel.hh"
23 #include "ManagedWindow.h"
24
25 /** @brief Sample reference browser dialog.
26 *
27 * Shows a modal dialog with a tree view showing all instruments and their
28 * respective regions which reference the selected sample at least once.
29 */
30 class ReferencesView : public ManagedDialog {
31 public:
32 ReferencesView(Gtk::Window& parent);
33 void setSample(gig::Sample* sample);
34
35 // When the user single clicked on a sample reference on this reference
36 // view dialog, then this signal is emitted and the dimension region editor
37 // shall select the respective, instrument, region and dimension region for
38 // further editing. The editor shall return true if selection was successful
39 // or should return false on errors.
40 sigc::signal<bool, gig::DimensionRegion*> dimension_region_selected;
41
42 // implementation for abstract methods of interface class "ManagedDialog"
43 virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->sampleRefsWindowX; }
44 virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->sampleRefsWindowY; }
45 virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->sampleRefsWindowW; }
46 virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->sampleRefsWindowH; }
47
48 protected:
49 gig::Sample* m_sample;
50
51 HButtonBox m_buttonBox;
52 Gtk::ScrolledWindow m_scrolledWindow;
53 Gtk::TreeView m_treeView;
54 Gtk::Button m_closeButton;
55 #if GTKMM_MAJOR_VERSION < 3
56 view::WrapLabel m_descriptionLabel;
57 #else
58 Gtk::Label m_descriptionLabel;
59 #endif
60 #if GTKMM_MAJOR_VERSION < 3
61 view::WrapLabel m_summaryLabel;
62 #else
63 Gtk::Label m_summaryLabel;
64 #endif
65
66 class RefsTreeModel : public Gtk::TreeModel::ColumnRecord {
67 public:
68 RefsTreeModel() {
69 add(m_col_name);
70 add(m_col_instr);
71 add(m_col_region);
72 add(m_col_refcount);
73 }
74
75 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
76 Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
77 Gtk::TreeModelColumn<gig::Region*> m_col_region;
78 Gtk::TreeModelColumn<Glib::ustring> m_col_refcount;
79 } m_columns;
80
81 class RefsTreeStore : public Gtk::TreeStore {
82 public:
83 static Glib::RefPtr<RefsTreeStore> create(const RefsTreeModel& columns) {
84 return Glib::RefPtr<RefsTreeStore>( new RefsTreeStore(columns) );
85 }
86 protected:
87 RefsTreeStore(const RefsTreeModel& columns) : Gtk::TreeStore(columns) {}
88 };
89
90 Glib::RefPtr<RefsTreeStore> m_refTreeModel;
91
92 void onSelectionChanged(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
93 };
94
95 #endif // GIGEDIT_REFERENCESVIEW_H

  ViewVC Help
Powered by ViewVC