Use the same logic to decide on step size when scroll-wheeling faders in the mixer...
[ardour.git] / libs / gtkmm2ext / gtk_ui.cc
index 7508b7e57f9a49ff6abd18725b483d7b5c7c8137..11b06b78ffe4595fbb9e4cf1102d252e56e20bab 100644 (file)
@@ -64,6 +64,8 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type();
 
 UI::UI (string namestr, int *argc, char ***argv)
        : AbstractUI<UIRequest> (namestr)
+       , _receiver (*this)
+         
 {
        theMain = new Main (argc, argv);
 
@@ -104,7 +106,7 @@ UI::UI (string namestr, int *argc, char ***argv)
        errors->set_title (title.get_string());
 
        errors->dismiss_button().set_name ("ErrorLogCloseButton");
-       errors->signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), (Window *) errors));
+       errors->signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), (Window *) errors));
        errors->set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
 
        //load_rcfile (rcfile);
@@ -252,10 +254,10 @@ UI::load_rcfile (string path, bool themechange)
 void
 UI::run (Receiver &old_receiver)
 {
-       listen_to (error);
-       listen_to (info);
-       listen_to (warning);
-       listen_to (fatal);
+       _receiver.listen_to (error);
+       _receiver.listen_to (info);
+       _receiver.listen_to (warning);
+       _receiver.listen_to (fatal);
 
        /* stop the old receiver (text/console) once we hit the first idle */
 
@@ -266,7 +268,7 @@ UI::run (Receiver &old_receiver)
        theMain->run ();
        _active = false;
        stopping ();
-       hangup ();
+       _receiver.hangup ();
        return;
 }
 
@@ -351,8 +353,13 @@ UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp)
                ustring ap = action->get_accel_path();
                if (!ap.empty()) {
                        bool has_key = ActionManager::lookup_entry(ap, key);
-                       if (has_key && key.get_abbrev() != "") {
-                               msg.append("\n\nKey: ").append(key.get_abbrev());
+                       if (has_key) {
+                               string  abbrev = key.get_abbrev();
+                               if (!abbrev.empty()) {
+                                       replace_all (abbrev, "<", "");
+                                       replace_all (abbrev, ">", "-");
+                                       msg.append(_("\n\nKey: ")).append (abbrev);
+                               }
                        }
                }
        }
@@ -361,8 +368,6 @@ UI::set_tip (Widget *w, const gchar *tip, const gchar *hlp)
                return;
        }
 
-       replace_all (msg, "<", "");
-       replace_all (msg, ">", "-");
 
        req->widget = w;
        req->msg = msg.c_str();
@@ -562,10 +567,15 @@ UI::process_error_message (Transmitter::Channel chn, const char *str)
                handle_fatal (str);
        } else {
 
-               display_message (prefix, prefix_len, ptag, mtag, str);
-
-               if (!errors->is_visible() && chn != Transmitter::Info) {
-                       show_errors ();
+               if (!ptag || !mtag) {
+                       /* oops, message sent before we set up tags - don't crash */
+                       cerr << prefix << str << endl;
+               } else {
+                       display_message (prefix, prefix_len, ptag, mtag, str);
+                       
+                       if (!errors->is_visible() && chn != Transmitter::Info) {
+                               show_errors ();
+                       }
                }
        }