Commence transport tool bar re-layout
authorRobin Gareus <robin@gareus.org>
Sun, 11 Dec 2016 16:24:30 +0000 (17:24 +0100)
committerRobin Gareus <robin@gareus.org>
Sat, 17 Dec 2016 01:43:42 +0000 (02:43 +0100)
12 files changed:
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dependents.cc
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h
gtk2_ardour/main_clock.cc
gtk2_ardour/main_clock.h
gtk2_ardour/rc_option_editor.cc
gtk2_ardour/time_info_box.cc
gtk2_ardour/time_info_box.h

index 637cc117103242ac23f33bf86c064fb5ec475277..0da611a153d2f6c0a47325baacf2ffb6e2f9248f 100644 (file)
@@ -432,6 +432,8 @@ private:
        void setup_transport ();
        void setup_clock ();
 
+       bool transport_expose (GdkEventExpose*);
+
        static ARDOUR_UI *theArdourUI;
        SessionDialog *_session_dialog;
 
@@ -473,19 +475,9 @@ private:
 
        /* Transport Control */
 
+       Gtk::Table               transport_table;
        Gtk::Frame               transport_frame;
        Gtk::HBox                transport_hbox;
-       Gtk::Fixed               transport_base;
-       Gtk::Fixed               transport_button_base;
-       Gtk::Frame               transport_button_frame;
-       Gtk::HBox                transport_button_hbox;
-       Gtk::VBox                transport_button_vbox;
-       Gtk::HBox                transport_option_button_hbox;
-       Gtk::VBox                transport_option_button_vbox;
-       Gtk::HBox                transport_clock_hbox;
-       Gtk::VBox                transport_clock_vbox;
-       Gtk::HBox                primary_clock_hbox;
-       Gtk::HBox                secondary_clock_hbox;
 
        struct TransportControllable : public PBD::Controllable {
            enum ToggleType {
@@ -526,6 +518,12 @@ private:
        ArdourButton auto_loop_button;
        ArdourButton play_selection_button;
        ArdourButton rec_button;
+       ArdourButton punch_in_button;
+       ArdourButton punch_out_button;
+       ArdourButton layered_button;
+
+       Gtk::Label   punch_label;
+       Gtk::Label   layered_label;
 
        void toggle_external_sync ();
        void toggle_time_master ();
@@ -571,8 +569,7 @@ private:
        void _auditioning_changed (bool);
 
        bool solo_alert_press (GdkEventButton* ev);
-       bool audition_alert_press (GdkEventButton* ev);
-       bool feedback_alert_press (GdkEventButton *);
+       void audition_alert_clicked ();
        bool error_alert_press (GdkEventButton *);
 
        void big_clock_value_changed ();
index c4404b824358f7030b86d6d7d93dfd3c09ae838b..ffbfd2ffd94de1f02a3a1344a98a1947ce1bf842 100644 (file)
@@ -179,52 +179,73 @@ bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult resu
        return false;
 }
 
-void
-ARDOUR_UI::setup_transport ()
+bool
+ARDOUR_UI::transport_expose (GdkEventExpose* ev)
 {
-       RefPtr<Action> act;
+       int x0, y0;
+       Gtk::Widget* window_parent;
+       Glib::RefPtr<Gdk::Window> win = Gtkmm2ext::window_to_draw_on (transport_table, &window_parent);
+       Glib::RefPtr<Gtk::Style> style = transport_table.get_style();
+       if (!win || !style) {
+               return false;
+       }
 
-       transport_hbox.set_border_width (PX_SCALE(3));
-       transport_hbox.set_spacing (PX_SCALE(3));
+       Cairo::RefPtr<Cairo::Context> cr = transport_table.get_window()->create_cairo_context ();
 
-       transport_base.set_name ("TransportBase");
-       transport_base.add (transport_hbox);
+       cr->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
+       cr->clip ();
 
-       transport_frame.set_shadow_type (SHADOW_OUT);
-       transport_frame.set_name ("BaseFrame");
-       transport_frame.add (transport_base);
+       transport_table.translate_coordinates (*window_parent, 0, 0, x0, y0);
 
-       auto_return_button.set_text(_("Auto Return"));
+       cr->rectangle (x0, y0, transport_table.get_width(), transport_table.get_height());
+       Gdk::Color bg (style->get_bg (transport_table.get_state()));
+       cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p());
+       cr->fill ();
 
-       follow_edits_button.set_text(_("Follow Edits"));
+       static const int xmargin = 2;
+       static const int ymargin = 1;
 
-//     auto_input_button.set_text (_("Auto Input"));
+       /* draw box around record-options */
+       int xx, ww, hh, uu;
 
-       click_button.set_icon (ArdourIcon::TransportMetronom);
+       punch_label.translate_coordinates (transport_table, -xmargin, 0, xx, uu); // left
+       punch_out_button.translate_coordinates (transport_table, xmargin, 0, ww, uu); // right
+       ww += punch_out_button.get_width () - xx; // width
+       hh = transport_table.get_height() - 1;
 
-       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);
+       Gtkmm2ext::rounded_rectangle (cr->cobj(), x0 + xx - 0.5, y0 + 0.5, ww + 1, hh, 6);
+       cr->set_source_rgb (0, 0, 0);
+       cr->set_line_width (1.0);
+       cr->stroke ();
 
-       auto_return_button.set_name ("transport option button");
-       follow_edits_button.set_name ("transport option button");
-       auto_input_button.set_name ("transport option button");
+       /* line to rec-enable */
+       int rx;
+       rec_button.translate_coordinates (transport_table, -xmargin, 0, rx, uu); // top
+       int dx = rx + rec_button.get_width() - xx;
 
-       /* these have to provide a clear indication of active state */
+       cr->move_to (x0 + xx, 1.5 + y0 + ymargin + round (punch_in_button.get_height () * .5));
+       cr->rel_line_to (dx, 0);
+       cr->stroke ();
 
-       click_button.set_name ("transport button");
-       sync_button.set_name ("transport active option button");
+       /* alert box */
+       gint ax;
+       solo_alert_button.translate_coordinates (transport_table, -xmargin, 0, ax, uu); // left
+       ww = solo_alert_button.get_width () + 2 * xmargin;
+       Gtkmm2ext::rounded_rectangle (cr->cobj(), x0 + ax - 0.5, y0 + 0.5, ww + 1, hh, 6);
+       cr->stroke ();
 
-       stop_button.set_active (true);
+       return false;
+}
 
-       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);
+void
+ARDOUR_UI::setup_transport ()
+{
+       RefPtr<Action> act;
+       /* setup actions */
+
+       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);
 
        act = ActionManager::get_action (X_("Transport"), X_("Stop"));
        stop_button.set_related_action (act);
@@ -245,200 +266,239 @@ ARDOUR_UI::setup_transport ()
        act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
        sync_button.set_related_action (act);
 
