add stacked edl editing, add sketcher/vframe line anti-aliasing
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / sketcher / sketcherwindow.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2008-2015 Adam Williams <broadcast at earthling dot net>
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #ifndef __SKETCHERWINDOW_H__
21 #define __SKETCHERWINDOW_H__
22
23 #include "sketcher.h"
24 #include "guicast.h"
25 #include "colorpicker.h"
26
27 class Sketcher;
28 class SketcherCoord;
29 class SketcherNum;
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;
43 class SketcherPointX;
44 class SketcherPointY;
45 class SketcherPointId;
46 class SketcherDrag;
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;
56 class SketcherWindow;
57
58
59 class SketcherCoord : public BC_TumbleTextBox
60 {
61 public:
62         SketcherWindow *gui;
63
64         SketcherCoord(SketcherWindow *gui, int x, int y, coord output,
65                 coord mn=-32767, coord mx=32767);
66         ~SketcherCoord();
67         int update(coord v) { return BC_TumbleTextBox::update((coord)v); }
68 };
69
70 class SketcherNum : public BC_TumbleTextBox
71 {
72 public:
73         SketcherWindow *gui;
74
75         SketcherNum(SketcherWindow *gui, int x, int y, int output,
76                 int mn=-32767, int mx=32767);
77         ~SketcherNum();
78         int update(int v) { return BC_TumbleTextBox::update((int64_t)v); }
79 };
80
81 class SketcherCurvePenItem : public BC_MenuItem
82 {
83 public:
84         SketcherCurvePenItem(int pen);
85         int handle_event();
86         int pen;
87 };
88
89 class SketcherCurvePen : public BC_PopupMenu
90 {
91 public:
92         SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen);
93         void create_objects();
94         void update(int pen);
95
96         SketcherWindow *gui;
97         int pen;
98 };
99
100 class SketcherCurveColor : public ColorBoxButton
101 {
102 public:
103         SketcherCurveColor(SketcherWindow *gui,
104                 int x, int y, int w, int h, int color, int alpha);
105         ~SketcherCurveColor();
106
107         int handle_new_color(int color, int alpha);
108         void handle_done_event(int result);
109
110         int color;
111         VFrame *vframes[3];
112         SketcherWindow *gui;
113 };
114
115 class SketcherNewCurve : public BC_GenericButton
116 {
117 public:
118         SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
119         ~SketcherNewCurve();
120
121         int handle_event();
122
123         SketcherWindow *gui;
124         Sketcher *plugin;
125 };
126
127 class SketcherDelCurve : public BC_GenericButton
128 {
129 public:
130         SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
131         ~SketcherDelCurve();
132
133         int handle_event();
134
135         Sketcher *plugin;
136         SketcherWindow *gui;
137 };
138
139 class SketcherCurveUp : public BC_GenericButton
140 {
141 public:
142         SketcherCurveUp(SketcherWindow *gui, int x, int y);
143         ~SketcherCurveUp();
144
145         int handle_event();
146
147         SketcherWindow *gui;
148 };
149
150 class SketcherCurveDn : public BC_GenericButton
151 {
152 public:
153         SketcherCurveDn(SketcherWindow *gui, int x, int y);
154         ~SketcherCurveDn();
155
156         int handle_event();
157
158         SketcherWindow *gui;
159 };
160
161 class SketcherCurveWidth : public SketcherNum
162 {
163 public:
164         SketcherCurveWidth(SketcherWindow *gui, int x, int y, int width);
165         ~SketcherCurveWidth();
166
167         int handle_event();
168         void update(int width);
169         int width;
170 };
171
172 class SketcherAliasItem : public BC_MenuItem
173 {
174 public:
175         SketcherAliasItem(SketcherAliasing *popup, int v);
176         int handle_event();
177
178         SketcherAliasing *popup;
179         int v;
180 };
181
182 class SketcherAliasing : public BC_PopupMenu
183 {
184 public:
185         SketcherAliasing(SketcherWindow *gui, Sketcher *plugin,
186                         int x, int y);
187         ~SketcherAliasing();
188
189         const char *alias_to_text(int alias);
190         void create_objects();
191
192         Sketcher *plugin;
193         SketcherWindow *gui;
194 };
195
196 class SketcherCurveList : public BC_ListBox
197 {
198 public:
199         SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
200         ~SketcherCurveList();
201
202         int handle_event();
203         int selection_changed();
204         int column_resize_event();
205         ArrayList<BC_ListBoxItem*> cols[CV_SZ];
206         void clear();
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);
211         void update(int k);
212         void update_list(int k);
213
214         SketcherWindow *gui;
215         Sketcher *plugin;
216         const char *col_titles[CV_SZ];
217         int col_widths[CV_SZ];
218 };
219
220
221 class SketcherPointX : public SketcherCoord
222 {
223 public:
224         SketcherPointX(SketcherWindow *gui, int x, int y, float output)
225          : SketcherCoord(gui, x, y, output) {}
226         ~SketcherPointX() {}
227
228         int handle_event();
229 };
230 class SketcherPointY : public SketcherCoord
231 {
232 public:
233         SketcherPointY(SketcherWindow *gui, int x, int y, float output)
234          : SketcherCoord(gui, x, y, output) {}
235         ~SketcherPointY() {}
236
237         int handle_event();
238 };
239
240 class SketcherPointId : public SketcherNum
241 {
242 public:
243         SketcherPointId(SketcherWindow *gui, int x, int y, int output)
244          : SketcherNum(gui, x, y, output) {}
245         ~SketcherPointId() {}
246
247         int handle_event();
248 };
249
250
251 class SketcherDrag : public BC_CheckBox
252 {
253 public:
254         SketcherDrag(SketcherWindow *gui, int x, int y);
255
256         int handle_event();
257         SketcherWindow *gui;
258 };
259
260 class SketcherPointTypeItem : public BC_MenuItem
261 {
262 public:
263         SketcherPointTypeItem(int arc);
264         int handle_event();
265         int arc;
266 };
267
268 class SketcherPointType : public BC_PopupMenu
269 {
270 public:
271         SketcherPointType(SketcherWindow *gui, int x, int y, int arc);
272         void create_objects();
273         void update(int arc);
274
275         SketcherWindow *gui;
276         int type;
277 };
278
279
280 class SketcherPointList : public BC_ListBox
281 {
282 public:
283         SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
284         ~SketcherPointList();
285
286         int handle_event();
287         int selection_changed();
288         int column_resize_event();
289         ArrayList<BC_ListBoxItem*> cols[PT_SZ];
290         void clear();
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);
296         void update(int k);
297         void update_list(int k);
298
299
300         SketcherWindow *gui;
301         Sketcher *plugin;
302         const char *col_titles[PT_SZ];
303         int col_widths[PT_SZ];
304 };
305
306 class SketcherNewPoint : public BC_GenericButton
307 {
308 public:
309         SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
310         ~SketcherNewPoint();
311
312         int handle_event();
313
314         SketcherWindow *gui;
315         Sketcher *plugin;
316 };
317
318 class SketcherDelPoint : public BC_GenericButton
319 {
320 public:
321         SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
322         ~SketcherDelPoint();
323
324         int handle_event();
325
326         Sketcher *plugin;
327         SketcherWindow *gui;
328 };
329
330 class SketcherPointUp : public BC_GenericButton
331 {
332 public:
333         SketcherPointUp(SketcherWindow *gui, int x, int y);
334         ~SketcherPointUp();
335
336         int handle_event();
337
338         SketcherWindow *gui;
339 };
340
341 class SketcherPointDn : public BC_GenericButton
342 {
343 public:
344         SketcherPointDn(SketcherWindow *gui, int x, int y);
345         ~SketcherPointDn();
346
347         int handle_event();
348
349         SketcherWindow *gui;
350 };
351
352 class SketcherResetCurves : public BC_GenericButton
353 {
354 public:
355         SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
356         ~SketcherResetCurves();
357
358         int handle_event();
359
360         Sketcher *plugin;
361         SketcherWindow *gui;
362 };
363
364 class SketcherResetPoints : public BC_GenericButton
365 {
366 public:
367         SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
368         ~SketcherResetPoints();
369
370         int handle_event();
371
372         Sketcher *plugin;
373         SketcherWindow *gui;
374 };
375
376
377 class SketcherWindow : public PluginClientWindow
378 {
379 public:
380         SketcherWindow(Sketcher *plugin);
381         ~SketcherWindow();
382
383         void create_objects();
384         void done_event(int result);
385         void update_gui();
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();
392
393         Sketcher *plugin;
394
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;
407
408         SketcherResetPoints *reset_points;
409         SketcherDrag *drag;
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;
420         int64_t position;
421         float projector_x, projector_y, projector_z;
422         int track_w, track_h;
423         int new_points;
424         int cursor_x, cursor_y;
425         float output_x, output_y;
426         float track_x, track_y;
427         int state, dragging;
428         int pending_motion, pending_config;
429         XEvent motion_event;
430         float last_x, last_y;
431         BC_Title *notes0, *notes1, *notes2, *notes3;
432 };
433 #endif
434