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);
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
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);
}
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
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,
, _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)
_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 */
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));
}
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
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);
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);
}
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()) {
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
/* 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
#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;
}
}
+ 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;
}
void
AudioClock::set_slave_info ()
{
- if (!_left_layout || !_right_layout) {
+ if (!_with_info) {
return;
}
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:
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 ("");
}
}
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;
}
_layout->set_text (buf);
- if (_left_layout) {
+ if (_with_info) {
framecnt_t rate = _session->frame_rate();
if (fmod (rate, 100.0) == 0.0) {
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));
}
}
}
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;
}
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;
}
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;
}
_layout->set_text (buf);
- if (_right_layout) {
+ if (_with_info) {
framepos_t pos;
if (bbt_reference_time < 0) {
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));
}
}
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());
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;