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,
62 //printf("TitleWindow::TitleWindow %d %d %d\n", __LINE__, client->config.window_w, client->config.window_h);
63 this->client = client;
68 x_title = 0; title_x = 0;
69 y_title = 0; title_y = 0;
70 w_title = 0; title_w = 0;
71 h_title = 0; title_h = 0;
72 dropshadow_title = 0; dropshadow = 0;
73 outline_title = 0; outline = 0;
74 stroker_title = 0; stroker = 0;
83 drag_dx = drag_dy = dragging = 0;
108 left = 0; center = 0; right = 0;
109 top = 0; mid = 0; bottom = 0;
120 void TitleWindow::done_event(int result)
122 color_button->close_picker();
123 outline_button->close_picker();
124 drag->drag_deactivate();
125 delete color_popup; color_popup = 0;
126 delete png_popup; png_popup = 0;
130 TitleWindow::~TitleWindow()
134 for( int i=0; i<fonts.size(); ++i )
135 delete fonts[i]->get_icon();
137 sizes.remove_all_objects();
138 delete timecode_format;
143 void TitleWindow::create_objects()
145 int x = xS(10), y = yS(10);
146 int margin = client->get_theme()->widget_border;
147 char string[BCTEXTLEN];
149 #define COLOR_W xS(50)
150 #define COLOR_H yS(30)
151 client->build_previews(this);
153 sizes.append(new BC_ListBoxItem("8"));
154 sizes.append(new BC_ListBoxItem("9"));
155 sizes.append(new BC_ListBoxItem("10"));
156 sizes.append(new BC_ListBoxItem("11"));
157 sizes.append(new BC_ListBoxItem("12"));
158 sizes.append(new BC_ListBoxItem("13"));
159 sizes.append(new BC_ListBoxItem("14"));
160 sizes.append(new BC_ListBoxItem("16"));
161 sizes.append(new BC_ListBoxItem("18"));
162 sizes.append(new BC_ListBoxItem("20"));
163 sizes.append(new BC_ListBoxItem("22"));
164 sizes.append(new BC_ListBoxItem("24"));
165 sizes.append(new BC_ListBoxItem("26"));
166 sizes.append(new BC_ListBoxItem("28"));
167 sizes.append(new BC_ListBoxItem("32"));
168 sizes.append(new BC_ListBoxItem("36"));
169 sizes.append(new BC_ListBoxItem("40"));
170 sizes.append(new BC_ListBoxItem("48"));
171 sizes.append(new BC_ListBoxItem("56"));
172 sizes.append(new BC_ListBoxItem("64"));
173 sizes.append(new BC_ListBoxItem("72"));
174 sizes.append(new BC_ListBoxItem("100"));
175 sizes.append(new BC_ListBoxItem("128"));
176 sizes.append(new BC_ListBoxItem("256"));
177 sizes.append(new BC_ListBoxItem("512"));
178 sizes.append(new BC_ListBoxItem("1024"));
180 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
181 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
182 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
183 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
184 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
188 // Construct font list
189 ArrayList<BC_FontEntry*> *fontlist = get_resources()->fontlist;
191 for( int i=0; i<fontlist->size(); ++i ) {
193 for( int j=0; j<fonts.size(); ++j ) {
194 if( !strcasecmp(fonts.get(j)->get_text(),
195 fontlist->get(i)->displayname) ) {
201 BC_ListBoxItem *item = 0;
203 fonts.append(item = new
204 BC_ListBoxItem(fontlist->get(i)->displayname));
205 if( !strcmp(client->config.font, item->get_text()) )
206 item->set_selected(1);
207 if( fontlist->values[i]->image ) {
208 VFrame *vframe = fontlist->get(i)->image;
209 BC_Pixmap *icon = new BC_Pixmap(this, vframe, PIXMAP_ALPHA);
210 item->set_icon(icon);
211 item->set_icon_vframe(vframe);
220 for( int i=0; i<fonts.size()-1; ++i ) {
221 if( strcmp(fonts.values[i]->get_text(),
222 fonts.values[i + 1]->get_text()) > 0 ) {
223 BC_ListBoxItem *temp = fonts.values[i + 1];
224 fonts.values[i + 1] = fonts.values[i];
225 fonts.values[i] = temp;
231 add_tool(font_title = new BC_Title(x, y, _("Font:")));
232 font = new TitleFont(client, this, x, y + font_title->get_h());
233 font->create_objects();
234 font->set_show_query(1);
236 add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y+margin));
237 x += font_tumbler->get_w() + margin;
240 add_tool(size_title = new BC_Title(x1, y1+margin, _("Size:")));
241 sprintf(string, "%.2f", client->config.size);
242 x1 += size_title->get_w() + margin;
243 size = new TitleSize(client, this, x1, y1+margin, string);
244 size->create_objects();
245 int x2 = x1 + size->get_w(), y2 = y1 + size->get_h() + margin;
246 add_subwindow(size_tumbler = new TitleSizeTumble(client, this, x2, y1+margin));
248 add_tool(pitch_title = new BC_Title(x-xS(5), y2+margin, _("Pitch:")));
249 pitch = new TitlePitch(client, this, x1, y2+margin, &client->config.line_pitch);
250 pitch->create_objects();
252 int x3 = x2 + size_tumbler->get_w() + xS(50);
253 int y3 = pitch->get_y() + pitch->get_h();
255 add_tool(style_title = new BC_Title(x=x3, y, _("Style:")));
256 add_tool(italic = new TitleItalic(client, this, x, y + yS(20)));
257 int w1 = italic->get_w();
258 add_tool(bold = new TitleBold(client, this, x, y + yS(50)));
259 if( bold->get_w() > w1 ) w1 = bold->get_w();
261 add_tool(drag = new TitleDrag(client, this, x, y + yS(80)));
262 drag->create_objects();
263 if( drag->get_w() > w1 ) w1 = drag->get_w();
264 if( client->config.drag ) {
265 if( drag->drag_activate() )
266 eprintf("drag enabled, but compositor already grabbed\n");
269 add_tool(alias = new TitleAlias(client, this, x, y+yS(110)));
270 if( alias->get_w() > w1 ) w1 = drag->get_w();
273 add_tool(justify_title = new BC_Title(x+xS(50), y, _("Justify:")));
274 add_tool(left = new TitleLeft(client, this, x, y + yS(20)));
276 add_tool(center = new TitleCenter(client, this, x, y + yS(50)));
277 if( center->get_w() > w1 ) w1 = center->get_w();
278 add_tool(right = new TitleRight(client, this, x, y + yS(80)));
279 if( right->get_w() > w1 ) w1 = right->get_w();
282 add_tool(top = new TitleTop(client, this, x, y + yS(20)));
283 add_tool(mid = new TitleMid(client, this, x, y + yS(50)));
284 add_tool(bottom= new TitleBottom(client, this, x, y + yS(80)));
289 w1 = BC_Title::calculate_w(this, _("X:"));
290 if( (x1 = BC_Title::calculate_w(this, _("Y:"))) > w1 ) w1 = x1;
291 if( (x1 = BC_Title::calculate_w(this, _("W:"))) > w1 ) w1 = x1;
292 if( (x1 = BC_Title::calculate_w(this, _("H:"))) > w1 ) w1 = x1;
293 add_tool(x_title = new BC_Title(x1=x, y, _("X:")));
295 title_x = new TitleX(client, this, x1, y);
296 title_x->create_objects();
297 x1 += title_x->get_w()+margin;
298 add_tool(y_title = new BC_Title(x1, y, _("Y:")));
300 title_y = new TitleY(client, this, x1, y);
301 title_y->create_objects();
302 x1 += title_y->get_w();
303 y1 = y + title_y->get_h();
305 add_tool(w_title = new BC_Title(x1=x, y1, _("W:")));
307 title_w = new TitleW(client, this, x1, y1);
308 title_w->create_objects();
309 x1 += title_w->get_w()+margin;
310 add_tool(h_title = new BC_Title(x1, y1, _("H:")));
312 title_h = new TitleH(client, this, x1, y1);
313 title_h->create_objects();
314 x1 += title_h->get_w();
317 add_tool(motion_title = new BC_Title(x1=x, y, _("Motion:")));
318 x1 += motion_title->get_w()+margin;
319 motion = new TitleMotion(client, this, x1, y);
320 motion->create_objects();
321 add_tool(loop = new TitleLoop(client, this, x, y1));
322 x = margin; y = y1 + loop->get_h()+yS(20);
324 add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
325 w1 = dropshadow_title->get_w();
326 dropshadow = new TitleDropShadow(client, this, x, y + yS(20));
327 dropshadow->create_objects();
328 if( dropshadow->get_w() > w1 ) w1 = dropshadow->get_w();
331 add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
332 w1 = fadein_title->get_w();
333 add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + yS(20)));
334 if( fade_in->get_w() > w1 ) w1 = fade_in->get_w();
337 add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
338 w1 = fadeout_title->get_w();
339 add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + yS(20)));
340 if( fade_out->get_w() > w1 ) w1 = fade_out->get_w();
343 add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
344 w1 = speed_title->get_w();
345 y += speed_title->get_h() + yS(5); y1 = y;
346 speed = new TitleSpeed(client, this, x, y);
347 speed->create_objects();
348 if( speed->get_w() > w1 ) w1 = speed->get_w();
350 y2 = y + speed->get_h() + yS(10);
352 add_tool(color_button_title = new BC_Title(x3, y1+yS(10), _("Color:")));
353 x1 = x3 + color_button_title->get_w() + xS(30);
354 add_tool(color_button = new TitleColorButton(client, this, x1, y1));
355 y1 += color_button->get_h() + yS(10);
356 add_tool(outline_button_title = new BC_Title(x3, y1+yS(10), _("Outline:")));
357 add_tool(outline_button = new TitleOutlineColorButton(client, this, x1, y1));
360 add_tool(outline_title = new BC_Title(x, y, _("Outline:")));
361 y1 = y + outline_title->get_h() + margin;
362 outline = new TitleOutline(client, this, x, y1);
363 outline->create_objects();
364 x += outline->get_w() + xS(2)*margin;
366 add_tool(stroker_title = new BC_Title(x, y, _("Stroker:")));
367 stroker = new TitleStroker(client, this, x, y1);
368 stroker->create_objects();
369 x += stroker->get_w() + margin;
371 add_tool(timecode = new TitleTimecode(client, this, x, y));
372 y += timecode->get_h() + margin;
374 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
376 Units::print_time_format(timeunit_formats[i], text);
377 int w = get_text_width(MEDIUMFONT, text);
380 add_tool(timecode_format = new TitleTimecodeFormat(client, this, x, y, tw,
381 Units::print_time_format(client->config.timecode_format, string)));
382 timecode_format->create_objects();
383 y += timecode_format->get_h() + margin;
386 add_tool(background = new TitleBackground(client, this, x, y));
387 x += background->get_w() + margin;
388 add_tool(background_path = new TitleBackgroundPath(client, this, x, y));
389 x += background_path->get_w() + margin;
390 add_tool(background_browse = new BrowseButton(
391 client->server->mwindow->theme, this, background_path,
392 x, y, "", _("background media"), _("Select background media path")));
393 x += background_browse->get_w() + xS(3)*margin;
394 add_tool(loop_playback = new TitleLoopPlayback(client, this, x, y));
395 y += loop_playback->get_h() + yS(10);
398 add_tool(text_title = new BC_Title(x, y, _("Text:")));
399 x += text_title->get_w() + xS(20);
400 int wid = BC_Title::calculate_w(this,"0")*xS(10);
401 add_tool(text_chars = new TitleTextChars(x,y,wid));
403 y += text_title->get_h() + margin;
405 text = new TitleText(client, this, x, y, get_w()-margin - x, get_h() - y - yS(10));
406 text->create_objects();
408 add_tool(cur_popup = new TitleCurPopup(client, this));
409 cur_popup->create_objects();
410 add_tool(fonts_popup = new TitleFontsPopup(client, this));
411 color_popup = new TitleColorPopup(client, this);
412 png_popup = new TitlePngPopup(client, this);
418 int TitleWindow::resize_event(int w, int h)
420 client->config.window_w = w;
421 client->config.window_h = h;
423 clear_box(0, 0, w, h);
424 font_title->reposition_window(font_title->get_x(), font_title->get_y());
425 font->reposition_window(font->get_x(), font->get_y());
426 font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
427 x_title->reposition_window(x_title->get_x(), x_title->get_y());
428 title_x->reposition_window(title_x->get_x(), title_x->get_y());
429 y_title->reposition_window(y_title->get_x(), y_title->get_y());
430 title_y->reposition_window(title_y->get_x(), title_y->get_y());
431 w_title->reposition_window(w_title->get_x(), w_title->get_y());
432 title_w->reposition_window(title_w->get_x(), title_w->get_y());
433 h_title->reposition_window(h_title->get_x(), h_title->get_y());
434 title_h->reposition_window(title_h->get_x(), title_h->get_y());
435 style_title->reposition_window(style_title->get_x(), style_title->get_y());
436 italic->reposition_window(italic->get_x(), italic->get_y());
437 bold->reposition_window(bold->get_x(), bold->get_y());
438 drag->reposition_window(drag->get_x(), drag->get_y());
439 alias->reposition_window(alias->get_x(), alias->get_y());
440 size_title->reposition_window(size_title->get_x(), size_title->get_y());
441 size->reposition_window(size->get_x(), size->get_y());
442 size_tumbler->reposition_window(size_tumbler->get_x(), size_tumbler->get_y());
443 pitch_title->reposition_window(pitch_title->get_x(), pitch_title->get_y());
444 pitch->reposition_window(pitch->get_x(), pitch->get_y());
446 color_button_title->reposition_window(color_button_title->get_x(), color_button_title->get_y());
447 color_button->reposition_window(color_button->get_x(), color_button->get_y());
448 outline_button_title->reposition_window(outline_button_title->get_x(), outline_button_title->get_y());
449 outline_button->reposition_window(outline_button->get_x(), outline_button->get_y());
450 motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
451 motion->reposition_window(motion->get_x(), motion->get_y());
452 loop->reposition_window(loop->get_x(), loop->get_y());
453 dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
454 dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
455 fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
456 fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
457 fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
458 fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
459 text_title->reposition_window(text_title->get_x(), text_title->get_y());
460 timecode->reposition_window(timecode->get_x(), timecode->get_y());
461 text->reposition_window(text->get_x(), text->get_y(), w - text->get_x() - xS(10),
462 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - yS(10)));
463 justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
464 left->reposition_window(left->get_x(), left->get_y());
465 center->reposition_window(center->get_x(), center->get_y());
466 right->reposition_window(right->get_x(), right->get_y());
467 top->reposition_window(top->get_x(), top->get_y());
468 mid->reposition_window(mid->get_x(), mid->get_y());
469 bottom->reposition_window(bottom->get_x(), bottom->get_y());
470 speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
471 speed->reposition_window(speed->get_x(), speed->get_y());
478 void TitleWindow::update_drag()
480 drag->drag_x = client->config.title_x;
481 drag->drag_y = client->config.title_y;
482 drag->drag_w = client->config.title_w;
483 drag->drag_h = client->config.title_h;
484 send_configure_change();
486 void TitleWindow::send_configure_change()
488 client->send_configure_change();
491 void TitleWindow::previous_font()
493 int current_font = font->get_number();
494 if( !fonts.total ) current_font = -1;
495 else if( --current_font < 0 ) current_font = fonts.total - 1;
496 font->set_number(current_font);
498 if( current_font < 0 || current_font >= fonts.total ) return;
500 for( int i=0; i<fonts.total; ++i ) {
501 fonts.values[i]->set_selected(i == current_font);
504 font->update(fonts.values[current_font]->get_text());
505 strcpy(client->config.font, fonts.values[current_font]->get_text());
506 check_style(client->config.font,1);
507 send_configure_change();
510 void TitleWindow::next_font()
512 int current_font = font->get_number();
513 if( !fonts.total ) current_font = -1;
514 else if( ++current_font >= fonts.total ) current_font = 0;
515 font->set_number(current_font);
517 if( current_font < 0 || current_font >= fonts.total ) return;
519 for( int i=0; i<fonts.total; ++i ) {
520 fonts.values[i]->set_selected(i == current_font);
523 font->update(fonts.values[current_font]->get_text());
524 strcpy(client->config.font, fonts.values[current_font]->get_text());
525 check_style(client->config.font,1);
526 send_configure_change();
529 int TitleWindow::insert_ibeam(const char *txt, int ofs)
531 int ibeam = cur_ibeam;
532 int ilen = strlen(txt)+1;
534 int len = BC_Resources::encode(client->config.encoding, BC_Resources::wide_encoding,
535 (char*)txt,ilen, (char *)wtxt,ilen*sizeof(wtxt[0])) / sizeof(wchar_t);
536 client->insert_text(wtxt, ibeam);
537 while( len > 0 && !wtxt[len] ) --len;
538 int adv = len+1 + ofs;
539 if( (ibeam += adv) >= client->config.wlen)
540 ibeam = client->config.wlen;
541 text->wset_selection(-1, -1, ibeam);
542 text->update(client->config.wtext);
543 send_configure_change();
547 void TitleWindow::update_color()
549 color_button->update_gui(client->config.color);
550 outline_button->update_gui(client->config.outline_color);
553 void TitleWindow::update_justification()
555 left->update(client->config.hjustification == JUSTIFY_LEFT);
556 center->update(client->config.hjustification == JUSTIFY_CENTER);
557 right->update(client->config.hjustification == JUSTIFY_RIGHT);
558 top->update(client->config.vjustification == JUSTIFY_TOP);
559 mid->update(client->config.vjustification == JUSTIFY_MID);
560 bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
563 void TitleWindow::update_stats()
565 text_chars->update(client->config.wlen);
568 void TitleWindow::update_gui()
570 title_x->update((int64_t)client->config.title_x);
571 title_y->update((int64_t)client->config.title_y);
572 title_w->update((int64_t)client->config.title_w);
573 title_h->update((int64_t)client->config.title_h);
574 italic->update(client->config.style & BC_FONT_ITALIC);
575 bold->update(client->config.style & BC_FONT_BOLD);
576 alias->update(client->config.style & FONT_ALIAS);
577 size->update(client->config.size);
578 motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
579 loop->update(client->config.loop);
580 dropshadow->update((int64_t)client->config.dropshadow);
581 fade_in->update((float)client->config.fade_in);
582 fade_out->update((float)client->config.fade_out);
583 font->update(client->config.font);
584 check_style(client->config.font,0);
585 text->update(client->config.wtext ? &client->config.wtext[0] : L"");
586 speed->update(client->config.pixels_per_second);
587 outline->update((int64_t)client->config.outline_size);
589 stroker->update((int64_t)client->config.stroke_width);
591 timecode->update(client->config.timecode);
592 timecode_format->update(client->config.timecode_format);
593 background->update(client->config.background);
594 background_path->update(client->config.background_path);
595 loop_playback->update((int64_t)client->config.loop_playback);
597 char string[BCTEXTLEN];
598 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
599 if( timeunit_formats[i] == client->config.timecode_format ) {
600 timecode_format->set_text(
601 Units::print_time_format(timeunit_formats[i], string));
605 update_justification();
611 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
614 this->client = client;
615 this->window = window;
617 int TitleFontTumble::handle_up_event()
619 window->previous_font();
623 int TitleFontTumble::handle_down_event()
630 TitleSizeTumble::TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y)
633 this->client = client;
634 this->window = window;
637 int TitleSizeTumble::handle_up_event()
639 int current_index = -1;
640 int current_difference = -1;
641 for( int i=0; i<window->sizes.size(); ++i ) {
642 int size = atoi(window->sizes.get(i)->get_text());
643 if( current_index < 0 ||
644 abs(size - client->config.size) < current_difference ) {
646 current_difference = abs(size - client->config.size);
651 if( current_index >= window->sizes.size() ) current_index = 0;
654 client->config.size = atoi(window->sizes.get(current_index)->get_text());
655 window->size->update(client->config.size);
656 window->send_configure_change();
660 int TitleSizeTumble::handle_down_event()
662 int current_index = -1;
663 int current_difference = -1;
664 for( int i=0; i<window->sizes.size(); ++i ) {
665 int size = atoi(window->sizes.get(i)->get_text());
666 if( current_index < 0 ||
667 abs(size - client->config.size) < current_difference ) {
669 current_difference = abs(size - client->config.size);
674 if( current_index < 0 ) current_index = window->sizes.size() - 1;
677 client->config.size = atoi(window->sizes.get(current_index)->get_text());
678 window->size->update(client->config.size);
679 window->send_configure_change();
683 TitleAlias::TitleAlias(TitleMain *client, TitleWindow *window, int x, int y)
684 : BC_CheckBox(x, y, client->config.style & FONT_ALIAS, _("Smooth"))
686 this->client = client;
687 this->window = window;
690 int TitleAlias::handle_event()
692 client->config.style =
693 (client->config.style & ~FONT_ALIAS) |
694 (get_value() ? FONT_ALIAS : 0);
695 window->send_configure_change();
699 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
700 : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
702 this->client = client;
703 this->window = window;
706 int TitleBold::handle_event()
708 client->config.style =
709 (client->config.style & ~BC_FONT_BOLD) |
710 (get_value() ? BC_FONT_BOLD : 0);
711 window->send_configure_change();
715 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
716 : BC_CheckBox(x, y, client->config.style & BC_FONT_ITALIC, _("Italic"))
718 this->client = client;
719 this->window = window;
721 int TitleItalic::handle_event()
723 client->config.style =
724 (client->config.style & ~BC_FONT_ITALIC) |
725 (get_value() ? BC_FONT_ITALIC : 0);
726 window->send_configure_change();
732 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
733 : BC_PopupTextBox(window, &window->sizes, text, x, y, xS(64), yS(300))
735 this->client = client;
736 this->window = window;
738 TitleSize::~TitleSize()
741 int TitleSize::handle_event()
743 client->config.size = atol(get_text());
744 //printf("TitleSize::handle_event 1 %s\n", get_text());
745 window->send_configure_change();
748 void TitleSize::update(int size)
750 char string[BCTEXTLEN];
751 sprintf(string, "%d", size);
752 BC_PopupTextBox::update(string);
756 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value)
757 : BC_TumbleTextBox(window, *value, 0, INT_MAX, x, y, xS(64))
759 this->client = client;
760 this->window = window;
769 int TitlePitch::handle_event()
771 *value = atol(get_text());
772 window->send_configure_change();
776 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
777 : ColorCircleButton(_("Text Color"), x, y, COLOR_W, COLOR_H,
778 client->config.color, client->config.alpha, 1)
780 this->client = client;
781 this->window = window;
783 int TitleColorButton::handle_new_color(int output, int alpha)
785 client->config.color = output;
786 client->config.alpha = alpha;
787 window->send_configure_change();
790 void TitleColorButton::handle_done_event(int result)
793 handle_new_color(orig_color, orig_alpha);
794 window->lock_window("TitleColorButton::handle_done_event");
795 update_gui(orig_color);
796 window->unlock_window();
800 TitleOutlineColorButton::TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y)
801 : ColorCircleButton(_("Outline Color"), x, y, COLOR_W, COLOR_H,
802 client->config.outline_color, client->config.outline_alpha, 1)
804 this->client = client;
805 this->window = window;
807 int TitleOutlineColorButton::handle_new_color(int output, int alpha)
809 client->config.outline_color = output;
810 client->config.outline_alpha = alpha;
811 window->send_configure_change();
814 void TitleOutlineColorButton::handle_done_event(int result)
817 handle_new_color(orig_color, orig_alpha);
818 window->lock_window("TitleColorButton::handle_done_event");
819 update_gui(orig_color);
820 window->unlock_window();
825 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
826 : BC_PopupTextBox(window, &window->paths,
827 client->motion_to_text(client->config.motion_strategy),
828 x, y, xS(120), yS(100))
830 this->client = client;
831 this->window = window;
833 int TitleMotion::handle_event()
835 client->config.motion_strategy = client->text_to_motion(get_text());
836 window->send_configure_change();
840 TitleLoop::TitleLoop(TitleMain *client, TitleWindow *window, int x, int y)
841 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
843 this->client = client;
844 this->window = window;
846 int TitleLoop::handle_event()
848 client->config.loop = get_value();
849 window->send_configure_change();
852 TitleTimecode::TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y)
853 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
855 this->client = client;
856 this->window = window;
858 int TitleTimecode::handle_event()
860 client->config.timecode = get_value();
861 client->send_configure_change();
865 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
866 int x, int y, int tw, const char *text)
867 : BC_PopupMenu(x, y, BC_PopupMenu::calculate_w(tw)+xS(10), text, 1)
869 this->client = client;
870 this->window = window;
873 int TitleTimecodeFormat::handle_event()
875 client->config.timecode_format = Units::text_to_format(get_text());
876 window->send_configure_change();
880 void TitleTimecodeFormat::create_objects()
882 char string[BCTEXTLEN];
883 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
884 add_item(new BC_MenuItem(
885 Units::print_time_format(timeunit_formats[i], string)));
890 int TitleTimecodeFormat::update(int timecode_format)
892 char string[BCTEXTLEN];
893 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
894 if( timeunit_formats[i] == timecode_format ) {
895 set_text(Units::print_time_format(timeunit_formats[i], string));
902 TitleFade::TitleFade(TitleMain *client, TitleWindow *window,
903 double *value, int x, int y)
904 : BC_TextBox(x, y, xS(80), 1, (float)*value)
906 this->client = client;
907 this->window = window;
912 int TitleFade::handle_event()
914 *value = atof(get_text());
915 window->send_configure_change();
919 void TitleWindow::check_style(const char *font_name, int update)
921 BC_FontEntry *font_nrm = TitleMain::get_font(font_name, 0);
922 BC_FontEntry *font_itl = TitleMain::get_font(font_name, BC_FONT_ITALIC);
923 BC_FontEntry *font_bld = TitleMain::get_font(font_name, BC_FONT_BOLD);
924 BC_FontEntry *font_bit = TitleMain::get_font(font_name, BC_FONT_ITALIC | BC_FONT_BOLD);
925 int has_norm = font_nrm != 0 ? 1 : 0;
926 int has_ital = font_itl != 0 || font_bit != 0 ? 1 : 0;
927 int has_bold = font_bld != 0 || font_bit != 0 ? 1 : 0;
928 if( bold->get_value() ) {
929 if( !has_bold ) bold->update(0);
932 if( !has_norm && has_bold ) bold->update(1);
934 if( italic->get_value() ) {
935 if( !has_ital ) italic->update(0);
938 if( !has_norm && has_ital ) italic->update(1);
940 if( has_norm && has_bold ) bold->enable(); else bold->disable();
941 if( has_norm && has_ital ) italic->enable(); else italic->disable();
943 int style = stroker && atof(stroker->get_text()) ? BC_FONT_OUTLINE : 0;
944 if( bold->get_value() ) style |= BC_FONT_BOLD;
945 if( italic->get_value() ) style |= BC_FONT_ITALIC;
946 if( alias->get_value() ) style |= FONT_ALIAS;
947 client->config.style = style;
951 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
952 : BC_PopupTextBox(window, &window->fonts, client->config.font,
953 x, y, xS(340), yS(300), LISTBOX_ICON_LIST)
955 this->client = client;
956 this->window = window;
958 int TitleFont::handle_event()
960 strcpy(client->config.font, get_text());
961 window->check_style(client->config.font, 1);
962 window->send_configure_change();
966 TitleText::TitleText(TitleMain *client, TitleWindow *window,
967 int x, int y, int w, int h)
968 : BC_ScrollTextBox(window, x, y, w,
969 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
970 client->config.wtext, 0)
972 this->client = client;
973 this->window = window;
974 //printf("TitleText::TitleText %s\n", client->config.text);
977 int TitleText::button_press_event()
979 if( get_buttonpress() == 3 ) {
980 window->cur_ibeam = get_ibeam_letter();
981 window->cur_popup->activate_menu();
984 return BC_ScrollTextBox::button_press_event();
987 int TitleText::handle_event()
989 window->fonts_popup->deactivate();
990 const wchar_t *wtext = get_wtext();
991 long wlen = wcslen(wtext);
992 client->config.demand(wlen);
993 wcsncpy(client->config.wtext, wtext, client->config.wsize);
994 client->config.wlen = wlen;
995 window->update_stats();
996 window->send_configure_change();
999 TitleTextChars::TitleTextChars(int x, int y, int w)
1000 : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
1003 TitleTextChars::~TitleTextChars()
1006 int TitleTextChars::update(int n)
1008 char text[BCSTRLEN];
1009 sprintf(text, _("chars: %d "),n);
1010 return BC_Title::update(text, 0);
1014 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
1015 : BC_TumbleTextBox(window, client->config.dropshadow,
1016 -1000, 1000, x, y, xS(70))
1018 this->client = client;
1019 this->window = window;
1021 int TitleDropShadow::handle_event()
1023 client->config.dropshadow = atol(get_text());
1024 window->send_configure_change();
1029 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
1030 : BC_TumbleTextBox(window, client->config.outline_size,
1031 0.f, 1000.f, x, y, xS(70))
1033 this->client = client;
1034 this->window = window;
1037 int TitleOutline::handle_event()
1039 client->config.outline_size = atof(get_text());
1040 window->send_configure_change();
1045 TitleStroker::TitleStroker(TitleMain *client, TitleWindow *window, int x, int y)
1046 : BC_TumbleTextBox(window, client->config.stroke_width,
1047 0.f, 1000.f, x, y, xS(70))
1049 this->client = client;
1050 this->window = window;
1053 int TitleStroker::handle_event()
1055 client->config.stroke_width = atof(get_text());
1056 if( client->config.stroke_width )
1057 client->config.style |= BC_FONT_OUTLINE;
1059 client->config.style &= ~BC_FONT_OUTLINE;
1060 window->send_configure_change();
1065 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
1066 : BC_TumbleTextBox(window, client->config.title_x,
1067 -32767.f, 32767.f, x, y, xS(50))
1069 this->client = client;
1070 this->window = window;
1073 int TitleX::handle_event()
1075 client->config.title_x = atof(get_text());
1076 window->update_drag();
1080 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
1081 : BC_TumbleTextBox(window, client->config.title_y,
1082 -32767.f, 32767.f, x, y, xS(50))
1084 this->client = client;
1085 this->window = window;
1088 int TitleY::handle_event()
1090 client->config.title_y = atof(get_text());
1091 window->update_drag();
1095 TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
1096 : BC_TumbleTextBox(window, client->config.title_w,
1097 0, 32767, x, y, xS(50))
1099 this->client = client;
1100 this->window = window;
1102 int TitleW::handle_event()
1104 client->config.title_w = atol(get_text());
1105 window->update_drag();
1109 TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
1110 : BC_TumbleTextBox(window, client->config.title_h,
1111 0, 32767, x, y, xS(50))
1113 this->client = client;
1114 this->window = window;
1116 int TitleH::handle_event()
1118 client->config.title_h = atol(get_text());
1119 window->update_drag();
1123 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
1124 : BC_TumbleTextBox(window, client->config.pixels_per_second,
1125 0.f, 1000.f, x, y, xS(100))
1127 this->client = client;
1128 this->window = window;
1134 int TitleSpeed::handle_event()
1136 client->config.pixels_per_second = atof(get_text());
1137 window->send_configure_change();
1142 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
1143 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
1145 this->client = client;
1146 this->window = window;
1148 int TitleLeft::handle_event()
1150 client->config.hjustification = JUSTIFY_LEFT;
1151 window->update_justification();
1152 window->send_configure_change();
1156 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
1157 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
1159 this->client = client;
1160 this->window = window;
1162 int TitleCenter::handle_event()
1164 client->config.hjustification = JUSTIFY_CENTER;
1165 window->update_justification();
1166 window->send_configure_change();
1170 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
1171 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
1173 this->client = client;
1174 this->window = window;
1176 int TitleRight::handle_event()
1178 client->config.hjustification = JUSTIFY_RIGHT;
1179 window->update_justification();
1180 window->send_configure_change();
1186 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
1187 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
1189 this->client = client;
1190 this->window = window;
1192 int TitleTop::handle_event()
1194 client->config.vjustification = JUSTIFY_TOP;
1195 window->update_justification();
1196 window->send_configure_change();
1200 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
1201 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
1203 this->client = client;
1204 this->window = window;
1206 int TitleMid::handle_event()
1208 client->config.vjustification = JUSTIFY_MID;
1209 window->update_justification();
1210 window->send_configure_change();
1214 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
1215 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
1217 this->client = client;
1218 this->window = window;
1220 int TitleBottom::handle_event()
1222 client->config.vjustification = JUSTIFY_BOTTOM;
1223 window->update_justification();
1224 window->send_configure_change();
1228 TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y)
1229 : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->config.drag,
1230 client->config.title_x, client->config.title_y,
1231 client->config.title_w, client->config.title_h)
1233 this->client = client;
1234 this->window = window;
1237 Track *TitleDrag::get_drag_track()
1239 return !client->server->plugin ? 0 :
1240 client->server->plugin->track;
1242 int64_t TitleDrag::get_drag_position()
1244 return client->get_source_position();
1247 void TitleDrag::update_gui()
1249 client->config.drag = get_value();
1250 client->config.title_x = drag_x;
1251 client->config.title_y = drag_y;
1252 client->config.title_w = drag_w+0.5;
1253 client->config.title_h = drag_h+0.5;
1254 window->title_x->update((float)client->config.title_x);
1255 window->title_y->update((float)client->config.title_y);
1256 window->title_w->update((int64_t)client->config.title_w);
1257 window->title_h->update((int64_t)client->config.title_h);
1258 window->send_configure_change();
1261 int TitleDrag::handle_event()
1263 int ret = DragCheckBox::handle_event();
1264 window->send_configure_change();
1268 TitleBackground::TitleBackground(TitleMain *client, TitleWindow *window, int x, int y)
1269 : BC_CheckBox(x, y, client->config.background, _("Background:"))
1271 this->client = client;
1272 this->window = window;
1275 int TitleBackground::handle_event()
1277 client->config.background = get_value();
1278 window->send_configure_change();
1282 TitleBackgroundPath::TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y)
1283 : BC_TextBox(x, y, xS(240), 1, client->config.background_path)
1285 this->client = client;
1286 this->window = window;
1289 int TitleBackgroundPath::handle_event()
1291 strncpy(client->config.background_path, get_text(), sizeof(client->config.background_path));
1292 window->send_configure_change();
1296 TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y)
1297 : BC_CheckBox(x, y, client->config.loop_playback, _("Loop playback"))
1299 this->client = client;
1300 this->window = window;
1302 int TitleLoopPlayback::handle_event()
1304 client->config.loop_playback = get_value();
1305 window->send_configure_change();
1310 TitleCurPopup::TitleCurPopup(TitleMain *client, TitleWindow *window)
1311 : BC_PopupMenu(0, 0, 0, "", 0)
1313 this->client = client;
1314 this->window = window;
1316 int TitleCurPopup::handle_event()
1321 void TitleCurSubMenu::add_subitemx(int popup_type, va_list ap, const char *fmt)
1323 char item[BCSTRLEN];
1324 vsnprintf(item, sizeof(item)-1, fmt, ap);
1325 item[sizeof(item)-1] = 0;
1326 add_submenuitem(new TitleCurSubMenuItem(this, item, popup_type));
1329 void TitleCurPopup::create_objects()
1331 TitleCurItem *cur_item;
1332 TitleCurSubMenu *sub_menu;
1334 add_item(cur_item = new TitleCurItem(this, item = _(KW_NUDGE)));
1335 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1336 sub_menu->add_subitem("%s dx,dy",item);
1337 sub_menu->add_subitem("/%s",item);
1338 add_item(cur_item = new TitleCurItem(this, item = _(KW_COLOR)));
1339 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1340 sub_menu->add_subitem(POPUP_COLOR,"%s %s",item,_("#"));
1341 sub_menu->add_subitem("%s ",item);
1342 sub_menu->add_subitem("/%s",item);
1343 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALPHA)));
1344 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1345 sub_menu->add_subitem("%s ",item);
1346 sub_menu->add_subitem("%s 0.",item);
1347 sub_menu->add_subitem("%s .5",item);
1348 sub_menu->add_subitem("%s 1.",item);
1349 sub_menu->add_subitem("/%s",item);
1350 add_item(cur_item = new TitleCurItem(this, item = _(KW_FONT)));
1351 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1352 sub_menu->add_subitem(POPUP_FONT,"%s %s",item, _("name"));
1353 sub_menu->add_subitem(POPUP_OFFSET, "%s ",item);
1354 sub_menu->add_subitem("/%s",item);
1355 add_item(cur_item = new TitleCurItem(this, item = _(KW_SIZE)));
1356 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1357 sub_menu->add_subitem("%s +",item);
1358 sub_menu->add_subitem("%s -",item);
1359 sub_menu->add_subitem("%s ",item);
1360 sub_menu->add_subitem("/%s",item);
1361 add_item(cur_item = new TitleCurItem(this, item = _(KW_BOLD)));
1362 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1363 sub_menu->add_subitem("%s 1",item);
1364 sub_menu->add_subitem("%s 0",item);
1365 sub_menu->add_subitem("/%s",item);
1366 add_item(cur_item = new TitleCurItem(this, item = _(KW_ITALIC)));
1367 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1368 sub_menu->add_subitem("%s 1",item);
1369 sub_menu->add_subitem("%s 0",item);
1370 sub_menu->add_subitem("/%s",item);
1371 add_item(cur_item = new TitleCurItem(this, item = _(KW_CAPS)));
1372 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1373 sub_menu->add_subitem("%s 1",item);
1374 sub_menu->add_subitem("%s 0",item);
1375 sub_menu->add_subitem("%s -1",item);
1376 sub_menu->add_subitem("/%s",item);
1377 add_item(cur_item = new TitleCurItem(this, item = _(KW_UL)));
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_BLINK)));
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 -1",item);
1386 sub_menu->add_subitem("%s ",item);
1387 sub_menu->add_subitem("%s 0",item);
1388 sub_menu->add_subitem("/%s",item);
1389 add_item(cur_item = new TitleCurItem(this, item = _(KW_FIXED)));
1390 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1391 sub_menu->add_subitem("%s ",item);
1392 sub_menu->add_subitem("%s 20",item);
1393 sub_menu->add_subitem("%s 10",item);
1394 sub_menu->add_subitem("%s 0",item);
1395 sub_menu->add_subitem("/%s",item);
1396 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALIAS)));
1397 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1398 sub_menu->add_subitem("%s 1",item);
1399 sub_menu->add_subitem("%s 0",item);
1400 sub_menu->add_subitem("/%s",item);
1401 add_item(cur_item = new TitleCurItem(this, item = _(KW_SUP)));
1402 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1403 sub_menu->add_subitem("%s 1",item);
1404 sub_menu->add_subitem("%s 0",item);
1405 sub_menu->add_subitem("%s -1",item);
1406 sub_menu->add_subitem("/%s",item);
1407 add_item(cur_item = new TitleCurItem(this, item = _(KW_PNG)));
1408 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1409 sub_menu->add_subitem(POPUP_PNG,"%s %s", item, _("file"));
1412 TitleCurItem::TitleCurItem(TitleCurPopup *popup, const char *text)
1415 this->popup = popup;
1417 int TitleCurItem::handle_event()
1422 TitleCurSubMenu::TitleCurSubMenu(TitleCurItem *cur_item)
1424 this->cur_item = cur_item;
1426 TitleCurSubMenu::~TitleCurSubMenu()
1430 TitleCurSubMenuItem::TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type)
1433 this->submenu = submenu;
1434 this->popup_type = popup_type;
1436 TitleCurSubMenuItem::~TitleCurSubMenuItem()
1439 int TitleCurSubMenuItem::handle_event()
1441 TitleCurPopup *popup = submenu->cur_item->popup;
1442 TitleWindow *window = popup->window;
1443 const char *item_text = get_text();
1444 int ofs = *item_text == '/' ? 0 : -1;
1445 switch( popup_type ) {
1448 window->get_pop_cursor(px ,py);
1449 window->fonts_popup->activate(px, py, xS(300),yS(200));
1452 window->color_popup->activate();
1455 window->png_popup->activate();
1462 sprintf(txt, "<%s>", item_text);
1463 return window->insert_ibeam(txt, ofs);
1466 TitleFontsPopup::TitleFontsPopup(TitleMain *client, TitleWindow *window)
1467 : BC_ListBox(-1, -1, 1, 1, LISTBOX_ICON_LIST,
1468 &window->fonts, 0, 0, 1, 0, 1)
1470 this->client = client;
1471 this->window = window;
1475 TitleFontsPopup::~TitleFontsPopup()
1478 int TitleFontsPopup::keypress_event()
1480 switch( get_keypress() ) {
1488 return BC_ListBox::keypress_event();
1491 int TitleFontsPopup::handle_event()
1494 BC_ListBoxItem *item = get_selection(0, 0);
1495 if( !item ) return 1;
1496 const char *item_text = item->get_text();
1497 char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_FONT), item_text);
1498 return window->insert_ibeam(txt);
1501 TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
1502 : ColorPicker(0, _("Color"))
1504 this->client = client;
1505 this->window = window;
1506 this->color_value = client->config.color;
1508 TitleColorPopup::~TitleColorPopup()
1511 int TitleColorPopup::handle_new_color(int output, int alpha)
1513 color_value = output;
1516 int TitleColorPopup::activate()
1518 start_window(client->config.color, 255, 1);
1521 void TitleColorPopup::handle_done_event(int result)
1524 char txt[BCSTRLEN]; sprintf(txt, "<%s #%06x>", _(KW_COLOR), color_value);
1525 window->lock_window("TitleColorPopup::handle_done_event");
1526 window->insert_ibeam(txt);
1527 window->unlock_window();
1531 TitlePngPopup::TitlePngPopup(TitleMain *client, TitleWindow *window)
1534 this->client = client;
1535 this->window = window;
1538 TitlePngPopup::~TitlePngPopup()
1543 void TitlePngPopup::handle_done_event(int result)
1545 if( result ) return;
1546 BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui();
1547 const char *path = gui->get_submitted_path();
1548 char txt[BCSTRLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
1549 window->lock_window("TitlePngPopup::handle_done_event");
1550 window->insert_ibeam(txt);
1551 window->unlock_window();
1554 BC_Window *TitlePngPopup::new_gui()
1556 MWindow *mwindow = client->server->mwindow;
1557 int x, y; mwindow->gui->get_abs_cursor(x, y);
1559 BC_Window *gui = new BrowseButtonWindow(mwindow->theme,
1560 x-xS(25), y-yS(100), window, "", _("Png file"), _("Png path"), 0);
1561 gui->create_objects();
1565 int TitlePngPopup::activate()
1567 BC_DialogThread::start();