From 2e39378467bc93fc8f7dee95e517543991cca392 Mon Sep 17 00:00:00 2001 From: itmuckel Date: Fri, 27 May 2022 13:45:49 +0200 Subject: [PATCH] Repurpose track numbers as color bars --- gtk2_ardour/mixer_strip.cc | 1 - gtk2_ardour/route_time_axis.cc | 62 ++++++++++++++++------------------ gtk2_ardour/route_time_axis.h | 1 - 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 79d38c786ea..fcfb45fdb6d 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -2045,7 +2045,6 @@ MixerStrip::set_meter_type (MeterType t) void MixerStrip::update_track_number_visibility () { - DisplaySuspender ds; bool show_label = _session->config.get_track_name_number(); if (_route && _route->is_master()) { diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 8c66af5d23e..1a0771aef6f 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -105,26 +105,27 @@ sigc::signal RouteTimeAxisView::signal_ctrl_touched; RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas) : RouteUI(sess) , StripableTimeAxisView(ed, sess, canvas) - , _view (0) + , _view (nullptr) , button_table (3, 3) , route_group_button (S_("RTAV|G")) , playlist_button (S_("RTAV|P")) , automation_button (S_("RTAV|A")) - , automation_action_menu (0) - , plugins_submenu_item (0) - , route_group_menu (0) - , overlaid_menu_item (0) - , stacked_menu_item (0) + , automation_action_menu (nullptr) + , route_group_menu (nullptr) + , overlaid_menu_item (nullptr) + , stacked_menu_item (nullptr) , gm (sess, true, 75, 14) , _ignore_set_layer_display (false) - , pan_automation_item(NULL) + , pan_automation_item(nullptr) { subplugin_menu.set_name ("ArdourContextMenu"); number_label.set_name("tracknumber label"); - number_label.set_elements((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive)); + number_label.set_elements((ArdourButton::Element)(ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive)); number_label.set_alignment(.5, .5); number_label.set_fallthrough_to_parent (true); + name_label.set_padding (2, 0); + sess->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::parameter_changed, this, _1), gui_context()); UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::parameter_changed)); @@ -258,7 +259,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) controls_table.attach (gm.get_gain_slider(), 3, 5, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 1, 0); } else { controls_table.attach (route_group_button, 4, 5, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - controls_table.attach (gm.get_gain_slider(), 0, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 1, 0); + controls_table.attach (gm.get_gain_slider(), 2, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 1, 0); } set_tooltip(*solo_button,_("Solo")); @@ -434,7 +435,8 @@ RouteTimeAxisView::label_view () inactive_label.show (); const int64_t track_number = _route->track_number (); - if (track_number == 0) { + bool show_label = _session->config.get_track_name_number(); + if (track_number == 0 || !show_label) { number_label.set_text (""); } else { number_label.set_text (PBD::to_string (abs(_route->track_number ()))); @@ -444,34 +446,30 @@ RouteTimeAxisView::label_view () void RouteTimeAxisView::update_track_number_visibility () { - DisplaySuspender ds; - bool show_label = _session->config.get_track_name_number(); - - if (_route && _route->is_master()) { - show_label = false; - } - if (number_label.get_parent()) { number_label.get_parent()->remove (number_label); } + + if (!_route->active ()) { + inactive_table.attach (number_label, 0, 1, 0, 3, Gtk::SHRINK, Gtk::EXPAND | Gtk::FILL, 1, 0); + } else if (ARDOUR::Profile->get_mixbus ()) { + controls_table.attach (number_label, 3, 4, 0, 1, Gtk::SHRINK, Gtk::EXPAND | Gtk::FILL, 1, 0); + } else { + controls_table.attach (number_label, 0, 1, 0, 3, Gtk::SHRINK, Gtk::FILL, 1, 0); + } + + // see ArdourButton::on_size_request(), we should probably use a global size-group here instead. + // except the width of the number label is subtracted from the name-hbox, so we + // need to explicitly calculate it anyway until the name-label & entry become ArdourWidgets. + bool show_label = _session->config.get_track_name_number(); if (show_label) { - if (!_route->active()) { - inactive_table.attach (number_label, 0, 1, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 1, 0); - } else if (ARDOUR::Profile->get_mixbus()) { - controls_table.attach (number_label, 3, 4, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 1, 0); - } else { - controls_table.attach (number_label, 0, 1, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 1, 0); - } - // see ArdourButton::on_size_request(), we should probably use a global size-group here instead. - // except the width of the number label is subtracted from the name-hbox, so we - // need to explicitly calculate it anyway until the name-label & entry become ArdourWidgets. - int tnw = (2 + std::max(2u, _session->track_number_decimals())) * number_label.char_pixel_width(); - if (tnw & 1) --tnw; - number_label.set_size_request(tnw, -1); - number_label.show (); + number_label.set_size_request (static_cast(15 * UIConfiguration::instance().get_ui_scale()), -1); } else { - number_label.hide (); + number_label.set_size_request (static_cast(3 * UIConfiguration::instance().get_ui_scale()), -1); } + number_label.show (); + + label_view (); } void diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index fdf30cc5c73..e094fdb1475 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -260,7 +260,6 @@ class RouteTimeAxisView : public RouteUI, public StripableTimeAxisView Gtk::Menu subplugin_menu; Gtk::Menu* automation_action_menu; - Gtk::MenuItem* plugins_submenu_item; RouteGroupMenu* route_group_menu; Gtk::MenuItem* overlaid_menu_item; Gtk::MenuItem* stacked_menu_item;