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