summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/ardour_ui.cc4
-rw-r--r--gtk2_ardour/ardour_ui.h2
-rw-r--r--gtk2_ardour/main.cc9
-rw-r--r--gtk2_ardour/ui_config.cc24
-rw-r--r--gtk2_ardour/ui_config.h12
5 files changed, 41 insertions, 10 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 941d0ac119..941e8b962e 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -181,10 +181,10 @@ ask_about_configuration_copy (string const & old_dir, string const & new_dir, in
return (msg.run() == Gtk::RESPONSE_YES);
}
-ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
+ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfiguration* uic)
: Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
- , ui_config (new UIConfiguration)
+ , ui_config (uic->post_gui_init ())
, session_loaded (false)
, gui_object_state (new GUIObjectState)
, primary_clock (new MainClock (X_("primary"), X_("transport"), true ))
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 819455c218..ed8da6d6be 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -140,7 +140,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
UIConfiguration* ui_config;
public:
- ARDOUR_UI (int *argcp, char **argvp[], const char* localedir);
+ ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfiguration*);
~ARDOUR_UI();
bool run_startup (bool should_be_new, std::string load_template);
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index abdfa35877..f43d1bd4f4 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -345,8 +345,15 @@ int main (int argc, char *argv[])
}
#endif
+ UIConfiguration* ui_config = new UIConfiguration;
+
+ if (ui_config->pre_gui_init ()) {
+ error << _("Could not complete pre-GUI initialization") << endmsg;
+ exit (1);
+ }
+
try {
- ui = new ARDOUR_UI (&argc, &argv, localedir.c_str());
+ ui = new ARDOUR_UI (&argc, &argv, localedir.c_str(), ui_config);
} catch (failed_constructor& err) {
error << string_compose (_("could not create %1 GUI"), PROGRAM_NAME) << endmsg;
exit (1);
diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc
index 1040c546ed..f34a5a48b6 100644
--- a/gtk2_ardour/ui_config.cc
+++ b/gtk2_ardour/ui_config.cc
@@ -78,10 +78,6 @@ UIConfiguration::UIConfiguration ()
ARDOUR_UI_UTILS::ColorsChanged.connect (boost::bind (&UIConfiguration::colors_changed, this));
ParameterChanged.connect (sigc::mem_fun (*this, &UIConfiguration::parameter_changed));
-
- /* force GTK theme setting, so that loading an RC file will work */
-
- load_color_theme ();
}
UIConfiguration::~UIConfiguration ()
@@ -152,6 +148,23 @@ UIConfiguration::map_parameters (boost::function<void (std::string)>& functor)
}
int
+UIConfiguration::pre_gui_init ()
+{
+ if (get_buggy_gradients()) {
+ g_setenv ("FORCE_BUGGY_GRADIENTS", "1", 1);
+ }
+
+ return 0;
+}
+
+UIConfiguration*
+UIConfiguration::post_gui_init ()
+{
+ load_color_theme ();
+ return this;
+}
+
+int
UIConfiguration::load_defaults ()
{
std::string rcfile;
@@ -177,13 +190,14 @@ UIConfiguration::load_defaults ()
warning << string_compose (_("Could not find default UI configuration file %1"), default_ui_config_file_name) << endmsg;
}
+
if (ret == 0) {
/* reload color theme */
load_color_theme (false);
ARDOUR_UI_UTILS::ColorsChanged (); /* EMIT SIGNAL */
}
- return 0;
+ return ret;
}
int
diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h
index c9f950d947..285bc5366a 100644
--- a/gtk2_ardour/ui_config.h
+++ b/gtk2_ardour/ui_config.h
@@ -48,6 +48,7 @@ class UIConfiguration : public PBD::Stateful
int load_state ();
int save_state ();
int load_defaults ();
+ int load_color_theme (bool allow_own=true);
int set_state (const XMLNode&, int version);
XMLNode& get_state (void);
@@ -79,6 +80,16 @@ class UIConfiguration : public PBD::Stateful
void map_parameters (boost::function<void (std::string)>&);
void parameter_changed (std::string);
+
+ /** called before initializing any part of the GUI. Sets up
+ * any runtime environment required to make the GUI work
+ * in specific ways.
+ */
+ int pre_gui_init ();
+
+ /** called after the GUI toolkit has been initialized.
+ */
+ UIConfiguration* post_gui_init ();
#undef UI_CONFIG_VARIABLE
#define UI_CONFIG_VARIABLE(Type,var,name,value) \
@@ -118,7 +129,6 @@ class UIConfiguration : public PBD::Stateful
void load_modifiers (XMLNode const &);
void reset_gtk_theme ();
void colors_changed ();
- int load_color_theme (bool allow_own=true);
uint32_t block_save;
};