--- gigedit/trunk/src/gigedit/gigedit.cpp 2008/02/02 08:18:19 1656 +++ gigedit/trunk/src/gigedit/gigedit.cpp 2009/05/10 09:35:56 1898 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Andreas Persson + * Copyright (C) 2007-2009 Andreas Persson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -79,6 +79,10 @@ void close_window(); }; +#ifdef WIN32 +HINSTANCE gigedit_dll_handle = 0; +#endif + void init_app() { static bool process_initialized = false; if (!process_initialized) { @@ -87,7 +91,24 @@ setlocale(LC_ALL, ""); #if HAVE_GETTEXT + +#ifdef WIN32 +#if GLIB_CHECK_VERSION(2, 16, 0) + gchar* root = + g_win32_get_package_installation_directory_of_module(gigedit_dll_handle); +#else + gchar* root = + g_win32_get_package_installation_directory(NULL, NULL); +#endif + gchar* temp = g_build_filename(root, "/share/locale", NULL); + g_free(root); + gchar* localedir = g_win32_locale_filename_from_utf8(temp); + g_free(temp); + bindtextdomain(GETTEXT_PACKAGE, localedir); + g_free(localedir); +#else bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); +#endif bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif // HAVE_GETTEXT @@ -127,9 +148,18 @@ mainwindow->signal_dimreg_changed().connect( gigedit->signal_dimreg_changed().make_slot() ); + mainwindow->signal_sample_changed().connect( + gigedit->signal_sample_changed().make_slot() + ); mainwindow->signal_sample_ref_changed().connect( gigedit->signal_sample_ref_changed().make_slot() ); + mainwindow->signal_keyboard_key_hit().connect( + gigedit->signal_keyboard_key_hit().make_slot() + ); + mainwindow->signal_keyboard_key_released().connect( + gigedit->signal_keyboard_key_released().make_slot() + ); } } // namespace @@ -203,10 +233,21 @@ return dimreg_changed_signal; } +sigc::signal& GigEdit::signal_sample_changed() { + return sample_changed_signal; +} + sigc::signal& GigEdit::signal_sample_ref_changed() { return sample_ref_changed_signal; } +sigc::signal& GigEdit::signal_keyboard_key_hit() { + return keyboard_key_hit_signal; +} + +sigc::signal& GigEdit::signal_keyboard_key_released() { + return keyboard_key_released_signal; +} Glib::StaticMutex GigEditState::mutex = GLIBMM_STATIC_MUTEX_INIT; Glib::Dispatcher* GigEditState::dispatcher = 0; @@ -267,3 +308,17 @@ mutex.unlock(); close.wait(); // sleep until window is closed } + +#if defined(WIN32) +extern "C" { + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) + { + switch (reason) { + case DLL_PROCESS_ATTACH: + gigedit_dll_handle = instance; + break; + } + return TRUE; + } +} +#endif