From 38adfdf79e98458584a0f11d4141b9a8adf63278 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 14 Apr 2024 01:29:09 +0200 Subject: [PATCH] Add custom color for region effect automation --- gtk2_ardour/audio_region_view.cc | 8 ++++---- gtk2_ardour/automation_line.cc | 20 ++++++++++++++----- gtk2_ardour/automation_line.h | 7 ++++--- gtk2_ardour/automation_time_axis.cc | 2 +- gtk2_ardour/editor_drag.cc | 2 +- gtk2_ardour/themes/adwaita_dark-ardour.colors | 1 + .../themes/blueberry_milk-ardour.colors | 1 + gtk2_ardour/themes/caineville-ardour.colors | 1 + gtk2_ardour/themes/clear_gray-ardour.colors | 1 + gtk2_ardour/themes/cubasish-ardour.colors | 1 + gtk2_ardour/themes/dark-ardour.colors | 3 ++- gtk2_ardour/themes/diehard3-ardour.colors | 1 + gtk2_ardour/themes/recbox-ardour.colors | 1 + gtk2_ardour/themes/unastudia-ardour.colors | 1 + gtk2_ardour/themes/xcolors-ardour.colors | 1 + 15 files changed, 36 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 0445434fd8..189be38a82 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -1673,11 +1673,11 @@ AudioRegionView::set_fx_line_colors () assert (_fx_line); if (_rdx_param != UINT32_MAX && _rfx_id != 0) { - _fx_line->set_line_color (UIConfiguration::instance().color ("processor automation line")); + _fx_line->set_line_color ("region automation line"); + } else if (audio_region()->envelope_active()) { + _fx_line->set_line_color ("gain line"); } else { - _fx_line->set_line_color (audio_region()->envelope_active() - ? UIConfiguration::instance().color ("gain line") - : UIConfiguration::instance().color_mod ("gain line inactive", "gain line inactive")); + _fx_line->set_line_color ("gain line inactive", "gain line inactive"); } } diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 0efee332ac..ae27a3fc14 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -92,6 +92,7 @@ AutomationLine::AutomationLine (const string& name, : trackview (tv) , _name (name) , _height (0) + , _line_color ("automation line") , _view_index_offset (0) , alist (al) , _visible (Line) @@ -264,14 +265,23 @@ AutomationLine::set_height (guint32 h) } void -AutomationLine::set_line_color (uint32_t color) +AutomationLine::set_line_color (string color_name, std::string color_mod) { - _line_color = color; + _line_color = color_name; + _line_color_mod = color_mod; + + uint32_t color = UIConfiguration::instance().color (color_name); line->set_outline_color (color); - Gtkmm2ext::SVAModifier mod = UIConfiguration::instance().modifier ("automation line fill"); + Gtkmm2ext::SVAModifier mod = UIConfiguration::instance().modifier (color_mod.empty () ? "automation line fill" : color_mod); - line->set_fill_color ((color & 0xffffff00) + mod.a()*255); + line->set_fill_color ((color & 0xffffff00) + mod.a() * 255); +} + +uint32_t +AutomationLine::get_line_color() const +{ + return UIConfiguration::instance().color (_line_color); } ControlPoint* @@ -996,7 +1006,7 @@ AutomationLine::set_selected_points (PointSelection const & points) void AutomationLine::set_colors () { - set_line_color (UIConfiguration::instance().color ("automation line")); + set_line_color (_line_color, _line_color_mod); for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { (*i)->set_color (); } diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 6ded1d2319..f10f3efd0a 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -104,8 +104,8 @@ public: bool visible() const { return _visible != VisibleAspects(0); } guint32 height() const { return _height; } - void set_line_color (uint32_t); - uint32_t get_line_color() const { return _line_color; } + void set_line_color (std::string color, std::string mod = ""); + uint32_t get_line_color() const; void set_visibility (VisibleAspects); void add_visibility (VisibleAspects); @@ -174,7 +174,8 @@ protected: std::string _name; guint32 _height; - uint32_t _line_color; + std::string _line_color; + std::string _line_color_mod; uint32_t _view_index_offset; std::shared_ptr alist; diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index e2efa6c499..2de5fa9d87 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -350,7 +350,7 @@ AutomationTimeAxisView::add_contents (bool show_regions) ) ); - line->set_line_color (UIConfiguration::instance().color ("processor automation line")); + line->set_line_color ("processor automation line"); line->set_fill (true); line->queue_reset (); add_line (line); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 74aeefe970..1c780cbe41 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -7267,7 +7267,7 @@ FreehandLineDrag::motion (GdkEvent* ev, bool firs dragging_line = new ArdourCanvas::PolyLine (parent ? parent : item()); dragging_line->set_ignore_events (true); dragging_line->set_outline_width (2.0); - dragging_line->set_outline_color (UIConfiguration::instance().color ("automation line")); + dragging_line->set_outline_color (UIConfiguration::instance().color ("automation line")); // XXX -> get color from AutomationLine dragging_line->raise_to_top (); /* for freehand drawing, we only support left->right direction, for now. */ diff --git a/gtk2_ardour/themes/adwaita_dark-ardour.colors b/gtk2_ardour/themes/adwaita_dark-ardour.colors index 2741c50f8d..0e8521660f 100644 --- a/gtk2_ardour/themes/adwaita_dark-ardour.colors +++ b/gtk2_ardour/themes/adwaita_dark-ardour.colors @@ -365,6 +365,7 @@ + diff --git a/gtk2_ardour/themes/blueberry_milk-ardour.colors b/gtk2_ardour/themes/blueberry_milk-ardour.colors index 8b9e64c1b7..24916c5943 100644 --- a/gtk2_ardour/themes/blueberry_milk-ardour.colors +++ b/gtk2_ardour/themes/blueberry_milk-ardour.colors @@ -356,6 +356,7 @@ + diff --git a/gtk2_ardour/themes/caineville-ardour.colors b/gtk2_ardour/themes/caineville-ardour.colors index bc49928d71..65a3c074aa 100644 --- a/gtk2_ardour/themes/caineville-ardour.colors +++ b/gtk2_ardour/themes/caineville-ardour.colors @@ -357,6 +357,7 @@ + diff --git a/gtk2_ardour/themes/clear_gray-ardour.colors b/gtk2_ardour/themes/clear_gray-ardour.colors index 12896dc987..aeba333bf4 100644 --- a/gtk2_ardour/themes/clear_gray-ardour.colors +++ b/gtk2_ardour/themes/clear_gray-ardour.colors @@ -357,6 +357,7 @@ + diff --git a/gtk2_ardour/themes/cubasish-ardour.colors b/gtk2_ardour/themes/cubasish-ardour.colors index e6c5fe85f5..8818f4e6ba 100644 --- a/gtk2_ardour/themes/cubasish-ardour.colors +++ b/gtk2_ardour/themes/cubasish-ardour.colors @@ -357,6 +357,7 @@ + diff --git a/gtk2_ardour/themes/dark-ardour.colors b/gtk2_ardour/themes/dark-ardour.colors index 61ec97d5fb..10d015df15 100644 --- a/gtk2_ardour/themes/dark-ardour.colors +++ b/gtk2_ardour/themes/dark-ardour.colors @@ -320,7 +320,7 @@ - + @@ -359,6 +359,7 @@ + diff --git a/gtk2_ardour/themes/diehard3-ardour.colors b/gtk2_ardour/themes/diehard3-ardour.colors index 2a26b522e3..459a0ee382 100644 --- a/gtk2_ardour/themes/diehard3-ardour.colors +++ b/gtk2_ardour/themes/diehard3-ardour.colors @@ -358,6 +358,7 @@ + diff --git a/gtk2_ardour/themes/recbox-ardour.colors b/gtk2_ardour/themes/recbox-ardour.colors index 9cd0945f49..f445eb70ed 100644 --- a/gtk2_ardour/themes/recbox-ardour.colors +++ b/gtk2_ardour/themes/recbox-ardour.colors @@ -358,6 +358,7 @@ + diff --git a/gtk2_ardour/themes/unastudia-ardour.colors b/gtk2_ardour/themes/unastudia-ardour.colors index bb72e6b2fd..a989472786 100644 --- a/gtk2_ardour/themes/unastudia-ardour.colors +++ b/gtk2_ardour/themes/unastudia-ardour.colors @@ -356,6 +356,7 @@ + diff --git a/gtk2_ardour/themes/xcolors-ardour.colors b/gtk2_ardour/themes/xcolors-ardour.colors index 20494db25b..5df8e64d6c 100644 --- a/gtk2_ardour/themes/xcolors-ardour.colors +++ b/gtk2_ardour/themes/xcolors-ardour.colors @@ -357,6 +357,7 @@ +