Move some code from ARDOUR_UI::setup_theme to ThemeManager::setup_theme

git-svn-id: svn://localhost/ardour2/trunk@2059 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry 2007-06-27 12:12:38 +00:00
parent 7efe2f0eca
commit f9910c90ea
2 changed files with 34 additions and 33 deletions

View file

@ -1514,25 +1514,6 @@ ARDOUR_UI::do_engine_start ()
void
ARDOUR_UI::setup_theme ()
{
string rcfile;
char* env;
if ((env = getenv ("ARDOUR2_UI_RC")) != 0 && strlen (env)) {
rcfile = env;
} else {
rcfile = Config->get_ui_rc_file();
}
rcfile = find_config_file (rcfile);
if (rcfile.empty()) {
warning << _("Without a UI style file, ardour will look strange.\n Please set ARDOUR2_UI_RC to point to a valid UI style file") << endmsg;
} else {
cerr << "Loading ui configuration file " << rcfile << endl;
}
load_rcfile(rcfile);
theme_manager->setup_theme();
}

View file

@ -173,6 +173,27 @@ ThemeManager::button_press_event (GdkEventButton* ev)
return false;
}
void
load_rc_file (const string& filename)
{
sys::path rc_file_path;
SearchPath spath (ardour_search_path());
spath += user_config_directory();
spath += system_config_search_path();
if(!find_file_in_search_path (spath, filename, rc_file_path))
{
warning << string_compose(_("Unable to find UI style file %1 in search path %2. Ardour will look strange"),
filename, spath.get_string())
<< endmsg;
return;
}
info << "Loading ui configuration file " << rc_file_path.to_string() << endmsg;
Gtkmm2ext::UI::instance()->load_rcfile (rc_file_path.to_string());
}
void
ThemeManager::load_rc(int which)
@ -183,12 +204,7 @@ ThemeManager::load_rc(int which)
Config->set_ui_rc_file("ardour2_ui_light.rc");
}
sys::path rc_file_path;
find_file_in_search_path (ardour_search_path() + system_config_search_path(),
Config->get_ui_rc_file(), rc_file_path);
Gtkmm2ext::UI::instance()->load_rcfile (rc_file_path.to_string());
load_rc_file (Config->get_ui_rc_file());
}
void
@ -213,18 +229,22 @@ ThemeManager::setup_theme ()
//cerr << (*i)->name() << " == " << rgba << endl;
}
cerr << "ThemeManager::setup_theme () called" << endl;
ColorsChanged(); //EMIT SIGNAL
if (getenv ("ARDOUR2_UI_RC")) {
return;
ColorsChanged.emit();
bool env_defined = false;
string rcfile = Glib::getenv("ARDOUR2_UI_RC", env_defined);
if(!env_defined) {
rcfile = Config->get_ui_rc_file();
}
if (Config->get_ui_rc_file() == "ardour2_ui_dark.rc") {
if (rcfile == "ardour2_ui_dark.rc") {
dark_button.set_active();
} else if (Config->get_ui_rc_file() == "ardour2_ui_light.rc") {
} else if (rcfile == "ardour2_ui_light.rc") {
light_button.set_active();
}
load_rc_file(rcfile);
}