1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006 - 2017 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 |
59 |
#include "dimregionchooser.h" |
#include "dimregionchooser.h" |
60 |
#include "dimregionedit.h" |
#include "dimregionedit.h" |
61 |
#include "midirules.h" |
#include "midirules.h" |
62 |
|
#ifdef GLIB_THREADS |
63 |
#ifndef OLD_THREADS |
#ifndef OLD_THREADS |
64 |
#include <glibmm/threads.h> |
#include <glibmm/threads.h> |
65 |
#endif |
#endif |
66 |
|
#else |
67 |
|
#include <thread> |
68 |
|
#include <mutex> |
69 |
|
#endif |
70 |
#include "ManagedWindow.h" |
#include "ManagedWindow.h" |
71 |
|
|
72 |
class MainWindow; |
class MainWindow; |
75 |
public PropEditor<DLS::Info> { |
public PropEditor<DLS::Info> { |
76 |
public: |
public: |
77 |
PropDialog(); |
PropDialog(); |
|
void set_info(DLS::Info* info); |
|
78 |
void set_file(gig::File* file); |
void set_file(gig::File* file); |
79 |
|
|
80 |
// implementation for abstract methods of interface class "ManagedWindow" |
// implementation for abstract methods of interface class "ManagedWindow" |
108 |
|
|
109 |
gig::File* m_file; |
gig::File* m_file; |
110 |
|
|
111 |
void onFileFormatChanged(); |
void set_FileFormat(int value); |
112 |
}; |
}; |
113 |
|
|
114 |
class InstrumentProps : public ManagedWindow, |
class InstrumentProps : public ManagedWindow, |
135 |
void set_MIDIProgram(uint32_t value); |
void set_MIDIProgram(uint32_t value); |
136 |
|
|
137 |
sigc::signal<void> sig_name_changed; |
sigc::signal<void> sig_name_changed; |
138 |
VBox vbox; |
Gtk::Notebook tabs; |
139 |
|
VBox vbox[3]; |
140 |
HButtonBox buttonBox; |
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 |
|
|
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 ProgressDialog : public Gtk::Dialog { |
class ProgressDialog : public Gtk::Dialog { |
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(); ///< Finished successfully, without error. |
Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error. |
191 |
Glib::Dispatcher& signal_error(); |
Glib::Dispatcher& signal_error(); |
192 |
void progress_callback(float fraction); |
void progress_callback(float fraction); |
193 |
float get_progress(); |
float get_progress(); |
194 |
|
void join(); |
195 |
const Glib::ustring filename; |
const Glib::ustring filename; |
196 |
Glib::ustring error_message; |
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 |
|
#ifdef GLIB_THREADS |
204 |
Glib::Threads::Thread* thread; |
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::Dispatcher error_dispatcher; |
Glib::Dispatcher error_dispatcher; |
|
Glib::Threads::Mutex progressMutex; |
|
215 |
float progress; |
float progress; |
216 |
}; |
}; |
217 |
|
|
218 |
class Saver : public sigc::trackable { |
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: |
public: |
228 |
Saver(gig::File* file, Glib::ustring filename = ""); ///< one argument means "save", two arguments means "save as" |
Saver(gig::File* file, Glib::ustring filename = ""); ///< one argument means "save", two arguments means "save as" |
|
void launch(); |
|
|
Glib::Dispatcher& signal_progress(); |
|
|
Glib::Dispatcher& signal_finished(); ///< Finished successfully, without error. |
|
|
Glib::Dispatcher& signal_error(); |
|
|
void progress_callback(float fraction); |
|
|
float get_progress(); |
|
|
gig::File* gig; |
|
|
const Glib::ustring filename; |
|
|
Glib::ustring error_message; |
|
229 |
|
|
230 |
private: |
private: |
231 |
Glib::Threads::Thread* thread; |
void thread_function_sub(gig::progress_t& progress); |
|
void thread_function(); |
|
|
Glib::Dispatcher finished_dispatcher; |
|
|
Glib::Dispatcher progress_dispatcher; |
|
|
Glib::Dispatcher error_dispatcher; |
|
|
Glib::Threads::Mutex progressMutex; |
|
|
float progress; |
|
232 |
}; |
}; |
233 |
|
|
234 |
class MainWindow : public ManagedWindow { |
class MainWindow : public ManagedWindow { |
666 |
void __refreshEntireGUI(); |
void __refreshEntireGUI(); |
667 |
void updateScriptListOfMenu(); |
void updateScriptListOfMenu(); |
668 |
void assignScript(gig::Script* pScript); |
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(); |
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; |
bool is_copy_samples_unity_note_enabled() const; |
685 |
bool is_copy_samples_fine_tune_enabled() const; |
bool is_copy_samples_fine_tune_enabled() const; |
686 |
bool is_copy_samples_loop_enabled() const; |
bool is_copy_samples_loop_enabled() const; |