-       /* clocks, etc. */
-
-       ARDOUR_UI::Clock.connect (sigc::mem_fun (primary_clock, &AudioClock::set));
-       ARDOUR_UI::Clock.connect (sigc::mem_fun (secondary_clock, &AudioClock::set));
-
-       primary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
-       secondary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
-       big_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed));
-
-       act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
-       auto_return_button.set_related_action (act);
-       act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
-       follow_edits_button.set_related_action (act);
-       act = ActionManager::get_action ("Transport", "ToggleAutoInput");
-       auto_input_button.set_related_action (act);
-
-       /* alerts */
-
        /* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */
-
-       solo_alert_button.set_name ("rude solo");
        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");
+       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"));
        error_alert_button.set_related_action(act);
        error_alert_button.set_fallthrough_to_parent(true);
 
-       alert_box.set_homogeneous (true);
-       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);
+       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")));
 
-       /* all transport buttons should be the same size vertically and
-        * horizontally
-        */
+       act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
+       auto_return_button.set_related_action (act);
+       act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
+       follow_edits_button.set_related_action (act);
+       act = ActionManager::get_action ("Transport", "ToggleAutoInput");
+       auto_input_button.set_related_action (act);
 
-       Glib::RefPtr<SizeGroup> transport_button_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
-       transport_button_size_group->add_widget (goto_start_button);
-       transport_button_size_group->add_widget (goto_end_button);
-       transport_button_size_group->add_widget (auto_loop_button);
-       transport_button_size_group->add_widget (rec_button);
-       transport_button_size_group->add_widget (play_selection_button);
-       transport_button_size_group->add_widget (roll_button);
-       transport_button_size_group->add_widget (stop_button);
+       act = ActionManager::get_action ("Transport", "TogglePunchIn");
+       punch_in_button.set_related_action (act);
+       act = ActionManager::get_action ("Transport", "TogglePunchOut");
+       punch_out_button.set_related_action (act);
 
-       /* 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));
+       /* connect signals */
+       ARDOUR_UI::Clock.connect (sigc::mem_fun (primary_clock, &AudioClock::set));
+       ARDOUR_UI::Clock.connect (sigc::mem_fun (secondary_clock, &AudioClock::set));
 
+       primary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
+       secondary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
+       big_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed));
 
-       HBox* tbox1 = manage (new HBox);
-       HBox* tbox2 = manage (new HBox);
-       HBox* tbox = manage (new HBox);
+       editor_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), editor));
+       mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer));
+       prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
 
-       VBox* vbox1 = manage (new VBox);
-       VBox* vbox2 = manage (new VBox);
+       /* catch context clicks so that we can show a menu on these buttons */
 
-       Alignment* a1 = manage (new Alignment);
-       Alignment* a2 = manage (new Alignment);
+       editor_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("editor")), false);
+       mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false);
+       prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false);
 
-       tbox1->set_spacing (PX_SCALE(2));
-       tbox2->set_spacing (PX_SCALE(2));
-       tbox->set_spacing (PX_SCALE(2));
+       /* setup widget style/name */
 
-       if (!Profile->get_trx()) {
-               tbox1->pack_start (midi_panic_button, true, true, 5);
-               tbox1->pack_start (click_button, true, true, 5);
-       }
+       auto_return_button.set_name ("transport option button");
+       follow_edits_button.set_name ("transport option button");
+       auto_input_button.set_name ("transport option button");
 
-       tbox1->pack_start (goto_start_button, true, true);
-       tbox1->pack_start (goto_end_button, true, true);
-       tbox1->pack_start (auto_loop_button, true, true);
+       solo_alert_button.set_name ("rude solo");
+       auditioning_alert_button.set_name ("rude audition");
+       feedback_alert_button.set_name ("feedback alert");
+       error_alert_button.set_name ("error alert");
 
-       if (!Profile->get_trx()) {
-               tbox2->pack_start (play_selection_button, true, true);
-       }
-       tbox2->pack_start (roll_button, true, true);
-       tbox2->pack_start (stop_button, true, true);
-       tbox2->pack_start (rec_button, true, true, 5);
+       solo_alert_button.set_elements (ArdourButton::Element(ArdourButton::Body|ArdourButton::Text));
+       auditioning_alert_button.set_elements (ArdourButton::Element(ArdourButton::Body|ArdourButton::Text));
+       feedback_alert_button.set_elements (ArdourButton::Element(ArdourButton::Body|ArdourButton::Text));
 
-       vbox1->pack_start (*tbox1, true, true);
-       vbox2->pack_start (*tbox2, true, true);
+       solo_alert_button.set_layout_font (UIConfiguration::instance().get_SmallerFont());
+       auditioning_alert_button.set_layout_font (UIConfiguration::instance().get_SmallerFont());
+       feedback_alert_button.set_layout_font (UIConfiguration::instance().get_SmallerFont());
 
-       a1->add (*vbox1);
-       a1->set (0.5, 0.5, 0.0, 1.0);
-       a2->add (*vbox2);
-       a2->set (0.5, 0.5, 0.0, 1.0);
+       editor_visibility_button.set_name (X_("page switch button"));
+       mixer_visibility_button.set_name (X_("page switch button"));
+       prefs_visibility_button.set_name (X_("page switch button"));
 
-       tbox->pack_start (*a1, false, false);
-       tbox->pack_start (*a2, false, false);
+       punch_in_button.set_name ("punch button");
+       punch_out_button.set_name ("punch button");
 
-       HBox* clock_box = manage (new HBox);
+       click_button.set_name ("transport button");
+       sync_button.set_name ("transport active option button");
 
-       clock_box->pack_start (*primary_clock, false, false);
-       if (!ARDOUR::Profile->get_small_screen() && !ARDOUR::Profile->get_trx()) {
-               clock_box->pack_start (*secondary_clock, false, false);
-       }
-       clock_box->set_spacing (PX_SCALE(3));
+       /* and widget text */
+       auto_return_button.set_text(_("Auto Return"));
+       follow_edits_button.set_text(_("Follow Edits"));
+       //auto_input_button.set_text (_("Auto Input"));
+       punch_in_button.set_text (_("In"));
+       punch_out_button.set_text (_("Out"));
+       layered_button.set_text (_("Non-Layered"));
 
-       shuttle_box = manage (new ShuttleControl);
-       shuttle_box->show ();
+       punch_label.set_text (_("Punch:"));
+       layered_label.set_text (_("Mode:"));
 
-       VBox* transport_vbox = manage (new VBox);
-       transport_vbox->set_name ("TransportBase");
-       transport_vbox->set_border_width (0);
-       transport_vbox->set_spacing (PX_SCALE(3));
-       transport_vbox->pack_start (*tbox, true, true, 0);
+       /* and tooltips */
 
-       if (!Profile->get_trx()) {
-               transport_vbox->pack_start (*shuttle_box, false, false, 0);
-       }
+       Gtkmm2ext::UI::instance()->set_tip (editor_visibility_button,
+                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
+                                                             "To put the window back, use the Window > %1 > Attach menu action"), editor->name()));
 
-       time_info_box = manage (new TimeInfoBox);
+       Gtkmm2ext::UI::instance()->set_tip (mixer_visibility_button,
+                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
+                                                             "To put the window back, use the Window > %1 > Attach menu action"), mixer->name()));
 
