add a Restore Defaults button to the theme manager, and another set of waveform changes
authorDoug McLain <doug@nostar.net>
Sat, 19 Jan 2008 19:33:13 +0000 (19:33 +0000)
committerDoug McLain <doug@nostar.net>
Sat, 19 Jan 2008 19:33:13 +0000 (19:33 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2949 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour2_ui_default.conf
gtk2_ardour/theme_manager.cc
gtk2_ardour/theme_manager.h
gtk2_ardour/ui_config.cc
gtk2_ardour/ui_config.h

index de5752a46cc934522a6d69f2088916f23f9e3bd0..f955ea40789bd8a33c37ca48ec9c2e05b8ea1105 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Ardour>
   <Canvas>
-    <Option name="waveform" value="000000d6"/>
-    <Option name="waveform fill" value="0b225a78"/>
+    <Option name="waveform" value="0f0f0fcc"/>
+    <Option name="waveform fill" value="3d475378"/>
     <Option name="clipped waveform" value="ff0000e5"/>
-    <Option name="region base" value="b2bcd3aa"/>
+    <Option name="region base" value="99a7b5aa"/>
     <Option name="selected region base" value="b591a8ff"/>
     <Option name="audio track base" value="c6d3d868"/>
     <Option name="audio bus base" value="dbd1ea68"/>
index f989534ef472f96c44940174812136405e4e178e..8d4daf0a3d372d527db590f498cb1ca208d58bbd 100644 (file)
@@ -44,7 +44,8 @@ sigc::signal<void,uint32_t> ColorChanged;
 ThemeManager::ThemeManager()
        : ArdourDialog ("ThemeManager"),
        dark_button ("Dark Theme"),
-       light_button ("Light Theme")
+       light_button ("Light Theme"),
+       reset_button ("Restore Defaults")
 {
        color_list = ListStore::create (columns);
        color_display.set_model (color_list);
@@ -71,6 +72,7 @@ ThemeManager::ThemeManager()
 
        get_vbox()->set_homogeneous(false);
        get_vbox()->pack_start (theme_selection_hbox, PACK_SHRINK);
+       get_vbox()->pack_start (reset_button, PACK_SHRINK);
        get_vbox()->pack_start (scroller);
 
        color_display.signal_button_press_event().connect (mem_fun (*this, &ThemeManager::button_press_event), false);
@@ -82,6 +84,7 @@ ThemeManager::ThemeManager()
        color_dialog.get_cancel_button()->signal_clicked().connect (bind (mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
        dark_button.signal_toggled().connect (mem_fun (*this, &ThemeManager::on_dark_theme_button_toggled));
        light_button.signal_toggled().connect (mem_fun (*this, &ThemeManager::on_light_theme_button_toggled));
+       reset_button.signal_clicked().connect (mem_fun (*this, &ThemeManager::reset_canvas_colors));
 
        set_size_request (-1, 400);
        setup_theme ();
@@ -210,6 +213,8 @@ void
 ThemeManager::setup_theme ()
 {
        int r, g, b, a;
+       color_list->clear();
+
        for (std::vector<UIConfigVariable<uint32_t> *>::iterator i = ARDOUR_UI::config()->canvas_colors.begin(); i != ARDOUR_UI::config()->canvas_colors.end(); i++) {
                
                TreeModel::Row row = *(color_list->append());
@@ -246,3 +251,10 @@ ThemeManager::setup_theme ()
        load_rc_file(rcfile, false);
 }
 
+void
+ThemeManager::reset_canvas_colors()
+{
+       ARDOUR_UI::config()->load_defaults();
+       setup_theme ();
+}
+
index 7ac3111b2ad97458034c521cce59171691bac741..3419cf0768ec506ceefb421c4531c56da6a0639b 100644 (file)
@@ -25,6 +25,7 @@
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/colorselection.h>
 #include <gtkmm/radiobutton.h>
+#include <gtkmm/button.h>
 #include <gtkmm/rc.h>
 #include "ardour_dialog.h"
 #include "ui_config.h"
@@ -37,6 +38,7 @@ class ThemeManager : public ArdourDialog
 
        int save (std::string path);
        void setup_theme ();
+       void reset_canvas_colors();
        
        void on_dark_theme_button_toggled ();
        void on_light_theme_button_toggled ();
@@ -66,6 +68,7 @@ class ThemeManager : public ArdourDialog
        Gtk::HBox theme_selection_hbox;
        Gtk::RadioButton dark_button;
        Gtk::RadioButton light_button;
+       Gtk::Button reset_button;
 
        bool button_press_event (GdkEventButton*);
 };
index b4524f9cc6b8a9d9af555861c690da98d53bc518..78574542d699d189726bafcd7ee9129b7e5ed148 100644 (file)
@@ -54,16 +54,15 @@ UIConfiguration::~UIConfiguration ()
 }
 
 int
-UIConfiguration::load_state ()
+UIConfiguration::load_defaults ()
 {
-       bool found = false;
-
+       int found = 0;
        std::string rcfile = find_config_file ("ardour2_ui_default.conf");
        
        if (rcfile.length())
        {
                XMLTree tree;
-               found = true;
+               found = 1;
 
                cerr << string_compose (_("loading default ui configuration file %1"), rcfile) << endl;
                
@@ -77,8 +76,14 @@ UIConfiguration::load_state ()
                        return -1;
                }
        }
-
-       rcfile = find_config_file ("ardour2_ui.conf");
+       return found;
+}
+       
+int
+UIConfiguration::load_state ()
+{
+       int found = load_defaults ();
+       std::string rcfile = find_config_file ("ardour2_ui.conf");
 
        if (rcfile.length())
        {
index f6bb5c12a32cbb481420f91f999992369f6b9b08..46cd3c9ad5006c03ad316a999cbc18f4b4aa3a0a 100644 (file)
@@ -110,6 +110,7 @@ class UIConfiguration : public Stateful
 
        int load_state ();
        int save_state ();
+       int load_defaults ();
 
        int set_state (const XMLNode&);
        XMLNode& get_state (void);