display active peak-builds
[ardour.git] / gtk2_ardour / theme_manager.cc
index 44389da71197405d5039daaa068e3ffe06cf818b..1f1baa84f1734114e1c1354480f4f7f4a0ee4d40 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "fix_carbon.h"
 
+#include <glib/gstdio.h>
+
 #include <gtkmm/stock.h>
 #include <gtkmm/settings.h>
 
@@ -74,6 +76,7 @@ ThemeManager::ThemeManager()
        , timeline_item_gradient_depth (0, 1.0, 0.05)
        , timeline_item_gradient_depth_label (_("Timeline item gradient depth"))
        , all_dialogs (_("All floating windows are dialogs"))
+       , transients_follow_front (_("Transient windows follow front window."))
        , icon_set_label (_("Icon Set"))
        , palette_viewport (*palette_scroller.get_hadjustment(), *palette_scroller.get_vadjustment())
        , palette_group (0)
@@ -111,10 +114,13 @@ ThemeManager::ThemeManager()
        theme_selection_hbox.pack_start (light_button);
 
        set_homogeneous (false);
+#if 0 // disable light/dark theme choice. until the 'light theme gets some attention.
        pack_start (theme_selection_hbox, PACK_SHRINK);
+#endif
        pack_start (reset_button, PACK_SHRINK);
 #ifndef __APPLE__
        pack_start (all_dialogs, PACK_SHRINK);
+       pack_start (transients_follow_front, PACK_SHRINK);
 #endif
        pack_start (flat_buttons, PACK_SHRINK);
        pack_start (blink_rec_button, PACK_SHRINK);
@@ -184,12 +190,16 @@ ThemeManager::ThemeManager()
        waveform_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_waveform_gradient_depth_change));
        timeline_item_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_timeline_item_gradient_depth_change));
        all_dialogs.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_all_dialogs_toggled));
+       transients_follow_front.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_transients_follow_front_toggled));
        icon_set_dropdown.signal_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_icon_set_changed));
 
        Gtkmm2ext::UI::instance()->set_tip (all_dialogs, 
                                            string_compose (_("Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
                                                              "This may help with some window managers. This requires a restart of %1 to take effect"),
                                                            PROGRAM_NAME));
+       Gtkmm2ext::UI::instance()->set_tip (transients_follow_front, 
+                                           string_compose (_("Make transient windows follow the front window when toggling between the editor and mixer.\n"
+                                                             "This requires a restart of %1 to take effect"), PROGRAM_NAME));
 
        set_size_request (-1, 400);
        /* no need to call setup_palette() here, it will be done when its size is allocated */
@@ -297,6 +307,12 @@ ThemeManager::on_all_dialogs_toggled ()
        ARDOUR_UI::config()->set_all_floating_windows_are_dialogs (all_dialogs.get_active());
 }
 
+void
+ThemeManager::on_transients_follow_front_toggled ()
+{
+       ARDOUR_UI::config()->set_transients_follow_front (transients_follow_front.get_active());
+}
+
 void
 ThemeManager::on_waveform_gradient_depth_change ()
 {
@@ -358,6 +374,8 @@ ThemeManager::set_ui_to_state()
        /* there is no need to block signal handlers, here,
         * all elements check if the value has changed and ignore NOOPs 
         */
+       all_dialogs.set_active (ARDOUR_UI::config()->get_all_floating_windows_are_dialogs());
+       transients_follow_front.set_active (ARDOUR_UI::config()->get_transients_follow_front());
        flat_buttons.set_active (ARDOUR_UI::config()->get_flat_buttons());
        blink_rec_button.set_active (ARDOUR_UI::config()->get_blink_rec_arm());
        region_color_button.set_active (ARDOUR_UI::config()->get_color_regions_using_track_color());
@@ -369,6 +387,19 @@ ThemeManager::set_ui_to_state()
 void
 ThemeManager::reset_canvas_colors()
 {
+       string cfile;
+       string basename;
+
+       basename = "my-";
+       basename += ARDOUR_UI::config()->get_color_file();
+       basename += ".colors";
+
+       if (find_file (ardour_config_search_path(), basename, cfile)) {
+               string backup = cfile + string (X_(".old"));
+               g_rename (cfile.c_str(), backup.c_str());
+               /* don't really care if it fails */
+       }
+
        ARDOUR_UI::config()->load_defaults();
        ARDOUR_UI::config()->save_state ();
        set_ui_to_state();