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