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;
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 ColorBoxButton
104 SketcherCurveColor(SketcherWindow *gui,
105 int x, int y, int w, int h, int color, int alpha);
106 ~SketcherCurveColor();
108 int handle_new_color(int color, int alpha);
109 void handle_done_event(int result);
116 class SketcherNewCurve : public BC_GenericButton
119 SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
128 class SketcherDelCurve : public BC_GenericButton
131 SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
140 class SketcherCurveUp : public BC_GenericButton
143 SketcherCurveUp(SketcherWindow *gui, int x, int y);
151 class SketcherCurveDn : public BC_GenericButton
154 SketcherCurveDn(SketcherWindow *gui, int x, int y);
162 class SketcherCurveWidth : public SketcherNum
165 SketcherCurveWidth(SketcherWindow *gui, int x, int y, int width);
166 ~SketcherCurveWidth();
169 void update(int width);
173 class SketcherAliasItem : public BC_MenuItem
176 SketcherAliasItem(SketcherAliasing *popup, int v);
179 SketcherAliasing *popup;
183 class SketcherAliasing : public BC_PopupMenu
186 SketcherAliasing(SketcherWindow *gui, Sketcher *plugin,
190 const char *alias_to_text(int alias);
191 void create_objects();
197 class SketcherCurveList : public BC_ListBox
200 SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
201 ~SketcherCurveList();
204 int selection_changed();
205 int column_resize_event();
206 ArrayList<BC_ListBoxItem*> cols[CV_SZ];
208 void add_curve(const char *id, const char *pen,
209 const char *width, const char *color, const char *alpha);
210 void del_curve(int i);
211 void set_selected(int k);
213 void update_list(int k);
217 const char *col_titles[CV_SZ];
218 int col_widths[CV_SZ];
222 class SketcherPointX : public SketcherCoord
225 SketcherPointX(SketcherWindow *gui, int x, int y, float output)
226 : SketcherCoord(gui, x, y, output) {}
231 class SketcherPointY : public SketcherCoord
234 SketcherPointY(SketcherWindow *gui, int x, int y, float output)
235 : SketcherCoord(gui, x, y, output) {}
241 class SketcherPointId : public SketcherNum
244 SketcherPointId(SketcherWindow *gui, int x, int y, int output)
245 : SketcherNum(gui, x, y, output) {}
246 ~SketcherPointId() {}
252 class SketcherDrag : public BC_CheckBox
255 SketcherDrag(SketcherWindow *gui, int x, int y);
261 class SketcherPointTypeItem : public BC_MenuItem
264 SketcherPointTypeItem(int arc);
269 class SketcherPointType : public BC_PopupMenu
272 SketcherPointType(SketcherWindow *gui, int x, int y, int arc);
273 void create_objects();
274 void update(int arc);
281 class SketcherPointList : public BC_ListBox
284 SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
285 ~SketcherPointList();
288 int selection_changed();
289 int column_resize_event();
290 ArrayList<BC_ListBoxItem*> cols[PT_SZ];
292 void add_point(const char *id, const char *ty, const char *xp, const char *yp);
293 void set_point(int i, int c, int v);
294 void set_point(int i, int c, coord v);
295 void set_point(int i, int c, const char *cp);
296 void set_selected(int k);
298 void update_list(int k);
303 const char *col_titles[PT_SZ];
304 int col_widths[PT_SZ];
307 class SketcherNewPoint : public BC_GenericButton
310 SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
319 class SketcherDelPoint : public BC_GenericButton
322 SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
331 class SketcherPointUp : public BC_GenericButton
334 SketcherPointUp(SketcherWindow *gui, int x, int y);
342 class SketcherPointDn : public BC_GenericButton
345 SketcherPointDn(SketcherWindow *gui, int x, int y);
353 class SketcherResetCurves : public BC_GenericButton
356 SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
357 ~SketcherResetCurves();
365 class SketcherResetPoints : public BC_GenericButton
368 SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
369 ~SketcherResetPoints();
377 class SketcherHelp : public BC_CheckBox
380 SketcherHelp(SketcherWindow *gui, Sketcher *plugin, int x, int y);
388 class SketcherWindow : public PluginClientWindow
391 SketcherWindow(Sketcher *plugin);
394 void create_objects();
395 void done_event(int result);
397 int grab_event(XEvent *event);
398 int do_grab_event(XEvent *event);
400 int grab_button_press(XEvent *event);
401 int grab_cursor_motion();
402 void send_configure_change();
403 int keypress_event();
407 BC_Title *title_pen, *title_color, *title_width;
408 SketcherCurveType *curve_type;
409 SketcherCurvePen *curve_pen;
410 SketcherCurveColor *curve_color;
411 SketcherNewCurve *new_curve;
412 SketcherDelCurve *del_curve;
413 SketcherCurveUp *curve_up;
414 SketcherCurveDn *curve_dn;
415 SketcherCurveWidth *curve_width;
416 SketcherAliasing *aliasing;
417 SketcherCurveList *curve_list;
418 SketcherResetCurves *reset_curves;
421 SketcherResetPoints *reset_points;
423 SketcherPointType *point_type;
424 SketcherPointList *point_list;
425 BC_Title *title_x, *title_y, *title_id;
426 SketcherPointX *point_x;
427 SketcherPointY *point_y;
428 SketcherPointId *point_id;
429 SketcherNewPoint *new_point;
430 SketcherDelPoint *del_point;
431 SketcherPointUp *point_up;
432 SketcherPointDn *point_dn;
434 float projector_x, projector_y, projector_z;
435 int track_w, track_h;
437 int cursor_x, cursor_y;
438 float output_x, output_y;
439 float track_x, track_y;
441 int pending_motion, pending_config;
442 int helped, help_y, help_h;
444 float last_x, last_y;
446 BC_Title *notes0, *notes1, *notes2, *notes3;