fix up various issues with UIConfiguration, saving state, RC file loading etc.
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 7 Dec 2014 19:20:17 +0000 (14:20 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 7 Dec 2014 19:20:17 +0000 (14:20 -0500)
gtk2_ardour/theme_manager.cc
gtk2_ardour/ui_config.cc
gtk2_ardour/ui_config.h

index a241637a9b75d865581b1dfdac2752d4a3eb469a..2be69d65b959d7c28ee4f846cebc6d6788cfb669 100644 (file)
@@ -231,7 +231,8 @@ ThemeManager::ThemeManager()
        setup_aliases ();
 
        /* Trigger setting up the GTK color scheme and loading the RC file */
-       ARDOUR_UI::config()->color_theme_changed ();
+       cerr << "Load RC file\n";
+       UIConfiguration::load_rc_file (ARDOUR_UI::config()->get_ui_rc_file(), false);
 }
 
 ThemeManager::~ThemeManager()
index 66d4472f71f57cb1517388479892ca6e788b9b26..915c1176829a455d403d57d8bce1ff37ff979cff 100644 (file)
@@ -104,13 +104,13 @@ UIConfiguration::UIConfiguration ()
 
        load_state();
 
-       ARDOUR_UI_UTILS::ColorsChanged.connect (boost::bind (&UIConfiguration::color_theme_changed, this));
+       ARDOUR_UI_UTILS::ColorsChanged.connect (boost::bind (&UIConfiguration::colors_changed, this));
 
        ParameterChanged.connect (sigc::mem_fun (*this, &UIConfiguration::parameter_changed));
 
-       /* force loading of the GTK rc file */
-
-       parameter_changed ("ui-rc-file");
+       /* force GTK theme setting, so that RC file will work */
+       
+       reset_gtk_theme ();
 }
 
 UIConfiguration::~UIConfiguration ()
@@ -118,7 +118,7 @@ UIConfiguration::~UIConfiguration ()
 }
 
 void
-UIConfiguration::color_theme_changed ()
+UIConfiguration::colors_changed ()
 {
        _dirty = true;
 
@@ -133,9 +133,7 @@ UIConfiguration::color_theme_changed ()
           GTK RC file, which causes a reset of all styles and a redraw
        */
 
-       parameter_changed ("ui-rc-file");
-
-       save_state ();
+       parameter_changed ("ui-rc_file");
 }
 
 void
@@ -144,15 +142,10 @@ UIConfiguration::parameter_changed (string param)
        _dirty = true;
        
        if (param == "ui-rc-file") {
-               bool env_defined = false;
-               string rcfile = Glib::getenv("ARDOUR3_UI_RC", env_defined);
-               
-               if (!env_defined) {
-                       rcfile = get_ui_rc_file();
-               }
-
-               load_rc_file (rcfile, true);
+               load_rc_file (get_ui_rc_file(), true);
        }
+
+       save_state ();
 }
 
 void
@@ -336,6 +329,8 @@ UIConfiguration::save_state()
 {
        XMLTree tree;
 
+       PBD::stacktrace (cerr, 20);
+       
        if (!dirty()) {
                return 0;
        }
@@ -646,6 +641,8 @@ UIConfiguration::reset_relative (const string& name, const RelativeHSV& rhsv)
        derived_modified = true;
 
        ARDOUR_UI_UTILS::ColorsChanged (); /* EMIT SIGNAL */
+
+       save_state ();
 }
 
 void
@@ -660,6 +657,8 @@ UIConfiguration::set_alias (string const & name, string const & alias)
        aliases_modified = true;
 
        ARDOUR_UI_UTILS::ColorsChanged (); /* EMIT SIGNAL */
+
+       save_state ();
 }
 
 void
index d3c48680acb7ff7d5fee2e0b180e6d40d7deaf51..7637bcf228ff1bc5215a7c855402fb28bc10b5f9 100644 (file)
@@ -109,8 +109,6 @@ class UIConfiguration : public PBD::Stateful
        int save_state ();
        int load_defaults ();
 
-       void color_theme_changed ();
-
        static void load_rc_file (std::string const &, bool themechange);
        
        int set_state (const XMLNode&, int version);
@@ -155,7 +153,7 @@ class UIConfiguration : public PBD::Stateful
 #undef CANVAS_BASE_COLOR
 #define CANVAS_BASE_COLOR(var,name,val) \
        ArdourCanvas::Color get_##var() const { return var.get(); } \
-       bool set_##var (ArdourCanvas::Color v) { bool ret = var.set (v); if (ret) { ParameterChanged (#var); } return ret;  } \
+       bool set_##var (ArdourCanvas::Color v) { bool ret = var.set (v); if (ret) { ParameterChanged (name); } return ret;  } \
        bool set_##var(const ArdourCanvas::HSV& v) const { return set_##var (v.color()); }
 #include "base_colors.h"
 #undef CANVAS_BASE_COLOR
@@ -193,6 +191,7 @@ class UIConfiguration : public PBD::Stateful
 
        void load_color_aliases (XMLNode const &);
        void reset_gtk_theme ();
+       void colors_changed ();
        
        XMLNode _saved_state_node;
        int     _saved_state_version;