Commence transport tool bar re-layout

This commit is contained in:
Robin Gareus 2016-12-11 17:24:30 +01:00
parent a631706059
commit 1a25b906b3
12 changed files with 388 additions and 532 deletions

View 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 ();

View File

@ -179,53 +179,74 @@ bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult resu
return false;
}
bool
ARDOUR_UI::transport_expose (GdkEventExpose* ev)
{
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;
}
Cairo::RefPtr<Cairo::Context> cr = transport_table.get_window()->create_cairo_context ();
cr->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
cr->clip ();
transport_table.translate_coordinates (*window_parent, 0, 0, x0, y0);
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 ();
static const int xmargin = 2;
static const int ymargin = 1;
/* draw box around record-options */
int xx, ww, hh, uu;
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;
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 ();
/* 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;
cr->move_to (x0 + xx, 1.5 + y0 + ymargin + round (punch_in_button.get_height () * .5));
cr->rel_line_to (dx, 0);
cr->stroke ();
/* 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 ();
return false;
}
void
ARDOUR_UI::setup_transport ()
{
RefPtr<Action> act;
transport_hbox.set_border_width (PX_SCALE(3));
transport_hbox.set_spacing (PX_SCALE(3));
transport_base.set_name ("TransportBase");
transport_base.add (transport_hbox);
transport_frame.set_shadow_type (SHADOW_OUT);
transport_frame.set_name ("BaseFrame");
transport_frame.add (transport_base);
auto_return_button.set_text(_("Auto Return"));
follow_edits_button.set_text(_("Follow Edits"));
// auto_input_button.set_text (_("Auto Input"));
click_button.set_icon (ArdourIcon::TransportMetronom);
/* 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);
auto_return_button.set_name ("transport option button");
follow_edits_button.set_name ("transport option button");
auto_input_button.set_name ("transport option button");
/* these have to provide a clear indication of active state */
click_button.set_name ("transport button");
sync_button.set_name ("transport active option button");
stop_button.set_active (true);
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);
act = ActionManager::get_action (X_("Transport"), X_("Stop"));
stop_button.set_related_action (act);
act = ActionManager::get_action (X_("Transport"), X_("Roll"));
@ -245,14 +266,18 @@ ARDOUR_UI::setup_transport ()
act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
sync_button.set_related_action (act);
/* clocks, etc. */
/* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */
act = ActionManager::get_action (X_("Main"), X_("cancel-solo"));
solo_alert_button.set_related_action (act);
auditioning_alert_button.signal_clicked.connect (sigc::mem_fun(*this,&ARDOUR_UI::audition_alert_clicked));
error_alert_button.signal_button_release_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::error_alert_press), false);
act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
error_alert_button.set_related_action(act);
error_alert_button.set_fallthrough_to_parent(true);
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));
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")));
act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
auto_return_button.set_related_action (act);
@ -261,145 +286,18 @@ ARDOUR_UI::setup_transport ()
act = ActionManager::get_action ("Transport", "ToggleAutoInput");
auto_input_button.set_related_action (act);
/* alerts */
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);
/* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */
/* connect signals */
ARDOUR_UI::Clock.connect (sigc::mem_fun (primary_clock, &AudioClock::set));
ARDOUR_UI::Clock.connect (sigc::mem_fun (secondary_clock, &AudioClock::set));
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");
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);
/* all transport buttons should be the same size vertically and
* horizontally
*/
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);
/* the icon for this has an odd aspect ratio, so fatten up the button */
midi_panic_button.set_size_request (PX_SCALE(25), -1);
goto_start_button.set_size_request (PX_SCALE(28), PX_SCALE(44));
click_button.set_size_request (PX_SCALE(32), PX_SCALE(44));
HBox* tbox1 = manage (new HBox);
HBox* tbox2 = manage (new HBox);
HBox* tbox = manage (new HBox);
VBox* vbox1 = manage (new VBox);
VBox* vbox2 = manage (new VBox);
Alignment* a1 = manage (new Alignment);
Alignment* a2 = manage (new Alignment);
tbox1->set_spacing (PX_SCALE(2));
tbox2->set_spacing (PX_SCALE(2));
tbox->set_spacing (PX_SCALE(2));
if (!Profile->get_trx()) {
tbox1->pack_start (midi_panic_button, true, true, 5);
tbox1->pack_start (click_button, true, true, 5);
}
tbox1->pack_start (goto_start_button, true, true);
tbox1->pack_start (goto_end_button, true, true);
tbox1->pack_start (auto_loop_button, true, true);
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);
vbox1->pack_start (*tbox1, true, true);
vbox2->pack_start (*tbox2, true, true);
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);
tbox->pack_start (*a1, false, false);
tbox->pack_start (*a2, false, false);
HBox* clock_box = manage (new HBox);
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));
shuttle_box = manage (new ShuttleControl);
shuttle_box->show ();
VBox* transport_vbox = manage (new VBox);
transport_vbox->set_name ("TransportBase");
transport_vbox->set_border_width (0);
transport_vbox->set_spacing (PX_SCALE(3));
transport_vbox->pack_start (*tbox, true, true, 0);
if (!Profile->get_trx()) {
transport_vbox->pack_start (*shuttle_box, false, false, 0);
}
time_info_box = manage (new TimeInfoBox);
transport_hbox.pack_start (*transport_vbox, false, true);
/* transport related toggle controls */
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);
}
if (!ARDOUR::Profile->get_trx()) {
transport_hbox.pack_start (*auto_box, false, false);
}
transport_hbox.pack_start (*clock_box, true, true);
if (ARDOUR::Profile->get_trx()) {
transport_hbox.pack_start (*auto_box, false, false);
}
if (!ARDOUR::Profile->get_trx()) {
transport_hbox.pack_start (*time_info_box, false, false);
}
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);
}
Gtk::VBox* window_button_box = manage (new Gtk::VBox);
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));
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));
@ -411,13 +309,48 @@ ARDOUR_UI::setup_transport ()
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);
editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
/* setup widget style/name */
auto_return_button.set_name ("transport option button");
follow_edits_button.set_name ("transport option button");
auto_input_button.set_name ("transport option button");
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");
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));
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());
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"));
punch_in_button.set_name ("punch button");
punch_out_button.set_name ("punch button");
click_button.set_name ("transport button");
sync_button.set_name ("transport active option button");
/* 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"));
punch_label.set_text (_("Punch:"));
layered_label.set_text (_("Mode:"));
/* and tooltips */
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()));
@ -430,15 +363,142 @@ ARDOUR_UI::setup_transport ()
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()));
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);
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"));
transport_hbox.pack_end (*window_button_box, false, false);
transport_hbox.pack_end (action_script_table, false, false);
/* setup icons */
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);
/* transport control size-group */
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);
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);
// external widgets
time_info_box = manage (new TimeInfoBox);
shuttle_box = manage (new ShuttleControl);
/* and now the layout... */
/* top level packing */
transport_table.set_spacings (0);
transport_frame.add (transport_table);
transport_frame.set_name ("BaseFrame");
transport_table.signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::transport_expose), false);
/* transport controls sub-group */
click_button.set_size_request (PX_SCALE(20), PX_SCALE(20));
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);
}
transport_table.attach (*alert_box, 11, 12, 0, 2, SHRINK, SHRINK, 2, 0);
/* 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);
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_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

View 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 ();

View 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);
}

View 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 {

View 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;

View 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;

View File

@ -17,15 +17,15 @@
*/
#include "ardour/tempo.h"
#include "actions.h"
#include "main_clock.h"
#include "ui_config.h"
#include "public_editor.h"
#include "ui_config.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);
}

View 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__

View 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)
)

View 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);
}
pack_start (table, false, false);
left.set_homogeneous (false);
left.set_spacings (0);
left.set_border_width (2);
left.set_col_spacings (2);
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

View 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*);