mixer align audio, track dump tweak, zwdw refresh edl fix, sketcher tweak
[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
21 #ifndef __SKETCHERWINDOW_H__
22 #define __SKETCHERWINDOW_H__
23
24 #include "sketcher.h"
25 #include "guicast.h"
26 #include "colorpicker.h"
27
28 class Sketcher;
29 class SketcherCoord;
30 class SketcherNum;
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;
42 class SketcherPointX;
43 class SketcherPointY;
44 class SketcherPointId;
45 class SketcherDrag;
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;
55 class SketcherWindow;
56
57
58 class SketcherCoord : public BC_TumbleTextBox
59 {
60 public:
61         SketcherWindow *gui;
62
63         SketcherCoord(SketcherWindow *gui, int x, int y, coord output,
64                 coord mn=-32767, coord mx=32767);
65         ~SketcherCoord();
66         int update(coord v) { return BC_TumbleTextBox::update((coord)v); }
67 };
68
69 class SketcherNum : public BC_TumbleTextBox
70 {
71 public:
72         SketcherWindow *gui;
73
74         SketcherNum(SketcherWindow *gui, int x, int y, int output,
75                 int mn=-32767, int mx=32767);
76         ~SketcherNum();
77         int update(int v) { return BC_TumbleTextBox::update((int64_t)v); }
78 };
79
80 class SketcherCurvePenItem : public BC_MenuItem
81 {
82 public:
83         SketcherCurvePenItem(int pen);
84         int handle_event();
85         int pen;
86 };
87
88 class SketcherCurvePen : public BC_PopupMenu
89 {
90 public:
91         SketcherCurvePen(SketcherWindow *gui, int x, int y, int pen);
92         void create_objects();
93         void update(int pen);
94
95         SketcherWindow *gui;
96         int pen;
97 };
98
99 class SketcherCurveColor : public ColorBoxButton
100 {
101 public:
102         SketcherCurveColor(SketcherWindow *gui,
103                 int x, int y, int w, int h, int color, int alpha);
104         ~SketcherCurveColor();
105
106         int handle_new_color(int color, int alpha);
107         void handle_done_event(int result);
108
109         int color;
110         VFrame *vframes[3];
111         SketcherWindow *gui;
112 };
113
114 class SketcherNewCurve : public BC_GenericButton
115 {
116 public:
117         SketcherNewCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
118         ~SketcherNewCurve();
119
120         int handle_event();
121
122         SketcherWindow *gui;
123         Sketcher *plugin;
124 };
125
126 class SketcherDelCurve : public BC_GenericButton
127 {
128 public:
129         SketcherDelCurve(SketcherWindow *gui, Sketcher *plugin, int x, int y);
130         ~SketcherDelCurve();
131
132         int handle_event();
133
134         Sketcher *plugin;
135         SketcherWindow *gui;
136 };
137
138 class SketcherCurveUp : public BC_GenericButton
139 {
140 public:
141         SketcherCurveUp(SketcherWindow *gui, int x, int y);
142         ~SketcherCurveUp();
143
144         int handle_event();
145
146         SketcherWindow *gui;
147 };
148
149 class SketcherCurveDn : public BC_GenericButton
150 {
151 public:
152         SketcherCurveDn(SketcherWindow *gui, int x, int y);
153         ~SketcherCurveDn();
154
155         int handle_event();
156
157         SketcherWindow *gui;
158 };
159
160 class SketcherCurveWidth : public SketcherNum
161 {
162 public:
163         SketcherCurveWidth(SketcherWindow *gui, int x, int y, int width);
164         ~SketcherCurveWidth();
165
166         int handle_event();
167         void update(int width);
168         int width;
169 };
170
171 class SketcherCurveList : public BC_ListBox
172 {
173 public:
174         SketcherCurveList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
175         ~SketcherCurveList();
176
177         int handle_event();
178         int selection_changed();
179         int column_resize_event();
180         ArrayList<BC_ListBoxItem*> cols[CV_SZ];
181         void clear();
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);
186         void update(int k);
187         void update_list(int k);
188
189         SketcherWindow *gui;
190         Sketcher *plugin;
191         const char *col_titles[CV_SZ];
192         int col_widths[CV_SZ];
193 };
194
195
196 class SketcherPointX : public SketcherCoord
197 {
198 public:
199         SketcherPointX(SketcherWindow *gui, int x, int y, float output)
200          : SketcherCoord(gui, x, y, output) {}
201         ~SketcherPointX() {}
202
203         int handle_event();
204 };
205 class SketcherPointY : public SketcherCoord
206 {
207 public:
208         SketcherPointY(SketcherWindow *gui, int x, int y, float output)
209          : SketcherCoord(gui, x, y, output) {}
210         ~SketcherPointY() {}
211
212         int handle_event();
213 };
214
215 class SketcherPointId : public SketcherNum
216 {
217 public:
218         SketcherPointId(SketcherWindow *gui, int x, int y, int output)
219          : SketcherNum(gui, x, y, output) {}
220         ~SketcherPointId() {}
221
222         int handle_event();
223 };
224
225
226 class SketcherDrag : public BC_CheckBox
227 {
228 public:
229         SketcherDrag(SketcherWindow *gui, int x, int y);
230
231         int handle_event();
232         SketcherWindow *gui;
233 };
234
235 class SketcherPointTypeItem : public BC_MenuItem
236 {
237 public:
238         SketcherPointTypeItem(int arc);
239         int handle_event();
240         int arc;
241 };
242
243 class SketcherPointType : public BC_PopupMenu
244 {
245 public:
246         SketcherPointType(SketcherWindow *gui, int x, int y, int arc);
247         void create_objects();
248         void update(int arc);
249
250         SketcherWindow *gui;
251         int type;
252 };
253
254
255 class SketcherPointList : public BC_ListBox
256 {
257 public:
258         SketcherPointList(SketcherWindow *gui, Sketcher *plugin, int x, int y);
259         ~SketcherPointList();
260
261         int handle_event();
262         int selection_changed();
263         int column_resize_event();
264         ArrayList<BC_ListBoxItem*> cols[PT_SZ];
265         void clear();
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);
271         void update(int k);
272         void update_list(int k);
273
274
275         SketcherWindow *gui;
276         Sketcher *plugin;
277         const char *col_titles[PT_SZ];
278         int col_widths[PT_SZ];
279 };
280
281 class SketcherNewPoint : public BC_GenericButton
282 {
283 public:
284         SketcherNewPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
285         ~SketcherNewPoint();
286
287         int handle_event();
288
289         SketcherWindow *gui;
290         Sketcher *plugin;
291 };
292
293 class SketcherDelPoint : public BC_GenericButton
294 {
295 public:
296         SketcherDelPoint(SketcherWindow *gui, Sketcher *plugin, int x, int y);
297         ~SketcherDelPoint();
298
299         int handle_event();
300
301         Sketcher *plugin;
302         SketcherWindow *gui;
303 };
304
305 class SketcherPointUp : public BC_GenericButton
306 {
307 public:
308         SketcherPointUp(SketcherWindow *gui, int x, int y);
309         ~SketcherPointUp();
310
311         int handle_event();
312
313         SketcherWindow *gui;
314 };
315
316 class SketcherPointDn : public BC_GenericButton
317 {
318 public:
319         SketcherPointDn(SketcherWindow *gui, int x, int y);
320         ~SketcherPointDn();
321
322         int handle_event();
323
324         SketcherWindow *gui;
325 };
326
327 class SketcherResetCurves : public BC_GenericButton
328 {
329 public:
330         SketcherResetCurves(SketcherWindow *gui, Sketcher *plugin, int x, int y);
331         ~SketcherResetCurves();
332
333         int handle_event();
334
335         Sketcher *plugin;
336         SketcherWindow *gui;
337 };
338
339 class SketcherResetPoints : public BC_GenericButton
340 {
341 public:
342         SketcherResetPoints(SketcherWindow *gui, Sketcher *plugin, int x, int y);
343         ~SketcherResetPoints();
344
345         int handle_event();
346
347         Sketcher *plugin;
348         SketcherWindow *gui;
349 };
350
351
352 class SketcherWindow : public PluginClientWindow
353 {
354 public:
355         SketcherWindow(Sketcher *plugin);
356         ~SketcherWindow();
357
358         void create_objects();
359         void done_event(int result);
360         void update_gui();
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();
367
368         Sketcher *plugin;
369
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;
381
382         SketcherResetPoints *reset_points;
383         SketcherDrag *drag;
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;
394         int64_t position;
395         float projector_x, projector_y, projector_z;
396         int track_w, track_h;
397         int new_points;
398         float cursor_x, cursor_y;
399         float output_x, output_y;
400         int state, dragging;
401         int pending_motion, pending_config;
402         XEvent motion_event;
403         float last_x, last_y;
404         BC_Title *notes0, *notes1, *notes2, *notes3;
405 };
406 #endif
407