add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.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 TitleWindow;
28
29 #include "colorpicker.h"
30 #include "dragcheckbox.h"
31 #include "filexml.h"
32 #include "mutex.h"
33 #include "titler.h"
34
35 #include <stdarg.h>
36
37 class TitleFontTumble;
38 class TitleSizeTumble;
39 class TitleItalic;
40 class TitleAlias;
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 TitleX;
57 class TitleY;
58 class TitleW;
59 class TitleH;
60 class TitleLeft;
61 class TitleCenter;
62 class TitleRight;class TitleTop;
63 class TitleMid;
64 class TitleBottom;
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         void update_drag();
90         void update_color();
91         void update_justification();
92         void update_stats();
93         void update();
94         void previous_font();
95         void next_font();
96         void check_style(const char *font_name, int update);
97         int insert_ibeam(const char *txt, int ofs=0);
98         void done_event(int result);
99         void send_configure_change();
100         int check_configure_change(int ret);
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         TitleAlias *alias;
124         TitleBold *bold;
125         TitleDrag *drag;
126         TitleCurPopup *cur_popup;
127         TitleFontsPopup *fonts_popup;
128         TitleColorPopup *color_popup;
129         TitlePngPopup *png_popup;
130
131         int color_x, color_y;
132         int outline_color_x, outline_color_y;
133         int drag_dx, drag_dy, dragging;
134         int cur_ibeam, pending_config;
135
136         BC_Title *size_title;
137         TitleSize *size;
138         TitleSizeTumble *size_tumbler;
139         BC_Title *pitch_title;
140         TitlePitch *pitch;
141         BC_Title *encoding_title;
142         TitleEncoding *encoding;
143         BC_Title *color_button_title;
144         TitleColorButton *color_button;
145         BC_Title *outline_button_title;
146         TitleOutlineColorButton *outline_button;
147         BC_Title *motion_title;
148         TitleMotion *motion;
149         TitleLinePitch *line_pitch;
150         TitleLoop *loop;
151         BC_Title *fadein_title;
152         TitleFade *fade_in;
153         BC_Title *fadeout_title;
154         TitleFade *fade_out;
155         BC_Title *text_title;
156         TitleText *text;
157         TitleTextChars *text_chars;
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 class TitleAlias : public BC_CheckBox
209 {
210 public:
211         TitleAlias(TitleMain *client, TitleWindow *window, int x, int y);
212         int handle_event();
213         TitleMain *client;
214         TitleWindow *window;
215 };
216 class TitleItalic : public BC_CheckBox
217 {
218 public:
219         TitleItalic(TitleMain *client, TitleWindow *window, int x, int y);
220         int handle_event();
221         TitleMain *client;
222         TitleWindow *window;
223 };
224 class TitleBold : public BC_CheckBox
225 {
226 public:
227         TitleBold(TitleMain *client, TitleWindow *window, int x, int y);
228         int handle_event();
229         TitleMain *client;
230         TitleWindow *window;
231 };
232 class TitleDrag : public DragCheckBox
233 {
234 public:
235         TitleDrag(TitleMain *client, TitleWindow *window, int x, int y);
236         int handle_event();
237         void update_gui();
238         Track *get_drag_track();
239         int64_t get_drag_position();
240
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 ColorCircleButton
280 {
281 public:
282         TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y);
283         int handle_new_color(int output, int alpha);
284         void handle_done_event(int result);
285         TitleMain *client;
286         TitleWindow *window;
287 };
288 class TitleOutlineColorButton : public ColorCircleButton
289 {
290 public:
291         TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y);
292         int handle_new_color(int output, int alpha);
293         void handle_done_event(int result);
294         TitleMain *client;
295         TitleWindow *window;
296 };
297
298 class TitleMotion : public BC_PopupTextBox
299 {
300 public:
301         TitleMotion(TitleMain *client, TitleWindow *window, int x, int y);
302         int handle_event();
303         TitleMain *client;
304         TitleWindow *window;
305 };
306 class TitleLoop : public BC_CheckBox
307 {
308 public:
309         TitleLoop(TitleMain *client, TitleWindow *window, int x, int y);
310         int handle_event();
311         TitleMain *client;
312         TitleWindow *window;
313 };
314 class TitleLinePitch : public BC_CheckBox
315 {
316 public:
317         TitleLinePitch(TitleMain *client, TitleWindow *window, int x, int y);
318         int handle_event();
319         TitleMain *client;
320         TitleWindow *window;
321 };
322
323 class TitleTimecode : public BC_CheckBox
324 {
325 public:
326         TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y);
327         int handle_event();
328         TitleMain *client;
329         TitleWindow *window;
330 };
331
332 class TitleTimecodeFormat : public BC_PopupMenu
333 {
334 public:
335         TitleTimecodeFormat(TitleMain *client, TitleWindow *window, int x, int y, const char *text);
336         void create_objects();
337         int update(int timecode_format);
338         int handle_event();
339         TitleMain *client;
340         TitleWindow *window;
341 };
342
343 class TitleFade : public BC_TextBox
344 {
345 public:
346         TitleFade(TitleMain *client, TitleWindow *window, double *value, int x, int y);
347         int handle_event();
348         TitleMain *client;
349         TitleWindow *window;
350         double *value;
351 };
352 class TitleFont : public BC_PopupTextBox
353 {
354 public:
355         TitleFont(TitleMain *client, TitleWindow *window, int x, int y);
356         int handle_event();
357         TitleMain *client;
358         TitleWindow *window;
359 };
360 class TitleText : public BC_ScrollTextBox
361 {
362 public:
363         TitleText(TitleMain *client,
364                 TitleWindow *window,
365                 int x,
366                 int y,
367                 int w,
368                 int h);
369         int handle_event();
370         int button_press_event();
371         TitleMain *client;
372         TitleWindow *window;
373 };
374 class TitleTextChars : public BC_Title
375 {
376 public:
377         int update(int n);
378         TitleTextChars(int x, int y, int w);
379         ~TitleTextChars();
380 };
381
382 class TitleX : public BC_TumbleTextBox
383 {
384 public:
385         TitleX(TitleMain *client, TitleWindow *window, int x, int y);
386         int handle_event();
387         TitleMain *client;
388         TitleWindow *window;
389 };
390 class TitleY : public BC_TumbleTextBox
391 {
392 public:
393         TitleY(TitleMain *client, TitleWindow *window, int x, int y);
394         int handle_event();
395         TitleMain *client;
396         TitleWindow *window;
397 };
398 class TitleW : public BC_TumbleTextBox
399 {
400 public:
401         TitleW(TitleMain *client, TitleWindow *window, int x, int y);
402         int handle_event();
403         TitleMain *client;
404         TitleWindow *window;
405 };
406 class TitleH : public BC_TumbleTextBox
407 {
408 public:
409         TitleH(TitleMain *client, TitleWindow *window, int x, int y);
410         int handle_event();
411         TitleMain *client;
412         TitleWindow *window;
413 };
414
415 class TitleDropShadow : public BC_TumbleTextBox
416 {
417 public:
418         TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y);
419         int handle_event();
420         TitleMain *client;
421         TitleWindow *window;
422 };
423
424 class TitleOutline : public BC_TumbleTextBox
425 {
426 public:
427         TitleOutline(TitleMain *client, TitleWindow *window, int x, int y);
428         int handle_event();
429         TitleMain *client;
430         TitleWindow *window;
431 };
432
433 class TitleStroker : public BC_TumbleTextBox
434 {
435 public:
436         TitleStroker(TitleMain *client, TitleWindow *window, int x, int y);
437         int handle_event();
438         TitleMain *client;
439         TitleWindow *window;
440 };
441
442 class TitleSpeed : public BC_TumbleTextBox
443 {
444 public:
445         TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y);
446         int handle_event();
447         TitleMain *client;
448         TitleWindow *window;
449 };
450
451 class TitleLeft : public BC_Radial
452 {
453 public:
454         TitleLeft(TitleMain *client, TitleWindow *window, int x, int y);
455         int handle_event();
456         TitleMain *client;
457         TitleWindow *window;
458 };
459 class TitleCenter : public BC_Radial
460 {
461 public:
462         TitleCenter(TitleMain *client, TitleWindow *window, int x, int y);
463         int handle_event();
464         TitleMain *client;
465         TitleWindow *window;
466 };
467 class TitleRight : public BC_Radial
468 {
469 public:
470         TitleRight(TitleMain *client, TitleWindow *window, int x, int y);
471         int handle_event();
472         TitleMain *client;
473         TitleWindow *window;
474 };
475
476 class TitleTop : public BC_Radial
477 {
478 public:
479         TitleTop(TitleMain *client, TitleWindow *window, int x, int y);
480         int handle_event();
481         TitleMain *client;
482         TitleWindow *window;
483 };
484 class TitleMid : public BC_Radial
485 {
486 public:
487         TitleMid(TitleMain *client, TitleWindow *window, int x, int y);
488         int handle_event();
489         TitleMain *client;
490         TitleWindow *window;
491 };
492 class TitleBottom : public BC_Radial
493 {
494 public:
495         TitleBottom(TitleMain *client, TitleWindow *window, int x, int y);
496         int handle_event();
497         TitleMain *client;
498         TitleWindow *window;
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, TitleWindow *window, 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