render effect segv, drag chkbox track coords, check mask active,
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / titler / titlerwindow.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef TITLEWINDOW_H
23 #define TITLEWINDOW_H
24
25 #include "guicast.h"
26
27 class TitleWindow;
28
29 #include "colorpicker.h"
30 #include "dragcheckbox.h"
31 #include "filexml.h"
32 #include "mutex.h"
33 #include "titler.h"
34
35 #include <stdarg.h>
36
37 class TitleFontTumble;
38 class TitleSizeTumble;
39 class TitleItalic;
40 class TitleAlias;
41 class TitleBold;
42 class TitleDrag;
43 class TitleSize;
44 class TitlePitch;
45 class TitleEncoding;
46 class TitleColorButton;
47 class TitleOutlineColorButton;
48 class TitleDropShadow;
49 class TitleMotion;
50 class TitleLoop;
51 class TitleLinePitch;
52 class TitleFade;
53 class TitleFont;
54 class TitleText;
55 class TitleTextChars;
56 class TitleX;
57 class TitleY;
58 class TitleW;
59 class TitleH;
60 class TitleLeft;
61 class TitleCenter;
62 class TitleRight;class TitleTop;
63 class TitleMid;
64 class TitleBottom;
65 class TitleSpeed;
66 class TitleTimecode;
67 class TitleTimecodeFormat;
68 class TitleOutline;
69 class TitleStroker;
70 class TitleBackground;
71 class TitleBackgroundPath;
72 class TitleLoopPlayback;
73 class TitleCurPopup;
74 class TitleCurItem;
75 class TitleCurSubMenu;
76 class TitleCurSubMenuItem;
77 class TitleFontsPopup;
78 class TitleColorPopup;
79 class TitlePngPopup;
80
81 class TitleWindow : public PluginClientWindow
82 {
83 public:
84         TitleWindow(TitleMain *client);
85         ~TitleWindow();
86
87         void create_objects();
88         int resize_event(int w, int h);
89         void update_drag();
90         void update_color();
91         void update_justification();
92         void update_stats();
93         void update_gui();
94         void previous_font();
95         void next_font();
96         void check_style(const char *font_name, int update);
97         int insert_ibeam(const char *txt, int ofs=0);
98         void done_event(int result);
99         void send_configure_change();
100         int check_configure_change(int ret);
101
102         TitleMain *client;
103
104         BC_Title *font_title;
105         TitleFont *font;
106         TitleFontTumble *font_tumbler;
107         BC_Title *x_title;
108         TitleX *title_x;
109         BC_Title *y_title;
110         TitleY *title_y;
111         BC_Title *w_title;
112         TitleW *title_w;
113         BC_Title *h_title;
114         TitleH *title_h;
115         BC_Title *dropshadow_title;
116         TitleDropShadow *dropshadow;
117         BC_Title *outline_title;
118         TitleOutline *outline;
119         BC_Title *stroker_title;
120         TitleStroker *stroker;
121         BC_Title *style_title;
122         TitleItalic *italic;
123         TitleAlias *alias;
124         TitleBold *bold;
125         TitleDrag *drag;
126         TitleCurPopup *cur_popup;
127         TitleFontsPopup *fonts_popup;
128         TitleColorPopup *color_popup;
129         TitlePngPopup *png_popup;
130
131         int color_x, color_y;
132         int outline_color_x, outline_color_y;
133         int drag_dx, drag_dy, dragging;
134         int cur_ibeam, pending_config;
135
136         BC_Title *size_title;
137         TitleSize *size;
138         TitleSizeTumble *size_tumbler;
139         BC_Title *pitch_title;
140         TitlePitch *pitch;
141         BC_Title *encoding_title;
142         TitleEncoding *encoding;
143         BC_Title *color_button_title;
144         TitleColorButton *color_button;
145         BC_Title *outline_button_title;
146         TitleOutlineColorButton *outline_button;
147         BC_Title *motion_title;
148         TitleMotion *motion;
149         TitleLinePitch *line_pitch;
150         TitleLoop *loop;
151         BC_Title *fadein_title;
152         TitleFade *fade_in;
153         BC_Title *fadeout_title;
154         TitleFade *fade_out;
155         BC_Title *text_title;
156         TitleText *text;
157         TitleTextChars *text_chars;
158         BC_Title *justify_title;
159         TitleLeft *left;
160         TitleCenter *center;
161         TitleRight *right;
162         TitleTop *top;
163         TitleMid *mid;
164         TitleBottom *bottom;
165         BC_Title *speed_title;
166         TitleSpeed *speed;
167         TitleTimecode *timecode;
168         TitleTimecodeFormat *timecode_format;
169         TitleBackground *background;
170         TitleBackgroundPath *background_path;
171         BrowseButton *background_browse;
172         TitleLoopPlayback *loop_playback;
173
174 // Color preview
175         ArrayList<BC_ListBoxItem*> sizes;
176         ArrayList<BC_ListBoxItem*> encodings;
177         ArrayList<BC_ListBoxItem*> paths;
178         ArrayList<BC_ListBoxItem*> fonts;
179 };
180
181
182 class TitleFontTumble : public BC_Tumbler
183 {
184 public:
185         TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y);
186
187         int handle_up_event();
188         int handle_down_event();
189
190         TitleMain *client;
191         TitleWindow *window;
192 };
193
194
195 class TitleSizeTumble : public BC_Tumbler
196 {
197 public:
198         TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y);
199
200         int handle_up_event();
201         int handle_down_event();
202
203         TitleMain *client;
204         TitleWindow *window;
205 };
206
207
208 class TitleAlias : public BC_CheckBox
209 {
210 public:
211         TitleAlias(TitleMain *client, TitleWindow *window, int x, int y);
212         int handle_event();
213         TitleMain *client;
214         TitleWindow *window;
215 };
216 class TitleItalic : public BC_CheckBox
217 {
218 public:
219         TitleItalic(TitleMain *client, TitleWindow *window, int x, int y);
220         int handle_event();
221         TitleMain *client;
222         TitleWindow *window;
223 };
224 class TitleBold : public BC_CheckBox
225 {
226 public:
227         TitleBold(TitleMain *client, TitleWindow *window, int x, int y);
228         int handle_event();
229         TitleMain *client;
230         TitleWindow *window;
231 };
232 class TitleDrag : public DragCheckBox
233 {
234 public:
235         TitleDrag(TitleMain *client, TitleWindow *window, int x, int y);
236         int handle_event();
237         void update_gui();
238         Track *get_drag_track();
239         int64_t get_drag_position();
240
241         TitleMain *client;
242         TitleWindow *window;
243 };
244
245
246 class TitleSize : public BC_PopupTextBox
247 {
248 public:
249         TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text);
250         ~TitleSize();
251         int handle_event();
252         void update(int size);
253         TitleMain *client;
254         TitleWindow *window;
255 };
256
257 class TitlePitch : public BC_TumbleTextBox
258 {
259 public:
260         TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value);
261         ~TitlePitch();
262         int handle_event();
263
264         int *value;
265         TitleMain *client;
266         TitleWindow *window;
267 };
268
269 class TitleEncoding : public BC_PopupTextBox
270 {
271 public:
272         TitleEncoding(TitleMain *client, TitleWindow *window, int x, int y, char *text);
273         ~TitleEncoding();
274         int handle_event();
275         TitleMain *client;
276         TitleWindow *window;
277 };
278
279 class TitleColorButton : public ColorCircleButton
280 {
281 public:
282         TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y);
283         int handle_new_color(int output, int alpha);
284         void handle_done_event(int result);
285         TitleMain *client;
286         TitleWindow *window;
287 };
288 class TitleOutlineColorButton : public ColorCircleButton
289 {
290 public:
291         TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y);
292         int handle_new_color(int output, int alpha);
293         void handle_done_event(int result);
294         TitleMain *client;
295         TitleWindow *window;
296 };
297
298 class TitleMotion : public BC_PopupTextBox
299 {
300 public:
301         TitleMotion(TitleMain *client, TitleWindow *window, int x, int y);
302         int handle_event();
303         TitleMain *client;
304         TitleWindow *window;
305 };
306 class TitleLoop : public BC_CheckBox
307 {
308 public:
309         TitleLoop(TitleMain *client, TitleWindow *window, int x, int y);
310         int handle_event();
311         TitleMain *client;
312         TitleWindow *window;
313 };
314 class TitleLinePitch : public BC_CheckBox
315 {
316 public:
317         TitleLinePitch(TitleMain *client, TitleWindow *window, int x, int y);
318         int handle_event();
319         TitleMain *client;
320         TitleWindow *window;
321 };
322
323 class TitleTimecode : public BC_CheckBox
324 {
325 public:
326         TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y);
327         int handle_event();
328         TitleMain *client;
329         TitleWindow *window;
330 };
331
332 class TitleTimecodeFormat : public BC_PopupMenu
333 {
334 public:
335         TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
336                 int x, int y, int tw, const char *text);
337         void create_objects();
338         int update(int timecode_format);
339         int handle_event();
340         TitleMain *client;
341         TitleWindow *window;
342 };
343
344 class TitleFade : public BC_TextBox
345 {
346 public:
347         TitleFade(TitleMain *client, TitleWindow *window, double *value, int x, int y);
348         int handle_event();
349         TitleMain *client;
350         TitleWindow *window;
351         double *value;
352 };
353 class TitleFont : public BC_PopupTextBox
354 {
355 public:
356         TitleFont(TitleMain *client, TitleWindow *window, int x, int y);
357         int handle_event();
358         TitleMain *client;
359         TitleWindow *window;
360 };
361 class TitleText : public BC_ScrollTextBox
362 {
363 public:
364         TitleText(TitleMain *client,
365                 TitleWindow *window,
366                 int x,
367                 int y,
368                 int w,
369                 int h);
370         int handle_event();
371         int button_press_event();
372         TitleMain *client;
373         TitleWindow *window;
374 };
375 class TitleTextChars : public BC_Title
376 {
377 public:
378         int update(int n);
379         TitleTextChars(int x, int y, int w);
380         ~TitleTextChars();
381 };
382
383 class TitleX : public BC_TumbleTextBox
384 {
385 public:
386         TitleX(TitleMain *client, TitleWindow *window, int x, int y);
387         int handle_event();
388         TitleMain *client;
389         TitleWindow *window;
390 };
391 class TitleY : public BC_TumbleTextBox
392 {
393 public:
394         TitleY(TitleMain *client, TitleWindow *window, int x, int y);
395         int handle_event();
396         TitleMain *client;
397         TitleWindow *window;
398 };
399 class TitleW : public BC_TumbleTextBox
400 {
401 public:
402         TitleW(TitleMain *client, TitleWindow *window, int x, int y);
403         int handle_event();
404         TitleMain *client;
405         TitleWindow *window;
406 };
407 class TitleH : public BC_TumbleTextBox
408 {
409 public:
410         TitleH(TitleMain *client, TitleWindow *window, int x, int y);
411         int handle_event();
412         TitleMain *client;
413         TitleWindow *window;
414 };
415
416 class TitleDropShadow : public BC_TumbleTextBox
417 {
418 public:
419         TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y);
420         int handle_event();
421         TitleMain *client;
422         TitleWindow *window;
423 };
424
425 class TitleOutline : public BC_TumbleTextBox
426 {
427 public:
428         TitleOutline(TitleMain *client, TitleWindow *window, int x, int y);
429         int handle_event();
430         TitleMain *client;
431         TitleWindow *window;
432 };
433
434 class TitleStroker : public BC_TumbleTextBox
435 {
436 public:
437         TitleStroker(TitleMain *client, TitleWindow *window, int x, int y);
438         int handle_event();
439         TitleMain *client;
440         TitleWindow *window;
441 };
442
443 class TitleSpeed : public BC_TumbleTextBox
444 {
445 public:
446         TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y);
447         int handle_event();
448         TitleMain *client;
449         TitleWindow *window;
450 };
451
452 class TitleLeft : public BC_Radial
453 {
454 public:
455         TitleLeft(TitleMain *client, TitleWindow *window, int x, int y);
456         int handle_event();
457         TitleMain *client;
458         TitleWindow *window;
459 };
460 class TitleCenter : public BC_Radial
461 {
462 public:
463         TitleCenter(TitleMain *client, TitleWindow *window, int x, int y);
464         int handle_event();
465         TitleMain *client;
466         TitleWindow *window;
467 };
468 class TitleRight : public BC_Radial
469 {
470 public:
471         TitleRight(TitleMain *client, TitleWindow *window, int x, int y);
472         int handle_event();
473         TitleMain *client;
474         TitleWindow *window;
475 };
476
477 class TitleTop : public BC_Radial
478 {
479 public:
480         TitleTop(TitleMain *client, TitleWindow *window, int x, int y);
481         int handle_event();
482         TitleMain *client;
483         TitleWindow *window;
484 };
485 class TitleMid : public BC_Radial
486 {
487 public:
488         TitleMid(TitleMain *client, TitleWindow *window, int x, int y);
489         int handle_event();
490         TitleMain *client;
491         TitleWindow *window;
492 };
493 class TitleBottom : public BC_Radial
494 {
495 public:
496         TitleBottom(TitleMain *client, TitleWindow *window, int x, int y);
497         int handle_event();
498         TitleMain *client;
499         TitleWindow *window;
500 };
501 class TitleBackground : public BC_CheckBox
502 {
503 public:
504         TitleBackground(TitleMain *client, TitleWindow *window, int x, int y);
505         int handle_event();
506         TitleMain *client;
507         TitleWindow *window;
508 };
509 class TitleBackgroundPath : public BC_TextBox
510 {
511 public:
512         TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y);
513         int handle_event();
514         TitleMain *client;
515         TitleWindow *window;
516 };
517 class TitleLoopPlayback : public BC_CheckBox
518 {
519 public:
520         TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y);
521         int handle_event();
522         TitleMain *client;
523         TitleWindow *window;
524 };
525
526
527 class TitleCurPopup : public BC_PopupMenu
528 {
529 public:
530         TitleCurPopup(TitleMain *client, TitleWindow *window);
531
532         int handle_event();
533         void create_objects();
534
535         TitleMain *client;
536         TitleWindow *window;
537 };
538
539 class TitleCurItem : public BC_MenuItem
540 {
541 public:
542         TitleCurItem(TitleCurPopup *popup, const char *text);
543
544         int handle_event();
545         TitleCurPopup *popup;
546 };
547
548 enum { POPUP_OFFSET=-1, POPUP_NONE=0, POPUP_FONT, POPUP_COLOR, POPUP_PNG, };
549
550 class TitleCurSubMenu : public BC_SubMenu
551 {
552 public:
553         TitleCurSubMenu(TitleCurItem *cur_item);
554         ~TitleCurSubMenu();
555         void add_subitemx(int popup_type, va_list ap, const char *fmt);
556         void add_subitem(int popup_type, const char *fmt,...) { va_list ap;
557                 va_start(ap, fmt); add_subitemx(popup_type, ap, fmt); va_end(ap);
558         }
559         void add_subitem(const char *fmt,...) { va_list ap;
560                 va_start(ap, fmt); add_subitemx(POPUP_NONE, ap, fmt); va_end(ap);
561         }
562         TitleCurItem *cur_item;
563 };
564
565 class TitleCurSubMenuItem : public BC_MenuItem
566 {
567 public:
568         TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type);
569         ~TitleCurSubMenuItem();
570         int handle_event();
571
572         TitleCurSubMenu *submenu;
573         int popup_type;
574 };
575
576 class TitleFontsPopup : public BC_ListBox
577 {
578 public:
579         TitleFontsPopup(TitleMain *client, TitleWindow *window);
580         ~TitleFontsPopup();
581         int keypress_event();
582         int handle_event();
583         int show_tooltip(const char *text, int x,int y, int w,int h) {
584                 return gui_tooltip(text);
585         }
586
587         TitleMain *client;
588         TitleWindow *window;
589 };
590
591 class TitleColorPopup : public ColorPicker
592 {
593 public:
594         TitleColorPopup(TitleMain *client, TitleWindow *window);
595         ~TitleColorPopup();
596         int handle_new_color(int output, int alpha);
597         void handle_done_event(int result);
598         int activate();
599
600         TitleMain *client;
601         TitleWindow *window;
602         int color_value;
603 };
604
605 class TitlePngPopup : public BC_DialogThread
606 {
607 public:
608         TitlePngPopup(TitleMain *client, TitleWindow *window);
609         ~TitlePngPopup();
610
611         void handle_done_event(int result);
612         BC_Window* new_gui();
613         int activate();
614
615         TitleMain *client;
616         TitleWindow *window;
617 };
618
619 #endif