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