4 * Copyright (C) 1997-2014 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
22 #include "bcdisplayinfo.h"
24 #include "bcsignals.h"
25 #include "browsebutton.h"
28 #include "automation.h"
30 #include "cwindowgui.h"
31 #include "dragcheckbox.h"
33 #include "edlsession.h"
36 #include "mainerror.h"
38 #include "mwindowgui.h"
40 #include "pluginserver.h"
44 #include "titlerwindow.h"
45 #include "bcfontentry.h"
47 static const int timeunit_formats[] =
58 TitleWindow::TitleWindow(TitleMain *client)
59 : PluginClientWindow(client,
60 client->config.window_w, client->config.window_h,
63 //printf("TitleWindow::TitleWindow %d %d %d\n", __LINE__, client->config.window_w, client->config.window_h);
64 this->client = client;
69 x_title = 0; title_x = 0;
70 y_title = 0; title_y = 0;
71 w_title = 0; title_w = 0;
72 h_title = 0; title_h = 0;
73 dropshadow_title = 0; dropshadow = 0;
74 outline_title = 0; outline = 0;
75 stroker_title = 0; stroker = 0;
84 drag_dx = drag_dy = dragging = 0;
109 left = 0; center = 0; right = 0;
110 top = 0; mid = 0; bottom = 0;
121 void TitleWindow::done_event(int result)
123 color_button->close_picker();
124 outline_button->close_picker();
125 drag->drag_deactivate();
126 delete color_popup; color_popup = 0;
127 delete png_popup; png_popup = 0;
131 TitleWindow::~TitleWindow()
135 for( int i=0; i<fonts.size(); ++i )
136 delete fonts[i]->get_icon();
138 sizes.remove_all_objects();
139 delete timecode_format;
146 void TitleWindow::create_objects()
148 int x = xS(10), y = yS(10);
149 int margin = client->get_theme()->widget_border;
150 char string[BCTEXTLEN];
152 #define COLOR_W xS(50)
153 #define COLOR_H yS(30)
154 client->build_previews(this);
156 sizes.append(new BC_ListBoxItem("8"));
157 sizes.append(new BC_ListBoxItem("9"));
158 sizes.append(new BC_ListBoxItem("10"));
159 sizes.append(new BC_ListBoxItem("11"));
160 sizes.append(new BC_ListBoxItem("12"));
161 sizes.append(new BC_ListBoxItem("13"));
162 sizes.append(new BC_ListBoxItem("14"));
163 sizes.append(new BC_ListBoxItem("16"));
164 sizes.append(new BC_ListBoxItem("18"));
165 sizes.append(new BC_ListBoxItem("20"));
166 sizes.append(new BC_ListBoxItem("22"));
167 sizes.append(new BC_ListBoxItem("24"));
168 sizes.append(new BC_ListBoxItem("26"));
169 sizes.append(new BC_ListBoxItem("28"));
170 sizes.append(new BC_ListBoxItem("32"));
171 sizes.append(new BC_ListBoxItem("36"));
172 sizes.append(new BC_ListBoxItem("40"));
173 sizes.append(new BC_ListBoxItem("48"));
174 sizes.append(new BC_ListBoxItem("56"));
175 sizes.append(new BC_ListBoxItem("64"));
176 sizes.append(new BC_ListBoxItem("72"));
177 sizes.append(new BC_ListBoxItem("100"));
178 sizes.append(new BC_ListBoxItem("128"));
179 sizes.append(new BC_ListBoxItem("256"));
180 sizes.append(new BC_ListBoxItem("512"));
181 sizes.append(new BC_ListBoxItem("1024"));
183 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
184 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
185 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
186 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
187 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
191 // Construct font list
192 ArrayList<BC_FontEntry*> *fontlist = get_resources()->fontlist;
194 for( int i=0; i<fontlist->size(); ++i ) {
196 for( int j=0; j<fonts.size(); ++j ) {
197 if( !strcasecmp(fonts.get(j)->get_text(),
198 fontlist->get(i)->displayname) ) {
204 BC_ListBoxItem *item = 0;
206 fonts.append(item = new
207 BC_ListBoxItem(fontlist->get(i)->displayname));
208 if( !strcmp(client->config.font, item->get_text()) )
209 item->set_selected(1);
210 if( fontlist->values[i]->image ) {
211 VFrame *vframe = fontlist->get(i)->image;
212 BC_Pixmap *icon = new BC_Pixmap(this, vframe, PIXMAP_ALPHA);
213 item->set_icon(icon);
214 item->set_icon_vframe(vframe);
223 for( int i=0; i<fonts.size()-1; ++i ) {
224 if( strcmp(fonts.values[i]->get_text(),
225 fonts.values[i + 1]->get_text()) > 0 ) {
226 BC_ListBoxItem *temp = fonts.values[i + 1];
227 fonts.values[i + 1] = fonts.values[i];
228 fonts.values[i] = temp;
234 add_tool(font_title = new BC_Title(x, y, _("Font:")));
235 font = new TitleFont(client, this, x, y + font_title->get_h());
236 font->create_objects();
237 font->set_show_query(1);
239 add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y+margin));
240 x += font_tumbler->get_w() + margin;
242 int x1 = x+xS(20), y1 = y;
243 add_tool(size_title = new BC_Title(x1, y1+margin, _("Size:")));
244 sprintf(string, "%.2f", client->config.size);
245 x1 += size_title->get_w() + margin;
246 size = new TitleSize(client, this, x1, y1+margin, string);
247 size->create_objects();
248 int x2 = x1 + size->get_w(), y2 = y1 + size->get_h() + margin;
249 add_subwindow(size_tumbler = new TitleSizeTumble(client, this, x2, y1+margin));
251 add_tool(pitch_title = new BC_Title(x-xS(16), y2+margin, _("Line Pitch:")));
252 pitch = new TitlePitch(client, this, x1, y2+margin, &client->config.line_pitch);
253 pitch->create_objects();
255 int x3 = x2 + size_tumbler->get_w() + xS(50);
256 int y3 = pitch->get_y() + pitch->get_h();
258 add_tool(style_title = new BC_Title(x=x3, y, _("Style:")));
259 add_tool(italic = new TitleItalic(client, this, x, y + yS(20)));
260 int w1 = italic->get_w();
261 add_tool(bold = new TitleBold(client, this, x, y + yS(50)));
262 if( bold->get_w() > w1 ) w1 = bold->get_w();
264 if( client->drag && drag->drag_activate() ) {
265 eprintf("drag enabled, but compositor already grabbed\n");
268 add_tool(drag = new TitleDrag(client, this, x, y + yS(80)));
269 drag->create_objects();
270 if( drag->get_w() > w1 ) w1 = drag->get_w();
272 add_tool(alias = new TitleAlias(client, this, x, y+yS(110)));
273 if( alias->get_w() > w1 ) w1 = drag->get_w();
276 add_tool(justify_title = new BC_Title(x+xS(50), y, _("Justify:")));
277 add_tool(left = new TitleLeft(client, this, x, y + yS(20)));
279 add_tool(center = new TitleCenter(client, this, x, y + yS(50)));
280 if( center->get_w() > w1 ) w1 = center->get_w();
281 add_tool(right = new TitleRight(client, this, x, y + yS(80)));
282 if( right->get_w() > w1 ) w1 = right->get_w();
285 add_tool(top = new TitleTop(client, this, x, y + yS(20)));
286 add_tool(mid = new TitleMid(client, this, x, y + yS(50)));
287 add_tool(bottom= new TitleBottom(client, this, x, y + yS(80)));
292 w1 = BC_Title::calculate_w(this, _("X:"));
293 if( (x1 = BC_Title::calculate_w(this, _("Y:"))) > w1 ) w1 = x1;
294 if( (x1 = BC_Title::calculate_w(this, _("W:"))) > w1 ) w1 = x1;
295 if( (x1 = BC_Title::calculate_w(this, _("H:"))) > w1 ) w1 = x1;
296 add_tool(x_title = new BC_Title(x1=x, y, _("X:")));
298 title_x = new TitleX(client, this, x1, y);
299 title_x->create_objects();
300 x1 += title_x->get_w()+margin;
301 add_tool(y_title = new BC_Title(x1, y, _("Y:")));
303 title_y = new TitleY(client, this, x1, y);
304 title_y->create_objects();
305 x1 += title_y->get_w();
306 y1 = y + title_y->get_h();
308 add_tool(w_title = new BC_Title(x1=x, y1, _("W:")));
310 title_w = new TitleW(client, this, x1, y1);
311 title_w->create_objects();
312 x1 += title_w->get_w()+margin;
313 add_tool(h_title = new BC_Title(x1, y1, _("H:")));
315 title_h = new TitleH(client, this, x1, y1);
316 title_h->create_objects();
317 x1 += title_h->get_w();
320 add_tool(motion_title = new BC_Title(x1=x, y, _("Motion:")));
321 x1 += motion_title->get_w()+margin;
322 motion = new TitleMotion(client, this, x1, y);
323 motion->create_objects();
324 add_tool(loop = new TitleLoop(client, this, x, y1));
325 x = margin; y = y1 + loop->get_h()+yS(20);
327 add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
328 w1 = dropshadow_title->get_w();
329 dropshadow = new TitleDropShadow(client, this, x, y + yS(20));
330 dropshadow->create_objects();
331 if( dropshadow->get_w() > w1 ) w1 = dropshadow->get_w();
334 add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
335 w1 = fadein_title->get_w();
336 add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + yS(20)));
337 if( fade_in->get_w() > w1 ) w1 = fade_in->get_w();
340 add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
341 w1 = fadeout_title->get_w();
342 add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + yS(20)));
343 if( fade_out->get_w() > w1 ) w1 = fade_out->get_w();
346 add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
347 w1 = speed_title->get_w();
348 y += speed_title->get_h() + yS(5); y1 = y;
349 speed = new TitleSpeed(client, this, x, y);
350 speed->create_objects();
351 if( speed->get_w() > w1 ) w1 = speed->get_w();
353 y2 = y + speed->get_h() + yS(10);
355 add_tool(color_button_title = new BC_Title(x3, y1+yS(10), _("Color:")));
356 x1 = x3 + color_button_title->get_w() + xS(30);
357 add_tool(color_button = new TitleColorButton(client, this, x1, y1));
358 y1 += color_button->get_h() + yS(10);
359 add_tool(outline_button_title = new BC_Title(x3, y1+yS(10), _("Outline:")));
360 add_tool(outline_button = new TitleOutlineColorButton(client, this, x1, y1));
363 add_tool(outline_title = new BC_Title(x, y, _("Outline:")));
364 y1 = y + outline_title->get_h() + margin;
365 outline = new TitleOutline(client, this, x, y1);
366 outline->create_objects();
367 x += outline->get_w() + xS(2)*margin;
369 add_tool(stroker_title = new BC_Title(x, y, _("Stroker:")));
370 stroker = new TitleStroker(client, this, x, y1);
371 stroker->create_objects();
372 x += stroker->get_w() + margin;
374 add_tool(timecode = new TitleTimecode(client, this, x, y));
375 y += timecode->get_h() + margin;
377 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
379 Units::print_time_format(timeunit_formats[i], text);
380 int w = get_text_width(MEDIUMFONT, text);
383 add_tool(timecode_format = new TitleTimecodeFormat(client, this, x, y, tw,
384 Units::print_time_format(client->config.timecode_format, string)));
385 timecode_format->create_objects();
386 y += timecode_format->get_h() + margin;
389 add_tool(background = new TitleBackground(client, this, x, y));
390 x += background->get_w() + margin;
391 add_tool(background_path = new TitleBackgroundPath(client, this, x, y));
392 x += background_path->get_w() + margin;
393 add_tool(background_browse = new BrowseButton(
394 client->server->mwindow->theme, this, background_path,
395 x, y, "", _("background media"), _("Select background media path")));
396 x += background_browse->get_w() + xS(3)*margin;
397 add_tool(loop_playback = new TitleLoopPlayback(client, this, x, y));
398 y += loop_playback->get_h() + yS(10);
401 add_tool(text_title = new BC_Title(x, y, _("Text:")));
402 x += text_title->get_w() + xS(20);
403 int wid = BC_Title::calculate_w(this,"0")*xS(10);
404 add_tool(text_chars = new TitleTextChars(x,y,wid));
406 y += text_title->get_h() + margin;
408 text = new TitleText(client, this, x, y, get_w()-margin - x, get_h() - y - yS(10));
409 text->create_objects();
411 add_tool(cur_popup = new TitleCurPopup(client, this));
412 cur_popup->create_objects();
413 add_tool(fonts_popup = new TitleFontsPopup(client, this));
414 color_popup = new TitleColorPopup(client, this);
415 png_popup = new TitlePngPopup(client, this);
421 int TitleWindow::resize_event(int w, int h)
423 client->config.window_w = w;
424 client->config.window_h = h;
426 clear_box(0, 0, w, h);
427 font_title->reposition_window(font_title->get_x(), font_title->get_y());
428 font->reposition_window(font->get_x(), font->get_y());
429 font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
430 x_title->reposition_window(x_title->get_x(), x_title->get_y());
431 title_x->reposition_window(title_x->get_x(), title_x->get_y());
432 y_title->reposition_window(y_title->get_x(), y_title->get_y());
433 title_y->reposition_window(title_y->get_x(), title_y->get_y());
434 w_title->reposition_window(w_title->get_x(), w_title->get_y());
435 title_w->reposition_window(title_w->get_x(), title_w->get_y());
436 h_title->reposition_window(h_title->get_x(), h_title->get_y());
437 title_h->reposition_window(title_h->get_x(), title_h->get_y());
438 style_title->reposition_window(style_title->get_x(), style_title->get_y());
439 italic->reposition_window(italic->get_x(), italic->get_y());
440 bold->reposition_window(bold->get_x(), bold->get_y());
441 drag->reposition_window(drag->get_x(), drag->get_y());
442 alias->reposition_window(alias->get_x(), alias->get_y());
443 size_title->reposition_window(size_title->get_x(), size_title->get_y());
444 size->reposition_window(size->get_x(), size->get_y());
445 size_tumbler->reposition_window(size_tumbler->get_x(), size_tumbler->get_y());
446 pitch_title->reposition_window(pitch_title->get_x(), pitch_title->get_y());
447 pitch->reposition_window(pitch->get_x(), pitch->get_y());
449 color_button_title->reposition_window(color_button_title->get_x(), color_button_title->get_y());
450 color_button->reposition_window(color_button->get_x(), color_button->get_y());
451 outline_button_title->reposition_window(outline_button_title->get_x(), outline_button_title->get_y());
452 outline_button->reposition_window(outline_button->get_x(), outline_button->get_y());
453 motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
454 motion->reposition_window(motion->get_x(), motion->get_y());
455 loop->reposition_window(loop->get_x(), loop->get_y());
456 dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
457 dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
458 fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
459 fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
460 fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
461 fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
462 text_title->reposition_window(text_title->get_x(), text_title->get_y());
463 timecode->reposition_window(timecode->get_x(), timecode->get_y());
464 text->reposition_window(text->get_x(), text->get_y(), w - text->get_x() - xS(10),
465 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - yS(10)));
466 justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
467 left->reposition_window(left->get_x(), left->get_y());
468 center->reposition_window(center->get_x(), center->get_y());
469 right->reposition_window(right->get_x(), right->get_y());
470 top->reposition_window(top->get_x(), top->get_y());
471 mid->reposition_window(mid->get_x(), mid->get_y());
472 bottom->reposition_window(bottom->get_x(), bottom->get_y());
473 speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
474 speed->reposition_window(speed->get_x(), speed->get_y());
481 void TitleWindow::update_drag()
483 drag->drag_x = client->config.title_x;
484 drag->drag_y = client->config.title_y;
485 drag->drag_w = client->config.title_w;
486 drag->drag_h = client->config.title_h;
487 send_configure_change();
489 void TitleWindow::send_configure_change()
491 client->send_configure_change();
494 void TitleWindow::previous_font()
496 int current_font = font->get_number();
497 if( !fonts.total ) current_font = -1;
498 else if( --current_font < 0 ) current_font = fonts.total - 1;
499 font->set_number(current_font);
501 if( current_font < 0 || current_font >= fonts.total ) return;
503 for( int i=0; i<fonts.total; ++i ) {
504 fonts.values[i]->set_selected(i == current_font);
507 font->update(fonts.values[current_font]->get_text());
508 strcpy(client->config.font, fonts.values[current_font]->get_text());
509 check_style(client->config.font,1);
510 send_configure_change();
513 void TitleWindow::next_font()
515 int current_font = font->get_number();
516 if( !fonts.total ) current_font = -1;
517 else if( ++current_font >= fonts.total ) current_font = 0;
518 font->set_number(current_font);
520 if( current_font < 0 || current_font >= fonts.total ) return;
522 for( int i=0; i<fonts.total; ++i ) {
523 fonts.values[i]->set_selected(i == current_font);
526 font->update(fonts.values[current_font]->get_text());
527 strcpy(client->config.font, fonts.values[current_font]->get_text());
528 check_style(client->config.font,1);
529 send_configure_change();
532 int TitleWindow::insert_ibeam(const char *txt, int ofs)
534 int ibeam = cur_ibeam;
535 int ilen = strlen(txt)+1;
537 int len = BC_Resources::encode(client->config.encoding, BC_Resources::wide_encoding,
538 (char*)txt,ilen, (char *)wtxt,ilen*sizeof(wtxt[0])) / sizeof(wchr_t);
539 client->insert_text(wtxt, ibeam);
540 while( len > 0 && !wtxt[len] ) --len;
541 int adv = len+1 + ofs;
542 if( (ibeam += adv) >= client->config.wlen)
543 ibeam = client->config.wlen;
544 text->wset_selection(-1, -1, ibeam);
545 text->update(client->config.wtext);
546 send_configure_change();
550 void TitleWindow::update_color()
552 color_button->update_gui(client->config.color);
553 outline_button->update_gui(client->config.outline_color);
556 void TitleWindow::update_justification()
558 left->update(client->config.hjustification == JUSTIFY_LEFT);
559 center->update(client->config.hjustification == JUSTIFY_CENTER);
560 right->update(client->config.hjustification == JUSTIFY_RIGHT);
561 top->update(client->config.vjustification == JUSTIFY_TOP);
562 mid->update(client->config.vjustification == JUSTIFY_MID);
563 bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
566 void TitleWindow::update_stats()
568 text_chars->update(client->config.wlen);
571 void TitleWindow::update_gui()
573 title_x->update((int64_t)client->config.title_x);
574 title_y->update((int64_t)client->config.title_y);
575 title_w->update((int64_t)client->config.title_w);
576 title_h->update((int64_t)client->config.title_h);
577 drag->drag_x = client->config.title_x;
578 drag->drag_y = client->config.title_y;
579 drag->drag_w = client->config.title_w;
580 drag->drag_h = client->config.title_h;
581 italic->update(client->config.style & BC_FONT_ITALIC);
582 bold->update(client->config.style & BC_FONT_BOLD);
583 alias->update(client->config.style & FONT_ALIAS);
584 size->update(client->config.size);
585 motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
586 loop->update(client->config.loop);
587 dropshadow->update((int64_t)client->config.dropshadow);
588 fade_in->update((float)client->config.fade_in);
589 fade_out->update((float)client->config.fade_out);
590 font->update(client->config.font);
591 check_style(client->config.font,0);
592 wchr_t wz[1] = { 0 };
593 text->update(client->config.wtext ? &client->config.wtext[0] : wz);
594 speed->update(client->config.pixels_per_second);
595 outline->update((int64_t)client->config.outline_size);
597 stroker->update((int64_t)client->config.stroke_width);
599 timecode->update(client->config.timecode);
600 timecode_format->update(client->config.timecode_format);
601 background->update(client->config.background);
602 background_path->update(client->config.background_path);
603 loop_playback->update((int64_t)client->config.loop_playback);
605 char string[BCTEXTLEN];
606 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
607 if( timeunit_formats[i] == client->config.timecode_format ) {
608 timecode_format->set_text(
609 Units::print_time_format(timeunit_formats[i], string));
613 update_justification();
619 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
622 this->client = client;
623 this->window = window;
625 int TitleFontTumble::handle_up_event()
627 window->previous_font();
631 int TitleFontTumble::handle_down_event()
638 TitleSizeTumble::TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y)
641 this->client = client;
642 this->window = window;
645 int TitleSizeTumble::handle_up_event()
647 int current_index = -1;
648 int current_difference = -1;
649 for( int i=0; i<window->sizes.size(); ++i ) {
650 int size = atoi(window->sizes.get(i)->get_text());
651 if( current_index < 0 ||
652 abs(size - client->config.size) < current_difference ) {
654 current_difference = abs(size - client->config.size);
659 if( current_index >= window->sizes.size() ) current_index = 0;
662 client->config.size = atoi(window->sizes.get(current_index)->get_text());
663 window->size->update(client->config.size);
664 window->send_configure_change();
668 int TitleSizeTumble::handle_down_event()
670 int current_index = -1;
671 int current_difference = -1;
672 for( int i=0; i<window->sizes.size(); ++i ) {
673 int size = atoi(window->sizes.get(i)->get_text());
674 if( current_index < 0 ||
675 abs(size - client->config.size) < current_difference ) {
677 current_difference = abs(size - client->config.size);
682 if( current_index < 0 ) current_index = window->sizes.size() - 1;
685 client->config.size = atoi(window->sizes.get(current_index)->get_text());
686 window->size->update(client->config.size);
687 window->send_configure_change();
691 TitleAlias::TitleAlias(TitleMain *client, TitleWindow *window, int x, int y)
692 : BC_CheckBox(x, y, client->config.style & FONT_ALIAS, _("Smooth"))
694 this->client = client;
695 this->window = window;
698 int TitleAlias::handle_event()
700 client->config.style =
701 (client->config.style & ~FONT_ALIAS) |
702 (get_value() ? FONT_ALIAS : 0);
703 window->send_configure_change();
707 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
708 : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
710 this->client = client;
711 this->window = window;
714 int TitleBold::handle_event()
716 client->config.style =
717 (client->config.style & ~BC_FONT_BOLD) |
718 (get_value() ? BC_FONT_BOLD : 0);
719 window->send_configure_change();
723 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
724 : BC_CheckBox(x, y, client->config.style & BC_FONT_ITALIC, _("Italic"))
726 this->client = client;
727 this->window = window;
729 int TitleItalic::handle_event()
731 client->config.style =
732 (client->config.style & ~BC_FONT_ITALIC) |
733 (get_value() ? BC_FONT_ITALIC : 0);
734 window->send_configure_change();
740 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
741 : BC_PopupTextBox(window, &window->sizes, text, x, y, xS(64), yS(300))
743 this->client = client;
744 this->window = window;
746 TitleSize::~TitleSize()
749 int TitleSize::handle_event()
751 client->config.size = atol(get_text());
752 //printf("TitleSize::handle_event 1 %s\n", get_text());
753 window->send_configure_change();
756 void TitleSize::update(int size)
758 char string[BCTEXTLEN];
759 sprintf(string, "%d", size);
760 BC_PopupTextBox::update(string);
764 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value)
765 : BC_TumbleTextBox(window, *value, 0, INT_MAX, x, y, xS(64))
767 this->client = client;
768 this->window = window;
777 int TitlePitch::handle_event()
779 *value = atol(get_text());
780 window->send_configure_change();
784 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
785 : ColorCircleButton(_("Text Color"), x, y, COLOR_W, COLOR_H,
786 client->config.color, client->config.alpha, 1)
788 this->client = client;
789 this->window = window;
791 int TitleColorButton::handle_new_color(int output, int alpha)
793 client->config.color = output;
794 client->config.alpha = alpha;
795 window->send_configure_change();
798 void TitleColorButton::handle_done_event(int result)
801 handle_new_color(orig_color, orig_alpha);
802 window->lock_window("TitleColorButton::handle_done_event");
803 update_gui(orig_color);
804 window->unlock_window();
808 TitleOutlineColorButton::TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y)
809 : ColorCircleButton(_("Outline Color"), x, y, COLOR_W, COLOR_H,
810 client->config.outline_color, client->config.outline_alpha, 1)
812 this->client = client;
813 this->window = window;
815 int TitleOutlineColorButton::handle_new_color(int output, int alpha)
817 client->config.outline_color = output;
818 client->config.outline_alpha = alpha;
819 window->send_configure_change();
822 void TitleOutlineColorButton::handle_done_event(int result)
825 handle_new_color(orig_color, orig_alpha);
826 window->lock_window("TitleColorButton::handle_done_event");
827 update_gui(orig_color);
828 window->unlock_window();
833 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
834 : BC_PopupTextBox(window, &window->paths,
835 client->motion_to_text(client->config.motion_strategy),
836 x, y, xS(120), yS(100))
838 this->client = client;
839 this->window = window;
841 int TitleMotion::handle_event()
843 client->config.motion_strategy = client->text_to_motion(get_text());
844 window->send_configure_change();
848 TitleLoop::TitleLoop(TitleMain *client, TitleWindow *window, int x, int y)
849 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
851 this->client = client;
852 this->window = window;
854 int TitleLoop::handle_event()
856 client->config.loop = get_value();
857 window->send_configure_change();
860 TitleTimecode::TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y)
861 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
863 this->client = client;
864 this->window = window;
866 int TitleTimecode::handle_event()
868 client->config.timecode = get_value();
869 client->send_configure_change();
873 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
874 int x, int y, int tw, const char *text)
875 : BC_PopupMenu(x, y, BC_PopupMenu::calculate_w(tw)+xS(10), text, 1)
877 this->client = client;
878 this->window = window;
881 int TitleTimecodeFormat::handle_event()
883 client->config.timecode_format = Units::text_to_format(get_text());
884 window->send_configure_change();
888 void TitleTimecodeFormat::create_objects()
890 char string[BCTEXTLEN];
891 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
892 add_item(new BC_MenuItem(
893 Units::print_time_format(timeunit_formats[i], string)));
898 int TitleTimecodeFormat::update(int timecode_format)
900 char string[BCTEXTLEN];
901 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
902 if( timeunit_formats[i] == timecode_format ) {
903 set_text(Units::print_time_format(timeunit_formats[i], string));
910 TitleFade::TitleFade(TitleMain *client, TitleWindow *window,
911 double *value, int x, int y)
912 : BC_TextBox(x, y, xS(80), 1, (float)*value)
914 this->client = client;
915 this->window = window;
920 int TitleFade::handle_event()
922 *value = atof(get_text());
923 window->send_configure_change();
927 void TitleWindow::check_style(const char *font_name, int update)
929 BC_FontEntry *font_nrm = TitleMain::get_font(font_name, 0);
930 BC_FontEntry *font_itl = TitleMain::get_font(font_name, BC_FONT_ITALIC);
931 BC_FontEntry *font_bld = TitleMain::get_font(font_name, BC_FONT_BOLD);
932 BC_FontEntry *font_bit = TitleMain::get_font(font_name, BC_FONT_ITALIC | BC_FONT_BOLD);
933 int has_norm = font_nrm != 0 ? 1 : 0;
934 int has_ital = font_itl != 0 || font_bit != 0 ? 1 : 0;
935 int has_bold = font_bld != 0 || font_bit != 0 ? 1 : 0;
936 if( bold->get_value() ) {
937 if( !has_bold ) bold->update(0);
940 if( !has_norm && has_bold ) bold->update(1);
942 if( italic->get_value() ) {
943 if( !has_ital ) italic->update(0);
946 if( !has_norm && has_ital ) italic->update(1);
948 if( has_norm && has_bold ) bold->enable(); else bold->disable();
949 if( has_norm && has_ital ) italic->enable(); else italic->disable();
951 int style = stroker && atof(stroker->get_text()) ? BC_FONT_OUTLINE : 0;
952 if( bold->get_value() ) style |= BC_FONT_BOLD;
953 if( italic->get_value() ) style |= BC_FONT_ITALIC;
954 if( alias->get_value() ) style |= FONT_ALIAS;
955 client->config.style = style;
959 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
960 : BC_PopupTextBox(window, &window->fonts, client->config.font,
961 x, y, xS(340), yS(300), LISTBOX_ICON_LIST)
963 this->client = client;
964 this->window = window;
966 int TitleFont::handle_event()
968 strcpy(client->config.font, get_text());
969 window->check_style(client->config.font, 1);
970 window->send_configure_change();
974 TitleText::TitleText(TitleMain *client, TitleWindow *window,
975 int x, int y, int w, int h)
976 : BC_ScrollTextBox(window, x, y, w,
977 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
978 client->config.wtext, 0)
980 this->client = client;
981 this->window = window;
982 //printf("TitleText::TitleText %s\n", client->config.text);
985 int TitleText::button_press_event()
987 if( get_buttonpress() == 3 ) {
988 window->cur_ibeam = get_ibeam_letter();
989 window->cur_popup->activate_menu();
992 return BC_ScrollTextBox::button_press_event();
995 int TitleText::handle_event()
997 window->fonts_popup->deactivate();
998 const wchr_t *wtext = get_wtext();
999 long wlen = wstrlen(wtext);
1000 client->config.demand(wlen);
1001 wstrncpy(client->config.wtext, wtext, client->config.wsize);
1002 client->config.wlen = wlen;
1003 window->update_stats();
1004 window->send_configure_change();
1007 TitleTextChars::TitleTextChars(int x, int y, int w)
1008 : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
1011 TitleTextChars::~TitleTextChars()
1014 int TitleTextChars::update(int n)
1016 char text[BCSTRLEN];
1017 sprintf(text, _("chars: %d "),n);
1018 return BC_Title::update(text, 0);
1022 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
1023 : BC_TumbleTextBox(window, client->config.dropshadow,
1024 -1000, 1000, x, y, xS(70))
1026 this->client = client;
1027 this->window = window;
1029 int TitleDropShadow::handle_event()
1031 client->config.dropshadow = atol(get_text());
1032 window->send_configure_change();
1037 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
1038 : BC_TumbleTextBox(window, client->config.outline_size,
1039 0.f, 1000.f, x, y, xS(70))
1041 this->client = client;
1042 this->window = window;
1045 int TitleOutline::handle_event()
1047 client->config.outline_size = atof(get_text());
1048 window->send_configure_change();
1053 TitleStroker::TitleStroker(TitleMain *client, TitleWindow *window, int x, int y)
1054 : BC_TumbleTextBox(window, client->config.stroke_width,
1055 0.f, 1000.f, x, y, xS(70))
1057 this->client = client;
1058 this->window = window;
1061 int TitleStroker::handle_event()
1063 client->config.stroke_width = atof(get_text());
1064 if( client->config.stroke_width )
1065 client->config.style |= BC_FONT_OUTLINE;
1067 client->config.style &= ~BC_FONT_OUTLINE;
1068 window->send_configure_change();
1073 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
1074 : BC_TumbleTextBox(window, client->config.title_x,
1075 -32767.f, 32767.f, x, y, xS(50))
1077 this->client = client;
1078 this->window = window;
1081 int TitleX::handle_event()
1083 client->config.title_x = atof(get_text());
1084 window->update_drag();
1088 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
1089 : BC_TumbleTextBox(window, client->config.title_y,
1090 -32767.f, 32767.f, x, y, xS(50))
1092 this->client = client;
1093 this->window = window;
1096 int TitleY::handle_event()
1098 client->config.title_y = atof(get_text());
1099 window->update_drag();
1103 TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
1104 : BC_TumbleTextBox(window, client->config.title_w,
1105 0, 32767, x, y, xS(50))
1107 this->client = client;
1108 this->window = window;
1110 int TitleW::handle_event()
1112 client->config.title_w = atol(get_text());
1113 window->update_drag();
1117 TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
1118 : BC_TumbleTextBox(window, client->config.title_h,
1119 0, 32767, x, y, xS(50))
1121 this->client = client;
1122 this->window = window;
1124 int TitleH::handle_event()
1126 client->config.title_h = atol(get_text());
1127 window->update_drag();
1131 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
1132 : BC_TumbleTextBox(window, client->config.pixels_per_second,
1133 0.f, 1000.f, x, y, xS(100))
1135 this->client = client;
1136 this->window = window;
1142 int TitleSpeed::handle_event()
1144 client->config.pixels_per_second = atof(get_text());
1145 window->send_configure_change();
1150 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
1151 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
1153 this->client = client;
1154 this->window = window;
1156 int TitleLeft::handle_event()
1158 client->config.hjustification = JUSTIFY_LEFT;
1159 window->update_justification();
1160 window->send_configure_change();
1164 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
1165 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
1167 this->client = client;
1168 this->window = window;
1170 int TitleCenter::handle_event()
1172 client->config.hjustification = JUSTIFY_CENTER;
1173 window->update_justification();
1174 window->send_configure_change();
1178 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
1179 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
1181 this->client = client;
1182 this->window = window;
1184 int TitleRight::handle_event()
1186 client->config.hjustification = JUSTIFY_RIGHT;
1187 window->update_justification();
1188 window->send_configure_change();
1194 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
1195 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
1197 this->client = client;
1198 this->window = window;
1200 int TitleTop::handle_event()
1202 client->config.vjustification = JUSTIFY_TOP;
1203 window->update_justification();
1204 window->send_configure_change();
1208 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
1209 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
1211 this->client = client;
1212 this->window = window;
1214 int TitleMid::handle_event()
1216 client->config.vjustification = JUSTIFY_MID;
1217 window->update_justification();
1218 window->send_configure_change();
1222 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
1223 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
1225 this->client = client;
1226 this->window = window;
1228 int TitleBottom::handle_event()
1230 client->config.vjustification = JUSTIFY_BOTTOM;
1231 window->update_justification();
1232 window->send_configure_change();
1236 TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y)
1237 : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->drag,
1238 client->config.title_x, client->config.title_y,
1239 client->config.title_w, client->config.title_h)
1241 this->client = client;
1242 this->window = window;
1245 Track *TitleDrag::get_drag_track()
1247 PluginServer *server = client->server;
1248 int plugin_id = server->plugin_id;
1249 Plugin *plugin = server->edl->tracks->plugin_exists(plugin_id);
1250 return !plugin ? 0 : plugin->track;
1252 int64_t TitleDrag::get_drag_position()
1254 return client->get_source_position();
1257 void TitleDrag::update_gui()
1259 client->drag = get_value();
1260 client->config.title_x = drag_x;
1261 client->config.title_y = drag_y;
1262 client->config.title_w = drag_w+0.5;
1263 client->config.title_h = drag_h+0.5;
1264 window->title_x->update((float)client->config.title_x);
1265 window->title_y->update((float)client->config.title_y);
1266 window->title_w->update((int64_t)client->config.title_w);
1267 window->title_h->update((int64_t)client->config.title_h);
1268 window->send_configure_change();
1271 int TitleDrag::handle_event()
1273 int ret = DragCheckBox::handle_event();
1274 client->drag = get_value();
1275 window->send_configure_change();
1279 TitleBackground::TitleBackground(TitleMain *client, TitleWindow *window, int x, int y)
1280 : BC_CheckBox(x, y, client->config.background, _("Background:"))
1282 this->client = client;
1283 this->window = window;
1286 int TitleBackground::handle_event()
1288 client->config.background = get_value();
1289 window->send_configure_change();
1293 TitleBackgroundPath::TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y)
1294 : BC_TextBox(x, y, xS(240), 1, client->config.background_path)
1296 this->client = client;
1297 this->window = window;
1300 int TitleBackgroundPath::handle_event()
1302 strncpy(client->config.background_path, get_text(), sizeof(client->config.background_path));
1303 window->send_configure_change();
1307 TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y)
1308 : BC_CheckBox(x, y, client->config.loop_playback, _("Loop playback"))
1310 this->client = client;
1311 this->window = window;
1313 int TitleLoopPlayback::handle_event()
1315 client->config.loop_playback = get_value();
1316 window->send_configure_change();
1321 TitleCurPopup::TitleCurPopup(TitleMain *client, TitleWindow *window)
1322 : BC_PopupMenu(0, 0, 0, "", 0)
1324 this->client = client;
1325 this->window = window;
1327 int TitleCurPopup::handle_event()
1332 void TitleCurSubMenu::add_subitemx(int popup_type, va_list ap, const char *fmt)
1334 char item[BCSTRLEN];
1335 vsnprintf(item, sizeof(item)-1, fmt, ap);
1336 item[sizeof(item)-1] = 0;
1337 add_submenuitem(new TitleCurSubMenuItem(this, item, popup_type));
1340 void TitleCurPopup::create_objects()
1342 TitleCurItem *cur_item;
1343 TitleCurSubMenu *sub_menu;
1345 add_item(cur_item = new TitleCurItem(this, item = _(KW_NUDGE)));
1346 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1347 sub_menu->add_subitem("%s dx,dy",item);
1348 sub_menu->add_subitem("/%s",item);
1349 add_item(cur_item = new TitleCurItem(this, item = _(KW_COLOR)));
1350 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1351 sub_menu->add_subitem(POPUP_COLOR,"%s %s",item,_("#"));
1352 sub_menu->add_subitem("%s ",item);
1353 sub_menu->add_subitem("/%s",item);
1354 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALPHA)));
1355 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1356 sub_menu->add_subitem("%s ",item);
1357 sub_menu->add_subitem("%s 0.",item);
1358 sub_menu->add_subitem("%s .5",item);
1359 sub_menu->add_subitem("%s 1.",item);
1360 sub_menu->add_subitem("/%s",item);
1361 add_item(cur_item = new TitleCurItem(this, item = _(KW_FONT)));
1362 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1363 sub_menu->add_subitem(POPUP_FONT,"%s %s",item, _("name"));
1364 sub_menu->add_subitem(POPUP_OFFSET, "%s ",item);
1365 sub_menu->add_subitem("/%s",item);
1366 add_item(cur_item = new TitleCurItem(this, item = _(KW_SIZE)));
1367 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1368 sub_menu->add_subitem("%s +",item);
1369 sub_menu->add_subitem("%s -",item);
1370 sub_menu->add_subitem("%s ",item);
1371 sub_menu->add_subitem("/%s",item);
1372 add_item(cur_item = new TitleCurItem(this, item = _(KW_BOLD)));
1373 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1374 sub_menu->add_subitem("%s 1",item);
1375 sub_menu->add_subitem("%s 0",item);
1376 sub_menu->add_subitem("/%s",item);
1377 add_item(cur_item = new TitleCurItem(this, item = _(KW_ITALIC)));
1378 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1379 sub_menu->add_subitem("%s 1",item);
1380 sub_menu->add_subitem("%s 0",item);
1381 sub_menu->add_subitem("/%s",item);
1382 add_item(cur_item = new TitleCurItem(this, item = _(KW_CAPS)));
1383 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1384 sub_menu->add_subitem("%s 1",item);
1385 sub_menu->add_subitem("%s 0",item);
1386 sub_menu->add_subitem("%s -1",item);
1387 sub_menu->add_subitem("/%s",item);
1388 add_item(cur_item = new TitleCurItem(this, item = _(KW_UL)));
1389 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1390 sub_menu->add_subitem("%s 1",item);
1391 sub_menu->add_subitem("%s 0",item);
1392 sub_menu->add_subitem("/%s",item);
1393 add_item(cur_item = new TitleCurItem(this, item = _(KW_BLINK)));
1394 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1395 sub_menu->add_subitem("%s 1",item);
1396 sub_menu->add_subitem("%s -1",item);
1397 sub_menu->add_subitem("%s ",item);
1398 sub_menu->add_subitem("%s 0",item);
1399 sub_menu->add_subitem("/%s",item);
1400 add_item(cur_item = new TitleCurItem(this, item = _(KW_FIXED)));
1401 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1402 sub_menu->add_subitem("%s ",item);
1403 sub_menu->add_subitem("%s 20",item);
1404 sub_menu->add_subitem("%s 10",item);
1405 sub_menu->add_subitem("%s 0",item);
1406 sub_menu->add_subitem("/%s",item);
1407 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALIAS)));
1408 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1409 sub_menu->add_subitem("%s 1",item);
1410 sub_menu->add_subitem("%s 0",item);
1411 sub_menu->add_subitem("/%s",item);
1412 add_item(cur_item = new TitleCurItem(this, item = _(KW_SUP)));
1413 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1414 sub_menu->add_subitem("%s 1",item);
1415 sub_menu->add_subitem("%s 0",item);
1416 sub_menu->add_subitem("%s -1",item);
1417 sub_menu->add_subitem("/%s",item);
1418 add_item(cur_item = new TitleCurItem(this, item = _(KW_PNG)));
1419 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1420 sub_menu->add_subitem(POPUP_PNG,"%s %s", item, _("file"));
1423 TitleCurItem::TitleCurItem(TitleCurPopup *popup, const char *text)
1426 this->popup = popup;
1428 int TitleCurItem::handle_event()
1433 TitleCurSubMenu::TitleCurSubMenu(TitleCurItem *cur_item)
1435 this->cur_item = cur_item;
1437 TitleCurSubMenu::~TitleCurSubMenu()
1441 TitleCurSubMenuItem::TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type)
1444 this->submenu = submenu;
1445 this->popup_type = popup_type;
1447 TitleCurSubMenuItem::~TitleCurSubMenuItem()
1450 int TitleCurSubMenuItem::handle_event()
1452 TitleCurPopup *popup = submenu->cur_item->popup;
1453 TitleWindow *window = popup->window;
1454 const char *item_text = get_text();
1455 int ofs = *item_text == '/' ? 0 : -1;
1456 switch( popup_type ) {
1459 window->get_pop_cursor(px ,py);
1460 window->fonts_popup->activate(px, py, xS(300),yS(200));
1463 window->color_popup->activate();
1466 window->png_popup->activate();
1473 sprintf(txt, "<%s>", item_text);
1474 return window->insert_ibeam(txt, ofs);
1477 TitleFontsPopup::TitleFontsPopup(TitleMain *client, TitleWindow *window)
1478 : BC_ListBox(-1, -1, 1, 1, LISTBOX_ICON_LIST,
1479 &window->fonts, 0, 0, 1, 0, 1)
1481 this->client = client;
1482 this->window = window;
1486 TitleFontsPopup::~TitleFontsPopup()
1489 int TitleFontsPopup::keypress_event()
1491 switch( get_keypress() ) {
1499 return BC_ListBox::keypress_event();
1502 int TitleFontsPopup::handle_event()
1505 BC_ListBoxItem *item = get_selection(0, 0);
1506 if( !item ) return 1;
1507 const char *item_text = item->get_text();
1508 char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_FONT), item_text);
1509 return window->insert_ibeam(txt);
1512 TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
1513 : ColorPicker(0, _("Color"))
1515 this->client = client;
1516 this->window = window;
1517 this->color_value = client->config.color;
1519 TitleColorPopup::~TitleColorPopup()
1522 int TitleColorPopup::handle_new_color(int output, int alpha)
1524 color_value = output;
1527 int TitleColorPopup::activate()
1529 start_window(client->config.color, 255, 1);
1532 void TitleColorPopup::handle_done_event(int result)
1535 char txt[BCSTRLEN]; sprintf(txt, "<%s #%06x>", _(KW_COLOR), color_value);
1536 window->lock_window("TitleColorPopup::handle_done_event");
1537 window->insert_ibeam(txt);
1538 window->unlock_window();
1542 TitlePngPopup::TitlePngPopup(TitleMain *client, TitleWindow *window)
1545 this->client = client;
1546 this->window = window;
1549 TitlePngPopup::~TitlePngPopup()
1554 void TitlePngPopup::handle_done_event(int result)
1556 if( result ) return;
1557 BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui();
1558 const char *path = gui->get_submitted_path();
1559 char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
1560 window->lock_window("TitlePngPopup::handle_done_event");
1561 window->insert_ibeam(txt);
1562 window->unlock_window();
1565 BC_Window *TitlePngPopup::new_gui()
1567 MWindow *mwindow = client->server->mwindow;
1568 int x, y; mwindow->gui->get_abs_cursor(x, y);
1570 BC_Window *gui = new BrowseButtonWindow(mwindow->theme,
1571 x-xS(25), y-yS(100), window, "", _("Png file"), _("Png path"), 0);
1572 gui->create_objects();
1576 int TitlePngPopup::activate()
1578 BC_DialogThread::start();