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_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 |
|
21 |
#include "wrapLabel.hh" |
22 |
|
23 |
/** |
24 |
* @brief Modal dialog which allows to merge instruments. |
25 |
* |
26 |
* This dialog shows a list of all instruments of the currently open .gig file |
27 |
* in gigedit and allows the user to shift select a set of instruments to be |
28 |
* combined. |
29 |
* |
30 |
* If the user successfully combined instruments in this dialog, then |
31 |
* newCombinedInstrument() will return a pointer to that new instrument. |
32 |
*/ |
33 |
class CombineInstrumentsDialog : public Gtk::Dialog { |
34 |
public: |
35 |
CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig); |
36 |
bool fileWasChanged() const; |
37 |
gig::Instrument* newCombinedInstrument() const; |
38 |
protected: |
39 |
gig::File* m_gig; |
40 |
bool m_fileWasChanged; |
41 |
gig::Instrument* m_newCombinedInstrument; |
42 |
|
43 |
Gtk::HButtonBox m_buttonBox; |
44 |
Gtk::TreeView m_treeView; |
45 |
Gtk::Button m_cancelButton; |
46 |
Gtk::Button m_OKButton; |
47 |
#if GTKMM_MAJOR_VERSION < 3 |
48 |
view::WrapLabel m_descriptionLabel; |
49 |
#else |
50 |
Gtk::Label m_descriptionLabel; |
51 |
#endif |
52 |
Gtk::Table m_tableDimCombo; |
53 |
Gtk::ComboBox m_comboDimType; |
54 |
Gtk::Label m_labelDimType; |
55 |
|
56 |
class ComboDimsModel : public Gtk::TreeModel::ColumnRecord { |
57 |
public: |
58 |
ComboDimsModel() { |
59 |
add(m_type_id); |
60 |
add(m_type_name); |
61 |
} |
62 |
|
63 |
Gtk::TreeModelColumn<int> m_type_id; |
64 |
Gtk::TreeModelColumn<Glib::ustring> m_type_name; |
65 |
} m_comboDimsModel; |
66 |
|
67 |
class ListModel : public Gtk::TreeModel::ColumnRecord { |
68 |
public: |
69 |
ListModel() { |
70 |
add(m_col_name); |
71 |
add(m_col_instr); |
72 |
} |
73 |
|
74 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
75 |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
76 |
} m_columns; |
77 |
|
78 |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
79 |
|
80 |
void combineSelectedInstruments(); |
81 |
void onSelectionChanged(); |
82 |
}; |
83 |
|
84 |
#endif // GIGEDIT_COMBINEINSTRUMENTSDIALOG |