-       transport_hbox.pack_start (*transport_vbox, false, true);
+       Gtkmm2ext::UI::instance()->set_tip (prefs_visibility_button,
+                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
+                                                             "To put the window back, use the Window > %1 > Attach menu action"), rc_option_editor->name()));
 
-       /* transport related toggle controls */
+       Gtkmm2ext::UI::instance()->set_tip (punch_in_button, _("Start recording at auto-punch start"));
+       Gtkmm2ext::UI::instance()->set_tip (punch_out_button, _("Stop recording at auto-punch end"));
 
-       VBox* auto_box = manage (new VBox);
-       auto_box->set_homogeneous (true);
-       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);
-               auto_box->pack_start (auto_return_button, true, true);
-       }
+       /* setup icons */
 
-       if (!ARDOUR::Profile->get_trx()) {
-               transport_hbox.pack_start (*auto_box, false, false);
-       }
-       transport_hbox.pack_start (*clock_box, true, true);
+       click_button.set_icon (ArdourIcon::TransportMetronom);
+       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);
 
-       if (ARDOUR::Profile->get_trx()) {
-               transport_hbox.pack_start (*auto_box, false, false);
-       }
+       /* transport control size-group */
 
-       if (!ARDOUR::Profile->get_trx()) {
-               transport_hbox.pack_start (*time_info_box, false, false);
-       }
+       Glib::RefPtr<SizeGroup> transport_button_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
+       transport_button_size_group->add_widget (goto_start_button);
+       transport_button_size_group->add_widget (goto_end_button);
+       transport_button_size_group->add_widget (auto_loop_button);
+       transport_button_size_group->add_widget (rec_button);
+       transport_button_size_group->add_widget (play_selection_button);
+       transport_button_size_group->add_widget (roll_button);
+       transport_button_size_group->add_widget (stop_button);
 
-       if (!ARDOUR::Profile->get_trx()) {
-               transport_hbox.pack_start (alert_box, false, false);
-               transport_hbox.pack_start (meter_box, false, false);
-               transport_hbox.pack_start (editor_meter_peak_display, false, false);
-       }
+       Glib::RefPtr<SizeGroup> punch_button_size_group = SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL);
+       punch_button_size_group->add_widget (punch_in_button);
+       punch_button_size_group->add_widget (punch_out_button);
 
-       Gtk::VBox*   window_button_box = manage (new Gtk::VBox);
+       // external widgets
+       time_info_box = manage (new TimeInfoBox);
+       shuttle_box = manage (new ShuttleControl);
 
-       editor_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), editor));
-       mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer));
-       prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
+       /* and now the layout... */
 
-       /* catch context clicks so that we can show a menu on these buttons */
+       /* top level packing */
+       transport_table.set_spacings (0);
+       transport_frame.add (transport_table);
+       transport_frame.set_name ("BaseFrame");
 
-       editor_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("editor")), false);
-       mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false);
-       prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false);
+       transport_table.signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::transport_expose), false);
 
-       editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
-       editor_visibility_button.set_name (X_("page switch button"));
-       mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility")));
-       mixer_visibility_button.set_name (X_("page switch button"));
-       prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility")));
-       prefs_visibility_button.set_name (X_("page switch button"));
+       /* transport controls sub-group */
+       click_button.set_size_request (PX_SCALE(20), PX_SCALE(20));
 
-       Gtkmm2ext::UI::instance()->set_tip (editor_visibility_button,
-                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
-                                                             "To put the window back, use the Window > %1 > Attach menu action"), editor->name()));
+       HBox* tbox = manage (new HBox);
+       tbox->set_spacing (PX_SCALE(1));
+
+       tbox->pack_start (midi_panic_button, true, true, 0);
+       tbox->pack_start (click_button, true, true, 0);
+       tbox->pack_start (goto_start_button, true, true);
+       tbox->pack_start (goto_end_button, true, true);
+       tbox->pack_start (auto_loop_button, true, true);
+       tbox->pack_start (play_selection_button, true, true);
+
+       tbox->pack_start (roll_button, true, true);
+       tbox->pack_start (stop_button, true, true);
+       tbox->pack_start (rec_button, true, true, 3);
+
+       /* alert box sub-group */
+       VBox* alert_box = manage (new VBox);
+       alert_box->set_homogeneous (true);
+       alert_box->set_spacing (1);
+       alert_box->set_border_width (2);
+       alert_box->pack_start (solo_alert_button, true, false, 0);
+       alert_box->pack_start (auditioning_alert_button, true, false, 0);
+       alert_box->pack_start (feedback_alert_button, true, false, 0);
+
+       /* clock button size groups */
+       Glib::RefPtr<SizeGroup> button_height_size_group = SizeGroup::create (Gtk::SIZE_GROUP_VERTICAL);
+       button_height_size_group->add_widget (follow_edits_button);
+       button_height_size_group->add_widget (*primary_clock->left_btn());
+       button_height_size_group->add_widget (*primary_clock->right_btn());
+       button_height_size_group->add_widget (*secondary_clock->left_btn());
+       button_height_size_group->add_widget (*secondary_clock->right_btn());
+
+       Glib::RefPtr<SizeGroup> clock1_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
+       clock1_size_group->add_widget (*primary_clock->left_btn());
+       clock1_size_group->add_widget (*primary_clock->right_btn());
+
+       Glib::RefPtr<SizeGroup> clock2_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
+       clock2_size_group->add_widget (*secondary_clock->left_btn());
+       clock2_size_group->add_widget (*secondary_clock->right_btn());
+
+       /* and the main table layout */
+
+       transport_table.attach (*tbox, 0, 2, 0, 1 , SHRINK, SHRINK, 3, 0);
+       transport_table.attach (sync_button, 0, 1, 1, 2 , FILL, SHRINK, 0, 0);
+       transport_table.attach (*shuttle_box, 1, 2, 1, 2 , FILL, SHRINK, 3, 0);
+
+       transport_table.attach (punch_label, 2, 3, 0, 1 , FILL, SHRINK, 3, 0);
+       transport_table.attach (layered_label, 2, 3, 1, 2 , FILL, SHRINK, 3, 0);
+
+       transport_table.attach (punch_in_button, 3, 4, 0, 1 , FILL, SHRINK, 1, 2);
+       transport_table.attach (punch_out_button, 4, 5, 0, 1 , FILL, SHRINK, 1, 2);
+       transport_table.attach (layered_button, 3, 5, 1, 2 , FILL, SHRINK, 0, 2);
+
+       // some extra space here (accomodate for the record-option box)
+       transport_table.attach (*(manage (new Label (""))), 5, 6, 0, 2 , FILL, SHRINK, 2, 0);
+
+       transport_table.attach (follow_edits_button, 6, 7, 0, 1 , FILL, SHRINK, 2, 0);
+       transport_table.attach (auto_return_button, 6, 7, 1, 2 , FILL, SHRINK, 2, 0);
+
+       transport_table.attach (*primary_clock, 7, 9, 0, 1 , FILL, SHRINK, 1, 0);
+       transport_table.attach (*primary_clock->left_btn(), 7, 8, 1, 2 , FILL, SHRINK, 1, 0);
+       transport_table.attach (*primary_clock->right_btn(), 8, 9, 1, 2 , FILL, SHRINK, 1, 0);
+
+       if (!ARDOUR::Profile->get_small_screen()) {
+               transport_table.attach (*secondary_clock, 9, 11, 0, 1 , FILL, SHRINK, 1, 0);
+               transport_table.attach (*secondary_clock->left_btn(), 9, 10, 1, 2 , FILL, SHRINK, 1, 0);
+               transport_table.attach (*secondary_clock->right_btn(), 10, 11, 1, 2 , FILL, SHRINK, 1, 0);
+       }
 
