1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006, 2007 Andreas Persson |
* Copyright (C) 2006 - 2019 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
20 |
#ifndef GIGEDIT_MAINWINDOW_H |
#ifndef GIGEDIT_MAINWINDOW_H |
21 |
#define GIGEDIT_MAINWINDOW_H |
#define GIGEDIT_MAINWINDOW_H |
22 |
|
|
23 |
#include <gig.h> |
#ifdef LIBGIG_HEADER_FILE |
24 |
|
# include LIBGIG_HEADER_FILE(gig.h) |
25 |
|
# include LIBGIG_HEADER_FILE(Serialization.h) |
26 |
|
#else |
27 |
|
# include <gig.h> |
28 |
|
# include <Serialization.h> |
29 |
|
#endif |
30 |
|
|
31 |
|
#include "compat.h" |
32 |
|
|
33 |
#include <gtkmm/actiongroup.h> |
#include <gtkmm/box.h> |
34 |
#include <gtkmm/buttonbox.h> |
#include <gtkmm/buttonbox.h> |
35 |
#include <gtkmm/dialog.h> |
#include <gtkmm/dialog.h> |
36 |
#include <gtkmm/liststore.h> |
#include <gtkmm/liststore.h> |
37 |
|
#include <gtkmm/menu.h> |
38 |
#include <gtkmm/paned.h> |
#include <gtkmm/paned.h> |
39 |
#include <gtkmm/progressbar.h> |
#include <gtkmm/progressbar.h> |
40 |
|
#include <gtkmm/radiomenuitem.h> |
41 |
#include <gtkmm/scrolledwindow.h> |
#include <gtkmm/scrolledwindow.h> |
42 |
#include <gtkmm/treestore.h> |
#include <gtkmm/treestore.h> |
43 |
#include <gtkmm/uimanager.h> |
#include <gtkmm/treemodelfilter.h> |
44 |
#include <gtkmm/window.h> |
#include <gtkmm/window.h> |
45 |
#include <gtkmm/statusbar.h> |
#include <gtkmm/statusbar.h> |
46 |
#include <gtkmm/image.h> |
#include <gtkmm/image.h> |
47 |
|
#include <gtkmm/entry.h> |
48 |
|
#include <gtkmm/notebook.h> |
49 |
|
|
50 |
|
#if USE_GTKMM_BUILDER |
51 |
|
# include <gtkmm/builder.h> |
52 |
|
#else |
53 |
|
# include <gtkmm/uimanager.h> // deprecated in gtkmm >= 3.21.4 |
54 |
|
#endif |
55 |
|
|
56 |
#include <sstream> |
#include <sstream> |
57 |
|
|
58 |
#include "regionchooser.h" |
#include "regionchooser.h" |
59 |
#include "dimregionchooser.h" |
#include "dimregionchooser.h" |
60 |
#include "dimregionedit.h" |
#include "dimregionedit.h" |
61 |
|
#include "midirules.h" |
62 |
|
#ifdef GLIB_THREADS |
63 |
|
#ifndef OLD_THREADS |
64 |
|
#include <glibmm/threads.h> |
65 |
|
#endif |
66 |
|
#else |
67 |
|
#include <thread> |
68 |
|
#include <mutex> |
69 |
|
#endif |
70 |
|
#include "ManagedWindow.h" |
71 |
|
|
72 |
class MainWindow; |
class MainWindow; |
73 |
|
|
74 |
class Table : public Gtk::Table |
class PropDialog : public ManagedWindow, |
75 |
{ |
public PropEditor<DLS::Info> { |
|
public: |
|
|
Table(int x, int y); |
|
|
void add(BoolEntry& boolentry); |
|
|
void add(BoolEntryPlus6& boolentry); |
|
|
void add(LabelWidget& labelwidget); |
|
|
private: |
|
|
int rowno; |
|
|
}; |
|
|
|
|
|
class PropDialog : public Gtk::Window { |
|
76 |
public: |
public: |
77 |
PropDialog(); |
PropDialog(); |
78 |
void set_info(DLS::Info* info); |
void set_file(gig::File* file); |
79 |
sigc::signal<void>& signal_info_changed(); |
|
80 |
|
// implementation for abstract methods of interface class "ManagedWindow" |
81 |
|
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->filePropsWindowX; } |
82 |
|
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->filePropsWindowY; } |
83 |
|
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->filePropsWindowW; } |
84 |
|
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->filePropsWindowH; } |
85 |
|
|
86 |
protected: |
protected: |
87 |
sigc::signal<void> info_changed; |
ChoiceEntry<int> eFileFormat; |
88 |
StringEntry eName; |
StringEntry eName; |
89 |
StringEntry eCreationDate; |
StringEntry eCreationDate; |
90 |
StringEntryMultiLine eComments; |
StringEntryMultiLine eComments; |
101 |
StringEntry eSourceForm; |
StringEntry eSourceForm; |
102 |
StringEntry eCommissioned; |
StringEntry eCommissioned; |
103 |
StringEntry eSubject; |
StringEntry eSubject; |
104 |
Gtk::VBox vbox; |
VBox vbox; |
105 |
Gtk::HButtonBox buttonBox; |
HButtonBox buttonBox; |
106 |
Gtk::Button quitButton; |
Gtk::Button quitButton; |
107 |
Table table; |
Table table; |
|
int update_model; |
|
|
DLS::Info* info; |
|
108 |
|
|
109 |
template<typename T> |
gig::File* m_file; |
|
void set_member(T value, T DLS::Info::* member) { |
|
|
if (update_model == 0) { |
|
|
info->*member = value; |
|
|
info_changed(); |
|
|
} |
|
|
} |
|
110 |
|
|
111 |
template<typename C, typename T> |
void set_FileFormat(int value); |
|
void connect(C& widget, T DLS::Info::* member) { |
|
|
widget.signal_value_changed().connect( |
|
|
sigc::compose( |
|
|
sigc::bind(sigc::mem_fun(*this, &PropDialog::set_member<T>), member), |
|
|
sigc::mem_fun(widget, &C::get_value))); |
|
|
} |
|
112 |
}; |
}; |
113 |
|
|
114 |
class InstrumentProps : public Gtk::Window { |
class InstrumentProps : public ManagedWindow, |
115 |
|
public PropEditor<gig::Instrument> { |
116 |
public: |
public: |
117 |
InstrumentProps(); |
InstrumentProps(); |
118 |
void set_instrument(gig::Instrument* instrument); |
void set_instrument(gig::Instrument* instrument); |
119 |
sigc::signal<void>& signal_instrument_changed(); |
gig::Instrument* get_instrument() { return m; } |
120 |
protected: |
void update_name(); |
121 |
gig::Instrument* instrument; |
sigc::signal<void>& signal_name_changed() { |
122 |
int update_model; |
return sig_name_changed; |
|
|
|
|
template<typename T> |
|
|
void set_value(T value, sigc::slot<void, InstrumentProps*, T> setter) { |
|
|
if (update_model == 0) { |
|
|
setter(this, value); |
|
|
instrument_changed(); |
|
|
} |
|
123 |
} |
} |
124 |
|
|
125 |
template<typename C, typename T> |
// implementation for abstract methods of interface class "ManagedWindow" |
126 |
void connect(C& widget, T gig::Instrument::* member) { |
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->instrPropsWindowX; } |
127 |
widget.signal_value_changed().connect( |
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->instrPropsWindowY; } |
128 |
sigc::compose( |
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->instrPropsWindowW; } |
129 |
sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value<T>), |
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->instrPropsWindowH; } |
|
sigc::bind(sigc::mem_fun(&InstrumentProps::set_member<T>), member)), |
|
|
sigc::mem_fun(widget, &C::get_value))); |
|
|
} |
|
|
|
|
|
template<typename C, typename T> |
|
|
void connect(C& widget, void (InstrumentProps::*setter)(T)) { |
|
|
widget.signal_value_changed().connect( |
|
|
sigc::compose( |
|
|
sigc::bind(sigc::mem_fun(*this, &InstrumentProps::set_value<T>), |
|
|
sigc::mem_fun(setter)), |
|
|
sigc::mem_fun(widget, &C::get_value))); |
|
|
} |
|
|
|
|
|
template<typename T> |
|
|
void set_member(T value, T gig::Instrument::* member) { |
|
|
instrument->*member = value; |
|
|
} |
|
130 |
|
|
131 |
|
protected: |
132 |
|
void set_Name(const gig::String& name); |
133 |
void set_IsDrum(bool value); |
void set_IsDrum(bool value); |
134 |
void set_MIDIBank(uint16_t value); |
void set_MIDIBank(uint16_t value); |
135 |
void set_MIDIProgram(uint32_t value); |
void set_MIDIProgram(uint32_t value); |
|
void set_DimensionKeyRange_low(uint8_t value); |
|
|
void set_DimensionKeyRange_high(uint8_t value); |
|
136 |
|
|
137 |
Gtk::VBox vbox; |
sigc::signal<void> sig_name_changed; |
138 |
Gtk::HButtonBox buttonBox; |
Gtk::Notebook tabs; |
139 |
|
VBox vbox[3]; |
140 |
|
HButtonBox buttonBox; |
141 |
Gtk::Button quitButton; |
Gtk::Button quitButton; |
142 |
|
|
143 |
|
// tab 1 |
144 |
Table table; |
Table table; |
145 |
StringEntry eName; |
StringEntry eName; |
146 |
BoolEntry eIsDrum; |
BoolEntry eIsDrum; |
154 |
BoolEntry ePianoReleaseMode; |
BoolEntry ePianoReleaseMode; |
155 |
NoteEntry eDimensionKeyRangeLow; |
NoteEntry eDimensionKeyRangeLow; |
156 |
NoteEntry eDimensionKeyRangeHigh; |
NoteEntry eDimensionKeyRangeHigh; |
157 |
sigc::signal<void> instrument_changed; |
|
158 |
|
// tab 2 |
159 |
|
Table table2; |
160 |
|
StringEntry eName2; |
161 |
|
StringEntry eCreationDate; |
162 |
|
StringEntryMultiLine eComments; |
163 |
|
StringEntry eProduct; |
164 |
|
StringEntry eCopyright; |
165 |
|
StringEntry eArtists; |
166 |
|
StringEntry eGenre; |
167 |
|
StringEntry eKeywords; |
168 |
|
StringEntry eEngineer; |
169 |
|
StringEntry eTechnician; |
170 |
|
StringEntry eSoftware; |
171 |
|
StringEntry eMedium; |
172 |
|
StringEntry eSource; |
173 |
|
StringEntry eSourceForm; |
174 |
|
StringEntry eCommissioned; |
175 |
|
StringEntry eSubject; |
176 |
}; |
}; |
177 |
|
|
178 |
class LoadDialog : public Gtk::Dialog { |
class ProgressDialog : public Gtk::Dialog { |
179 |
public: |
public: |
180 |
LoadDialog(const Glib::ustring& title, Gtk::Window& parent); |
ProgressDialog(const Glib::ustring& title, Gtk::Window& parent); |
181 |
void set_fraction(float fraction) { progressBar.set_fraction(fraction); } |
void set_fraction(float fraction) { progressBar.set_fraction(fraction); } |
182 |
protected: |
protected: |
183 |
Gtk::ProgressBar progressBar; |
Gtk::ProgressBar progressBar; |
184 |
}; |
}; |
185 |
|
|
186 |
class Loader : public sigc::trackable { |
class LoaderSaverBase { |
187 |
public: |
public: |
|
Loader(const char* filename); |
|
188 |
void launch(); |
void launch(); |
189 |
Glib::Dispatcher& signal_progress(); |
Glib::Dispatcher& signal_progress(); |
190 |
Glib::Dispatcher& signal_finished(); |
Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error. |
191 |
|
Glib::Dispatcher& signal_error(); |
192 |
void progress_callback(float fraction); |
void progress_callback(float fraction); |
193 |
float get_progress(); |
float get_progress(); |
194 |
const char* filename; |
void join(); |
195 |
|
const Glib::ustring filename; |
196 |
|
Glib::ustring error_message; |
197 |
gig::File* gig; |
gig::File* gig; |
198 |
|
|
199 |
|
protected: |
200 |
|
LoaderSaverBase(const Glib::ustring filename, gig::File* gig); |
201 |
|
|
202 |
private: |
private: |
203 |
Glib::Thread* thread; |
#ifdef GLIB_THREADS |
204 |
|
Glib::Threads::Thread* thread; |
205 |
|
Glib::Threads::Mutex progressMutex; |
206 |
|
#else |
207 |
|
std::thread thread; |
208 |
|
std::mutex progressMutex; |
209 |
|
#endif |
210 |
void thread_function(); |
void thread_function(); |
211 |
|
virtual void thread_function_sub(gig::progress_t& progress) = 0; |
212 |
Glib::Dispatcher finished_dispatcher; |
Glib::Dispatcher finished_dispatcher; |
213 |
Glib::Dispatcher progress_dispatcher; |
Glib::Dispatcher progress_dispatcher; |
214 |
Glib::Mutex progressMutex; |
Glib::Dispatcher error_dispatcher; |
215 |
float progress; |
float progress; |
216 |
}; |
}; |
217 |
|
|
218 |
class MainWindow : public Gtk::Window { |
class Loader : public LoaderSaverBase { |
219 |
|
public: |
220 |
|
Loader(const char* filename); |
221 |
|
|
222 |
|
private: |
223 |
|
void thread_function_sub(gig::progress_t& progress); |
224 |
|
}; |
225 |
|
|
226 |
|
class Saver : public LoaderSaverBase { |
227 |
|
public: |
228 |
|
Saver(gig::File* file, Glib::ustring filename = ""); ///< one argument means "save", two arguments means "save as" |
229 |
|
|
230 |
|
private: |
231 |
|
void thread_function_sub(gig::progress_t& progress); |
232 |
|
}; |
233 |
|
|
234 |
|
class MainWindow : public ManagedWindow { |
235 |
public: |
public: |
236 |
MainWindow(); |
MainWindow(); |
237 |
virtual ~MainWindow(); |
virtual ~MainWindow(); |
246 |
sigc::signal<void, gig::Region*>& signal_region_changed(); |
sigc::signal<void, gig::Region*>& signal_region_changed(); |
247 |
sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed(); |
sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_to_be_changed(); |
248 |
sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed(); |
sigc::signal<void, gig::DimensionRegion*>& signal_dimreg_changed(); |
249 |
|
sigc::signal<void, gig::Sample*>& signal_sample_changed(); |
250 |
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed(); |
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& signal_sample_ref_changed(); |
251 |
|
|
252 |
|
sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_on(); |
253 |
|
sigc::signal<void, int/*key*/, int/*velocity*/>& signal_note_off(); |
254 |
|
|
255 |
|
sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_hit(); |
256 |
|
sigc::signal<void, int/*key*/, int/*velocity*/>& signal_keyboard_key_released(); |
257 |
|
|
258 |
|
sigc::signal<void, gig::Instrument*>& signal_switch_sampler_instrument(); |
259 |
|
|
260 |
|
sigc::signal<void, gig::Script*> signal_script_to_be_changed; |
261 |
|
sigc::signal<void, gig::Script*> signal_script_changed; |
262 |
|
|
263 |
|
// implementation for abstract methods of interface class "ManagedWindow" |
264 |
|
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->mainWindowX; } |
265 |
|
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->mainWindowY; } |
266 |
|
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->mainWindowW; } |
267 |
|
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->mainWindowH; } |
268 |
|
|
269 |
protected: |
protected: |
270 |
|
#if USE_GTKMM_BUILDER |
271 |
|
Glib::RefPtr<Gio::SimpleActionGroup> m_actionGroup; |
272 |
|
Glib::RefPtr<Gtk::Builder> m_uiManager; |
273 |
|
#else |
274 |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
275 |
Glib::RefPtr<Gtk::UIManager> uiManager; |
Glib::RefPtr<Gtk::UIManager> uiManager; |
276 |
|
#endif |
277 |
|
|
278 |
|
#if USE_GLIB_ACTION |
279 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionMIDIRules; |
280 |
|
|
281 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionCopyDimRgn; |
282 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionPasteDimRgn; |
283 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAdjustClipboard; |
284 |
|
|
285 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionSampleProperties; |
286 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddSample; |
287 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionRemoveSample; |
288 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionViewSampleRefs; |
289 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionReplaceSample; |
290 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddSampleGroup; |
291 |
|
|
292 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddScriptGroup; |
293 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionAddScript; |
294 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionEditScript; |
295 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionRemoveScript; |
296 |
|
|
297 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleUnity; |
298 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleTune; |
299 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleCopySampleLoop; |
300 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleStatusBar; |
301 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleRestoreWinDim; |
302 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleSaveWithTempFile; |
303 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleWarnOnExtensions; |
304 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleShowTooltips; |
305 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleSyncSamplerSelection; |
306 |
|
Glib::RefPtr<Gio::SimpleAction> m_actionToggleMoveRootNoteWithRegion; |
307 |
|
#endif |
308 |
|
|
309 |
Gtk::Statusbar m_StatusBar; |
Gtk::Statusbar m_StatusBar; |
310 |
Gtk::Label m_AttachedStateLabel; |
Gtk::Label m_AttachedStateLabel; |
315 |
|
|
316 |
PropDialog propDialog; |
PropDialog propDialog; |
317 |
InstrumentProps instrumentProps; |
InstrumentProps instrumentProps; |
318 |
|
MidiRules midiRules; |
319 |
|
|
320 |
|
/** |
321 |
|
* Ensures that the 2 signals MainWindow::dimreg_to_be_changed_signal and |
322 |
|
* MainWindowv::dimreg_changed_signal are always triggered correctly as a |
323 |
|
* pair. It behaves similar to a "mutex lock guard" design pattern. |
324 |
|
*/ |
325 |
|
class DimRegionChangeGuard : public SignalGuard<gig::DimensionRegion*> { |
326 |
|
public: |
327 |
|
DimRegionChangeGuard(MainWindow* w, gig::DimensionRegion* pDimReg) : |
328 |
|
SignalGuard<gig::DimensionRegion*>(w->dimreg_to_be_changed_signal, w->dimreg_changed_signal, pDimReg) |
329 |
|
{ |
330 |
|
} |
331 |
|
}; |
332 |
|
|
333 |
sigc::signal<void, gig::File*> file_structure_to_be_changed_signal; |
sigc::signal<void, gig::File*> file_structure_to_be_changed_signal; |
334 |
sigc::signal<void, gig::File*> file_structure_changed_signal; |
sigc::signal<void, gig::File*> file_structure_changed_signal; |
338 |
sigc::signal<void, gig::Region*> region_changed_signal; |
sigc::signal<void, gig::Region*> region_changed_signal; |
339 |
sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal; |
sigc::signal<void, gig::DimensionRegion*> dimreg_to_be_changed_signal; |
340 |
sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal; |
sigc::signal<void, gig::DimensionRegion*> dimreg_changed_signal; |
341 |
|
sigc::signal<void, gig::Sample*> sample_changed_signal; |
342 |
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal; |
sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/> sample_ref_changed_signal; |
343 |
|
|
344 |
void on_instrument_selection_change(int index); |
sigc::signal<void, int/*key*/, int/*velocity*/> note_on_signal; |
345 |
|
sigc::signal<void, int/*key*/, int/*velocity*/> note_off_signal; |
346 |
|
|
347 |
|
sigc::signal<void, gig::Instrument*> switch_sampler_instrument_signal; |
348 |
|
|
349 |
|
#if !USE_GTKMM_BUILDER |
350 |
|
void on_instrument_selection_change(Gtk::RadioMenuItem* item); |
351 |
|
#endif |
352 |
void on_sel_change(); |
void on_sel_change(); |
353 |
void region_changed(); |
void region_changed(); |
354 |
void dimreg_changed(); |
void dimreg_changed(); |
355 |
|
void select_instrument(gig::Instrument* instrument); |
356 |
|
bool select_dimension_region(gig::DimensionRegion* dimRgn); |
357 |
|
void select_sample(gig::Sample* sample); |
358 |
void on_loader_progress(); |
void on_loader_progress(); |
359 |
void on_loader_finished(); |
void on_loader_finished(); |
360 |
|
void on_loader_error(); |
361 |
|
void on_saver_progress(); |
362 |
|
void on_saver_error(); |
363 |
|
void on_saver_finished(); |
364 |
|
void updateMacroMenu(); |
365 |
|
void onMacroSelected(int iMacro); |
366 |
|
void setupMacros(); |
367 |
|
void onMacrosSetupChanged(const std::vector<Serialization::Archive>& macros); |
368 |
|
void applyMacro(Serialization::Archive& macro); |
369 |
|
void onScriptSlotsModified(gig::Instrument* pInstrument); |
370 |
|
void bringToFront(); |
371 |
|
|
372 |
void dimreg_all_dimregs_toggled(); |
void dimreg_all_dimregs_toggled(); |
373 |
gig::Instrument* get_instrument(); |
gig::Instrument* get_instrument(); |
374 |
void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs); |
void add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs); |
377 |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
378 |
public: |
public: |
379 |
ModelColumns() { |
ModelColumns() { |
380 |
|
add(m_col_nr); |
381 |
add(m_col_name); |
add(m_col_name); |
382 |
add(m_col_instr); |
add(m_col_instr); |
383 |
|
add(m_col_scripts); |
384 |
|
add(m_col_tooltip); |
385 |
} |
} |
386 |
|
|
387 |
|
Gtk::TreeModelColumn<int> m_col_nr; |
388 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
389 |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
390 |
|
Gtk::TreeModelColumn<Glib::ustring> m_col_scripts; |
391 |
|
Gtk::TreeModelColumn<Glib::ustring> m_col_tooltip; |
392 |
} m_Columns; |
} m_Columns; |
393 |
|
|
394 |
Gtk::VBox m_VBox; |
VBox m_VBox; |
395 |
Gtk::HPaned m_HPaned; |
Gtk::HPaned m_HPaned; |
396 |
|
|
397 |
Gtk::ScrolledWindow m_ScrolledWindow; |
Gtk::ScrolledWindow m_ScrolledWindow; |
398 |
|
|
399 |
Gtk::TreeView m_TreeView; |
Gtk::TreeView m_TreeView; |
400 |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
Glib::RefPtr<Gtk::ListStore> m_refTreeModel; |
401 |
|
Glib::RefPtr<Gtk::TreeModelFilter> m_refTreeModelFilter; //FIXME: I really would love to get rid of TreeModelFilter, because it causes behavior conflicts with get_model() all over the place (see the respective comments regarding get_model()), however I found no other way to filter a treeview effectively. |
402 |
|
|
403 |
|
#if USE_GTKMM_BUILDER |
404 |
|
Gtk::Menu* menuMacro; |
405 |
|
#else |
406 |
|
Gtk::Menu* instrument_menu; // kept for GTKMM 2 version only, will be completely removed in future |
407 |
|
#endif |
408 |
|
Gtk::Menu* assign_scripts_menu; |
409 |
|
|
410 |
|
std::map<gig::Sample*,int> sample_ref_count; |
411 |
|
|
412 |
class SamplesModel : public Gtk::TreeModel::ColumnRecord { |
class SamplesModel : public Gtk::TreeModel::ColumnRecord { |
413 |
public: |
public: |
415 |
add(m_col_name); |
add(m_col_name); |
416 |
add(m_col_sample); |
add(m_col_sample); |
417 |
add(m_col_group); |
add(m_col_group); |
418 |
|
add(m_col_refcount); |
419 |
|
add(m_color); |
420 |
} |
} |
421 |
|
|
422 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
423 |
Gtk::TreeModelColumn<gig::Sample*> m_col_sample; |
Gtk::TreeModelColumn<gig::Sample*> m_col_sample; |
424 |
Gtk::TreeModelColumn<gig::Group*> m_col_group; |
Gtk::TreeModelColumn<gig::Group*> m_col_group; |
425 |
|
Gtk::TreeModelColumn<Glib::ustring> m_col_refcount; |
426 |
|
Gtk::TreeModelColumn<Glib::ustring> m_color; |
427 |
} m_SamplesModel; |
} m_SamplesModel; |
428 |
|
|
429 |
class SamplesTreeStore : public Gtk::TreeStore { |
class SamplesTreeStore : public Gtk::TreeStore { |
439 |
Gtk::TreeView m_TreeViewSamples; |
Gtk::TreeView m_TreeViewSamples; |
440 |
Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel; |
Glib::RefPtr<SamplesTreeStore> m_refSamplesTreeModel; |
441 |
|
|
442 |
Gtk::VBox dimreg_vbox; |
class ScriptsModel : public Gtk::TreeModel::ColumnRecord { |
443 |
Gtk::HBox dimreg_hbox; |
public: |
444 |
|
ScriptsModel() { |
445 |
|
add(m_col_name); |
446 |
|
add(m_col_script); |
447 |
|
add(m_col_group); |
448 |
|
} |
449 |
|
|
450 |
|
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
451 |
|
Gtk::TreeModelColumn<gig::Script*> m_col_script; |
452 |
|
Gtk::TreeModelColumn<gig::ScriptGroup*> m_col_group; |
453 |
|
} m_ScriptsModel; |
454 |
|
|
455 |
|
class ScriptsTreeStore : public Gtk::TreeStore { |
456 |
|
public: |
457 |
|
static Glib::RefPtr<ScriptsTreeStore> create(const ScriptsModel& columns) { |
458 |
|
return Glib::RefPtr<ScriptsTreeStore>( new ScriptsTreeStore(columns) ); |
459 |
|
} |
460 |
|
protected: |
461 |
|
ScriptsTreeStore(const ScriptsModel& columns) : Gtk::TreeStore(columns) {} |
462 |
|
}; |
463 |
|
|
464 |
|
Gtk::ScrolledWindow m_ScrolledWindowScripts; |
465 |
|
Gtk::TreeView m_TreeViewScripts; |
466 |
|
Glib::RefPtr<ScriptsTreeStore> m_refScriptsTreeModel; |
467 |
|
|
468 |
|
VBox dimreg_vbox; |
469 |
|
HBox dimreg_hbox; |
470 |
Gtk::Label dimreg_label; |
Gtk::Label dimreg_label; |
471 |
Gtk::CheckButton dimreg_all_regions; |
Gtk::CheckButton dimreg_all_regions; |
472 |
Gtk::CheckButton dimreg_all_dimregs; |
Gtk::CheckButton dimreg_all_dimregs; |
473 |
Gtk::CheckButton dimreg_stereo; |
Gtk::CheckButton dimreg_stereo; |
474 |
|
|
475 |
|
HBox legend_hbox; |
476 |
|
Gtk::Label labelLegend; |
477 |
|
Gtk::Image imageNoSample; |
478 |
|
Gtk::Label labelNoSample; |
479 |
|
Gtk::Image imageMissingSample; |
480 |
|
Gtk::Label labelMissingSample; |
481 |
|
Gtk::Image imageLooped; |
482 |
|
Gtk::Label labelLooped; |
483 |
|
Gtk::Image imageSomeLoops; |
484 |
|
Gtk::Label labelSomeLoops; |
485 |
DimRegionEdit dimreg_edit; |
DimRegionEdit dimreg_edit; |
486 |
|
|
487 |
Gtk::Notebook m_Notebook; |
VBox m_left_vbox; |
488 |
Gtk::Notebook m_TreeViewNotebook; |
Gtk::Notebook m_TreeViewNotebook; |
489 |
|
HBox m_searchField; |
490 |
|
Gtk::Label m_searchLabel; |
491 |
|
Gtk::Entry m_searchText; |
492 |
|
|
493 |
struct SampleImportItem { |
struct SampleImportItem { |
494 |
gig::Sample* gig_sample; // pointer to the gig::Sample to |
gig::Sample* gig_sample; // pointer to the gig::Sample to |
497 |
Glib::ustring sample_path; // file name of the sample to be |
Glib::ustring sample_path; // file name of the sample to be |
498 |
// imported |
// imported |
499 |
}; |
}; |
500 |
std::list<SampleImportItem> m_SampleImportQueue; |
std::map<gig::Sample*, SampleImportItem> m_SampleImportQueue; |
501 |
|
|
502 |
|
|
503 |
void on_action_file_new(); |
void on_action_file_new(); |
507 |
void on_action_file_properties(); |
void on_action_file_properties(); |
508 |
void on_action_quit(); |
void on_action_quit(); |
509 |
void show_instr_props(); |
void show_instr_props(); |
510 |
|
bool instr_props_set_instrument(); |
511 |
|
void show_midi_rules(); |
512 |
|
void show_script_slots(); |
513 |
void on_action_view_status_bar(); |
void on_action_view_status_bar(); |
514 |
|
void on_auto_restore_win_dim(); |
515 |
|
void on_save_with_temporary_file(); |
516 |
|
void on_action_refresh_all(); |
517 |
|
void on_action_warn_user_on_extensions(); |
518 |
|
void on_action_show_tooltips(); |
519 |
|
void on_show_tooltips_changed(); |
520 |
|
void on_action_sync_sampler_instrument_selection(); |
521 |
|
void on_action_move_root_note_with_region_moved(); |
522 |
void on_action_help_about(); |
void on_action_help_about(); |
523 |
|
|
524 |
|
void on_notebook_tab_switched(void* page, guint page_num); |
525 |
|
|
526 |
// sample right-click popup actions |
// sample right-click popup actions |
527 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
528 |
|
bool on_sample_treeview_button_release(Gdk::EventButton& button); |
529 |
|
#else |
530 |
void on_sample_treeview_button_release(GdkEventButton* button); |
void on_sample_treeview_button_release(GdkEventButton* button); |
531 |
|
#endif |
532 |
void on_action_sample_properties(); |
void on_action_sample_properties(); |
533 |
void on_action_add_group(); |
void on_action_add_group(); |
534 |
void on_action_add_sample(); |
void on_action_add_sample(); |
535 |
|
void on_action_replace_sample(); |
536 |
|
void on_action_replace_all_samples_in_all_groups(); |
537 |
void on_action_remove_sample(); |
void on_action_remove_sample(); |
538 |
|
void on_action_remove_unused_samples(); |
539 |
|
|
540 |
|
// script right-click popup actions |
541 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
542 |
|
bool on_script_treeview_button_release(Gdk::EventButton& button); |
543 |
|
#else |
544 |
|
void on_script_treeview_button_release(GdkEventButton* button); |
545 |
|
#endif |
546 |
|
void on_action_add_script_group(); |
547 |
|
void on_action_add_script(); |
548 |
|
void on_action_edit_script(); |
549 |
|
void on_action_remove_script(); |
550 |
|
|
551 |
void on_action_add_instrument(); |
void on_action_add_instrument(); |
552 |
|
void on_action_duplicate_instrument(); |
553 |
void on_action_remove_instrument(); |
void on_action_remove_instrument(); |
554 |
|
|
555 |
LoadDialog* load_dialog; |
void show_samples_tab(); |
556 |
|
void show_intruments_tab(); |
557 |
|
void show_scripts_tab(); |
558 |
|
|
559 |
|
void select_prev_instrument(); |
560 |
|
void select_next_instrument(); |
561 |
|
void select_instrument_by_dir(int dir); |
562 |
|
|
563 |
|
void select_prev_region(); |
564 |
|
void select_next_region(); |
565 |
|
|
566 |
|
void select_next_dim_rgn_zone(); |
567 |
|
void select_prev_dim_rgn_zone(); |
568 |
|
void select_add_next_dim_rgn_zone(); |
569 |
|
void select_add_prev_dim_rgn_zone(); |
570 |
|
void select_prev_dimension(); |
571 |
|
void select_next_dimension(); |
572 |
|
|
573 |
|
Serialization::Archive m_serializationArchive; ///< Clipboard content. |
574 |
|
std::vector<Serialization::Archive> m_macros; ///< User configured list of macros. |
575 |
|
|
576 |
|
void copy_selected_dimrgn(); |
577 |
|
void paste_copied_dimrgn(); |
578 |
|
void adjust_clipboard_content(); |
579 |
|
void updateClipboardCopyAvailable(); |
580 |
|
void updateClipboardPasteAvailable(); |
581 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
582 |
|
void on_clipboard_owner_change(Gdk::EventOwnerChange& event); |
583 |
|
#else |
584 |
|
void on_clipboard_owner_change(GdkEventOwnerChange* event); |
585 |
|
#endif |
586 |
|
void on_clipboard_get(Gtk::SelectionData& selection_data, guint info); |
587 |
|
void on_clipboard_clear(); |
588 |
|
void on_clipboard_received(const Gtk::SelectionData& selection_data); |
589 |
|
void on_clipboard_received_targets(const std::vector<Glib::ustring>& targets); |
590 |
|
|
591 |
|
void add_instrument(gig::Instrument* instrument); |
592 |
|
#if !USE_GTKMM_BUILDER |
593 |
|
Gtk::RadioMenuItem* add_instrument_to_menu(const Glib::ustring& name, |
594 |
|
int position = -1); |
595 |
|
void remove_instrument_from_menu(int index); |
596 |
|
#endif |
597 |
|
bool onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip); |
598 |
|
|
599 |
|
ProgressDialog* progress_dialog; |
600 |
Loader* loader; |
Loader* loader; |
601 |
|
Saver* saver; |
602 |
void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false); |
void load_gig(gig::File* gig, const char* filename, bool isSharedInstrument = false); |
603 |
|
void updateSampleRefCountMap(gig::File* gig); |
604 |
|
|
605 |
gig::File* file; |
gig::File* file; |
606 |
bool file_is_shared; |
bool file_is_shared; |
607 |
bool file_has_name; |
bool file_has_name; |
608 |
bool file_is_changed; |
bool file_is_changed; |
609 |
std::string filename; |
std::string filename; |
610 |
std::string current_dir; |
std::string current_gig_dir; |
611 |
|
std::string current_sample_dir; |
612 |
|
|
613 |
void set_file_is_shared(bool); |
void set_file_is_shared(bool); |
614 |
|
|
616 |
bool file_save_as(); |
bool file_save_as(); |
617 |
bool check_if_savable(); |
bool check_if_savable(); |
618 |
|
|
619 |
|
#if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 91 || (GTKMM_MINOR_VERSION == 91 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.91.2 |
620 |
|
bool on_button_release(Gdk::EventButton& button); |
621 |
|
#else |
622 |
void on_button_release(GdkEventButton* button); |
void on_button_release(GdkEventButton* button); |
623 |
|
#endif |
624 |
|
void on_instruments_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
625 |
|
void on_instruments_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
626 |
|
Gtk::SelectionData& selection_data, guint, guint); |
627 |
|
void on_instruments_treeview_drop_drag_data_received( |
628 |
|
const Glib::RefPtr<Gdk::DragContext>& context, int, int, |
629 |
|
const Gtk::SelectionData& selection_data, guint, guint time |
630 |
|
); |
631 |
|
void on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
632 |
|
void on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
633 |
|
Gtk::SelectionData& selection_data, guint, guint); |
634 |
void on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
void on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
635 |
void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
void on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
636 |
Gtk::SelectionData& selection_data, guint, guint); |
Gtk::SelectionData& selection_data, guint, guint); |
639 |
const Gtk::SelectionData& selection_data, |
const Gtk::SelectionData& selection_data, |
640 |
guint, guint time); |
guint, guint time); |
641 |
|
|
642 |
|
void script_name_changed(const Gtk::TreeModel::Path& path, |
643 |
|
const Gtk::TreeModel::iterator& iter); |
644 |
|
void script_double_clicked(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column); |
645 |
void sample_name_changed(const Gtk::TreeModel::Path& path, |
void sample_name_changed(const Gtk::TreeModel::Path& path, |
646 |
const Gtk::TreeModel::iterator& iter); |
const Gtk::TreeModel::iterator& iter); |
647 |
void instrument_name_changed(const Gtk::TreeModel::Path& path, |
void instrument_name_changed(const Gtk::TreeModel::Path& path, |
648 |
const Gtk::TreeModel::iterator& iter); |
const Gtk::TreeModel::iterator& iter); |
649 |
|
void instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it); |
650 |
|
bool instrument_row_visible(const Gtk::TreeModel::const_iterator& iter); |
651 |
|
sigc::connection instrument_name_connection; |
652 |
|
|
653 |
|
void on_action_combine_instruments(); |
654 |
|
void on_action_view_references(); |
655 |
|
void on_action_merge_files(); |
656 |
|
void mergeFiles(const std::vector<std::string>& filenames); |
657 |
|
|
658 |
|
void on_sample_ref_changed(gig::Sample* oldSample, gig::Sample* newSample); |
659 |
|
void on_sample_ref_count_incremented(gig::Sample* sample, int offset); |
660 |
|
void on_samples_to_be_removed(std::list<gig::Sample*> samples); |
661 |
|
|
662 |
|
void add_or_replace_sample(bool replace); |
663 |
|
|
664 |
void __import_queued_samples(); |
void __import_queued_samples(); |
665 |
void __clear(); |
void __clear(); |
666 |
|
void __refreshEntireGUI(); |
667 |
|
void updateScriptListOfMenu(); |
668 |
|
void assignScript(gig::Script* pScript); |
669 |
|
void dropAllScriptSlots(); |
670 |
|
|
671 |
bool close_confirmation_dialog(); |
bool close_confirmation_dialog(); |
672 |
bool leaving_shared_mode_dialog(); |
bool leaving_shared_mode_dialog(); |
673 |
|
|
674 |
Gtk::Menu* popup_menu; |
Gtk::Menu* popup_menu; |
675 |
|
#if USE_GTKMM_BUILDER |
676 |
|
Gtk::Menu* sample_popup; |
677 |
|
Gtk::Menu* script_popup; |
678 |
|
#endif |
679 |
|
|
680 |
bool on_delete_event(GdkEventAny* event); |
bool on_delete_event(GdkEventAny* event); |
681 |
|
|
682 |
bool first_call_to_drag_data_get; |
bool first_call_to_drag_data_get; |
683 |
|
|
684 |
|
bool is_copy_samples_unity_note_enabled() const; |
685 |
|
bool is_copy_samples_fine_tune_enabled() const; |
686 |
|
bool is_copy_samples_loop_enabled() const; |
687 |
}; |
}; |
688 |
|
|
689 |
#endif |
#endif |