Code

enable color gestures for fill and stroke
[inkscape.git] / src / ui / widget / selected-style.h
1 /**
2  * \brief Selected style indicator (fill, stroke, opacity)
3  *
4  * Authors:
5  *   buliabyak@gmail.com
6  *   scislac@users.sf.net
7  *
8  * Copyright (C) 2005 authors
9  *
10  * Released under GNU GPL.  Read the file 'COPYING' for more information.
11  */
13 #ifndef INKSCAPE_UI_CURRENT_STYLE_H
14 #define INKSCAPE_UI_CURRENT_STYLE_H
16 #include <gtkmm/table.h>
17 #include <gtkmm/label.h>
18 #include <gtkmm/box.h>
19 #include <gtkmm/eventbox.h>
20 #include <gtkmm/enums.h>
21 #include <gtkmm/menu.h>
22 #include <gtkmm/menuitem.h>
23 #include <gtkmm/adjustment.h>
24 #include <gtkmm/spinbutton.h>
26 #include <sigc++/sigc++.h>
28 #include <glibmm/i18n.h>
30 #include <desktop.h>
32 #include "button.h"
33 #include "rotateable.h"
35 class SPUnit;
37 namespace Inkscape {
38 namespace UI {
39 namespace Widget {
41 enum {
42     SS_NA,
43     SS_NONE,
44     SS_UNSET,
45     SS_PATTERN,
46     SS_LGRADIENT,
47     SS_RGRADIENT,
48     SS_MANY,
49     SS_COLOR
50 };
52 enum {
53     SS_FILL,
54     SS_STROKE
55 };
57 class SelectedStyle;
59 class RotateableSwatch: public Rotateable 
60 {
61 public:
62     RotateableSwatch(guint mode);
63     ~RotateableSwatch();
65     guint fillstroke;
66     SelectedStyle *parent;
67     guint32 startcolor;
68     bool startcolor_set;
69     gchar *undokey;
71     double color_adjust (float *hsl, double by, guint32 cc, guint state);
72     virtual void do_motion (double by, guint state);
73     virtual void do_release (double by, guint state);
74 };
76 class SelectedStyle : public Gtk::HBox
77 {
78 public:
79     SelectedStyle(bool layout = true);
81     ~SelectedStyle();
83     void setDesktop(SPDesktop *desktop);
84     SPDesktop *getDesktop() {return _desktop;}
85     void update();
87     guint32 _lastselected[2];
88     guint32 _thisselected[2];
90     guint _mode[2];
92 protected:
93     SPDesktop *_desktop;
95     Gtk::Table _table;
97     Gtk::Label _fill_label;
98     Gtk::Label _stroke_label;
99     Gtk::Label _opacity_label;
101     RotateableSwatch _fill_place;
102     RotateableSwatch _stroke_place;
104     Gtk::EventBox _fill_flag_place;
105     Gtk::EventBox _stroke_flag_place;
107     Gtk::EventBox _opacity_place;
108     Gtk::Adjustment _opacity_adjustment;
109     Gtk::SpinButton _opacity_sb;
111     Gtk::Label _na[2];
112     Glib::ustring __na[2];
114     Gtk::Label _none[2];
115     Glib::ustring __none[2];
117     Gtk::Label _pattern[2];
118     Glib::ustring __pattern[2];
120     Gtk::Label _lgradient[2];
121     Glib::ustring __lgradient[2];
123     GtkWidget *_gradient_preview_l[2];
124     Gtk::HBox _gradient_box_l[2];
126     Gtk::Label _rgradient[2];
127     Glib::ustring __rgradient[2];
129     GtkWidget *_gradient_preview_r[2];
130     Gtk::HBox _gradient_box_r[2];
132     Gtk::Label _many[2];
133     Glib::ustring __many[2];
135     Gtk::Label _unset[2];
136     Glib::ustring __unset[2];
138     Gtk::Widget *_color_preview[2];
139     Glib::ustring __color[2];
141     Gtk::Label _averaged[2];
142     Glib::ustring __averaged[2];
143     Gtk::Label _multiple[2];
144     Glib::ustring __multiple[2];
146     Gtk::HBox _stroke;
147     Gtk::EventBox _stroke_width_place;
148     Gtk::Label _stroke_width;
150     Glib::ustring _paintserver_id[2];
152     sigc::connection *selection_changed_connection;
153     sigc::connection *selection_modified_connection;
154     sigc::connection *subselection_changed_connection;
156     static void dragDataReceived( GtkWidget *widget,
157                                   GdkDragContext *drag_context,
158                                   gint x, gint y,
159                                   GtkSelectionData *data,
160                                   guint info,
161                                   guint event_time,
162                                   gpointer user_data );
164     bool on_fill_click(GdkEventButton *event);
165     bool on_stroke_click(GdkEventButton *event);
166     bool on_opacity_click(GdkEventButton *event);
167     bool on_sw_click(GdkEventButton *event);
169     bool _opacity_blocked;
170     void on_opacity_changed();
171     void on_opacity_menu(Gtk::Menu *menu);
172     void opacity_0();
173     void opacity_025();
174     void opacity_05();
175     void opacity_075();
176     void opacity_1();
178     void on_fill_remove();
179     void on_stroke_remove();
180     void on_fill_lastused();
181     void on_stroke_lastused();
182     void on_fill_lastselected();
183     void on_stroke_lastselected();
184     void on_fill_unset();
185     void on_stroke_unset();
186     void on_fill_edit();
187     void on_stroke_edit();
188     void on_fillstroke_swap();
189     void on_fill_invert();
190     void on_stroke_invert();
191     void on_fill_white();
192     void on_stroke_white();
193     void on_fill_black();
194     void on_stroke_black();
195     void on_fill_copy();
196     void on_stroke_copy();
197     void on_fill_paste();
198     void on_stroke_paste();
199     void on_fill_opaque();
200     void on_stroke_opaque();
202     Gtk::Menu _popup[2];
203     Gtk::MenuItem _popup_edit[2];
204     Gtk::MenuItem _popup_lastused[2];
205     Gtk::MenuItem _popup_lastselected[2];
206     Gtk::MenuItem _popup_invert[2];
207     Gtk::MenuItem _popup_white[2];
208     Gtk::MenuItem _popup_black[2];
209     Gtk::MenuItem _popup_copy[2];
210     Gtk::MenuItem _popup_paste[2];
211     Gtk::MenuItem _popup_swap[2];
212     Gtk::MenuItem _popup_opaque[2];
213     Gtk::MenuItem _popup_unset[2];
214     Gtk::MenuItem _popup_remove[2];
216     Gtk::Menu _popup_sw; 
217     Gtk::RadioButtonGroup _sw_group;
218     Gtk::RadioMenuItem _popup_px; 
219     void on_popup_px();
220     Gtk::RadioMenuItem _popup_pt; 
221     void on_popup_pt();
222     Gtk::RadioMenuItem _popup_mm;
223     void on_popup_mm();
224     void on_popup_preset(int i);
225     Gtk::MenuItem _popup_sw_remove;
227     SPUnit *_sw_unit;
229     Gtk::Tooltips _tooltips;
231     void *_drop[2];
232     bool _dropEnabled[2];
233 };
236 } // namespace Widget
237 } // namespace UI
238 } // namespace Inkscape
240 #endif // INKSCAPE_UI_WIDGET_BUTTON_H
242 /* 
243   Local Variables:
244   mode:c++
245   c-file-style:"stroustrup"
246   c-file-offsets:((innamespace . 0)(inline-open . 0))
247   indent-tabs-mode:nil
248   fill-column:99
249   End:
250 */
251 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :