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;
239 int x1 = x+xS(20), y1 = y;
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(16), y2+margin, _("Line 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(wchr_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 wchr_t wz[1] = { 0 };
586 text->update(client->config.wtext ? &client->config.wtext[0] : wz);
587 speed->update(client->config.pixels_per_second);
588 outline->update((int64_t)client->config.outline_size);
590 stroker->update((int64_t)client->config.stroke_width);
592 timecode->update(client->config.timecode);
593 timecode_format->update(client->config.timecode_format);
594 background->update(client->config.background);
595 background_path->update(client->config.background_path);
596 loop_playback->update((int64_t)client->config.loop_playback);
598 char string[BCTEXTLEN];
599 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
600 if( timeunit_formats[i] == client->config.timecode_format ) {
601 timecode_format->set_text(
602 Units::print_time_format(timeunit_formats[i], string));
606 update_justification();
612 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
615 this->client = client;
616 this->window = window;
618 int TitleFontTumble::handle_up_event()
620 window->previous_font();
624 int TitleFontTumble::handle_down_event()
631 TitleSizeTumble::TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y)
634 this->client = client;
635 this->window = window;
638 int TitleSizeTumble::handle_up_event()
640 int current_index = -1;
641 int current_difference = -1;
642 for( int i=0; i<window->sizes.size(); ++i ) {
643 int size = atoi(window->sizes.get(i)->get_text());
644 if( current_index < 0 ||
645 abs(size - client->config.size) < current_difference ) {
647 current_difference = abs(size - client->config.size);
652 if( current_index >= window->sizes.size() ) current_index = 0;
655 client->config.size = atoi(window->sizes.get(current_index)->get_text());
656 window->size->update(client->config.size);
657 window->send_configure_change();
661 int TitleSizeTumble::handle_down_event()
663 int current_index = -1;
664 int current_difference = -1;
665 for( int i=0; i<window->sizes.size(); ++i ) {
666 int size = atoi(window->sizes.get(i)->get_text());
667 if( current_index < 0 ||
668 abs(size - client->config.size) < current_difference ) {
670 current_difference = abs(size - client->config.size);
675 if( current_index < 0 ) current_index = window->sizes.size() - 1;
678 client->config.size = atoi(window->sizes.get(current_index)->get_text());
679 window->size->update(client->config.size);
680 window->send_configure_change();
684 TitleAlias::TitleAlias(TitleMain *client, TitleWindow *window, int x, int y)
685 : BC_CheckBox(x, y, client->config.style & FONT_ALIAS, _("Smooth"))
687 this->client = client;
688 this->window = window;
691 int TitleAlias::handle_event()
693 client->config.style =
694 (client->config.style & ~FONT_ALIAS) |
695 (get_value() ? FONT_ALIAS : 0);
696 window->send_configure_change();
700 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
701 : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
703 this->client = client;
704 this->window = window;
707 int TitleBold::handle_event()
709 client->config.style =
710 (client->config.style & ~BC_FONT_BOLD) |
711 (get_value() ? BC_FONT_BOLD : 0);
712 window->send_configure_change();
716 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
717 : BC_CheckBox(x, y, client->config.style & BC_FONT_ITALIC, _("Italic"))
719 this->client = client;
720 this->window = window;
722 int TitleItalic::handle_event()
724 client->config.style =
725 (client->config.style & ~BC_FONT_ITALIC) |
726 (get_value() ? BC_FONT_ITALIC : 0);
727 window->send_configure_change();
733 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
734 : BC_PopupTextBox(window, &window->sizes, text, x, y, xS(64), yS(300))
736 this->client = client;
737 this->window = window;
739 TitleSize::~TitleSize()
742 int TitleSize::handle_event()
744 client->config.size = atol(get_text());
745 //printf("TitleSize::handle_event 1 %s\n", get_text());
746 window->send_configure_change();
749 void TitleSize::update(int size)
751 char string[BCTEXTLEN];
752 sprintf(string, "%d", size);
753 BC_PopupTextBox::update(string);
757 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value)
758 : BC_TumbleTextBox(window, *value, 0, INT_MAX, x, y, xS(64))
760 this->client = client;
761 this->window = window;
770 int TitlePitch::handle_event()
772 *value = atol(get_text());
773 window->send_configure_change();
777 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
778 : ColorCircleButton(_("Text Color"), x, y, COLOR_W, COLOR_H,
779 client->config.color, client->config.alpha, 1)
781 this->client = client;
782 this->window = window;
784 int TitleColorButton::handle_new_color(int output, int alpha)
786 client->config.color = output;
787 client->config.alpha = alpha;
788 window->send_configure_change();
791 void TitleColorButton::handle_done_event(int result)
794 handle_new_color(orig_color, orig_alpha);
795 window->lock_window("TitleColorButton::handle_done_event");
796 update_gui(orig_color);
797 window->unlock_window();
801 TitleOutlineColorButton::TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y)
802 : ColorCircleButton(_("Outline Color"), x, y, COLOR_W, COLOR_H,
803 client->config.outline_color, client->config.outline_alpha, 1)
805 this->client = client;
806 this->window = window;
808 int TitleOutlineColorButton::handle_new_color(int output, int alpha)
810 client->config.outline_color = output;
811 client->config.outline_alpha = alpha;
812 window->send_configure_change();
815 void TitleOutlineColorButton::handle_done_event(int result)
818 handle_new_color(orig_color, orig_alpha);
819 window->lock_window("TitleColorButton::handle_done_event");
820 update_gui(orig_color);
821 window->unlock_window();
826 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
827 : BC_PopupTextBox(window, &window->paths,
828 client->motion_to_text(client->config.motion_strategy),
829 x, y, xS(120), yS(100))
831 this->client = client;
832 this->window = window;
834 int TitleMotion::handle_event()
836 client->config.motion_strategy = client->text_to_motion(get_text());
837 window->send_configure_change();
841 TitleLoop::TitleLoop(TitleMain *client, TitleWindow *window, int x, int y)
842 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
844 this->client = client;
845 this->window = window;
847 int TitleLoop::handle_event()
849 client->config.loop = get_value();
850 window->send_configure_change();
853 TitleTimecode::TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y)
854 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
856 this->client = client;
857 this->window = window;
859 int TitleTimecode::handle_event()
861 client->config.timecode = get_value();
862 client->send_configure_change();
866 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
867 int x, int y, int tw, const char *text)
868 : BC_PopupMenu(x, y, BC_PopupMenu::calculate_w(tw)+xS(10), text, 1)
870 this->client = client;
871 this->window = window;
874 int TitleTimecodeFormat::handle_event()
876 client->config.timecode_format = Units::text_to_format(get_text());
877 window->send_configure_change();
881 void TitleTimecodeFormat::create_objects()
883 char string[BCTEXTLEN];
884 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
885 add_item(new BC_MenuItem(
886 Units::print_time_format(timeunit_formats[i], string)));
891 int TitleTimecodeFormat::update(int timecode_format)
893 char string[BCTEXTLEN];
894 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
895 if( timeunit_formats[i] == timecode_format ) {
896 set_text(Units::print_time_format(timeunit_formats[i], string));
903 TitleFade::TitleFade(TitleMain *client, TitleWindow *window,
904 double *value, int x, int y)
905 : BC_TextBox(x, y, xS(80), 1, (float)*value)
907 this->client = client;
908 this->window = window;
913 int TitleFade::handle_event()
915 *value = atof(get_text());
916 window->send_configure_change();
920 void TitleWindow::check_style(const char *font_name, int update)
922 BC_FontEntry *font_nrm = TitleMain::get_font(font_name, 0);
923 BC_FontEntry *font_itl = TitleMain::get_font(font_name, BC_FONT_ITALIC);
924 BC_FontEntry *font_bld = TitleMain::get_font(font_name, BC_FONT_BOLD);
925 BC_FontEntry *font_bit = TitleMain::get_font(font_name, BC_FONT_ITALIC | BC_FONT_BOLD);
926 int has_norm = font_nrm != 0 ? 1 : 0;
927 int has_ital = font_itl != 0 || font_bit != 0 ? 1 : 0;
928 int has_bold = font_bld != 0 || font_bit != 0 ? 1 : 0;
929 if( bold->get_value() ) {
930 if( !has_bold ) bold->update(0);
933 if( !has_norm && has_bold ) bold->update(1);
935 if( italic->get_value() ) {
936 if( !has_ital ) italic->update(0);
939 if( !has_norm && has_ital ) italic->update(1);
941 if( has_norm && has_bold ) bold->enable(); else bold->disable();
942 if( has_norm && has_ital ) italic->enable(); else italic->disable();
944 int style = stroker && atof(stroker->get_text()) ? BC_FONT_OUTLINE : 0;
945 if( bold->get_value() ) style |= BC_FONT_BOLD;
946 if( italic->get_value() ) style |= BC_FONT_ITALIC;
947 if( alias->get_value() ) style |= FONT_ALIAS;
948 client->config.style = style;
952 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
953 : BC_PopupTextBox(window, &window->fonts, client->config.font,
954 x, y, xS(340), yS(300), LISTBOX_ICON_LIST)
956 this->client = client;
957 this->window = window;
959 int TitleFont::handle_event()
961 strcpy(client->config.font, get_text());
962 window->check_style(client->config.font, 1);
963 window->send_configure_change();
967 TitleText::TitleText(TitleMain *client, TitleWindow *window,
968 int x, int y, int w, int h)
969 : BC_ScrollTextBox(window, x, y, w,
970 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
971 client->config.wtext, 0)
973 this->client = client;
974 this->window = window;
975 //printf("TitleText::TitleText %s\n", client->config.text);
978 int TitleText::button_press_event()
980 if( get_buttonpress() == 3 ) {
981 window->cur_ibeam = get_ibeam_letter();
982 window->cur_popup->activate_menu();
985 return BC_ScrollTextBox::button_press_event();
988 int TitleText::handle_event()
990 window->fonts_popup->deactivate();
991 const wchr_t *wtext = get_wtext();
992 long wlen = wstrlen(wtext);
993 client->config.demand(wlen);
994 wstrncpy(client->config.wtext, wtext, client->config.wsize);
995 client->config.wlen = wlen;
996 window->update_stats();
997 window->send_configure_change();
1000 TitleTextChars::TitleTextChars(int x, int y, int w)
1001 : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
1004 TitleTextChars::~TitleTextChars()
1007 int TitleTextChars::update(int n)
1009 char text[BCSTRLEN];
1010 sprintf(text, _("chars: %d "),n);
1011 return BC_Title::update(text, 0);
1015 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
1016 : BC_TumbleTextBox(window, client->config.dropshadow,
1017 -1000, 1000, x, y, xS(70))
1019 this->client = client;
1020 this->window = window;
1022 int TitleDropShadow::handle_event()
1024 client->config.dropshadow = atol(get_text());
1025 window->send_configure_change();
1030 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
1031 : BC_TumbleTextBox(window, client->config.outline_size,
1032 0.f, 1000.f, x, y, xS(70))
1034 this->client = client;
1035 this->window = window;
1038 int TitleOutline::handle_event()
1040 client->config.outline_size = atof(get_text());
1041 window->send_configure_change();
1046 TitleStroker::TitleStroker(TitleMain *client, TitleWindow *window, int x, int y)
1047 : BC_TumbleTextBox(window, client->config.stroke_width,
1048 0.f, 1000.f, x, y, xS(70))
1050 this->client = client;
1051 this->window = window;
1054 int TitleStroker::handle_event()
1056 client->config.stroke_width = atof(get_text());
1057 if( client->config.stroke_width )
1058 client->config.style |= BC_FONT_OUTLINE;
1060 client->config.style &= ~BC_FONT_OUTLINE;
1061 window->send_configure_change();
1066 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
1067 : BC_TumbleTextBox(window, client->config.title_x,
1068 -32767.f, 32767.f, x, y, xS(50))
1070 this->client = client;
1071 this->window = window;
1074 int TitleX::handle_event()
1076 client->config.title_x = atof(get_text());
1077 window->update_drag();
1081 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
1082 : BC_TumbleTextBox(window, client->config.title_y,
1083 -32767.f, 32767.f, x, y, xS(50))
1085 this->client = client;
1086 this->window = window;
1089 int TitleY::handle_event()
1091 client->config.title_y = atof(get_text());
1092 window->update_drag();
1096 TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
1097 : BC_TumbleTextBox(window, client->config.title_w,
1098 0, 32767, x, y, xS(50))
1100 this->client = client;
1101 this->window = window;
1103 int TitleW::handle_event()
1105 client->config.title_w = atol(get_text());
1106 window->update_drag();
1110 TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
1111 : BC_TumbleTextBox(window, client->config.title_h,
1112 0, 32767, x, y, xS(50))
1114 this->client = client;
1115 this->window = window;
1117 int TitleH::handle_event()
1119 client->config.title_h = atol(get_text());
1120 window->update_drag();
1124 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
1125 : BC_TumbleTextBox(window, client->config.pixels_per_second,
1126 0.f, 1000.f, x, y, xS(100))
1128 this->client = client;
1129 this->window = window;
1135 int TitleSpeed::handle_event()
1137 client->config.pixels_per_second = atof(get_text());
1138 window->send_configure_change();
1143 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
1144 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
1146 this->client = client;
1147 this->window = window;
1149 int TitleLeft::handle_event()
1151 client->config.hjustification = JUSTIFY_LEFT;
1152 window->update_justification();
1153 window->send_configure_change();
1157 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
1158 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
1160 this->client = client;
1161 this->window = window;
1163 int TitleCenter::handle_event()
1165 client->config.hjustification = JUSTIFY_CENTER;
1166 window->update_justification();
1167 window->send_configure_change();
1171 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
1172 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
1174 this->client = client;
1175 this->window = window;
1177 int TitleRight::handle_event()
1179 client->config.hjustification = JUSTIFY_RIGHT;
1180 window->update_justification();
1181 window->send_configure_change();
1187 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
1188 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
1190 this->client = client;
1191 this->window = window;
1193 int TitleTop::handle_event()
1195 client->config.vjustification = JUSTIFY_TOP;
1196 window->update_justification();
1197 window->send_configure_change();
1201 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
1202 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
1204 this->client = client;
1205 this->window = window;
1207 int TitleMid::handle_event()
1209 client->config.vjustification = JUSTIFY_MID;
1210 window->update_justification();
1211 window->send_configure_change();
1215 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
1216 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
1218 this->client = client;
1219 this->window = window;
1221 int TitleBottom::handle_event()
1223 client->config.vjustification = JUSTIFY_BOTTOM;
1224 window->update_justification();
1225 window->send_configure_change();
1229 TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y)
1230 : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->config.drag,
1231 client->config.title_x, client->config.title_y,
1232 client->config.title_w, client->config.title_h)
1234 this->client = client;
1235 this->window = window;
1238 Track *TitleDrag::get_drag_track()
1240 return !client->server->plugin ? 0 :
1241 client->server->plugin->track;
1243 int64_t TitleDrag::get_drag_position()
1245 return client->get_source_position();
1248 void TitleDrag::update_gui()
1250 client->config.drag = get_value();
1251 client->config.title_x = drag_x;
1252 client->config.title_y = drag_y;
1253 client->config.title_w = drag_w+0.5;
1254 client->config.title_h = drag_h+0.5;
1255 window->title_x->update((float)client->config.title_x);
1256 window->title_y->update((float)client->config.title_y);
1257 window->title_w->update((int64_t)client->config.title_w);
1258 window->title_h->update((int64_t)client->config.title_h);
1259 window->send_configure_change();
1262 int TitleDrag::handle_event()
1264 int ret = DragCheckBox::handle_event();
1265 window->send_configure_change();
1269 TitleBackground::TitleBackground(TitleMain *client, TitleWindow *window, int x, int y)
1270 : BC_CheckBox(x, y, client->config.background, _("Background:"))
1272 this->client = client;
1273 this->window = window;
1276 int TitleBackground::handle_event()
1278 client->config.background = get_value();
1279 window->send_configure_change();
1283 TitleBackgroundPath::TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y)
1284 : BC_TextBox(x, y, xS(240), 1, client->config.background_path)
1286 this->client = client;
1287 this->window = window;
1290 int TitleBackgroundPath::handle_event()
1292 strncpy(client->config.background_path, get_text(), sizeof(client->config.background_path));
1293 window->send_configure_change();
1297 TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y)
1298 : BC_CheckBox(x, y, client->config.loop_playback, _("Loop playback"))
1300 this->client = client;
1301 this->window = window;
1303 int TitleLoopPlayback::handle_event()
1305 client->config.loop_playback = get_value();
1306 window->send_configure_change();
1311 TitleCurPopup::TitleCurPopup(TitleMain *client, TitleWindow *window)
1312 : BC_PopupMenu(0, 0, 0, "", 0)
1314 this->client = client;
1315 this->window = window;
1317 int TitleCurPopup::handle_event()
1322 void TitleCurSubMenu::add_subitemx(int popup_type, va_list ap, const char *fmt)
1324 char item[BCSTRLEN];
1325 vsnprintf(item, sizeof(item)-1, fmt, ap);
1326 item[sizeof(item)-1] = 0;
1327 add_submenuitem(new TitleCurSubMenuItem(this, item, popup_type));
1330 void TitleCurPopup::create_objects()
1332 TitleCurItem *cur_item;
1333 TitleCurSubMenu *sub_menu;
1335 add_item(cur_item = new TitleCurItem(this, item = _(KW_NUDGE)));
1336 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1337 sub_menu->add_subitem("%s dx,dy",item);
1338 sub_menu->add_subitem("/%s",item);
1339 add_item(cur_item = new TitleCurItem(this, item = _(KW_COLOR)));
1340 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1341 sub_menu->add_subitem(POPUP_COLOR,"%s %s",item,_("#"));
1342 sub_menu->add_subitem("%s ",item);
1343 sub_menu->add_subitem("/%s",item);
1344 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALPHA)));
1345 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1346 sub_menu->add_subitem("%s ",item);
1347 sub_menu->add_subitem("%s 0.",item);
1348 sub_menu->add_subitem("%s .5",item);
1349 sub_menu->add_subitem("%s 1.",item);
1350 sub_menu->add_subitem("/%s",item);
1351 add_item(cur_item = new TitleCurItem(this, item = _(KW_FONT)));
1352 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1353 sub_menu->add_subitem(POPUP_FONT,"%s %s",item, _("name"));
1354 sub_menu->add_subitem(POPUP_OFFSET, "%s ",item);
1355 sub_menu->add_subitem("/%s",item);
1356 add_item(cur_item = new TitleCurItem(this, item = _(KW_SIZE)));
1357 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1358 sub_menu->add_subitem("%s +",item);
1359 sub_menu->add_subitem("%s -",item);
1360 sub_menu->add_subitem("%s ",item);
1361 sub_menu->add_subitem("/%s",item);
1362 add_item(cur_item = new TitleCurItem(this, item = _(KW_BOLD)));
1363 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1364 sub_menu->add_subitem("%s 1",item);
1365 sub_menu->add_subitem("%s 0",item);
1366 sub_menu->add_subitem("/%s",item);
1367 add_item(cur_item = new TitleCurItem(this, item = _(KW_ITALIC)));
1368 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1369 sub_menu->add_subitem("%s 1",item);
1370 sub_menu->add_subitem("%s 0",item);
1371 sub_menu->add_subitem("/%s",item);
1372 add_item(cur_item = new TitleCurItem(this, item = _(KW_CAPS)));
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 -1",item);
1377 sub_menu->add_subitem("/%s",item);
1378 add_item(cur_item = new TitleCurItem(this, item = _(KW_UL)));
1379 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1380 sub_menu->add_subitem("%s 1",item);
1381 sub_menu->add_subitem("%s 0",item);
1382 sub_menu->add_subitem("/%s",item);
1383 add_item(cur_item = new TitleCurItem(this, item = _(KW_BLINK)));
1384 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1385 sub_menu->add_subitem("%s 1",item);
1386 sub_menu->add_subitem("%s -1",item);
1387 sub_menu->add_subitem("%s ",item);
1388 sub_menu->add_subitem("%s 0",item);
1389 sub_menu->add_subitem("/%s",item);
1390 add_item(cur_item = new TitleCurItem(this, item = _(KW_FIXED)));
1391 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1392 sub_menu->add_subitem("%s ",item);
1393 sub_menu->add_subitem("%s 20",item);
1394 sub_menu->add_subitem("%s 10",item);
1395 sub_menu->add_subitem("%s 0",item);
1396 sub_menu->add_subitem("/%s",item);
1397 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALIAS)));
1398 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1399 sub_menu->add_subitem("%s 1",item);
1400 sub_menu->add_subitem("%s 0",item);
1401 sub_menu->add_subitem("/%s",item);
1402 add_item(cur_item = new TitleCurItem(this, item = _(KW_SUP)));
1403 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1404 sub_menu->add_subitem("%s 1",item);
1405 sub_menu->add_subitem("%s 0",item);
1406 sub_menu->add_subitem("%s -1",item);
1407 sub_menu->add_subitem("/%s",item);
1408 add_item(cur_item = new TitleCurItem(this, item = _(KW_PNG)));
1409 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1410 sub_menu->add_subitem(POPUP_PNG,"%s %s", item, _("file"));
1413 TitleCurItem::TitleCurItem(TitleCurPopup *popup, const char *text)
1416 this->popup = popup;
1418 int TitleCurItem::handle_event()
1423 TitleCurSubMenu::TitleCurSubMenu(TitleCurItem *cur_item)
1425 this->cur_item = cur_item;
1427 TitleCurSubMenu::~TitleCurSubMenu()
1431 TitleCurSubMenuItem::TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type)
1434 this->submenu = submenu;
1435 this->popup_type = popup_type;
1437 TitleCurSubMenuItem::~TitleCurSubMenuItem()
1440 int TitleCurSubMenuItem::handle_event()
1442 TitleCurPopup *popup = submenu->cur_item->popup;
1443 TitleWindow *window = popup->window;
1444 const char *item_text = get_text();
1445 int ofs = *item_text == '/' ? 0 : -1;
1446 switch( popup_type ) {
1449 window->get_pop_cursor(px ,py);
1450 window->fonts_popup->activate(px, py, xS(300),yS(200));
1453 window->color_popup->activate();
1456 window->png_popup->activate();
1463 sprintf(txt, "<%s>", item_text);
1464 return window->insert_ibeam(txt, ofs);
1467 TitleFontsPopup::TitleFontsPopup(TitleMain *client, TitleWindow *window)
1468 : BC_ListBox(-1, -1, 1, 1, LISTBOX_ICON_LIST,
1469 &window->fonts, 0, 0, 1, 0, 1)
1471 this->client = client;
1472 this->window = window;
1476 TitleFontsPopup::~TitleFontsPopup()
1479 int TitleFontsPopup::keypress_event()
1481 switch( get_keypress() ) {
1489 return BC_ListBox::keypress_event();
1492 int TitleFontsPopup::handle_event()
1495 BC_ListBoxItem *item = get_selection(0, 0);
1496 if( !item ) return 1;
1497 const char *item_text = item->get_text();
1498 char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_FONT), item_text);
1499 return window->insert_ibeam(txt);
1502 TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
1503 : ColorPicker(0, _("Color"))
1505 this->client = client;
1506 this->window = window;
1507 this->color_value = client->config.color;
1509 TitleColorPopup::~TitleColorPopup()
1512 int TitleColorPopup::handle_new_color(int output, int alpha)
1514 color_value = output;
1517 int TitleColorPopup::activate()
1519 start_window(client->config.color, 255, 1);
1522 void TitleColorPopup::handle_done_event(int result)
1525 char txt[BCSTRLEN]; sprintf(txt, "<%s #%06x>", _(KW_COLOR), color_value);
1526 window->lock_window("TitleColorPopup::handle_done_event");
1527 window->insert_ibeam(txt);
1528 window->unlock_window();
1532 TitlePngPopup::TitlePngPopup(TitleMain *client, TitleWindow *window)
1535 this->client = client;
1536 this->window = window;
1539 TitlePngPopup::~TitlePngPopup()
1544 void TitlePngPopup::handle_done_event(int result)
1546 if( result ) return;
1547 BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui();
1548 const char *path = gui->get_submitted_path();
1549 char txt[BCSTRLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
1550 window->lock_window("TitlePngPopup::handle_done_event");
1551 window->insert_ibeam(txt);
1552 window->unlock_window();
1555 BC_Window *TitlePngPopup::new_gui()
1557 MWindow *mwindow = client->server->mwindow;
1558 int x, y; mwindow->gui->get_abs_cursor(x, y);
1560 BC_Window *gui = new BrowseButtonWindow(mwindow->theme,
1561 x-xS(25), y-yS(100), window, "", _("Png file"), _("Png path"), 0);
1562 gui->create_objects();
1566 int TitlePngPopup::activate()
1568 BC_DialogThread::start();