27 #include <glib/gstdio.h>
29 #include <gtkmm/stock.h>
30 #include <gtkmm/settings.h>
41 #include "canvas/container.h"
42 #include "canvas/rectangle.h"
43 #include "canvas/scroll_group.h"
44 #include "canvas/wave_view.h"
67 : dark_button (
_(
"Dark Theme"))
68 , light_button (
_(
"Light Theme"))
69 , reset_button (
_(
"Restore Defaults"))
70 , flat_buttons (
_(
"Draw \"flat\" buttons"))
71 , blink_rec_button (
_(
"Blink Rec-Arm buttons"))
72 , region_color_button (
_(
"Color regions using their track's color"))
73 , show_clipping_button (
_(
"Show waveform clipping"))
74 , waveform_gradient_depth (0, 1.0, 0.05)
75 , waveform_gradient_depth_label (
_(
"Waveforms color gradient depth"))
76 , timeline_item_gradient_depth (0, 1.0, 0.05)
77 , timeline_item_gradient_depth_label (
_(
"Timeline item gradient depth"))
78 , all_dialogs (
_(
"All floating windows are dialogs"))
79 , transients_follow_front (
_(
"Transient windows follow front window."))
80 , icon_set_label (
_(
"Icon Set"))
81 , palette_viewport (*palette_scroller.get_hadjustment(), *palette_scroller.get_vadjustment())
92 TreeViewColumn* color_column = manage (
new TreeViewColumn (
_(
"Color"), *color_renderer));
96 alias_display.get_column (0)->set_data (
X_(
"colnum"), GUINT_TO_POINTER(0));
98 alias_display.get_column (1)->set_data (
X_(
"colnum"), GUINT_TO_POINTER(1));
110 RadioButton::Group group =
dark_button.get_group();
116 set_homogeneous (
false);
117 #if 0 // disable light/dark theme choice. until the 'light theme gets some attention.
134 if (icon_sets.size() > 1) {
138 hbox = Gtk::manage (
new Gtk::HBox());
139 hbox->set_spacing (6);
142 pack_start (*hbox, PACK_SHRINK);
146 hbox = Gtk::manage (
new Gtk::HBox());
147 hbox->set_spacing (6);
150 pack_start (*hbox, PACK_SHRINK);
152 hbox = Gtk::manage (
new Gtk::HBox());
153 hbox->set_spacing (6);
156 pack_start (*hbox, PACK_SHRINK);
176 color_dialog.get_colorsel()->set_has_opacity_control (
true);
181 color_dialog.get_ok_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (
color_dialog, &Gtk::Dialog::response), RESPONSE_ACCEPT));
182 color_dialog.get_cancel_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (
color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
197 string_compose (
_(
"Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
198 "This may help with some window managers. This requires a restart of %1 to take effect"),
201 string_compose (
_(
"Make transient windows follow the front window when toggling between the editor and mixer.\n"
202 "This requires a restart of %1 to take effect"), PROGRAM_NAME));
204 set_size_request (-1, 400);
222 Gtk::Label* mod_label;
223 Gtk::HScale* mod_scale;
227 for (UIConfiguration::Modifiers::const_iterator m = modifiers.begin(); m != modifiers.end(); ++m) {
228 mod_hbox = manage (
new HBox);
230 mod_scale = manage (
new HScale (0.0, 1.0, 0.01));
231 mod_scale->set_draw_value (
false);
232 mod_scale->set_value (m->second.a());
233 mod_scale->set_update_policy (Gtk::UPDATE_DISCONTINUOUS);
236 mod_label = manage (
new Label (m->first));
237 mod_label->set_alignment (1.0, 0.5);
238 mod_label->set_size_request (150, -1);
240 mod_hbox->pack_start (*mod_label,
false,
true, 12);
241 mod_hbox->pack_start (*mod_scale,
true,
true);
255 double alpha = range->get_value();
256 SVAModifier svam (SVAModifier::Assign, -1.0, -1.0, alpha);
280 gtk_rc_reset_styles (gtk_settings_get_default());
301 ArdourCanvas::WaveView::set_global_show_waveform_clipping (
ARDOUR_UI::config()->get_show_waveform_clipping());
322 ArdourCanvas::WaveView::set_global_gradient_depth (v);
347 uic->set_color_file(
"dark");
357 uic->set_color_file(
"light");
395 basename +=
".colors";
398 string backup = cfile + string (
X_(
".old"));
399 g_rename (cfile.c_str(), backup.c_str());
408 ArdourCanvas::Container*
414 canvas.set_background_color (rgba_to_color (0.0, 0.0, 1.0, 0.0));
418 ScrollGroup* scroll_group =
new ScrollGroup (canvas.root(), ScrollGroup::ScrollSensitivity (ScrollGroup::ScrollsVertically|ScrollGroup::ScrollsHorizontally));
419 canvas.add_scroller (*scroll_group);
423 return new ArdourCanvas::Container (scroll_group);
435 NamedColor (
string s, ArdourCanvas::HSV c) : name (s), color (c) {}
441 const HSV black (0, 0, 0);
443 return black.distance (a.
color) < black.distance (b.
color);
461 vector<NamedColor> nc;
462 for (UIConfiguration::Colors::const_iterator x = colors.begin(); x != colors.end(); ++x) {
463 nc.push_back (
NamedColor (x->first, HSV (x->second)));
466 sort (nc.begin(), nc.end(), sorter);
468 const uint32_t color_limit = nc.size();
469 const double box_size = 20.0;
470 const double width = canvas.width();
471 const double height = canvas.height();
473 uint32_t color_num = 0;
479 for (uint32_t y = 0; y < height - box_size && color_num < color_limit; y += box_size) {
480 for (uint32_t x = 0; x < width - box_size && color_num < color_limit; x += box_size) {
481 ArdourCanvas::Rectangle* r =
new ArdourCanvas::Rectangle (&group, ArdourCanvas::Rect (x, y, x + box_size, y + box_size));
483 string name = nc[color_num++].name;
485 UIConfiguration::Colors::iterator c = colors.find (name);
487 if (c != colors.end()) {
488 Color
color = c->second;
489 r->set_fill_color (color);
490 r->set_outline_color (rgba_to_color (0.0, 0.0, 0.0, 1.0));
491 r->set_tooltip (name);
492 r->Event.connect (sigc::bind (event_handler, name));
502 const int box_size = 20;
504 double c = sqrt ((
double)ncolors);
505 req->width = (int) floor (c * box_size);
506 req->height = (int) floor (c * box_size);
510 if (fmod (ncolors, c) != 0.0) {
511 req->height += box_size;
525 case GDK_BUTTON_RELEASE:
540 ArdourCanvas::Color c = uic->
color (name);
543 color_to_rgba (c, r, g, b, a);
545 gdkcolor.set_rgb_p (r, g, b);
546 color_dialog.get_colorsel()->set_previous_color (gdkcolor);
547 color_dialog.get_colorsel()->set_current_color (gdkcolor);
548 color_dialog.get_colorsel()->set_previous_alpha ((guint16) (a * 65535));
549 color_dialog.get_colorsel()->set_current_alpha ((guint16) (a * 65535));
568 case RESPONSE_ACCEPT:
570 gdkcolor =
color_dialog.get_colorsel()->get_current_color();
571 a =
color_dialog.get_colorsel()->get_current_alpha() / 65535.0;
572 r = gdkcolor.get_red_p();
573 g = gdkcolor.get_green_p();
574 b = gdkcolor.get_blue_p();
576 uic->
set_color (name, rgba_to_color (r, g, b, a));
590 case GDK_BUTTON_RELEASE:
604 case GTK_RESPONSE_OK:
605 case GTK_RESPONSE_ACCEPT:
610 case GTK_RESPONSE_REJECT:
627 UIConfiguration::ColorAliases::iterator i = uic->
color_aliases.find (name);
639 ArdourCanvas::GtkCanvas* canvas =
new ArdourCanvas::GtkCanvas ();
665 for (UIConfiguration::ColorAliases::iterator i = aliases.begin(); i != aliases.end(); ++i) {
666 TreeModel::Children rows =
alias_list->children();
668 string::size_type colon;
670 if ((colon = i->first.find (
':')) != string::npos) {
676 string parent = i->first.substr (0, colon);
677 TreeModel::iterator ri;
679 for (ri = rows.begin(); ri != rows.end(); ++ri) {
686 if (ri == rows.end()) {
694 row = *(
alias_list->insert (row->children().end()));
697 row = *(
alias_list->insert ((*ri)->children().end()));
713 Color c (uic->
color (i->second));
714 color_to_rgba (c, r, g, b, a);
715 col.set_rgb_p (r, g, b);
725 TreeModel::Path path;
726 TreeViewColumn* column;
730 if (!
alias_display.get_path_at_pos ((
int)ev->x, (
int)ev->y, path, column, cellx, celly)) {
734 guint32 colnum = GPOINTER_TO_UINT (column->get_data (
X_(
"colnum")));
744 if (!target_color_alias.empty()) {
Gtk::CheckButton blink_rec_button
sigc::connection palette_response_connection
ArdourCanvas::Color color(const std::string &, bool *failed=0) const
Gtk::CheckButton flat_buttons
Gtk::TreeView alias_display
Glib::PropertyProxy< Gdk::Color > property_color()
NamedColor(string s, ArdourCanvas::HSV c)
Gtk::TreeModelColumn< std::string > name
void on_flat_buttons_toggled()
void on_dark_theme_button_toggled()
void on_waveform_gradient_depth_change()
Gtk::TreeModelColumn< std::string > key
Gtk::Label waveform_gradient_depth_label
Gtk::TreeModelColumn< std::string > alias
void on_all_dialogs_toggled()
std::vector< std::string > get_icon_sets()
Gtk::ComboBoxText icon_set_dropdown
bool alias_palette_event(GdkEvent *, std::string, std::string)
Glib::RefPtr< Gtk::TreeStore > alias_list
bool alias_button_press_event(GdkEventButton *)
LIBGTKMM2EXT_API void set_popdown_strings(Gtk::ComboBoxText &, const std::vector< std::string > &)
void on_transients_follow_front_toggled()
Gtk::Label timeline_item_gradient_depth_label
Gtk::CheckButton all_dialogs
bool find_file(const Searchpath &search_path, const string &filename, std::string &result)
ArdourCanvas::Container * initialize_palette_canvas(ArdourCanvas::Canvas &canvas)
std::map< std::string, ArdourCanvas::SVAModifier > Modifiers
ColorAliases color_aliases
void palette_size_request(Gtk::Requisition *)
LIBARDOUR_API RCConfiguration * Config
std::map< std::string, ArdourCanvas::Color > Colors
Gtk::ScrolledWindow alias_scroller
void set_color(const std::string &name, ArdourCanvas::Color)
std::map< std::string, std::string > ColorAliases
void on_icon_set_changed()
Gtk::CheckButton transients_follow_front
ColorAliasModelColumns alias_columns
void on_show_clip_toggled()
Gtk::HScale waveform_gradient_depth
ArdourCanvas::GtkCanvasViewport palette_viewport
void build_palette_canvas(ArdourCanvas::Canvas &, ArdourCanvas::Container &, sigc::slot< bool, GdkEvent *, std::string > event_handler)
static const struct @24 modifiers[]
Gtk::RadioButton dark_button
LIBARDOUR_API PBD::Searchpath ardour_config_search_path()
void reset_canvas_colors()
ArdourDialog * palette_window
PBD::Signal1< void, std::string > ParameterChanged
void set_tip(Gtk::Widget &w, const gchar *tip)
void alias_palette_response(int, std::string, std::string)
sigc::connection color_dialog_connection
void on_light_theme_button_toggled()
int save(std::string path)
Gtk::CheckButton region_color_button
Gtk::ColorSelectionDialog color_dialog
Gtk::CheckButton show_clipping_button
void choose_color_from_palette(std::string const &target_name)
Gtk::ScrolledWindow modifier_scroller
Gtk::HBox theme_selection_hbox
Gtk::ScrolledWindow palette_scroller
static UIConfiguration * config()
sigc::signal< void > ColorsChanged
void on_blink_rec_arm_toggled()
bool palette_event(GdkEvent *, std::string name)
void palette_color_response(int, std::string)
void set_alias(std::string const &name, std::string const &alias)
void palette_canvas_allocated(Gtk::Allocation &alloc, ArdourCanvas::Container *group, ArdourCanvas::Canvas *canvas, sigc::slot< bool, GdkEvent *, std::string > event_handler)
Gtk::Label icon_set_label
Gtk::HScale timeline_item_gradient_depth
void on_timeline_item_gradient_depth_change()
void modifier_edited(Gtk::Range *, std::string)
Gtk::TreeModelColumn< Gdk::Color > color
void set_modifier(std::string const &, ArdourCanvas::SVAModifier svam)
void edit_palette_color(std::string)
void on_region_color_toggled()
std::string string_compose(const std::string &fmt, const T1 &o1)
LIBGTKMM2EXT_API void container_clear(Gtk::Container &)
ArdourCanvas::Container * palette_group
Gtk::RadioButton light_button
LIBARDOUR_API PBD::PropertyDescriptor< bool > color