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.
20 #ifndef __ardour_gtk_color_manager_h__
21 #define __ardour_gtk_color_manager_h__
23 #include <gtkmm/treeview.h>
24 #include <gtkmm/treestore.h>
25 #include <gtkmm/scrolledwindow.h>
26 #include <gtkmm/colorselection.h>
27 #include <gtkmm/radiobutton.h>
28 #include <gtkmm/button.h>
29 #include <gtkmm/scale.h>
32 #include "canvas/types.h"
33 #include "canvas/canvas.h"
35 #include "ui_config.h"
37 namespace ArdourCanvas {
44 class ThemeManager : public Gtk::VBox
50 int save (std::string path);
51 void reset_canvas_colors();
53 void on_flat_buttons_toggled ();
54 void on_blink_rec_arm_toggled ();
55 void on_region_color_toggled ();
56 void on_show_clip_toggled ();
57 void on_waveform_gradient_depth_change ();
58 void on_timeline_item_gradient_depth_change ();
59 void on_all_dialogs_toggled ();
60 void on_transients_follow_front_toggled ();
61 void on_floating_monitor_section_toggled ();
62 void on_icon_set_changed ();
63 void on_color_theme_changed ();
66 Gtk::Notebook notebook;
68 struct ColorThemeModelColumns : public Gtk::TreeModel::ColumnRecord {
69 ColorThemeModelColumns() {
74 Gtk::TreeModelColumn<std::string> name;
75 Gtk::TreeModelColumn<std::string> path;
78 ColorThemeModelColumns color_theme_columns;
79 Glib::RefPtr<Gtk::TreeStore> theme_list;
81 Gtk::ColorSelectionDialog color_dialog;
82 sigc::connection color_dialog_connection;
84 Gtk::Button reset_button;
85 Gtk::CheckButton flat_buttons;
86 Gtk::CheckButton blink_rec_button;
87 Gtk::CheckButton region_color_button;
88 Gtk::CheckButton show_clipping_button;
89 Gtk::HScale waveform_gradient_depth;
90 Gtk::Label waveform_gradient_depth_label;
91 Gtk::HScale timeline_item_gradient_depth;
92 Gtk::Label timeline_item_gradient_depth_label;
93 Gtk::CheckButton all_dialogs;
94 Gtk::CheckButton transients_follow_front;
95 Gtk::CheckButton floating_monitor_section;
96 Gtk::CheckButton gradient_waveforms;
97 Gtk::Label icon_set_label;
98 Gtk::ComboBoxText icon_set_dropdown;
99 Gtk::Label color_theme_label;
100 Gtk::ComboBox color_theme_dropdown;
102 /* handls response from color dialog when it is used to
103 edit a derived color.
105 void palette_color_response (int, std::string);
107 Gtk::ScrolledWindow palette_scroller;
108 ArdourCanvas::GtkCanvasViewport palette_viewport;
109 ArdourCanvas::Container* palette_group;
111 /* these methods create and manage a canvas for use in either the
112 palette tab or in a separate dialog. Different behaviour is
113 accomplished by changing the event handler passed into the
114 allocation handler. We do it there because we have to rebuild
115 the canvas on allocation events, and during the rebuild, connect
116 each rectangle to the event handler.
118 the alternative is one event handler for the canvas and a map
119 of where each color rectangle is. nothing wrong with this
120 but the per-rect event setup is simpler and avoids building
121 and looking up the map information.
123 ArdourCanvas::Container* initialize_palette_canvas (ArdourCanvas::Canvas& canvas);
124 void build_palette_canvas (ArdourCanvas::Canvas&, ArdourCanvas::Container&, sigc::slot<bool,GdkEvent*,std::string> event_handler);
125 void palette_canvas_allocated (Gtk::Allocation& alloc, ArdourCanvas::Container* group, ArdourCanvas::Canvas* canvas, sigc::slot<bool,GdkEvent*,std::string> event_handler);
126 void palette_size_request (Gtk::Requisition*);
128 /* handles events from a palette canvas inside the palette (derived
131 bool palette_event (GdkEvent*, std::string name);
132 /* allows user to edit a named color (e.g. "color 3") after clicking
133 on it inside the palette tab.
135 void edit_palette_color (std::string);
137 struct ColorAliasModelColumns : public Gtk::TreeModel::ColumnRecord {
138 ColorAliasModelColumns() {
145 Gtk::TreeModelColumn<std::string> name;
146 Gtk::TreeModelColumn<std::string> alias;
147 Gtk::TreeModelColumn<Gdk::Color> color;
148 Gtk::TreeModelColumn<std::string> key;
151 ColorAliasModelColumns alias_columns;
152 Gtk::TreeView alias_display;
153 Glib::RefPtr<Gtk::TreeStore> alias_list;
154 Gtk::ScrolledWindow alias_scroller;
156 bool alias_button_press_event (GdkEventButton*);
158 ArdourDialog* palette_window;
159 sigc::connection palette_response_connection;
161 void choose_color_from_palette (std::string const &target_name);
163 bool alias_palette_event (GdkEvent*, std::string, std::string);
164 void alias_palette_response (int, std::string, std::string);
166 void setup_aliases ();
167 void setup_palette ();
169 Gtk::ScrolledWindow modifier_scroller;
170 Gtk::VBox modifier_vbox;
172 void setup_modifiers ();
173 void modifier_edited (Gtk::Range*, std::string);
175 void colors_changed ();
176 void set_ui_to_state ();
179 #endif /* __ardour_gtk_color_manager_h__ */