29 |
int argc = 1; |
int argc = 1; |
30 |
const char* argv_c[] = { "gigedit" }; |
const char* argv_c[] = { "gigedit" }; |
31 |
char** argv = const_cast<char**>(argv_c); |
char** argv = const_cast<char**>(argv_c); |
32 |
|
//FIXME: Gtk only allows to instantiate one Gtk::Main object per process, so this might crash other Gtk applications, i.e. launched as plugins by LinuxSampler |
33 |
|
Gtk::Main kit(argc, argv); |
34 |
|
|
35 |
static void __init_app() { |
static void __init_app() { |
36 |
setlocale(LC_ALL, ""); |
static bool process_initialized = false; |
37 |
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); |
if (!process_initialized) { |
38 |
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); |
std::cout << "Initializing 3rd party services needed by gigedit.\n" |
39 |
textdomain(GETTEXT_PACKAGE); |
<< std::flush; |
40 |
// make sure thread_init() is called once and ONLY once per process |
setlocale(LC_ALL, ""); |
41 |
if (!Glib::thread_supported()) Glib::thread_init(); |
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); |
42 |
|
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); |
43 |
|
textdomain(GETTEXT_PACKAGE); |
44 |
|
// make sure thread_init() is called once and ONLY once per process |
45 |
|
if (!Glib::thread_supported()) Glib::thread_init(); |
46 |
|
|
47 |
|
process_initialized = true; |
48 |
|
} |
49 |
} |
} |
50 |
|
|
51 |
static void __connect_signals(GigEdit* gigedit, MainWindow* mainwindow) { |
static void __connect_signals(GigEdit* gigedit, MainWindow* mainwindow) { |
83 |
|
|
84 |
int GigEdit::run() { |
int GigEdit::run() { |
85 |
__init_app(); |
__init_app(); |
|
Gtk::Main kit(argc, argv); |
|
86 |
MainWindow window; |
MainWindow window; |
87 |
__connect_signals(this, &window); |
__connect_signals(this, &window); |
88 |
kit.run(window); |
kit.run(window); |
91 |
|
|
92 |
int GigEdit::run(const char* pFileName) { |
int GigEdit::run(const char* pFileName) { |
93 |
__init_app(); |
__init_app(); |
|
Gtk::Main kit(argc, argv); |
|
94 |
MainWindow window; |
MainWindow window; |
95 |
__connect_signals(this, &window); |
__connect_signals(this, &window); |
96 |
if (pFileName) window.load_file(pFileName); |
if (pFileName) window.load_file(pFileName); |
100 |
|
|
101 |
int GigEdit::run(gig::Instrument* pInstrument) { |
int GigEdit::run(gig::Instrument* pInstrument) { |
102 |
__init_app(); |
__init_app(); |
|
Gtk::Main kit(argc, argv); |
|
103 |
MainWindow window; |
MainWindow window; |
104 |
__connect_signals(this, &window); |
__connect_signals(this, &window); |
105 |
if (pInstrument) window.load_instrument(pInstrument); |
if (pInstrument) window.load_instrument(pInstrument); |