From: Robin Gareus Date: Wed, 4 May 2016 15:36:40 +0000 (+0200) Subject: add option to limit track-header meters to stereo X-Git-Tag: 5.0-pre0~725 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=106851b33a52b122cdded8fa2dd03c47bac955a9;p=ardour.git add option to limit track-header meters to stereo --- diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc index d9f31303dd..114c28c708 100644 --- a/gtk2_ardour/level_meter.cc +++ b/gtk2_ardour/level_meter.cc @@ -51,7 +51,8 @@ LevelMeterBase::LevelMeterBase (Session* s, PBD::EventLoop::InvalidationRecord* , max_peak (minus_infinity()) , meter_type (MeterPeak) , visible_meter_type (MeterType(0)) - , visible_meter_count (0) + , meter_count (0) + , max_visible_meters (0) , color_changed (false) { set_session (s); @@ -230,7 +231,18 @@ LevelMeterBase::hide_all_meters () (*i).packed = false; } } - visible_meter_count = 0; + meter_count = 0; +} + +void +LevelMeterBase::set_max_audio_meter_count (uint32_t cnt) +{ + if (cnt == max_visible_meters) { + return; + } + color_changed = true; // force re-setup + max_visible_meters = cnt; + setup_meters (meter_length, regular_meter_width, thin_meter_width); } void @@ -264,7 +276,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) width = rint (width * UIConfiguration::instance().get_ui_scale()); if ( meters.size() > 0 - && nmeters == visible_meter_count + && nmeters == meter_count && meters[0].width == width && meters[0].length == len && !color_changed @@ -277,7 +289,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) (meters.size() > 0) ? "yes" : "no", (meters.size() > 0 && meters[0].width == width) ? "yes" : "no", (meters.size() > 0 && meters[0].length == len) ? "yes" : "no", - (nmeters == visible_meter_count) ? "yes" : "no", + (nmeters == meter_count) ? "yes" : "no", (meter_type == visible_meter_type) ? "yes" : "no", !color_changed ? "yes" : "no" ); @@ -459,13 +471,17 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) //pack_end (*meters[n].meter, false, false); mtr_pack (*meters[n].meter); - meters[n].meter->show_all (); meters[n].packed = true; + if (max_visible_meters == 0 || (uint32_t) n < max_visible_meters + nmidi) { + meters[n].meter->show_all (); + } else { + meters[n].meter->hide (); + } } //show(); color_changed = false; visible_meter_type = meter_type; - visible_meter_count = nmeters; + meter_count = nmeters; } void diff --git a/gtk2_ardour/level_meter.h b/gtk2_ardour/level_meter.h index a7a64d7559..758b94c37b 100644 --- a/gtk2_ardour/level_meter.h +++ b/gtk2_ardour/level_meter.h @@ -65,6 +65,7 @@ class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::tra void clear_meters (bool reset_highlight = true); void hide_meters (); void setup_meters (int len=0, int width=3, int thin=2); + void set_max_audio_meter_count (uint32_t cnt = 0); void set_type (ARDOUR::MeterType); ARDOUR::MeterType get_type () { return meter_type; } @@ -108,7 +109,8 @@ class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::tra float max_peak; ARDOUR::MeterType meter_type; ARDOUR::MeterType visible_meter_type; - uint32_t visible_meter_count; + uint32_t meter_count; + uint32_t max_visible_meters; PBD::ScopedConnection _configuration_connection; PBD::ScopedConnection _meter_type_connection; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index f11585e31b..fc340534f4 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2216,14 +2216,6 @@ RCOptionEditor::RCOptionEditor () sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_draggable_playhead) )); - add_option (_("Editor"), - new BoolOption ( - "show-track-meters", - _("Show meters on tracks in the editor"), - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_track_meters), - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_track_meters) - )); - add_option (_("Editor"), new BoolOption ( "show-editor-meter", @@ -3294,6 +3286,24 @@ if (!ARDOUR::Profile->get_mixbus()) { sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_style_led) )); + add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Editor Meters"))); + + add_option (S_("Preferences|Metering"), + new BoolOption ( + "show-track-meters", + _("Show meters on tracks in the editor"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_track_meters), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_track_meters) + )); + + add_option (S_("Preferences|Metering"), + new BoolOption ( + "editor-stereo-only-meters", + _("Show at most stereo meters in the track-header"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_editor_stereo_only_meters), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_editor_stereo_only_meters) + )); + add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Post Export Analysis"))); add_option (S_("Preferences|Metering"), diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 8243a78ca1..986a274ee6 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -124,6 +124,9 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCan number_label.set_fallthrough_to_parent (true); 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)); + + parameter_changed ("editor-stereo-only-meters"); } void @@ -441,6 +444,12 @@ RouteTimeAxisView::parameter_changed (string const & p) { if (p == "track-name-number") { update_track_number_visibility(); + } else if (p == "editor-stereo-only-meters") { + if (UIConfiguration::instance().get_editor_stereo_only_meters()) { + gm.get_level_meter().set_max_audio_meter_count (2); + } else { + gm.get_level_meter().set_max_audio_meter_count (0); + } } } diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 0621aa81fb..1e7b987136 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -58,6 +58,7 @@ UI_CONFIG_VARIABLE (bool, show_name_highlight, "show-name-highlight", false) UI_CONFIG_VARIABLE (bool, primary_clock_delta_edit_cursor, "primary-clock-delta-edit-cursor", false) UI_CONFIG_VARIABLE (bool, secondary_clock_delta_edit_cursor, "secondary-clock-delta-edit-cursor", false) UI_CONFIG_VARIABLE (bool, show_track_meters, "show-track-meters", true) +UI_CONFIG_VARIABLE (bool, editor_stereo_only_meters, "editor-stereo-only-meters", false) UI_CONFIG_VARIABLE (bool, follow_edits, "follow-edits", false) UI_CONFIG_VARIABLE (bool, super_rapid_clock_update, "super-rapid-clock-update", false) UI_CONFIG_VARIABLE (bool, autoscroll_editor, "autoscroll-editor", true)