NOOP, remove trailing tabs/whitespace.
[ardour.git] / gtk2_ardour / ardour_ui2.cc
index 3459d0373f086f8c984e286bd062a43bc800d8f2..d8a1f218ec31ebc30a9f6d21a68e72c2a06c0300 100644 (file)
@@ -216,13 +216,15 @@ ARDOUR_UI::tearoff_settings (const char* name) const
        return 0;
 }
 
+#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
+
 void
 ARDOUR_UI::setup_transport ()
 {
        RefPtr<Action> act;
 
-       transport_tearoff_hbox.set_border_width (3);
-       transport_tearoff_hbox.set_spacing (3);
+       transport_tearoff_hbox.set_border_width (PX_SCALE(3));
+       transport_tearoff_hbox.set_spacing (PX_SCALE(3));
 
        transport_tearoff = manage (new TearOff (transport_tearoff_hbox));
        transport_tearoff->set_name ("TransportBase");
@@ -256,7 +258,8 @@ ARDOUR_UI::setup_transport ()
 
 //     auto_input_button.set_text (_("Auto Input"));
 
-       click_button.set_image (get_icon (X_("metronome")));
+       click_button.set_icon (ArdourIcon::TransportMetronom);
+
        act = ActionManager::get_action ("Transport", "ToggleClick");
        click_button.set_related_action (act);
        click_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::click_button_clicked), false);
@@ -272,19 +275,15 @@ ARDOUR_UI::setup_transport ()
 
        stop_button.set_active (true);
 
-       goto_start_button.set_image (get_icon (X_("transport_start")));
-       goto_end_button.set_image (get_icon (X_("transport_end")));
-       roll_button.set_image (get_icon (X_("transport_play")));
-       stop_button.set_image (get_icon (X_("transport_stop")));
-       play_selection_button.set_image (get_icon (X_("transport_range")));
-       auto_loop_button.set_image (get_icon (X_("transport_loop")));
-
-       rec_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::RecButton));
+       goto_start_button.set_icon (ArdourIcon::TransportStart);
+       goto_end_button.set_icon (ArdourIcon::TransportEnd);
+       roll_button.set_icon (ArdourIcon::TransportPlay);
+       stop_button.set_icon (ArdourIcon::TransportStop);
+       play_selection_button.set_icon (ArdourIcon::TransportRange);
+       auto_loop_button.set_icon (ArdourIcon::TransportLoop);
+       rec_button.set_icon (ArdourIcon::RecButton);
+       midi_panic_button.set_icon (ArdourIcon::TransportPanic);
 
-       midi_panic_button.set_image (get_icon (X_("midi_panic")));
-       /* the icon for this has an odd aspect ratio, so fatten up the button */
-       midi_panic_button.set_size_request (25, -1);
-       
        act = ActionManager::get_action (X_("Transport"), X_("Stop"));
        stop_button.set_related_action (act);
        act = ActionManager::get_action (X_("Transport"), X_("Roll"));
@@ -325,22 +324,26 @@ ARDOUR_UI::setup_transport ()
        /* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */
 
        solo_alert_button.set_name ("rude solo");
-       solo_alert_button.signal_button_press_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::solo_alert_press), false);
+       act = ActionManager::get_action (X_("Main"), X_("cancel-solo"));
+       solo_alert_button.set_related_action (act);
        auditioning_alert_button.set_name ("rude audition");
        auditioning_alert_button.signal_button_press_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::audition_alert_press), false);
        feedback_alert_button.set_name ("feedback alert");
        feedback_alert_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::feedback_alert_press), false);
        error_alert_button.set_name ("error alert");
-       error_alert_button.signal_button_press_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::error_alert_press), false);
+       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"));
+       error_alert_button.set_related_action(act);
+       error_alert_button.set_fallthrough_to_parent(true);
 
        alert_box.set_homogeneous (true);
-       alert_box.set_spacing (2);
+       alert_box.set_spacing (PX_SCALE(2));
        alert_box.pack_start (solo_alert_button, true, true);
        alert_box.pack_start (auditioning_alert_button, true, true);
        alert_box.pack_start (feedback_alert_button, true, true);
 
        /* all transport buttons should be the same size vertically and
-        * horizontally 
+        * horizontally
         */
 
        Glib::RefPtr<SizeGroup> transport_button_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
@@ -352,7 +355,11 @@ ARDOUR_UI::setup_transport ()
        transport_button_size_group->add_widget (roll_button);
        transport_button_size_group->add_widget (stop_button);
 
-       goto_start_button.set_size_request (-1, 40);
+       /* the icon for this has an odd aspect ratio, so fatten up the button */
+       midi_panic_button.set_size_request (PX_SCALE(25), -1);
+       goto_start_button.set_size_request (PX_SCALE(28), PX_SCALE(44));
+       click_button.set_size_request (PX_SCALE(32), PX_SCALE(44));
+
 
        HBox* tbox1 = manage (new HBox);
        HBox* tbox2 = manage (new HBox);
@@ -364,9 +371,9 @@ ARDOUR_UI::setup_transport ()
        Alignment* a1 = manage (new Alignment);
        Alignment* a2 = manage (new Alignment);
 
