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
20 #ifndef __SKETCHERWINDOW_H__
21 #define __SKETCHERWINDOW_H__
25 #include "colorpicker.h"
30 class SketcherCurveTypeItem;
31 class SketcherCurveType;
32 class SketcherCurvePenItem;
33 class SketcherCurvePen;
34 class SketcherCurveColor;
35 class SketcherNewCurve;
36 class SketcherDelCurve;
37 class SketcherCurveUp;
38 class SketcherCurveDn;
39 class SketcherCurveWidth;
40 class SketcherAliasItem;
41 class SketcherAliasing;
42 class SketcherCurveList;
45 class SketcherPointId;
47 class SketcherPointTypeItem;
48 class SketcherPointType;
49 class SketcherPointList;
50 class SketcherNewPoint;
51 class SketcherDelPoint;
52 class SketcherPointUp;
53 class SketcherPointDn;
54 class SketcherResetCurves;
55 class SketcherResetPoints;
59 class SketcherCoord : public BC_TumbleTextBox
64 SketcherCoord(SketcherWindow *gui, int x, int y, coord output,
65 coord mn=-32767, coord mx=32767);
67 int update(coord v) { return BC_TumbleTextBox::update((coord)v); }
70 class SketcherNum : public BC_TumbleTextBox
75 SketcherNum(SketcherWindow *gui, int x, int y, int output,
76 int mn=-32767, int mx=32767);
78 int update(int v) { return BC_TumbleTextBox::update((int64_t)v); }
81 class SketcherCurvePenItem : public BC_MenuItem
84 SketcherCurvePenItem(int pen);
89 class SketcherCurvePen : public BC_PopupMenu
92 SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen);
93 void create_objects();
100 class SketcherCurveColor : public ColorBoxButton
103 SketcherCurveColor(SketcherWindow *gui,
104 int x, int y, int w, int h, int color, int alpha);
105 ~SketcherCurveColor();
107 int handle_new_color(int color, int alpha);
108 void handle_done_event(int result);
115 class SketcherNewCurve : public BC_GenericButton
118 SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
127 class SketcherDelCurve : public BC_GenericButton
130 SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
139 class SketcherCurveUp : public BC_GenericButton
142 SketcherCurveUp(SketcherWindow *gui, int x, int y);
150 class SketcherCurveDn : public BC_GenericButton
153 SketcherCurveDn(SketcherWindow *gui, int x, int y);
161 class SketcherCurveWidth : public SketcherNum
164 SketcherCurveWidth(SketcherWindow *gui, int x, int y, int width);
165 ~SketcherCurveWidth();
168 void update(int width);
172 class SketcherAliasItem : public BC_MenuItem
175 SketcherAliasItem(SketcherAliasing *popup, int v);
178 SketcherAliasing *popup;
182 class SketcherAliasing : public BC_PopupMenu
185 SketcherAliasing(SketcherWindow *gui, Sketcher *plugin,
189 const char *alias_to_text(int alias);
190 void create_objects();
196 class SketcherCurveList : public BC_ListBox
199 SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
200 ~SketcherCurveList();
203 int selection_changed();
204 int column_resize_event();
205 ArrayList<BC_ListBoxItem*> cols[CV_SZ];
207 void add_curve(const char *id, const char *pen,
208 const char *width, const char *color, const char *alpha);
209 void del_curve(int i);
210 void set_selected(int k);
212 void update_list(int k);
216 const char *col_titles[CV_SZ];
217 int col_widths[CV_SZ];
221 class SketcherPointX : public SketcherCoord
224 SketcherPointX(SketcherWindow *gui, int x, int y, float output)
225 : SketcherCoord(gui, x, y, output) {}
230 class SketcherPointY : public SketcherCoord
233 SketcherPointY(SketcherWindow *gui, int x, int y, float output)
234 : SketcherCoord(gui, x, y, output) {}
240 class SketcherPointId : public SketcherNum
243 SketcherPointId(SketcherWindow *gui, int x, int y, int output)
244 : SketcherNum(gui, x, y, output) {}
245 ~SketcherPointId() {}
251 class SketcherDrag : public BC_CheckBox
254 SketcherDrag(SketcherWindow *gui, int x, int y);
260 class SketcherPointTypeItem : public BC_MenuItem
263 SketcherPointTypeItem(int arc);
268 class SketcherPointType : public BC_PopupMenu
271 SketcherPointType(SketcherWindow *gui, int x, int y, int arc);
272 void create_objects();
273 void update(int arc);
280 class SketcherPointList : public BC_ListBox
283 SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
284 ~SketcherPointList();
287 int selection_changed();
288 int column_resize_event();
289 ArrayList<BC_ListBoxItem*> cols[PT_SZ];
291 void add_point(const char *id, const char *ty, const char *xp, const char *yp);
292 void set_point(int i, int c, int v);
293 void set_point(int i, int c, coord v);
294 void set_point(int i, int c, const char *cp);
295 void set_selected(int k);
297 void update_list(int k);
302 const char *col_titles[PT_SZ];
303 int col_widths[PT_SZ];
306 class SketcherNewPoint : public BC_GenericButton
309 SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
318 class SketcherDelPoint : public BC_GenericButton
321 SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
330 class SketcherPointUp : public BC_GenericButton
333 SketcherPointUp(SketcherWindow *gui, int x, int y);
341 class SketcherPointDn : public BC_GenericButton
344 SketcherPointDn(SketcherWindow *gui, int x, int y);
352 class SketcherResetCurves : public BC_GenericButton
355 SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
356 ~SketcherResetCurves();
364 class SketcherResetPoints : public BC_GenericButton
367 SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
368 ~SketcherResetPoints();
377 class SketcherWindow : public PluginClientWindow
380 SketcherWindow(Sketcher *plugin);
383 void create_objects();
384 void done_event(int result);
386 int grab_event(XEvent *event);
387 int do_grab_event(XEvent *event);
388 int grab_button_press(XEvent *event);
389 int grab_cursor_motion();
390 void send_configure_change();
391 int keypress_event();
395 BC_Title *title_pen, *title_color, *title_width;
396 SketcherCurveType *curve_type;
397 SketcherCurvePen *curve_pen;
398 SketcherCurveColor *curve_color;
399 SketcherNewCurve *new_curve;
400 SketcherDelCurve *del_curve;
401 SketcherCurveUp *curve_up;
402 SketcherCurveDn *curve_dn;
403 SketcherCurveWidth *curve_width;
404 SketcherAliasing *aliasing;
405 SketcherCurveList *curve_list;
406 SketcherResetCurves *reset_curves;
408 SketcherResetPoints *reset_points;
410 SketcherPointType *point_type;
411 SketcherPointList *point_list;
412 BC_Title *title_x, *title_y, *title_id;
413 SketcherPointX *point_x;
414 SketcherPointY *point_y;
415 SketcherPointId *point_id;
416 SketcherNewPoint *new_point;
417 SketcherDelPoint *del_point;
418 SketcherPointUp *point_up;
419 SketcherPointDn *point_dn;
421 float projector_x, projector_y, projector_z;
422 int track_w, track_h;
424 int cursor_x, cursor_y;
425 float output_x, output_y;
426 float track_x, track_y;
428 int pending_motion, pending_config;
430 float last_x, last_y;
431 BC_Title *notes0, *notes1, *notes2, *notes3;