1 |
/* |
2 |
Copyright (c) 2014-2016 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_COMBINEINSTRUMENTSDIALOG |
9 |
#define GIGEDIT_COMBINEINSTRUMENTSDIALOG |
10 |
|
11 |
#include <gig.h> |
12 |
|
13 |
#include <gtkmm/buttonbox.h> |
14 |
#include <gtkmm/window.h> |
15 |
#include <gtkmm/dialog.h> |
16 |
#include <gtkmm/treeview.h> |
17 |
#include <gtkmm/liststore.h> |
18 |
#include <gtkmm/table.h> |
19 |
#include <gtkmm/comboboxtext.h> |
20 |
#include <gtkmm/scrolledwindow.h> |
21 |
|
22 |
#include "wrapLabel.hh" |
23 |
#include "ManagedWindow.h" |
24 |
|
25 |
/** |
26 |
* @brief Modal dialog which allows to merge instruments. |
27 |
* |
28 |
* This dialog shows a list of all instruments of the currently open .gig file |
29 |
* in gigedit and allows the user to shift select a set of instruments to be |
30 |
* combined. |
31 |
* |
32 |
* If the user successfully combined instruments in this dialog, then |
33 |
* newCombinedInstrument() will return a pointer to that new instrument. |
34 |
*/ |
35 |
class CombineInstrumentsDialog : public ManagedDialog { |
36 |
public: |
37 |
CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig); |
38 |
bool fileWasChanged() const; |
39 |
gig::Instrument* newCombinedInstrument() const; |
40 |
|
41 |
// implementation for abstract methods of interface class "ManagedDialog" |
42 |
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->combineInstrumentsWindowX; } |
43 |
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->combineInstrumentsWindowY; } |
44 |
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->combineInstrumentsWindowW; } |
45 |
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->combineInstrumentsWindowH; } |
46 |
|
47 |
protected: |
48 |
gig::File* m_gig; |
49 |
bool m_fileWasChanged; |
50 |
gig::Instrument* m_newCombinedInstrument; |
51 |
|
52 |
Gtk::HButtonBox m_buttonBox; |
53 |
Gtk::ScrolledWindow m_scrolledWindow; |
54 |
Gtk::TreeView m_treeView; |
55 |
Gtk::Button m_cancelButton; |
56 |
Gtk::Button m_OKButton; |
57 |
#if GTKMM_MAJOR_VERSION < 3 |
58 |
view::WrapLabel m_descriptionLabel; |
59 |
#else |
60 |
Gtk::Label m_descriptionLabel; |
61 |
#endif |
62 |
Gtk::Table m_tableDimCombo; |
63 |
Gtk::ComboBox m_comboDimType; |
64 |
Gtk::Label m_labelDimType; |
65 |
|
66 |
class ComboDimsModel : public Gtk::TreeModel::ColumnRecord { |
67 |
public: |
68 |
ComboDimsModel() { |
69 |
add(m_type_id); |
70 |
add(m_type_name); |
71 |
} |
72 |
|
73 |
Gtk::TreeModelColumn<int> m_type_id; |
74 |
Gtk::TreeModelColumn<Glib::ustring> m_type_name; |
75 |
} m_comboDimsModel; |
76 |
|
77 |
class ListModel : public Gtk::TreeModel::ColumnRecord { |
78 |
public: |
79 |
ListModel() { |
80 |
add(m_col_name); |
81 |
add(m_col_instr); |
82 |
} |
83 |
|
84 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
85 |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
86 |
} m_columns; |
87 |
|
88 |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
89 |
|
90 |
void combineSelectedInstruments(); |
91 |
void onSelectionChanged(); |
92 |
}; |
93 |
|
94 |
#endif // GIGEDIT_COMBINEINSTRUMENTSDIALOG |