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