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