2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "fix_carbon.h"
27 #include <gtkmm/stock.h>
28 #include <gtkmm/settings.h>
30 #include "gtkmm2ext/gtk_ui.h"
31 #include "gtkmm2ext/cell_renderer_color_selector.h"
32 #include "gtkmm2ext/utils.h"
34 #include "pbd/file_utils.h"
35 #include "pbd/compose.h"
37 #include "ardour/filesystem_paths.h"
39 #include "canvas/container.h"
40 #include "canvas/rectangle.h"
41 #include "canvas/scroll_group.h"
42 #include "canvas/wave_view.h"
44 #include "ardour_button.h"
45 #include "theme_manager.h"
46 #include "rgb_macros.h"
47 #include "ardour_ui.h"
48 #include "global_signals.h"
56 using namespace ARDOUR;
57 using namespace ARDOUR_UI_UTILS;
59 namespace ARDOUR_UI_UTILS {
60 sigc::signal<void> ColorsChanged;
61 sigc::signal<void,uint32_t> ColorChanged;
64 ThemeManager::ThemeManager()
65 : ArdourWindow (_("Theme Manager"))
66 , dark_button (_("Dark Theme"))
67 , light_button (_("Light Theme"))
68 , reset_button (_("Restore Defaults"))
69 , flat_buttons (_("Draw \"flat\" buttons"))
70 , blink_rec_button (_("Blink Rec-Arm buttons"))
71 , region_color_button (_("Color regions using their track's color"))
72 , show_clipping_button (_("Show waveform clipping"))
73 , waveform_gradient_depth (0, 1.0, 0.05)
74 , waveform_gradient_depth_label (_("Waveforms color gradient depth"))
75 , timeline_item_gradient_depth (0, 1.0, 0.05)
76 , timeline_item_gradient_depth_label (_("Timeline item gradient depth"))
77 , all_dialogs (_("All floating windows are dialogs"))
78 , icon_set_label (_("Icon Set"))
79 , base_color_viewport (*base_color_scroller.get_hadjustment(), *base_color_scroller.get_vadjustment())
80 , base_color_group (0)
83 set_title (_("Theme Manager"));
85 /* Basic color list */
87 color_list = TreeStore::create (columns);
88 color_display.set_model (color_list);
89 color_display.append_column (_("Object"), columns.name);
91 Gtkmm2ext::CellRendererColorSelector* color_renderer = manage (new Gtkmm2ext::CellRendererColorSelector);
92 TreeViewColumn* color_column = manage (new TreeViewColumn (_("Color"), *color_renderer));
93 color_column->add_attribute (color_renderer->property_color(), columns.gdkcolor);
95 color_display.append_column (*color_column);
97 color_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
98 color_display.get_column (0)->set_expand (true);
99 color_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
100 color_display.get_column (1)->set_expand (false);
101 color_display.set_reorderable (false);
102 color_display.get_selection()->set_mode (SELECTION_NONE);
103 color_display.set_headers_visible (true);
105 color_display.signal_button_press_event().connect (sigc::mem_fun (*this, &ThemeManager::button_press_event), false);
107 scroller.add (color_display);
108 scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
110 /* Now the alias list */
112 alias_list = TreeStore::create (alias_columns);
113 alias_display.set_model (alias_list);
114 alias_display.append_column (_("Object"), columns.name);
116 color_renderer = manage (new Gtkmm2ext::CellRendererColorSelector);
117 color_column = manage (new TreeViewColumn (_("Color"), *color_renderer));
118 color_column->add_attribute (color_renderer->property_color(), alias_columns.color);
120 alias_display.append_column (*color_column);
122 alias_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
123 alias_display.get_column (0)->set_expand (true);
124 alias_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
125 alias_display.get_column (1)->set_expand (false);
126 alias_display.set_reorderable (false);
127 alias_display.get_selection()->set_mode (SELECTION_NONE);
128 alias_display.set_headers_visible (true);
130 alias_display.signal_button_press_event().connect (sigc::mem_fun (*this, &ThemeManager::alias_button_press_event), false);
132 alias_scroller.add (alias_display);
134 /* various buttons */
136 RadioButton::Group group = dark_button.get_group();
137 light_button.set_group(group);
138 theme_selection_hbox.set_homogeneous(false);
139 theme_selection_hbox.pack_start (dark_button);
140 theme_selection_hbox.pack_start (light_button);
142 Gtk::VBox* vbox = Gtk::manage (new Gtk::VBox ());
143 vbox->set_homogeneous (false);
144 vbox->pack_start (theme_selection_hbox, PACK_SHRINK);
145 vbox->pack_start (reset_button, PACK_SHRINK);
147 vbox->pack_start (all_dialogs, PACK_SHRINK);
149 vbox->pack_start (flat_buttons, PACK_SHRINK);
150 vbox->pack_start (blink_rec_button, PACK_SHRINK);
151 vbox->pack_start (region_color_button, PACK_SHRINK);
152 vbox->pack_start (show_clipping_button, PACK_SHRINK);
156 vector<string> icon_sets = ::get_icon_sets ();
158 if (icon_sets.size() > 1) {
159 Gtkmm2ext::set_popdown_strings (icon_set_dropdown, icon_sets);
160 icon_set_dropdown.set_active_text (ARDOUR_UI::config()->get_icon_set());
162 hbox = Gtk::manage (new Gtk::HBox());
163 hbox->set_spacing (6);
164 hbox->pack_start (icon_set_label, false, false);
165 hbox->pack_start (icon_set_dropdown, true, true);
166 vbox->pack_start (*hbox, PACK_SHRINK);
170 hbox = Gtk::manage (new Gtk::HBox());
171 hbox->set_spacing (6);
172 hbox->pack_start (waveform_gradient_depth, true, true);
173 hbox->pack_start (waveform_gradient_depth_label, false, false);
174 vbox->pack_start (*hbox, PACK_SHRINK);
176 hbox = Gtk::manage (new Gtk::HBox());
177 hbox->set_spacing (6);
178 hbox->pack_start (timeline_item_gradient_depth, true, true);
179 hbox->pack_start (timeline_item_gradient_depth_label, false, false);
180 vbox->pack_start (*hbox, PACK_SHRINK);
182 base_color_viewport.signal_size_allocate().connect (sigc::mem_fun (*this, &ThemeManager::base_color_viewport_allocated));
183 base_color_scroller.add (base_color_viewport);
185 notebook.append_page (scroller, _("Palette"));
186 notebook.append_page (base_color_scroller, _("Base Colors"));
187 notebook.append_page (alias_scroller, _("Items"));
189 vbox->pack_start (notebook);
195 waveform_gradient_depth.set_update_policy (Gtk::UPDATE_DELAYED);
196 timeline_item_gradient_depth.set_update_policy (Gtk::UPDATE_DELAYED);
198 color_dialog.get_colorsel()->set_has_opacity_control (true);
199 color_dialog.get_colorsel()->set_has_palette (true);
201 flat_buttons.set_active (ARDOUR_UI::config()->get_flat_buttons());
202 blink_rec_button.set_active (ARDOUR_UI::config()->get_blink_rec_arm());
203 region_color_button.set_active (ARDOUR_UI::config()->get_color_regions_using_track_color());
204 show_clipping_button.set_active (ARDOUR_UI::config()->get_show_waveform_clipping());
206 color_dialog.get_ok_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_ACCEPT));
207 color_dialog.get_cancel_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
208 dark_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_dark_theme_button_toggled));
209 light_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_light_theme_button_toggled));
210 reset_button.signal_clicked().connect (sigc::mem_fun (*this, &ThemeManager::reset_canvas_colors));
211 flat_buttons.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_flat_buttons_toggled));
212 blink_rec_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_blink_rec_arm_toggled));
213 region_color_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_region_color_toggled));
214 show_clipping_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_show_clip_toggled));
215 waveform_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_waveform_gradient_depth_change));
216 timeline_item_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_timeline_item_gradient_depth_change));
217 all_dialogs.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_all_dialogs_toggled));
218 icon_set_dropdown.signal_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_icon_set_changed));
220 Gtkmm2ext::UI::instance()->set_tip (all_dialogs,
221 string_compose (_("Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
222 "This may help with some window managers. This requires a restart of %1 to take effect"),
225 set_size_request (-1, 400);
229 /* Trigger setting up the GTK color scheme and loading the RC file */
230 ARDOUR_UI::config()->color_theme_changed ();
233 ThemeManager::~ThemeManager()
238 ThemeManager::save (string /*path*/)
244 ThemeManager::button_press_event (GdkEventButton* ev)
247 TreeModel::Path path;
248 TreeViewColumn* column;
252 if (!color_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
256 switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
258 /* allow normal processing to occur */
262 if ((iter = color_list->get_iter (path))) {
264 ColorVariable<uint32_t>* var = (*iter)[columns.pVar];
266 /* parent row, do nothing */
271 uint32_t rgba = (*iter)[columns.rgba];
274 UINT_TO_RGBA (rgba, &r, &g, &b, &a);
275 color.set_rgb_p (r / 255.0, g / 255.0, b / 255.0);
276 color_dialog.get_colorsel()->set_previous_color (color);
277 color_dialog.get_colorsel()->set_current_color (color);
278 color_dialog.get_colorsel()->set_previous_alpha ((guint16) (a * 256));
279 color_dialog.get_colorsel()->set_current_alpha ((guint16) (a * 256));
281 color_dialog_connection.disconnect ();
282 color_dialog_connection = color_dialog.signal_response().connect (sigc::mem_fun (*this, &ThemeManager::foobar_response));
283 color_dialog.present ();
291 ThemeManager::foobar_response (int result)
293 // ColorVariable<uint32_t> *ccvar;
298 color_dialog_connection.disconnect ();
301 case RESPONSE_CANCEL:
303 case RESPONSE_ACCEPT:
304 color = color_dialog.get_colorsel()->get_current_color();
305 a = color_dialog.get_colorsel()->get_current_alpha();
306 r = (int) floor (color.get_red_p() * 255.0);
307 g = (int) floor (color.get_green_p() * 255.0);
308 b = (int) floor (color.get_blue_p() * 255.0);
310 rgba = RGBA_TO_UINT(r,g,b,a>>8);
311 // (*iter)[columns.rgba] = rgba;
312 // (*iter)[columns.gdkcolor] = color;
314 // ccvar = (*iter)[columns.pVar];
317 ARDOUR_UI::config()->set_dirty ();
318 /* but save it immediately */
319 ARDOUR_UI::config()->save_state ();
321 ColorsChanged(); //EMIT SIGNAL
329 color_dialog.hide ();
333 ThemeManager::on_flat_buttons_toggled ()
335 ARDOUR_UI::config()->set_flat_buttons (flat_buttons.get_active());
336 ARDOUR_UI::config()->set_dirty ();
337 ArdourButton::set_flat_buttons (flat_buttons.get_active());
339 gtk_rc_reset_styles (gtk_settings_get_default());
343 ThemeManager::on_blink_rec_arm_toggled ()
345 ARDOUR_UI::config()->set_blink_rec_arm (blink_rec_button.get_active());
346 ARDOUR_UI::config()->set_dirty ();
347 ARDOUR::Config->ParameterChanged("blink-rec-arm");
351 ThemeManager::on_region_color_toggled ()
353 ARDOUR_UI::config()->set_color_regions_using_track_color (region_color_button.get_active());
354 ARDOUR_UI::config()->set_dirty ();
358 ThemeManager::on_show_clip_toggled ()
360 ARDOUR_UI::config()->set_show_waveform_clipping (show_clipping_button.get_active());
361 ARDOUR_UI::config()->set_dirty ();
365 ThemeManager::on_all_dialogs_toggled ()
367 ARDOUR_UI::config()->set_all_floating_windows_are_dialogs (all_dialogs.get_active());
368 ARDOUR_UI::config()->set_dirty ();
372 ThemeManager::on_waveform_gradient_depth_change ()
374 double v = waveform_gradient_depth.get_value();
376 ARDOUR_UI::config()->set_waveform_gradient_depth (v);
377 ARDOUR_UI::config()->set_dirty ();
378 ArdourCanvas::WaveView::set_global_gradient_depth (v);
382 ThemeManager::on_timeline_item_gradient_depth_change ()
384 double v = timeline_item_gradient_depth.get_value();
386 ARDOUR_UI::config()->set_timeline_item_gradient_depth (v);
387 ARDOUR_UI::config()->set_dirty ();
391 ThemeManager::on_icon_set_changed ()
393 string new_set = icon_set_dropdown.get_active_text();
394 ARDOUR_UI::config()->set_icon_set (new_set);
398 ThemeManager::on_dark_theme_button_toggled()
400 if (!dark_button.get_active()) return;
402 UIConfiguration* uic (ARDOUR_UI::config());
404 uic->set_ui_rc_file("ui_dark.rc");
406 uic->load_rc_file (uic->get_ui_rc_file(), true);
410 ThemeManager::on_light_theme_button_toggled()
412 if (!light_button.get_active()) return;
414 UIConfiguration* uic (ARDOUR_UI::config());
416 uic->set_ui_rc_file("ui_light.rc");
418 uic->load_rc_file (uic->get_ui_rc_file(), true);
422 ThemeManager::setup_theme ()
428 for (std::map<std::string,ColorVariable<uint32_t> *>::iterator i = ARDOUR_UI::config()->configurable_colors.begin(); i != ARDOUR_UI::config()->configurable_colors.end(); i++) {
431 ColorVariable<uint32_t>* var = i->second;
433 TreeModel::Children rows = color_list->children();
435 string::size_type colon;
437 if ((colon = var->name().find (':')) != string::npos) {
439 /* this is supposed to be a child node, so find the
443 string parent = var->name().substr (0, colon);
444 TreeModel::iterator ri;
446 for (ri = rows.begin(); ri != rows.end(); ++ri) {
447 string s = (*ri)[columns.name];
453 if (ri == rows.end()) {
454 /* not found, add the parent as new top level row */
455 row = *(color_list->append());
456 row[columns.name] = parent;
457 row[columns.pVar] = 0;
459 /* now add the child as a child of this one */
461 row = *(color_list->insert (row->children().end()));
462 row[columns.name] = var->name().substr (colon+1);
464 row = *(color_list->insert ((*ri)->children().end()));
465 row[columns.name] = var->name().substr (colon+1);
470 row = *(color_list->append());
471 row[columns.name] = var->name();
475 uint32_t rgba = var->get();
476 UINT_TO_RGBA (rgba, &r, &g, &b, &a);
477 //cerr << (*i)->name() << " == " << hex << rgba << ": " << hex << r << " " << hex << g << " " << hex << b << endl;
478 col.set_rgb_p (r / 255.0, g / 255.0, b / 255.0);
480 row[columns.pVar] = var;
481 row[columns.rgba] = rgba;
482 row[columns.gdkcolor] = col;
485 UIConfiguration* uic (ARDOUR_UI::config());
487 flat_buttons.set_active (uic->get_flat_buttons());
488 blink_rec_button.set_active (uic->get_blink_rec_arm());
489 waveform_gradient_depth.set_value (uic->get_waveform_gradient_depth());
490 timeline_item_gradient_depth.set_value (uic->get_timeline_item_gradient_depth());
491 all_dialogs.set_active (uic->get_all_floating_windows_are_dialogs());
495 ThemeManager::reset_canvas_colors()
497 ARDOUR_UI::config()->load_defaults();
499 ARDOUR_UI::config()->set_dirty ();
500 ARDOUR_UI::config()->save_state ();
505 ArdourCanvas::HSV color;
506 NamedColor (string s, ArdourCanvas::HSV c) : name (s), color (c) {}
510 bool operator() (NamedColor const & a, NamedColor const & b) {
511 using namespace ArdourCanvas;
512 const HSV black (0, 0, 0);
513 if (a.color.is_gray() || b.color.is_gray()) {
514 return black.distance (a.color) < black.distance (b.color);
516 return a.color.h < b.color.h;
517 // const HSV red (rgba_to_color (1.0, 0.0, 0.0, 1.0));
518 // return red.distance (a.color) < red.distance (b.color);
523 ArdourCanvas::Container*
524 ThemeManager::initialize_canvas (ArdourCanvas::Canvas& canvas)
526 using namespace ArdourCanvas;
528 /* hide background */
529 canvas.set_background_color (rgba_to_color (0.0, 0.0, 1.0, 0.0));
531 ScrollGroup* base_color_scroll_group = new ScrollGroup (canvas.root(), ScrollGroup::ScrollSensitivity (ScrollGroup::ScrollsVertically|ScrollGroup::ScrollsHorizontally));
532 canvas.add_scroller (*base_color_scroll_group);
533 return new ArdourCanvas::Container (base_color_scroll_group);
537 ThemeManager::build_base_color_canvas (ArdourCanvas::Container& group, bool (ThemeManager::*event_handler)(GdkEvent*,std::string), double width, double height)
539 using namespace ArdourCanvas;
541 /* we want the colors sorted by hue, with their name */
543 UIConfiguration::RelativeColors& relatives (ARDOUR_UI::instance()->config()->relative_colors);
544 vector<NamedColor> nc;
545 for (UIConfiguration::RelativeColors::const_iterator x = relatives.begin(); x != relatives.end(); ++x) {
546 nc.push_back (NamedColor (x->first, x->second.get()));
549 sort (nc.begin(), nc.end(), sorter);
551 const uint32_t color_limit = nc.size();
552 const double box_size = 20.0;
554 uint32_t color_num = 0;
556 /* clear existing rects and delete them */
560 for (uint32_t y = 0; y < height - box_size && color_num < color_limit; y += box_size) {
561 for (uint32_t x = 0; x < width - box_size && color_num < color_limit; x += box_size) {
562 ArdourCanvas::Rectangle* r = new ArdourCanvas::Rectangle (&group, ArdourCanvas::Rect (x, y, x + box_size, y + box_size));
564 string name = nc[color_num++].name;
566 UIConfiguration::RelativeColors::iterator c = relatives.find (name);
568 if (c != relatives.end()) {
569 Color color = c->second.get().color ();
570 r->set_fill_color (color);
571 r->set_outline_color (rgba_to_color (0.0, 0.0, 0.0, 1.0));
572 r->set_tooltip (name);
573 r->Event.connect (sigc::bind (sigc::mem_fun (*this, event_handler), name));
580 ThemeManager::base_color_viewport_allocated (Gtk::Allocation&)
582 if (!base_color_group) {
583 base_color_group = initialize_canvas (*base_color_viewport.canvas());
586 build_base_color_canvas (*base_color_group, &ThemeManager::base_color_event,
587 base_color_viewport.canvas()->width(),
588 base_color_viewport.canvas()->height());
593 ThemeManager::base_color_event (GdkEvent*ev, string name)
596 case GDK_BUTTON_RELEASE:
597 edit_named_color (name);
607 ThemeManager::edit_named_color (std::string name)
609 using namespace ArdourCanvas;
611 UIConfiguration* uic (ARDOUR_UI::instance()->config());
612 ArdourCanvas::Color c = uic->color (name);
615 color_to_rgba (c, r, g, b, a);
617 gdkcolor.set_rgb_p (r, g, b);
618 color_dialog.get_colorsel()->set_previous_color (gdkcolor);
619 color_dialog.get_colorsel()->set_current_color (gdkcolor);
620 color_dialog.get_colorsel()->set_previous_alpha ((guint16) (a * 65535));
621 color_dialog.get_colorsel()->set_current_alpha ((guint16) (a * 65535));
623 base_color_edit_name = name;
625 color_dialog_connection.disconnect ();
626 color_dialog_connection = color_dialog.signal_response().connect (sigc::mem_fun (*this, &ThemeManager::base_color_dialog_done));
627 color_dialog.present();
631 ThemeManager::base_color_dialog_done (int result)
633 using namespace ArdourCanvas;
635 cerr << "Done, using [" << base_color_edit_name << "] res = " << result << endl;
637 if (base_color_edit_name.empty()) {
638 color_dialog.hide ();
642 UIConfiguration* uic (ARDOUR_UI::instance()->config());
643 UIConfiguration::RelativeHSV rhsv ("", HSV());
648 case RESPONSE_ACCEPT:
650 cerr << "Accepting\n";
651 gdkcolor = color_dialog.get_colorsel()->get_current_color();
652 a = color_dialog.get_colorsel()->get_current_alpha() / 65535.0;
653 r = gdkcolor.get_red_p();
654 g = gdkcolor.get_green_p();
655 b = gdkcolor.get_blue_p();
657 rhsv = uic->color_as_relative_hsv (rgba_to_color (r, g, b, a));
658 uic->reset_relative (base_color_edit_name, rhsv);
662 build_base_color_canvas (*base_color_group, &ThemeManager::base_color_event,
663 base_color_viewport.canvas()->width(),
664 base_color_viewport.canvas()->height());
666 ColorsChanged(); //EMIT SIGNAL
673 color_dialog.hide ();
674 base_color_edit_name = "";
678 ThemeManager::palette_canvas_allocated (Gtk::Allocation& alloc, ArdourCanvas::Container* group, bool (ThemeManager::*event_handler)(GdkEvent*,std::string))
680 build_base_color_canvas (*group, event_handler, alloc.get_width(), alloc.get_height());
684 ThemeManager::palette_chosen (GdkEvent* ev, string name)
687 case GDK_BUTTON_RELEASE:
694 UIConfiguration* uic (ARDOUR_UI::instance()->config());
695 uic->set_alias (palette_edit_name, name);
697 (void) palette_done ((GdkEventAny*) 0);
699 /* rebuild alias list with new color: inefficient but simple */
707 ThemeManager::palette_done (GdkEventAny*)
709 palette_edit_name = "";
710 palette_window->hide ();
715 ThemeManager::choose_color_from_palette (string const & name)
717 if (!palette_window) {
718 palette_window = new Gtk::Window (WINDOW_TOPLEVEL);
719 ArdourCanvas::GtkCanvas* canvas = new ArdourCanvas::GtkCanvas ();
720 ArdourCanvas::Container* group = initialize_canvas (*canvas);
722 canvas->signal_size_allocate().connect (sigc::bind (sigc::mem_fun (*this, &ThemeManager::palette_canvas_allocated), group, &ThemeManager::palette_chosen));
723 palette_window->signal_delete_event().connect (sigc::mem_fun (*this, &ThemeManager::palette_done));
725 palette_window->add (*canvas);
729 palette_edit_name = name;
731 palette_window->set_position (WIN_POS_MOUSE);
732 palette_window->present ();
736 ThemeManager::setup_aliases ()
738 using namespace ArdourCanvas;
740 UIConfiguration* uic (ARDOUR_UI::instance()->config());
741 UIConfiguration::ColorAliases& aliases (uic->color_aliases);
743 alias_list->clear ();
745 for (UIConfiguration::ColorAliases::iterator i = aliases.begin(); i != aliases.end(); ++i) {
748 row = *(alias_list->append());
749 row[alias_columns.name] = i->first;
750 row[alias_columns.alias] = i->second;
752 Color c = uic->color (i->second);
754 /* Gdk colors don't support alpha */
757 color_to_rgba (c, r, g, b, a);
759 gcolor.set_rgb_p (r, g, b);
761 row[alias_columns.color] = gcolor;
766 ThemeManager::alias_button_press_event (GdkEventButton* ev)
769 TreeModel::Path path;
770 TreeViewColumn* column;
774 if (!alias_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
778 guint32 colnum = GPOINTER_TO_UINT (column->get_data (X_("colnum")));
782 /* allow normal processing to occur */
786 if ((iter = alias_list->get_iter (path))) {
787 choose_color_from_palette ((*iter)[alias_columns.name]);