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