#include "pbd/i18n.h"
#include "stripable_colorpicker.h"
+#include "ui_config.h"
#include "utils.h"
using namespace Gtk;
using namespace ARDOUR_UI_UTILS;
+bool StripableColorDialog::palette_initialized = false;
+Gtk::ColorSelection::SlotChangePaletteHook StripableColorDialog::gtk_palette_changed_hook;
+
StripableColorDialog::StripableColorDialog ()
{
+ initialize_color_palette ();
signal_response().connect (sigc::mem_fun (*this, &StripableColorDialog::finish_color_edit));
}
reset ();
}
+void
+StripableColorDialog::palette_changed_hook (const Glib::RefPtr<Gdk::Screen>& s, const Gdk::ArrayHandle_Color& c)
+{
+ std::string p = std::string (ColorSelection::palette_to_string (c));
+ UIConfiguration::instance ().set_stripable_color_palette (p);
+ gtk_palette_changed_hook (s, c);
+}
+
+void
+StripableColorDialog::initialize_color_palette ()
+{
+ // non-static member, because it needs a screen()
+ if (palette_initialized) {
+ return;
+ }
+ gtk_palette_changed_hook =
+ get_colorsel()->set_change_palette_hook (&StripableColorDialog::palette_changed_hook);
+
+ std::string cp = UIConfiguration::instance ().get_stripable_color_palette ();
+ if (!cp.empty()) {
+ Gdk::ArrayHandle_Color c = ColorSelection::palette_from_string (cp);
+ gtk_palette_changed_hook (get_screen (), c);
+ }
+ palette_initialized = true;
+}
+
void
StripableColorDialog::reset ()
{
void popup (boost::shared_ptr<ARDOUR::Stripable> s);
private:
+ void initialize_color_palette ();
void finish_color_edit (int response);
boost::shared_ptr<ARDOUR::Stripable> _stripable;
+
+
+ static bool palette_initialized;
+ static void palette_changed_hook (const Glib::RefPtr<Gdk::Screen>&, const Gdk::ArrayHandle_Color&);
+ static Gtk::ColorSelection::SlotChangePaletteHook gtk_palette_changed_hook;
};
#endif
UI_CONFIG_VARIABLE (bool, prefer_inline_over_gui, "prefer-inline-over-gui", true)
UI_CONFIG_VARIABLE (uint32_t, action_table_columns, "action-table-columns", 0)
UI_CONFIG_VARIABLE (bool, use_wm_visibility, "use-wm-visibility", true)
+UI_CONFIG_VARIABLE (std::string, stripable_color_palette, "stripable-color-palette", "#7F7F7F:#FF0000:#800080:#0000FF:#ADD8E6:#008000:#FFFF00:#FFA500:#E6E6FA:#A52A2A:#8B6914:#1E90FF:#FFC0CB:#90EE90:#1A1A1A:#4D4D4D:#BFBFBF:#E5E5E5:#AAAAAA:#444444") /* Gtk::ColorSelection::palette_to_string */