fix up various issues with UIConfiguration, saving state, RC file loading etc.

This commit is contained in:
Paul Davis
2014-12-07 14:20:17 -05:00
parent 9ac7ddb31d
commit d425a43b26
3 changed files with 19 additions and 20 deletions

View 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()

View 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

View 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;