1 |
/* |
/* |
2 |
Copyright (c) 2014-2016 Christian Schoenebeck |
Copyright (c) 2014-2018 Christian Schoenebeck |
3 |
|
|
4 |
This file is part of "gigedit" and released under the terms of the |
This file is part of "gigedit" and released under the terms of the |
5 |
GNU General Public License version 2. |
GNU General Public License version 2. |
8 |
#ifndef GIGEDIT_COMBINEINSTRUMENTSDIALOG |
#ifndef GIGEDIT_COMBINEINSTRUMENTSDIALOG |
9 |
#define GIGEDIT_COMBINEINSTRUMENTSDIALOG |
#define GIGEDIT_COMBINEINSTRUMENTSDIALOG |
10 |
|
|
11 |
#include <gig.h> |
#ifdef LIBGIG_HEADER_FILE |
12 |
|
# include LIBGIG_HEADER_FILE(gig.h) |
13 |
|
#else |
14 |
|
# include <gig.h> |
15 |
|
#endif |
16 |
|
|
17 |
|
#include "compat.h" |
18 |
|
|
19 |
#include <gtkmm/buttonbox.h> |
#include <gtkmm/buttonbox.h> |
20 |
#include <gtkmm/window.h> |
#include <gtkmm/window.h> |
21 |
#include <gtkmm/dialog.h> |
#include <gtkmm/dialog.h> |
22 |
#include <gtkmm/treeview.h> |
#include <gtkmm/treeview.h> |
23 |
#include <gtkmm/liststore.h> |
#include <gtkmm/liststore.h> |
24 |
#include <gtkmm/table.h> |
#include <gtkmm/iconview.h> |
25 |
|
#if USE_GTKMM_GRID |
26 |
|
# include <gtkmm/grid.h> |
27 |
|
#else |
28 |
|
# include <gtkmm/table.h> |
29 |
|
#endif |
30 |
#include <gtkmm/comboboxtext.h> |
#include <gtkmm/comboboxtext.h> |
31 |
#include <gtkmm/scrolledwindow.h> |
#include <gtkmm/scrolledwindow.h> |
32 |
|
|
33 |
#include "wrapLabel.hh" |
#include "wrapLabel.hh" |
34 |
#include "ManagedWindow.h" |
#include "ManagedWindow.h" |
35 |
|
|
36 |
|
#include <set> |
37 |
|
|
38 |
/** |
/** |
39 |
* @brief Modal dialog which allows to merge instruments. |
* @brief Modal dialog which allows to merge instruments. |
40 |
* |
* |
50 |
CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig); |
CombineInstrumentsDialog(Gtk::Window& parent, gig::File* gig); |
51 |
bool fileWasChanged() const; |
bool fileWasChanged() const; |
52 |
gig::Instrument* newCombinedInstrument() const; |
gig::Instrument* newCombinedInstrument() const; |
53 |
|
void setSelectedInstruments(const std::set<int>& instrumentIndeces); |
54 |
|
|
55 |
// implementation for abstract methods of interface class "ManagedDialog" |
// implementation for abstract methods of interface class "ManagedDialog" |
56 |
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->combineInstrumentsWindowX; } |
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->combineInstrumentsWindowX; } |
63 |
bool m_fileWasChanged; |
bool m_fileWasChanged; |
64 |
gig::Instrument* m_newCombinedInstrument; |
gig::Instrument* m_newCombinedInstrument; |
65 |
|
|
66 |
Gtk::HButtonBox m_buttonBox; |
HButtonBox m_buttonBox; |
67 |
Gtk::ScrolledWindow m_scrolledWindow; |
Gtk::ScrolledWindow m_scrolledWindow; |
68 |
Gtk::TreeView m_treeView; |
Gtk::TreeView m_treeView; |
69 |
|
Gtk::IconView m_iconView; |
70 |
Gtk::Button m_cancelButton; |
Gtk::Button m_cancelButton; |
71 |
Gtk::Button m_OKButton; |
Gtk::Button m_OKButton; |
72 |
#if GTKMM_MAJOR_VERSION < 3 |
#if GTKMM_MAJOR_VERSION < 3 |
74 |
#else |
#else |
75 |
Gtk::Label m_descriptionLabel; |
Gtk::Label m_descriptionLabel; |
76 |
#endif |
#endif |
77 |
|
#if USE_GTKMM_GRID |
78 |
|
Gtk::Grid m_tableDimCombo; |
79 |
|
#else |
80 |
Gtk::Table m_tableDimCombo; |
Gtk::Table m_tableDimCombo; |
81 |
|
#endif |
82 |
Gtk::ComboBox m_comboDimType; |
Gtk::ComboBox m_comboDimType; |
83 |
Gtk::Label m_labelDimType; |
Gtk::Label m_labelDimType; |
84 |
|
Gtk::Label m_labelOrder; |
85 |
|
|
86 |
class ComboDimsModel : public Gtk::TreeModel::ColumnRecord { |
class ComboDimsModel : public Gtk::TreeModel::ColumnRecord { |
87 |
public: |
public: |
97 |
class ListModel : public Gtk::TreeModel::ColumnRecord { |
class ListModel : public Gtk::TreeModel::ColumnRecord { |
98 |
public: |
public: |
99 |
ListModel() { |
ListModel() { |
100 |
|
add(m_col_index); |
101 |
add(m_col_name); |
add(m_col_name); |
102 |
add(m_col_instr); |
add(m_col_instr); |
103 |
} |
} |
104 |
|
|
105 |
|
Gtk::TreeModelColumn<int> m_col_index; |
106 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
107 |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
108 |
} m_columns; |
} m_columns; |
109 |
|
|
110 |
|
class OrderListModel : public Gtk::TreeModel::ColumnRecord { |
111 |
|
public: |
112 |
|
OrderListModel() { |
113 |
|
add(m_col_name); |
114 |
|
add(m_col_markup); |
115 |
|
add(m_col_instr); |
116 |
|
} |
117 |
|
|
118 |
|
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
119 |
|
Gtk::TreeModelColumn<Glib::ustring> m_col_markup; |
120 |
|
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
121 |
|
} m_orderColumns; |
122 |
|
|
123 |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
124 |
|
Glib::RefPtr<Gtk::ListStore> m_refOrderModel; |
125 |
|
bool first_call_to_drag_data_get; |
126 |
|
|
127 |
void combineSelectedInstruments(); |
void combineSelectedInstruments(); |
128 |
void onSelectionChanged(); |
void onSelectionChanged(); |
129 |
|
void on_order_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
130 |
|
void on_order_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
131 |
|
Gtk::SelectionData& selection_data, guint, guint); |
132 |
|
void on_order_drop_drag_data_received( |
133 |
|
const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, |
134 |
|
const Gtk::SelectionData& selection_data, guint, guint time |
135 |
|
); |
136 |
|
void on_show_tooltips_changed(); |
137 |
}; |
}; |
138 |
|
|
139 |
#endif // GIGEDIT_COMBINEINSTRUMENTSDIALOG |
#endif // GIGEDIT_COMBINEINSTRUMENTSDIALOG |