From d425a43b26c0081e93ef8a23692d9ed7fc635b89 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 7 Dec 2014 14:20:17 -0500 Subject: fix up various issues with UIConfiguration, saving state, RC file loading etc. --- gtk2_ardour/theme_manager.cc | 3 ++- gtk2_ardour/ui_config.cc | 31 +++++++++++++++---------------- gtk2_ardour/ui_config.h | 5 ++--- 3 files changed, 19 insertions(+), 20 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index a241637a9b..2be69d65b9 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -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() diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 66d4472f71..915c117682 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -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 diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index d3c48680ac..7637bcf228 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -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; -- cgit v1.2.3