17 |
* 02110-1301 USA. |
* 02110-1301 USA. |
18 |
*/ |
*/ |
19 |
|
|
20 |
|
#include <glibmmconfig.h> |
21 |
|
// threads.h must be included first to be able to build with |
22 |
|
// G_DISABLE_DEPRECATED |
23 |
|
#if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \ |
24 |
|
(GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION > 31) || GLIBMM_MAJOR_VERSION > 2 |
25 |
|
#include <glibmm/threads.h> |
26 |
|
#endif |
27 |
|
|
28 |
#include "gigedit.h" |
#include "gigedit.h" |
29 |
|
|
30 |
|
#include <gtkmmconfig.h> |
31 |
|
#if GTKMM_MAJOR_VERSION < 3 |
32 |
|
#include <gdkmm/region.h> |
33 |
|
#endif |
34 |
#include <glibmm/dispatcher.h> |
#include <glibmm/dispatcher.h> |
35 |
#include <glibmm/main.h> |
#include <glibmm/main.h> |
36 |
#include <gtkmm/main.h> |
#include <gtkmm/main.h> |
51 |
#endif |
#endif |
52 |
|
|
53 |
//TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments below in this file for details) |
//TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments below in this file for details) |
54 |
#if defined(__APPLE__) // the following global external variables are defined in LinuxSampler's global_private.cpp ... |
#if defined(__APPLE__) && HAVE_LINUXSAMPLER // the following global external variables are defined in LinuxSampler's global_private.cpp ... |
55 |
extern bool g_mainThreadCallbackSupported; |
extern bool g_mainThreadCallbackSupported; |
56 |
extern void (*g_mainThreadCallback)(void* info); |
extern void (*g_mainThreadCallback)(void* info); |
57 |
extern void* g_mainThreadCallbackInfo; |
extern void* g_mainThreadCallbackInfo; |
70 |
// |
// |
71 |
class GigEditState : public sigc::trackable { |
class GigEditState : public sigc::trackable { |
72 |
public: |
public: |
73 |
GigEditState(GigEdit* parent) : parent(parent), instrument(NULL) { } |
GigEditState(GigEdit* parent) : |
74 |
|
window(0), parent(parent), instrument(0) { } |
75 |
void run(gig::Instrument* pInstrument); |
void run(gig::Instrument* pInstrument); |
76 |
|
|
77 |
MainWindow* window; |
MainWindow* window; |
251 |
mainwindow->signal_switch_sampler_instrument().connect( |
mainwindow->signal_switch_sampler_instrument().connect( |
252 |
gigedit->signal_switch_sampler_instrument().make_slot() |
gigedit->signal_switch_sampler_instrument().make_slot() |
253 |
); |
); |
254 |
|
mainwindow->signal_script_to_be_changed.connect( |
255 |
|
gigedit->signal_script_to_be_changed.make_slot() |
256 |
|
); |
257 |
|
mainwindow->signal_script_changed.connect( |
258 |
|
gigedit->signal_script_changed.make_slot() |
259 |
|
); |
260 |
} |
} |
261 |
|
|
262 |
} // namespace |
} // namespace |
299 |
|
|
300 |
void GigEdit::on_note_on_event(int key, int velocity) { |
void GigEdit::on_note_on_event(int key, int velocity) { |
301 |
if (!this->state) return; |
if (!this->state) return; |
302 |
GigEditState* state = (GigEditState*) this->state; |
GigEditState* state = static_cast<GigEditState*>(this->state); |
303 |
state->window->signal_note_on().emit(key, velocity); |
state->window->signal_note_on().emit(key, velocity); |
304 |
} |
} |
305 |
|
|
306 |
void GigEdit::on_note_off_event(int key, int velocity) { |
void GigEdit::on_note_off_event(int key, int velocity) { |
307 |
if (!this->state) return; |
if (!this->state) return; |
308 |
GigEditState* state = (GigEditState*) this->state; |
GigEditState* state = static_cast<GigEditState*>(this->state); |
309 |
state->window->signal_note_off().emit(key, velocity); |
state->window->signal_note_off().emit(key, velocity); |
310 |
} |
} |
311 |
|
|
429 |
static bool main_loop_started = false; |
static bool main_loop_started = false; |
430 |
instrument = pInstrument; |
instrument = pInstrument; |
431 |
if (!main_loop_started) { |
if (!main_loop_started) { |
432 |
#if defined(__APPLE__) |
#if defined(__APPLE__) && HAVE_LINUXSAMPLER |
433 |
// spawn GUI on main thread : |
// spawn GUI on main thread : |
434 |
// On OS X the Gtk GUI can only be launched on a process's "main" |
// On OS X the Gtk GUI can only be launched on a process's "main" |
435 |
// thread. When trying to launch the Gtk GUI on any other thread, |
// thread. When trying to launch the Gtk GUI on any other thread, |