1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006 - 2015 Andreas Persson |
* Copyright (C) 2006 - 2017 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 |
|
#else |
26 |
|
# include <gig.h> |
27 |
|
#endif |
28 |
|
|
29 |
|
#include <gtkmm/box.h> |
30 |
#include <gtkmm/actiongroup.h> |
#include <gtkmm/actiongroup.h> |
31 |
#include <gtkmm/buttonbox.h> |
#include <gtkmm/buttonbox.h> |
32 |
#include <gtkmm/dialog.h> |
#include <gtkmm/dialog.h> |
51 |
#ifndef OLD_THREADS |
#ifndef OLD_THREADS |
52 |
#include <glibmm/threads.h> |
#include <glibmm/threads.h> |
53 |
#endif |
#endif |
54 |
|
#include "ManagedWindow.h" |
55 |
|
|
56 |
class MainWindow; |
class MainWindow; |
57 |
|
|
58 |
class PropDialog : public Gtk::Window, |
class PropDialog : public ManagedWindow, |
59 |
public PropEditor<DLS::Info> { |
public PropEditor<DLS::Info> { |
60 |
public: |
public: |
61 |
PropDialog(); |
PropDialog(); |
62 |
void set_info(DLS::Info* info); |
void set_info(DLS::Info* info); |
63 |
void set_file(gig::File* file); |
void set_file(gig::File* file); |
64 |
|
|
65 |
|
// implementation for abstract methods of interface class "ManagedWindow" |
66 |
|
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->filePropsWindowX; } |
67 |
|
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->filePropsWindowY; } |
68 |
|
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->filePropsWindowW; } |
69 |
|
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->filePropsWindowH; } |
70 |
|
|
71 |
protected: |
protected: |
72 |
ChoiceEntry<int> eFileFormat; |
ChoiceEntry<int> eFileFormat; |
73 |
StringEntry eName; |
StringEntry eName; |
96 |
void onFileFormatChanged(); |
void onFileFormatChanged(); |
97 |
}; |
}; |
98 |
|
|
99 |
class InstrumentProps : public Gtk::Window, |
class InstrumentProps : public ManagedWindow, |
100 |
public PropEditor<gig::Instrument> { |
public PropEditor<gig::Instrument> { |
101 |
public: |
public: |
102 |
InstrumentProps(); |
InstrumentProps(); |
106 |
sigc::signal<void>& signal_name_changed() { |
sigc::signal<void>& signal_name_changed() { |
107 |
return sig_name_changed; |
return sig_name_changed; |
108 |
} |
} |
109 |
|
|
110 |
|
// implementation for abstract methods of interface class "ManagedWindow" |
111 |
|
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->instrPropsWindowX; } |
112 |
|
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->instrPropsWindowY; } |
113 |
|
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->instrPropsWindowW; } |
114 |
|
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->instrPropsWindowH; } |
115 |
|
|
116 |
protected: |
protected: |
117 |
void set_Name(const gig::String& name); |
void set_Name(const gig::String& name); |
118 |
void set_IsDrum(bool value); |
void set_IsDrum(bool value); |
192 |
float progress; |
float progress; |
193 |
}; |
}; |
194 |
|
|
195 |
class MainWindow : public Gtk::Window { |
class MainWindow : public ManagedWindow { |
196 |
public: |
public: |
197 |
MainWindow(); |
MainWindow(); |
198 |
virtual ~MainWindow(); |
virtual ~MainWindow(); |
218 |
|
|
219 |
sigc::signal<void, gig::Instrument*>& signal_switch_sampler_instrument(); |
sigc::signal<void, gig::Instrument*>& signal_switch_sampler_instrument(); |
220 |
|
|
221 |
|
sigc::signal<void, gig::Script*> signal_script_to_be_changed; |
222 |
|
sigc::signal<void, gig::Script*> signal_script_changed; |
223 |
|
|
224 |
|
// implementation for abstract methods of interface class "ManagedWindow" |
225 |
|
virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->mainWindowX; } |
226 |
|
virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->mainWindowY; } |
227 |
|
virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->mainWindowW; } |
228 |
|
virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->mainWindowH; } |
229 |
|
|
230 |
protected: |
protected: |
231 |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
Glib::RefPtr<Gtk::ActionGroup> actionGroup; |
232 |
Glib::RefPtr<Gtk::UIManager> uiManager; |
Glib::RefPtr<Gtk::UIManager> uiManager; |
262 |
void on_sel_change(); |
void on_sel_change(); |
263 |
void region_changed(); |
void region_changed(); |
264 |
void dimreg_changed(); |
void dimreg_changed(); |
265 |
|
void select_instrument(gig::Instrument* instrument); |
266 |
|
bool select_dimension_region(gig::DimensionRegion* dimRgn); |
267 |
void select_sample(gig::Sample* sample); |
void select_sample(gig::Sample* sample); |
268 |
void on_loader_progress(); |
void on_loader_progress(); |
269 |
void on_loader_finished(); |
void on_loader_finished(); |
280 |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
281 |
public: |
public: |
282 |
ModelColumns() { |
ModelColumns() { |
283 |
|
add(m_col_nr); |
284 |
add(m_col_name); |
add(m_col_name); |
285 |
add(m_col_instr); |
add(m_col_instr); |
286 |
} |
} |
287 |
|
|
288 |
|
Gtk::TreeModelColumn<int> m_col_nr; |
289 |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
Gtk::TreeModelColumn<Glib::ustring> m_col_name; |
290 |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
Gtk::TreeModelColumn<gig::Instrument*> m_col_instr; |
291 |
} m_Columns; |
} m_Columns; |
364 |
Gtk::CheckButton dimreg_all_regions; |
Gtk::CheckButton dimreg_all_regions; |
365 |
Gtk::CheckButton dimreg_all_dimregs; |
Gtk::CheckButton dimreg_all_dimregs; |
366 |
Gtk::CheckButton dimreg_stereo; |
Gtk::CheckButton dimreg_stereo; |
367 |
|
|
368 |
|
Gtk::HBox legend_hbox; |
369 |
|
Gtk::Label labelLegend; |
370 |
|
Gtk::Image imageNoSample; |
371 |
|
Gtk::Label labelNoSample; |
372 |
|
Gtk::Image imageMissingSample; |
373 |
|
Gtk::Label labelMissingSample; |
374 |
|
Gtk::Image imageLooped; |
375 |
|
Gtk::Label labelLooped; |
376 |
|
Gtk::Image imageSomeLoops; |
377 |
|
Gtk::Label labelSomeLoops; |
378 |
DimRegionEdit dimreg_edit; |
DimRegionEdit dimreg_edit; |
379 |
|
|
380 |
Gtk::Notebook m_TreeViewNotebook; |
Gtk::Notebook m_TreeViewNotebook; |
386 |
Glib::ustring sample_path; // file name of the sample to be |
Glib::ustring sample_path; // file name of the sample to be |
387 |
// imported |
// imported |
388 |
}; |
}; |
389 |
std::list<SampleImportItem> m_SampleImportQueue; |
std::map<gig::Sample*, SampleImportItem> m_SampleImportQueue; |
390 |
|
|
391 |
|
|
392 |
void on_action_file_new(); |
void on_action_file_new(); |
400 |
void show_midi_rules(); |
void show_midi_rules(); |
401 |
void show_script_slots(); |
void show_script_slots(); |
402 |
void on_action_view_status_bar(); |
void on_action_view_status_bar(); |
403 |
|
void on_auto_restore_win_dim(); |
404 |
|
void on_save_with_temporary_file(); |
405 |
|
void on_action_refresh_all(); |
406 |
void on_action_warn_user_on_extensions(); |
void on_action_warn_user_on_extensions(); |
407 |
void on_action_sync_sampler_instrument_selection(); |
void on_action_sync_sampler_instrument_selection(); |
408 |
|
void on_action_move_root_note_with_region_moved(); |
409 |
void on_action_help_about(); |
void on_action_help_about(); |
410 |
|
|
411 |
// sample right-click popup actions |
// sample right-click popup actions |
413 |
void on_action_sample_properties(); |
void on_action_sample_properties(); |
414 |
void on_action_add_group(); |
void on_action_add_group(); |
415 |
void on_action_add_sample(); |
void on_action_add_sample(); |
416 |
|
void on_action_replace_sample(); |
417 |
void on_action_replace_all_samples_in_all_groups(); |
void on_action_replace_all_samples_in_all_groups(); |
418 |
void on_action_remove_sample(); |
void on_action_remove_sample(); |
419 |
|
void on_action_remove_unused_samples(); |
420 |
|
|
421 |
// script right-click popup actions |
// script right-click popup actions |
422 |
void on_script_treeview_button_release(GdkEventButton* button); |
void on_script_treeview_button_release(GdkEventButton* button); |
423 |
void on_action_add_script_group(); |
void on_action_add_script_group(); |
459 |
bool check_if_savable(); |
bool check_if_savable(); |
460 |
|
|
461 |
void on_button_release(GdkEventButton* button); |
void on_button_release(GdkEventButton* button); |
462 |
|
void on_instruments_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
463 |
|
void on_instruments_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
464 |
|
Gtk::SelectionData& selection_data, guint, guint); |
465 |
|
void on_instruments_treeview_drop_drag_data_received( |
466 |
|
const Glib::RefPtr<Gdk::DragContext>& context, int, int, |
467 |
|
const Gtk::SelectionData& selection_data, guint, guint time |
468 |
|
); |
469 |
void on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
void on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context); |
470 |
void on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
void on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, |
471 |
Gtk::SelectionData& selection_data, guint, guint); |
Gtk::SelectionData& selection_data, guint, guint); |
496 |
void on_sample_ref_count_incremented(gig::Sample* sample, int offset); |
void on_sample_ref_count_incremented(gig::Sample* sample, int offset); |
497 |
void on_samples_to_be_removed(std::list<gig::Sample*> samples); |
void on_samples_to_be_removed(std::list<gig::Sample*> samples); |
498 |
|
|
499 |
|
void add_or_replace_sample(bool replace); |
500 |
|
|
501 |
void __import_queued_samples(); |
void __import_queued_samples(); |
502 |
void __clear(); |
void __clear(); |
503 |
void __refreshEntireGUI(); |
void __refreshEntireGUI(); |