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