Fix gmsynth detection
[ardour.git] / gtk2_ardour / ardour_ui2.cc
index b200f82a83af5129c97bab21e82d5ecea33a6803..97d639fc1bb5990d995811b6aa4b6b867d79a89f 100644 (file)
@@ -108,6 +108,24 @@ ARDOUR_UI::status_bar_button_press (GdkEventButton* ev)
        return handled;
 }
 
+void
+ARDOUR_UI::display_message (const char* prefix, gint prefix_len, RefPtr<TextBuffer::Tag> ptag, RefPtr<TextBuffer::Tag> mtag, const char* msg)
+{
+       UI::display_message (prefix, prefix_len, ptag, mtag, msg);
+
+       ArdourLogLevel ll = LogLevelNone;
+
+       if (strcmp (prefix, _("[ERROR]: ")) == 0) {
+               ll = LogLevelError;
+       } else if (strcmp (prefix, _("[WARNING]: ")) == 0) {
+               ll = LogLevelWarning;
+       } else if (strcmp (prefix, _("[INFO]: ")) == 0) {
+               ll = LogLevelInfo;
+       }
+
+       _log_not_acknowledged = std::max(_log_not_acknowledged, ll);
+}
+
 XMLNode*
 ARDOUR_UI::tearoff_settings (const char* name) const
 {
@@ -237,42 +255,42 @@ ARDOUR_UI::setup_transport ()
        RefPtr<Action> act;
        /* setup actions */
 
-       act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
+       act = global_actions.find_action (X_("Transport"), X_("ToggleExternalSync"));
        sync_button.set_related_action (act);
        sync_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::sync_button_clicked), false);
 
        sync_button.set_sizing_text (S_("LogestSync|M-Clk"));
 
        /* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */
-       act = ActionManager::get_action (X_("Main"), X_("cancel-solo"));
+       act = global_actions.find_action (X_("Main"), X_("cancel-solo"));
        solo_alert_button.set_related_action (act);
        auditioning_alert_button.signal_clicked.connect (sigc::mem_fun(*this,&ARDOUR_UI::audition_alert_clicked));
        error_alert_button.signal_button_release_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::error_alert_press), false);
-       act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
+       act = editor->find_action (X_("Editor"), X_("toggle-log-window"));
        error_alert_button.set_related_action(act);
        error_alert_button.set_fallthrough_to_parent(true);
 
        layered_button.signal_clicked.connect (sigc::mem_fun(*this,&ARDOUR_UI::layered_button_clicked));
 
-       editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
-       mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility")));
-       prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility")));
+       editor_visibility_button.set_related_action (global_actions.find_action (X_("Common"), X_("change-editor-visibility")));
+       mixer_visibility_button.set_related_action (global_actions.find_action (X_("Common"), X_("change-mixer-visibility")));
+       prefs_visibility_button.set_related_action (global_actions.find_action (X_("Common"), X_("change-preferences-visibility")));
 
-       act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
+       act = global_actions.find_action ("Transport", "ToggleAutoReturn");
        auto_return_button.set_related_action (act);
-       act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
+       act = global_actions.find_action (X_("Transport"), X_("ToggleFollowEdits"));
        follow_edits_button.set_related_action (act);
-       act = ActionManager::get_action ("Transport", "ToggleAutoInput");
+       act = global_actions.find_action ("Transport", "ToggleAutoInput");
        auto_input_button.set_related_action (act);
 
-       act = ActionManager::get_action ("Transport", "TogglePunchIn");
+       act = global_actions.find_action ("Transport", "TogglePunchIn");
        punch_in_button.set_related_action (act);
-       act = ActionManager::get_action ("Transport", "TogglePunchOut");
+       act = global_actions.find_action ("Transport", "TogglePunchOut");
        punch_out_button.set_related_action (act);
 
-       act = ActionManager::get_action ("Transport", "SessionMonitorIn");
+       act = global_actions.find_action ("Transport", "SessionMonitorIn");
        monitor_in_button.set_related_action (act);
-       act = ActionManager::get_action ("Transport", "SessionMonitorDisk");
+       act = global_actions.find_action ("Transport", "SessionMonitorDisk");
        monitor_disk_button.set_related_action (act);
 
        /* connect signals */
@@ -576,7 +594,7 @@ ARDOUR_UI::error_alert_press (GdkEventButton* ev)
        if (ev->button == 1) {
                if (_log_not_acknowledged == LogLevelError) {
                        // just acknowledge the error, don't hide the log if it's already visible
-                       RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
+                       RefPtr<Action> act = editor->find_action (X_("Editor"), X_("toggle-log-window"));
                        Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
                        if (tact && tact->get_active()) {
                                do_toggle = false;
@@ -763,7 +781,7 @@ ARDOUR_UI::sync_button_clicked (GdkEventButton* ev)
 void
 ARDOUR_UI::toggle_follow_edits ()
 {
-       RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
+       RefPtr<Action> act = global_actions.find_action (X_("Transport"), X_("ToggleFollowEdits"));
        assert (act);
 
        RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
@@ -799,3 +817,21 @@ ARDOUR_UI::update_title ()
        }
 
 }
+
+void
+ARDOUR_UI::toggle_use_monitor_section ()
+{
+       RefPtr<Action> act = ActionManager::get_action (X_("Monitor"), "UseMonitorSection");
+       assert (act);  RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+       assert (tact);
+
+       bool yn = tact->get_active ();
+
+       if (yn) {
+               _session->add_monitor_section ();
+       } else {
+               _session->remove_monitor_section ();
+       }
+
+       Config->set_use_monitor_bus (yn);
+}