From 46ed23116e44d1b4182a65511cf7ccf6b00b2a61 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 2 Dec 2014 07:05:14 -0500 Subject: make new color aliases actually work --- gtk2_ardour/ui_config.cc | 25 ++++++++++++++----------- gtk2_ardour/ui_config.h | 14 +------------- 2 files changed, 15 insertions(+), 24 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index d7c9d788b1..cafbd14e18 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -27,6 +27,7 @@ #include "pbd/xml++.h" #include "pbd/file_utils.h" #include "pbd/error.h" +#include "pbd/stacktrace.h" #include "gtkmm2ext/rgb_macros.h" @@ -71,10 +72,6 @@ UIConfiguration::UIConfiguration () #include "base_colors.h" #undef CANVAS_BASE_COLOR -#undef CANVAS_COLOR -#define CANVAS_COLOR(var,name,base,modifier) var (base,modifier), -#include "colors.h" -#undef CANVAS_COLOR _dirty (false) { _instance = this; @@ -88,6 +85,11 @@ UIConfiguration::UIConfiguration () #include "base_colors.h" #undef CANVAS_BASE_COLOR +#undef CANVAS_COLOR +#define CANVAS_COLOR(var,name,base,modifier) relative_colors.insert (make_pair (name, RelativeHSV (base,modifier))); +#include "colors.h" +#undef CANVAS_COLOR + #undef COLOR_ALIAS #define COLOR_ALIAS(var,name,alias) color_aliases.insert (make_pair (name,alias)); #include "color_aliases.h" @@ -662,6 +664,8 @@ UIConfiguration::regenerate_relative_definitions () void UIConfiguration::color_theme_changed () { + return; + map::iterator current_color; /* we need to reset the quantized hues before we start, because @@ -941,7 +945,7 @@ UIConfiguration::base_color_by_name (const std::string& name) const } #endif - cerr << string_compose (_("Color %1 not found"), name) << endl; + cerr << string_compose (_("Base Color %1 not found"), name) << endl; return RGBA_TO_UINT (g_random_int()%256,g_random_int()%256,g_random_int()%256,0xff); } @@ -951,14 +955,14 @@ UIConfiguration::color (const std::string& name) const map::const_iterator e = color_aliases.find (name); if (e != color_aliases.end ()) { - map::const_iterator ac = actual_colors.find (e->second); - if (ac != actual_colors.end()) { - return ac->second; + map::const_iterator rc = relative_colors.find (e->second); + if (rc != relative_colors.end()) { + return rc->second.get(); } - } + } cerr << string_compose (_("Color %1 not found"), name) << endl; - + return rgba_to_color ((g_random_int()%256)/255.0, (g_random_int()%256)/255.0, (g_random_int()%256)/255.0, @@ -1001,7 +1005,6 @@ UIConfiguration::color_compute () map::iterator current_color; color_aliases.clear (); - actual_colors.clear (); for (current_color = relative_colors.begin(); current_color != relative_colors.end(); ++current_color) { diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index 9021fbc60e..49cf27c93a 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -133,13 +133,8 @@ class UIConfiguration : public PBD::Stateful #include "base_colors.h" #undef CANVAS_BASE_COLOR -#undef CANVAS_COLOR -#define CANVAS_COLOR(var,name,base,modifier) ArdourCanvas::Color get_##var() const { return var.get().color(); } -#include "colors.h" -#undef CANVAS_COLOR - #undef COLOR_ALIAS -#define COLOR_ALIAS(var,name,alias) ArdourCanvas::Color get_##var() const { return color (alias); } +#define COLOR_ALIAS(var,name,alias) ArdourCanvas::Color get_##var() const { return color (name); } #include "color_aliases.h" #undef COLOR_ALIAS @@ -184,13 +179,6 @@ class UIConfiguration : public PBD::Stateful #include "base_colors.h" #undef CANVAS_BASE_COLOR - /* declare relative color variables (not directly modifiable) */ - -#undef CANVAS_COLOR -#define CANVAS_COLOR(var,name,base,modifier) RelativeHSV var; -#include "colors.h" -#undef CANVAS_COLOR - XMLNode& state (); bool _dirty; static UIConfiguration* _instance; -- cgit v1.2.3