00001 #include "bcdisplayinfo.h"
00002 #include "titlewindow.h"
00003
00004 #include <string.h>
00005 #include <libintl.h>
00006 #define _(String) gettext(String)
00007 #define gettext_noop(String) String
00008 #define N_(String) gettext_noop (String)
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 PLUGIN_THREAD_OBJECT(TitleMain, TitleThread, TitleWindow)
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 TitleWindow::TitleWindow(TitleMain *client, int x, int y)
00030 : BC_Window(client->gui_string,
00031 x,
00032 y,
00033 client->window_w,
00034 client->window_h,
00035 100,
00036 100,
00037 1,
00038 0,
00039 1)
00040 {
00041 this->client = client;
00042 }
00043
00044 TitleWindow::~TitleWindow()
00045 {
00046 sizes.remove_all_objects();
00047 encodings.remove_all_objects();
00048 timecodeformats.remove_all_objects();
00049 delete timecodeformat;
00050 delete color_thread;
00051 #ifdef USE_OUTLINE
00052 delete color_stroke_thread;
00053 #endif
00054 delete title_x;
00055 delete title_y;
00056 }
00057
00058 int TitleWindow::create_objects()
00059 {
00060 int x = 10, y = 10;
00061 timecodeformats.append(new BC_ListBoxItem(TIME_SECONDS__STR));
00062 timecodeformats.append(new BC_ListBoxItem(TIME_HMS__STR));
00063 timecodeformats.append(new BC_ListBoxItem(TIME_HMS2__STR));
00064 timecodeformats.append(new BC_ListBoxItem(TIME_HMS3__STR));
00065 timecodeformats.append(new BC_ListBoxItem(TIME_HMSF__STR));
00066
00067
00068 timecodeformats.append(new BC_ListBoxItem(TIME_FRAMES__STR));
00069
00070
00071 encodings.append(new BC_ListBoxItem("ISO8859-1"));
00072 encodings.append(new BC_ListBoxItem("ISO8859-2"));
00073 encodings.append(new BC_ListBoxItem("ISO8859-3"));
00074 encodings.append(new BC_ListBoxItem("ISO8859-4"));
00075 encodings.append(new BC_ListBoxItem("ISO8859-5"));
00076 encodings.append(new BC_ListBoxItem("ISO8859-6"));
00077 encodings.append(new BC_ListBoxItem("ISO8859-7"));
00078 encodings.append(new BC_ListBoxItem("ISO8859-8"));
00079 encodings.append(new BC_ListBoxItem("ISO8859-9"));
00080 encodings.append(new BC_ListBoxItem("ISO8859-10"));
00081 encodings.append(new BC_ListBoxItem("ISO8859-11"));
00082 encodings.append(new BC_ListBoxItem("ISO8859-12"));
00083 encodings.append(new BC_ListBoxItem("ISO8859-13"));
00084 encodings.append(new BC_ListBoxItem("ISO8859-14"));
00085 encodings.append(new BC_ListBoxItem("ISO8859-15"));
00086 encodings.append(new BC_ListBoxItem("KOI8"));
00087
00088
00089
00090 sizes.append(new BC_ListBoxItem("8"));
00091 sizes.append(new BC_ListBoxItem("9"));
00092 sizes.append(new BC_ListBoxItem("10"));
00093 sizes.append(new BC_ListBoxItem("11"));
00094 sizes.append(new BC_ListBoxItem("12"));
00095 sizes.append(new BC_ListBoxItem("13"));
00096 sizes.append(new BC_ListBoxItem("14"));
00097 sizes.append(new BC_ListBoxItem("16"));
00098 sizes.append(new BC_ListBoxItem("18"));
00099 sizes.append(new BC_ListBoxItem("20"));
00100 sizes.append(new BC_ListBoxItem("22"));
00101 sizes.append(new BC_ListBoxItem("24"));
00102 sizes.append(new BC_ListBoxItem("26"));
00103 sizes.append(new BC_ListBoxItem("28"));
00104 sizes.append(new BC_ListBoxItem("32"));
00105 sizes.append(new BC_ListBoxItem("36"));
00106 sizes.append(new BC_ListBoxItem("40"));
00107 sizes.append(new BC_ListBoxItem("48"));
00108 sizes.append(new BC_ListBoxItem("56"));
00109 sizes.append(new BC_ListBoxItem("64"));
00110 sizes.append(new BC_ListBoxItem("72"));
00111 sizes.append(new BC_ListBoxItem("100"));
00112 sizes.append(new BC_ListBoxItem("128"));
00113
00114 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
00115 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
00116 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
00117 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
00118 paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
00119
00120
00121
00122
00123 for(int i = 0; i < client->fonts->total; i++)
00124 {
00125 int exists = 0;
00126 for(int j = 0; j < fonts.total; j++)
00127 {
00128 if(!strcasecmp(fonts.values[j]->get_text(),
00129 client->fonts->values[i]->fixed_title))
00130 {
00131 exists = 1;
00132 break;
00133 }
00134 }
00135
00136 if(!exists) fonts.append(new
00137 BC_ListBoxItem(client->fonts->values[i]->fixed_title));
00138 }
00139
00140
00141 int done = 0;
00142 while(!done)
00143 {
00144 done = 1;
00145 for(int i = 0; i < fonts.total - 1; i++)
00146 {
00147 if(strcmp(fonts.values[i]->get_text(), fonts.values[i + 1]->get_text()) > 0)
00148 {
00149 BC_ListBoxItem *temp = fonts.values[i + 1];
00150 fonts.values[i + 1] = fonts.values[i];
00151 fonts.values[i] = temp;
00152 done = 0;
00153 }
00154 }
00155 }
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 add_tool(font_title = new BC_Title(x, y, _("Font:")));
00169 font = new TitleFont(client, this, x, y + 20);
00170 font->create_objects();
00171 x += 230;
00172 add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y + 20));
00173 x += 30;
00174 char string[BCTEXTLEN];
00175 add_tool(size_title = new BC_Title(x, y, _("Size:")));
00176 sprintf(string, "%d", client->config.size);
00177 size = new TitleSize(client, this, x, y + 20, string);
00178 size->create_objects();
00179 x += 140;
00180
00181 add_tool(style_title = new BC_Title(x, y, _("Style:")));
00182 add_tool(italic = new TitleItalic(client, this, x, y + 20));
00183 add_tool(bold = new TitleBold(client, this, x, y + 50));
00184 #ifdef USE_OUTLINE
00185 add_tool(stroke = new TitleStroke(client, this, x, y + 80));
00186 #endif
00187 x += 90;
00188 add_tool(justify_title = new BC_Title(x, y, _("Justify:")));
00189 add_tool(left = new TitleLeft(client, this, x, y + 20));
00190 add_tool(center = new TitleCenter(client, this, x, y + 50));
00191 add_tool(right = new TitleRight(client, this, x, y + 80));
00192
00193 x += 80;
00194 add_tool(top = new TitleTop(client, this, x, y + 20));
00195 add_tool(mid = new TitleMid(client, this, x, y + 50));
00196 add_tool(bottom= new TitleBottom(client, this, x, y + 80));
00197
00198
00199
00200 y += 50;
00201 x = 10;
00202
00203 add_tool(x_title = new BC_Title(x, y, _("X:")));
00204 title_x = new TitleX(client, this, x, y + 20);
00205 title_x->create_objects();
00206 x += 90;
00207
00208 add_tool(y_title = new BC_Title(x, y, _("Y:")));
00209 title_y = new TitleY(client, this, x, y + 20);
00210 title_y->create_objects();
00211 x += 90;
00212
00213 add_tool(motion_title = new BC_Title(x, y, _("Motion type:")));
00214
00215 motion = new TitleMotion(client, this, x, y + 20);
00216 motion->create_objects();
00217 x += 150;
00218
00219 add_tool(loop = new TitleLoop(client, x, y + 20));
00220 x += 100;
00221
00222 x = 10;
00223 y += 50;
00224
00225 add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
00226 dropshadow = new TitleDropShadow(client, this, x, y + 20);
00227 dropshadow->create_objects();
00228 x += 100;
00229
00230 add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
00231 add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
00232 x += 100;
00233
00234 add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
00235 add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
00236 x += 110;
00237
00238 add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
00239 speed = new TitleSpeed(client, this, x, y + 20);
00240 speed->create_objects();
00241 x += 110;
00242
00243 add_tool(color_button = new TitleColorButton(client, this, x, y + 20));
00244 x += color_button->get_w();
00245 color_x = x;
00246 color_y = y + 20;
00247 color_thread = new TitleColorThread(client, this);
00248
00249 x = 10;
00250 y += 50;
00251 add_tool(encoding_title = new BC_Title(x, y + 3, _("Encoding:")));
00252 encoding = new TitleEncoding(client, this, x, y + 20);
00253 encoding->create_objects();
00254
00255 #ifdef USE_OUTLINE
00256 x += 160;
00257 add_tool(strokewidth_title = new BC_Title(x, y, _("Outline width:")));
00258 stroke_width = new TitleStrokeW(client,
00259 this,
00260 x,
00261 y + 20);
00262 stroke_width->create_objects();
00263
00264 x += 210;
00265 add_tool(color_stroke_button = new TitleColorStrokeButton(client,
00266 this,
00267 x,
00268 y + 20));
00269 color_stroke_x = color_x;
00270 color_stroke_y = y + 20;
00271 color_stroke_thread = new TitleColorStrokeThread(client, this);
00272 #endif
00273
00274
00275 x = 10;
00276 y += 50;
00277
00278 add_tool(text_title = new BC_Title(x, y + 3, _("Text:")));
00279
00280 x += 100;
00281 add_tool(timecode = new TitleTimecode(client, x, y));
00282
00283
00284 x += timecode->get_w() + 5;
00285 BC_SubWindow *thisw;
00286 add_tool(thisw = new BC_Title(x, y+4, _("Format:")));
00287 x += thisw->get_w() + 5;
00288 timecodeformat = new TitleTimecodeFormat(client, this, x, y);
00289 timecodeformat->create_objects();
00290
00291 x = 10;
00292 y += 30;
00293 text = new TitleText(client,
00294 this,
00295 x,
00296 y,
00297 get_w() - x - 10,
00298 get_h() - y - 20 - 10);
00299 text->create_objects();
00300
00301 update_color();
00302
00303 show_window();
00304 flush();
00305 return 0;
00306 }
00307
00308 int TitleWindow::resize_event(int w, int h)
00309 {
00310 client->window_w = w;
00311 client->window_h = h;
00312
00313 clear_box(0, 0, w, h);
00314 font_title->reposition_window(font_title->get_x(), font_title->get_y());
00315 font->reposition_window(font->get_x(), font->get_y());
00316 font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
00317 x_title->reposition_window(x_title->get_x(), x_title->get_y());
00318 title_x->reposition_window(title_x->get_x(), title_x->get_y());
00319 y_title->reposition_window(y_title->get_x(), y_title->get_y());
00320 title_y->reposition_window(title_y->get_x(), title_y->get_y());
00321 style_title->reposition_window(style_title->get_x(), style_title->get_y());
00322 italic->reposition_window(italic->get_x(), italic->get_y());
00323 bold->reposition_window(bold->get_x(), bold->get_y());
00324 #ifdef USE_OUTLINE
00325 stroke->reposition_window(stroke->get_x(), stroke->get_y());
00326 #endif
00327 size_title->reposition_window(size_title->get_x(), size_title->get_y());
00328 size->reposition_window(size->get_x(), size->get_y());
00329 encoding_title->reposition_window(encoding_title->get_x(), encoding_title->get_y());
00330 encoding->reposition_window(encoding->get_x(), encoding->get_y());
00331 color_button->reposition_window(color_button->get_x(), color_button->get_y());
00332 #ifdef USE_OUTLINE
00333 color_stroke_button->reposition_window(color_stroke_button->get_x(), color_stroke_button->get_y());
00334 #endif
00335 motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
00336 motion->reposition_window(motion->get_x(), motion->get_y());
00337 loop->reposition_window(loop->get_x(), loop->get_y());
00338 dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
00339 dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
00340 fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
00341 fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
00342 fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
00343 fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
00344 text_title->reposition_window(text_title->get_x(), text_title->get_y());
00345 #ifdef USE_OUTLINE
00346 stroke_width->reposition_window(stroke_width->get_x(), stroke_width->get_y());
00347 strokewidth_title->reposition_window(strokewidth_title->get_x(), strokewidth_title->get_y());
00348 #endif
00349 timecode->reposition_window(timecode->get_x(), timecode->get_y());
00350
00351 text->reposition_window(text->get_x(),
00352 text->get_y(),
00353 w - text->get_x() - 10,
00354 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));
00355
00356
00357
00358 justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
00359 left->reposition_window(left->get_x(), left->get_y());
00360 center->reposition_window(center->get_x(), center->get_y());
00361 right->reposition_window(right->get_x(), right->get_y());
00362 top->reposition_window(top->get_x(), top->get_y());
00363 mid->reposition_window(mid->get_x(), mid->get_y());
00364 bottom->reposition_window(bottom->get_x(), bottom->get_y());
00365 speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
00366 speed->reposition_window(speed->get_x(), speed->get_y());
00367 update_color();
00368 flash();
00369
00370 return 1;
00371 }
00372
00373
00374 void TitleWindow::previous_font()
00375 {
00376 int current_font = font->get_number();
00377 current_font--;
00378 if(current_font < 0) current_font = fonts.total - 1;
00379
00380 if(current_font < 0 || current_font >= fonts.total) return;
00381
00382 for(int i = 0; i < fonts.total; i++)
00383 {
00384 fonts.values[i]->set_selected(i == current_font);
00385 }
00386
00387 font->update(fonts.values[current_font]->get_text());
00388 strcpy(client->config.font, fonts.values[current_font]->get_text());
00389 client->send_configure_change();
00390 }
00391
00392 void TitleWindow::next_font()
00393 {
00394 int current_font = font->get_number();
00395 current_font++;
00396 if(current_font >= fonts.total) current_font = 0;
00397
00398 if(current_font < 0 || current_font >= fonts.total) return;
00399
00400 for(int i = 0; i < fonts.total; i++)
00401 {
00402 fonts.values[i]->set_selected(i == current_font);
00403 }
00404
00405 font->update(fonts.values[current_font]->get_text());
00406 strcpy(client->config.font, fonts.values[current_font]->get_text());
00407 client->send_configure_change();
00408 }
00409
00410
00411 int TitleWindow::close_event()
00412 {
00413
00414 set_done(1);
00415 return 1;
00416 }
00417
00418 void TitleWindow::update_color()
00419 {
00420
00421 set_color(client->config.color);
00422 draw_box(color_x, color_y, 100, 30);
00423 flash(color_x, color_y, 100, 30);
00424 #ifdef USE_OUTLINE
00425 set_color(client->config.color_stroke);
00426 draw_box(color_stroke_x, color_stroke_y, 100, 30);
00427 flash(color_stroke_x, color_stroke_y, 100, 30);
00428 #endif
00429 }
00430
00431 void TitleWindow::update_justification()
00432 {
00433 left->update(client->config.hjustification == JUSTIFY_LEFT);
00434 center->update(client->config.hjustification == JUSTIFY_CENTER);
00435 right->update(client->config.hjustification == JUSTIFY_RIGHT);
00436 top->update(client->config.vjustification == JUSTIFY_TOP);
00437 mid->update(client->config.vjustification == JUSTIFY_MID);
00438 bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
00439 }
00440
00441 void TitleWindow::update()
00442 {
00443 title_x->update((int64_t)client->config.x);
00444 title_y->update((int64_t)client->config.y);
00445 italic->update(client->config.style & FONT_ITALIC);
00446 bold->update(client->config.style & FONT_BOLD);
00447 #ifdef USE_OUTLINE
00448 stroke->update(client->config.style & FONT_OUTLINE);
00449 #endif
00450 size->update(client->config.size);
00451 encoding->update(client->config.encoding);
00452 timecode->update(client->config.timecode);
00453 timecodeformat->update(client->config.timecodeformat);
00454 motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
00455 loop->update(client->config.loop);
00456 dropshadow->update((float)client->config.dropshadow);
00457 fade_in->update((float)client->config.fade_in);
00458 fade_out->update((float)client->config.fade_out);
00459 #ifdef USE_OUTLINE
00460 stroke_width->update((float)client->config.stroke_width);
00461 #endif
00462 font->update(client->config.font);
00463 text->update(client->config.text);
00464 speed->update(client->config.pixels_per_second);
00465 update_justification();
00466 update_color();
00467 }
00468
00469
00470 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
00471 : BC_Tumbler(x, y)
00472 {
00473 this->client = client;
00474 this->window = window;
00475 }
00476 int TitleFontTumble::handle_up_event()
00477 {
00478 window->previous_font();
00479 return 1;
00480 }
00481
00482 int TitleFontTumble::handle_down_event()
00483 {
00484 window->next_font();
00485 return 1;
00486 }
00487
00488 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
00489 : BC_CheckBox(x, y, client->config.style & FONT_BOLD, _("Bold"))
00490 {
00491 this->client = client;
00492 this->window = window;
00493 }
00494
00495 int TitleBold::handle_event()
00496 {
00497 client->config.style = (client->config.style & ~FONT_BOLD) | (get_value() ? FONT_BOLD : 0);
00498 client->send_configure_change();
00499 return 1;
00500 }
00501
00502 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
00503 : BC_CheckBox(x, y, client->config.style & FONT_ITALIC, _("Italic"))
00504 {
00505 this->client = client;
00506 this->window = window;
00507 }
00508 int TitleItalic::handle_event()
00509 {
00510 client->config.style = (client->config.style & ~FONT_ITALIC) | (get_value() ? FONT_ITALIC : 0);
00511 client->send_configure_change();
00512 return 1;
00513 }
00514
00515 TitleStroke::TitleStroke(TitleMain *client, TitleWindow *window, int x, int y)
00516 : BC_CheckBox(x, y, client->config.style & FONT_OUTLINE, _("Outline"))
00517 {
00518 this->client = client;
00519 this->window = window;
00520 }
00521
00522 int TitleStroke::handle_event()
00523 {
00524 client->config.style =
00525 (client->config.style & ~FONT_OUTLINE) |
00526 (get_value() ? FONT_OUTLINE : 0);
00527 client->send_configure_change();
00528 return 1;
00529 }
00530
00531
00532
00533 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
00534 : BC_PopupTextBox(window,
00535 &window->sizes,
00536 text,
00537 x,
00538 y,
00539 100,
00540 300)
00541 {
00542 this->client = client;
00543 this->window = window;
00544 }
00545 TitleSize::~TitleSize()
00546 {
00547 }
00548 int TitleSize::handle_event()
00549 {
00550 client->config.size = atol(get_text());
00551
00552 client->send_configure_change();
00553 return 1;
00554 }
00555 void TitleSize::update(int size)
00556 {
00557 char string[BCTEXTLEN];
00558 sprintf(string, "%d", size);
00559 BC_PopupTextBox::update(string);
00560 }
00561 TitleEncoding::TitleEncoding(TitleMain *client, TitleWindow *window, int x, int y)
00562 : BC_PopupTextBox(window,
00563 &window->encodings,
00564 client->config.encoding,
00565 x,
00566 y,
00567 100,
00568 300)
00569 {
00570 this->client = client;
00571 this->window = window;
00572 }
00573
00574 TitleEncoding::~TitleEncoding()
00575 {
00576 }
00577 int TitleEncoding::handle_event()
00578 {
00579 strcpy(client->config.encoding, get_text());
00580 client->send_configure_change();
00581 return 1;
00582 }
00583
00584 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
00585 : BC_GenericButton(x, y, _("Color..."))
00586 {
00587 this->client = client;
00588 this->window = window;
00589 }
00590 int TitleColorButton::handle_event()
00591 {
00592 window->color_thread->start_window(client->config.color, 0);
00593 return 1;
00594 }
00595
00596 TitleColorStrokeButton::TitleColorStrokeButton(TitleMain *client, TitleWindow *window, int x, int y)
00597 : BC_GenericButton(x, y, _("Outline color..."))
00598 {
00599 this->client = client;
00600 this->window = window;
00601 }
00602 int TitleColorStrokeButton::handle_event()
00603 {
00604 #ifdef USE_OUTLINE
00605 window->color_stroke_thread->start_window(client->config.color_stroke, 0);
00606 #endif
00607 return 1;
00608 }
00609
00610 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
00611 : BC_PopupTextBox(window,
00612 &window->paths,
00613 client->motion_to_text(client->config.motion_strategy),
00614 x,
00615 y,
00616 120,
00617 100)
00618 {
00619 this->client = client;
00620 this->window = window;
00621 }
00622 int TitleMotion::handle_event()
00623 {
00624 client->config.motion_strategy = client->text_to_motion(get_text());
00625 client->send_configure_change();
00626 return 1;
00627 }
00628
00629 TitleLoop::TitleLoop(TitleMain *client, int x, int y)
00630 : BC_CheckBox(x, y, client->config.loop, _("Loop"))
00631 {
00632 this->client = client;
00633 }
00634 int TitleLoop::handle_event()
00635 {
00636 client->config.loop = get_value();
00637 client->send_configure_change();
00638 return 1;
00639 }
00640
00641 TitleTimecode::TitleTimecode(TitleMain *client, int x, int y)
00642 : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
00643 {
00644 this->client = client;
00645 }
00646 int TitleTimecode::handle_event()
00647 {
00648 client->config.timecode = get_value();
00649 client->send_configure_change();
00650 return 1;
00651 }
00652
00653 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window, int x, int y)
00654 : BC_PopupTextBox(window,
00655 &window->timecodeformats,
00656 client->config.timecodeformat,
00657 x,
00658 y,
00659 140,
00660 160)
00661 {
00662 this->client = client;
00663 this->window = window;
00664 }
00665
00666 TitleTimecodeFormat::~TitleTimecodeFormat()
00667 {
00668 }
00669 int TitleTimecodeFormat::handle_event()
00670 {
00671 strcpy(client->config.timecodeformat, get_text());
00672 client->send_configure_change();
00673 return 1;
00674 }
00675
00676 TitleFade::TitleFade(TitleMain *client,
00677 TitleWindow *window,
00678 double *value,
00679 int x,
00680 int y)
00681 : BC_TextBox(x, y, 90, 1, (float)*value)
00682 {
00683 this->client = client;
00684 this->window = window;
00685 this->value = value;
00686 }
00687
00688 int TitleFade::handle_event()
00689 {
00690 *value = atof(get_text());
00691 client->send_configure_change();
00692 return 1;
00693 }
00694
00695 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
00696 : BC_PopupTextBox(window,
00697 &window->fonts,
00698 client->config.font,
00699 x,
00700 y,
00701 200,
00702 500)
00703 {
00704 this->client = client;
00705 this->window = window;
00706 }
00707 int TitleFont::handle_event()
00708 {
00709 strcpy(client->config.font, get_text());
00710 client->send_configure_change();
00711 return 1;
00712 }
00713
00714 TitleText::TitleText(TitleMain *client,
00715 TitleWindow *window,
00716 int x,
00717 int y,
00718 int w,
00719 int h)
00720 : BC_ScrollTextBox(window,
00721 x,
00722 y,
00723 w,
00724 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
00725 client->config.text)
00726 {
00727 this->client = client;
00728 this->window = window;
00729
00730 }
00731
00732 int TitleText::handle_event()
00733 {
00734 strcpy(client->config.text, get_text());
00735 client->send_configure_change();
00736 return 1;
00737 }
00738
00739
00740 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
00741 : BC_TumbleTextBox(window,
00742 (int64_t)client->config.dropshadow,
00743 (int64_t)0,
00744 (int64_t)1000,
00745 x,
00746 y,
00747 70)
00748 {
00749 this->client = client;
00750 this->window = window;
00751 }
00752 int TitleDropShadow::handle_event()
00753 {
00754 client->config.dropshadow = atol(get_text());
00755 client->send_configure_change();
00756 return 1;
00757 }
00758
00759
00760 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
00761 : BC_TumbleTextBox(window,
00762 (int64_t)client->config.x,
00763 (int64_t)-2048,
00764 (int64_t)2048,
00765 x,
00766 y,
00767 60)
00768 {
00769 this->client = client;
00770 this->window = window;
00771 }
00772 int TitleX::handle_event()
00773 {
00774 client->config.x = atol(get_text());
00775 client->send_configure_change();
00776 return 1;
00777 }
00778
00779 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
00780 : BC_TumbleTextBox(window,
00781 (int64_t)client->config.y,
00782 (int64_t)-2048,
00783 (int64_t)2048,
00784 x,
00785 y,
00786 60)
00787 {
00788 this->client = client;
00789 this->window = window;
00790 }
00791 int TitleY::handle_event()
00792 {
00793 client->config.y = atol(get_text());
00794 client->send_configure_change();
00795 return 1;
00796 }
00797
00798 TitleStrokeW::TitleStrokeW(TitleMain *client,
00799 TitleWindow *window,
00800 int x,
00801 int y)
00802 : BC_TumbleTextBox(window,
00803 (float)client->config.stroke_width,
00804 (float)-2048,
00805 (float)2048,
00806 x,
00807 y,
00808 60)
00809 {
00810 this->client = client;
00811 this->window = window;
00812 }
00813 int TitleStrokeW::handle_event()
00814 {
00815 client->config.stroke_width = atof(get_text());
00816 client->send_configure_change();
00817 return 1;
00818 }
00819
00820
00821 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
00822 : BC_TumbleTextBox(window,
00823 (float)client->config.pixels_per_second,
00824 (float)0,
00825 (float)1000,
00826 x,
00827 y,
00828 70)
00829 {
00830 this->client = client;
00831 }
00832
00833
00834 int TitleSpeed::handle_event()
00835 {
00836 client->config.pixels_per_second = atof(get_text());
00837 client->send_configure_change();
00838 return 1;
00839 }
00840
00841
00842
00843
00844
00845
00846
00847 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
00848 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
00849 {
00850 this->client = client;
00851 this->window = window;
00852 }
00853 int TitleLeft::handle_event()
00854 {
00855 client->config.hjustification = JUSTIFY_LEFT;
00856 window->update_justification();
00857 client->send_configure_change();
00858 return 1;
00859 }
00860
00861 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
00862 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
00863 {
00864 this->client = client;
00865 this->window = window;
00866 }
00867 int TitleCenter::handle_event()
00868 {
00869 client->config.hjustification = JUSTIFY_CENTER;
00870 window->update_justification();
00871 client->send_configure_change();
00872 return 1;
00873 }
00874
00875 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
00876 : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
00877 {
00878 this->client = client;
00879 this->window = window;
00880 }
00881 int TitleRight::handle_event()
00882 {
00883 client->config.hjustification = JUSTIFY_RIGHT;
00884 window->update_justification();
00885 client->send_configure_change();
00886 return 1;
00887 }
00888
00889
00890
00891 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
00892 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
00893 {
00894 this->client = client;
00895 this->window = window;
00896 }
00897 int TitleTop::handle_event()
00898 {
00899 client->config.vjustification = JUSTIFY_TOP;
00900 window->update_justification();
00901 client->send_configure_change();
00902 return 1;
00903 }
00904
00905 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
00906 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
00907 {
00908 this->client = client;
00909 this->window = window;
00910 }
00911 int TitleMid::handle_event()
00912 {
00913 client->config.vjustification = JUSTIFY_MID;
00914 window->update_justification();
00915 client->send_configure_change();
00916 return 1;
00917 }
00918
00919 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
00920 : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
00921 {
00922 this->client = client;
00923 this->window = window;
00924 }
00925 int TitleBottom::handle_event()
00926 {
00927 client->config.vjustification = JUSTIFY_BOTTOM;
00928 window->update_justification();
00929 client->send_configure_change();
00930 return 1;
00931 }
00932
00933
00934
00935 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window)
00936 : ColorThread()
00937 {
00938 this->client = client;
00939 this->window = window;
00940 }
00941
00942 int TitleColorThread::handle_new_color(int output, int )
00943 {
00944 client->config.color = output;
00945 window->update_color();
00946 window->flush();
00947 client->send_configure_change();
00948 return 1;
00949 }
00950 TitleColorStrokeThread::TitleColorStrokeThread(TitleMain *client, TitleWindow *window)
00951 : ColorThread()
00952 {
00953 this->client = client;
00954 this->window = window;
00955 }
00956
00957 int TitleColorStrokeThread::handle_event(int output)
00958 {
00959 client->config.color_stroke = output;
00960 window->update_color();
00961 window->flush();
00962 client->send_configure_change();
00963 return 1;
00964 }