Ardour  9.0-pre0-582-g084a23a80d
color_theme_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
3  * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #pragma once
21 
22 #include <gtkmm/treeview.h>
23 #include <gtkmm/treestore.h>
24 #include <gtkmm/scrolledwindow.h>
25 #include <gtkmm/colorselection.h>
26 #include <gtkmm/button.h>
27 
28 #include "canvas/types.h"
29 #include "canvas/canvas.h"
30 
31 #include "option_editor.h"
32 #include "ui_config.h"
33 
34 namespace ArdourCanvas {
35  class Container;
36  class ScrollGroup;
37 }
38 
39 class ArdourDialog;
40 
42 {
43 public:
46 
49 
53  void parameter_changed (std::string const & p);
54 
57 
58  void set_note (std::string const &);
59 
61 
63 
64 private:
67 
68  /* handls response from color dialog when it is used to
69  * edit a derived color.
70  */
71  void palette_color_response (int, std::string);
72 
76 
77  /* these methods create and manage a canvas for use in either the
78  * palette tab or in a separate dialog. Different behaviour is
79  * accomplished by changing the event handler passed into the
80  * allocation handler. We do it there because we have to rebuild
81  * the canvas on allocation events, and during the rebuild, connect
82  * each rectangle to the event handler.
83  *
84  * the alternative is one event handler for the canvas and a map
85  * of where each color rectangle is. nothing wrong with this
86  * but the per-rect event setup is simpler and avoids building
87  * and looking up the map information.
88  */
90  void build_palette_canvas (ArdourCanvas::Canvas&, ArdourCanvas::Container&, sigc::slot<bool,GdkEvent*,std::string> event_handler);
91  void palette_canvas_allocated (Gtk::Allocation& alloc, ArdourCanvas::Container* group, ArdourCanvas::Canvas* canvas, sigc::slot<bool,GdkEvent*,std::string> event_handler);
93 
94  /* handles events from a palette canvas inside the palette (derived
95  * colors) tab
96  */
97  bool palette_event (GdkEvent*, std::string name);
98  /* allows user to edit a named color (e.g. "color 3") after clicking
99  * on it inside the palette tab.
100  */
101  void edit_palette_color (std::string);
102 
105  add (name);
106  add (alias);
107  add (color);
108  add (key);
109  }
110 
115  };
116 
119  Glib::RefPtr<Gtk::TreeStore> alias_list;
121 
123 
125  sigc::connection palette_response_connection;
126 
127  void choose_color_from_palette (std::string const &target_name);
128 
129  bool alias_palette_event (GdkEvent*, std::string, std::string);
130  void alias_palette_response (int, std::string, std::string);
131 
132  void setup_aliases ();
133  void setup_palette ();
134 
137 
139  void modifier_edited (Gtk::Range*, std::string);
140 
142  sigc::connection color_dialog_connection;
143 
144  void colors_changed ();
146 
147 
150  add (name);
151  add (path);
152  }
153 
156  };
157 
159  Glib::RefPtr<Gtk::TreeStore> theme_list;
160 
163 
164 };
165 
Declaration of the main canvas classes.
ArdourDialog * palette_window
sigc::connection palette_response_connection
void choose_color_from_palette(std::string const &target_name)
ArdourCanvas::Container * initialize_palette_canvas(ArdourCanvas::Canvas &canvas)
Gtk::Widget & tip_widget()
Gtk::ScrolledWindow alias_scroller
Gtk::ScrolledWindow palette_scroller
bool alias_button_press_event(GdkEventButton *)
void reset_canvas_colors()
void set_note(std::string const &)
Gtk::ScrolledWindow modifier_scroller
void modifier_edited(Gtk::Range *, std::string)
ColorThemeModelColumns color_theme_columns
void add_to_page(OptionEditorPage *)
void alias_palette_response(int, std::string, std::string)
void palette_canvas_allocated(Gtk::Allocation &alloc, ArdourCanvas::Container *group, ArdourCanvas::Canvas *canvas, sigc::slot< bool, GdkEvent *, std::string > event_handler)
Gtk::TreeView alias_display
void on_color_theme_changed()
ColorAliasModelColumns alias_columns
ArdourCanvas::Container * palette_group
Gtk::Notebook notebook
bool alias_palette_event(GdkEvent *, std::string, std::string)
sigc::connection color_dialog_connection
Gtk::ColorSelectionDialog color_dialog
Gtk::ComboBox color_theme_dropdown
ArdourCanvas::GtkCanvasViewport palette_viewport
void edit_palette_color(std::string)
Glib::RefPtr< Gtk::TreeStore > alias_list
bool palette_event(GdkEvent *, std::string name)
void set_state_from_config()
Glib::RefPtr< Gtk::TreeStore > theme_list
void parameter_changed(std::string const &p)
void palette_color_response(int, std::string)
void palette_size_request(Gtk::Requisition *)
void build_palette_canvas(ArdourCanvas::Canvas &, ArdourCanvas::Container &, sigc::slot< bool, GdkEvent *, std::string > event_handler)
void add(TreeModelColumnBase &column)
GtkImageIconNameData name
Definition: gtkimage.h:6
Base class for option editing dialog boxes.
Gtk::TreeModelColumn< std::string > alias
Gtk::TreeModelColumn< std::string > name
Gtk::TreeModelColumn< std::string > key
Gtk::TreeModelColumn< Gdk::Color > color
Gtk::TreeModelColumn< std::string > path
Gtk::TreeModelColumn< std::string > name