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__
26 #include "colorpicker.h"
31 class SketcherCurveTypeItem;
32 class SketcherCurveType;
33 class SketcherCurvePenItem;
34 class SketcherCurvePen;
35 class SketcherCurveColor;
36 class SketcherCurveColorPicker;
37 class SketcherCurveColorThread;
38 class SketcherNewCurve;
39 class SketcherDelCurve;
40 class SketcherCurveUp;
41 class SketcherCurveDn;
42 class SketcherCurveWidth;
43 class SketcherCurveList;
46 class SketcherPointId;
48 class SketcherPointTypeItem;
49 class SketcherPointType;
50 class SketcherPointList;
51 class SketcherNewPoint;
52 class SketcherDelPoint;
53 class SketcherPointUp;
54 class SketcherPointDn;
55 class SketcherResetCurves;
56 class SketcherResetPoints;
60 class SketcherCoord : public BC_TumbleTextBox
65 SketcherCoord(SketcherWindow *gui, int x, int y, coord output,
66 coord mn=-32767, coord mx=32767);
68 int update(coord v) { return BC_TumbleTextBox::update((coord)v); }
71 class SketcherNum : public BC_TumbleTextBox
76 SketcherNum(SketcherWindow *gui, int x, int y, int output,
77 int mn=-32767, int mx=32767);
79 int update(int v) { return BC_TumbleTextBox::update((int64_t)v); }
82 class SketcherCurvePenItem : public BC_MenuItem
85 SketcherCurvePenItem(int pen);
90 class SketcherCurvePen : public BC_PopupMenu
93 SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen);
94 void create_objects();
101 class SketcherCurveColor : public BC_Button
104 SketcherCurveColor(SketcherWindow *gui, int x, int y, int w, int h);
105 ~SketcherCurveColor();
107 void set_color(int color);
108 void update_gui(int color);
116 class SketcherCurveColorPicker : public ColorPicker
119 SketcherCurveColorPicker(SketcherWindow *gui, SketcherCurveColor *curve_color);
120 ~SketcherCurveColorPicker();
121 void start(int color);
122 int handle_new_color(int color, int alpha);
124 void handle_done_event(int result);
128 SketcherCurveColor *color_button;
129 SketcherCurveColorThread *color_update;
132 class SketcherCurveColorThread : public Thread
135 SketcherCurveColorThread(SketcherCurveColorPicker *color_picker);
136 ~SketcherCurveColorThread();
142 SketcherCurveColorPicker *color_picker;
144 Condition *update_lock;
147 class SketcherNewCurve : public BC_GenericButton
150 SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
159 class SketcherDelCurve : public BC_GenericButton
162 SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
171 class SketcherCurveUp : public BC_GenericButton
174 SketcherCurveUp(SketcherWindow *gui, int x, int y);
182 class SketcherCurveDn : public BC_GenericButton
185 SketcherCurveDn(SketcherWindow *gui, int x, int y);
193 class SketcherCurveWidth : public SketcherNum
196 SketcherCurveWidth(SketcherWindow *gui, int x, int y, int width);
197 ~SketcherCurveWidth();
200 void update(int width);
204 class SketcherCurveList : public BC_ListBox
207 SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
208 ~SketcherCurveList();
211 int selection_changed();
212 int column_resize_event();
213 ArrayList<BC_ListBoxItem*> cols[CV_SZ];
215 void add_curve(const char *id, const char *pen,
216 const char *width, const char *color, const char *alpha);
217 void del_curve(int i);
218 void set_selected(int k);
220 void update_list(int k);
224 const char *col_titles[CV_SZ];
225 int col_widths[CV_SZ];
229 class SketcherPointX : public SketcherCoord
232 SketcherPointX(SketcherWindow *gui, int x, int y, float output)
233 : SketcherCoord(gui, x, y, output) {}
238 class SketcherPointY : public SketcherCoord
241 SketcherPointY(SketcherWindow *gui, int x, int y, float output)
242 : SketcherCoord(gui, x, y, output) {}
248 class SketcherPointId : public SketcherNum
251 SketcherPointId(SketcherWindow *gui, int x, int y, int output)
252 : SketcherNum(gui, x, y, output) {}
253 ~SketcherPointId() {}
259 class SketcherDrag : public BC_CheckBox
262 SketcherDrag(SketcherWindow *gui, int x, int y);
268 class SketcherPointTypeItem : public BC_MenuItem
271 SketcherPointTypeItem(int arc);
276 class SketcherPointType : public BC_PopupMenu
279 SketcherPointType(SketcherWindow *gui, int x, int y, int arc);
280 void create_objects();
281 void update(int arc);
288 class SketcherPointList : public BC_ListBox
291 SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
292 ~SketcherPointList();
295 int selection_changed();
296 int column_resize_event();
297 ArrayList<BC_ListBoxItem*> cols[PT_SZ];
299 void add_point(const char *id, const char *ty, const char *xp, const char *yp);
300 void set_point(int i, int c, int v);
301 void set_point(int i, int c, coord v);
302 void set_point(int i, int c, const char *cp);
303 void set_selected(int k);
305 void update_list(int k);
310 const char *col_titles[PT_SZ];
311 int col_widths[PT_SZ];
314 class SketcherNewPoint : public BC_GenericButton
317 SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
326 class SketcherDelPoint : public BC_GenericButton
329 SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
338 class SketcherPointUp : public BC_GenericButton
341 SketcherPointUp(SketcherWindow *gui, int x, int y);
349 class SketcherPointDn : public BC_GenericButton
352 SketcherPointDn(SketcherWindow *gui, int x, int y);
360 class SketcherResetCurves : public BC_GenericButton
363 SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
364 ~SketcherResetCurves();
372 class SketcherResetPoints : public BC_GenericButton
375 SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
376 ~SketcherResetPoints();
385 class SketcherWindow : public PluginClientWindow
388 SketcherWindow(Sketcher *plugin);
391 void create_objects();
392 void done_event(int result);
394 void start_color_thread(SketcherCurveColor *curve_color);
395 int grab_event(XEvent *event);
396 int do_grab_event(XEvent *event);
397 int grab_button_press(XEvent *event);
398 int grab_cursor_motion();
399 void send_configure_change();
400 int keypress_event();
404 BC_Title *title_pen, *title_color, *title_width;
405 SketcherCurveType *curve_type;
406 SketcherCurvePen *curve_pen;
407 SketcherCurveColor *curve_color;
408 SketcherCurveColorPicker *color_picker;
409 SketcherNewCurve *new_curve;
410 SketcherDelCurve *del_curve;
411 SketcherCurveUp *curve_up;
412 SketcherCurveDn *curve_dn;
413 SketcherCurveWidth *curve_width;
414 SketcherCurveList *curve_list;
415 SketcherResetCurves *reset_curves;
417 SketcherResetPoints *reset_points;
419 SketcherPointType *point_type;
420 SketcherPointList *point_list;
421 BC_Title *title_x, *title_y, *title_id;
422 SketcherPointX *point_x;
423 SketcherPointY *point_y;
424 SketcherPointId *point_id;
425 SketcherNewPoint *new_point;
426 SketcherDelPoint *del_point;
427 SketcherPointUp *point_up;
428 SketcherPointDn *point_dn;
430 float projector_x, projector_y, projector_z;
431 int track_w, track_h;
433 float cursor_x, cursor_y;
434 float output_x, output_y;
436 int pending_motion, pending_config;
438 float last_x, last_y;
439 BC_Title *notes0, *notes1, *notes2, *notes3;