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"
23 #include "bcsignals.h"
27 #include "titlewindow.h"
28 #include "bcfontentry.h"
32 static const int timeunit_formats[] =
43 TitleWindow::TitleWindow(TitleMain *client)
44 : PluginClientWindow(client,
45 client->config.window_w,
46 client->config.window_h,
51 //printf("TitleWindow::TitleWindow %d %d %d\n", __LINE__, client->config.window_w, client->config.window_h);
52 this->client = client;
96 TitleWindow::~TitleWindow()
98 for(int j = 0; j < fonts.size(); j++)
100 // delete the pixmaps but not the vframes since they're static
101 delete fonts.get(j)->get_icon();
104 sizes.remove_all_objects();
105 delete timecode_format;
108 delete color_stroke_thread;
114 void TitleWindow::create_objects()
117 int margin = client->get_theme()->widget_border;
118 char string[BCTEXTLEN];
122 client->build_previews(this);
124 encodings.append(new BC_ListBoxItem("ISO8859-1"));
125 encodings.append(new BC_ListBoxItem("ISO8859-2"));
126 encodings.append(new BC_ListBoxItem("ISO8859-3"));
127 encodings.append(new BC_ListBoxItem("ISO8859-4"));
128 encodings.append(new BC_ListBoxItem("ISO8859-5"));
129 encodings.append(new BC_ListBoxItem("ISO8859-6"));
130 encodings.append(new BC_ListBoxItem("ISO8859-7"));
131 encodings.append(new BC_ListBoxItem("ISO8859-8"));
132 encodings.append(new BC_ListBoxItem("ISO8859-9"));
133 encodings.append(new BC_ListBoxItem("ISO8859-10"));
134 encodings.append(new BC_ListBoxItem("ISO8859-11"));
135 encodings.append(new BC_ListBoxItem("ISO8859-12"));
136 encodings.append(new BC_ListBoxItem("ISO8859-13"));
137 encodings.append(new BC_ListBoxItem("ISO8859-14"));
138 encodings.append(new BC_ListBoxItem("ISO8859-15"));
139 encodings.append(new BC_ListBoxItem("KOI8"));
140 encodings.append(new BC_ListBoxItem("UTF-8"));
143 sizes.append(new BC_ListBoxItem("8"));
144 sizes.append(new BC_ListBoxItem("9"));
145 sizes.append(new BC_ListBoxItem("10"));
146 sizes.append(new BC_ListBoxItem("11"));
147 sizes.append(new BC_ListBoxItem("12"));
148 sizes.append(new BC_ListBoxItem("13"));
149 sizes.append(new BC_ListBoxItem("14"));
150 sizes.append(new BC_ListBoxItem("16"));
151 sizes.append(new BC_ListBoxItem("18"));
152 sizes.append(new BC_ListBoxItem("20"));
153 sizes.append(new BC_ListBoxItem("22"));
154 sizes.append(new BC_ListBoxItem("24"));
155 sizes.append(new BC_ListBoxItem("26"));
156 sizes.append(new BC_ListBoxItem("28"));
157 sizes.append(new BC_ListBoxItem("32"));
158 sizes.append(new BC_ListBoxItem("36"));
159 sizes.append(new BC_ListBoxItem("40"));
160 sizes.append(new BC_ListBoxItem("48"));
161 sizes.append(new BC_ListBoxItem("56"));
162 sizes.append(new BC_ListBoxItem("64"));
163 sizes.append(new BC_ListBoxItem("72"));
164 sizes.append(new BC_ListBoxItem("100"));
165 sizes.append(new BC_ListBoxItem("128"));
166 sizes.append(new BC_ListBoxItem("256"));
167 sizes.append(new BC_ListBoxItem("512"));
168 sizes.append(new BC_ListBoxItem("1024"));
170 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
171 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
172 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
173 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
174 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
178 // Construct font list
179 ArrayList<BC_FontEntry*> *fontlist = get_resources()->fontlist;
181 for(int i = 0; i < fontlist->size(); i++) {
183 for(int j = 0; j < fonts.size(); j++) {
184 if(!strcasecmp(fonts.get(j)->get_text(),
185 fontlist->get(i)->displayname)) {
191 BC_ListBoxItem *item = 0;
193 fonts.append(item = new
194 BC_ListBoxItem(fontlist->get(i)->displayname));
195 if(!strcmp(client->config.font, item->get_text()))
196 item->set_selected(1);
197 if(fontlist->values[i]->image)
199 VFrame *vframe = fontlist->get(i)->image;
200 BC_Pixmap *icon = new BC_Pixmap(this, vframe, PIXMAP_ALPHA);
201 item->set_icon(icon);
202 item->set_icon_vframe(vframe);
211 for(int i = 0; i < fonts.size() - 1; i++) {
212 if(strcmp(fonts.values[i]->get_text(),
213 fonts.values[i + 1]->get_text()) > 0) {
214 BC_ListBoxItem *temp = fonts.values[i + 1];
215 fonts.values[i + 1] = fonts.values[i];
216 fonts.values[i] = temp;
222 add_tool(font_title = new BC_Title(x, y, _("Font:")));
223 font = new TitleFont(client, this, x, y + font_title->get_h());
224 font->create_objects();
226 add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y+10));
227 x += font_tumbler->get_w() + margin;
230 add_tool(size_title = new BC_Title(x1, y1+10, _("Size:")));
231 sprintf(string, "%d", client->config.size);
232 x1 += size_title->get_w() + margin;
233 size = new TitleSize(client, this, x1, y1+10, string);
234 size->create_objects();
235 int x2 = x1 + size->get_w(), y2 = y1 + size->get_h() + margin;
236 add_subwindow(size_tumbler = new TitleSizeTumble(client, this, x2, y1+10));
238 add_tool(pitch_title = new BC_Title(x-5, y2+10, _("Pitch:")));
239 pitch = new TitlePitch(client, this, x1, y2+10, &client->config.line_pitch);
240 pitch->create_objects();
241 x = x2 + size_tumbler->get_w() + margin;
243 add_tool(style_title = new BC_Title(x, y, _("Style:")));
244 add_tool(italic = new TitleItalic(client, this, x, y + 20));
245 add_tool(bold = new TitleBold(client, this, x, y + 50));
247 add_tool(stroke = new TitleStroke(client, this, x, y + 110));
250 add_tool(justify_title = new BC_Title(x, y, _("Justify:")));
251 add_tool(left = new TitleLeft(client, this, x, y + 20));
252 add_tool(center = new TitleCenter(client, this, x, y + 50));
253 add_tool(right = new TitleRight(client, this, x, y + 80));
256 add_tool(top = new TitleTop(client, this, x, y + 20));
257 add_tool(mid = new TitleMid(client, this, x, y + 50));
258 add_tool(bottom= new TitleBottom(client, this, x, y + 80));
263 add_tool(x_title = new BC_Title(x, y, _("X:")));
264 title_x = new TitleX(client, this, x, y + 20);
265 title_x->create_objects();
268 add_tool(y_title = new BC_Title(x, y, _("Y:")));
269 title_y = new TitleY(client, this, x, y + 20);
270 title_y->create_objects();
273 add_tool(motion_title = new BC_Title(x, y, _("Motion type:")));
275 motion = new TitleMotion(client, this, x, y + 20);
276 motion->create_objects();
279 add_tool(loop = new TitleLoop(client, x, y + 20));
284 add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
285 dropshadow = new TitleDropShadow(client, this, x, y + 20);
286 dropshadow->create_objects();
289 add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
290 add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
293 add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
294 add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
297 add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
298 speed = new TitleSpeed(client, this, x, y + 20);
299 speed->create_objects();
305 add_tool(color_button = new TitleColorButton(client, this, x, y + 20, 0));
306 x += color_button->get_w();
307 color_thread = new TitleColorThread(client, this, 0);
313 outline_color_y = y + 20;
315 add_tool(outline_color_button = new TitleColorButton(client, this, x, y + 20, 1));
316 x += outline_color_button->get_w();
317 outline_color_thread = new TitleColorThread(client, this, 1);
322 add_tool(outline_title = new BC_Title(x, y, _("Outline:")));
323 outline = new TitleOutline(client, this, x, y + outline_title->get_h() + margin);
324 outline->create_objects();
325 x += outline->get_w() + margin;
327 #ifndef X_HAVE_UTF8_STRING
328 add_tool(encoding_title = new BC_Title(x, y + 3, _("Encoding:")));
329 encoding = new TitleEncoding(client, this, x, y + encoding_title->get_h() + margin);
330 encoding->create_objects();
334 y += outline_title->get_h() + margin;
335 add_tool(timecode = new TitleTimecode(client, x, y));
336 x += timecode->get_w() + margin;
338 add_tool(timecode_format = new TitleTimecodeFormat(client, x, y,
339 Units::print_time_format(client->config.timecode_format, string)));
340 timecode_format->create_objects();
342 y += timecode_format->get_h() + margin;
344 add_tool(text_title = new BC_Title(x, y + 3, _("Text:")));
345 y += text_title->get_h() + margin;
346 text = new TitleText(client, this, x, y, get_w() - x - 10, get_h() - y - 50);
347 text->create_objects();
353 int TitleWindow::resize_event(int w, int h)
355 client->config.window_w = w;
356 client->config.window_h = h;
358 clear_box(0, 0, w, h);
359 font_title->reposition_window(font_title->get_x(), font_title->get_y());
360 font->reposition_window(font->get_x(), font->get_y());
361 font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
362 x_title->reposition_window(x_title->get_x(), x_title->get_y());
363 title_x->reposition_window(title_x->get_x(), title_x->get_y());
364 y_title->reposition_window(y_title->get_x(), y_title->get_y());
365 title_y->reposition_window(title_y->get_x(), title_y->get_y());
366 style_title->reposition_window(style_title->get_x(), style_title->get_y());
367 italic->reposition_window(italic->get_x(), italic->get_y());
368 bold->reposition_window(bold->get_x(), bold->get_y());
370 stroke->reposition_window(stroke->get_x(), stroke->get_y());
372 size_title->reposition_window(size_title->get_x(), size_title->get_y());
373 size->reposition_window(size->get_x(), size->get_y());
374 size_tumbler->reposition_window(size_title->get_x(), size_title->get_y());
375 pitch_title->reposition_window(pitch_title->get_x(), pitch_title->get_y());
376 pitch->reposition_window(size->get_x(), size->get_y());
378 #ifndef X_HAVE_UTF8_STRING
379 encoding->reposition_window(encoding->get_x(), encoding->get_y());
382 color_button->reposition_window(color_button->get_x(), color_button->get_y());
384 color_stroke_button->reposition_window(color_stroke_button->get_x(), color_stroke_button->get_y());
386 outline_color_button->reposition_window(outline_color_button->get_x(), outline_color_button->get_y());
387 motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
388 motion->reposition_window(motion->get_x(), motion->get_y());
389 loop->reposition_window(loop->get_x(), loop->get_y());
390 dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
391 dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
392 fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
393 fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
394 fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
395 fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
396 text_title->reposition_window(text_title->get_x(), text_title->get_y());
398 stroke_width->reposition_window(stroke_width->get_x(), stroke_width->get_y());
399 strokewidth_title->reposition_window(strokewidth_title->get_x(), strokewidth_title->get_y());
401 timecode->reposition_window(timecode->get_x(), timecode->get_y());
403 text->reposition_window(text->get_x(),
405 w - text->get_x() - 10,
406 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));
410 justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
411 left->reposition_window(left->get_x(), left->get_y());
412 center->reposition_window(center->get_x(), center->get_y());
413 right->reposition_window(right->get_x(), right->get_y());
414 top->reposition_window(top->get_x(), top->get_y());
415 mid->reposition_window(mid->get_x(), mid->get_y());
416 bottom->reposition_window(bottom->get_x(), bottom->get_y());
417 speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
418 speed->reposition_window(speed->get_x(), speed->get_y());
426 void TitleWindow::previous_font()
428 int current_font = font->get_number();
430 if(current_font < 0) current_font = fonts.total - 1;
432 if(current_font < 0 || current_font >= fonts.total) return;
434 for(int i = 0; i < fonts.total; i++)
436 fonts.values[i]->set_selected(i == current_font);
439 font->update(fonts.values[current_font]->get_text());
440 strcpy(client->config.font, fonts.values[current_font]->get_text());
441 client->send_configure_change();
444 void TitleWindow::next_font()
446 int current_font = font->get_number();
448 if(current_font >= fonts.total) current_font = 0;
450 if(current_font < 0 || current_font >= fonts.total) return;
452 for(int i = 0; i < fonts.total; i++)
454 fonts.values[i]->set_selected(i == current_font);
457 font->update(fonts.values[current_font]->get_text());
458 strcpy(client->config.font, fonts.values[current_font]->get_text());
459 client->send_configure_change();
464 void TitleWindow::update_color()
466 //printf("TitleWindow::update_color %x\n", client->config.color);
467 set_color(client->config.color);
468 draw_box(color_x, color_y, COLOR_W, COLOR_H);
469 flash(color_x, color_y, COLOR_W, COLOR_H);
470 set_color(client->config.outline_color);
471 draw_box(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
473 draw_rectangle(color_x, color_y, COLOR_W, COLOR_H);
474 draw_rectangle(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
475 flash(outline_color_x, outline_color_y, COLOR_W, COLOR_H);
478 void TitleWindow::update_justification()
480 left->update(client->config.hjustification == JUSTIFY_LEFT);
481 center->update(client->config.hjustification == JUSTIFY_CENTER);
482 right->update(client->config.hjustification == JUSTIFY_RIGHT);
483 top->update(client->config.vjustification == JUSTIFY_TOP);
484 mid->update(client->config.vjustification == JUSTIFY_MID);
485 bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
488 void TitleWindow::update()
490 title_x->update((int64_t)client->config.x);
491 title_y->update((int64_t)client->config.y);
492 italic->update(client->config.style & BC_FONT_ITALIC);
493 bold->update(client->config.style & BC_FONT_BOLD);
495 stroke->update(client->config.style & BC_FONT_OUTLINE);
497 size->update(client->config.size);
498 #ifndef X_HAVE_UTF8_STRING
499 encoding->update(client->config.encoding);
501 motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
502 loop->update(client->config.loop);
503 dropshadow->update((float)client->config.dropshadow);
504 fade_in->update((float)client->config.fade_in);
505 fade_out->update((float)client->config.fade_out);
507 stroke_width->update((float)client->config.stroke_width);
509 font->update(client->config.font);
510 text->update(&client->config.wtext[0]);
511 speed->update(client->config.pixels_per_second);
512 outline->update((int64_t)client->config.outline_size);
513 timecode->update(client->config.timecode);
514 timecode_format->update(client->config.timecode_format);
516 char string[BCTEXTLEN];
517 for(int i = 0; i < lengthof(timeunit_formats); i++) {
518 if(timeunit_formats[i] == client->config.timecode_format)
520 timecode_format->set_text(
521 Units::print_time_format(timeunit_formats[i], string));
525 update_justification();
530 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
533 this->client = client;
534 this->window = window;
536 int TitleFontTumble::handle_up_event()
538 window->previous_font();
542 int TitleFontTumble::handle_down_event()
550 TitleSizeTumble::TitleSizeTumble(TitleMain *client, TitleWindow *window, int x, int y)
553 this->client = client;
554 this->window = window;
557 int TitleSizeTumble::handle_up_event()
559 int current_index = -1;
560 int current_difference = -1;
561 for(int i = 0; i < window->sizes.size(); i++)
563 int size = atoi(window->sizes.get(i)->get_text());
564 if(current_index < 0 ||
565 abs(size - client->config.size) < current_difference)
568 current_difference = abs(size - client->config.size);
573 if(current_index >= window->sizes.size()) current_index = 0;
576 client->config.size = atoi(window->sizes.get(current_index)->get_text());
577 window->size->update(client->config.size);
578 client->send_configure_change();
582 int TitleSizeTumble::handle_down_event()
584 int current_index = -1;
585 int current_difference = -1;
586 for(int i = 0; i < window->sizes.size(); i++)
588 int size = atoi(window->sizes.get(i)->get_text());
589 if(current_index < 0 ||
590 abs(size - client->config.size) < current_difference)
593 current_difference = abs(size - client->config.size);
598 if(current_index < 0) current_index = window->sizes.size() - 1;
601 client->config.size = atoi(window->sizes.get(current_index)->get_text());
602 window->size->update(client->config.size);
603 client->send_configure_change();
607 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
608 : BC_CheckBox(x, y, client->config.style & BC_FONT_BOLD, _("Bold"))
610 this->client = client;
611 this->window = window;
614 int TitleBold::handle_event()
616 client->config.style =
617 (client->config.style & ~BC_FONT_BOLD) |
618 (get_value() ? BC_FONT_BOLD : 0);
619 client->send_configure_change();
623 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
624 : BC_CheckBox(x, y, client->config.style & BC_FONT_ITALIC, _("Italic"))
626 this->client = client;
627 this->window = window;
629 int TitleItalic::handle_event()
631 client->config.style =
632 (client->config.style & ~BC_FONT_ITALIC) |
633 (get_value() ? BC_FONT_ITALIC : 0);
634 client->send_configure_change();
640 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
641 : BC_PopupTextBox(window,
649 this->client = client;
650 this->window = window;
652 TitleSize::~TitleSize()
655 int TitleSize::handle_event()
657 client->config.size = atol(get_text());
658 //printf("TitleSize::handle_event 1 %s\n", get_text());
659 client->send_configure_change();
662 void TitleSize::update(int size)
664 char string[BCTEXTLEN];
665 sprintf(string, "%d", size);
666 BC_PopupTextBox::update(string);
670 TitlePitch(TitleMain *client, TitleWindow *window, int x, int y, int *value)
671 : BC_TumbleTextBox(window, *value, 0, INT_MAX, x, y, 64)
674 this->client = client;
675 this->window = window;
684 int TitlePitch::handle_event()
686 *value = atof(get_text());
687 client->send_configure_change();
691 TitleColorButton::TitleColorButton(TitleMain *client,
696 : BC_GenericButton(x, y, is_outline ? _("Outline color...") : _("Color..."))
698 this->client = client;
699 this->window = window;
700 this->is_outline = is_outline;
702 int TitleColorButton::handle_event()
705 window->outline_color_thread->start_window(client->config.outline_color,
706 client->config.outline_alpha);
708 window->color_thread->start_window(client->config.color,
709 client->config.alpha);
713 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
714 : BC_PopupTextBox(window,
716 client->motion_to_text(client->config.motion_strategy),
722 this->client = client;
723 this->window = window;
725 int TitleMotion::handle_event()
727 client->config.motion_strategy = client->text_to_motion(get_text());
728 client->send_configure_change();
732 TitleLoop::TitleLoop(TitleMain *client, int x, int y)
733 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
735 this->client = client;
737 int TitleLoop::handle_event()
739 client->config.loop = get_value();
740 client->send_configure_change();
743 TitleTimecode::TitleTimecode(TitleMain *client, int x, int y)
744 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
746 this->client = client;
748 int TitleTimecode::handle_event()
750 client->config.timecode = get_value();
751 client->send_configure_change();
755 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, int x, int y, const char *text)
756 : BC_PopupMenu(x, y, 100, text, 1)
758 this->client = client;
761 int TitleTimecodeFormat::handle_event()
763 client->config.timecode_format = Units::text_to_format(get_text());
764 client->send_configure_change();
768 void TitleTimecodeFormat::create_objects()
770 char string[BCTEXTLEN];
771 for(int i = 0; i < lengthof(timeunit_formats); i++) {
772 add_item(new BC_MenuItem(
773 Units::print_time_format(timeunit_formats[i], string)));
778 int TitleTimecodeFormat::update(int timecode_format)
780 char string[BCTEXTLEN];
781 for(int i = 0; i < lengthof(timeunit_formats); i++) {
782 if(timeunit_formats[i] == timecode_format)
784 set_text(Units::print_time_format(timeunit_formats[i], string));
791 TitleFade::TitleFade(TitleMain *client,
796 : BC_TextBox(x, y, 90, 1, (float)*value)
798 this->client = client;
799 this->window = window;
803 int TitleFade::handle_event()
805 *value = atof(get_text());
806 client->send_configure_change();
810 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
811 : BC_PopupTextBox(window,
820 this->client = client;
821 this->window = window;
823 int TitleFont::handle_event()
825 strcpy(client->config.font, get_text());
826 client->send_configure_change();
830 TitleText::TitleText(TitleMain *client,
831 TitleWindow *window, int x, int y, int w, int h)
832 : BC_ScrollTextBox(window, x, y, w,
833 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
834 client->config.wtext, 8192)
836 this->client = client;
837 this->window = window;
838 //printf("TitleText::TitleText %s\n", client->config.text);
841 int TitleText::handle_event()
843 int len = sizeof(client->config.wtext) / sizeof(wchar_t);
844 wcsncpy(client->config.wtext, get_wtext(), len);
845 client->config.wtext[len-1] = 0;
846 client->config.wlen = wcslen(client->config.wtext);
847 client->send_configure_change();
852 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
853 : BC_TumbleTextBox(window,
854 (int64_t)client->config.dropshadow,
861 this->client = client;
862 this->window = window;
864 int TitleDropShadow::handle_event()
866 client->config.dropshadow = atol(get_text());
867 client->send_configure_change();
872 TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
873 : BC_TumbleTextBox(window,
874 (int64_t)client->config.outline_size,
881 this->client = client;
882 this->window = window;
884 int TitleOutline::handle_event()
886 client->config.outline_size = atol(get_text());
887 client->send_configure_change();
892 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
893 : BC_TumbleTextBox(window,
894 (int64_t)client->config.x,
901 this->client = client;
902 this->window = window;
904 int TitleX::handle_event()
906 client->config.x = atol(get_text());
907 client->send_configure_change();
911 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
912 : BC_TumbleTextBox(window,
913 (int64_t)client->config.y,
920 this->client = client;
921 this->window = window;
923 int TitleY::handle_event()
925 client->config.y = atol(get_text());
926 client->send_configure_change();
930 TitleStrokeW::TitleStrokeW(TitleMain *client,
934 : BC_TumbleTextBox(window,
935 (float)client->config.stroke_width,
942 this->client = client;
943 this->window = window;
945 int TitleStrokeW::handle_event()
947 client->config.stroke_width = atof(get_text());
948 client->send_configure_change();
953 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
954 : BC_TumbleTextBox(window,
955 (float)client->config.pixels_per_second,
962 this->client = client;
966 int TitleSpeed::handle_event()
968 client->config.pixels_per_second = atof(get_text());
969 client->send_configure_change();
979 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
980 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
982 this->client = client;
983 this->window = window;
985 int TitleLeft::handle_event()
987 client->config.hjustification = JUSTIFY_LEFT;
988 window->update_justification();
989 client->send_configure_change();
993 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
994 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
996 this->client = client;
997 this->window = window;
999 int TitleCenter::handle_event()
1001 client->config.hjustification = JUSTIFY_CENTER;
1002 window->update_justification();
1003 client->send_configure_change();
1007 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
1008 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
1010 this->client = client;
1011 this->window = window;
1013 int TitleRight::handle_event()
1015 client->config.hjustification = JUSTIFY_RIGHT;
1016 window->update_justification();
1017 client->send_configure_change();
1023 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
1024 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
1026 this->client = client;
1027 this->window = window;
1029 int TitleTop::handle_event()
1031 client->config.vjustification = JUSTIFY_TOP;
1032 window->update_justification();
1033 client->send_configure_change();
1037 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
1038 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
1040 this->client = client;
1041 this->window = window;
1043 int TitleMid::handle_event()
1045 client->config.vjustification = JUSTIFY_MID;
1046 window->update_justification();
1047 client->send_configure_change();
1051 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
1052 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
1054 this->client = client;
1055 this->window = window;
1057 int TitleBottom::handle_event()
1059 client->config.vjustification = JUSTIFY_BOTTOM;
1060 window->update_justification();
1061 client->send_configure_change();
1067 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline)
1070 this->client = client;
1071 this->window = window;
1072 this->is_outline = is_outline;
1075 int TitleColorThread::handle_new_color(int output, int alpha)
1079 client->config.outline_color = output;
1080 client->config.outline_alpha = alpha;
1084 client->config.color = output;
1085 client->config.alpha = alpha;
1088 window->lock_window("TitleColorThread::handle_new_color");
1089 window->update_color();
1091 window->unlock_window();
1093 client->send_configure_change();
1098 TitleColorStrokeThread::TitleColorStrokeThread(TitleMain *client, TitleWindow *window)
1101 this->client = client;
1102 this->window = window;
1105 int TitleColorStrokeThread::handle_event(int output)
1107 client->config.color_stroke = output;
1108 window->update_color();
1110 client->send_configure_change();