-       tbox1->set_spacing (2);
-       tbox2->set_spacing (2);
-       tbox->set_spacing (2);
+       tbox1->set_spacing (PX_SCALE(2));
+       tbox2->set_spacing (PX_SCALE(2));
+       tbox->set_spacing (PX_SCALE(2));
 
        if (!Profile->get_trx()) {
                tbox1->pack_start (midi_panic_button, true, true, 5);
@@ -401,15 +408,15 @@ ARDOUR_UI::setup_transport ()
        if (!ARDOUR::Profile->get_small_screen() && !ARDOUR::Profile->get_trx()) {
                clock_box->pack_start (*secondary_clock, false, false);
        }
-       clock_box->set_spacing (3);
+       clock_box->set_spacing (PX_SCALE(3));
 
        shuttle_box = manage (new ShuttleControl);
        shuttle_box->show ();
-       
+
        VBox* transport_vbox = manage (new VBox);
        transport_vbox->set_name ("TransportBase");
        transport_vbox->set_border_width (0);
-       transport_vbox->set_spacing (3);
+       transport_vbox->set_spacing (PX_SCALE(3));
        transport_vbox->pack_start (*tbox, true, true, 0);
 
        if (!Profile->get_trx()) {
@@ -428,7 +435,7 @@ ARDOUR_UI::setup_transport ()
 
        VBox* auto_box = manage (new VBox);
        auto_box->set_homogeneous (true);
-       auto_box->set_spacing (2);
+       auto_box->set_spacing (PX_SCALE(2));
        auto_box->pack_start (sync_button, true, true);
        if (!ARDOUR::Profile->get_trx()) {
                auto_box->pack_start (follow_edits_button, true, true);
@@ -448,10 +455,6 @@ ARDOUR_UI::setup_transport ()
                transport_tearoff_hbox.pack_start (*time_info_box, false, false);
        }
 
-        if (ARDOUR::Profile->get_small_screen()) {
-                transport_tearoff_hbox.pack_start (_editor_transport_box, false, false);
-        }
-
        if (!ARDOUR::Profile->get_trx()) {
                transport_tearoff_hbox.pack_start (alert_box, false, false);
                transport_tearoff_hbox.pack_start (meter_box, false, false);
@@ -472,6 +475,7 @@ ARDOUR_UI::setup_transport ()
                transport_tearoff->set_state (*tnode);
        }
 }
+#undef PX_SCALE
 
 void
 ARDOUR_UI::detach_tearoff (Box* b, Widget* w)
@@ -524,19 +528,6 @@ ARDOUR_UI::audition_alert_press (GdkEventButton*)
        return true;
 }
 
-bool
-ARDOUR_UI::solo_alert_press (GdkEventButton*)
-{
-       if (_session) {
-               if (_session->soloing()) {
-                       _session->set_solo (_session->get_routes(), false);
-               } else if (_session->listening()) {
-                       _session->set_listen (_session->get_routes(), false);
-               }
-       }
-       return true;
-}
-
 bool
 ARDOUR_UI::feedback_alert_press (GdkEventButton *)
 {
@@ -544,12 +535,23 @@ ARDOUR_UI::feedback_alert_press (GdkEventButton *)
 }
 
 bool
-ARDOUR_UI::error_alert_press (GdkEventButton*)
+ARDOUR_UI::error_alert_press (GdkEventButton* ev)
 {
-       _log_not_acknowledged = LogLevelNone;
-       error_blink (false); // immediate acknowledge
-       UI::show_errors();
-       return true;
+       bool do_toggle = true;
+       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"));
+                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+                       if (tact && tact->get_active()) {
+                               do_toggle = false;
+                       }
+               }
+               _log_not_acknowledged = LogLevelNone;
+               error_blink (false); // immediate acknowledge
+       }
+       // maybe fall through to to button toggle
+       return !do_toggle;
 }
 
 void
@@ -633,23 +635,18 @@ ARDOUR_UI::error_blink (bool onoff)
                        // blink
                        if (onoff) {
                                error_alert_button.set_custom_led_color(0xff0000ff); // bright red
-                               error_alert_button.set_active (true);
                        } else {
                                error_alert_button.set_custom_led_color(0x880000ff); // dark red
-                               error_alert_button.set_active (false);
                        }
                        break;
                case LogLevelWarning:
                        error_alert_button.set_custom_led_color(0xccaa00ff); // yellow
-                       error_alert_button.set_active (true);
                        break;
                case LogLevelInfo:
                        error_alert_button.set_custom_led_color(0x88cc00ff); // lime green
-                       error_alert_button.set_active (true);
                        break;
                default:
                        error_alert_button.set_custom_led_color(0x333333ff); // gray
-                       error_alert_button.set_active (false);
                        break;
        }
 }
@@ -669,7 +666,7 @@ ARDOUR_UI::editor_realized ()
        boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
        Config->map_parameters (pc);
 
-       reset_dpi ();
+       UIConfiguration::instance().reset_dpi ();
 }
 
 void
@@ -734,7 +731,7 @@ ARDOUR_UI::toggle_follow_edits ()
        RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
        assert (tact);
 
-       ui_config->set_follow_edits (tact->get_active ());
+       UIConfiguration::instance().set_follow_edits (tact->get_active ());
 }
 
-       
+