From e0cb9efb003500fea319552a772364f00753a26f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 16 Dec 2014 00:05:45 -0500 Subject: [PATCH] Various color tweaks. This commit changes some color names, nuke your theme. This isn't quite ideal yet, but takes some steps towards where I think things should go aesthetically: Make automation tracks/regions colors correspond to their parent's type. Make selected MIDI notes outlined in red like most everything else, and scrap separate min/mid/max fill colors for selected MIDI notes. Color automation ghost MIDI notes based on original note color. Try to kill 90's looking brightish gray gradients in general. --- gtk2_ardour/automation_region_view.cc | 1 + gtk2_ardour/automation_streamview.cc | 28 +++++----- gtk2_ardour/automation_time_axis.cc | 6 ++- gtk2_ardour/dark.colors | 74 +++++++++++++-------------- gtk2_ardour/ghostregion.cc | 6 +-- gtk2_ardour/midi_region_view.cc | 5 +- gtk2_ardour/note_base.cc | 10 ++-- gtk2_ardour/note_base.h | 44 ++++++---------- gtk2_ardour/time_axis_view_item.cc | 13 +++-- gtk2_ardour/time_axis_view_item.h | 3 +- gtk2_ardour/ui_config.cc | 6 +++ gtk2_ardour/ui_config.h | 1 + 12 files changed, 97 insertions(+), 100 deletions(-) diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 61b0f1f39c..ac9083e6ed 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -75,6 +75,7 @@ AutomationRegionView::init (bool /*wfd*/) set_height (trackview.current_height()); + _fill_color_name = "midi frame base"; set_colors (); _enable_display = true; diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index c4787f14ea..89ae7fa079 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -31,19 +31,21 @@ #include "ardour/midi_region.h" #include "ardour/midi_source.h" -#include "automation_streamview.h" -#include "region_view.h" +#include "ardour_ui.h" #include "automation_region_view.h" +#include "automation_streamview.h" #include "automation_time_axis.h" -#include "region_selection.h" -#include "selection.h" +#include "global_signals.h" +#include "gui_thread.h" #include "public_editor.h" -#include "ardour_ui.h" +#include "region_selection.h" +#include "region_view.h" #include "rgb_macros.h" -#include "gui_thread.h" +#include "selection.h" using namespace std; using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; using namespace PBD; using namespace Editing; @@ -56,7 +58,9 @@ AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv) CANVAS_DEBUG_NAME (_canvas_group, string_compose ("SV canvas group auto %1", tv.name())); CANVAS_DEBUG_NAME (canvas_rect, string_compose ("SV canvas rectangle auto %1", tv.name())); - canvas_rect->set_fill (false); + color_handler (); + + ColorsChanged.connect(sigc::mem_fun(*this, &AutomationStreamView::color_handler)); } AutomationStreamView::~AutomationStreamView () @@ -191,13 +195,11 @@ AutomationStreamView::setup_rec_box () void AutomationStreamView::color_handler () { - /*if (_trackview.is_midi_track()) { - canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->get_MidiTrackBase(); + if (_trackview.is_midi_track()) { + canvas_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("midi track base", "midi track base")); + } else { + canvas_rect->set_fill_color (ARDOUR_UI::config()->color ("midi bus base")); } - - if (!_trackview.is_midi_track()) { - canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->get_MidiBusBase();; - }*/ } AutoState diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index d4c62a2739..3452da3847 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -110,6 +110,10 @@ AutomationTimeAxisView::AutomationTimeAxisView ( _controller = AutomationController::create (_automatable, _control->parameter(), _control->desc(), _control); } + const std::string fill_color_name = (dynamic_cast(&parent) + ? "midi automation track fill" + : "audio automation track fill"); + automation_menu = 0; auto_off_item = 0; auto_touch_item = 0; @@ -124,7 +128,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( CANVAS_DEBUG_NAME (_base_rect, string_compose ("base rect for %1", _name)); _base_rect->set_x1 (ArdourCanvas::COORD_MAX); _base_rect->set_outline (false); - _base_rect->set_fill_color (ARDOUR_UI::config()->color_mod ("automation track fill", "automation track fill")); + _base_rect->set_fill_color (ARDOUR_UI::config()->color_mod (fill_color_name, "automation track fill")); _base_rect->set_data ("trackview", this); _base_rect->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_automation_track_event), _base_rect, this)); if (!a) { diff --git a/gtk2_ardour/dark.colors b/gtk2_ardour/dark.colors index 5724b09fcd..507f8420ad 100644 --- a/gtk2_ardour/dark.colors +++ b/gtk2_ardour/dark.colors @@ -117,14 +117,14 @@ - + + - + - @@ -141,13 +141,11 @@ - - - + @@ -168,7 +166,7 @@ - + @@ -248,17 +246,18 @@ - - - + + + + - + @@ -271,18 +270,19 @@ + - + - + @@ -336,7 +336,7 @@ - + @@ -368,14 +368,13 @@ + - + - - @@ -398,9 +397,7 @@ - - - + @@ -411,10 +408,10 @@ - + @@ -478,33 +475,34 @@ - + + + + - - - - - - + + - - - + - - - + + - + + - + + + + - - + + + diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index aff64e9845..0813a229bb 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -230,12 +230,10 @@ MidiGhostRegion::set_height () void MidiGhostRegion::set_colors() { - guint fill = source_track_color(200); - GhostRegion::set_colors(); for (EventList::iterator it = events.begin(); it != events.end(); ++it) { - (*it)->rect->set_fill_color (fill); + (*it)->rect->set_fill_color (ARDOUR_UI::config()->color_mod((*it)->event->base_color(), "ghost track midi fill")); (*it)->rect->set_outline_color (ARDOUR_UI::config()->color ("ghost track midi outline")); } } @@ -272,7 +270,7 @@ MidiGhostRegion::add_note (NoteBase* n) GhostEvent* event = new GhostEvent (n, group); events.push_back (event); - event->rect->set_fill_color (source_track_color(200)); + event->rect->set_fill_color (ARDOUR_UI::config()->color_mod(n->base_color(), "ghost track midi fill")); event->rect->set_outline_color (ARDOUR_UI::config()->color ("ghost track midi outline")); MidiStreamView* mv = midi_view(); diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 2e1da30c37..96dd9b27a7 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -274,6 +274,7 @@ MidiRegionView::init (bool wfd) _model = midi_region()->midi_source(0)->model(); _enable_display = false; + _fill_color_name = "midi frame base"; RegionView::init (false); @@ -3282,8 +3283,8 @@ MidiRegionView::set_frame_color() if (_selected) { f = ARDOUR_UI::config()->color ("selected region base"); - } else if (high_enough_for_name) { - f= ARDOUR_UI::config()->color_mod ("midi frame base", "midi frame base"); + } else if (high_enough_for_name || !ARDOUR_UI::config()->get_color_regions_using_track_color()) { + f = ARDOUR_UI::config()->color_mod ("midi frame base", "midi frame base"); } else { f = fill_color; } diff --git a/gtk2_ardour/note_base.cc b/gtk2_ardour/note_base.cc index 158161d62d..71d8dd98fc 100644 --- a/gtk2_ardour/note_base.cc +++ b/gtk2_ardour/note_base.cc @@ -122,7 +122,8 @@ NoteBase::on_channel_selection_change(uint16_t selection) // make note change its color if its channel is not marked active if ( (selection & (1 << _note->channel())) == 0 ) { set_fill_color(ARDOUR_UI::config()->color ("midi note inactive channel")); - set_outline_color(calculate_outline(ARDOUR_UI::config()->color ("midi note inactive channel"))); + set_outline_color(calculate_outline(ARDOUR_UI::config()->color ("midi note inactive channel"), + _selected)); } else { // set the color according to the notes selection state set_selected(_selected); @@ -149,12 +150,7 @@ NoteBase::set_selected(bool selected) _selected = selected; set_fill_color (base_color()); - if (_selected) { - set_outline_color(calculate_outline(ARDOUR_UI::config()->color ("midi note selected"))); - } else { - set_outline_color(calculate_outline(base_color())); - } - + set_outline_color(calculate_outline(base_color(), _selected)); } #define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257) diff --git a/gtk2_ardour/note_base.h b/gtk2_ardour/note_base.h index 22dd9d462e..d426a7b59d 100644 --- a/gtk2_ardour/note_base.h +++ b/gtk2_ardour/note_base.h @@ -103,36 +103,26 @@ class NoteBase : public sigc::trackable MidiRegionView& region_view() const { return _region; } inline static uint32_t meter_style_fill_color(uint8_t vel, bool selected) { - if (selected) { - if (vel < 64) { - return UINT_INTERPOLATE( - ARDOUR_UI::config()->color_mod ("selected midi note min", "selected midi note"), - ARDOUR_UI::config()->color_mod ("selected midi note mid", "selected midi note"), - (vel / (double)63.0)); - } else { - return UINT_INTERPOLATE( - ARDOUR_UI::config()->color_mod ("selected midi note mid", "selected midi note"), - ARDOUR_UI::config()->color_mod ("selected midi note max", "selected midi note"), - ((vel-64) / (double)63.0)); - } - } else { - if (vel < 64) { - return UINT_INTERPOLATE( - ARDOUR_UI::config()->color_mod ("midi note min", "midi note"), - ARDOUR_UI::config()->color_mod ("midi note mid", "midi note"), - (vel / (double)63.0)); - } else { - return UINT_INTERPOLATE( - ARDOUR_UI::config()->color_mod ("midi note mid", "midi note"), - ARDOUR_UI::config()->color_mod ("midi note max", " midi note"), - ((vel-64) / (double)63.0)); - } - } + if (vel < 64) { + return UINT_INTERPOLATE( + ARDOUR_UI::config()->color_mod ("midi note min", "midi note"), + ARDOUR_UI::config()->color_mod ("midi note mid", "midi note"), + (vel / (double)63.0)); + } else { + return UINT_INTERPOLATE( + ARDOUR_UI::config()->color_mod ("midi note mid", "midi note"), + ARDOUR_UI::config()->color_mod ("midi note max", " midi note"), + ((vel-64) / (double)63.0)); + } } /// calculate outline colors from fill colors of notes - inline static uint32_t calculate_outline(uint32_t color) { - return UINT_INTERPOLATE(color, 0x000000ff, 0.5); + inline static uint32_t calculate_outline(uint32_t color, bool selected=false) { + if (selected) { + return ARDOUR_UI::config()->color ("midi note selected outline"); + } else { + return UINT_INTERPOLATE(color, 0x000000ff, 0.5); + } } /// hue circle divided into 16 equal-looking parts, courtesy Thorsten Wilms diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 60b39e1c71..78c5b3299a 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -169,6 +169,7 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event)); fill_color = base_color; + _fill_color_name = "region base"; samples_per_pixel = fpp; frame_position = start; item_duration = duration; @@ -729,21 +730,19 @@ TimeAxisViewItem::fill_opacity () const return 130; } - uint32_t col = ARDOUR_UI::config()->color_mod ("region base", "region base"); + uint32_t col = ARDOUR_UI::config()->color_mod (_fill_color_name, _fill_color_name); return UINT_RGBA_A (col); } uint32_t TimeAxisViewItem::get_fill_color () const { - uint32_t f; - uint32_t o; - - o = fill_opacity (); + uint32_t f; + uint32_t o = fill_opacity (); if (_selected) { - f = ARDOUR_UI::config()->color ("selected region base"); + f = ARDOUR_UI::config()->color ("selected region base"); if (o == 0) { /* some condition of this item has set fill opacity to @@ -759,7 +758,7 @@ TimeAxisViewItem::get_fill_color () const f = ARDOUR_UI::config()->color ("recording rect"); } else { if ((!Config->get_show_name_highlight() || high_enough_for_name) && !ARDOUR_UI::config()->get_color_regions_using_track_color()) { - f = ARDOUR_UI::config()->color_mod ("region base", "region base"); + f = ARDOUR_UI::config()->color_mod (_fill_color_name, _fill_color_name); } else { f = fill_color; } diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index 2488355eef..74a655a6c0 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -76,7 +76,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList void set_color (uint32_t); void set_name_text_color (); - uint32_t get_fill_color () const; + uint32_t get_fill_color () const; ArdourCanvas::Item* get_canvas_frame(); ArdourCanvas::Item* get_canvas_group(); @@ -241,6 +241,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList double _height; Visibility visibility; + std::string _fill_color_name; bool _recregion; bool _automation; ///< true if this is an automation region view bool _dragging; diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index e1aba7d524..8021d3dc9e 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -557,6 +557,12 @@ UIConfiguration::color_mod (std::string const & colorname, std::string const & m return HSV (color (colorname)).mod (modifier (modifiername)).color (); } +ArdourCanvas::Color +UIConfiguration::color_mod (const ArdourCanvas::Color& color, std::string const & modifiername) const +{ + return HSV (color).mod (modifier (modifiername)).color (); +} + ArdourCanvas::Color UIConfiguration::color (const std::string& name, bool* failed) const { diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index c8dcbacf12..244c1a0a82 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -71,6 +71,7 @@ class UIConfiguration : public PBD::Stateful ArdourCanvas::Color color (const std::string&, bool* failed = 0) const; ArdourCanvas::Color color_mod (std::string const & color, std::string const & modifier) const; + ArdourCanvas::Color color_mod (const ArdourCanvas::Color& color, std::string const & modifier) const; ArdourCanvas::HSV color_hsv (const std::string&) const; ArdourCanvas::SVAModifier modifier (const std::string&) const; -- 2.30.2