- Call channel pressure channel pressure, not aftertouch (that's key specific).
[ardour.git] / gtk2_ardour / ui_config.cc
index 80cd612ee7fca6ff5c3afe647557035b54e10608..37a0ade3fe120e98d62481b6ebe25447b41f89fa 100644 (file)
@@ -20,6 +20,8 @@
 #include <unistd.h>
 #include <cstdio> /* for snprintf, grrr */
 
+#include <glibmm/miscutils.h>
+
 #include <pbd/failed_constructor.h>
 #include <pbd/xml++.h>
 #include <pbd/filesystem.h>
@@ -56,11 +58,40 @@ UIConfiguration::~UIConfiguration ()
 {
 }
 
+int
+UIConfiguration::load_defaults ()
+{
+       int found = 0;
+       sys::path default_ui_rc_file;
+       
+       if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(),
+                       "ardour3_ui_default.conf", default_ui_rc_file) )
+       {
+               XMLTree tree;
+               found = 1;
+
+               string rcfile = default_ui_rc_file.to_string();
+
+               cerr << string_compose (_("loading default ui configuration file %1"), rcfile) << endl;
+               
+               if (!tree.read (rcfile.c_str())) {
+                       error << string_compose(_("Ardour: cannot read default ui configuration file \"%1\""), rcfile) << endmsg;
+                       return -1;
+               }
+
+               if (set_state (*tree.root())) {
+                       error << string_compose(_("Ardour: default ui configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
+                       return -1;
+               }
+       }
+       return found;
+}
+       
 int
 UIConfiguration::load_state ()
 {
        bool found = false;
-
+       
        sys::path default_ui_rc_file;
        
        if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(),
@@ -119,12 +150,10 @@ UIConfiguration::save_state()
 {
        XMLTree tree;
 
-       try
-       {
+       try {
                sys::create_directories (user_config_directory ());
        }
-       catch (const sys::filesystem_error& ex)
-       {
+       catch (const sys::filesystem_error& ex) {
                error << "Could not create user configuration directory" << endmsg;
                return -1;
        }