-       Gtkmm2ext::UI::instance()->set_tip (mixer_visibility_button,
-                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
-                                                             "To put the window back, use the Window > %1 > Attach menu action"), mixer->name()));
+       transport_table.attach (*alert_box, 11, 12, 0, 2, SHRINK, SHRINK, 2, 0);
 
-       Gtkmm2ext::UI::instance()->set_tip (prefs_visibility_button,
-                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
-                                                             "To put the window back, use the Window > %1 > Attach menu action"), rc_option_editor->name()));
+       /* editor-meter is in transport_hbox */
+       transport_hbox.set_spacing (PX_SCALE(1));
+       transport_table.attach (transport_hbox, 12, 13, 0, 2, SHRINK, EXPAND|FILL, 3, 0);
+
+       /* lua script action buttons */
+       transport_table.attach (action_script_table, 13, 14, 0, 2, SHRINK, EXPAND|FILL, 1, 0);
 
-       window_button_box->pack_start (editor_visibility_button, true, false);
-       window_button_box->pack_start (mixer_visibility_button, true, false);
-       window_button_box->pack_start (prefs_visibility_button, true, false);
+       transport_table.attach (editor_visibility_button, 14, 15, 0, 1 , FILL, SHRINK, 1, 0);
+       transport_table.attach (mixer_visibility_button, 14, 15, 1, 2 , FILL, SHRINK, 1, 0);
 
-       transport_hbox.pack_end (*window_button_box, false, false);
-       transport_hbox.pack_end (action_script_table, false, false);
+       transport_table.attach (*time_info_box, 15, 16, 0, 2, SHRINK, EXPAND|FILL, 1, 0); // XXX
 
        /* desensitize */
 
+       feedback_alert_button.set_sensitive (false);
+       feedback_alert_button.set_visual_state (Gtkmm2ext::NoVisualState);
+       auditioning_alert_button.set_sensitive (false);
+       auditioning_alert_button.set_visual_state (Gtkmm2ext::NoVisualState);
+
+       stop_button.set_active (true);
        set_transport_sensitivity (false);
 }
 #undef PX_SCALE
@@ -455,6 +515,10 @@ void
 ARDOUR_UI::_auditioning_changed (bool onoff)
 {
        auditioning_alert_button.set_active (onoff);
+       auditioning_alert_button.set_sensitive (onoff);
+       if (!onoff) {
+               auditioning_alert_button.set_visual_state (Gtkmm2ext::NoVisualState);
+       }
        set_transport_sensitivity (!onoff);
 }
 
@@ -464,19 +528,12 @@ ARDOUR_UI::auditioning_changed (bool onoff)
        UI::instance()->call_slot (MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::_auditioning_changed, this, onoff));
 }
 
-bool
-ARDOUR_UI::audition_alert_press (GdkEventButton*)
+void
+ARDOUR_UI::audition_alert_clicked ()
 {
        if (_session) {
                _session->cancel_audition();
        }
-       return true;
-}
-
-bool
-ARDOUR_UI::feedback_alert_press (GdkEventButton *)
-{
-       return true;
 }
 
 bool
index b8d8ad8bfc1b78bb8bf03df0f5fcf021ecfe1de3..ec4462f3240a78a1cb802ee687774ac5a1617811 100644 (file)
@@ -314,9 +314,9 @@ ARDOUR_UI::setup_windows ()
                } else {
                        action_script_call_btn[i].set_visual_state (Gtkmm2ext::VisualState (action_script_call_btn[i].visual_state() | Gtkmm2ext::Insensitive));
                }
-               const int row = i % 3;
-               const int col = i / 3;
-               action_script_table.attach (action_script_call_btn[i], col, col + 1, row, row + 1, EXPAND, EXPAND, 1, 1);
+               const int row = i % 2;
+               const int col = i / 2;
+               action_script_table.attach (action_script_call_btn[i], col, col + 1, row, row + 1, EXPAND, EXPAND, 1, 0);
                action_script_call_btn[i].set_no_show_all ();
        }
        action_script_table.show ();
index e372c1e7fdf59f3b106fd1825f8b490b827cee0a..13bf3e00878f6b8ad4dd0cd543e0bb461a4d9c7b 100644 (file)
@@ -223,7 +223,7 @@ ARDOUR_UI::set_session (Session *s)
                        editor_meter->set_meter (_session->master_out()->shared_peak_meter().get());
                        editor_meter->clear_meters();
                        editor_meter->set_type (_session->master_out()->meter_type());
-                       editor_meter->setup_meters (30, 12, 6);
+                       editor_meter->setup_meters (30, 10, 6);
                        editor_meter->show();
                        meter_box.pack_start(*editor_meter);
                }
index 98ede1dc3fbcd1742264fad39eee1aa3a8e3bd44..329fbb909f818f63fe063e7ebd0dd11918ab98c1 100644 (file)
@@ -436,7 +436,7 @@ ARDOUR_UI::parameter_changed (std::string p)
        } else if (p == "action-table-columns") {
                const uint32_t cols = UIConfiguration::instance().get_action_table_columns ();
                for (int i = 0; i < 9; ++i) {
-                       const int col = i / 3;
+                       const int col = i / 2;
                        if (cols & (1<<col)) {
                                action_script_call_btn[i].show();
                        } else {
index a453b80d16c9a06679d1edd01eff271b067a0118..69af98be85723deaf6119f8c3c608b0fce3fb370 100644 (file)
@@ -56,14 +56,9 @@ using Gtkmm2ext::Keyboard;
 
 sigc::signal<void> AudioClock::ModeChanged;
 vector<AudioClock*> AudioClock::clocks;
-const double AudioClock::info_font_scale_factor = 0.68;
-const double AudioClock::separator_height = 0.0;
-const double AudioClock::x_leading_padding = 6.0;
 
 #define BBT_BAR_CHAR "|"
 #define BBT_SCANF_FORMAT "%" PRIu32 "%*c%" PRIu32 "%*c%" PRIu32
-#define INFO_FONT_SIZE ((int)lrint(font_size * info_font_scale_factor))
-#define TXTSPAN "<span font-family=\"Sans\" foreground=\"white\">"
 
 AudioClock::AudioClock (const string& clock_name, bool transient, const string& widget_name,
                        bool allow_edit, bool follows_playhead, bool duration, bool with_info,
@@ -80,6 +75,7 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
        , _edit_by_click_field (false)
        , _negative_allowed (false)
        , edit_is_negative (false)
+       , _with_info (with_info)
        , editing_attr (0)
        , foreground_attr (0)
        , first_height (0)
@@ -107,11 +103,6 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
        _layout = Pango::Layout::create (get_pango_context());
        _layout->set_attributes (normal_attributes);
 
-       if (with_info) {
-               _left_layout = Pango::Layout::create (get_pango_context());
-               _right_layout = Pango::Layout::create (get_pango_context());
-       }
-
        set_widget_name (widget_name);
 
        _mode = BBT; /* lie to force mode switch */
@@ -122,6 +113,12 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
                clocks.push_back (this);
        }
 
+       _left_btn.set_sizing_text (_("0000000000000"));
+       // NB right_btn is in a size-group
+
+       _left_btn.set_layout_font (UIConfiguration::instance().get_SmallFont());
+       _right_btn.set_layout_font (UIConfiguration::instance().get_SmallFont());
+
        UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &AudioClock::set_colors));
        UIConfiguration::instance().DPIReset.connect (sigc::mem_fun (*this, &AudioClock::dpi_reset));
 }
