4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
31 #include "colorpicker.h"
38 class TitleFontTumble;
39 class TitleSizeTumble;
46 class TitleColorButton;
47 class TitleOutlineColorButton;
48 class TitleDropShadow;
61 class TitleRight;class TitleTop;
64 class TitleColorThread;
67 class TitleTimecodeFormat;
70 class TitleBackground;
71 class TitleBackgroundPath;
72 class TitleLoopPlayback;
75 class TitleCurSubMenu;
76 class TitleCurSubMenuItem;
77 class TitleFontsPopup;
78 class TitleColorPopup;
81 class TitleWindow : public PluginClientWindow
84 TitleWindow(TitleMain *client);
87 void create_objects();
88 int resize_event(int w, int h);
89 int grab_event(XEvent *event);
91 void update_justification();
95 void check_style(const char *font_name, int update);
96 int insert_ibeam(const char *txt, int ofs=0);
97 void done_event(int result);
101 BC_Title *font_title;
103 TitleFontTumble *font_tumbler;
112 BC_Title *dropshadow_title;
113 TitleDropShadow *dropshadow;
114 BC_Title *outline_title;
115 TitleOutline *outline;
116 BC_Title *stroker_title;
117 TitleStroker *stroker;
118 BC_Title *style_title;
122 TitleCurPopup *cur_popup;
123 TitleFontsPopup *fonts_popup;
124 TitleColorPopup *color_popup;
125 TitlePngPopup *png_popup;
127 int color_x, color_y;
128 int outline_color_x, outline_color_y;
129 int drag_dx, drag_dy, dragging;
132 BC_Title *size_title;
134 TitleSizeTumble *size_tumbler;
135 BC_Title *pitch_title;
137 BC_Title *encoding_title;
138 TitleEncoding *encoding;
139 TitleColorButton *color_button;
140 TitleColorThread *color_thread;
141 TitleOutlineColorButton *outline_color_button;
142 TitleColorThread *outline_color_thread;
143 BC_Title *motion_title;
145 TitleLinePitch *line_pitch;
147 BC_Title *fadein_title;
149 BC_Title *fadeout_title;
151 BC_Title *text_title;
153 BC_Title *justify_title;
160 BC_Title *speed_title;
162 TitleTimecode *timecode;
163 TitleTimecodeFormat *timecode_format;
164 TitleBackground *background;
165 TitleBackgroundPath *background_path;
166 BrowseButton *background_browse;
167 TitleLoopPlayback *loop_playback;
170 ArrayList<BC_ListBoxItem*> sizes;
171 ArrayList<BC_ListBoxItem*> encodings;
172 ArrayList<BC_ListBoxItem*> paths;
173 ArrayList<BC_ListBoxItem*> fonts;
177 class TitleFontTumble : public BC_Tumbler
180 TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y);
182 int handle_up_event();
183 int handle_down_event();
190 class TitleSizeTumble : public BC_Tumbler
193 TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y);
195 int handle_up_event();
196 int handle_down_event();
204 class TitleItalic : public BC_CheckBox
207 TitleItalic(TitleMain *client, TitleWindow *window, int x, int y);
212 class TitleBold : public BC_CheckBox
215 TitleBold(TitleMain *client, TitleWindow *window, int x, int y);
220 class TitleDrag : public BC_CheckBox
223 TitleDrag(TitleMain *client, TitleWindow *window, int x, int y);
230 class TitleSize : public BC_PopupTextBox
233 TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text);
236 void update(int size);
241 class TitlePitch : public BC_TumbleTextBox
244 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value);
253 class TitleEncoding : public BC_PopupTextBox
256 TitleEncoding(TitleMain *client, TitleWindow *window, int x, int y, char *text);
263 class TitleColorButton : public BC_GenericButton
266 TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y);
271 class TitleOutlineColorButton : public BC_GenericButton
274 TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y);
280 class TitleMotion : public BC_PopupTextBox
283 TitleMotion(TitleMain *client, TitleWindow *window, int x, int y);
288 class TitleLoop : public BC_CheckBox
291 TitleLoop(TitleMain *client, int x, int y);
296 class TitleLinePitch : public BC_CheckBox
299 TitleLinePitch(TitleMain *client, int x, int y);
305 class TitleTimecode : public BC_CheckBox
308 TitleTimecode(TitleMain *client, int x, int y);
313 class TitleTimecodeFormat : public BC_PopupMenu
316 TitleTimecodeFormat(TitleMain *client, int x, int y, const char *text);
317 void create_objects();
318 int update(int timecode_format);
323 class TitleFade : public BC_TextBox
326 TitleFade(TitleMain *client, TitleWindow *window, double *value, int x, int y);
332 class TitleFont : public BC_PopupTextBox
335 TitleFont(TitleMain *client, TitleWindow *window, int x, int y);
340 class TitleText : public BC_ScrollTextBox
343 TitleText(TitleMain *client,
350 int button_press_event();
354 class TitleX : public BC_TumbleTextBox
357 TitleX(TitleMain *client, TitleWindow *window, int x, int y);
362 class TitleY : public BC_TumbleTextBox
365 TitleY(TitleMain *client, TitleWindow *window, int x, int y);
370 class TitleW : public BC_TumbleTextBox
373 TitleW(TitleMain *client, TitleWindow *window, int x, int y);
378 class TitleH : public BC_TumbleTextBox
381 TitleH(TitleMain *client, TitleWindow *window, int x, int y);
387 class TitleDropShadow : public BC_TumbleTextBox
390 TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y);
396 class TitleOutline : public BC_TumbleTextBox
399 TitleOutline(TitleMain *client, TitleWindow *window, int x, int y);
405 class TitleStroker : public BC_TumbleTextBox
408 TitleStroker(TitleMain *client, TitleWindow *window, int x, int y);
414 class TitleSpeed : public BC_TumbleTextBox
417 TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y);
422 class TitleLeft : public BC_Radial
425 TitleLeft(TitleMain *client, TitleWindow *window, int x, int y);
430 class TitleCenter : public BC_Radial
433 TitleCenter(TitleMain *client, TitleWindow *window, int x, int y);
438 class TitleRight : public BC_Radial
441 TitleRight(TitleMain *client, TitleWindow *window, int x, int y);
447 class TitleTop : public BC_Radial
450 TitleTop(TitleMain *client, TitleWindow *window, int x, int y);
455 class TitleMid : public BC_Radial
458 TitleMid(TitleMain *client, TitleWindow *window, int x, int y);
463 class TitleBottom : public BC_Radial
466 TitleBottom(TitleMain *client, TitleWindow *window, int x, int y);
471 class TitleColorThread : public ColorPicker
474 TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline);
475 virtual int handle_new_color(int output, int alpha);
480 class TitleBackground : public BC_CheckBox
483 TitleBackground(TitleMain *client, TitleWindow *window, int x, int y);
488 class TitleBackgroundPath : public BC_TextBox
491 TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y);
496 class TitleLoopPlayback : public BC_CheckBox
499 TitleLoopPlayback(TitleMain *client, int x, int y);
506 class TitleCurPopup : public BC_PopupMenu
509 TitleCurPopup(TitleMain *client, TitleWindow *window);
512 void create_objects();
518 class TitleCurItem : public BC_MenuItem
521 TitleCurItem(TitleCurPopup *popup, const char *text);
524 TitleCurPopup *popup;
527 enum { POPUP_OFFSET=-1, POPUP_NONE=0, POPUP_FONT, POPUP_COLOR, POPUP_PNG, };
529 class TitleCurSubMenu : public BC_SubMenu
532 TitleCurSubMenu(TitleCurItem *cur_item);
534 void add_subitem(int popup_type, va_list ap, const char *fmt);
535 void add_subitem(int popup_type, const char *fmt,...) { va_list ap;
536 va_start(ap, fmt); add_subitem(popup_type, ap, fmt); va_end(ap);
538 void add_subitem(const char *fmt,...) { va_list ap;
539 va_start(ap, fmt); add_subitem(POPUP_NONE, ap, fmt); va_end(ap);
541 TitleCurItem *cur_item;
544 class TitleCurSubMenuItem : public BC_MenuItem
547 TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type);
548 ~TitleCurSubMenuItem();
551 TitleCurSubMenu *submenu;
555 class TitleFontsPopup : public BC_ListBox
558 TitleFontsPopup(TitleMain *client, TitleWindow *window);
560 int keypress_event();
562 int show_tooltip(const char *text, int x,int y, int w,int h) {
563 return gui_tooltip(text);
570 class TitleColorPopup : public ColorPicker
573 TitleColorPopup(TitleMain *client, TitleWindow *window);
575 int handle_new_color(int output, int alpha);
576 void handle_done_event(int result);
584 class TitlePngPopup : public BC_DialogThread
587 TitlePngPopup(TitleMain *client, TitleWindow *window);
590 void handle_done_event(int result);
591 BC_Window* new_gui();