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