ardour
theme_manager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2007 Paul Davis
3 
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.
8 
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.
13 
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.
17 
18 */
19 
20 #ifndef __ardour_gtk_color_manager_h__
21 #define __ardour_gtk_color_manager_h__
22 
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>
30 #include <gtkmm/rc.h>
31 
32 #include "canvas/types.h"
33 #include "canvas/canvas.h"
34 
35 #include "ui_config.h"
36 
37 namespace ArdourCanvas {
38  class Container;
39  class ScrollGroup;
40 }
41 
42 class ArdourDialog;
43 
44 class ThemeManager : public Gtk::VBox
45 {
46  public:
47  ThemeManager();
48  ~ThemeManager();
49 
50  int save (std::string path);
51  void reset_canvas_colors();
52 
58  void on_show_clip_toggled ();
61  void on_all_dialogs_toggled ();
63  void on_icon_set_changed ();
64 
65  private:
66  Gtk::Notebook notebook;
67 
68  struct BasicColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
70  add (name);
71  add (gdkcolor);
72  }
73 
74  Gtk::TreeModelColumn<std::string> name;
75  Gtk::TreeModelColumn<Gdk::Color> gdkcolor;
76  };
77 
78  Gtk::ColorSelectionDialog color_dialog;
79  sigc::connection color_dialog_connection;
80 
82  Gtk::RadioButton dark_button;
83  Gtk::RadioButton light_button;
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;
93  Gtk::CheckButton all_dialogs;
94  Gtk::CheckButton transients_follow_front;
95  Gtk::CheckButton gradient_waveforms;
96  Gtk::Label icon_set_label;
97  Gtk::ComboBoxText icon_set_dropdown;
98 
99  /* handls response from color dialog when it is used to
100  edit a derived color.
101  */
102  void palette_color_response (int, std::string);
103 
104  Gtk::ScrolledWindow palette_scroller;
105  ArdourCanvas::GtkCanvasViewport palette_viewport;
106  ArdourCanvas::Container* palette_group;
107 
108  /* these methods create and manage a canvas for use in either the
109  palette tab or in a separate dialog. Different behaviour is
110  accomplished by changing the event handler passed into the
111  allocation handler. We do it there because we have to rebuild
112  the canvas on allocation events, and during the rebuild, connect
113  each rectangle to the event handler.
114 
115  the alternative is one event handler for the canvas and a map
116  of where each color rectangle is. nothing wrong with this
117  but the per-rect event setup is simpler and avoids building
118  and looking up the map information.
119  */
120  ArdourCanvas::Container* initialize_palette_canvas (ArdourCanvas::Canvas& canvas);
121  void build_palette_canvas (ArdourCanvas::Canvas&, ArdourCanvas::Container&, sigc::slot<bool,GdkEvent*,std::string> event_handler);
122  void palette_canvas_allocated (Gtk::Allocation& alloc, ArdourCanvas::Container* group, ArdourCanvas::Canvas* canvas, sigc::slot<bool,GdkEvent*,std::string> event_handler);
123  void palette_size_request (Gtk::Requisition*);
124 
125  /* handles events from a palette canvas inside the palette (derived
126  colors) tab
127  */
128  bool palette_event (GdkEvent*, std::string name);
129  /* allows user to edit a named color (e.g. "color 3") after clicking
130  on it inside the palette tab.
131  */
132  void edit_palette_color (std::string);
133 
134  struct ColorAliasModelColumns : public Gtk::TreeModel::ColumnRecord {
136  add (name);
137  add (alias);
138  add (color);
139  add (key);
140  }
141 
142  Gtk::TreeModelColumn<std::string> name;
143  Gtk::TreeModelColumn<std::string> alias;
144  Gtk::TreeModelColumn<Gdk::Color> color;
145  Gtk::TreeModelColumn<std::string> key;
146  };
147 
149  Gtk::TreeView alias_display;
150  Glib::RefPtr<Gtk::TreeStore> alias_list;
151  Gtk::ScrolledWindow alias_scroller;
152 
153  bool alias_button_press_event (GdkEventButton*);
154 
156  sigc::connection palette_response_connection;
157 
158  void choose_color_from_palette (std::string const &target_name);
159 
160  bool alias_palette_event (GdkEvent*, std::string, std::string);
161  void alias_palette_response (int, std::string, std::string);
162 
163  void setup_aliases ();
164  void setup_palette ();
165 
166  Gtk::ScrolledWindow modifier_scroller;
167  Gtk::VBox modifier_vbox;
168 
169  void setup_modifiers ();
170  void modifier_edited (Gtk::Range*, std::string);
171 
172  void colors_changed ();
173  void set_ui_to_state ();
174 };
175 
176 #endif /* __ardour_gtk_color_manager_h__ */
177 
Gtk::CheckButton blink_rec_button
Definition: theme_manager.h:86
sigc::connection palette_response_connection
Gtk::VBox modifier_vbox
Gtk::CheckButton flat_buttons
Definition: theme_manager.h:85
Gtk::TreeView alias_display
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
Definition: theme_manager.h:90
Gtk::TreeModelColumn< std::string > alias
void on_all_dialogs_toggled()
Gtk::ComboBoxText icon_set_dropdown
Definition: theme_manager.h:97
bool alias_palette_event(GdkEvent *, std::string, std::string)
Glib::RefPtr< Gtk::TreeStore > alias_list
bool alias_button_press_event(GdkEventButton *)
void on_transients_follow_front_toggled()
Gtk::Label timeline_item_gradient_depth_label
Definition: theme_manager.h:92
Gtk::CheckButton all_dialogs
Definition: theme_manager.h:93
ArdourCanvas::Container * initialize_palette_canvas(ArdourCanvas::Canvas &canvas)
void palette_size_request(Gtk::Requisition *)
void setup_modifiers()
Gtk::ScrolledWindow alias_scroller
void on_icon_set_changed()
Gtk::CheckButton transients_follow_front
Definition: theme_manager.h:94
ColorAliasModelColumns alias_columns
void on_show_clip_toggled()
Gtk::HScale waveform_gradient_depth
Definition: theme_manager.h:89
ArdourCanvas::GtkCanvasViewport palette_viewport
Gtk::Notebook notebook
Definition: theme_manager.h:66
Gtk::TreeModelColumn< Gdk::Color > gdkcolor
Definition: theme_manager.h:75
void build_palette_canvas(ArdourCanvas::Canvas &, ArdourCanvas::Container &, sigc::slot< bool, GdkEvent *, std::string > event_handler)
Gtk::RadioButton dark_button
Definition: theme_manager.h:82
Gtk::CheckButton gradient_waveforms
Definition: theme_manager.h:95
void reset_canvas_colors()
ArdourDialog * palette_window
void alias_palette_response(int, std::string, std::string)
sigc::connection color_dialog_connection
Definition: theme_manager.h:79
void on_light_theme_button_toggled()
Gtk::Button reset_button
Definition: theme_manager.h:84
int save(std::string path)
Gtk::CheckButton region_color_button
Definition: theme_manager.h:87
Gtk::TreeModelColumn< std::string > name
Definition: theme_manager.h:74
const char * name
void colors_changed()
void setup_palette()
Gtk::ColorSelectionDialog color_dialog
Definition: theme_manager.h:78
Gtk::CheckButton show_clipping_button
Definition: theme_manager.h:88
void choose_color_from_palette(std::string const &target_name)
Gtk::ScrolledWindow modifier_scroller
Gtk::HBox theme_selection_hbox
Definition: theme_manager.h:81
Gtk::ScrolledWindow palette_scroller
void on_blink_rec_arm_toggled()
bool palette_event(GdkEvent *, std::string name)
void palette_color_response(int, std::string)
void set_ui_to_state()
void setup_aliases()
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
Definition: theme_manager.h:96
Gtk::HScale timeline_item_gradient_depth
Definition: theme_manager.h:91
void on_timeline_item_gradient_depth_change()
void modifier_edited(Gtk::Range *, std::string)
Gtk::TreeModelColumn< Gdk::Color > color
void edit_palette_color(std::string)
void on_region_color_toggled()
ArdourCanvas::Container * palette_group
Gtk::RadioButton light_button
Definition: theme_manager.h:83