more hot wine.
[ardour.git] / gtk2_ardour / ardour_ui2.cc
index f5f9f62b6613ce3bb8f996126cf82707b00f3301..3e8fde5dbb3d79c5d2e6731c958f620b93c0287d 100644 (file)
@@ -134,11 +134,11 @@ ARDOUR_UI::setup_tooltips ()
        set_tip (auto_loop_button, _("Play loop range"));
        set_tip (midi_panic_button, _("MIDI Panic\nSend note off and reset controller messages on all MIDI channels"));
        set_tip (auto_return_button, _("Return to last playback start when stopped"));
-       set_tip (follow_edits_button, _("Playhead follows Range Selections and Edits"));
+       set_tip (follow_edits_button, _("Playhead follows range selections and edits"));
        set_tip (auto_input_button, _("Be sensible about input monitoring"));
        set_tip (click_button, _("Enable/Disable audio click"));
        set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything"));
-       set_tip (auditioning_alert_button, _("When active, auditioning is taking place\nClick to stop the audition"));
+       set_tip (auditioning_alert_button, _("When active, auditioning is taking place.\nClick to stop the audition"));
        set_tip (feedback_alert_button, _("When active, there is a feedback loop."));
        set_tip (primary_clock, _("<b>Primary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
        set_tip (secondary_clock, _("<b>Secondary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
@@ -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,28 +275,15 @@ ARDOUR_UI::setup_transport ()
 
        stop_button.set_active (true);
 
-       goto_start_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
-       goto_start_button.set_icon (ArdourButton::BtnStart);
-       goto_end_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
-       goto_end_button.set_icon (ArdourButton::BtnEnd);
-       roll_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
-       roll_button.set_icon (ArdourButton::BtnPlay);
-       stop_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
-       stop_button.set_icon (ArdourButton::BtnStop);
-       play_selection_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
-       play_selection_button.set_icon (ArdourButton::BtnRange);
-
-       auto_loop_button.set_image (get_icon (X_("transport_loop")));
-
-       rec_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
-       rec_button.set_icon (ArdourButton::RecButton);
-
-       midi_panic_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
-       midi_panic_button.set_icon (ArdourButton::BtnPanic);
+       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);
 
-       /* 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"));
@@ -334,7 +324,8 @@ 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");
@@ -346,13 +337,13 @@ ARDOUR_UI::setup_transport ()
        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);
@@ -364,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);
@@ -376,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);
@@ -413,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()) {
@@ -440,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);
@@ -460,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);
@@ -484,6 +475,7 @@ ARDOUR_UI::setup_transport ()
                transport_tearoff->set_state (*tnode);
        }
 }
+#undef PX_SCALE
 
 void
 ARDOUR_UI::detach_tearoff (Box* b, Widget* w)
@@ -536,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 *)
 {
@@ -687,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
@@ -752,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 ());
 }
 
-       
+