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