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;
109 left = 0; center = 0; right = 0;
110 top = 0; mid = 0; bottom = 0;
121 void TitleWindow::done_event(int result)
123 drag->drag_deactivate();
124 color_thread->close_window();
125 outline_color_thread->close_window();
126 color_popup->close_window();
127 png_popup->close_window();
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;
144 void TitleWindow::create_objects()
147 int margin = client->get_theme()->widget_border;
148 char string[BCTEXTLEN];
152 client->build_previews(this);
154 sizes.append(new BC_ListBoxItem("8"));
155 sizes.append(new BC_ListBoxItem("9"));
156 sizes.append(new BC_ListBoxItem("10"));
157 sizes.append(new BC_ListBoxItem("11"));
158 sizes.append(new BC_ListBoxItem("12"));
159 sizes.append(new BC_ListBoxItem("13"));
160 sizes.append(new BC_ListBoxItem("14"));
161 sizes.append(new BC_ListBoxItem("16"));
162 sizes.append(new BC_ListBoxItem("18"));
163 sizes.append(new BC_ListBoxItem("20"));
164 sizes.append(new BC_ListBoxItem("22"));
165 sizes.append(new BC_ListBoxItem("24"));
166 sizes.append(new BC_ListBoxItem("26"));
167 sizes.append(new BC_ListBoxItem("28"));
168 sizes.append(new BC_ListBoxItem("32"));
169 sizes.append(new BC_ListBoxItem("36"));
170 sizes.append(new BC_ListBoxItem("40"));
171 sizes.append(new BC_ListBoxItem("48"));
172 sizes.append(new BC_ListBoxItem("56"));
173 sizes.append(new BC_ListBoxItem("64"));
174 sizes.append(new BC_ListBoxItem("72"));
175 sizes.append(new BC_ListBoxItem("100"));
176 sizes.append(new BC_ListBoxItem("128"));
177 sizes.append(new BC_ListBoxItem("256"));
178 sizes.append(new BC_ListBoxItem("512"));
179 sizes.append(new BC_ListBoxItem("1024"));
181 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
182 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
183 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
184 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
185 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
189 // Construct font list
190 ArrayList<BC_FontEntry*> *fontlist = get_resources()->fontlist;
192 for( int i=0; i<fontlist->size(); ++i ) {
194 for( int j=0; j<fonts.size(); ++j ) {
195 if( !strcasecmp(fonts.get(j)->get_text(),
196 fontlist->get(i)->displayname) ) {
202 BC_ListBoxItem *item = 0;
204 fonts.append(item = new
205 BC_ListBoxItem(fontlist->get(i)->displayname));
206 if( !strcmp(client->config.font, item->get_text()) )
207 item->set_selected(1);
208 if( fontlist->values[i]->image ) {
209 VFrame *vframe = fontlist->get(i)->image;
210 BC_Pixmap *icon = new BC_Pixmap(this, vframe, PIXMAP_ALPHA);
211 item->set_icon(icon);
212 item->set_icon_vframe(vframe);
221 for( int i=0; i<fonts.size()-1; ++i ) {
222 if( strcmp(fonts.values[i]->get_text(),
223 fonts.values[i + 1]->get_text()) > 0 ) {
224 BC_ListBoxItem *temp = fonts.values[i + 1];
225 fonts.values[i + 1] = fonts.values[i];
226 fonts.values[i] = temp;
232 add_tool(font_title = new BC_Title(x, y, _("Font:")));
233 font = new TitleFont(client, this, x, y + font_title->get_h());
234 font->create_objects();
235 font->set_show_query(1);
237 add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y+margin));
238 x += font_tumbler->get_w() + margin;
241 add_tool(size_title = new BC_Title(x1, y1+margin, _("Size:")));
242 sprintf(string, "%.2f", client->config.size);
243 x1 += size_title->get_w() + margin;
244 size = new TitleSize(client, this, x1, y1+margin, string);
245 size->create_objects();
246 int x2 = x1 + size->get_w(), y2 = y1 + size->get_h() + margin;
247 add_subwindow(size_tumbler = new TitleSizeTumble(client, this, x2, y1+margin));
249 add_tool(pitch_title = new BC_Title(x-5, y2+margin, _("Pitch:")));
250 pitch = new TitlePitch(client, this, x1, y2+margin, &client->config.line_pitch);
251 pitch->create_objects();
253 int x3 = x2 + size_tumbler->get_w() + 50;
254 int y3 = pitch->get_y() + pitch->get_h();
256 add_tool(style_title = new BC_Title(x=x3, y, _("Style:")));
257 add_tool(italic = new TitleItalic(client, this, x, y + 20));
258 int w1 = italic->get_w();
259 add_tool(bold = new TitleBold(client, this, x, y + 50));
260 if( bold->get_w() > w1 ) w1 = bold->get_w();
262 add_tool(drag = new TitleDrag(client, this, x, y + 80));
263 drag->create_objects();
264 if( drag->get_w() > w1 ) w1 = drag->get_w();
265 if( client->config.drag ) {
266 if( drag->drag_activate() )
267 eprintf("drag enabled, but compositor already grabbed\n");
270 add_tool(alias = new TitleAlias(client, this, x, y+110));
271 if( alias->get_w() > w1 ) w1 = drag->get_w();
274 add_tool(justify_title = new BC_Title(x+50, y, _("Justify:")));
275 add_tool(left = new TitleLeft(client, this, x, y + 20));
277 add_tool(center = new TitleCenter(client, this, x, y + 50));
278 if( center->get_w() > w1 ) w1 = center->get_w();
279 add_tool(right = new TitleRight(client, this, x, y + 80));
280 if( right->get_w() > w1 ) w1 = right->get_w();
283 add_tool(top = new TitleTop(client, this, x, y + 20));
284 add_tool(mid = new TitleMid(client, this, x, y + 50));
285 add_tool(bottom= new TitleBottom(client, this, x, y + 80));
290 w1 = BC_Title::calculate_w(this, _("X:"));
291 if( (x1 = BC_Title::calculate_w(this, _("Y:"))) > w1 ) w1 = x1;
292 if( (x1 = BC_Title::calculate_w(this, _("W:"))) > w1 ) w1 = x1;
293 if( (x1 = BC_Title::calculate_w(this, _("H:"))) > w1 ) w1 = x1;
294 add_tool(x_title = new BC_Title(x1=x, y, _("X:")));
296 title_x = new TitleX(client, this, x1, y);
297 title_x->create_objects();
298 x1 += title_x->get_w()+margin;
299 add_tool(y_title = new BC_Title(x1, y, _("Y:")));
301 title_y = new TitleY(client, this, x1, y);
302 title_y->create_objects();
303 x1 += title_y->get_w();
304 y1 = y + title_y->get_h();
306 add_tool(w_title = new BC_Title(x1=x, y1, _("W:")));
308 title_w = new TitleW(client, this, x1, y1);
309 title_w->create_objects();
310 x1 += title_w->get_w()+margin;
311 add_tool(h_title = new BC_Title(x1, y1, _("H:")));
313 title_h = new TitleH(client, this, x1, y1);
314 title_h->create_objects();
315 x1 += title_h->get_w();
318 add_tool(motion_title = new BC_Title(x1=x, y, _("Motion:")));
319 x1 += motion_title->get_w()+margin;
320 motion = new TitleMotion(client, this, x1, y);
321 motion->create_objects();
322 add_tool(loop = new TitleLoop(client, this, x, y1));
323 x = margin; y = y1 + loop->get_h()+20;
325 add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
326 w1 = dropshadow_title->get_w();
327 dropshadow = new TitleDropShadow(client, this, x, y + 20);
328 dropshadow->create_objects();
329 if( dropshadow->get_w() > w1 ) w1 = dropshadow->get_w();
332 add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
333 w1 = fadein_title->get_w();
334 add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
335 if( fade_in->get_w() > w1 ) w1 = fade_in->get_w();
338 add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
339 w1 = fadeout_title->get_w();
340 add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
341 if( fade_out->get_w() > w1 ) w1 = fade_out->get_w();
344 add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
345 w1 = speed_title->get_w();
346 y += speed_title->get_h() + 5; y1 = y;
347 speed = new TitleSpeed(client, this, x, y);
348 speed->create_objects();
349 if( speed->get_w() > w1 ) w1 = speed->get_w();
351 y2 = y + speed->get_h() + 10;
353 color_x = x3; color_y = y = y1;
354 color_thread = new TitleColorThread(client, this, 0);
355 x1 = color_x + COLOR_W + 2*margin;
357 add_tool(color_button = new TitleColorButton(client, this, x1, y1));
359 outline_color_x = x3; outline_color_y = y;
360 outline_color_thread = new TitleColorThread(client, this, 1);
361 y1 = outline_color_y + 5;
362 add_tool(outline_color_button = new TitleOutlineColorButton(client, this, x1, y1));
365 add_tool(outline_title = new BC_Title(x, y, _("Outline:")));
366 y1 = y + outline_title->get_h() + margin;
367 outline = new TitleOutline(client, this, x, y1);
368 outline->create_objects();
369 x += outline->get_w() + 2*margin;
371 add_tool(stroker_title = new BC_Title(x, y, _("Stroker:")));
372 stroker = new TitleStroker(client, this, x, y1);
373 stroker->create_objects();
374 x += stroker->get_w() + margin;
376 y += outline_title->get_h() + margin;
377 add_tool(timecode = new TitleTimecode(client, this, x1=x, y));
378 x += timecode->get_w() + margin;
379 add_tool(timecode_format = new TitleTimecodeFormat(client, this, x, y,
380 Units::print_time_format(client->config.timecode_format, string)));
381 timecode_format->create_objects();
382 y += timecode_format->get_h() + margin;
385 add_tool(background = new TitleBackground(client, this, x, y));
386 x += background->get_w() + margin;
387 add_tool(background_path = new TitleBackgroundPath(client, this, x, y));
388 x += background_path->get_w() + margin;
389 add_tool(background_browse = new BrowseButton(
390 client->server->mwindow->theme, this, background_path,
391 x, y, "", _("background media"), _("Select background media path")));
392 x += background_browse->get_w() + 3*margin;
393 add_tool(loop_playback = new TitleLoopPlayback(client, this, x, y));
394 y += loop_playback->get_h() + 10;
397 add_tool(text_title = new BC_Title(x, y, _("Text:")));
398 x += text_title->get_w() + 20;
399 int wid = BC_Title::calculate_w(this,"0")*10;
400 add_tool(text_chars = new TitleTextChars(x,y,wid));
402 y += text_title->get_h() + margin;
404 text = new TitleText(client, this, x, y, get_w()-margin - x, get_h() - y - 10);
405 text->create_objects();
407 add_tool(cur_popup = new TitleCurPopup(client, this));
408 cur_popup->create_objects();
409 add_tool(fonts_popup = new TitleFontsPopup(client, this));
410 color_popup = new TitleColorPopup(client, this);
411 png_popup = new TitlePngPopup(client, this);
417 int TitleWindow::resize_event(int w, int h)
419 client->config.window_w = w;
420 client->config.window_h = h;
422 clear_box(0, 0, w, h);
423 font_title->reposition_window(font_title->get_x(), font_title->get_y());
424 font->reposition_window(font->get_x(), font->get_y());
425 font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
426 x_title->reposition_window(x_title->get_x(), x_title->get_y());
427 title_x->reposition_window(title_x->get_x(), title_x->get_y());
428 y_title->reposition_window(y_title->get_x(), y_title->get_y());
429 title_y->reposition_window(title_y->get_x(), title_y->get_y());
430 w_title->reposition_window(w_title->get_x(), w_title->get_y());
431 title_w->reposition_window(title_w->get_x(), title_w->get_y());
432 h_title->reposition_window(h_title->get_x(), h_title->get_y());
433 title_h->reposition_window(title_h->get_x(), title_h->get_y());
434 style_title->reposition_window(style_title->get_x(), style_title->get_y());
435 italic->reposition_window(italic->get_x(), italic->get_y());
436 bold->reposition_window(bold->get_x(), bold->get_y());
437 drag->reposition_window(drag->get_x(), drag->get_y());
438 alias->reposition_window(alias->get_x(), alias->get_y());
439 size_title->reposition_window(size_title->get_x(), size_title->get_y());
440 size->reposition_window(size->get_x(), size->get_y());
441 size_tumbler->reposition_window(size_tumbler->get_x(), size_tumbler->get_y());
442 pitch_title->reposition_window(pitch_title->get_x(), pitch_title->get_y());
443 pitch->reposition_window(pitch->get_x(), pitch->get_y());
445 color_button->reposition_window(color_button->get_x(), color_button->get_y());
446 outline_color_button->reposition_window(outline_color_button->get_x(), outline_color_button->get_y());
447 motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
448 motion->reposition_window(motion->get_x(), motion->get_y());
449 loop->reposition_window(loop->get_x(), loop->get_y());
450 dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
451 dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
452 fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
453 fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
454 fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
455 fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
456 text_title->reposition_window(text_title->get_x(), text_title->get_y());
457 timecode->reposition_window(timecode->get_x(), timecode->get_y());
458 text->reposition_window(text->get_x(), text->get_y(), w - text->get_x() - 10,
459 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));
460 justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
461 left->reposition_window(left->get_x(), left->get_y());
462 center->reposition_window(center->get_x(), center->get_y());
463 right->reposition_window(right->get_x(), right->get_y());
464 top->reposition_window(top->get_x(), top->get_y());
465 mid->reposition_window(mid->get_x(), mid->get_y());
466 bottom->reposition_window(bottom->get_x(), bottom->get_y());
467 speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
468 speed->reposition_window(speed->get_x(), speed->get_y());
475 void TitleWindow::update_drag()
477 drag->drag_x = client->config.title_x;
478 drag->drag_y = client->config.title_y;
479 drag->drag_w = client->config.title_w;
480 drag->drag_h = client->config.title_h;
481 send_configure_change();
483 void TitleWindow::send_configure_change()
485 client->send_configure_change();
488 void TitleWindow::previous_font()
490 int current_font = font->get_number();
492 if( current_font < 0 ) current_font = fonts.total - 1;
494 if( current_font < 0 || current_font >= fonts.total ) return;
496 for( int i=0; i<fonts.total; ++i ) {
497 fonts.values[i]->set_selected(i == current_font);
500 font->update(fonts.values[current_font]->get_text());
501 strcpy(client->config.font, fonts.values[current_font]->get_text());
502 check_style(client->config.font,1);
503 send_configure_change();
506 void TitleWindow::next_font()
508 int current_font = font->get_number();
510 if( current_font >= fonts.total ) current_font = 0;
512 if( current_font < 0 || current_font >= fonts.total ) return;
514 for( int i=0; i<fonts.total; ++i ) {
515 fonts.values[i]->set_selected(i == current_font);
518 font->update(fonts.values[current_font]->get_text());
519 strcpy(client->config.font, fonts.values[current_font]->get_text());
520 check_style(client->config.font,1);
521 send_configure_change();
524 int TitleWindow::insert_ibeam(const char *txt, int ofs)
526 int ibeam = cur_ibeam;
527 int ilen = strlen(txt)+1;
529 int len = BC_Resources::encode(client->config.encoding, BC_Resources::wide_encoding,
530 (char*)txt,ilen, (char *)wtxt,ilen*sizeof(wtxt[0])) / sizeof(wchar_t);
531 client->insert_text(wtxt, ibeam);
532 while( len > 0 && !wtxt[len] ) --len;
533 int adv = len+1 + ofs;
534 if( (ibeam += adv) >= client->config.wlen)
535 ibeam = client->config.wlen;
536 text->wset_selection(-1, -1, ibeam);
537 text->update(client->config.wtext);
538 send_configure_change();
542 void TitleWindow::update_color()
544 //printf("TitleWindow::update_color %x\n", client->config.color);
545 set_color(client->config.color);
546 draw_box(color_x, color_y, COLOR_W, COLOR_H);
547 flash(color_x, color_y, COLOR_W, COLOR_H);
548 set_color(client->config.outline_color);
549 draw_box(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
551 draw_rectangle(color_x, color_y, COLOR_W, COLOR_H);
552 draw_rectangle(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
553 flash(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
556 void TitleWindow::update_justification()
558 left->update(client->config.hjustification == JUSTIFY_LEFT);
559 center->update(client->config.hjustification == JUSTIFY_CENTER);
560 right->update(client->config.hjustification == JUSTIFY_RIGHT);
561 top->update(client->config.vjustification == JUSTIFY_TOP);
562 mid->update(client->config.vjustification == JUSTIFY_MID);
563 bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
566 void TitleWindow::update_stats()
568 text_chars->update(client->config.wlen);
571 void TitleWindow::update()
573 title_x->update((int64_t)client->config.title_x);
574 title_y->update((int64_t)client->config.title_y);
575 title_w->update((int64_t)client->config.title_w);
576 title_h->update((int64_t)client->config.title_h);
577 italic->update(client->config.style & BC_FONT_ITALIC);
578 bold->update(client->config.style & BC_FONT_BOLD);
579 alias->update(client->config.style & FONT_ALIAS);
580 size->update(client->config.size);
581 motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
582 loop->update(client->config.loop);
583 dropshadow->update((int64_t)client->config.dropshadow);
584 fade_in->update((float)client->config.fade_in);
585 fade_out->update((float)client->config.fade_out);
586 font->update(client->config.font);
587 check_style(client->config.font,0);
588 text->update(client->config.wtext ? &client->config.wtext[0] : L"");
589 speed->update(client->config.pixels_per_second);
590 outline->update((int64_t)client->config.outline_size);
592 stroker->update((int64_t)client->config.stroke_width);
594 timecode->update(client->config.timecode);
595 timecode_format->update(client->config.timecode_format);
596 background->update(client->config.background);
597 background_path->update(client->config.background_path);
598 loop_playback->update((int64_t)client->config.loop_playback);
600 char string[BCTEXTLEN];
601 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
602 if( timeunit_formats[i] == client->config.timecode_format ) {
603 timecode_format->set_text(
604 Units::print_time_format(timeunit_formats[i], string));
608 update_justification();
614 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
617 this->client = client;
618 this->window = window;
620 int TitleFontTumble::handle_up_event()
622 window->previous_font();
626 int TitleFontTumble::handle_down_event()
633 TitleSizeTumble::TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y)
636 this->client = client;
637 this->window = window;
640 int TitleSizeTumble::handle_up_event()
642 int current_index = -1;
643 int current_difference = -1;
644 for( int i=0; i<window->sizes.size(); ++i ) {
645 int size = atoi(window->sizes.get(i)->get_text());
646 if( current_index < 0 ||
647 abs(size - client->config.size) < current_difference ) {
649 current_difference = abs(size - client->config.size);
654 if( current_index >= window->sizes.size() ) current_index = 0;
657 client->config.size = atoi(window->sizes.get(current_index)->get_text());
658 window->size->update(client->config.size);
659 window->send_configure_change();
663 int TitleSizeTumble::handle_down_event()
665 int current_index = -1;
666 int current_difference = -1;
667 for( int i=0; i<window->sizes.size(); ++i ) {
668 int size = atoi(window->sizes.get(i)->get_text());
669 if( current_index < 0 ||
670 abs(size - client->config.size) < current_difference ) {
672 current_difference = abs(size - client->config.size);
677 if( current_index < 0 ) current_index = window->sizes.size() - 1;
680 client->config.size = atoi(window->sizes.get(current_index)->get_text());
681 window->size->update(client->config.size);
682 window->send_configure_change();
686 TitleAlias::TitleAlias(TitleMain *client, TitleWindow *window, int x, int y)
687 : BC_CheckBox(x, y, client->config.style & FONT_ALIAS, _("Smooth"))
689 this->client = client;
690 this->window = window;
693 int TitleAlias::handle_event()
695 client->config.style =
696 (client->config.style & ~FONT_ALIAS) |
697 (get_value() ? FONT_ALIAS : 0);
698 window->send_configure_change();
702 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
703 : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
705 this->client = client;
706 this->window = window;
709 int TitleBold::handle_event()
711 client->config.style =
712 (client->config.style & ~BC_FONT_BOLD) |
713 (get_value() ? BC_FONT_BOLD : 0);
714 window->send_configure_change();
718 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
719 : BC_CheckBox(x, y, client->config.style & BC_FONT_ITALIC, _("Italic"))
721 this->client = client;
722 this->window = window;
724 int TitleItalic::handle_event()
726 client->config.style =
727 (client->config.style & ~BC_FONT_ITALIC) |
728 (get_value() ? BC_FONT_ITALIC : 0);
729 window->send_configure_change();
735 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
736 : BC_PopupTextBox(window, &window->sizes, text, x, y, 64, 300)
738 this->client = client;
739 this->window = window;
741 TitleSize::~TitleSize()
744 int TitleSize::handle_event()
746 client->config.size = atol(get_text());
747 //printf("TitleSize::handle_event 1 %s\n", get_text());
748 window->send_configure_change();
751 void TitleSize::update(int size)
753 char string[BCTEXTLEN];
754 sprintf(string, "%d", size);
755 BC_PopupTextBox::update(string);
759 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value)
760 : BC_TumbleTextBox(window, *value, 0, INT_MAX, x, y, 64)
762 this->client = client;
763 this->window = window;
772 int TitlePitch::handle_event()
774 *value = atol(get_text());
775 window->send_configure_change();
779 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
780 : BC_GenericButton(x, y, _("Text Color..."))
782 this->client = client;
783 this->window = window;
785 int TitleColorButton::handle_event()
787 window->color_thread->start_window(client->config.color,
788 client->config.alpha, 1);
791 TitleOutlineColorButton::TitleOutlineColorButton(TitleMain *client, TitleWindow *window, int x, int y)
792 : BC_GenericButton(x, y, _("Outline color..."))
794 this->client = client;
795 this->window = window;
797 int TitleOutlineColorButton::handle_event()
799 window->outline_color_thread->start_window(client->config.outline_color,
800 client->config.outline_alpha, 1);
805 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
806 : BC_PopupTextBox(window, &window->paths,
807 client->motion_to_text(client->config.motion_strategy),
810 this->client = client;
811 this->window = window;
813 int TitleMotion::handle_event()
815 client->config.motion_strategy = client->text_to_motion(get_text());
816 window->send_configure_change();
820 TitleLoop::TitleLoop(TitleMain *client, TitleWindow *window, int x, int y)
821 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
823 this->client = client;
824 this->window = window;
826 int TitleLoop::handle_event()
828 client->config.loop = get_value();
829 window->send_configure_change();
832 TitleTimecode::TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y)
833 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
835 this->client = client;
836 this->window = window;
838 int TitleTimecode::handle_event()
840 client->config.timecode = get_value();
841 client->send_configure_change();
845 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
846 int x, int y, const char *text)
847 : BC_PopupMenu(x, y, 100, text, 1)
849 this->client = client;
850 this->window = window;
853 int TitleTimecodeFormat::handle_event()
855 client->config.timecode_format = Units::text_to_format(get_text());
856 window->send_configure_change();
860 void TitleTimecodeFormat::create_objects()
862 char string[BCTEXTLEN];
863 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
864 add_item(new BC_MenuItem(
865 Units::print_time_format(timeunit_formats[i], string)));
870 int TitleTimecodeFormat::update(int timecode_format)
872 char string[BCTEXTLEN];
873 for( int i=0; i<lengthof(timeunit_formats); ++i ) {
874 if( timeunit_formats[i] == timecode_format ) {
875 set_text(Units::print_time_format(timeunit_formats[i], string));
882 TitleFade::TitleFade(TitleMain *client, TitleWindow *window,
883 double *value, int x, int y)
884 : BC_TextBox(x, y, 80, 1, (float)*value)
886 this->client = client;
887 this->window = window;
892 int TitleFade::handle_event()
894 *value = atof(get_text());
895 window->send_configure_change();
899 void TitleWindow::check_style(const char *font_name, int update)
901 BC_FontEntry *font_nrm = TitleMain::get_font(font_name, 0);
902 BC_FontEntry *font_itl = TitleMain::get_font(font_name, BC_FONT_ITALIC);
903 BC_FontEntry *font_bld = TitleMain::get_font(font_name, BC_FONT_BOLD);
904 BC_FontEntry *font_bit = TitleMain::get_font(font_name, BC_FONT_ITALIC | BC_FONT_BOLD);
905 int has_norm = font_nrm != 0 ? 1 : 0;
906 int has_ital = font_itl != 0 || font_bit != 0 ? 1 : 0;
907 int has_bold = font_bld != 0 || font_bit != 0 ? 1 : 0;
908 if( bold->get_value() ) {
909 if( !has_bold ) bold->update(0);
912 if( !has_norm && has_bold ) bold->update(1);
914 if( italic->get_value() ) {
915 if( !has_ital ) italic->update(0);
918 if( !has_norm && has_ital ) italic->update(1);
920 if( has_norm && has_bold ) bold->enable(); else bold->disable();
921 if( has_norm && has_ital ) italic->enable(); else italic->disable();
923 int style = stroker && atof(stroker->get_text()) ? BC_FONT_OUTLINE : 0;
924 if( bold->get_value() ) style |= BC_FONT_BOLD;
925 if( italic->get_value() ) style |= BC_FONT_ITALIC;
926 client->config.style = style;
930 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
931 : BC_PopupTextBox(window, &window->fonts, client->config.font,
932 x, y, 240, 300, LISTBOX_ICON_LIST)
934 this->client = client;
935 this->window = window;
937 int TitleFont::handle_event()
939 strcpy(client->config.font, get_text());
940 window->check_style(client->config.font, 1);
941 window->send_configure_change();
945 TitleText::TitleText(TitleMain *client, TitleWindow *window,
946 int x, int y, int w, int h)
947 : BC_ScrollTextBox(window, x, y, w,
948 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
949 client->config.wtext, 0)
951 this->client = client;
952 this->window = window;
953 //printf("TitleText::TitleText %s\n", client->config.text);
956 int TitleText::button_press_event()
958 if( get_buttonpress() == 3 ) {
959 window->cur_ibeam = get_ibeam_letter();
960 window->cur_popup->activate_menu();
963 return BC_ScrollTextBox::button_press_event();
966 int TitleText::handle_event()
968 window->fonts_popup->deactivate();
969 const wchar_t *wtext = get_wtext();
970 long wlen = wcslen(wtext);
971 client->config.demand(wlen);
972 wcsncpy(client->config.wtext, wtext, client->config.wsize);
973 client->config.wlen = wlen;
974 window->update_stats();
975 window->send_configure_change();
978 TitleTextChars::TitleTextChars(int x, int y, int w)
979 : BC_Title(x, y, "", MEDIUMFONT, -1, 0, w)
982 TitleTextChars::~TitleTextChars()
985 int TitleTextChars::update(int n)
988 sprintf(text, _("chars: %d "),n);
989 return BC_Title::update(text, 0);
993 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
994 : BC_TumbleTextBox(window, client->config.dropshadow,
995 -1000, 1000, x, y, 70)
997 this->client = client;
998 this->window = window;
1000 int TitleDropShadow::handle_event()
1002 client->config.dropshadow = atol(get_text());
1003 window->send_configure_change();
1008 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
1009 : BC_TumbleTextBox(window, client->config.outline_size,
1010 0.f, 1000.f, x, y, 70)
1012 this->client = client;
1013 this->window = window;
1016 int TitleOutline::handle_event()
1018 client->config.outline_size = atof(get_text());
1019 window->send_configure_change();
1024 TitleStroker::TitleStroker(TitleMain *client, TitleWindow *window, int x, int y)
1025 : BC_TumbleTextBox(window, client->config.stroke_width,
1026 0.f, 1000.f, x, y, 70)
1028 this->client = client;
1029 this->window = window;
1032 int TitleStroker::handle_event()
1034 client->config.stroke_width = atof(get_text());
1035 if( client->config.stroke_width )
1036 client->config.style |= BC_FONT_OUTLINE;
1038 client->config.style &= ~BC_FONT_OUTLINE;
1039 window->send_configure_change();
1044 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
1045 : BC_TumbleTextBox(window, client->config.title_x,
1046 -32767.f, 32767.f, x, y, 50)
1048 this->client = client;
1049 this->window = window;
1052 int TitleX::handle_event()
1054 client->config.title_x = atof(get_text());
1055 window->update_drag();
1059 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
1060 : BC_TumbleTextBox(window, client->config.title_y,
1061 -32767.f, 32767.f, x, y, 50)
1063 this->client = client;
1064 this->window = window;
1067 int TitleY::handle_event()
1069 client->config.title_y = atof(get_text());
1070 window->update_drag();
1074 TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
1075 : BC_TumbleTextBox(window, client->config.title_w,
1078 this->client = client;
1079 this->window = window;
1081 int TitleW::handle_event()
1083 client->config.title_w = atol(get_text());
1084 window->update_drag();
1088 TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
1089 : BC_TumbleTextBox(window, client->config.title_h,
1092 this->client = client;
1093 this->window = window;
1095 int TitleH::handle_event()
1097 client->config.title_h = atol(get_text());
1098 window->update_drag();
1102 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
1103 : BC_TumbleTextBox(window, client->config.pixels_per_second,
1104 0.f, 1000.f, x, y, 100)
1106 this->client = client;
1107 this->window = window;
1113 int TitleSpeed::handle_event()
1115 client->config.pixels_per_second = atof(get_text());
1116 window->send_configure_change();
1121 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
1122 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
1124 this->client = client;
1125 this->window = window;
1127 int TitleLeft::handle_event()
1129 client->config.hjustification = JUSTIFY_LEFT;
1130 window->update_justification();
1131 window->send_configure_change();
1135 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
1136 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
1138 this->client = client;
1139 this->window = window;
1141 int TitleCenter::handle_event()
1143 client->config.hjustification = JUSTIFY_CENTER;
1144 window->update_justification();
1145 window->send_configure_change();
1149 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
1150 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
1152 this->client = client;
1153 this->window = window;
1155 int TitleRight::handle_event()
1157 client->config.hjustification = JUSTIFY_RIGHT;
1158 window->update_justification();
1159 window->send_configure_change();
1165 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
1166 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
1168 this->client = client;
1169 this->window = window;
1171 int TitleTop::handle_event()
1173 client->config.vjustification = JUSTIFY_TOP;
1174 window->update_justification();
1175 window->send_configure_change();
1179 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
1180 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
1182 this->client = client;
1183 this->window = window;
1185 int TitleMid::handle_event()
1187 client->config.vjustification = JUSTIFY_MID;
1188 window->update_justification();
1189 window->send_configure_change();
1193 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
1194 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
1196 this->client = client;
1197 this->window = window;
1199 int TitleBottom::handle_event()
1201 client->config.vjustification = JUSTIFY_BOTTOM;
1202 window->update_justification();
1203 window->send_configure_change();
1209 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline)
1210 : ColorPicker(1, is_outline? _("Outline Color") : _("Text Color"))
1212 this->client = client;
1213 this->window = window;
1214 this->is_outline = is_outline;
1217 int TitleColorThread::handle_new_color(int output, int alpha)
1220 client->config.outline_color = output;
1221 client->config.outline_alpha = alpha;
1224 client->config.color = output;
1225 client->config.alpha = alpha;
1228 window->lock_window("TitleColorThread::handle_new_color");
1229 window->update_color();
1231 window->unlock_window();
1233 window->send_configure_change();
1237 void TitleColorThread::handle_done_event(int result)
1240 client->config.color = orig_color;
1241 client->config.alpha = orig_alpha;
1242 handle_new_color(orig_color, orig_alpha);
1243 window->update_color();
1244 window->send_configure_change();
1248 TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y)
1249 : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->config.drag,
1250 client->config.title_x, client->config.title_y,
1251 client->config.title_w, client->config.title_h)
1253 this->client = client;
1254 this->window = window;
1257 Track *TitleDrag::get_drag_track()
1259 return client->server->plugin->track;
1261 int64_t TitleDrag::get_drag_position()
1263 return client->get_source_position();
1266 void TitleDrag::update_gui()
1268 client->config.drag = get_value();
1269 client->config.title_x = drag_x;
1270 client->config.title_y = drag_y;
1271 client->config.title_w = drag_w+0.5;
1272 client->config.title_h = drag_h+0.5;
1273 window->title_x->update((float)client->config.title_x);
1274 window->title_y->update((float)client->config.title_y);
1275 window->title_w->update((int64_t)client->config.title_w);
1276 window->title_h->update((int64_t)client->config.title_h);
1277 window->send_configure_change();
1280 int TitleDrag::handle_event()
1282 int ret = DragCheckBox::handle_event();
1283 window->send_configure_change();
1287 TitleBackground::TitleBackground(TitleMain *client, TitleWindow *window, int x, int y)
1288 : BC_CheckBox(x, y, client->config.background, _("Background:"))
1290 this->client = client;
1291 this->window = window;
1294 int TitleBackground::handle_event()
1296 client->config.background = get_value();
1297 window->send_configure_change();
1301 TitleBackgroundPath::TitleBackgroundPath(TitleMain *client, TitleWindow *window, int x, int y)
1302 : BC_TextBox(x, y, 240, 1, client->config.background_path)
1304 this->client = client;
1305 this->window = window;
1308 int TitleBackgroundPath::handle_event()
1310 strncpy(client->config.background_path, get_text(), sizeof(client->config.background_path));
1311 window->send_configure_change();
1315 TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y)
1316 : BC_CheckBox(x, y, client->config.loop_playback, _("Loop playback"))
1318 this->client = client;
1319 this->window = window;
1321 int TitleLoopPlayback::handle_event()
1323 client->config.loop_playback = get_value();
1324 window->send_configure_change();
1329 TitleCurPopup::TitleCurPopup(TitleMain *client, TitleWindow *window)
1330 : BC_PopupMenu(0, 0, 0, "", 0)
1332 this->client = client;
1333 this->window = window;
1335 int TitleCurPopup::handle_event()
1340 void TitleCurSubMenu::add_subitemx(int popup_type, va_list ap, const char *fmt)
1342 char item[BCSTRLEN];
1343 vsnprintf(item, sizeof(item)-1, fmt, ap);
1344 item[sizeof(item)-1] = 0;
1345 add_submenuitem(new TitleCurSubMenuItem(this, item, popup_type));
1348 void TitleCurPopup::create_objects()
1350 TitleCurItem *cur_item;
1351 TitleCurSubMenu *sub_menu;
1353 add_item(cur_item = new TitleCurItem(this, item = _(KW_NUDGE)));
1354 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1355 sub_menu->add_subitem("%s dx,dy",item);
1356 sub_menu->add_subitem("/%s",item);
1357 add_item(cur_item = new TitleCurItem(this, item = _(KW_COLOR)));
1358 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1359 sub_menu->add_subitem(POPUP_COLOR,"%s %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_ALPHA)));
1363 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1364 sub_menu->add_subitem("%s ",item);
1365 sub_menu->add_subitem("%s 0.",item);
1366 sub_menu->add_subitem("%s .5",item);
1367 sub_menu->add_subitem("%s 1.",item);
1368 sub_menu->add_subitem("/%s",item);
1369 add_item(cur_item = new TitleCurItem(this, item = _(KW_FONT)));
1370 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1371 sub_menu->add_subitem(POPUP_FONT,"%s %s",item, _("name"));
1372 sub_menu->add_subitem(POPUP_OFFSET, "%s ",item);
1373 sub_menu->add_subitem("/%s",item);
1374 add_item(cur_item = new TitleCurItem(this, item = _(KW_SIZE)));
1375 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1376 sub_menu->add_subitem("%s +",item);
1377 sub_menu->add_subitem("%s -",item);
1378 sub_menu->add_subitem("%s ",item);
1379 sub_menu->add_subitem("/%s",item);
1380 add_item(cur_item = new TitleCurItem(this, item = _(KW_BOLD)));
1381 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1382 sub_menu->add_subitem("%s 1",item);
1383 sub_menu->add_subitem("%s 0",item);
1384 sub_menu->add_subitem("/%s",item);
1385 add_item(cur_item = new TitleCurItem(this, item = _(KW_ITALIC)));
1386 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1387 sub_menu->add_subitem("%s 1",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_CAPS)));
1391 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1392 sub_menu->add_subitem("%s 1",item);
1393 sub_menu->add_subitem("%s 0",item);
1394 sub_menu->add_subitem("%s -1",item);
1395 sub_menu->add_subitem("/%s",item);
1396 add_item(cur_item = new TitleCurItem(this, item = _(KW_UL)));
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_BLINK)));
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 -1",item);
1405 sub_menu->add_subitem("%s ",item);
1406 sub_menu->add_subitem("%s 0",item);
1407 sub_menu->add_subitem("/%s",item);
1408 add_item(cur_item = new TitleCurItem(this, item = _(KW_FIXED)));
1409 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1410 sub_menu->add_subitem("%s ",item);
1411 sub_menu->add_subitem("%s 20",item);
1412 sub_menu->add_subitem("%s 10",item);
1413 sub_menu->add_subitem("%s 0",item);
1414 sub_menu->add_subitem("/%s",item);
1415 add_item(cur_item = new TitleCurItem(this, item = _(KW_ALIAS)));
1416 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1417 sub_menu->add_subitem("%s 1",item);
1418 sub_menu->add_subitem("%s 0",item);
1419 sub_menu->add_subitem("/%s",item);
1420 add_item(cur_item = new TitleCurItem(this, item = _(KW_SUP)));
1421 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1422 sub_menu->add_subitem("%s 1",item);
1423 sub_menu->add_subitem("%s 0",item);
1424 sub_menu->add_subitem("%s -1",item);
1425 sub_menu->add_subitem("/%s",item);
1426 add_item(cur_item = new TitleCurItem(this, item = _(KW_PNG)));
1427 cur_item->add_submenu(sub_menu = new TitleCurSubMenu(cur_item));
1428 sub_menu->add_subitem(POPUP_PNG,"%s %s", item, _("file"));
1431 TitleCurItem::TitleCurItem(TitleCurPopup *popup, const char *text)
1434 this->popup = popup;
1436 int TitleCurItem::handle_event()
1441 TitleCurSubMenu::TitleCurSubMenu(TitleCurItem *cur_item)
1443 this->cur_item = cur_item;
1445 TitleCurSubMenu::~TitleCurSubMenu()
1449 TitleCurSubMenuItem::TitleCurSubMenuItem(TitleCurSubMenu *submenu, const char *text, int popup_type)
1452 this->submenu = submenu;
1453 this->popup_type = popup_type;
1455 TitleCurSubMenuItem::~TitleCurSubMenuItem()
1458 int TitleCurSubMenuItem::handle_event()
1460 TitleCurPopup *popup = submenu->cur_item->popup;
1461 TitleWindow *window = popup->window;
1462 const char *item_text = get_text();
1463 int ofs = *item_text == '/' ? 0 : -1;
1464 switch( popup_type ) {
1467 window->get_pop_cursor(px ,py);
1468 window->fonts_popup->activate(px, py, 300,200);
1471 window->color_popup->activate();
1474 window->png_popup->activate();
1481 sprintf(txt, "<%s>", item_text);
1482 return window->insert_ibeam(txt, ofs);
1485 TitleFontsPopup::TitleFontsPopup(TitleMain *client, TitleWindow *window)
1486 : BC_ListBox(-1, -1, 1, 1, LISTBOX_ICON_LIST,
1487 &window->fonts, 0, 0, 1, 0, 1)
1489 this->client = client;
1490 this->window = window;
1494 TitleFontsPopup::~TitleFontsPopup()
1497 int TitleFontsPopup::keypress_event()
1499 switch( get_keypress() ) {
1507 return BC_ListBox::keypress_event();
1510 int TitleFontsPopup::handle_event()
1513 BC_ListBoxItem *item = get_selection(0, 0);
1514 if( !item ) return 1;
1515 const char *item_text = item->get_text();
1516 char txt[BCTEXTLEN]; sprintf(txt, "<%s %s>", _(KW_FONT), item_text);
1517 return window->insert_ibeam(txt);
1520 TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window)
1521 : ColorPicker(0, _("Color"))
1523 this->client = client;
1524 this->window = window;
1525 this->color_value = client->config.color;
1527 TitleColorPopup::~TitleColorPopup()
1530 int TitleColorPopup::handle_new_color(int output, int alpha)
1532 color_value = output;
1535 int TitleColorPopup::activate()
1537 start_window(client->config.color, 255, 1);
1540 void TitleColorPopup::handle_done_event(int result)
1543 char txt[BCSTRLEN]; sprintf(txt, "<%s #%06x>", _(KW_COLOR), color_value);
1544 window->insert_ibeam(txt);
1548 TitlePngPopup::TitlePngPopup(TitleMain *client, TitleWindow *window)
1551 this->client = client;
1552 this->window = window;
1555 TitlePngPopup::~TitlePngPopup()
1560 void TitlePngPopup::handle_done_event(int result)
1562 if( result ) return;
1563 BrowseButtonWindow *gui = (BrowseButtonWindow *)get_gui();
1564 const char *path = gui->get_submitted_path();
1565 char txt[BCSTRLEN]; sprintf(txt, "<%s %s>", _(KW_PNG), path);
1566 window->insert_ibeam(txt);
1569 BC_Window *TitlePngPopup::new_gui()
1571 MWindow *mwindow = client->server->mwindow;
1572 int x, y; mwindow->gui->get_abs_cursor(x, y);
1574 BC_Window *gui = new BrowseButtonWindow(mwindow->theme,
1575 x-25, y-100, window, "", _("Png file"), _("Png path"), 0);
1576 gui->create_objects();
1580 int TitlePngPopup::activate()
1582 BC_DialogThread::start();