Code

it was a very stupid idea to sort all combos without asking - this broke the blend...
[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(SelectedStyle *parent, guint mode);
63     ~RotateableSwatch();
65     double color_adjust (float *hsl, double by, guint32 cc, guint state);
66     virtual void do_motion (double by, guint state);
67     virtual void do_release (double by, guint state);
69 private:
70     guint fillstroke;
72     SelectedStyle *parent;
74     guint32 startcolor;
75     bool startcolor_set;
77     gchar const *undokey;
79     GdkCursor *cr;
80     bool cr_set;
81 };
83 class RotateableStrokeWidth: public Rotateable 
84 {
85 public:
86     RotateableStrokeWidth(SelectedStyle *parent);
87     ~RotateableStrokeWidth();
89     double value_adjust(double current, double by, guint modifier, bool final);
90     virtual void do_motion (double by, guint state);
91     virtual void do_release (double by, guint state);
93 private:
94     SelectedStyle *parent;
96     double startvalue;
97     bool startvalue_set;
99     gchar const *undokey;
101     GdkCursor *cr;
102     bool cr_set;
103 };
105 class SelectedStyle : public Gtk::HBox
107 public:
108     SelectedStyle(bool layout = true);
110     ~SelectedStyle();
112     void setDesktop(SPDesktop *desktop);
113     SPDesktop *getDesktop() {return _desktop;}
114     void update();
116     guint32 _lastselected[2];
117     guint32 _thisselected[2];
119     guint _mode[2];
121     double current_stroke_width;
123 protected:
124     SPDesktop *_desktop;
126     Gtk::Table _table;
128     Gtk::Label _fill_label;
129     Gtk::Label _stroke_label;
130     Gtk::Label _opacity_label;
132     RotateableSwatch _fill_place;
133     RotateableSwatch _stroke_place;
135     Gtk::EventBox _fill_flag_place;
136     Gtk::EventBox _stroke_flag_place;
138     Gtk::EventBox _opacity_place;
139     Gtk::Adjustment _opacity_adjustment;
140     Gtk::SpinButton _opacity_sb;
142     Gtk::Label _na[2];
143     Glib::ustring __na[2];
145     Gtk::Label _none[2];
146     Glib::ustring __none[2];
148     Gtk::Label _pattern[2];
149     Glib::ustring __pattern[2];
151     Gtk::Label _lgradient[2];
152     Glib::ustring __lgradient[2];
154     GtkWidget *_gradient_preview_l[2];
155     Gtk::HBox _gradient_box_l[2];
157     Gtk::Label _rgradient[2];
158     Glib::ustring __rgradient[2];
160     GtkWidget *_gradient_preview_r[2];
161     Gtk::HBox _gradient_box_r[2];
163     Gtk::Label _many[2];
164     Glib::ustring __many[2];
166     Gtk::Label _unset[2];
167     Glib::ustring __unset[2];
169     Gtk::Widget *_color_preview[2];
170     Glib::ustring __color[2];
172     Gtk::Label _averaged[2];
173     Glib::ustring __averaged[2];
174     Gtk::Label _multiple[2];
175     Glib::ustring __multiple[2];
177     Gtk::HBox _stroke;
178     RotateableStrokeWidth _stroke_width_place;
179     Gtk::Label _stroke_width;
181     Glib::ustring _paintserver_id[2];
183     sigc::connection *selection_changed_connection;
184     sigc::connection *selection_modified_connection;
185     sigc::connection *subselection_changed_connection;
187     static void dragDataReceived( GtkWidget *widget,
188                                   GdkDragContext *drag_context,
189                                   gint x, gint y,
190                                   GtkSelectionData *data,
191                                   guint info,
192                                   guint event_time,
193                                   gpointer user_data );
195     bool on_fill_click(GdkEventButton *event);
196     bool on_stroke_click(GdkEventButton *event);
197     bool on_opacity_click(GdkEventButton *event);
198     bool on_sw_click(GdkEventButton *event);
200     bool _opacity_blocked;
201     void on_opacity_changed();
202     void on_opacity_menu(Gtk::Menu *menu);
203     void opacity_0();
204     void opacity_025();
205     void opacity_05();
206     void opacity_075();
207     void opacity_1();
209     void on_fill_remove();
210     void on_stroke_remove();
211     void on_fill_lastused();
212     void on_stroke_lastused();
213     void on_fill_lastselected();
214     void on_stroke_lastselected();
215     void on_fill_unset();
216     void on_stroke_unset();
217     void on_fill_edit();
218     void on_stroke_edit();
219     void on_fillstroke_swap();
220     void on_fill_invert();
221     void on_stroke_invert();
222     void on_fill_white();
223     void on_stroke_white();
224     void on_fill_black();
225     void on_stroke_black();
226     void on_fill_copy();
227     void on_stroke_copy();
228     void on_fill_paste();
229     void on_stroke_paste();
230     void on_fill_opaque();
231     void on_stroke_opaque();
233     Gtk::Menu _popup[2];
234     Gtk::MenuItem _popup_edit[2];
235     Gtk::MenuItem _popup_lastused[2];
236     Gtk::MenuItem _popup_lastselected[2];
237     Gtk::MenuItem _popup_invert[2];
238     Gtk::MenuItem _popup_white[2];
239     Gtk::MenuItem _popup_black[2];
240     Gtk::MenuItem _popup_copy[2];
241     Gtk::MenuItem _popup_paste[2];
242     Gtk::MenuItem _popup_swap[2];
243     Gtk::MenuItem _popup_opaque[2];
244     Gtk::MenuItem _popup_unset[2];
245     Gtk::MenuItem _popup_remove[2];
247     Gtk::Menu _popup_sw; 
248     Gtk::RadioButtonGroup _sw_group;
249     Gtk::RadioMenuItem _popup_px; 
250     void on_popup_px();
251     Gtk::RadioMenuItem _popup_pt; 
252     void on_popup_pt();
253     Gtk::RadioMenuItem _popup_mm;
254     void on_popup_mm();
255     void on_popup_preset(int i);
256     Gtk::MenuItem _popup_sw_remove;
258     SPUnit *_sw_unit;
260     Gtk::Tooltips _tooltips;
262     void *_drop[2];
263     bool _dropEnabled[2];
264 };
267 } // namespace Widget
268 } // namespace UI
269 } // namespace Inkscape
271 #endif // INKSCAPE_UI_WIDGET_BUTTON_H
273 /* 
274   Local Variables:
275   mode:c++
276   c-file-style:"stroustrup"
277   c-file-offsets:((innamespace . 0)(inline-open . 0))
278   indent-tabs-mode:nil
279   fill-column:99
280   End:
281 */
282 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :