make new color aliases actually work
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 2 Dec 2014 12:05:14 +0000 (07:05 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 5 Dec 2014 14:01:55 +0000 (09:01 -0500)
gtk2_ardour/ui_config.cc
gtk2_ardour/ui_config.h

index d7c9d788b17efc698161b2b7668f1b4365424c57..cafbd14e184590a955c558e1187254ec4d57a20a 100644 (file)
@@ -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<std::string,RelativeHSV>::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<string,string>::const_iterator e = color_aliases.find (name);
 
        if (e != color_aliases.end ()) {
-               map<string,HSV>::const_iterator ac = actual_colors.find (e->second);
-               if (ac != actual_colors.end()) {
-                       return ac->second;
+               map<string,RelativeHSV>::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<std::string,RelativeHSV>::iterator current_color;
        
        color_aliases.clear ();
-       
        actual_colors.clear ();
 
        for (current_color = relative_colors.begin(); current_color != relative_colors.end(); ++current_color) {
index 9021fbc60ea084dccc881a91d95a1c8239515083..49cf27c93ada275c4ca37a836e20d6e3e695e4c8 100644 (file)
@@ -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;