Make send automation work (#4734).
[ardour.git] / gtk2_ardour / theme_manager.cc
index 47ae4b73905334803ecdd44d9976605a489a6cd9..71300ad07d8bf91e6fa8218037fc5d1354a6d0af 100644 (file)
 
 #include "pbd/file_utils.h"
 
-#include "ardour/configuration.h"
 #include "ardour/filesystem_paths.h"
-#include "ardour/profile.h"
 
+#include "ardour_button.h"
 #include "theme_manager.h"
 #include "rgb_macros.h"
 #include "ardour_ui.h"
@@ -52,10 +51,11 @@ sigc::signal<void> ColorsChanged;
 sigc::signal<void,uint32_t> ColorChanged;
 
 ThemeManager::ThemeManager()
-       : ArdourWindow (_("Theme Manager")),
-         dark_button (_("Dark Theme")),
-         light_button (_("Light Theme")),
-         reset_button (_("Restore Defaults"))
+       : ArdourWindow (_("Theme Manager"))
+       , dark_button (_("Dark Theme"))
+       , light_button (_("Light Theme"))
+       , reset_button (_("Restore Defaults"))
+       , flat_buttons (_("Draw \"flat\" buttons"))
 {
        set_title (_("Theme Manager"));
 
@@ -90,6 +90,7 @@ ThemeManager::ThemeManager()
        vbox->set_homogeneous (false);
        vbox->pack_start (theme_selection_hbox, PACK_SHRINK);
        vbox->pack_start (reset_button, PACK_SHRINK);
+       vbox->pack_start (flat_buttons, PACK_SHRINK);
        vbox->pack_start (scroller);
        add (*vbox);
 
@@ -103,6 +104,7 @@ ThemeManager::ThemeManager()
        dark_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_dark_theme_button_toggled));
        light_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_light_theme_button_toggled));
        reset_button.signal_clicked().connect (sigc::mem_fun (*this, &ThemeManager::reset_canvas_colors));
+       flat_buttons.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_flat_buttons_toggled));
 
        set_size_request (-1, 400);
        setup_theme ();
@@ -202,13 +204,9 @@ load_rc_file (const string& filename, bool themechange)
 {
        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)) {
+       if (!find_file_in_search_path (ardour_config_search_path(), filename, rc_file_path)) {
                warning << string_compose (_("Unable to find UI style file %1 in search path %2. %3 will look strange"),
-                                           filename, spath.to_string(), PROGRAM_NAME)
+                                           filename, ardour_config_search_path().to_string(), PROGRAM_NAME)
                                << endmsg;
                return;
        }
@@ -230,6 +228,16 @@ load_rc_file (const string& filename, bool themechange)
 
 #define HACK_PROFILE_IS_SAE() (getenv("ARDOUR_SAE")!=0)
 
+void
+ThemeManager::on_flat_buttons_toggled ()
+{
+       ARDOUR_UI::config()->flat_buttons.set (flat_buttons.get_active());
+       ARDOUR_UI::config()->set_dirty ();
+       ArdourButton::set_flat_buttons (flat_buttons.get_active());
+       /* force a redraw */
+       gtk_rc_reset_styles (gtk_settings_get_default());
+}
+
 void
 ThemeManager::on_dark_theme_button_toggled()
 {
@@ -334,10 +342,12 @@ ThemeManager::setup_theme ()
 
        if (rcfile == "ardour3_ui_dark.rc" || rcfile == "ardour3_ui_dark_sae.rc") {
                dark_button.set_active();
-       } else if (rcfile == "ardour3_ui_light.rc" || "ardour3_ui_light_sae.rc") {
+       } else if (rcfile == "ardour3_ui_light.rc" || rcfile == "ardour3_ui_light_sae.rc") {
                light_button.set_active();
        }
-
+       
+       flat_buttons.set_active (ARDOUR_UI::config()->flat_buttons.get());
+       
        load_rc_file(rcfile, false);
 }