@@ -175,18 +172,6 @@ AudioClock::set_font (Pango::FontDescription font)
 
        normal_attributes.change (*font_attr);
        editing_attributes.change (*font_attr);
-
-       /* now a smaller version of the same font */
-
-       delete font_attr;
-       font.set_size (INFO_FONT_SIZE);
-       font.set_weight (Pango::WEIGHT_NORMAL);
-       font_attr = new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font));
-
-       info_attributes.change (*font_attr);
-
-       /* and an even smaller one */
-
        delete font_attr;
 
        /* get the figure width for the font. This doesn't have to super
@@ -270,7 +255,6 @@ AudioClock::set_colors ()
        editing_attr = new Pango::AttrColor (Pango::Attribute::create_attr_foreground (r, g, b));
 
        normal_attributes.change (*foreground_attr);
-       info_attributes.change (*foreground_attr);
        editing_attributes.change (*foreground_attr);
        editing_attributes.change (*editing_attr);
 
@@ -300,11 +284,7 @@ AudioClock::render (cairo_t* cr, cairo_rectangle_t*)
        if (_need_bg) {
                cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
                if (corner_radius) {
-                       if (_left_layout) {
-                               Gtkmm2ext::rounded_top_half_rectangle (cr, 0, 0, get_width(), upper_height, corner_radius);
-                       } else {
-                               Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), upper_height, corner_radius);
-                       }
+                       Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), upper_height, corner_radius);
                } else {
                        cairo_rectangle (cr, 0, 0, get_width(), upper_height);
                }
@@ -327,81 +307,6 @@ AudioClock::render (cairo_t* cr, cairo_rectangle_t*)
                cairo_restore (cr);
        }
 
-       if (_left_layout) {
-
-               double h = get_height() - upper_height - separator_height;
-
-               if (_need_bg) {
-                       cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
-               }
-
-               if (mode_based_info_ratio != 1.0) {
-
-                       double left_rect_width = get_left_rect_width();
-
-                       if (_need_bg) {
-                               if (corner_radius) {
-                                       Gtkmm2ext::rounded_bottom_half_rectangle (cr, 0, upper_height + separator_height,
-                                                       left_rect_width + (separator_height == 0 ? corner_radius : 0),
-                                                       h, corner_radius);
-                               } else {
-                                       cairo_rectangle (cr, 0, upper_height + separator_height, left_rect_width, h);
-                               }
-                               cairo_fill (cr);
-                       }
-
-                       cairo_move_to (cr, x_leading_padding, upper_height + separator_height + ((h - info_height)/2.0));
-                       pango_cairo_show_layout (cr, _left_layout->gobj());
-
-                       if (_need_bg) {
-                               if (corner_radius) {
-                                       Gtkmm2ext::rounded_bottom_half_rectangle (cr, left_rect_width + separator_height,
-                                                       upper_height + separator_height,
-                                                       get_width() - separator_height - left_rect_width,
-                                                       h, corner_radius);
-                               } else {
-                                       cairo_rectangle (cr, left_rect_width + separator_height, upper_height + separator_height,
-                                                        get_width() - separator_height - left_rect_width, h);
-                               }
-                               cairo_fill (cr);
-                       }
-
-
-                       if (_right_layout->get_alignment() == Pango::ALIGN_RIGHT) {
-                               /* right-align does not work per se beacuse layout width is unset.
-                                * Using _right_layout->set_width([value >=0]) would also enable
-                                * word-wrapping which is not wanted here.
-                                * The solution is to custom align the layout depending on its size.
-                                * if it is larger than the available space it will be cropped on the
-                                * right edge rather than override text on the left side.
-                                */
-                               int x, rw, rh;
-                               _right_layout->get_pixel_size(rw, rh);
-                               x = get_width() - rw - separator_height - x_leading_padding;
-                               if (x < x_leading_padding + left_rect_width + separator_height) {
-                                       /* rather cut off the right end than overlap with the text on the left */
-                                       x = x_leading_padding + left_rect_width + separator_height;
-                               }
-                               cairo_move_to (cr, x, upper_height + separator_height + ((h - info_height)/2.0));
-                       } else {
-                               cairo_move_to (cr, x_leading_padding + left_rect_width + separator_height, upper_height + separator_height + ((h - info_height)/2.0));
-                       }
-                       pango_cairo_show_layout (cr, _right_layout->gobj());
-
-               } else {
-                       /* no info to display, or just one */
-
-                       if (_need_bg) {
-                               if (corner_radius) {
-                                       Gtkmm2ext::rounded_bottom_half_rectangle (cr, 0, upper_height + separator_height, get_width(), h, corner_radius);
-                               } else {
-                                       cairo_rectangle (cr, 0, upper_height + separator_height, get_width(), h);
-                               }
-                               cairo_fill (cr);
-                       }
-               }
-       }
-
        if (editing) {
                if (!insert_map.empty()) {
 
@@ -447,12 +352,7 @@ void
 AudioClock::on_size_allocate (Gtk::Allocation& alloc)
 {
        CairoWidget::on_size_allocate (alloc);
-
-       if (_left_layout) {
-               upper_height = (get_height()/2.0) - 1.0;
-       } else {
-               upper_height = get_height();
-       }
+       upper_height = get_height();
 }
 
 void
@@ -502,42 +402,6 @@ AudioClock::on_size_request (Gtk::Requisition* req)
        /* now tackle height, for which we need to know the height of the lower
         * layout
         */
-
-       if (_left_layout) {
-
-               Glib::RefPtr<Pango::Layout> tmp;
-               Glib::RefPtr<Gtk::Style> style = get_style ();
-               Pango::FontDescription font;
-               int w;
-
-               tmp = Pango::Layout::create (get_pango_context());
-
-               if (!is_realized()) {
-                       font = get_font_for_style (get_name());
-               } else {
-                       font = style->get_font();
-               }
-
-               tmp->set_font_description (font);
-
-               font.set_size (INFO_FONT_SIZE);
-               font.set_weight (Pango::WEIGHT_NORMAL);
-               tmp->set_font_description (font);
-
-               /* we only care about height, so put as much stuff in here
-                  as possible that might change the height.
-               */
-               tmp->set_text ("qyhH|"); /* one ascender, one descender */
-
-               tmp->get_pixel_size (w, info_height);
-
-               /* silly extra padding that seems necessary to correct the info
-                * that pango just gave us. I have no idea why.
-                */
-
-               req->height += info_height;
-               req->height += separator_height;
-       }
 }
 
 void
@@ -989,27 +853,21 @@ AudioClock::set (framepos_t when, bool force, framecnt_t offset)
 #endif
        }
 
