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 __SKETCHERWINDOW_H__
22 #define __SKETCHERWINDOW_H__
26 #include "colorpicker.h"
31 class SketcherCurveTypeItem;
32 class SketcherCurveType;
33 class SketcherCurvePenItem;
34 class SketcherCurvePen;
35 class SketcherCurveColor;
36 class SketcherNewCurve;
37 class SketcherDelCurve;
38 class SketcherCurveUp;
39 class SketcherCurveDn;
40 class SketcherCurveWidth;
41 class SketcherCurveList;
44 class SketcherPointId;
46 class SketcherPointTypeItem;
47 class SketcherPointType;
48 class SketcherPointList;
49 class SketcherNewPoint;
50 class SketcherDelPoint;
51 class SketcherPointUp;
52 class SketcherPointDn;
53 class SketcherResetCurves;
54 class SketcherResetPoints;
58 class SketcherCoord : public BC_TumbleTextBox
63 SketcherCoord(SketcherWindow *gui, int x, int y, coord output,
64 coord mn=-32767, coord mx=32767);
66 int update(coord v) { return BC_TumbleTextBox::update((coord)v); }
69 class SketcherNum : public BC_TumbleTextBox
74 SketcherNum(SketcherWindow *gui, int x, int y, int output,
75 int mn=-32767, int mx=32767);
77 int update(int v) { return BC_TumbleTextBox::update((int64_t)v); }
80 class SketcherCurvePenItem : public BC_MenuItem
83 SketcherCurvePenItem(int pen);
88 class SketcherCurvePen : public BC_PopupMenu
91 SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen);
92 void create_objects();
99 class SketcherCurveColor : public ColorBoxButton
102 SketcherCurveColor(SketcherWindow *gui,
103 int x, int y, int w, int h, int color, int alpha);
104 ~SketcherCurveColor();
106 int handle_new_color(int color, int alpha);
107 void handle_done_event(int result);
114 class SketcherNewCurve : public BC_GenericButton
117 SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
126 class SketcherDelCurve : public BC_GenericButton
129 SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
138 class SketcherCurveUp : public BC_GenericButton
141 SketcherCurveUp(SketcherWindow *gui, int x, int y);
149 class SketcherCurveDn : public BC_GenericButton
152 SketcherCurveDn(SketcherWindow *gui, int x, int y);
160 class SketcherCurveWidth : public SketcherNum
163 SketcherCurveWidth(SketcherWindow *gui, int x, int y, int width);
164 ~SketcherCurveWidth();
167 void update(int width);
171 class SketcherCurveList : public BC_ListBox
174 SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
175 ~SketcherCurveList();
178 int selection_changed();
179 int column_resize_event();
180 ArrayList<BC_ListBoxItem*> cols[CV_SZ];
182 void add_curve(const char *id, const char *pen,
183 const char *width, const char *color, const char *alpha);
184 void del_curve(int i);
185 void set_selected(int k);
187 void update_list(int k);
191 const char *col_titles[CV_SZ];
192 int col_widths[CV_SZ];
196 class SketcherPointX : public SketcherCoord
199 SketcherPointX(SketcherWindow *gui, int x, int y, float output)
200 : SketcherCoord(gui, x, y, output) {}
205 class SketcherPointY : public SketcherCoord
208 SketcherPointY(SketcherWindow *gui, int x, int y, float output)
209 : SketcherCoord(gui, x, y, output) {}
215 class SketcherPointId : public SketcherNum
218 SketcherPointId(SketcherWindow *gui, int x, int y, int output)
219 : SketcherNum(gui, x, y, output) {}
220 ~SketcherPointId() {}
226 class SketcherDrag : public BC_CheckBox
229 SketcherDrag(SketcherWindow *gui, int x, int y);
235 class SketcherPointTypeItem : public BC_MenuItem
238 SketcherPointTypeItem(int arc);
243 class SketcherPointType : public BC_PopupMenu
246 SketcherPointType(SketcherWindow *gui, int x, int y, int arc);
247 void create_objects();
248 void update(int arc);
255 class SketcherPointList : public BC_ListBox
258 SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
259 ~SketcherPointList();
262 int selection_changed();
263 int column_resize_event();
264 ArrayList<BC_ListBoxItem*> cols[PT_SZ];
266 void add_point(const char *id, const char *ty, const char *xp, const char *yp);
267 void set_point(int i, int c, int v);
268 void set_point(int i, int c, coord v);
269 void set_point(int i, int c, const char *cp);
270 void set_selected(int k);
272 void update_list(int k);
277 const char *col_titles[PT_SZ];
278 int col_widths[PT_SZ];
281 class SketcherNewPoint : public BC_GenericButton
284 SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
293 class SketcherDelPoint : public BC_GenericButton
296 SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
305 class SketcherPointUp : public BC_GenericButton
308 SketcherPointUp(SketcherWindow *gui, int x, int y);
316 class SketcherPointDn : public BC_GenericButton
319 SketcherPointDn(SketcherWindow *gui, int x, int y);
327 class SketcherResetCurves : public BC_GenericButton
330 SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
331 ~SketcherResetCurves();
339 class SketcherResetPoints : public BC_GenericButton
342 SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
343 ~SketcherResetPoints();
352 class SketcherWindow : public PluginClientWindow
355 SketcherWindow(Sketcher *plugin);
358 void create_objects();
359 void done_event(int result);
361 int grab_event(XEvent *event);
362 int do_grab_event(XEvent *event);
363 int grab_button_press(XEvent *event);
364 int grab_cursor_motion();
365 void send_configure_change();
366 int keypress_event();
370 BC_Title *title_pen, *title_color, *title_width;
371 SketcherCurveType *curve_type;
372 SketcherCurvePen *curve_pen;
373 SketcherCurveColor *curve_color;
374 SketcherNewCurve *new_curve;
375 SketcherDelCurve *del_curve;
376 SketcherCurveUp *curve_up;
377 SketcherCurveDn *curve_dn;
378 SketcherCurveWidth *curve_width;
379 SketcherCurveList *curve_list;
380 SketcherResetCurves *reset_curves;
382 SketcherResetPoints *reset_points;
384 SketcherPointType *point_type;
385 SketcherPointList *point_list;
386 BC_Title *title_x, *title_y, *title_id;
387 SketcherPointX *point_x;
388 SketcherPointY *point_y;
389 SketcherPointId *point_id;
390 SketcherNewPoint *new_point;
391 SketcherDelPoint *del_point;
392 SketcherPointUp *point_up;
393 SketcherPointDn *point_dn;
395 float projector_x, projector_y, projector_z;
396 int track_w, track_h;
398 int cursor_x, cursor_y;
399 float output_x, output_y;
400 float track_x, track_y;
402 int pending_motion, pending_config;
404 float last_x, last_y;
405 BC_Title *notes0, *notes1, *notes2, *notes3;