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