+       bool btn_en = false;
+
        if (!editing) {
-               if (_right_layout) {
-                       _right_layout->set_alignment(Pango::ALIGN_LEFT);
-               }
 
                switch (_mode) {
                case Timecode:
-                       if (_right_layout) {
-                               _right_layout->set_alignment(Pango::ALIGN_RIGHT);
-                       }
                        set_timecode (when, force);
                        break;
 
                case BBT:
                        set_bbt (when, offset, force);
+                       btn_en = true;
                        break;
 
                case MinSec:
-                       if (_right_layout) {
-                               _right_layout->set_alignment(Pango::ALIGN_RIGHT);
-                       }
                        set_minsec (when, force);
                        break;
 
@@ -1019,6 +877,24 @@ AudioClock::set (framepos_t when, bool force, framecnt_t offset)
                }
        }
 
+       if (_with_info) {
+               _left_btn.set_sensitive (btn_en);
+               _right_btn.set_sensitive (btn_en);
+               _left_btn.set_visual_state (Gtkmm2ext::NoVisualState);
+               _right_btn.set_visual_state (Gtkmm2ext::NoVisualState);
+               if (btn_en) {
+                       _left_btn.set_elements (ArdourButton::Element(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text));
+                       _right_btn.set_elements (ArdourButton::Element(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text));
+                       _left_btn.set_alignment (.5, .5);
+                       _right_btn.set_alignment (.5, .5);
+               } else {
+                       _left_btn.set_elements (ArdourButton::Text);
+                       _right_btn.set_elements (ArdourButton::Text);
+                       _left_btn.set_alignment (0, .5);
+                       _right_btn.set_alignment (1, .5);
+               }
+       }
+
        queue_draw ();
        last_when = when;
 }
@@ -1026,7 +902,7 @@ AudioClock::set (framepos_t when, bool force, framecnt_t offset)
 void
 AudioClock::set_slave_info ()
 {
-       if (!_left_layout || !_right_layout) {
+       if (!_with_info) {
                return;
        }
 
@@ -1037,20 +913,16 @@ AudioClock::set_slave_info ()
 
                switch (sync_src) {
                case Engine:
-                       _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
-                                               INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
-                       _right_layout->set_text ("");
+                       _left_btn.set_text (sync_source_to_string (sync_src, true));
+                       _right_btn.set_text ("");
                        break;
                case MIDIClock:
                        if (slave) {
-                               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
-                                                       INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
-                               _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
-                                                       INFO_FONT_SIZE, slave->approximate_current_delta()));
+                               _left_btn.set_text (sync_source_to_string (sync_src, true));
+                               _right_btn.set_text (slave->approximate_current_delta (), true);
                        } else {
-                               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
-                                                       INFO_FONT_SIZE, _("--pending--")));
-                               _right_layout->set_text ("");
+                               _left_btn.set_text (_("--pending--"));
+                               _right_btn.set_text ("");
                        }
                        break;
                case LTC:
@@ -1060,23 +932,23 @@ AudioClock::set_slave_info ()
                                TimecodeSlave* tcslave;
                                if ((tcslave = dynamic_cast<TimecodeSlave*>(_session->slave())) != 0) {
                                        matching = (tcslave->apparent_timecode_format() == _session->config.get_timecode_format());
-                                       _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span><span foreground=\"%3\">%4</span></span>",
-                                                                                 INFO_FONT_SIZE, sync_source_to_string(sync_src, true)[0], (matching?"green":"red"),
-                                                                                 dynamic_cast<TimecodeSlave*>(slave)->approximate_current_position()));
-                                       _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
-                                                                                  INFO_FONT_SIZE, slave->approximate_current_delta()));
+                                       _left_btn.set_text (string_compose ("%1 <span face=\"monospace\" foreground=\"%3\">%2</span>",
+                                                               sync_source_to_string(sync_src, true)[0],
+                                                               dynamic_cast<TimecodeSlave*>(slave)->approximate_current_position (),
+                                                               matching ? "#66ff66" : "#ff3333"
+                                                               ), true);
+                                       _right_btn.set_text (slave->approximate_current_delta (), true);
                                }
                        } else {
-                               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
-                                                       INFO_FONT_SIZE, _("--pending--")));
-                               _right_layout->set_text ("");
+                               _left_btn.set_text (_("--pending--"));
+                               _right_btn.set_text ("");
                        }
                        break;
                }
        } else {
-               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "INT/%2</span></span>",
-                                       INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
-               _right_layout->set_text ("");
+               _left_btn.set_text (string_compose ("%1/%2",
+                                       _("INT"), sync_source_to_string(sync_src, true)));
+               _right_btn.set_text ("");
        }
 }
 
@@ -1088,12 +960,8 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
 
        if (_off) {
                _layout->set_text (" ----------");
-
-               if (_left_layout) {
-                       _left_layout->set_text ("");
-                       _right_layout->set_text ("");
-               }
-
+               _left_btn.set_text ("");
+               _right_btn.set_text ("");
                return;
        }
 
@@ -1110,7 +978,7 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
 
        _layout->set_text (buf);
 
-       if (_left_layout) {
+       if (_with_info) {
                framecnt_t rate = _session->frame_rate();
 
                if (fmod (rate, 100.0) == 0.0) {
@@ -1119,18 +987,15 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
                        sprintf (buf, "%" PRId64 "Hz", rate);
                }
 
-               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2 </span><span foreground=\"green\">%3</span></span>",
-                               INFO_FONT_SIZE, _("SR"), buf));
+               _left_btn.set_text (string_compose ("%1 %2", _("SR"), buf));
 
                float vid_pullup = _session->config.get_video_pullup();
 
                if (vid_pullup == 0.0) {
-                       _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2 </span><span foreground=\"green\">off</span></span>",
-                                       INFO_FONT_SIZE, _("Pull")));
+                       _right_btn.set_text (string_compose ("%1 off", _("Pull")));
                } else {
                        sprintf (buf, _("%+.4f%%"), vid_pullup);
-                       _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2 </span><span foreground=\"green\">%3</span></span>",
-                                       INFO_FONT_SIZE, _("Pull"), buf));
+                       _right_btn.set_text (string_compose ("%1 %2", _("Pull"), buf));
                }
        }
 }
@@ -1176,11 +1041,8 @@ AudioClock::set_minsec (framepos_t when, bool /*force*/)
 
        if (_off) {
                _layout->set_text (" --:--:--.---");
-
-               if (_left_layout) {
-                       _left_layout->set_text ("");
-                       _right_layout->set_text ("");
-               }
+               _left_btn.set_text ("");
+               _right_btn.set_text ("");
 
                return;
        }
