X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftheme_manager.cc;h=442ba77e4176ffcb72b6db18e9c97bfdec9a69d0;hb=44680aa1bb6c42d261e4b6424d5d76fd42f26624;hp=887ca5453c0b9c980ede46d5e0c79bb4979348af;hpb=2f96c5b2dd32c6071ca38287e3ebd5569bb62de9;p=ardour.git diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index 887ca5453c..442ba77e41 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -32,10 +32,10 @@ #include "pbd/file_utils.h" -#include "ardour/configuration.h" #include "ardour/filesystem_paths.h" -#include "ardour/profile.h" +#include "ardour_button.h" +#include "canvas-waveview.h" #include "theme_manager.h" #include "rgb_macros.h" #include "ardour_ui.h" @@ -52,10 +52,12 @@ sigc::signal ColorsChanged; sigc::signal 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")) + , gradient_waveforms (_("Draw waveforms with color gradient")) { set_title (_("Theme Manager")); @@ -90,6 +92,8 @@ 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 (gradient_waveforms, PACK_SHRINK); vbox->pack_start (scroller); add (*vbox); @@ -103,6 +107,8 @@ 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)); + gradient_waveforms.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_gradient_waveforms_toggled)); set_size_request (-1, 400); setup_theme (); @@ -200,22 +206,18 @@ ThemeManager::button_press_event (GdkEventButton* ev) void load_rc_file (const string& filename, bool themechange) { - sys::path rc_file_path; + std::string 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; } - info << "Loading ui configuration file " << rc_file_path.to_string() << endmsg; + info << "Loading ui configuration file " << rc_file_path << endmsg; - Gtkmm2ext::UI::instance()->load_rcfile (rc_file_path.to_string(), themechange); + Gtkmm2ext::UI::instance()->load_rcfile (rc_file_path, themechange); } /* hmm, this is a problem. the profile doesn't @@ -230,6 +232,28 @@ 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_gradient_waveforms_toggled () +{ + ARDOUR_UI::config()->gradient_waveforms.set (gradient_waveforms.get_active()); + ARDOUR_UI::config()->set_dirty (); + + gnome_canvas_waveview_set_gradient_waveforms (gradient_waveforms.get_active()); + + /* force a redraw */ + gtk_rc_reset_styles (gtk_settings_get_default()); +} + void ThemeManager::on_dark_theme_button_toggled() { @@ -337,7 +361,10 @@ ThemeManager::setup_theme () } 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()); + gradient_waveforms.set_active (ARDOUR_UI::config()->gradient_waveforms.get()); + load_rc_file(rcfile, false); }