1 |
/* |
2 |
Copyright (c) 2014 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 |
protected: |
25 |
gig::Sample* m_sample; |
26 |
|
27 |
Gtk::HButtonBox m_buttonBox; |
28 |
Gtk::ScrolledWindow m_scrolledWindow; |
29 |
Gtk::TreeView m_treeView; |
30 |
Gtk::Button m_closeButton; |
31 |
#if GTKMM_MAJOR_VERSION < 3 |
32 |
view::WrapLabel m_descriptionLabel; |
33 |
#else |
34 |
Gtk::Label m_descriptionLabel; |
35 |
#endif |
36 |
#if GTKMM_MAJOR_VERSION < 3 |
37 |
view::WrapLabel m_summaryLabel; |
38 |
#else |
39 |
Gtk::Label m_summaryLabel; |
40 |
#endif |
41 |
|
42 |
class RefsTreeModel : public Gtk::TreeModel::ColumnRecord { |
43 |
public: |
44 |
RefsTreeModel() { |
45 |
add(m_col_name); |
46 |
add(m_col_instr); |
47 |
add(m_col_region); |
48 |
add(m_col_refcount); |
49 |
} |
50 |
|
51 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
52 |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
53 |
Gtk::TreeModelColumn<gig::Region*> m_col_region; |
54 |
Gtk::TreeModelColumn<Glib::ustring> m_col_refcount; |
55 |
} m_columns; |
56 |
|
57 |
class RefsTreeStore : public Gtk::TreeStore { |
58 |
public: |
59 |
static Glib::RefPtr<RefsTreeStore> create(const RefsTreeModel& columns) { |
60 |
return Glib::RefPtr<RefsTreeStore>( new RefsTreeStore(columns) ); |
61 |
} |
62 |
protected: |
63 |
RefsTreeStore(const RefsTreeModel& columns) : Gtk::TreeStore(columns) {} |
64 |
}; |
65 |
|
66 |
Glib::RefPtr<RefsTreeStore> m_refTreeModel; |
67 |
}; |
68 |
|
69 |
#endif // GIGEDIT_REFERENCESVIEW_H |