@@ -1199,11 +1061,8 @@ AudioClock::set_timecode (framepos_t when, bool /*force*/)
 
        if (_off) {
                _layout->set_text (" --:--:--:--");
-               if (_left_layout) {
-                       _left_layout->set_text ("");
-                       _right_layout->set_text ("");
-               }
-
+               _left_btn.set_text ("");
+               _right_btn.set_text ("");
                return;
        }
 
@@ -1234,10 +1093,8 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
 
        if (_off) {
                _layout->set_text (" ---|--|----");
-               if (_left_layout) {
-                       _left_layout->set_text ("");
-                       _right_layout->set_text ("");
-               }
+               _left_btn.set_text ("");
+               _right_btn.set_text ("");
                return;
        }
 
@@ -1305,7 +1162,7 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
 
        _layout->set_text (buf);
 
-       if (_right_layout) {
+       if (_with_info) {
                framepos_t pos;
 
                if (bbt_reference_time < 0) {
@@ -1316,14 +1173,17 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/)
 
                TempoMetric m (_session->tempo_map().metric_at (pos));
 
-               snprintf (buf, sizeof(buf), "%-5.3f/%f", _session->tempo_map().tempo_at_frame (pos).note_types_per_minute(), m.tempo().note_type());
-               /* XXX this doesn't fit inside the container. */
-               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%3</span> <span foreground=\"green\">%2</span></span>",
-                                                         INFO_FONT_SIZE, buf, _("Tempo")));
+               if (m.tempo().note_type() == 4) {
+                       snprintf (buf, sizeof(buf), "\u2669 = %.0f", _session->tempo_map().tempo_at_frame (pos).note_types_per_minute());
+               } else if (m.tempo().note_type() == 8) {
+                       snprintf (buf, sizeof(buf), "\u266a = %.0f", _session->tempo_map().tempo_at_frame (pos).note_types_per_minute());
+               } else {
+                       snprintf (buf, sizeof(buf), "%.0f@%.0f", _session->tempo_map().tempo_at_frame (pos).note_types_per_minute(), m.tempo().note_type());
+               }
+               _left_btn.set_text (string_compose ("%1: %2", _("Tempo"), buf));
 
                snprintf (buf, sizeof(buf), "%g/%g", m.meter().divisions_per_bar(), m.meter().note_divisor());
-               _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%3</span> <span foreground=\"green\">%2</span></span>",
-                                                          INFO_FONT_SIZE, buf, _("Meter")));
+               _right_btn.set_text (string_compose ("%1: %2", _("Meter"), buf));
        }
 }
 
@@ -1334,6 +1194,7 @@ AudioClock::set_session (Session *s)
 
        if (_session) {
 
+               Config->ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context());
                _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context());
                _session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_property_changed, this, _1), gui_context());
                _session->tempo_map().MetricPositionChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::metric_position_changed, this), gui_context());
@@ -2200,19 +2061,6 @@ AudioClock::set_mode (Mode m, bool noemit)
        Gtk::Requisition req;
        set_clock_dimensions (req);
 
