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"
43 #include "titlerwindow.h"
44 #include "bcfontentry.h"
46 static const int timeunit_formats[] =
57 TitleWindow::TitleWindow(TitleMain *client)
58 : PluginClientWindow(client,
59 client->config.window_w, client->config.window_h, 100, 100, 1)
61 //printf("TitleWindow::TitleWindow %d %d %d\n", __LINE__, client->config.window_w, client->config.window_h);
62 this->client = client;
67 x_title = 0; title_x = 0;
68 y_title = 0; title_y = 0;
69 w_title = 0; title_w = 0;
70 h_title = 0; title_h = 0;
71 dropshadow_title = 0; dropshadow = 0;
72 outline_title = 0; outline = 0;
73 stroker_title = 0; stroker = 0;
82 drag_dx = drag_dy = dragging = 0;
107 left = 0; center = 0; right = 0;
108 top = 0; mid = 0; bottom = 0;
119 void TitleWindow::done_event(int result)
121 color_button->close_picker();
122 outline_button->close_picker();
123 drag->drag_deactivate();
124 delete color_popup; color_popup = 0;
125 delete png_popup; png_popup = 0;
129 TitleWindow::~TitleWindow()
133 for( int i=0; i<fonts.size(); ++i )
134 delete fonts[i]->get_icon();
136 sizes.remove_all_objects();
137 delete timecode_format;
142 void TitleWindow::create_objects()
145 int margin = client->get_theme()->widget_border;
146 char string[BCTEXTLEN];
150 client->build_previews(this);
152 sizes.append(new BC_ListBoxItem("8"));
153 sizes.append(new BC_ListBoxItem("9"));
154 sizes.append(new BC_ListBoxItem("10"));
155 sizes.append(new BC_ListBoxItem("11"));
156 sizes.append(new BC_ListBoxItem("12"));
157 sizes.append(new BC_ListBoxItem("13"));
158 sizes.append(new BC_ListBoxItem("14"));
159 sizes.append(new BC_ListBoxItem("16"));
160 sizes.append(new BC_ListBoxItem("18"));
161 sizes.append(new BC_ListBoxItem("20"));
162 sizes.append(new BC_ListBoxItem("22"));
163 sizes.append(new BC_ListBoxItem("24"));
164 sizes.append(new BC_ListBoxItem("26"));
165 sizes.append(new BC_ListBoxItem("28"));
166 sizes.append(new BC_ListBoxItem("32"));
167 sizes.append(new BC_ListBoxItem("36"));
168 sizes.append(new BC_ListBoxItem("40"));
169 sizes.append(new BC_ListBoxItem("48"));
170 sizes.append(new BC_ListBoxItem("56"));
171 sizes.append(new BC_ListBoxItem("64"));
172 sizes.append(new BC_ListBoxItem("72"));
173 sizes.append(new BC_ListBoxItem("100"));
174 sizes.append(new BC_ListBoxItem("128"));
175 sizes.append(new BC_ListBoxItem("256"));
176 sizes.append(new BC_ListBoxItem("512"));
177 sizes.append(new BC_ListBoxItem("1024"));
179 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
180 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
181 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
182 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
183 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
187 // Construct font list
188 ArrayList<BC_FontEntry*> *fontlist = get_resources()->fontlist;
190 for( int i=0; i<fontlist->size(); ++i ) {
192 for( int j=0; j<fonts.size(); ++j ) {
193 if( !strcasecmp(fonts.get(j)->get_text(),
194 fontlist->get(i)->displayname) ) {
200 BC_ListBoxItem *item = 0;
202 fonts.append(item = new
203 BC_ListBoxItem(fontlist->get(i)->displayname));
204 if( !strcmp(client->config.font, item->get_text()) )
205 item->set_selected(1);
206 if( fontlist->values[i]->image ) {
207 VFrame *vframe = fontlist->get(i)->image;
208 BC_Pixmap *icon = new BC_Pixmap(this, vframe, PIXMAP_ALPHA);
209 item->set_icon(icon);
210 item->set_icon_vframe(vframe);
219 for( int i=0; i<fonts.size()-1; ++i ) {
220 if( strcmp(fonts.values[i]->get_text(),
221 fonts.values[i + 1]->get_text()) > 0 ) {
222 BC_ListBoxItem *temp = fonts.values[i + 1];
223 fonts.values[i + 1] = fonts.values[i];
224 fonts.values[i] = temp;
230 add_tool(font_title = new BC_Title(x, y, _("Font:")));
231 font = new TitleFont(client, this, x, y + font_title->get_h());
232 font->create_objects();
233 font->set_show_query(1);
235 add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y+margin));
236 x += font_tumbler->get_w() + margin;
239 add_tool(size_title = new BC_Title(x1, y1+margin, _("Size:")));
240 sprintf(string, "%.2f", client->config.size);
241 x1 += size_title->get_w() + margin;
242 size = new TitleSize(client, this, x1, y1+margin, string);
243 size->create_objects();
244 int x2 = x1 + size->get_w(), y2 = y1 + size->get_h() + margin;
245 add_subwindow(size_tumbler = new TitleSizeTumble(client, this, x2, y1+margin));
247 add_tool(pitch_title = new BC_Title(x-5, y2+margin, _("Pitch:")));
248 pitch = new TitlePitch(client, this, x1, y2+margin, &client->config.line_pitch);
249 pitch->create_objects();
251 int x3 = x2 + size_tumbler->get_w() + 50;
252 int y3 = pitch->get_y() + pitch->get_h();
254 add_tool(style_title = new BC_Title(x=x3, y, _("Style:")));
255 add_tool(italic = new TitleItalic(client, this, x, y + 20));
256 int w1 = italic->get_w();
257 add_tool(bold = new TitleBold(client, this, x, y + 50));
258 if( bold->get_w() > w1 ) w1 = bold->get_w();
260 add_tool(drag = new TitleDrag(client, this, x, y + 80));
261 drag->create_objects();
262 if( drag->get_w() > w1 ) w1 = drag->get_w();
263 if( client->config.drag ) {
264 if( drag->drag_activate() )
265 eprintf("drag enabled, but compositor already grabbed\n");
268 add_tool(alias = new TitleAlias(client, this, x, y+110));
269 if( alias->get_w() > w1 ) w1 = drag->get_w();
272 add_tool(justify_title = new BC_Title(x+50, y, _("Justify:")));
273 add_tool(left = new TitleLeft(client, this, x, y + 20));
275 add_tool(center = new TitleCenter(client, this, x, y + 50));
276 if( center->get_w() > w1 ) w1 = center->get_w();
277 add_tool(right = new TitleRight(client, this, x, y + 80));
278 if( right->get_w() > w1 ) w1 = right->get_w();
281 add_tool(top = new TitleTop(client, this, x, y + 20));
282 add_tool(mid = new TitleMid(client, this, x, y + 50));
283 add_tool(bottom= new TitleBottom(client, this, x, y + 80));
288 w1 = BC_Title::calculate_w(this, _("X:"));
289 if( (x1 = BC_Title::calculate_w(this, _("Y:"))) > w1 ) w1 = x1;
290 if( (x1 = BC_Title::calculate_w(this, _("W:"))) > w1 ) w1 = x1;
291 if( (x1 = BC_Title::calculate_w(this, _("H:"))) > w1 ) w1 = x1;
292 add_tool(x_title = new BC_Title(x1=x, y, _("X:")));
294 title_x = new TitleX(client, this, x1, y);
295 title_x->create_objects();
296 x1 += title_x->get_w()+margin;
297 add_tool(y_title = new BC_Title(x1, y, _("Y:")));
299 title_y = new TitleY(client, this, x1, y);
300 title_y->create_objects();
301 x1 += title_y->get_w();
302 y1 = y + title_y->get_h();
304 add_tool(w_title = new BC_Title(x1=x, y1, _("W:")));
306 title_w = new TitleW(client, this, x1, y1);
307 title_w->create_objects();
308 x1 += title_w->get_w()+margin;
309 add_tool(h_title = new BC_Title(x1, y1, _("H:")));
311 title_h = new TitleH(client, this, x1, y1);
312 title_h->create_objects();
313 x1 += title_h->get_w();
316 add_tool(motion_title = new BC_Title(x1=x, y, _("Motion:")));
317 x1 += motion_title->get_w()+margin;
318 motion = new TitleMotion(client, this, x1, y);
319 motion->create_objects();
320 add_tool(loop = new TitleLoop(client, this, x, y1));
321 x = margin; y = y1 + loop->get_h()+20;
323 add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
324 w1 = dropshadow_title->get_w();
325 dropshadow = new TitleDropShadow(client, this, x, y + 20);
326 dropshadow->create_objects();
327 if( dropshadow->get_w() > w1 ) w1 = dropshadow->get_w();
330 add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
331 w1 = fadein_title->get_w();
332 add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
333 if( fade_in->get_w() > w1 ) w1 = fade_in->get_w();
336 add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
337 w1 = fadeout_title->get_w();
338 add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
339 if( fade_out->get_w() > w1 ) w1 = fade_out->get_w();
342 add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
343 w1 = speed_title->get_w();
344 y += speed_title->get_h() + 5; y1 = y;
345 speed = new TitleSpeed(client, this, x, y);
346 speed->create_objects();
347 if( speed->get_w() > w1 ) w1 = speed->get_w();
349 y2 = y + speed->get_h() + 10;
351 add_tool(color_button_title = new BC_Title(x3, y1+10, _("Color:")));
352 x1 = x3 + color_button_title->get_w() + 30;
353 add_tool(color_button = new TitleColorButton(client, this, x1, y1));
354 y1 += color_button->get_h() + 10;
355 add_tool(outline_button_title = new BC_Title(x3, y1+10, _("Outline:")));
356 add_tool(outline_button = new TitleOutlineColorButton(client, this, x1, y1));
359 add_tool(outline_title = new BC_Title(x, y, _("Outline:")));
360 y1 = y + outline_title->get_h() + margin;
361 outline = new TitleOutline(client, this, x, y1);
362 outline->create_objects();
363 x += outline->get_w() + 2*margin;
365 add_tool(stroker_title = new BC_Title(x, y, _("Stroker:")));
366 stroker = new TitleStroker(client, this, x, y1);
367 stroker->create_objects();
368 x += stroker->get_w() + margin;
370 add_tool(timecode = new TitleTimecode(client, this, x, y));
371 y += timecode->get_h() + margin;
373 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
375 Units::print_time_format(timeunit_formats[i], text);
376 int w = get_text_width(MEDIUMFONT, text);
379 add_tool(timecode_format = new TitleTimecodeFormat(client, this, x, y, tw,
380 Units::print_time_format(client->config.timecode_format, string)));
381 timecode_format->create_objects();
382 y += timecode_format->get_h() + margin;
385 add_tool(background = new TitleBackground(client, this, x, y));
386 x += background->get_w() + margin;
387 add_tool(background_path = new TitleBackgroundPath(client, this, x, y));
388 x += background_path->get_w() + margin;
389 add_tool(background_browse = new BrowseButton(
390 client->server->mwindow->theme, this, background_path,
391 x, y, "", _("background media"), _("Select background media path")));
392 x += background_browse->get_w() + 3*margin;
393 add_tool(loop_playback = new TitleLoopPlayback(client, this, x, y));
394 y += loop_playback->get_h() + 10;
397 add_tool(text_title = new BC_Title(x, y, _("Text:")));
398 x += text_title->get_w() + 20;
399 int wid = BC_Title::calculate_w(this,"0")*10;
400 add_tool(text_chars = new TitleTextChars(x,y,wid));
402 y += text_title->get_h() + margin;
404 text = new TitleText(client, this, x, y, get_w()-margin - x, get_h() - y - 10);
405 text->create_objects();
407 add_tool(cur_popup = new TitleCurPopup(client, this));
408 cur_popup->create_objects();
409 add_tool(fonts_popup = new TitleFontsPopup(client, this));
410 color_popup = new TitleColorPopup(client, this);
411 png_popup = new TitlePngPopup(client, this);
417 int TitleWindow::resize_event(int w, int h)
419 client->config.window_w = w;
420 client->config.window_h = h;
422 clear_box(0, 0, w, h);
423 font_title->reposition_window(font_title->get_x(), font_title->get_y());
424 font->reposition_window(font->get_x(), font->get_y());
425 font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
426 x_title->reposition_window(x_title->get_x(), x_title->get_y());
427 title_x->reposition_window(title_x->get_x(), title_x->get_y());
428 y_title->reposition_window(y_title->get_x(), y_title->get_y());
429 title_y->reposition_window(title_y->get_x(), title_y->get_y());
430 w_title->reposition_window(w_title->get_x(), w_title->get_y());
431 title_w->reposition_window(title_w->get_x(), title_w->get_y());
432 h_title->reposition_window(h_title->get_x(), h_title->get_y());
433 title_h->reposition_window(title_h->get_x(), title_h->get_y());
434 style_title->reposition_window(style_title->get_x(), style_title->get_y());
435 italic->reposition_window(italic->get_x(), italic->get_y());
436 bold->reposition_window(bold->get_x(), bold->get_y());
437 drag->reposition_window(drag->get_x(), drag->get_y());
438 alias->reposition_window(alias->get_x(), alias->get_y());
439 size_title->reposition_window(size_title->get_x(), size_title->get_y());
440 size->reposition_window(size->get_x(), size->get_y());
441 size_tumbler->reposition_window(size_tumbler->get_x(), size_tumbler->get_y());
442 pitch_title->reposition_window(pitch_title->get_x(), pitch_title->get_y());
443 pitch->reposition_window(pitch->get_x(), pitch->get_y());
445 color_button_title->reposition_window(color_button_title->get_x(), color_button_title->get_y());
446 color_button->reposition_window(color_button->get_x(), color_button->get_y());
447 outline_button_title->reposition_window(outline_button_title->get_x(), outline_button_title->get_y());
448 outline_button->reposition_window(outline_button->get_x(), outline_button->get_y());
449 motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
450 motion->reposition_window(motion->get_x(), motion->get_y());
451 loop->reposition_window(loop->get_x(), loop->get_y());
452 dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
453 dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
454 fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
455 fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
456 fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
457 fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
458 text_title->reposition_window(text_title->get_x(), text_title->get_y());
459 timecode->reposition_window(timecode->get_x(), timecode->get_y());
460 text->reposition_window(text->get_x(), text->get_y(), w - text->get_x() - 10,
461 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));
462 justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
463 left->reposition_window(left->get_x(), left->get_y());
464 center->reposition_window(center->get_x(), center->get_y());
465 right->reposition_window(right->get_x(), right->get_y());
466 top->reposition_window(top->get_x(), top->get_y());
467 mid->reposition_window(mid->get_x(), mid->get_y());
468 bottom->reposition_window(bottom->get_x(), bottom->get_y());
469 speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
470 speed->reposition_window(speed->get_x(), speed->get_y());
477 void TitleWindow::update_drag()
479 drag->drag_x = client->config.title_x;
480 drag->drag_y = client->config.title_y;
481 drag->drag_w = client->config.title_w;
482 drag->drag_h = client->config.title_h;
483 send_configure_change();
485 void TitleWindow::send_configure_change()
487 client->send_configure_change();
490 void TitleWindow::previous_font()
492 int current_font = font->get_number();
493 if( !fonts.total ) current_font = -1;
494 else if( --current_font < 0 ) current_font = fonts.total - 1;
495 font->set_number(current_font);
497 if( current_font < 0 || current_font >= fonts.total ) return;
499 for( int i=0; i<fonts.total; ++i ) {
500 fonts.values[i]->set_selected(i == current_font);
503 font->update(fonts.values[current_font]->get_text());
504 strcpy(client->config.font, fonts.values[current_font]->get_text());
505 check_style(client->config.font,1);
506 send_configure_change();
509 void TitleWindow::next_font()
511 int current_font = font->get_number();
512 if( !fonts.total ) current_font = -1;
513 else if( ++current_font >= fonts.total ) current_font = 0;
514 font->set_number(current_font);
516 if( current_font < 0 || current_font >= fonts.total ) return;
518 for( int i=0; i<fonts.total; ++i ) {
519 fonts.values[i]->set_selected(i == current_font);
522 font->update(fonts.values[current_font]->get_text());
523 strcpy(client->config.font, fonts.values[current_font]->get_text());
524 check_style(client->config.font,1);
525 send_configure_change();
528 int TitleWindow::insert_ibeam(const char *txt, int ofs)
530 int ibeam = cur_ibeam;
531 int ilen = strlen(txt)+1;
533 int len = BC_Resources::encode(client->config.encoding, BC_Resources::wide_encoding,
534 (char*)txt,ilen, (char *)wtxt,ilen*sizeof(wtxt[0])) / sizeof(wchar_t);
535 client->insert_text(wtxt, ibeam);
536 while( len > 0 && !wtxt[len] ) --len;
537 int adv = len+1 + ofs;
538 if( (ibeam += adv) >= client->config.wlen)
539 ibeam = client->config.wlen;
540 text->wset_selection(-1, -1, ibeam);
541 text->update(client->config.wtext);
542 send_configure_change();
546 void TitleWindow::update_color()
548 color_button->update_gui(client->config.color);
549 outline_button->update_gui(client->config.outline_color);
552 void TitleWindow::update_justification()
554 left->update(client->config.hjustification == JUSTIFY_LEFT);
555 center->update(client->config.hjustification == JUSTIFY_CENTER);
556 right->update(client->config.hjustification == JUSTIFY_RIGHT);
557 top->update(client->config.vjustification == JUSTIFY_TOP);
558 mid->update(client->config.vjustification == JUSTIFY_MID);
559 bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
562 void TitleWindow::update_stats()
564 text_chars->update(client->config.wlen);
567 void TitleWindow::update_gui()
569 title_x->update((int64_t)client->config.title_x);
570 title_y->update((int64_t)client->config.title_y);
571 title_w->update((int64_t)client->config.title_w);
572 title_h->update((int64_t)client->config.title_h);
573 italic->update(client->config.style & BC_FONT_ITALIC);
574 bold->update(client->config.style & BC_FONT_BOLD);
575 alias->update(client->config.style & FONT_ALIAS);
576 size->update(client->config.size);
577 motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
578 loop->update(client->config.loop);
579 dropshadow->update((int64_t)client->config.dropshadow);
580 fade_in->update((float)client->config.fade_in);
581 fade_out->update((float)client->config.fade_out);
582 font->update(client->config.font);
583 check_style(client->config.font,0);
584 text->update(client->config.wtext ? &client->config.wtext[0] : L"");
585 speed->update(client->config.pixels_per_second);
586 outline->update((int64_t)client->config.outline_size);
588 stroker->update((int64_t)client->config.stroke_width);
590 timecode->update(client->config.timecode);
591 timecode_format->update(client->config.timecode_format);
592 background->update(client->config.background);
593 background_path->update(client->config.background_path);
594 loop_playback->update((int64_t)client->config.loop_playback);
596 char string[BCTEXTLEN];
597 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
598 if( timeunit_formats[i] == client->config.timecode_format ) {
599 timecode_format->set_text(
600 Units::print_time_format(timeunit_formats[i], string));
604 update_justification();
610 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
613 this->client = client;
614 this->window = window;
616 int TitleFontTumble::handle_up_event()
618 window->previous_font();
622 int TitleFontTumble::handle_down_event()
629 TitleSizeTumble::TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y)
632 this->client = client;
633 this->window = window;
636 int TitleSizeTumble::handle_up_event()
638 int current_index = -1;
639 int current_difference = -1;
640 for( int i=0; i<window->sizes.size(); ++i ) {
641 int size = atoi(window->sizes.get(i)->get_text());
642 if( current_index < 0 ||
643 abs(size - client->config.size) < current_difference ) {
645 current_difference = abs(size - client->config.size);
650 if( current_index >= window->sizes.size() ) current_index = 0;
653 client->config.size = atoi(window->sizes.get(current_index)->get_text());
654 window->size->update(client->config.size);
655 window->send_configure_change();
659 int TitleSizeTumble::handle_down_event()
661 int current_index = -1;
662 int current_difference = -1;
663 for( int i=0; i<window->sizes.size(); ++i ) {
664 int size = atoi(window->sizes.get(i)->get_text());
665 if( current_index < 0 ||
666 abs(size - client->config.size) < current_difference ) {
668 current_difference = abs(size - client->config.size);
673 if( current_index < 0 ) current_index = window->sizes.size() - 1;
676 client->config.size = atoi(window->sizes.get(current_index)->get_text());
677 window->size->update(client->config.size);
678 window->send_configure_change();
682 TitleAlias::TitleAlias(TitleMain *client, TitleWindow *window, int x, int y)
683 : BC_CheckBox(x, y, client->config.style & FONT_ALIAS, _("Smooth"))
685 this->client = client;
686 this->window = window;
689 int TitleAlias::handle_event()
691 client->config.style =
692 (client->config.style & ~FONT_ALIAS) |
693 (get_value() ? FONT_ALIAS : 0);
694 window->send_configure_change();
698 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
699 : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
701 this->client = client;
702 this->window = window;
705 int TitleBold::handle_event()
707 client->config.style =
708 (client->config.style & ~BC_FONT_BOLD) |
709 (get_value() ? BC_FONT_BOLD : 0);
710 window->send_configure_change();
714 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
715 : BC_CheckBox(x, y, client->config.style & BC_FONT_ITALIC, _("Italic"))
717 this->client = client;
718 this->window = window;
720 int TitleItalic::handle_event()
722 client->config.style =
723 (client->config.style & ~BC_FONT_ITALIC) |
724 (get_value() ? BC_FONT_ITALIC : 0);
725 window->send_configure_change();
731 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
732 : BC_PopupTextBox(window, &window->sizes, text, x, y, 64, 300)
734 this->client = client;
735 this->window = window;
737 TitleSize::~TitleSize()
740 int TitleSize::handle_event()
742 client->config.size = atol(get_text());
743 //printf("TitleSize::handle_event 1 %s\n", get_text());
744 window->send_configure_change();
747 void TitleSize::update(int size)
749 char string[BCTEXTLEN];
750 sprintf(string, "%d", size);
751 BC_PopupTextBox::update(string);
755 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value)
756 : BC_TumbleTextBox(window, *value, 0, INT_MAX, x, y, 64)
758 this->client = client;
759 this->window = window;
768 int TitlePitch::handle_event()
770 *value = atol(get_text());
771 window->send_configure_change();
775 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
776 : ColorCircleButton(_("Text Color"), x, y, COLOR_W, COLOR_H,
777 client->config.color, client->config.alpha, 1)
779 this->client = client;
780 this->window = window;
782 int TitleColorButton::handle_new_color(int output, int alpha)
784 client->config.color = output;
785 client->config.alpha = alpha;
786 window->send_configure_change();
789 void TitleColorButton::handle_done_event(int result)
792 handle_new_color(orig_color, orig_alpha);
793 window->lock_window("TitleColorButton::handle_done_event");
794 update_gui(orig_color);
795 window->unlock_window();
799 TitleOutlineColorButton::TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y)
800 : ColorCircleButton(_("Outline Color"), x, y, COLOR_W, COLOR_H,
801 client->config.outline_color, client->config.outline_alpha, 1)
803 this->client = client;
804 this->window = window;
806 int TitleOutlineColorButton::handle_new_color(int output, int alpha)
808 client->config.outline_color = output;
809 client->config.outline_alpha = alpha;
810 window->send_configure_change();
813 void TitleOutlineColorButton::handle_done_event(int result)
816 handle_new_color(orig_color, orig_alpha);
817 window->lock_window("TitleColorButton::handle_done_event");
818 update_gui(orig_color);
819 window->unlock_window();
824 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
825 : BC_PopupTextBox(window, &window->paths,
826 client->motion_to_text(client->config.motion_strategy),
829 this->client = client;
830 this->window = window;
832 int TitleMotion::handle_event()
834 client->config.motion_strategy = client->text_to_motion(get_text());
835 window->send_configure_change();
839 TitleLoop::TitleLoop(TitleMain *client, TitleWindow *window, int x, int y)
840 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
842 this->client = client;
843 this->window = window;
845 int TitleLoop::handle_event()
847 client->config.loop = get_value();
848 window->send_configure_change();
851 TitleTimecode::TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y)
852 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
854 this->client = client;
855 this->window = window;
857 int TitleTimecode::handle_event()
859 client->config.timecode = get_value();
860 client->send_configure_change();
864 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
865 int x, int y, int tw, const char *text)
866 : BC_PopupMenu(x, y, BC_PopupMenu::calculate_w(tw)+10, text, 1)
868 this->client = client;
869 this->window = window;
872 int TitleTimecodeFormat::handle_event()
874 client->config.timecode_format = Units::text_to_format(get_text());
875 window->send_configure_change();
879 void TitleTimecodeFormat::create_objects()
881 char string[BCTEXTLEN];
882 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
883 add_item(new BC_MenuItem(
884 Units::print_time_format(timeunit_formats[i], string)));
889 int TitleTimecodeFormat::update(int timecode_format)
891 char string[BCTEXTLEN];
892 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
893 if( timeunit_formats[i] == timecode_format ) {
894 set_text(Units::print_time_format(timeunit_formats[i], string));
901 TitleFade::TitleFade(TitleMain *client, TitleWindow *window,
902 double *value, int x, int y)
903 : BC_TextBox(x, y, 80, 1, (float)*value)
905 this->client = client;
906 this->window = window;
911 int TitleFade::handle_event()
913 *value = atof(get_text());
914 window->send_configure_change();
918 void TitleWindow::check_style(const char *font_name, int update)
920 BC_FontEntry *font_nrm = TitleMain::get_font(font_name, 0);
921 BC_FontEntry *font_itl = TitleMain::get_font(font_name, BC_FONT_ITALIC);
922 BC_FontEntry *font_bld = TitleMain::get_font(font_name, BC_FONT_BOLD);
923 BC_FontEntry *font_bit = TitleMain::get_font(font_name, BC_FONT_ITALIC | BC_FONT_BOLD);
924 int has_norm = font_nrm != 0 ? 1 : 0;
925 int has_ital = font_itl != 0 || font_bit != 0 ? 1 : 0;
926 int has_bold = font_bld != 0 || font_bit != 0 ? 1 : 0;
927 if( bold->get_value() ) {
928 if( !has_bold ) bold->update(0);
931 if( !has_norm && has_bold ) bold->update(1);
933 if( italic->get_value() ) {
934 if( !has_ital ) italic->update(0);
937 if( !has_norm && has_ital ) italic->update(1);
939 if( has_norm && has_bold ) bold->enable(); else bold->disable();
940 if( has_norm && has_ital ) italic->enable(); else italic->disable();
942 int style = stroker && atof(stroker->get_text()) ? BC_FONT_OUTLINE : 0;
943 if( bold->get_value() ) style |= BC_FONT_BOLD;
944 if( italic->get_value() ) style |= BC_FONT_ITALIC;
945 if( alias->get_value() ) style |= FONT_ALIAS;
946 client->config.style = style;
950 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
951 : BC_PopupTextBox(window, &window->fonts, client->config.font,
952 x, y, 340, 300, LISTBOX_ICON_LIST)
954 this->client = client;
955 this->window = window;
957 int TitleFont::handle_event()
959 strcpy(client->config.font, get_text());
960 window->check_style(client->config.font, 1);
961 window->send_configure_change();
965 TitleText::TitleText(TitleMain *client, TitleWindow *window,
966 int x, int y, int w, int h)
967 : BC_ScrollTextBox(window, x, y, w,
968 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
969 client->config.wtext, 0)
971 this->client = client;
972 this->window = window;
973 //printf("TitleText::TitleText %s\n", client->config.text);
976 int TitleText::button_press_event()
978 if( get_buttonpress() == 3 ) {
979 window->cur_ibeam = get_ibeam_letter();
980 window->cur_popup->activate_menu();
983 return BC_ScrollTextBox::button_press_event();
986 int TitleText::handle_event()
988 window->fonts_popup->deactivate();
989 const wchar_t *wtext = get_wtext();
990 long wlen = wcslen(wtext);
991 client->config.demand(wlen);
992 wcsncpy(client->config.wtext, wtext, client->config.wsize);
993 client->config.wlen = wlen;
994 window->update_stats();
995 window->send_configure_change();
998 TitleTextChars::TitleTextChars(int x, int y, int w)
999 : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
1002 TitleTextChars::~TitleTextChars()
1005 int TitleTextChars::update(int n)
1007 char text[BCSTRLEN];
1008 sprintf(text, _("chars: %d "),n);
1009 return BC_Title::update(text, 0);
1013 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
1014 : BC_TumbleTextBox(window, client->config.dropshadow,
1015 -1000, 1000, x, y, 70)
1017 this->client = client;
1018 this->window = window;
1020 int TitleDropShadow::handle_event()
1022 client->config.dropshadow = atol(get_text());
1023 window->send_configure_change();
1028 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
1029 : BC_TumbleTextBox(window, client->config.outline_size,
1030 0.f, 1000.f, x, y, 70)
1032 this->client = client;
1033 this->window = window;
1036 int TitleOutline::handle_event()
1038 client->config.outline_size = atof(get_text());
1039 window->send_configure_change();
1044 TitleStroker::TitleStroker(TitleMain *client, TitleWindow *window, int x, int y)
1045 : BC_TumbleTextBox(window, client->config.stroke_width,
1046 0.f, 1000.f, x, y, 70)
1048 this->client = client;
1049 this->window = window;
1052 int TitleStroker::handle_event()
1054 client->config.stroke_width = atof(get_text());
1055 if( client->config.stroke_width )
1056 client->config.style |= BC_FONT_OUTLINE;
1058 client->config.style &= ~BC_FONT_OUTLINE;
1059 window->send_configure_change();
1064 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
1065 : BC_TumbleTextBox(window, client->config.title_x,
1066 -32767.f, 32767.f, x, y, 50)
1068 this->client = client;
1069 this->window = window;
1072 int TitleX::handle_event()
1074 client->config.title_x = atof(get_text());
1075 window->update_drag();
1079 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
1080 : BC_TumbleTextBox(window, client->config.title_y,
1081 -32767.f, 32767.f, x, y, 50)
1083 this->client = client;
1084 this->window = window;
1087 int TitleY::handle_event()
1089 client->config.title_y = atof(get_text());
1090 window->update_drag();
1094 TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
1095 : BC_TumbleTextBox(window, client->config.title_w,
1098 this->client = client;
1099 this->window = window;
1101 int TitleW::handle_event()
1103 client->config.title_w = atol(get_text());
1104 window->update_drag();
1108 TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
1109 : BC_TumbleTextBox(window, client->config.title_h,
1112 this->client = client;
1113 this->window = window;
1115 int TitleH::handle_event()
1117 client->config.title_h = atol(get_text());
1118 window->update_drag();
1122 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
1123 : BC_TumbleTextBox(window, client->config.pixels_per_second,
1124 0.f, 1000.f, x, y, 100)
1126 this->client = client;
1127 this->window = window;
1133 int TitleSpeed::handle_event()
1135 client->config.pixels_per_second = atof(get_text());
1136 window->send_configure_change();
1141 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
1142 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
1144 this->client = client;
1145 this->window = window;
1147 int TitleLeft::handle_event()
1149 client->config.hjustification = JUSTIFY_LEFT;
1150 window->update_justification();
1151 window->send_configure_change();
1155 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
1156 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
1158 this->client = client;
1159 this->window = window;
1161 int TitleCenter::handle_event()
1163 client->config.hjustification = JUSTIFY_CENTER;
1164 window->update_justification();
1165 window->send_configure_change();
1169 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
1170 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
1172 this->client = client;
1173 this->window = window;
1175 int TitleRight::handle_event()
1177 client->config.hjustification = JUSTIFY_RIGHT;
1178 window->update_justification();
1179 window->send_configure_change();
1185 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
1186 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
1188 this->client = client;
1189 this->window = window;
1191 int TitleTop::handle_event()
1193 client->config.vjustification = JUSTIFY_TOP;
1194 window->update_justification();
1195 window->send_configure_change();
1199 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
1200 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
1202 this->client = client;
1203 this->window = window;
1205 int TitleMid::handle_event()
1207 client->config.vjustification = JUSTIFY_MID;
1208 window->update_justification();
1209 window->send_configure_change();
1213 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
1214 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
1216 this->client = client;
1217 this->window = window;
1219 int TitleBottom::handle_event()
1221 client->config.vjustification = JUSTIFY_BOTTOM;
1222 window->update_justification();
1223 window->send_configure_change();
1227 TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y)
1228 : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->config.drag,
1229 client->config.title_x, client->config.title_y,
1230 client->config.title_w, client->config.title_h)
1232 this->client = client;
1233 this->window = window;
1236 Track *TitleDrag::get_drag_track()
1238 return !client->server->plugin ? 0 :
1239 client->server->plugin->track;
1241 int64_t TitleDrag::get_drag_position()
1243 return client->get_source_position();
1246 void TitleDrag::update_gui()
1248 client->config.drag = get_value();
1249 client->config.title_x = drag_x;
1250 client->config.title_y = drag_y;
1251 client->config.title_w = drag_w+0.5;
1252 client->config.title_h = drag_h+0.5;
1253 window->title_x->update((float)client->config.title_x);
1254 window->title_y->update((float)client->config.title_y);
1255 window->title_w->update((int64_t)client->config.title_w);
1256 window->title_h->update((int64_t)client->config.title_h);
1257 window->send_configure_change();
1260 int TitleDrag::handle_event()
1262 int ret = DragCheckBox::handle_event();
1263 window->send_configure_change();
1267 TitleBackground::TitleBackground(TitleMain *client, TitleWindow *window, int x, int y)
1268 : BC_CheckBox(x, y, client->config.background, _("Background:"))
1270 this->client = client;
1271 this->window = window;
1274 int TitleBackground::handle_event()
1276 client->config.background = get_value();
1277 window->send_configure_change();
1281 TitleBackgroundPath::TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y)
1282 : BC_TextBox(x, y, 240, 1, client->config.background_path)
1284 this->client = client;
1285 this->window = window;
1288 int TitleBackgroundPath::handle_event()
1290 strncpy(client->config.background_path, get_text(), sizeof(client->config.background_path));
1291 window->send_configure_change();
1295 TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y)
1296 : BC_CheckBox(x, y, client->config.loop_playback, _("Loop playback"))
1298 this->client = client;
1299 this->window = window;
1301 int TitleLoopPlayback::handle_event()
1303 client->config.loop_playback = get_value();
1304 window->send_configure_change();
1309 TitleCurPopup::TitleCurPopup(TitleMain *client, TitleWindow *window)
1310 : BC_PopupMenu(0, 0, 0, "", 0)
1312 this->client = client;
1313 this->window = window;
1315 int TitleCurPopup::handle_event()
1320 void TitleCurSubMenu::add_subitemx(int popup_type, va_list ap, const char *fmt)
1322 char item[BCSTRLEN];
1323 vsnprintf(item, sizeof(item)-1, fmt, ap);
1324 item[sizeof(item)-1] = 0;
1325 add_submenuitem(new TitleCurSubMenuItem(this, item, popup_type));
1328 void TitleCurPopup::create_objects()
1330 TitleCurItem *cur_item;
1331 TitleCurSubMenu *sub_menu;
1333 add_item(cur_item = new TitleCurItem(this, item = _(KW_NUDGE)));
1334 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1335 sub_menu->add_subitem("%s dx,dy",item);
1336 sub_menu->add_subitem("/%s",item);
1337 add_item(cur_item = new TitleCurItem(this, item = _(KW_COLOR)));
1338 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1339 sub_menu->add_subitem(POPUP_COLOR,"%s %s",item,_("#"));
1340 sub_menu->add_subitem("%s ",item);
1341 sub_menu->add_subitem("/%s",item);
1342 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALPHA)));
1343 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1344 sub_menu->add_subitem("%s ",item);
1345 sub_menu->add_subitem("%s 0.",item);
1346 sub_menu->add_subitem("%s .5",item);
1347 sub_menu->add_subitem("%s 1.",item);
1348 sub_menu->add_subitem("/%s",item);
1349 add_item(cur_item = new TitleCurItem(this, item = _(KW_FONT)));
1350 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1351 sub_menu->add_subitem(POPUP_FONT,"%s %s",item, _("name"));
1352 sub_menu->add_subitem(POPUP_OFFSET, "%s ",item);
1353 sub_menu->add_subitem("/%s",item);
1354 add_item(cur_item = new TitleCurItem(this, item = _(KW_SIZE)));
1355 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1356 sub_menu->add_subitem("%s +",item);
1357 sub_menu->add_subitem("%s -",item);
1358 sub_menu->add_subitem("%s ",item);
1359 sub_menu->add_subitem("/%s",item);
1360 add_item(cur_item = new TitleCurItem(this, item = _(KW_BOLD)));
1361 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1362 sub_menu->add_subitem("%s 1",item);
1363 sub_menu->add_subitem("%s 0",item);
1364 sub_menu->add_subitem("/%s",item);
1365 add_item(cur_item = new TitleCurItem(this, item = _(KW_ITALIC)));
1366 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1367 sub_menu->add_subitem("%s 1",item);
1368 sub_menu->add_subitem("%s 0",item);
1369 sub_menu->add_subitem("/%s",item);
1370 add_item(cur_item = new TitleCurItem(this, item = _(KW_CAPS)));
1371 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1372 sub_menu->add_subitem("%s 1",item);
1373 sub_menu->add_subitem("%s 0",item);
1374 sub_menu->add_subitem("%s -1",item);
1375 sub_menu->add_subitem("/%s",item);
1376 add_item(cur_item = new TitleCurItem(this, item = _(KW_UL)));
1377 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1378 sub_menu->add_subitem("%s 1",item);
1379 sub_menu->add_subitem("%s 0",item);
1380 sub_menu->add_subitem("/%s",item);
1381 add_item(cur_item = new TitleCurItem(this, item = _(KW_BLINK)));
1382 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1383 sub_menu->add_subitem("%s 1",item);
1384 sub_menu->add_subitem("%s -1",item);
1385 sub_menu->add_subitem("%s ",item);
1386 sub_menu->add_subitem("%s 0",item);
1387 sub_menu->add_subitem("/%s",item);
1388 add_item(cur_item = new TitleCurItem(this, item = _(KW_FIXED)));
1389 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1390 sub_menu->add_subitem("%s ",item);
1391 sub_menu->add_subitem("%s 20",item);
1392 sub_menu->add_subitem("%s 10",item);
1393 sub_menu->add_subitem("%s 0",item);
1394 sub_menu->add_subitem("/%s",item);
1395 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALIAS)));
1396 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1397 sub_menu->add_subitem("%s 1",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_SUP)));
1401 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1402 sub_menu->add_subitem("%s 1",item);
1403 sub_menu->add_subitem("%s 0",item);
1404 sub_menu->add_subitem("%s -1",item);
1405 sub_menu->add_subitem("/%s",item);
1406 add_item(cur_item = new TitleCurItem(this, item = _(KW_PNG)));
1407 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1408 sub_menu->add_subitem(POPUP_PNG,"%s %s", item, _("file"));
1411 TitleCurItem::TitleCurItem(TitleCurPopup *popup, const char *text)
1414 this->popup = popup;
1416 int TitleCurItem::handle_event()
1421 TitleCurSubMenu::TitleCurSubMenu(TitleCurItem *cur_item)
1423 this->cur_item = cur_item;
1425 TitleCurSubMenu::~TitleCurSubMenu()
1429 TitleCurSubMenuItem::TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type)
1432 this->submenu = submenu;
1433 this->popup_type = popup_type;
1435 TitleCurSubMenuItem::~TitleCurSubMenuItem()
1438 int TitleCurSubMenuItem::handle_event()
1440 TitleCurPopup *popup = submenu->cur_item->popup;
1441 TitleWindow *window = popup->window;
1442 const char *item_text = get_text();
1443 int ofs = *item_text == '/' ? 0 : -1;
1444 switch( popup_type ) {
1447 window->get_pop_cursor(px ,py);
1448 window->fonts_popup->activate(px, py, 300,200);
1451 window->color_popup->activate();
1454 window->png_popup->activate();
1461 sprintf(txt, "<%s>", item_text);
1462 return window->insert_ibeam(txt, ofs);
1465 TitleFontsPopup::TitleFontsPopup(TitleMain *client, TitleWindow *window)
1466 : BC_ListBox(-1, -1, 1, 1, LISTBOX_ICON_LIST,
1467 &window->fonts, 0, 0, 1, 0, 1)
1469 this->client = client;
1470 this->window = window;
1474 TitleFontsPopup::~TitleFontsPopup()
1477 int TitleFontsPopup::keypress_event()
1479 switch( get_keypress() ) {
1487 return BC_ListBox::keypress_event();
1490 int TitleFontsPopup::handle_event()
1493 BC_ListBoxItem *item = get_selection(0, 0);
1494 if( !item ) return 1;
1495 const char *item_text = item->get_text();
1496 char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_FONT), item_text);
1497 return window->insert_ibeam(txt);
1500 TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
1501 : ColorPicker(0, _("Color"))
1503 this->client = client;
1504 this->window = window;
1505 this->color_value = client->config.color;
1507 TitleColorPopup::~TitleColorPopup()
1510 int TitleColorPopup::handle_new_color(int output, int alpha)
1512 color_value = output;
1515 int TitleColorPopup::activate()
1517 start_window(client->config.color, 255, 1);
1520 void TitleColorPopup::handle_done_event(int result)
1523 char txt[BCSTRLEN]; sprintf(txt, "<%s #%06x>", _(KW_COLOR), color_value);
1524 window->lock_window("TitleColorPopup::handle_done_event");
1525 window->insert_ibeam(txt);
1526 window->unlock_window();
1530 TitlePngPopup::TitlePngPopup(TitleMain *client, TitleWindow *window)
1533 this->client = client;
1534 this->window = window;
1537 TitlePngPopup::~TitlePngPopup()
1542 void TitlePngPopup::handle_done_event(int result)
1544 if( result ) return;
1545 BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui();
1546 const char *path = gui->get_submitted_path();
1547 char txt[BCSTRLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
1548 window->lock_window("TitlePngPopup::handle_done_event");
1549 window->insert_ibeam(txt);
1550 window->unlock_window();
1553 BC_Window *TitlePngPopup::new_gui()
1555 MWindow *mwindow = client->server->mwindow;
1556 int x, y; mwindow->gui->get_abs_cursor(x, y);
1558 BC_Window *gui = new BrowseButtonWindow(mwindow->theme,
1559 x-25, y-100, window, "", _("Png file"), _("Png path"), 0);
1560 gui->create_objects();
1564 int TitlePngPopup::activate()
1566 BC_DialogThread::start();