From 9e35a9da669ab35d5f95841ac31dd8026a718518 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 18 Apr 2023 01:07:54 +0200 Subject: [PATCH] Add option to use a neutral color for new routes --- gtk2_ardour/rc_option_editor.cc | 25 +++++++++++++++++++++++++ gtk2_ardour/route_ui.cc | 6 +++++- gtk2_ardour/ui_config_vars.h | 2 ++ gtk2_ardour/vca_master_strip.cc | 6 +++++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 9d9f3659ac..51273fd90d 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2946,6 +2946,31 @@ RCOptionEditor::RCOptionEditor () add_option (_("Appearance/Colors"), new ColorThemeManager); add_option (_("Appearance/Colors"), new OptionEditorBlank ()); + bo = new BoolOption ( + "use-palette-for-new-route", + _("Use color-palette to assign color for new tracks/busses"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_use_palette_for_new_route), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_use_palette_for_new_route) + ); + Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), + _("When enabled new Routes are assigned a color from the stripable-color-palette in round-robin fashion.\n" + "When disabled all new Routes will have a neutal color from the theme." + )); + add_option (_("Appearance/Colors"), bo); + + + bo = new BoolOption ( + "use-palette-for-new-vca", + _("Use color-palette to assign color for new VCA"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_use_palette_for_new_vca), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_use_palette_for_new_vca) + ); + Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget (), + _("When enabled newly created VCAs are assigned a random color.\n" + "When disabled all new VCAs will have a neutal color from the theme." + )); + add_option (_("Appearance/Colors"), bo); + /* Quirks */ OptionEditorHeading* quirks_head = new OptionEditorHeading (_("Various Workarounds for Windowing Systems")); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index a01e6a31f2..f081f6f5e4 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -366,7 +366,11 @@ RouteUI::set_route (std::shared_ptr rp) } if (set_color_from_route()) { - set_color (gdk_color_to_rgba (AxisView::unique_random_color ())); + if (UIConfiguration::instance().get_use_palette_for_new_route ()) { + set_color (gdk_color_to_rgba (AxisView::unique_random_color ())); + } else { + set_color (UIConfiguration::instance ().color (X_("neutral:midground"))); + } } if (self_destruct) { diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index e34411f549..13808d4716 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -123,6 +123,8 @@ UI_CONFIG_VARIABLE (uint32_t, action_table_columns, "action-table-columns", 3) UI_CONFIG_VARIABLE (bool, hide_splash_screen, "hide-splash-screen", true) UI_CONFIG_VARIABLE (bool, check_announcements, "check-announcements,", true) UI_CONFIG_VARIABLE (bool, use_wm_visibility, "use-wm-visibility", true) +UI_CONFIG_VARIABLE (bool, use_palette_for_new_route, "use-palette-for-new-route", true) +UI_CONFIG_VARIABLE (bool, use_palette_for_new_vca, "use-palette-for-new-vca", true) UI_CONFIG_VARIABLE (std::string, stripable_color_palette, "stripable-color-palette", "#AA3939:#FFAAAA:#D46A6A:#801515:#550000:#AA8E39:#FFEAAA:#D4BA6A:#806515:#554000:#343477:#8080B3:#565695:#1A1A59:#09093B:#2D882D:#88CC88:#55AA55:#116611:#004400") /* Gtk::ColorSelection::palette_to_string */ UI_CONFIG_VARIABLE (bool, use_note_bars_for_velocity, "use-note-bars-for-velocity", true) UI_CONFIG_VARIABLE (bool, use_note_color_for_velocity, "use-note-color-for-velocity", true) diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc index 9c29e60e0a..8c958e4897 100644 --- a/gtk2_ardour/vca_master_strip.cc +++ b/gtk2_ardour/vca_master_strip.cc @@ -64,7 +64,11 @@ VCAMasterStrip::VCAMasterStrip (Session* s, std::shared_ptr v) /* set color for the VCA, if not already done. */ if (!_vca->presentation_info().color_set()) { - _vca->presentation_info().set_color (Gtkmm2ext::gdk_color_to_rgba (unique_random_color())); + if (UIConfiguration::instance().get_use_palette_for_new_vca ()) { + _vca->presentation_info().set_color (Gtkmm2ext::gdk_color_to_rgba (unique_random_color())); + } else { + _vca->presentation_info().set_color (UIConfiguration::instance ().color (X_("neutral:midground"))); + } } control_slave_ui.set_stripable (std::dynamic_pointer_cast (v));