-       if (_left_layout) {
-
-               _left_layout->set_attributes (info_attributes);
-               _right_layout->set_attributes (info_attributes);
-               /* adjust info_height according to font size */
-               int ignored;
-               _left_layout->set_text (" 1234567890");
-               _left_layout->get_pixel_size (ignored, info_height);
-
-               _left_layout->set_text ("");
-               _right_layout->set_text ("");
-       }
-
        switch (_mode) {
        case Timecode:
                mode_based_info_ratio = 0.6;
index 79d05f62fead72d182abd5db80ba1edad3e792ac..ffd4d6b93a6f52cfc7fa81807ea90dc66c7a7e61 100644 (file)
@@ -34,6 +34,7 @@
 #include "ardour/session_handle.h"
 
 #include "gtkmm2ext/cairo_widget.h"
+#include "ardour_button.h"
 
 namespace ARDOUR {
        class Session;
@@ -80,6 +81,9 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
        void set_session (ARDOUR::Session *s);
        void set_negative_allowed (bool yn);
 
+       ArdourButton* left_btn () { return &_left_btn; }
+       ArdourButton* right_btn () { return &_right_btn; }
+
        /** Alter cairo scaling during rendering.
         *
         * Used by clocks that resize themselves
@@ -106,15 +110,10 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
 
        bool on_button_press_event (GdkEventButton *ev);
        bool on_button_release_event(GdkEventButton *ev);
-       bool is_lower_layout_click(int y) const {
-               return y > upper_height + separator_height;
-       }
-       bool is_right_layout_click(int x) const {
-               return x > x_leading_padding + get_left_rect_width() + separator_height;
-       }
-       double get_left_rect_width() const {
-              return round (((get_width() - separator_height) * mode_based_info_ratio) + 0.5);
-       }
+
+       ArdourButton _left_btn;
+       ArdourButton _right_btn;
+
        private:
        Mode             _mode;
        std::string      _name;
@@ -131,15 +130,14 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
        bool             edit_is_negative;
 
        Glib::RefPtr<Pango::Layout> _layout;
-       Glib::RefPtr<Pango::Layout> _left_layout;
-       Glib::RefPtr<Pango::Layout> _right_layout;
+
+       bool         _with_info;
 
        Pango::AttrColor*    editing_attr;
        Pango::AttrColor*    foreground_attr;
 
        Pango::AttrList normal_attributes;
        Pango::AttrList editing_attributes;
-       Pango::AttrList info_attributes;
 
        int first_height;
        int first_width;
index 9a7360b41f4502f767619dd7a575e577224907b6..6a759eb9dce18a69df93574682ae5b2518156a96 100644 (file)
 
 */
 
-#include "main_clock.h"
-#include "public_editor.h"
+#include "ardour/tempo.h"
 
+#include "actions.h"
+#include "main_clock.h"
 #include "ui_config.h"
+#include "public_editor.h"
 
 #include "pbd/i18n.h"
 
-#include "ardour/tempo.h"
-
 using namespace Gtk;
 
 MainClock::MainClock (
@@ -36,7 +36,14 @@ MainClock::MainClock (
        : AudioClock (clock_name, false, widget_name, true, true, false, true)
          , _primary (primary)
 {
+}
 
+void
+MainClock::set_session (ARDOUR::Session *s)
+{
+       AudioClock::set_session (s);
+       _left_btn.set_related_action (ActionManager::get_action (X_("Editor"), X_("edit-current-tempo")));
+       _right_btn.set_related_action (ActionManager::get_action (X_("Editor"), X_("edit-current-meter")));
 }
 
 void
@@ -117,25 +124,3 @@ MainClock::insert_new_meter ()
 {
        PublicEditor::instance().mouse_add_new_meter_event (absolute_time ());
 }
-
-bool
-MainClock::on_button_press_event (GdkEventButton *ev)
-{
-       if (ev->button == 1) {
-               if (mode() == BBT) {
-                       if (is_lower_layout_click(ev->y)) {
-                               if (is_right_layout_click(ev->x)) {
-                                       // meter on the right
-                                       edit_current_meter();
-                               } else {
-                                       // tempo on the left
-                                       edit_current_tempo();
-                               }
-                               return true;
-                       }
-               }
-       }
-
-       return AudioClock::on_button_press_event (ev);
-}
-
index 1e4cd9506c3082a3d25c3dba6496d1a06cd7e3b8..28cc98850652f75f6c9e9a3802f5a0572f8635f7 100644 (file)
@@ -30,6 +30,7 @@ class MainClock : public AudioClock
 public:
        MainClock (const std::string& clock_name, const std::string& widget_name, bool primary);
        framepos_t absolute_time () const;
+       void set_session (ARDOUR::Session *s);
 
 private:
 
@@ -42,8 +43,6 @@ private:
        void insert_new_tempo ();
        void insert_new_meter ();
        bool _primary;
-
-       bool on_button_press_event (GdkEventButton *ev);
 };
 
 #endif // __gtk_ardour_main_clock_h__
index 440705e1a38aa264af00ce4b3eb1701bf6be14a9..14b20b0df13075e35c58a42f81263f2c15a07214 100644 (file)
@@ -3489,7 +3489,7 @@ if (!ARDOUR::Profile->get_mixbus()) {
 
        add_option (S_("Preferences|GUI"),
                        new ColumVisibilityOption (
-                               "action-table-columns", _("Action Script Button Visibility"), 3,
+                               "action-table-columns", _("Action Script Button Visibility"), 4,
                                sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_action_table_columns),
                                sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_action_table_columns)
                                )
index d0d6871cbb0c07a3626e035b12e3e9b4f986c89e..f8118cbf648d842bdf2ce01bcd6d4d6a2b47c144 100644 (file)
@@ -44,8 +44,7 @@ using std::min;
 using std::max;
 
 TimeInfoBox::TimeInfoBox ()
-       : left (2, 4)
-       , right (2, 4)
+       : table (3, 4)
        , syncing_selection (false)
        , syncing_punch (false)
 {
@@ -65,67 +64,44 @@ TimeInfoBox::TimeInfoBox ()
        set_spacing (0);
        set_border_width (2);
 
-       pack_start (left, true, true);
-       if (!ARDOUR::Profile->get_trx()) {
-               pack_start (right, true, true);
-       }
-
-       left.set_homogeneous (false);
-       left.set_spacings (0);
-       left.set_border_width (2);
-       left.set_col_spacings (2);
+       pack_start (table, false, false);
 
-       right.set_homogeneous (false);
-       right.set_spacings (0);
-       right.set_border_width (2);
-       right.set_col_spacings (2);
+       table.set_homogeneous (false);
+       table.set_spacings (0);
+       table.set_border_width (2);
+       table.set_col_spacings (2);
 
        Gtk::Label* l;
 
        selection_title.set_name ("TimeInfoSelectionTitle");
-       left.attach (selection_title, 1, 2, 0, 1);
+       table.attach (selection_title, 1, 2, 0, 1);
        l = manage (new Label);
        l->set_text (_("Start"));
        l->set_alignment (1.0, 0.5);
        l->set_name (X_("TimeInfoSelectionLabel"));
-        left.attach (*l, 0, 1, 1, 2, FILL);
-        left.attach (*selection_start, 1, 2, 1, 2);
+       table.attach (*l, 0, 1, 1, 2, FILL);
+       table.attach (*selection_start, 1, 2, 1, 2);
 
        l = manage (new Label);
        l->set_text (_("End"));
        l->set_alignment (1.0, 0.5);
        l->set_name (X_("TimeInfoSelectionLabel"));
-        left.attach (*l, 0, 1, 2, 3, FILL);
-        left.attach (*selection_end, 1, 2, 2, 3);
+       table.attach (*l, 0, 1, 2, 3, FILL);
+       table.attach (*selection_end, 1, 2, 2, 3);
 
        l = manage (new Label);
        l->set_text (_("Length"));
        l->set_alignment (1.0, 0.5);
        l->set_name (X_("TimeInfoSelectionLabel"));
-        left.attach (*l, 0, 1, 3, 4, FILL);
-        left.attach (*selection_length, 1, 2, 3, 4);
-
-       punch_in_button.set_name ("punch button");
-       punch_out_button.set_name ("punch button");
-       punch_in_button.set_text (_("In"));
-       punch_out_button.set_text (_("Out"));
-
-       Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "TogglePunchIn");
-       punch_in_button.set_related_action (act);
-       act = ActionManager::get_action ("Transport", "TogglePunchOut");
-       punch_out_button.set_related_action (act);
-
-       Gtkmm2ext::UI::instance()->set_tip (punch_in_button, _("Start recording at auto-punch start"));
-       Gtkmm2ext::UI::instance()->set_tip (punch_out_button, _("Stop recording at auto-punch end"));
+       table.attach (*l, 0, 1, 3, 4, FILL);
+       table.attach (*selection_length, 1, 2, 3, 4);
 
        punch_title.set_name ("TimeInfoSelectionTitle");
-       right.attach (punch_title, 3, 4, 0, 1);
-        right.attach (punch_in_button, 2, 3, 1, 2, FILL, SHRINK);
-        right.attach (*punch_start, 3, 4, 1, 2);
-        right.attach (punch_out_button, 2, 3, 2, 3, FILL, SHRINK);
-        right.attach (*punch_end, 3, 4, 2, 3);
+       table.attach (punch_title, 2, 3, 0, 1);
+       table.attach (*punch_start, 2, 3, 1, 2);
+       table.attach (*punch_end, 2, 3, 2, 3);
 
-        show_all ();
+       show_all ();
 
        selection_start->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_start));
        selection_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_end));
@@ -149,12 +125,12 @@ TimeInfoBox::TimeInfoBox ()
 
 TimeInfoBox::~TimeInfoBox ()
 {
-        delete selection_length;
-        delete selection_end;
-        delete selection_start;
+       delete selection_length;
+       delete selection_end;
+       delete selection_start;
 
-        delete punch_start;
-        delete punch_end;
+       delete punch_start;
+       delete punch_end;
 }
 
 void
index 444d2e83b0402b21c8cc3bd3c26a62dcbf72707f..984a14a1c0d28bb788a0d7ae21cc0b33fcc3b323 100644 (file)
@@ -49,8 +49,7 @@ class TimeInfoBox : public CairoHPacker, public ARDOUR::SessionHandlePtr
     void set_session (ARDOUR::Session*);
 
   private:
-    Gtk::Table left;
-    Gtk::Table right;
+    Gtk::Table table;
 
     AudioClock* selection_start;
     AudioClock* selection_end;
@@ -71,9 +70,6 @@ class TimeInfoBox : public CairoHPacker, public ARDOUR::SessionHandlePtr
     PBD::ScopedConnectionList editor_connections;
     PBD::ScopedConnectionList region_property_connections;
 
-    ArdourButton punch_in_button;
-    ArdourButton punch_out_button;
-
     void selection_changed ();
 
     void sync_selection_mode (AudioClock*);