diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in index f73535e223..08fcc409f1 100644 --- a/gtk2_ardour/ardev_common.sh.in +++ b/gtk2_ardour/ardev_common.sh.in @@ -15,6 +15,7 @@ export ARDOUR_PANNER_PATH=$libs/panners export ARDOUR_DATA_PATH=$TOP:$TOP/build:$TOP/gtk2_ardour:$TOP/build/gtk2_ardour:. export ARDOUR_MIDIMAPS_PATH=$TOP/midi_maps:. export ARDOUR_EXPORT_FORMATS_PATH=$TOP/export:. +export ARDOUR_THEMES_PATH=$TOP/themes:. export ARDOUR_BACKEND_PATH=$libs/backends/jack:$libs/backends/wavesaudio:$libs/backends/dummy:$libs/backends/alsa:$libs/backends/coreaudio:$libs/backends/portaudio:$libs/backends/asio export ARDOUR_TEST_PATH=$TOP/libs/ardour/test/data export PBD_TEST_PATH=$TOP/libs/pbd/test diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index e1daeabb60..18ac65662c 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -73,10 +73,13 @@ ThemeManager::ThemeManager() , transients_follow_front (_("Transient windows follow front window.")) , floating_monitor_section (_("Float detached monitor-section window")) , icon_set_label (_("Icon Set")) + , color_theme_label (_("Color Theme")) , palette_viewport (*palette_scroller.get_hadjustment(), *palette_scroller.get_vadjustment()) , palette_group (0) , palette_window (0) { + Gtk::HBox* hbox; + /* Now the alias list */ alias_list = TreeStore::create (alias_columns); @@ -108,9 +111,20 @@ 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 + + vector color_themes = ::get_color_themes (); + + if (color_themes.size() > 1) { + Gtkmm2ext::set_popdown_strings (color_theme_dropdown, color_themes); + color_theme_dropdown.set_active_text (UIConfiguration::instance().get_color_file()); + + hbox = Gtk::manage (new Gtk::HBox()); + hbox->set_spacing (6); + hbox->pack_start (color_theme_label, false, false); + hbox->pack_start (color_theme_dropdown, true, false); + pack_start (*hbox, PACK_SHRINK); + } + pack_start (reset_button, PACK_SHRINK); #ifndef __APPLE__ pack_start (all_dialogs, PACK_SHRINK); @@ -124,8 +138,6 @@ ThemeManager::ThemeManager() pack_start (region_color_button, PACK_SHRINK); pack_start (show_clipping_button, PACK_SHRINK); - Gtk::HBox* hbox; - vector icon_sets = ::get_icon_sets (); if (icon_sets.size() > 1) { @@ -135,11 +147,10 @@ ThemeManager::ThemeManager() hbox = Gtk::manage (new Gtk::HBox()); hbox->set_spacing (6); hbox->pack_start (icon_set_label, false, false); - hbox->pack_start (icon_set_dropdown, true, true); + hbox->pack_start (icon_set_dropdown, true, false); pack_start (*hbox, PACK_SHRINK); } - hbox = Gtk::manage (new Gtk::HBox()); hbox->set_spacing (6); hbox->pack_start (waveform_gradient_depth, true, true); @@ -190,6 +201,7 @@ ThemeManager::ThemeManager() transients_follow_front.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_transients_follow_front_toggled)); floating_monitor_section.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_floating_monitor_section_toggled)); icon_set_dropdown.signal_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_icon_set_changed)); + color_theme_dropdown.signal_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_color_theme_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" @@ -344,6 +356,13 @@ ThemeManager::on_icon_set_changed () UIConfiguration::instance().set_icon_set (new_set); } +void +ThemeManager::on_color_theme_changed () +{ + string new_theme = color_theme_dropdown.get_active_text(); + UIConfiguration::instance().set_color_file (new_theme); +} + void ThemeManager::on_dark_theme_button_toggled() { @@ -400,7 +419,7 @@ ThemeManager::reset_canvas_colors() basename = "my-"; basename += UIConfiguration::instance().get_color_file(); - basename += ".colors"; + basename += UIConfiguration::color_file_suffix; if (find_file (ardour_config_search_path(), basename, cfile)) { string backup = cfile + string (X_(".old")); diff --git a/gtk2_ardour/theme_manager.h b/gtk2_ardour/theme_manager.h index 36e85e5dd9..366fc8aad8 100644 --- a/gtk2_ardour/theme_manager.h +++ b/gtk2_ardour/theme_manager.h @@ -62,6 +62,7 @@ class ThemeManager : public Gtk::VBox void on_transients_follow_front_toggled (); void on_floating_monitor_section_toggled (); void on_icon_set_changed (); + void on_color_theme_changed (); private: Gtk::Notebook notebook; @@ -97,6 +98,8 @@ class ThemeManager : public Gtk::VBox Gtk::CheckButton gradient_waveforms; Gtk::Label icon_set_label; Gtk::ComboBoxText icon_set_dropdown; + Gtk::Label color_theme_label; + Gtk::ComboBoxText color_theme_dropdown; /* handls response from color dialog when it is used to edit a derived color. @@ -176,4 +179,3 @@ class ThemeManager : public Gtk::VBox }; #endif /* __ardour_gtk_color_manager_h__ */ - diff --git a/gtk2_ardour/themes/Blueberry Milk.colors b/gtk2_ardour/themes/Blueberry Milk.colors new file mode 100755 index 0000000000..c65c1c5b2d --- /dev/null +++ b/gtk2_ardour/themes/Blueberry Milk.colors @@ -0,0 +1,518 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gtk2_ardour/themes/Cainelton.colors b/gtk2_ardour/themes/Cainelton.colors new file mode 100755 index 0000000000..44180308fc --- /dev/null +++ b/gtk2_ardour/themes/Cainelton.colors @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gtk2_ardour/themes/Cubasish.colors b/gtk2_ardour/themes/Cubasish.colors new file mode 100755 index 0000000000..e2436c3c96 --- /dev/null +++ b/gtk2_ardour/themes/Cubasish.colors @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gtk2_ardour/dark.colors b/gtk2_ardour/themes/Dark.colors similarity index 100% rename from gtk2_ardour/dark.colors rename to gtk2_ardour/themes/Dark.colors diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index d456a95794..317b5e4688 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -50,6 +50,7 @@ #include "gtkmm2ext/gtk_ui.h" #include "ardour/filesystem_paths.h" +#include "ardour/search_paths.h" #include "ardour/utils.h" #include "ui_config.h" @@ -65,6 +66,7 @@ static const char* ui_config_file_name = "ui_config"; static const char* default_ui_config_file_name = "default_ui_config"; static const double hue_width = 18.0; +std::string UIConfiguration::color_file_suffix = X_(".colors"); UIConfiguration& UIConfiguration::instance () @@ -265,21 +267,23 @@ UIConfiguration::load_color_theme (bool allow_own) */ PBD::Unwinder uw (block_save, block_save + 1); + std::cerr << "\n\n\nLoading COLOR " << color_file.get() << std::endl; + if (allow_own) { basename = "my-"; basename += color_file.get(); - basename += ".colors"; + basename += color_file_suffix; - if (find_file (ardour_config_search_path(), basename, cfile)) { + if (find_file (theme_search_path(), basename, cfile)) { found = true; } } if (!found) { basename = color_file.get(); - basename += ".colors"; + basename += color_file_suffix; - if (find_file (ardour_config_search_path(), basename, cfile)) { + if (find_file (theme_search_path(), basename, cfile)) { found = true; } } @@ -346,7 +350,7 @@ UIConfiguration::store_color_theme () root->add_child_nocopy (*parent); XMLTree tree; - std::string colorfile = Glib::build_filename (user_config_directory(), (string ("my-") + color_file.get() + ".colors")); + std::string colorfile = Glib::build_filename (user_config_directory(), (string ("my-") + color_file.get() + color_file_suffix)); tree.set_root (root); @@ -749,5 +753,3 @@ UIConfiguration::load_rc_file (bool themechange, bool allow_own) Gtkmm2ext::UI::instance()->load_rcfile (rc_file_path, themechange); } - - diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index 06338aae39..76a628b9be 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -46,6 +46,8 @@ private: public: static UIConfiguration& instance(); + static std::string color_file_suffix; + void load_rc_file (bool themechange, bool allow_own = true); int load_state (); @@ -144,4 +146,3 @@ private: }; #endif /* __ardour_ui_configuration_h__ */ - diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 1e7b987136..404348754f 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -19,7 +19,7 @@ UI_CONFIG_VARIABLE (std::string, icon_set, "icon-set", "default") UI_CONFIG_VARIABLE (std::string, ui_rc_file, "ui-rc-file", "clearlooks.rc") -UI_CONFIG_VARIABLE (std::string, color_file, "color-file", "dark") +UI_CONFIG_VARIABLE (std::string, color_file, "color-file", "Dark") UI_CONFIG_VARIABLE (bool, flat_buttons, "flat-buttons", false) UI_CONFIG_VARIABLE (bool, blink_rec_arm, "blink-rec-arm", false) UI_CONFIG_VARIABLE (float, waveform_gradient_depth, "waveform-gradient-depth", 0) diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index ca6c0608ce..12c01fb7d0 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -36,11 +36,13 @@ #include #include +#include "pbd/basename.h" #include "pbd/file_utils.h" #include #include "ardour/filesystem_paths.h" +#include "ardour/search_paths.h" #include "canvas/item.h" #include "canvas/utils.h" @@ -416,6 +418,36 @@ ARDOUR_UI_UTILS::get_xpm (std::string name) return xpm_map[name]; } +vector +ARDOUR_UI_UTILS::get_color_themes () +{ + Searchpath spath(ARDOUR::theme_search_path()); + vector r; + + for (vector::iterator s = spath.begin(); s != spath.end(); ++s) { + + vector entries; + + find_files_matching_pattern (entries, *s, string ("*") + UIConfiguration::color_file_suffix); + + for (vector::iterator e = entries.begin(); e != entries.end(); ++e) { + + XMLTree tree; + + tree.read ((*e).c_str()); + XMLNode* root = tree.root(); + + if (!root || root->name() != X_("Ardour")) { + continue; + } + + r.push_back (Glib::filename_to_utf8 (basename_nosuffix(*e))); + } + } + + return r; +} + vector ARDOUR_UI_UTILS::get_icon_sets () { @@ -669,7 +701,7 @@ ARDOUR_UI_UTILS::escape_underscores (string const & s) Gdk::Color ARDOUR_UI_UTILS::unique_random_color (list& used_colors) { - Gdk::Color newcolor; + Gdk::Color newcolor; while (1) { diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index 1793631326..03a68558b5 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -72,6 +72,7 @@ bool emulate_key_event (unsigned int); Glib::RefPtr get_xpm (std::string); std::vector get_icon_sets (); +std::vector get_color_themes (); std::string get_icon_path (const char*, std::string icon_set = std::string(), bool is_image = true); Glib::RefPtr get_icon (const char*, std::string icon_set = std::string()); static std::map > xpm_map;