bunch-o compiler bitch'n
[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 TitleTextChars;
56 class TitleTextBfrSz;
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 TitleColorThread;
67 class TitleSpeed;
68 class TitleTimecode;
69 class TitleTimecodeFormat;
70 class TitleOutline;
71 class TitleStroker;
72 class TitleBackground;
73 class TitleBackgroundPath;
74 class TitleLoopPlayback;
75 class TitleCurPopup;
76 class TitleCurItem;
77 class TitleCurSubMenu;
78 class TitleCurSubMenuItem;
79 class TitleFontsPopup;
80 class TitleColorPopup;
81 class TitlePngPopup;
82
83 class TitleWindow : public PluginClientWindow
84 {
85 public:
86         TitleWindow(TitleMain *client);
87         ~TitleWindow();
88
89         void create_objects();
90         int resize_event(int w, int h);
91         int grab_event(XEvent *event);
92         void update_color();
93         void update_justification();
94         void update_stats();
95         void update();
96         void previous_font();
97         void next_font();
98         void check_style(const char *font_name, int update);
99         int insert_ibeam(const char *txt, int ofs=0);
100         void done_event(int result);
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         TitleBold *bold;
124         TitleDrag *drag;
125         TitleCurPopup *cur_popup;
126         TitleFontsPopup *fonts_popup;
127         TitleColorPopup *color_popup;
128         TitlePngPopup *png_popup;
129
130         int color_x, color_y;
131         int outline_color_x, outline_color_y;
132         int drag_dx, drag_dy, dragging;
133         int cur_ibeam;
134
135         BC_Title *size_title;
136         TitleSize *size;
137         TitleSizeTumble *size_tumbler;
138         BC_Title *pitch_title;
139         TitlePitch *pitch;
140         BC_Title *encoding_title;
141         TitleEncoding *encoding;
142         TitleColorButton *color_button;
143         TitleColorThread *color_thread;
144         TitleOutlineColorButton *outline_color_button;
145         TitleColorThread *outline_color_thread;
146         BC_Title *motion_title;
147         TitleMotion *motion;
148         TitleLinePitch *line_pitch;
149         TitleLoop *loop;
150         BC_Title *fadein_title;
151         TitleFade *fade_in;
152         BC_Title *fadeout_title;
153         TitleFade *fade_out;
154         BC_Title *text_title;
155         TitleText *text;
156         TitleTextChars *text_chars;
157         TitleTextBfrSz *text_bfrsz;
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
209 class TitleItalic : public BC_CheckBox
210 {
211 public:
212         TitleItalic(TitleMain *client, TitleWindow *window, int x, int y);
213         int handle_event();
214         TitleMain *client;
215         TitleWindow *window;
216 };
217 class TitleBold : public BC_CheckBox
218 {
219 public:
220         TitleBold(TitleMain *client, TitleWindow *window, int x, int y);
221         int handle_event();
222         TitleMain *client;
223         TitleWindow *window;
224 };
225 class TitleDrag : public BC_CheckBox
226 {
227 public:
228         TitleDrag(TitleMain *client, TitleWindow *window, int x, int y);
229         int handle_event();
230         TitleMain *client;
231         TitleWindow *window;
232 };
233
234
235 class TitleSize : public BC_PopupTextBox
236 {
237 public:
238         TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text);
239         ~TitleSize();
240         int handle_event();
241         void update(int size);
242         TitleMain *client;
243         TitleWindow *window;
244 };
245
246 class TitlePitch : public BC_TumbleTextBox
247 {
248 public:
249         TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value);
250         ~TitlePitch();
251         int handle_event();
252
253         int *value;
254         TitleMain *client;
255         TitleWindow *window;
256 };
257
258 class TitleEncoding : public BC_PopupTextBox
259 {
260 public:
261         TitleEncoding(TitleMain *client, TitleWindow *window, int x, int y, char *text);
262         ~TitleEncoding();
263         int handle_event();
264         TitleMain *client;
265         TitleWindow *window;
266 };
267
268 class TitleColorButton : public BC_GenericButton
269 {
270 public:
271         TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y);
272         int handle_event();
273         TitleMain *client;
274         TitleWindow *window;
275 };
276 class TitleOutlineColorButton : public BC_GenericButton
277 {
278 public:
279         TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y);
280         int handle_event();
281         TitleMain *client;
282         TitleWindow *window;
283 };
284
285 class TitleMotion : public BC_PopupTextBox
286 {
287 public:
288         TitleMotion(TitleMain *client, TitleWindow *window, int x, int y);
289         int handle_event();
290         TitleMain *client;
291         TitleWindow *window;
292 };
293 class TitleLoop : public BC_CheckBox
294 {
295 public:
296         TitleLoop(TitleMain *client, int x, int y);
297         int handle_event();
298         TitleMain *client;
299         TitleWindow *window;
300 };
301 class TitleLinePitch : public BC_CheckBox
302 {
303 public:
304         TitleLinePitch(TitleMain *client, int x, int y);
305         int handle_event();
306         TitleMain *client;
307         TitleWindow *window;
308 };
309
310 class TitleTimecode : public BC_CheckBox
311 {
312 public:
313         TitleTimecode(TitleMain *client, int x, int y);
314         int handle_event();
315         TitleMain *client;
316 };
317
318 class TitleTimecodeFormat : public BC_PopupMenu
319 {
320 public:
321         TitleTimecodeFormat(TitleMain *client, int x, int y, const char *text);
322         void create_objects();
323         int update(int timecode_format);
324         int handle_event();
325         TitleMain *client;
326 };
327
328 class TitleFade : public BC_TextBox
329 {
330 public:
331         TitleFade(TitleMain *client, TitleWindow *window, double *value, int x, int y);
332         int handle_event();
333         TitleMain *client;
334         TitleWindow *window;
335         double *value;
336 };
337 class TitleFont : public BC_PopupTextBox
338 {
339 public:
340         TitleFont(TitleMain *client, TitleWindow *window, int x, int y);
341         int handle_event();
342         TitleMain *client;
343         TitleWindow *window;
344 };
345 class TitleText : public BC_ScrollTextBox
346 {
347 public:
348         TitleText(TitleMain *client,
349                 TitleWindow *window,
350                 int x,
351                 int y,
352                 int w,
353                 int h);
354         int handle_event();
355         int button_press_event();
356         TitleMain *client;
357         TitleWindow *window;
358 };
359 class TitleTextChars : public BC_Title
360 {
361 public:
362         int update(int n);
363         TitleTextChars(int x, int y, int w);
364         ~TitleTextChars();
365 };
366 class TitleTextBfrSz : public BC_Title
367 {
368 public:
369         int update(int n);
370         TitleTextBfrSz(int x, int y, int w);
371         ~TitleTextBfrSz();
372 };
373
374 class TitleX : public BC_TumbleTextBox
375 {
376 public:
377         TitleX(TitleMain *client, TitleWindow *window, int x, int y);
378         int handle_event();
379         TitleMain *client;
380         TitleWindow *window;
381 };
382 class TitleY : public BC_TumbleTextBox
383 {
384 public:
385         TitleY(TitleMain *client, TitleWindow *window, int x, int y);
386         int handle_event();
387         TitleMain *client;
388         TitleWindow *window;
389 };
390 class TitleW : public BC_TumbleTextBox
391 {
392 public:
393         TitleW(TitleMain *client, TitleWindow *window, int x, int y);
394         int handle_event();
395         TitleMain *client;
396         TitleWindow *window;
397 };
398 class TitleH : public BC_TumbleTextBox
399 {
400 public:
401         TitleH(TitleMain *client, TitleWindow *window, int x, int y);
402         int handle_event();
403         TitleMain *client;
404         TitleWindow *window;
405 };
406
407 class TitleDropShadow : public BC_TumbleTextBox
408 {
409 public:
410         TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y);
411         int handle_event();
412         TitleMain *client;
413         TitleWindow *window;
414 };
415
416 class TitleOutline : public BC_TumbleTextBox
417 {
418 public:
419         TitleOutline(TitleMain *client, TitleWindow *window, int x, int y);
420         int handle_event();
421         TitleMain *client;
422         TitleWindow *window;
423 };
424
425 class TitleStroker : public BC_TumbleTextBox
426 {
427 public:
428         TitleStroker(TitleMain *client, TitleWindow *window, int x, int y);
429         int handle_event();
430         TitleMain *client;
431         TitleWindow *window;
432 };
433
434 class TitleSpeed : public BC_TumbleTextBox
435 {
436 public:
437         TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y);
438         int handle_event();
439         TitleMain *client;
440 };
441
442 class TitleLeft : public BC_Radial
443 {
444 public:
445         TitleLeft(TitleMain *client, TitleWindow *window, int x, int y);
446         int handle_event();
447         TitleMain *client;
448         TitleWindow *window;
449 };
450 class TitleCenter : public BC_Radial
451 {
452 public:
453         TitleCenter(TitleMain *client, TitleWindow *window, int x, int y);
454         int handle_event();
455         TitleMain *client;
456         TitleWindow *window;
457 };
458 class TitleRight : public BC_Radial
459 {
460 public:
461         TitleRight(TitleMain *client, TitleWindow *window, int x, int y);
462         int handle_event();
463         TitleMain *client;
464         TitleWindow *window;
465 };
466
467 class TitleTop : public BC_Radial
468 {
469 public:
470         TitleTop(TitleMain *client, TitleWindow *window, int x, int y);
471         int handle_event();
472         TitleMain *client;
473         TitleWindow *window;
474 };
475 class TitleMid : public BC_Radial
476 {
477 public:
478         TitleMid(TitleMain *client, TitleWindow *window, int x, int y);
479         int handle_event();
480         TitleMain *client;
481         TitleWindow *window;
482 };
483 class TitleBottom : public BC_Radial
484 {
485 public:
486         TitleBottom(TitleMain *client, TitleWindow *window, int x, int y);
487         int handle_event();
488         TitleMain *client;
489         TitleWindow *window;
490 };
491 class TitleColorThread : public ColorPicker
492 {
493 public:
494         TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline);
495         virtual int handle_new_color(int output, int alpha);
496         TitleMain *client;
497         TitleWindow *window;
498         int is_outline;
499 };
500 class TitleBackground : public BC_CheckBox
501 {
502 public:
503         TitleBackground(TitleMain *client, TitleWindow *window, int x, int y);
504         int handle_event();
505         TitleMain *client;
506         TitleWindow *window;
507 };
508 class TitleBackgroundPath : public BC_TextBox
509 {
510 public:
511         TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y);
512         int handle_event();
513         TitleMain *client;
514         TitleWindow *window;
515 };
516 class TitleLoopPlayback : public BC_CheckBox
517 {
518 public:
519         TitleLoopPlayback(TitleMain *client, int x, int y);
520         int handle_event();
521         TitleMain *client;
522         TitleWindow *window;
523 };
524
525
526 class TitleCurPopup : public BC_PopupMenu
527 {
528 public:
529         TitleCurPopup(TitleMain *client, TitleWindow *window);
530
531         int handle_event();
532         void create_objects();
533
534         TitleMain *client;
535         TitleWindow *window;
536 };
537
538 class TitleCurItem : public BC_MenuItem
539 {
540 public:
541         TitleCurItem(TitleCurPopup *popup, const char *text);
542
543         int handle_event();
544         TitleCurPopup *popup;
545 };
546
547 enum { POPUP_OFFSET=-1, POPUP_NONE=0, POPUP_FONT, POPUP_COLOR, POPUP_PNG, };
548
549 class TitleCurSubMenu : public BC_SubMenu
550 {
551 public:
552         TitleCurSubMenu(TitleCurItem *cur_item);
553         ~TitleCurSubMenu();
554         void add_subitemx(int popup_type, va_list ap, const char *fmt);
555         void add_subitem(int popup_type, const char *fmt,...) { va_list ap;
556                 va_start(ap, fmt); add_subitemx(popup_type, ap, fmt); va_end(ap);
557         }
558         void add_subitem(const char *fmt,...) { va_list ap;
559                 va_start(ap, fmt); add_subitemx(POPUP_NONE, ap, fmt); va_end(ap);
560         }
561         TitleCurItem *cur_item;
562 };
563
564 class TitleCurSubMenuItem : public BC_MenuItem
565 {
566 public:
567         TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type);
568         ~TitleCurSubMenuItem();
569         int handle_event();
570
571         TitleCurSubMenu *submenu;
572         int popup_type;
573 };
574
575 class TitleFontsPopup : public BC_ListBox
576 {
577 public:
578         TitleFontsPopup(TitleMain *client, TitleWindow *window);
579         ~TitleFontsPopup();
580         int keypress_event();
581         int handle_event();
582         int show_tooltip(const char *text, int x,int y, int w,int h) {
583                 return gui_tooltip(text);
584         }
585
586         TitleMain *client;
587         TitleWindow *window;
588 };
589
590 class TitleColorPopup : public ColorPicker
591 {
592 public:
593         TitleColorPopup(TitleMain *client, TitleWindow *window);
594         ~TitleColorPopup();
595         int handle_new_color(int output, int alpha);
596         void handle_done_event(int result);
597         int activate();
598
599         TitleMain *client;
600         TitleWindow *window;
601         int color_value;
602 };
603
604 class TitlePngPopup : public BC_DialogThread
605 {
606 public:
607         TitlePngPopup(TitleMain *client, TitleWindow *window);
608         ~TitlePngPopup();
609
610         void handle_done_event(int result);
611         BC_Window* new_gui();
612         int activate();
613
614         TitleMain *client;
615         TitleWindow *window;
616 };
617
618 #endif