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;
81 color_x = color_y = 0;
82 outline_color_x = outline_color_y = 0;
83 drag_dx = drag_dy = dragging = 0;
95 outline_color_button = 0;
96 outline_color_thread = 0;
110 left = 0; center = 0; right = 0;
111 top = 0; mid = 0; bottom = 0;
122 void TitleWindow::done_event(int result)
124 drag->drag_deactivate();
125 color_thread->close_window();
126 outline_color_thread->close_window();
127 color_popup->close_window();
128 png_popup->close_window();
131 TitleWindow::~TitleWindow()
135 for( int i=0; i<fonts.size(); ++i )
136 delete fonts[i]->get_icon();
138 sizes.remove_all_objects();
139 delete timecode_format;
145 void TitleWindow::create_objects()
148 int margin = client->get_theme()->widget_border;
149 char string[BCTEXTLEN];
153 client->build_previews(this);
155 sizes.append(new BC_ListBoxItem("8"));
156 sizes.append(new BC_ListBoxItem("9"));
157 sizes.append(new BC_ListBoxItem("10"));
158 sizes.append(new BC_ListBoxItem("11"));
159 sizes.append(new BC_ListBoxItem("12"));
160 sizes.append(new BC_ListBoxItem("13"));
161 sizes.append(new BC_ListBoxItem("14"));
162 sizes.append(new BC_ListBoxItem("16"));
163 sizes.append(new BC_ListBoxItem("18"));
164 sizes.append(new BC_ListBoxItem("20"));
165 sizes.append(new BC_ListBoxItem("22"));
166 sizes.append(new BC_ListBoxItem("24"));
167 sizes.append(new BC_ListBoxItem("26"));
168 sizes.append(new BC_ListBoxItem("28"));
169 sizes.append(new BC_ListBoxItem("32"));
170 sizes.append(new BC_ListBoxItem("36"));
171 sizes.append(new BC_ListBoxItem("40"));
172 sizes.append(new BC_ListBoxItem("48"));
173 sizes.append(new BC_ListBoxItem("56"));
174 sizes.append(new BC_ListBoxItem("64"));
175 sizes.append(new BC_ListBoxItem("72"));
176 sizes.append(new BC_ListBoxItem("100"));
177 sizes.append(new BC_ListBoxItem("128"));
178 sizes.append(new BC_ListBoxItem("256"));
179 sizes.append(new BC_ListBoxItem("512"));
180 sizes.append(new BC_ListBoxItem("1024"));
182 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
183 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
184 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
185 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
186 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
190 // Construct font list
191 ArrayList<BC_FontEntry*> *fontlist = get_resources()->fontlist;
193 for( int i=0; i<fontlist->size(); ++i ) {
195 for( int j=0; j<fonts.size(); ++j ) {
196 if( !strcasecmp(fonts.get(j)->get_text(),
197 fontlist->get(i)->displayname) ) {
203 BC_ListBoxItem *item = 0;
205 fonts.append(item = new
206 BC_ListBoxItem(fontlist->get(i)->displayname));
207 if( !strcmp(client->config.font, item->get_text()) )
208 item->set_selected(1);
209 if( fontlist->values[i]->image ) {
210 VFrame *vframe = fontlist->get(i)->image;
211 BC_Pixmap *icon = new BC_Pixmap(this, vframe, PIXMAP_ALPHA);
212 item->set_icon(icon);
213 item->set_icon_vframe(vframe);
222 for( int i=0; i<fonts.size()-1; ++i ) {
223 if( strcmp(fonts.values[i]->get_text(),
224 fonts.values[i + 1]->get_text()) > 0 ) {
225 BC_ListBoxItem *temp = fonts.values[i + 1];
226 fonts.values[i + 1] = fonts.values[i];
227 fonts.values[i] = temp;
233 add_tool(font_title = new BC_Title(x, y, _("Font:")));
234 font = new TitleFont(client, this, x, y + font_title->get_h());
235 font->create_objects();
236 font->set_show_query(1);
238 add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y+margin));
239 x += font_tumbler->get_w() + margin;
242 add_tool(size_title = new BC_Title(x1, y1+margin, _("Size:")));
243 sprintf(string, "%.2f", client->config.size);
244 x1 += size_title->get_w() + margin;
245 size = new TitleSize(client, this, x1, y1+margin, string);
246 size->create_objects();
247 int x2 = x1 + size->get_w(), y2 = y1 + size->get_h() + margin;
248 add_subwindow(size_tumbler = new TitleSizeTumble(client, this, x2, y1+margin));
250 add_tool(pitch_title = new BC_Title(x-5, y2+margin, _("Pitch:")));
251 pitch = new TitlePitch(client, this, x1, y2+margin, &client->config.line_pitch);
252 pitch->create_objects();
254 int x3 = x2 + size_tumbler->get_w() + 50;
255 int y3 = pitch->get_y() + pitch->get_h();
257 add_tool(style_title = new BC_Title(x=x3, y, _("Style:")));
258 add_tool(italic = new TitleItalic(client, this, x, y + 20));
259 int w1 = italic->get_w();
260 add_tool(bold = new TitleBold(client, this, x, y + 50));
261 if( bold->get_w() > w1 ) w1 = bold->get_w();
263 add_tool(drag = new TitleDrag(client, this, x, y + 80));
264 drag->create_objects();
265 if( drag->get_w() > w1 ) w1 = drag->get_w();
266 if( client->config.drag ) {
267 if( drag->drag_activate() )
268 eprintf("drag enabled, but compositor already grabbed\n");
271 add_tool(alias = new TitleAlias(client, this, x, y+110));
272 if( alias->get_w() > w1 ) w1 = drag->get_w();
275 add_tool(justify_title = new BC_Title(x+50, y, _("Justify:")));
276 add_tool(left = new TitleLeft(client, this, x, y + 20));
278 add_tool(center = new TitleCenter(client, this, x, y + 50));
279 if( center->get_w() > w1 ) w1 = center->get_w();
280 add_tool(right = new TitleRight(client, this, x, y + 80));
281 if( right->get_w() > w1 ) w1 = right->get_w();
284 add_tool(top = new TitleTop(client, this, x, y + 20));
285 add_tool(mid = new TitleMid(client, this, x, y + 50));
286 add_tool(bottom= new TitleBottom(client, this, x, y + 80));
291 w1 = BC_Title::calculate_w(this, _("X:"));
292 if( (x1 = BC_Title::calculate_w(this, _("Y:"))) > w1 ) w1 = x1;
293 if( (x1 = BC_Title::calculate_w(this, _("W:"))) > w1 ) w1 = x1;
294 if( (x1 = BC_Title::calculate_w(this, _("H:"))) > w1 ) w1 = x1;
295 add_tool(x_title = new BC_Title(x1=x, y, _("X:")));
297 title_x = new TitleX(client, this, x1, y);
298 title_x->create_objects();
299 x1 += title_x->get_w()+margin;
300 add_tool(y_title = new BC_Title(x1, y, _("Y:")));
302 title_y = new TitleY(client, this, x1, y);
303 title_y->create_objects();
304 x1 += title_y->get_w();
305 y1 = y + title_y->get_h();
307 add_tool(w_title = new BC_Title(x1=x, y1, _("W:")));
309 title_w = new TitleW(client, this, x1, y1);
310 title_w->create_objects();
311 x1 += title_w->get_w()+margin;
312 add_tool(h_title = new BC_Title(x1, y1, _("H:")));
314 title_h = new TitleH(client, this, x1, y1);
315 title_h->create_objects();
316 x1 += title_h->get_w();
319 add_tool(motion_title = new BC_Title(x1=x, y, _("Motion:")));
320 x1 += motion_title->get_w()+margin;
321 motion = new TitleMotion(client, this, x1, y);
322 motion->create_objects();
323 add_tool(loop = new TitleLoop(client, this, x, y1));
324 x = margin; y = y1 + loop->get_h()+20;
326 add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
327 w1 = dropshadow_title->get_w();
328 dropshadow = new TitleDropShadow(client, this, x, y + 20);
329 dropshadow->create_objects();
330 if( dropshadow->get_w() > w1 ) w1 = dropshadow->get_w();
333 add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
334 w1 = fadein_title->get_w();
335 add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
336 if( fade_in->get_w() > w1 ) w1 = fade_in->get_w();
339 add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
340 w1 = fadeout_title->get_w();
341 add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
342 if( fade_out->get_w() > w1 ) w1 = fade_out->get_w();
345 add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
346 w1 = speed_title->get_w();
347 y += speed_title->get_h() + 5; y1 = y;
348 speed = new TitleSpeed(client, this, x, y);
349 speed->create_objects();
350 if( speed->get_w() > w1 ) w1 = speed->get_w();
352 y2 = y + speed->get_h() + 10;
354 color_x = x3; color_y = y = y1;
355 color_thread = new TitleColorThread(client, this, 0);
356 x1 = color_x + COLOR_W + 2*margin;
358 add_tool(color_button = new TitleColorButton(client, this, x1, y1));
360 outline_color_x = x3; outline_color_y = y;
361 outline_color_thread = new TitleColorThread(client, this, 1);
362 y1 = outline_color_y + 5;
363 add_tool(outline_color_button = new TitleOutlineColorButton(client, this, x1, y1));
366 add_tool(outline_title = new BC_Title(x, y, _("Outline:")));
367 y1 = y + outline_title->get_h() + margin;
368 outline = new TitleOutline(client, this, x, y1);
369 outline->create_objects();
370 x += outline->get_w() + 2*margin;
372 add_tool(stroker_title = new BC_Title(x, y, _("Stroker:")));
373 stroker = new TitleStroker(client, this, x, y1);
374 stroker->create_objects();
375 x += stroker->get_w() + margin;
377 y += outline_title->get_h() + margin;
378 add_tool(timecode = new TitleTimecode(client, this, x1=x, y));
379 x += timecode->get_w() + margin;
380 add_tool(timecode_format = new TitleTimecodeFormat(client, this, x, y,
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() + 3*margin;
394 add_tool(loop_playback = new TitleLoopPlayback(client, this, x, y));
395 y += loop_playback->get_h() + 10;
398 add_tool(text_title = new BC_Title(x, y, _("Text:")));
399 x += text_title->get_w() + 20;
400 int wid = BC_Title::calculate_w(this,"0")*10;
401 add_tool(text_chars = new TitleTextChars(x,y,wid));
402 x += text_chars->get_w() + 20;
403 add_tool(text_bfrsz = new TitleTextBfrSz(x,y,wid));
405 y += text_title->get_h() + margin;
407 text = new TitleText(client, this, x, y, get_w()-margin - x, get_h() - y - 10);
408 text->create_objects();
410 add_tool(cur_popup = new TitleCurPopup(client, this));
411 cur_popup->create_objects();
412 add_tool(fonts_popup = new TitleFontsPopup(client, this));
413 color_popup = new TitleColorPopup(client, this);
414 png_popup = new TitlePngPopup(client, this);
420 int TitleWindow::resize_event(int w, int h)
422 client->config.window_w = w;
423 client->config.window_h = h;
425 clear_box(0, 0, w, h);
426 font_title->reposition_window(font_title->get_x(), font_title->get_y());
427 font->reposition_window(font->get_x(), font->get_y());
428 font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
429 x_title->reposition_window(x_title->get_x(), x_title->get_y());
430 title_x->reposition_window(title_x->get_x(), title_x->get_y());
431 y_title->reposition_window(y_title->get_x(), y_title->get_y());
432 title_y->reposition_window(title_y->get_x(), title_y->get_y());
433 w_title->reposition_window(w_title->get_x(), w_title->get_y());
434 title_w->reposition_window(title_w->get_x(), title_w->get_y());
435 h_title->reposition_window(h_title->get_x(), h_title->get_y());
436 title_h->reposition_window(title_h->get_x(), title_h->get_y());
437 style_title->reposition_window(style_title->get_x(), style_title->get_y());
438 italic->reposition_window(italic->get_x(), italic->get_y());
439 bold->reposition_window(bold->get_x(), bold->get_y());
440 drag->reposition_window(drag->get_x(), drag->get_y());
441 alias->reposition_window(alias->get_x(), alias->get_y());
442 size_title->reposition_window(size_title->get_x(), size_title->get_y());
443 size->reposition_window(size->get_x(), size->get_y());
444 size_tumbler->reposition_window(size_tumbler->get_x(), size_tumbler->get_y());
445 pitch_title->reposition_window(pitch_title->get_x(), pitch_title->get_y());
446 pitch->reposition_window(pitch->get_x(), pitch->get_y());
448 color_button->reposition_window(color_button->get_x(), color_button->get_y());
449 outline_color_button->reposition_window(outline_color_button->get_x(), outline_color_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() - 10,
462 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 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();
495 if( current_font < 0 ) current_font = fonts.total - 1;
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();
513 if( current_font >= fonts.total ) current_font = 0;
515 if( current_font < 0 || current_font >= fonts.total ) return;
517 for( int i=0; i<fonts.total; ++i ) {
518 fonts.values[i]->set_selected(i == current_font);
521 font->update(fonts.values[current_font]->get_text());
522 strcpy(client->config.font, fonts.values[current_font]->get_text());
523 check_style(client->config.font,1);
524 send_configure_change();
527 int TitleWindow::insert_ibeam(const char *txt, int ofs)
529 int ibeam = cur_ibeam;
530 int ilen = strlen(txt)+1;
532 int len = BC_Resources::encode(client->config.encoding, BC_Resources::wide_encoding,
533 (char*)txt,ilen, (char *)wtxt,ilen*sizeof(wtxt[0])) / sizeof(wchar_t);
534 client->insert_text(wtxt, ibeam);
535 while( len > 0 && !wtxt[len] ) --len;
536 int adv = len+1 + ofs;
537 if( (ibeam += adv) >= client->config.wlen)
538 ibeam = client->config.wlen;
539 text->wset_selection(-1, -1, ibeam);
540 text->update(client->config.wtext);
541 send_configure_change();
545 void TitleWindow::update_color()
547 //printf("TitleWindow::update_color %x\n", client->config.color);
548 set_color(client->config.color);
549 draw_box(color_x, color_y, COLOR_W, COLOR_H);
550 flash(color_x, color_y, COLOR_W, COLOR_H);
551 set_color(client->config.outline_color);
552 draw_box(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
554 draw_rectangle(color_x, color_y, COLOR_W, COLOR_H);
555 draw_rectangle(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
556 flash(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
559 void TitleWindow::update_justification()
561 left->update(client->config.hjustification == JUSTIFY_LEFT);
562 center->update(client->config.hjustification == JUSTIFY_CENTER);
563 right->update(client->config.hjustification == JUSTIFY_RIGHT);
564 top->update(client->config.vjustification == JUSTIFY_TOP);
565 mid->update(client->config.vjustification == JUSTIFY_MID);
566 bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
569 void TitleWindow::update_stats()
571 text_chars->update(client->config.wlen);
572 int len = MESSAGESIZE - BCTEXTLEN - strlen(text->get_text()) - 1;
573 if( len < 0 ) len = 0;
574 text_bfrsz->update(len);
577 void TitleWindow::update()
579 title_x->update((int64_t)client->config.title_x);
580 title_y->update((int64_t)client->config.title_y);
581 title_w->update((int64_t)client->config.title_w);
582 title_h->update((int64_t)client->config.title_h);
583 italic->update(client->config.style & BC_FONT_ITALIC);
584 bold->update(client->config.style & BC_FONT_BOLD);
585 alias->update(client->config.style & FONT_ALIAS);
586 size->update(client->config.size);
587 motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
588 loop->update(client->config.loop);
589 dropshadow->update((int64_t)client->config.dropshadow);
590 fade_in->update((float)client->config.fade_in);
591 fade_out->update((float)client->config.fade_out);
592 font->update(client->config.font);
593 check_style(client->config.font,0);
594 text->update(&client->config.wtext[0]);
595 speed->update(client->config.pixels_per_second);
596 outline->update((int64_t)client->config.outline_size);
598 stroker->update((int64_t)client->config.stroke_width);
600 timecode->update(client->config.timecode);
601 timecode_format->update(client->config.timecode_format);
602 background->update(client->config.background);
603 background_path->update(client->config.background_path);
604 loop_playback->update((int64_t)client->config.loop_playback);
606 char string[BCTEXTLEN];
607 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
608 if( timeunit_formats[i] == client->config.timecode_format ) {
609 timecode_format->set_text(
610 Units::print_time_format(timeunit_formats[i], string));
614 update_justification();
620 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
623 this->client = client;
624 this->window = window;
626 int TitleFontTumble::handle_up_event()
628 window->previous_font();
632 int TitleFontTumble::handle_down_event()
639 TitleSizeTumble::TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y)
642 this->client = client;
643 this->window = window;
646 int TitleSizeTumble::handle_up_event()
648 int current_index = -1;
649 int current_difference = -1;
650 for( int i=0; i<window->sizes.size(); ++i ) {
651 int size = atoi(window->sizes.get(i)->get_text());
652 if( current_index < 0 ||
653 abs(size - client->config.size) < current_difference ) {
655 current_difference = abs(size - client->config.size);
660 if( current_index >= window->sizes.size() ) current_index = 0;
663 client->config.size = atoi(window->sizes.get(current_index)->get_text());
664 window->size->update(client->config.size);
665 window->send_configure_change();
669 int TitleSizeTumble::handle_down_event()
671 int current_index = -1;
672 int current_difference = -1;
673 for( int i=0; i<window->sizes.size(); ++i ) {
674 int size = atoi(window->sizes.get(i)->get_text());
675 if( current_index < 0 ||
676 abs(size - client->config.size) < current_difference ) {
678 current_difference = abs(size - client->config.size);
683 if( current_index < 0 ) current_index = window->sizes.size() - 1;
686 client->config.size = atoi(window->sizes.get(current_index)->get_text());
687 window->size->update(client->config.size);
688 window->send_configure_change();
692 TitleAlias::TitleAlias(TitleMain *client, TitleWindow *window, int x, int y)
693 : BC_CheckBox(x, y, client->config.style & FONT_ALIAS, _("Smooth"))
695 this->client = client;
696 this->window = window;
699 int TitleAlias::handle_event()
701 client->config.style =
702 (client->config.style & ~FONT_ALIAS) |
703 (get_value() ? FONT_ALIAS : 0);
704 window->send_configure_change();
708 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
709 : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
711 this->client = client;
712 this->window = window;
715 int TitleBold::handle_event()
717 client->config.style =
718 (client->config.style & ~BC_FONT_BOLD) |
719 (get_value() ? BC_FONT_BOLD : 0);
720 window->send_configure_change();
724 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
725 : BC_CheckBox(x, y, client->config.style & BC_FONT_ITALIC, _("Italic"))
727 this->client = client;
728 this->window = window;
730 int TitleItalic::handle_event()
732 client->config.style =
733 (client->config.style & ~BC_FONT_ITALIC) |
734 (get_value() ? BC_FONT_ITALIC : 0);
735 window->send_configure_change();
741 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
742 : BC_PopupTextBox(window, &window->sizes, text, x, y, 64, 300)
744 this->client = client;
745 this->window = window;
747 TitleSize::~TitleSize()
750 int TitleSize::handle_event()
752 client->config.size = atol(get_text());
753 //printf("TitleSize::handle_event 1 %s\n", get_text());
754 window->send_configure_change();
757 void TitleSize::update(int size)
759 char string[BCTEXTLEN];
760 sprintf(string, "%d", size);
761 BC_PopupTextBox::update(string);
765 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value)
766 : BC_TumbleTextBox(window, *value, 0, INT_MAX, x, y, 64)
768 this->client = client;
769 this->window = window;
778 int TitlePitch::handle_event()
780 *value = atol(get_text());
781 window->send_configure_change();
785 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
786 : BC_GenericButton(x, y, _("Text Color..."))
788 this->client = client;
789 this->window = window;
791 int TitleColorButton::handle_event()
793 window->color_thread->start_window(client->config.color,
794 client->config.alpha);
797 TitleOutlineColorButton::TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y)
798 : BC_GenericButton(x, y, _("Outline color..."))
800 this->client = client;
801 this->window = window;
803 int TitleOutlineColorButton::handle_event()
805 window->outline_color_thread->start_window(client->config.outline_color,
806 client->config.outline_alpha);
811 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
812 : BC_PopupTextBox(window, &window->paths,
813 client->motion_to_text(client->config.motion_strategy),
816 this->client = client;
817 this->window = window;
819 int TitleMotion::handle_event()
821 client->config.motion_strategy = client->text_to_motion(get_text());
822 window->send_configure_change();
826 TitleLoop::TitleLoop(TitleMain *client, TitleWindow *window, int x, int y)
827 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
829 this->client = client;
830 this->window = window;
832 int TitleLoop::handle_event()
834 client->config.loop = get_value();
835 window->send_configure_change();
838 TitleTimecode::TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y)
839 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
841 this->client = client;
842 this->window = window;
844 int TitleTimecode::handle_event()
846 client->config.timecode = get_value();
847 client->send_configure_change();
851 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
852 int x, int y, const char *text)
853 : BC_PopupMenu(x, y, 100, text, 1)
855 this->client = client;
856 this->window = window;
859 int TitleTimecodeFormat::handle_event()
861 client->config.timecode_format = Units::text_to_format(get_text());
862 window->send_configure_change();
866 void TitleTimecodeFormat::create_objects()
868 char string[BCTEXTLEN];
869 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
870 add_item(new BC_MenuItem(
871 Units::print_time_format(timeunit_formats[i], string)));
876 int TitleTimecodeFormat::update(int timecode_format)
878 char string[BCTEXTLEN];
879 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
880 if( timeunit_formats[i] == timecode_format ) {
881 set_text(Units::print_time_format(timeunit_formats[i], string));
888 TitleFade::TitleFade(TitleMain *client, TitleWindow *window,
889 double *value, int x, int y)
890 : BC_TextBox(x, y, 80, 1, (float)*value)
892 this->client = client;
893 this->window = window;
898 int TitleFade::handle_event()
900 *value = atof(get_text());
901 window->send_configure_change();
905 void TitleWindow::check_style(const char *font_name, int update)
907 BC_FontEntry *font_nrm = TitleMain::get_font(font_name, 0);
908 BC_FontEntry *font_itl = TitleMain::get_font(font_name, BC_FONT_ITALIC);
909 BC_FontEntry *font_bld = TitleMain::get_font(font_name, BC_FONT_BOLD);
910 BC_FontEntry *font_bit = TitleMain::get_font(font_name, BC_FONT_ITALIC | BC_FONT_BOLD);
911 int has_norm = font_nrm != 0 ? 1 : 0;
912 int has_ital = font_itl != 0 || font_bit != 0 ? 1 : 0;
913 int has_bold = font_bld != 0 || font_bit != 0 ? 1 : 0;
914 if( bold->get_value() ) {
915 if( !has_bold ) bold->update(0);
918 if( !has_norm && has_bold ) bold->update(1);
920 if( italic->get_value() ) {
921 if( !has_ital ) italic->update(0);
924 if( !has_norm && has_ital ) italic->update(1);
926 if( has_norm && has_bold ) bold->enable(); else bold->disable();
927 if( has_norm && has_ital ) italic->enable(); else italic->disable();
929 int style = stroker && atof(stroker->get_text()) ? BC_FONT_OUTLINE : 0;
930 if( bold->get_value() ) style |= BC_FONT_BOLD;
931 if( italic->get_value() ) style |= BC_FONT_ITALIC;
932 client->config.style = style;
936 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
937 : BC_PopupTextBox(window, &window->fonts, client->config.font,
938 x, y, 240, 300, LISTBOX_ICON_LIST)
940 this->client = client;
941 this->window = window;
943 int TitleFont::handle_event()
945 strcpy(client->config.font, get_text());
946 window->check_style(client->config.font, 1);
947 window->send_configure_change();
951 TitleText::TitleText(TitleMain *client, TitleWindow *window,
952 int x, int y, int w, int h)
953 : BC_ScrollTextBox(window, x, y, w,
954 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
955 client->config.wtext, 8192)
957 this->client = client;
958 this->window = window;
959 //printf("TitleText::TitleText %s\n", client->config.text);
962 int TitleText::button_press_event()
964 if( get_buttonpress() == 3 ) {
965 window->cur_ibeam = get_ibeam_letter();
966 window->cur_popup->activate_menu();
969 return BC_ScrollTextBox::button_press_event();
972 int TitleText::handle_event()
974 window->fonts_popup->deactivate();
975 int text_len = strlen(get_text());
976 int avail = MESSAGESIZE - BCTEXTLEN;
977 if( text_len >= avail ) { // back off last utf8 char
978 char text[2*sizeof(client->config.wtext)];
979 strcpy(text, get_text());
981 while( text_len > 0 && (text[text_len-1] & 0xc0) == 0x80 )
982 text[--text_len] = 0;
984 text[--text_len] = 0;
987 int len = sizeof(client->config.wtext) / sizeof(wchar_t);
988 wcsncpy(client->config.wtext, get_wtext(), len);
989 client->config.wtext[len-1] = 0;
990 client->config.wlen = wcslen(client->config.wtext);
991 window->update_stats();
992 window->send_configure_change();
995 TitleTextChars::TitleTextChars(int x, int y, int w)
996 : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
999 TitleTextChars::~TitleTextChars()
1002 int TitleTextChars::update(int n)
1004 char text[BCSTRLEN];
1005 sprintf(text, _("chars: %d "),n);
1006 return BC_Title::update(text, 0);
1009 TitleTextBfrSz::TitleTextBfrSz(int x, int y, int w)
1010 : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
1013 TitleTextBfrSz::~TitleTextBfrSz()
1016 int TitleTextBfrSz::update(int n)
1018 char text[BCSTRLEN];
1019 sprintf(text, _("bfrsz: %d "),n);
1020 return BC_Title::update(text, 0);
1024 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
1025 : BC_TumbleTextBox(window, client->config.dropshadow,
1026 -1000, 1000, x, y, 70)
1028 this->client = client;
1029 this->window = window;
1031 int TitleDropShadow::handle_event()
1033 client->config.dropshadow = atol(get_text());
1034 window->send_configure_change();
1039 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
1040 : BC_TumbleTextBox(window, client->config.outline_size,
1041 0.f, 1000.f, x, y, 70)
1043 this->client = client;
1044 this->window = window;
1047 int TitleOutline::handle_event()
1049 client->config.outline_size = atof(get_text());
1050 window->send_configure_change();
1055 TitleStroker::TitleStroker(TitleMain *client, TitleWindow *window, int x, int y)
1056 : BC_TumbleTextBox(window, client->config.stroke_width,
1057 0.f, 1000.f, x, y, 70)
1059 this->client = client;
1060 this->window = window;
1063 int TitleStroker::handle_event()
1065 client->config.stroke_width = atof(get_text());
1066 if( client->config.stroke_width )
1067 client->config.style |= BC_FONT_OUTLINE;
1069 client->config.style &= ~BC_FONT_OUTLINE;
1070 window->send_configure_change();
1075 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
1076 : BC_TumbleTextBox(window, client->config.title_x,
1077 -32767.f, 32767.f, x, y, 50)
1079 this->client = client;
1080 this->window = window;
1083 int TitleX::handle_event()
1085 client->config.title_x = atof(get_text());
1086 window->update_drag();
1090 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
1091 : BC_TumbleTextBox(window, client->config.title_y,
1092 -32767.f, 32767.f, x, y, 50)
1094 this->client = client;
1095 this->window = window;
1098 int TitleY::handle_event()
1100 client->config.title_y = atof(get_text());
1101 window->update_drag();
1105 TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
1106 : BC_TumbleTextBox(window, client->config.title_w,
1109 this->client = client;
1110 this->window = window;
1112 int TitleW::handle_event()
1114 client->config.title_w = atol(get_text());
1115 window->update_drag();
1119 TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
1120 : BC_TumbleTextBox(window, client->config.title_h,
1123 this->client = client;
1124 this->window = window;
1126 int TitleH::handle_event()
1128 client->config.title_h = atol(get_text());
1129 window->update_drag();
1133 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
1134 : BC_TumbleTextBox(window, client->config.pixels_per_second,
1135 0.f, 1000.f, x, y, 100)
1137 this->client = client;
1138 this->window = window;
1144 int TitleSpeed::handle_event()
1146 client->config.pixels_per_second = atof(get_text());
1147 window->send_configure_change();
1152 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
1153 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
1155 this->client = client;
1156 this->window = window;
1158 int TitleLeft::handle_event()
1160 client->config.hjustification = JUSTIFY_LEFT;
1161 window->update_justification();
1162 window->send_configure_change();
1166 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
1167 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
1169 this->client = client;
1170 this->window = window;
1172 int TitleCenter::handle_event()
1174 client->config.hjustification = JUSTIFY_CENTER;
1175 window->update_justification();
1176 window->send_configure_change();
1180 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
1181 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
1183 this->client = client;
1184 this->window = window;
1186 int TitleRight::handle_event()
1188 client->config.hjustification = JUSTIFY_RIGHT;
1189 window->update_justification();
1190 window->send_configure_change();
1196 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
1197 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
1199 this->client = client;
1200 this->window = window;
1202 int TitleTop::handle_event()
1204 client->config.vjustification = JUSTIFY_TOP;
1205 window->update_justification();
1206 window->send_configure_change();
1210 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
1211 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
1213 this->client = client;
1214 this->window = window;
1216 int TitleMid::handle_event()
1218 client->config.vjustification = JUSTIFY_MID;
1219 window->update_justification();
1220 window->send_configure_change();
1224 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
1225 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
1227 this->client = client;
1228 this->window = window;
1230 int TitleBottom::handle_event()
1232 client->config.vjustification = JUSTIFY_BOTTOM;
1233 window->update_justification();
1234 window->send_configure_change();
1240 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline)
1241 : ColorPicker(1, is_outline? _("Outline Color") : _("Text Color"))
1243 this->client = client;
1244 this->window = window;
1245 this->is_outline = is_outline;
1248 int TitleColorThread::handle_new_color(int output, int alpha)
1251 client->config.outline_color = output;
1252 client->config.outline_alpha = alpha;
1255 client->config.color = output;
1256 client->config.alpha = alpha;
1259 window->lock_window("TitleColorThread::handle_new_color");
1260 window->update_color();
1262 window->unlock_window();
1264 window->send_configure_change();
1268 TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y)
1269 : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->config.drag,
1270 client->config.title_x, client->config.title_y,
1271 client->config.title_w, client->config.title_h)
1273 this->client = client;
1274 this->window = window;
1277 Track *TitleDrag::get_drag_track()
1279 return client->server->plugin->track;
1281 int64_t TitleDrag::get_drag_position()
1283 return client->get_source_position();
1286 void TitleDrag::update_gui()
1288 client->config.drag = get_value();
1289 client->config.title_x = drag_x;
1290 client->config.title_y = drag_y;
1291 client->config.title_w = drag_w+0.5;
1292 client->config.title_h = drag_h+0.5;
1293 window->title_x->update((float)client->config.title_x);
1294 window->title_y->update((float)client->config.title_y);
1295 window->title_w->update((int64_t)client->config.title_w);
1296 window->title_h->update((int64_t)client->config.title_h);
1297 window->send_configure_change();
1300 int TitleDrag::handle_event()
1302 int ret = DragCheckBox::handle_event();
1303 window->send_configure_change();
1307 TitleBackground::TitleBackground(TitleMain *client, TitleWindow *window, int x, int y)
1308 : BC_CheckBox(x, y, client->config.background, _("Background:"))
1310 this->client = client;
1311 this->window = window;
1314 int TitleBackground::handle_event()
1316 client->config.background = get_value();
1317 window->send_configure_change();
1321 TitleBackgroundPath::TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y)
1322 : BC_TextBox(x, y, 240, 1, client->config.background_path)
1324 this->client = client;
1325 this->window = window;
1328 int TitleBackgroundPath::handle_event()
1330 strncpy(client->config.background_path, get_text(), sizeof(client->config.background_path));
1331 window->send_configure_change();
1335 TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y)
1336 : BC_CheckBox(x, y, client->config.loop_playback, _("Loop playback"))
1338 this->client = client;
1339 this->window = window;
1341 int TitleLoopPlayback::handle_event()
1343 client->config.loop_playback = get_value();
1344 window->send_configure_change();
1349 TitleCurPopup::TitleCurPopup(TitleMain *client, TitleWindow *window)
1350 : BC_PopupMenu(0, 0, 0, "", 0)
1352 this->client = client;
1353 this->window = window;
1355 int TitleCurPopup::handle_event()
1360 void TitleCurSubMenu::add_subitemx(int popup_type, va_list ap, const char *fmt)
1362 char item[BCSTRLEN];
1363 vsnprintf(item, sizeof(item)-1, fmt, ap);
1364 item[sizeof(item)-1] = 0;
1365 add_submenuitem(new TitleCurSubMenuItem(this, item, popup_type));
1368 void TitleCurPopup::create_objects()
1370 TitleCurItem *cur_item;
1371 TitleCurSubMenu *sub_menu;
1373 add_item(cur_item = new TitleCurItem(this, item = _(KW_NUDGE)));
1374 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1375 sub_menu->add_subitem("%s dx,dy",item);
1376 sub_menu->add_subitem("/%s",item);
1377 add_item(cur_item = new TitleCurItem(this, item = _(KW_COLOR)));
1378 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1379 sub_menu->add_subitem(POPUP_COLOR,"%s %s",item,_("#"));
1380 sub_menu->add_subitem("%s ",item);
1381 sub_menu->add_subitem("/%s",item);
1382 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALPHA)));
1383 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1384 sub_menu->add_subitem("%s ",item);
1385 sub_menu->add_subitem("%s 0.",item);
1386 sub_menu->add_subitem("%s .5",item);
1387 sub_menu->add_subitem("%s 1.",item);
1388 sub_menu->add_subitem("/%s",item);
1389 add_item(cur_item = new TitleCurItem(this, item = _(KW_FONT)));
1390 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1391 sub_menu->add_subitem(POPUP_FONT,"%s %s",item, _("name"));
1392 sub_menu->add_subitem(POPUP_OFFSET, "%s ",item);
1393 sub_menu->add_subitem("/%s",item);
1394 add_item(cur_item = new TitleCurItem(this, item = _(KW_SIZE)));
1395 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1396 sub_menu->add_subitem("%s +",item);
1397 sub_menu->add_subitem("%s -",item);
1398 sub_menu->add_subitem("%s ",item);
1399 sub_menu->add_subitem("/%s",item);
1400 add_item(cur_item = new TitleCurItem(this, item = _(KW_BOLD)));
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",item);
1405 add_item(cur_item = new TitleCurItem(this, item = _(KW_ITALIC)));
1406 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1407 sub_menu->add_subitem("%s 1",item);
1408 sub_menu->add_subitem("%s 0",item);
1409 sub_menu->add_subitem("/%s",item);
1410 add_item(cur_item = new TitleCurItem(this, item = _(KW_CAPS)));
1411 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1412 sub_menu->add_subitem("%s 1",item);
1413 sub_menu->add_subitem("%s 0",item);
1414 sub_menu->add_subitem("%s -1",item);
1415 sub_menu->add_subitem("/%s",item);
1416 add_item(cur_item = new TitleCurItem(this, item = _(KW_UL)));
1417 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1418 sub_menu->add_subitem("%s 1",item);
1419 sub_menu->add_subitem("%s 0",item);
1420 sub_menu->add_subitem("/%s",item);
1421 add_item(cur_item = new TitleCurItem(this, item = _(KW_BLINK)));
1422 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1423 sub_menu->add_subitem("%s 1",item);
1424 sub_menu->add_subitem("%s -1",item);
1425 sub_menu->add_subitem("%s ",item);
1426 sub_menu->add_subitem("%s 0",item);
1427 sub_menu->add_subitem("/%s",item);
1428 add_item(cur_item = new TitleCurItem(this, item = _(KW_FIXED)));
1429 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1430 sub_menu->add_subitem("%s ",item);
1431 sub_menu->add_subitem("%s 20",item);
1432 sub_menu->add_subitem("%s 10",item);
1433 sub_menu->add_subitem("%s 0",item);
1434 sub_menu->add_subitem("/%s",item);
1435 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALIAS)));
1436 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1437 sub_menu->add_subitem("%s 1",item);
1438 sub_menu->add_subitem("%s 0",item);
1439 sub_menu->add_subitem("/%s",item);
1440 add_item(cur_item = new TitleCurItem(this, item = _(KW_SUP)));
1441 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1442 sub_menu->add_subitem("%s 1",item);
1443 sub_menu->add_subitem("%s 0",item);
1444 sub_menu->add_subitem("%s -1",item);
1445 sub_menu->add_subitem("/%s",item);
1446 add_item(cur_item = new TitleCurItem(this, item = _(KW_PNG)));
1447 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1448 sub_menu->add_subitem(POPUP_PNG,"%s %s", item, _("file"));
1451 TitleCurItem::TitleCurItem(TitleCurPopup *popup, const char *text)
1454 this->popup = popup;
1456 int TitleCurItem::handle_event()
1461 TitleCurSubMenu::TitleCurSubMenu(TitleCurItem *cur_item)
1463 this->cur_item = cur_item;
1465 TitleCurSubMenu::~TitleCurSubMenu()
1469 TitleCurSubMenuItem::TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type)
1472 this->submenu = submenu;
1473 this->popup_type = popup_type;
1475 TitleCurSubMenuItem::~TitleCurSubMenuItem()
1478 int TitleCurSubMenuItem::handle_event()
1480 TitleCurPopup *popup = submenu->cur_item->popup;
1481 TitleWindow *window = popup->window;
1482 const char *item_text = get_text();
1483 int ofs = *item_text == '/' ? 0 : -1;
1484 switch( popup_type ) {
1487 window->get_pop_cursor(px ,py);
1488 window->fonts_popup->activate(px, py, 300,200);
1491 window->color_popup->activate();
1494 window->png_popup->activate();
1501 sprintf(txt, "<%s>", item_text);
1502 return window->insert_ibeam(txt, ofs);
1505 TitleFontsPopup::TitleFontsPopup(TitleMain *client, TitleWindow *window)
1506 : BC_ListBox(-1, -1, 1, 1, LISTBOX_ICON_LIST,
1507 &window->fonts, 0, 0, 1, 0, 1)
1509 this->client = client;
1510 this->window = window;
1514 TitleFontsPopup::~TitleFontsPopup()
1517 int TitleFontsPopup::keypress_event()
1519 switch( get_keypress() ) {
1527 return BC_ListBox::keypress_event();
1530 int TitleFontsPopup::handle_event()
1533 BC_ListBoxItem *item = get_selection(0, 0);
1534 if( !item ) return 1;
1535 const char *item_text = item->get_text();
1536 char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_FONT), item_text);
1537 return window->insert_ibeam(txt);
1540 TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
1541 : ColorPicker(0, _("Color"))
1543 this->client = client;
1544 this->window = window;
1545 this->color_value = client->config.color;
1547 TitleColorPopup::~TitleColorPopup()
1550 int TitleColorPopup::handle_new_color(int output, int alpha)
1552 color_value = output;
1555 int TitleColorPopup::activate()
1557 start_window(client->config.color, 255, 1);
1560 void TitleColorPopup::handle_done_event(int result)
1562 if( result ) return;
1563 char txt[BCSTRLEN]; sprintf(txt, "<%s #%06x>", _(KW_COLOR), color_value);
1564 window->insert_ibeam(txt);
1567 TitlePngPopup::TitlePngPopup(TitleMain *client, TitleWindow *window)
1570 this->client = client;
1571 this->window = window;
1574 TitlePngPopup::~TitlePngPopup()
1579 void TitlePngPopup::handle_done_event(int result)
1581 if( result ) return;
1582 BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui();
1583 const char *path = gui->get_submitted_path();
1584 char txt[BCSTRLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
1585 window->insert_ibeam(txt);
1588 BC_Window *TitlePngPopup::new_gui()
1590 MWindow *mwindow = client->server->mwindow;
1591 int x, y; mwindow->gui->get_abs_cursor(x, y);
1593 BC_Window *gui = new BrowseButtonWindow(mwindow->theme,
1594 x-25, y-100, window, "", _("Png file"), _("Png path"), 0);
1595 gui->create_objects();
1599 int TitlePngPopup::activate()
1601 BC_DialogThread::start();