3 * Copyright (C) 2008-2015 Adam Williams <broadcast at earthling dot net>
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __CRIKEYWINDOW_H__
22 #define __CRIKEYWINDOW_H__
25 #include "colorpicker.h"
29 class SketcherCurveTypeItem;
30 class SketcherCurveType;
31 class SketcherCurvePenItem;
32 class SketcherCurvePen;
33 class SketcherCurveColor;
34 class SketcherCurveColorPicker;
35 class SketcherCurveColorThread;
36 class SketcherNewCurve;
37 class SketcherDelCurve;
38 class SketcherCurveUp;
39 class SketcherCurveDn;
40 class SketcherCurveRadius;
41 class SketcherCurveList;
45 class SketcherPointTypeItem;
46 class SketcherPointType;
47 class SketcherPointList;
48 class SketcherNewPoint;
49 class SketcherDelPoint;
50 class SketcherPointUp;
51 class SketcherPointDn;
52 class SketcherResetCurves;
53 class SketcherResetPoints;
57 class SketcherNum : public BC_TumbleTextBox
62 SketcherNum(SketcherWindow *gui, int x, int y, int output,
63 int mn=-32767, int mx=32767);
65 int update(int v) { return BC_TumbleTextBox::update((int64_t)v); }
68 class SketcherCurvePenItem : public BC_MenuItem
71 SketcherCurvePenItem(int pen);
76 class SketcherCurvePen : public BC_PopupMenu
79 SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen);
80 void create_objects();
86 class SketcherCurveColor : public BC_Button
89 SketcherCurveColor(SketcherWindow *gui, int x, int y, int w, int h);
90 ~SketcherCurveColor();
92 void set_color(int color);
93 void update_gui(int color);
101 class SketcherCurveColorPicker : public ColorPicker
104 SketcherCurveColorPicker(SketcherWindow *gui, SketcherCurveColor *curve_color);
105 ~SketcherCurveColorPicker();
106 void start(int color);
107 int handle_new_color(int color, int alpha);
109 void handle_done_event(int result);
113 SketcherCurveColor *color_button;
114 SketcherCurveColorThread *color_update;
117 class SketcherCurveColorThread : public Thread
120 SketcherCurveColorThread(SketcherCurveColorPicker *color_picker);
121 ~SketcherCurveColorThread();
127 SketcherCurveColorPicker *color_picker;
129 Condition *update_lock;
132 class SketcherNewCurve : public BC_GenericButton
135 SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
144 class SketcherDelCurve : public BC_GenericButton
147 SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
156 class SketcherCurveUp : public BC_GenericButton
159 SketcherCurveUp(SketcherWindow *gui, int x, int y);
167 class SketcherCurveDn : public BC_GenericButton
170 SketcherCurveDn(SketcherWindow *gui, int x, int y);
178 class SketcherCurveRadius : public SketcherNum
181 SketcherCurveRadius(SketcherWindow *gui, int x, int y, float output)
182 : SketcherNum(gui, x, y, output, 0, 255) {}
183 ~SketcherCurveRadius() {}
188 class SketcherCurveList : public BC_ListBox
191 SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
192 ~SketcherCurveList();
195 int selection_changed();
196 int column_resize_event();
197 ArrayList<BC_ListBoxItem*> cols[CV_SZ];
199 void add_curve(const char *id, const char *pen,
200 const char *radius, const char *color);
201 void del_curve(int i);
202 void set_curve(int i, int c, const char *cp);
203 void set_selected(int k);
205 void update_list(int k);
209 const char *titles[CV_SZ];
214 class SketcherPointX : public SketcherNum
217 SketcherPointX(SketcherWindow *gui, int x, int y, float output)
218 : SketcherNum(gui, x, y, output) {}
223 class SketcherPointY : public SketcherNum
226 SketcherPointY(SketcherWindow *gui, int x, int y, float output)
227 : SketcherNum(gui, x, y, output) {}
234 class SketcherDrag : public BC_CheckBox
237 SketcherDrag(SketcherWindow *gui, int x, int y);
243 class SketcherPointTypeItem : public BC_MenuItem
246 SketcherPointTypeItem(int pty);
251 class SketcherPointType : public BC_PopupMenu
254 SketcherPointType(SketcherWindow *gui, int x, int y, int pty);
255 void create_objects();
256 void update(int pty);
262 class SketcherPointList : public BC_ListBox
265 SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
266 ~SketcherPointList();
269 int selection_changed();
270 int column_resize_event();
271 ArrayList<BC_ListBoxItem*> cols[PT_SZ];
273 void add_point(const char *id, const char *ty, const char *xp, const char *yp);
274 void set_point(int i, int c, int v);
275 void set_point(int i, int c, const char *cp);
276 void set_selected(int k);
278 void update_list(int k);
283 const char *titles[PT_SZ];
287 class SketcherNewPoint : public BC_GenericButton
290 SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
299 class SketcherDelPoint : public BC_GenericButton
302 SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
311 class SketcherPointUp : public BC_GenericButton
314 SketcherPointUp(SketcherWindow *gui, int x, int y);
322 class SketcherPointDn : public BC_GenericButton
325 SketcherPointDn(SketcherWindow *gui, int x, int y);
333 class SketcherResetCurves : public BC_GenericButton
336 SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
337 ~SketcherResetCurves();
345 class SketcherResetPoints : public BC_GenericButton
348 SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
349 ~SketcherResetPoints();
358 class SketcherWindow : public PluginClientWindow
361 SketcherWindow(Sketcher *plugin);
364 void create_objects();
366 void start_color_thread(SketcherCurveColor *curve_color);
367 int grab_event(XEvent *event);
368 int do_grab_event(XEvent *event);
369 void done_event(int result);
370 void send_configure_change();
371 int keypress_event();
375 BC_Title *title_pen, *title_color, *title_radius;
376 SketcherCurveType *curve_type;
377 SketcherCurvePen *curve_pen;
378 SketcherCurveColor *curve_color;
379 SketcherCurveColorPicker *color_picker;
380 SketcherNewCurve *new_curve;
381 SketcherDelCurve *del_curve;
382 SketcherCurveUp *curve_up;
383 SketcherCurveDn *curve_dn;
384 SketcherCurveRadius *curve_radius;
385 SketcherCurveList *curve_list;
386 SketcherResetCurves *reset_curves;
388 SketcherResetPoints *reset_points;
390 SketcherPointType *point_type;
391 SketcherPointList *point_list;
392 BC_Title *title_x, *title_y;
393 SketcherPointX *point_x;
394 SketcherPointY *point_y;
395 SketcherNewPoint *new_point;
396 SketcherDelPoint *del_point;
397 SketcherPointUp *point_up;
398 SketcherPointDn *point_dn;
399 int dragging, pending_config;
401 float last_x, last_y;
402 BC_Title *notes0, *notes1, *notes2;