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