no longer need ffmpeg patch0 which was for Termux
[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 SketcherHelp;
57 class SketcherWindow;
58
59
60 class SketcherCoord : public BC_TumbleTextBox
61 {
62 public:
63         SketcherWindow *gui;
64
65         SketcherCoord(SketcherWindow *gui, int x, int y, coord output,
66                 coord mn=-32767, coord mx=32767);
67         ~SketcherCoord();
68         int update(coord v) { return BC_TumbleTextBox::update((coord)v); }
69 };
70
71 class SketcherNum : public BC_TumbleTextBox
72 {
73 public:
74         SketcherWindow *gui;
75
76         SketcherNum(SketcherWindow *gui, int x, int y, int output,
77                 int mn=-32767, int mx=32767);
78         ~SketcherNum();
79         int update(int v) { return BC_TumbleTextBox::update((int64_t)v); }
80 };
81
82 class SketcherCurvePenItem : public BC_MenuItem
83 {
84 public:
85         SketcherCurvePenItem(int pen);
86         int handle_event();
87         int pen;
88 };
89
90 class SketcherCurvePen : public BC_PopupMenu
91 {
92 public:
93         SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen);
94         void create_objects();
95         void update(int pen);
96
97         SketcherWindow *gui;
98         int pen;
99 };
100
101 class SketcherCurveColor : public ColorBoxButton
102 {
103 public:
104         SketcherCurveColor(SketcherWindow *gui,
105                 int x, int y, int w, int h, int color, int alpha);
106         ~SketcherCurveColor();
107
108         int handle_new_color(int color, int alpha);
109         void handle_done_event(int result);
110
111         int color;
112         VFrame *vframes[3];
113         SketcherWindow *gui;
114 };
115
116 class SketcherNewCurve : public BC_GenericButton
117 {
118 public:
119         SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
120         ~SketcherNewCurve();
121
122         int handle_event();
123
124         SketcherWindow *gui;
125         Sketcher *plugin;
126 };
127
128 class SketcherDelCurve : public BC_GenericButton
129 {
130 public:
131         SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
132         ~SketcherDelCurve();
133
134         int handle_event();
135
136         Sketcher *plugin;
137         SketcherWindow *gui;
138 };
139
140 class SketcherCurveUp : public BC_GenericButton
141 {
142 public:
143         SketcherCurveUp(SketcherWindow *gui, int x, int y);
144         ~SketcherCurveUp();
145
146         int handle_event();
147
148         SketcherWindow *gui;
149 };
150
151 class SketcherCurveDn : public BC_GenericButton
152 {
153 public:
154         SketcherCurveDn(SketcherWindow *gui, int x, int y);
155         ~SketcherCurveDn();
156
157         int handle_event();
158
159         SketcherWindow *gui;
160 };
161
162 class SketcherCurveWidth : public SketcherNum
163 {
164 public:
165         SketcherCurveWidth(SketcherWindow *gui, int x, int y, int width);
166         ~SketcherCurveWidth();
167
168         int handle_event();
169         void update(int width);
170         int width;
171 };
172
173 class SketcherAliasItem : public BC_MenuItem
174 {
175 public:
176         SketcherAliasItem(SketcherAliasing *popup, int v);
177         int handle_event();
178
179         SketcherAliasing *popup;
180         int v;
181 };
182
183 class SketcherAliasing : public BC_PopupMenu
184 {
185 public:
186         SketcherAliasing(SketcherWindow *gui, Sketcher *plugin,
187                         int x, int y);
188         ~SketcherAliasing();
189
190         const char *alias_to_text(int alias);
191         void create_objects();
192
193         Sketcher *plugin;
194         SketcherWindow *gui;
195 };
196
197 class SketcherCurveList : public BC_ListBox
198 {
199 public:
200         SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
201         ~SketcherCurveList();
202
203         int handle_event();
204         int selection_changed();
205         int column_resize_event();
206         ArrayList<BC_ListBoxItem*> cols[CV_SZ];
207         void clear();
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);
212         void update(int k);
213         void update_list(int k);
214
215         SketcherWindow *gui;
216         Sketcher *plugin;
217         const char *col_titles[CV_SZ];
218         int col_widths[CV_SZ];
219 };
220
221
222 class SketcherPointX : public SketcherCoord
223 {
224 public:
225         SketcherPointX(SketcherWindow *gui, int x, int y, float output)
226          : SketcherCoord(gui, x, y, output) {}
227         ~SketcherPointX() {}
228
229         int handle_event();
230 };
231 class SketcherPointY : public SketcherCoord
232 {
233 public:
234         SketcherPointY(SketcherWindow *gui, int x, int y, float output)
235          : SketcherCoord(gui, x, y, output) {}
236         ~SketcherPointY() {}
237
238         int handle_event();
239 };
240
241 class SketcherPointId : public SketcherNum
242 {
243 public:
244         SketcherPointId(SketcherWindow *gui, int x, int y, int output)
245          : SketcherNum(gui, x, y, output) {}
246         ~SketcherPointId() {}
247
248         int handle_event();
249 };
250
251
252 class SketcherDrag : public BC_CheckBox
253 {
254 public:
255         SketcherDrag(SketcherWindow *gui, int x, int y);
256
257         int handle_event();
258         SketcherWindow *gui;
259 };
260
261 class SketcherPointTypeItem : public BC_MenuItem
262 {
263 public:
264         SketcherPointTypeItem(int arc);
265         int handle_event();
266         int arc;
267 };
268
269 class SketcherPointType : public BC_PopupMenu
270 {
271 public:
272         SketcherPointType(SketcherWindow *gui, int x, int y, int arc);
273         void create_objects();
274         void update(int arc);
275
276         SketcherWindow *gui;
277         int type;
278 };
279
280
281 class SketcherPointList : public BC_ListBox
282 {
283 public:
284         SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
285         ~SketcherPointList();
286
287         int handle_event();
288         int selection_changed();
289         int column_resize_event();
290         ArrayList<BC_ListBoxItem*> cols[PT_SZ];
291         void clear();
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);
297         void update(int k);
298         void update_list(int k);
299
300
301         SketcherWindow *gui;
302         Sketcher *plugin;
303         const char *col_titles[PT_SZ];
304         int col_widths[PT_SZ];
305 };
306
307 class SketcherNewPoint : public BC_GenericButton
308 {
309 public:
310         SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
311         ~SketcherNewPoint();
312
313         int handle_event();
314
315         SketcherWindow *gui;
316         Sketcher *plugin;
317 };
318
319 class SketcherDelPoint : public BC_GenericButton
320 {
321 public:
322         SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
323         ~SketcherDelPoint();
324
325         int handle_event();
326
327         Sketcher *plugin;
328         SketcherWindow *gui;
329 };
330
331 class SketcherPointUp : public BC_GenericButton
332 {
333 public:
334         SketcherPointUp(SketcherWindow *gui, int x, int y);
335         ~SketcherPointUp();
336
337         int handle_event();
338
339         SketcherWindow *gui;
340 };
341
342 class SketcherPointDn : public BC_GenericButton
343 {
344 public:
345         SketcherPointDn(SketcherWindow *gui, int x, int y);
346         ~SketcherPointDn();
347
348         int handle_event();
349
350         SketcherWindow *gui;
351 };
352
353 class SketcherResetCurves : public BC_GenericButton
354 {
355 public:
356         SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
357         ~SketcherResetCurves();
358
359         int handle_event();
360
361         Sketcher *plugin;
362         SketcherWindow *gui;
363 };
364
365 class SketcherResetPoints : public BC_GenericButton
366 {
367 public:
368         SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
369         ~SketcherResetPoints();
370
371         int handle_event();
372
373         Sketcher *plugin;
374         SketcherWindow *gui;
375 };
376
377 class SketcherHelp : public BC_CheckBox
378 {
379 public:
380         SketcherHelp(SketcherWindow *gui, Sketcher *plugin, int x, int y);
381         ~SketcherHelp();
382         int handle_event();
383
384         Sketcher *plugin;
385         SketcherWindow *gui;
386 };
387
388 class SketcherWindow : public PluginClientWindow
389 {
390 public:
391         SketcherWindow(Sketcher *plugin);
392         ~SketcherWindow();
393
394         void create_objects();
395         void done_event(int result);
396         void update_gui();
397         int grab_event(XEvent *event);
398         int do_grab_event(XEvent *event);
399         int handle_ungrab();
400         int grab_button_press(XEvent *event);
401         int grab_cursor_motion();
402         void send_configure_change();
403         int keypress_event();
404
405         Sketcher *plugin;
406
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;
419         SketcherHelp *help;
420
421         SketcherResetPoints *reset_points;
422         SketcherDrag *drag;
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;
433         int64_t position;
434         float projector_x, projector_y, projector_z;
435         int track_w, track_h;
436         int new_points;
437         int cursor_x, cursor_y;
438         float output_x, output_y;
439         float track_x, track_y;
440         int state, dragging;
441         int pending_motion, pending_config;
442         int helped, help_y, help_h;
443         XEvent motion_event;
444         float last_x, last_y;
445         int64_t last_time;
446         BC_Title *notes0, *notes1, *notes2, *notes3;
447 };
448 #endif
449