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();
100 class SketcherCurveColor : public BC_Button
103 SketcherCurveColor(SketcherWindow *gui, int x, int y, int w, int h);
104 ~SketcherCurveColor();
106 void set_color(int color);
107 void update_gui(int color);
115 class SketcherCurveColorPicker : public ColorPicker
118 SketcherCurveColorPicker(SketcherWindow *gui, SketcherCurveColor *curve_color);
119 ~SketcherCurveColorPicker();
120 void start(int color);
121 int handle_new_color(int color, int alpha);
123 void handle_done_event(int result);
127 SketcherCurveColor *color_button;
128 SketcherCurveColorThread *color_update;
131 class SketcherCurveColorThread : public Thread
134 SketcherCurveColorThread(SketcherCurveColorPicker *color_picker);
135 ~SketcherCurveColorThread();
141 SketcherCurveColorPicker *color_picker;
143 Condition *update_lock;
146 class SketcherNewCurve : public BC_GenericButton
149 SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
158 class SketcherDelCurve : public BC_GenericButton
161 SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
170 class SketcherCurveUp : public BC_GenericButton
173 SketcherCurveUp(SketcherWindow *gui, int x, int y);
181 class SketcherCurveDn : public BC_GenericButton
184 SketcherCurveDn(SketcherWindow *gui, int x, int y);
192 class SketcherCurveWidth : public SketcherNum
195 SketcherCurveWidth(SketcherWindow *gui, int x, int y, float output)
196 : SketcherNum(gui, x, y, output, 0, 255) {}
197 ~SketcherCurveWidth() {}
202 class SketcherCurveList : public BC_ListBox
205 SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
206 ~SketcherCurveList();
209 int selection_changed();
210 int column_resize_event();
211 ArrayList<BC_ListBoxItem*> cols[CV_SZ];
213 void add_curve(const char *id, const char *pen,
214 const char *width, const char *color, const char *alpha);
215 void del_curve(int i);
216 void set_selected(int k);
218 void update_list(int k);
222 const char *col_titles[CV_SZ];
223 int col_widths[CV_SZ];
227 class SketcherPointX : public SketcherCoord
230 SketcherPointX(SketcherWindow *gui, int x, int y, float output)
231 : SketcherCoord(gui, x, y, output) {}
236 class SketcherPointY : public SketcherCoord
239 SketcherPointY(SketcherWindow *gui, int x, int y, float output)
240 : SketcherCoord(gui, x, y, output) {}
246 class SketcherPointId : public SketcherNum
249 SketcherPointId(SketcherWindow *gui, int x, int y, int output)
250 : SketcherNum(gui, x, y, output) {}
251 ~SketcherPointId() {}
257 class SketcherDrag : public BC_CheckBox
260 SketcherDrag(SketcherWindow *gui, int x, int y);
266 class SketcherPointTypeItem : public BC_MenuItem
269 SketcherPointTypeItem(int pty);
274 class SketcherPointType : public BC_PopupMenu
277 SketcherPointType(SketcherWindow *gui, int x, int y, int pty);
278 void create_objects();
279 void update(int pty);
285 class SketcherPointList : public BC_ListBox
288 SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
289 ~SketcherPointList();
292 int selection_changed();
293 int column_resize_event();
294 ArrayList<BC_ListBoxItem*> cols[PT_SZ];
296 void add_point(const char *id, const char *ty, const char *xp, const char *yp);
297 void set_point(int i, int c, int v);
298 void set_point(int i, int c, coord v);
299 void set_point(int i, int c, const char *cp);
300 void set_selected(int k);
302 void update_list(int k);
307 const char *col_titles[PT_SZ];
308 int col_widths[PT_SZ];
311 class SketcherNewPoint : public BC_GenericButton
314 SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
323 class SketcherDelPoint : public BC_GenericButton
326 SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
335 class SketcherPointUp : public BC_GenericButton
338 SketcherPointUp(SketcherWindow *gui, int x, int y);
346 class SketcherPointDn : public BC_GenericButton
349 SketcherPointDn(SketcherWindow *gui, int x, int y);
357 class SketcherResetCurves : public BC_GenericButton
360 SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
361 ~SketcherResetCurves();
369 class SketcherResetPoints : public BC_GenericButton
372 SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
373 ~SketcherResetPoints();
382 class SketcherWindow : public PluginClientWindow
385 SketcherWindow(Sketcher *plugin);
388 void create_objects();
390 void start_color_thread(SketcherCurveColor *curve_color);
391 int grab_event(XEvent *event);
392 int grab_button_press(XEvent *event);
393 int grab_cursor_motion(XEvent *event);
394 int do_grab_event(XEvent *event);
395 void done_event(int result);
396 void send_configure_change();
397 int keypress_event();
401 BC_Title *title_pen, *title_color, *title_width;
402 SketcherCurveType *curve_type;
403 SketcherCurvePen *curve_pen;
404 SketcherCurveColor *curve_color;
405 SketcherCurveColorPicker *color_picker;
406 SketcherNewCurve *new_curve;
407 SketcherDelCurve *del_curve;
408 SketcherCurveUp *curve_up;
409 SketcherCurveDn *curve_dn;
410 SketcherCurveWidth *curve_width;
411 SketcherCurveList *curve_list;
412 SketcherResetCurves *reset_curves;
414 SketcherResetPoints *reset_points;
416 SketcherPointType *point_type;
417 SketcherPointList *point_list;
418 BC_Title *title_x, *title_y, *title_id;
419 SketcherPointX *point_x;
420 SketcherPointY *point_y;
421 SketcherPointId *point_id;
422 SketcherNewPoint *new_point;
423 SketcherDelPoint *del_point;
424 SketcherPointUp *point_up;
425 SketcherPointDn *point_dn;
427 float projector_x, projector_y, projector_z;
428 int track_w, track_h;
430 float cursor_x, cursor_y;
431 float output_x, output_y;
433 int pending_motion, pending_config;
435 float last_x, last_y;
436 BC_Title *notes0, *notes1, *notes2;