--- gigedit/trunk/src/gigedit/gigedit.cpp 2008/01/30 02:20:48 1654 +++ gigedit/trunk/src/gigedit/gigedit.cpp 2008/12/28 09:58:05 1823 @@ -25,14 +25,6 @@ #include "global.h" -GigEditJob::GigEditJob() { - _msecs = 100; // 100ms by default -} - -int GigEditJob::msecs() { - return _msecs; -} - namespace { // State for a gigedit thread. @@ -48,7 +40,6 @@ GigEditState(GigEdit* parent) : parent(parent) { } void run(gig::Instrument* pInstrument); - static std::vector< GigEditJob* > timeoutJobs; MainWindow* window; private: @@ -96,7 +87,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(NULL); +#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 @@ -139,6 +147,12 @@ 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 @@ -168,10 +182,6 @@ return 0; } -void GigEdit::add_timeout_job(GigEditJob* job) { - GigEditState::timeoutJobs.push_back(job); -} - void GigEdit::on_note_on_event(int key, int velocity) { if (!this->state) return; GigEditState* state = (GigEditState*) this->state; @@ -220,11 +230,17 @@ 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; GigEditState* GigEditState::current = 0; -std::vector GigEditState::timeoutJobs; void GigEditState::open_window_static() { GigEditState* c = GigEditState::current; @@ -258,16 +274,6 @@ dispatcher->connect(sigc::ptr_fun(&GigEditState::open_window_static)); initialized->signal(); - for (int i = 0; i < GigEditState::timeoutJobs.size(); i++) { - GigEditJob* job = timeoutJobs[i]; - const Glib::RefPtr timeout_source = - Glib::TimeoutSource::create(job->msecs()); - timeout_source->connect( - sigc::mem_fun(*job, &GigEditJob::runGigEditJob) - ); - timeout_source->attach(Glib::MainContext::get_default()); - } - main_loop.run(); }