X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fgtk_ui.cc;h=e220a37a280f94eb3f23bb66b631fc822843db45;hb=a2fd790252b651fae8ccf2a3d7e35c3d7cf65a30;hp=0c15e5e3ccb247ef8ebee60656ee1b57bfff5fee;hpb=be6a43d4d30f321cc7a3105aaf34ab6c76de6ce0;p=ardour.git diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index 0c15e5e3cc..e220a37a28 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -35,6 +35,7 @@ #include "pbd/replace_all.h" #include "gtkmm2ext/application.h" +#include "gtkmm2ext/bindings.h" #include "gtkmm2ext/gtk_ui.h" #include "gtkmm2ext/textviewer.h" #include "gtkmm2ext/popup.h" @@ -53,7 +54,8 @@ using namespace Glib; using namespace PBD; using std::map; -UI *UI::theGtkUI = 0; +UI* UI::theGtkUI = 0; +float UI::ui_scale = 1.0; BaseUI::RequestType Gtkmm2ext::NullMessage = BaseUI::new_request_type(); BaseUI::RequestType Gtkmm2ext::ErrorMessage = BaseUI::new_request_type(); @@ -67,11 +69,11 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type(); template class AbstractUI; -UI::UI (string namestr, int *argc, char ***argv) - : AbstractUI (namestr) +UI::UI (string application_name, string thread_name, int *argc, char ***argv) + : AbstractUI (thread_name) , _receiver (*this) + , global_bindings (0) , errors (0) - { theMain = new Main (argc, argv); @@ -98,6 +100,10 @@ UI::UI (string namestr, int *argc, char ***argv) set_event_loop_for_thread (this); + /* we will be receiving requests */ + + EventLoop::register_request_buffer_factory ("gui", request_buffer_factory); + /* attach our request source to the default main context */ attach_request_source (); @@ -107,7 +113,7 @@ UI::UI (string namestr, int *argc, char ***argv) errors->text().set_name ("ErrorText"); errors->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("/Editor/toggle-log-window"))); - Glib::set_application_name(namestr); + Glib::set_application_name (application_name); WindowTitle title(Glib::get_application_name()); title += _("Log"); @@ -360,10 +366,22 @@ UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp) } if (action) { - Gtk::AccelKey key; - ustring ap = action->get_accel_path(); - if (!ap.empty()) { - string shortcut = ActionManager::get_key_representation (ap, key); + Bindings* bindings = (Bindings*) w->get_data ("ardour-bindings"); + if (!bindings) { + Gtk::Window* win = (Gtk::Window*) w->get_toplevel(); + if (win) { + bindings = (Bindings*) win->get_data ("ardour-bindings"); + } + } + + if (!bindings) { + bindings = global_bindings; + } + + if (bindings) { + Bindings::Operation op; + KeyboardKey kb = bindings->get_binding_for_action (action, op); + string shortcut = kb.display_label (); if (!shortcut.empty()) { replace_all (shortcut, "<", ""); replace_all (shortcut, ">", "-"); @@ -704,7 +722,7 @@ UI::popup_error (const string& text) MessageDialog msg (text); msg.set_title (string_compose (_("I'm sorry %1, I can't do that"), g_get_user_name())); - msg.set_wmclass (X_("error"), name()); + msg.set_wmclass (X_("error"), Glib::get_application_name()); msg.set_position (WIN_POS_MOUSE); msg.run (); }