/[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 2695 - (show annotations) (download) (as text)
Tue Jan 6 18:11:27 2015 UTC (9 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2474 byte(s)
* Sample Referenve View Dialog: Clicking on a reference in the list closes
  the dialog and jumps directly to the respective instrument, region and
  dimension region the respective sample reference is located at.

1 /*
2 Copyright (c) 2014,2015 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 #include <gig.h>
12 #include <gtkmm.h>
13 #include "wrapLabel.hh"
14
15 /** @brief Sample reference browser dialog.
16 *
17 * Shows a modal dialog with a tree view showing all instruments and their
18 * respective regions which reference the selected sample at least once.
19 */
20 class ReferencesView : public Gtk::Dialog {
21 public:
22 ReferencesView(Gtk::Window& parent);
23 void setSample(gig::Sample* sample);
24
25 // When the user single clicked on a sample reference on this reference
26 // view dialog, then this signal is emitted and the dimension region editor
27 // shall select the respective, instrument, region and dimension region for
28 // further editing. The editor shall return true if selection was successful
29 // or should return false on errors.
30 sigc::signal<bool, gig::DimensionRegion*> dimension_region_selected;
31
32 protected:
33 gig::Sample* m_sample;
34
35 Gtk::HButtonBox m_buttonBox;
36 Gtk::ScrolledWindow m_scrolledWindow;
37 Gtk::TreeView m_treeView;
38 Gtk::Button m_closeButton;
39 #if GTKMM_MAJOR_VERSION < 3
40 view::WrapLabel m_descriptionLabel;
41 #else
42 Gtk::Label m_descriptionLabel;
43 #endif
44 #if GTKMM_MAJOR_VERSION < 3
45 view::WrapLabel m_summaryLabel;
46 #else
47 Gtk::Label m_summaryLabel;
48 #endif
49
50 class RefsTreeModel : public Gtk::TreeModel::ColumnRecord {
51 public:
52 RefsTreeModel() {
53 add(m_col_name);
54 add(m_col_instr);
55 add(m_col_region);
56 add(m_col_refcount);
57 }
58
59 Gtk::TreeModelColumn<Glib::ustring> m_col_name;
60 Gtk::TreeModelColumn<gig::Instrument*> m_col_instr;
61 Gtk::TreeModelColumn<gig::Region*> m_col_region;
62 Gtk::TreeModelColumn<Glib::ustring> m_col_refcount;
63 } m_columns;
64
65 class RefsTreeStore : public Gtk::TreeStore {
66 public:
67 static Glib::RefPtr<RefsTreeStore> create(const RefsTreeModel& columns) {
68 return Glib::RefPtr<RefsTreeStore>( new RefsTreeStore(columns) );
69 }
70 protected:
71 RefsTreeStore(const RefsTreeModel& columns) : Gtk::TreeStore(columns) {}
72 };
73
74 Glib::RefPtr<RefsTreeStore> m_refTreeModel;
75
76 void onSelectionChanged();
77 };
78
79 #endif // GIGEDIT_REFERENCESVIEW_H

  ViewVC Help
Powered by ViewVC