r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / plugins / titler / titlewindow.C
blob8aa047edf21be09cdd721066f8026661a4a6da9e
1 #include "bcdisplayinfo.h"
2 #include "titlewindow.h"
4 #include <string.h>
6 #include <libintl.h>
7 #define _(String) gettext(String)
8 #define gettext_noop(String) String
9 #define N_(String) gettext_noop (String)
11 TitleThread::TitleThread(TitleMain *client)
12  : Thread()
14         this->client = client;
15         set_synchronous(0);
16         gui_started.lock();
17         completion.lock();
20 TitleThread::~TitleThread()
22 // Window always deleted here
23         delete window;
26 void TitleThread::run()
28         BC_DisplayInfo info;
29         window = new TitleWindow(client, 
30                 info.get_abs_cursor_x() - client->window_w / 2, 
31                 info.get_abs_cursor_y() - client->window_h / 2);
32         window->create_objects();
33         gui_started.unlock();
34         int result = window->run_window();
35         completion.unlock();
36 // Last command executed in thread
37         if(result) client->client_side_close();
48 TitleWindow::TitleWindow(TitleMain *client, int x, int y)
49  : BC_Window(client->gui_string, 
50         x,
51         y,
52         client->window_w, 
53         client->window_h, 
54         100, 
55         100, 
56         1, 
57         0,
58         1)
59
60         this->client = client; 
63 TitleWindow::~TitleWindow()
65         sizes.remove_all_objects();
66         encodings.remove_all_objects();
67         delete color_thread;
68 #ifdef USE_OUTLINE
69         delete color_stroke_thread;
70 #endif
71         delete title_x;
72         delete title_y;
75 int TitleWindow::create_objects()
77         int x = 10, y = 10;
78         
79         encodings.append(new BC_ListBoxItem("ISO8859-1"));
80         encodings.append(new BC_ListBoxItem("ISO8859-2"));
81         encodings.append(new BC_ListBoxItem("ISO8859-3"));
82         encodings.append(new BC_ListBoxItem("ISO8859-4"));
83         encodings.append(new BC_ListBoxItem("ISO8859-5"));
84         encodings.append(new BC_ListBoxItem("ISO8859-6"));
85         encodings.append(new BC_ListBoxItem("ISO8859-7"));
86         encodings.append(new BC_ListBoxItem("ISO8859-8"));
87         encodings.append(new BC_ListBoxItem("ISO8859-9"));
88         encodings.append(new BC_ListBoxItem("ISO8859-10"));
89         encodings.append(new BC_ListBoxItem("ISO8859-11"));
90         encodings.append(new BC_ListBoxItem("ISO8859-12"));
91         encodings.append(new BC_ListBoxItem("ISO8859-13"));
92         encodings.append(new BC_ListBoxItem("ISO8859-14"));
93         encodings.append(new BC_ListBoxItem("ISO8859-15"));
94         encodings.append(new BC_ListBoxItem("KOI8"));
98         sizes.append(new BC_ListBoxItem("8"));
99         sizes.append(new BC_ListBoxItem("9"));
100         sizes.append(new BC_ListBoxItem("10"));
101         sizes.append(new BC_ListBoxItem("11"));
102         sizes.append(new BC_ListBoxItem("12"));
103         sizes.append(new BC_ListBoxItem("13"));
104         sizes.append(new BC_ListBoxItem("14"));
105         sizes.append(new BC_ListBoxItem("16"));
106         sizes.append(new BC_ListBoxItem("18"));
107         sizes.append(new BC_ListBoxItem("20"));
108         sizes.append(new BC_ListBoxItem("22"));
109         sizes.append(new BC_ListBoxItem("24"));
110         sizes.append(new BC_ListBoxItem("26"));
111         sizes.append(new BC_ListBoxItem("28"));
112         sizes.append(new BC_ListBoxItem("32"));
113         sizes.append(new BC_ListBoxItem("36"));
114         sizes.append(new BC_ListBoxItem("40"));
115         sizes.append(new BC_ListBoxItem("48"));
116         sizes.append(new BC_ListBoxItem("56"));
117         sizes.append(new BC_ListBoxItem("64"));
118         sizes.append(new BC_ListBoxItem("72"));
119         sizes.append(new BC_ListBoxItem("100"));
120         sizes.append(new BC_ListBoxItem("128"));
122         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
123         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
124         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
125         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
126         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
130 // Construct font list
131         for(int i = 0; i < client->fonts->total; i++)
132         {
133                 int exists = 0;
134                 for(int j = 0; j < fonts.total; j++)
135                 {
136                         if(!strcasecmp(fonts.values[j]->get_text(), 
137                                 client->fonts->values[i]->fixed_title)) 
138                         {
139                                 exists = 1;
140                                 break;
141                         }
142                 }
144                 if(!exists) fonts.append(new 
145                         BC_ListBoxItem(client->fonts->values[i]->fixed_title));
146         }
148 // Sort font list
149         int done = 0;
150         while(!done)
151         {
152                 done = 1;
153                 for(int i = 0; i < fonts.total - 1; i++)
154                 {
155                         if(strcmp(fonts.values[i]->get_text(), fonts.values[i + 1]->get_text()) > 0)
156                         {
157                                 BC_ListBoxItem *temp = fonts.values[i + 1];
158                                 fonts.values[i + 1] = fonts.values[i];
159                                 fonts.values[i] = temp;
160                                 done = 0;
161                         }
162                 }
163         }       
176         add_tool(font_title = new BC_Title(x, y, _("Font:")));
177         font = new TitleFont(client, this, x, y + 20);
178         font->create_objects();
179         x += 230;
180         add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y + 20));
181         x += 30;
182         char string[BCTEXTLEN];
183         add_tool(size_title = new BC_Title(x, y, _("Size:")));
184         sprintf(string, "%d", client->config.size);
185         size = new TitleSize(client, this, x, y + 20, string);
186         size->create_objects();
187         x += 140;
189         add_tool(style_title = new BC_Title(x, y, _("Style:")));
190         add_tool(italic = new TitleItalic(client, this, x, y + 20));
191         add_tool(bold = new TitleBold(client, this, x, y + 50));
192 #ifdef USE_OUTLINE
193         add_tool(stroke = new TitleStroke(client, this, x, y + 80));
194 #endif
195         x += 90;
196         add_tool(justify_title = new BC_Title(x, y, _("Justify:")));
197         add_tool(left = new TitleLeft(client, this, x, y + 20));
198         add_tool(center = new TitleCenter(client, this, x, y + 50));
199         add_tool(right = new TitleRight(client, this, x, y + 80));
201         x += 80;
202         add_tool(top = new TitleTop(client, this, x, y + 20));
203         add_tool(mid = new TitleMid(client, this, x, y + 50));
204         add_tool(bottom= new TitleBottom(client, this, x, y + 80));
205         
208         y += 50;
209         x = 10;
211         add_tool(x_title = new BC_Title(x, y, _("X:")));
212         title_x = new TitleX(client, this, x, y + 20);
213         title_x->create_objects();
214         x += 90;
216         add_tool(y_title = new BC_Title(x, y, _("Y:")));
217         title_y = new TitleY(client, this, x, y + 20);
218         title_y->create_objects();
219         x += 90;
221         add_tool(motion_title = new BC_Title(x, y, _("Motion type:")));
223         motion = new TitleMotion(client, this, x, y + 20);
224         motion->create_objects();
225         x += 150;
226         
227         add_tool(loop = new TitleLoop(client, x, y + 20));
228         x += 100;
229         
230         x = 10;
231         y += 50;
233         add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
234         dropshadow = new TitleDropShadow(client, this, x, y + 20);
235         dropshadow->create_objects();
236         x += 100;
238         add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
239         add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
240         x += 100;
242         add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
243         add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
244         x += 110;
246         add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
247         speed = new TitleSpeed(client, this, x, y + 20);
248         speed->create_objects();
249         x += 110;
251         add_tool(color_button = new TitleColorButton(client, this, x, y + 20));
252         x += 90;
253         color_x = x;
254         color_y = y + 20;
255         color_thread = new TitleColorThread(client, this);
257         x = 10;
258         y += 50;
259         add_tool(encoding_title = new BC_Title(x, y + 3, _("Encoding:")));
260         encoding = new TitleEncoding(client, this, x, y + 20);
261         encoding->create_objects();
263 #ifdef USE_OUTLINE
264         x += 160;
265         add_tool(strokewidth_title = new BC_Title(x, y, _("Outline width:")));
266         stroke_width = new TitleStrokeW(client, 
267                 this, 
268                 x, 
269                 y + 20);
270         stroke_width->create_objects();
272         x += 210;
273         add_tool(color_stroke_button = new TitleColorStrokeButton(client, 
274                 this, 
275                 x, 
276                 y + 20));
277         color_stroke_x = color_x;
278         color_stroke_y = y + 20;
279         color_stroke_thread = new TitleColorStrokeThread(client, this);
280 #endif
283         x = 10;
284         y += 50;
286         add_tool(text_title = new BC_Title(x, y + 3, _("Text:")));
288         x += 100;
289         add_tool(timecode = new TitleTimecode(client, x, y));
293         x = 10;
294         y += 30;
295         text = new TitleText(client, 
296                 this, 
297                 x, 
298                 y, 
299                 get_w() - x - 10, 
300                 get_h() - y - 20 - 10);
301         text->create_objects();
303         update_color();
305         show_window();
306         flush();
307         return 0;
310 int TitleWindow::resize_event(int w, int h)
312         client->window_w = w;
313         client->window_h = h;
315         clear_box(0, 0, w, h);
316         font_title->reposition_window(font_title->get_x(), font_title->get_y());
317         font->reposition_window(font->get_x(), font->get_y());
318         font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
319         x_title->reposition_window(x_title->get_x(), x_title->get_y());
320         title_x->reposition_window(title_x->get_x(), title_x->get_y());
321         y_title->reposition_window(y_title->get_x(), y_title->get_y());
322         title_y->reposition_window(title_y->get_x(), title_y->get_y());
323         style_title->reposition_window(style_title->get_x(), style_title->get_y());
324         italic->reposition_window(italic->get_x(), italic->get_y());
325         bold->reposition_window(bold->get_x(), bold->get_y());
326 #ifdef USE_OUTLINE
327         stroke->reposition_window(stroke->get_x(), stroke->get_y());
328 #endif
329         size_title->reposition_window(size_title->get_x(), size_title->get_y());
330         size->reposition_window(size->get_x(), size->get_y());
331         encoding_title->reposition_window(encoding_title->get_x(), encoding_title->get_y());
332         encoding->reposition_window(encoding->get_x(), encoding->get_y());
333         color_button->reposition_window(color_button->get_x(), color_button->get_y());
334 #ifdef USE_OUTLINE
335         color_stroke_button->reposition_window(color_stroke_button->get_x(), color_stroke_button->get_y());
336 #endif
337         motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
338         motion->reposition_window(motion->get_x(), motion->get_y());
339         loop->reposition_window(loop->get_x(), loop->get_y());
340         dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
341         dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
342         fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
343         fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
344         fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
345         fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
346         text_title->reposition_window(text_title->get_x(), text_title->get_y());
347 #ifdef USE_OUTLINE
348         stroke_width->reposition_window(stroke_width->get_x(), stroke_width->get_y());
349         strokewidth_title->reposition_window(strokewidth_title->get_x(), strokewidth_title->get_y());
350 #endif
351         timecode->reposition_window(timecode->get_x(), timecode->get_y());
353         text->reposition_window(text->get_x(), 
354                 text->get_y(), 
355                 w - text->get_x() - 10,
356                 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));
360         justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
361         left->reposition_window(left->get_x(), left->get_y());
362         center->reposition_window(center->get_x(), center->get_y());
363         right->reposition_window(right->get_x(), right->get_y());
364         top->reposition_window(top->get_x(), top->get_y());
365         mid->reposition_window(mid->get_x(), mid->get_y());
366         bottom->reposition_window(bottom->get_x(), bottom->get_y());
367         speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
368         speed->reposition_window(speed->get_x(), speed->get_y());
369         update_color();
370         flash();
372         return 1;
376 void TitleWindow::previous_font()
378         int current_font = font->get_number();
379         current_font--;
380         if(current_font < 0) current_font = fonts.total - 1;
382         if(current_font < 0 || current_font >= fonts.total) return;
384         for(int i = 0; i < fonts.total; i++)
385         {
386                 fonts.values[i]->set_selected(i == current_font);
387         }
389         font->update(fonts.values[current_font]->get_text());
390         strcpy(client->config.font, fonts.values[current_font]->get_text());
391         client->send_configure_change();
394 void  TitleWindow::next_font()
396         int current_font = font->get_number();
397         current_font++;
398         if(current_font >= fonts.total) current_font = 0;
400         if(current_font < 0 || current_font >= fonts.total) return;
402         for(int i = 0; i < fonts.total; i++)
403         {
404                 fonts.values[i]->set_selected(i == current_font);
405         }
407         font->update(fonts.values[current_font]->get_text());
408         strcpy(client->config.font, fonts.values[current_font]->get_text());
409         client->send_configure_change();
413 int TitleWindow::close_event()
415 // Set result to 1 to indicate a client side close
416         set_done(1);
417         return 1;
420 void TitleWindow::update_color()
422 //printf("TitleWindow::update_color %x\n", client->config.color);
423         set_color(client->config.color);
424         draw_box(color_x, color_y, 100, 30);
425         flash(color_x, color_y, 100, 30);
426 #ifdef USE_OUTLINE
427         set_color(client->config.color_stroke);
428         draw_box(color_stroke_x, color_stroke_y, 100, 30);
429         flash(color_stroke_x, color_stroke_y, 100, 30);
430 #endif
433 void TitleWindow::update_justification()
435         left->update(client->config.hjustification == JUSTIFY_LEFT);
436         center->update(client->config.hjustification == JUSTIFY_CENTER);
437         right->update(client->config.hjustification == JUSTIFY_RIGHT);
438         top->update(client->config.vjustification == JUSTIFY_TOP);
439         mid->update(client->config.vjustification == JUSTIFY_MID);
440         bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
443 void TitleWindow::update()
445         title_x->update((int64_t)client->config.x);
446         title_y->update((int64_t)client->config.y);
447         italic->update(client->config.style & FONT_ITALIC);
448         bold->update(client->config.style & FONT_BOLD);
449 #ifdef USE_OUTLINE
450         stroke->update(client->config.style & FONT_OUTLINE);
451 #endif
452         size->update(client->config.size);
453         encoding->update(client->config.encoding);
454         motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
455         loop->update(client->config.loop);
456         dropshadow->update((float)client->config.dropshadow);
457         fade_in->update((float)client->config.fade_in);
458         fade_out->update((float)client->config.fade_out);
459 #ifdef USE_OUTLINE
460         stroke_width->update((float)client->config.stroke_width);
461 #endif
462         font->update(client->config.font);
463         text->update(client->config.text);
464         speed->update(client->config.pixels_per_second);
465         update_justification();
466         update_color();
470 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
471  : BC_Tumbler(x, y)
473         this->client = client;
474         this->window = window;
476 int TitleFontTumble::handle_up_event()
478         window->previous_font();
479         return 1;
482 int TitleFontTumble::handle_down_event()
484         window->next_font();
485         return 1;
488 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
489  : BC_CheckBox(x, y, client->config.style & FONT_BOLD, _("Bold"))
491         this->client = client;
492         this->window = window;
495 int TitleBold::handle_event()
497         client->config.style = (client->config.style & ~FONT_BOLD) | (get_value() ? FONT_BOLD : 0);
498         client->send_configure_change();
499         return 1;
502 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
503  : BC_CheckBox(x, y, client->config.style & FONT_ITALIC, _("Italic"))
505         this->client = client;
506         this->window = window;
508 int TitleItalic::handle_event()
510         client->config.style = (client->config.style & ~FONT_ITALIC) | (get_value() ? FONT_ITALIC : 0);
511         client->send_configure_change();
512         return 1;
515 TitleStroke::TitleStroke(TitleMain *client, TitleWindow *window, int x, int y)
516  : BC_CheckBox(x, y, client->config.style & FONT_OUTLINE, _("Outline"))
518         this->client = client;
519         this->window = window;
522 int TitleStroke::handle_event()
524         client->config.style = 
525                 (client->config.style & ~FONT_OUTLINE) | 
526                 (get_value() ? FONT_OUTLINE : 0);
527         client->send_configure_change();
528         return 1;
533 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
534  : BC_PopupTextBox(window, 
535                 &window->sizes,
536                 text,
537                 x, 
538                 y, 
539                 100,
540                 300)
542         this->client = client;
543         this->window = window;
545 TitleSize::~TitleSize()
548 int TitleSize::handle_event()
550         client->config.size = atol(get_text());
551 //printf("TitleSize::handle_event 1 %s\n", get_text());
552         client->send_configure_change();
553         return 1;
555 void TitleSize::update(int size)
557         char string[BCTEXTLEN];
558         sprintf(string, "%d", size);
559         BC_PopupTextBox::update(string);
561 TitleEncoding::TitleEncoding(TitleMain *client, TitleWindow *window, int x, int y)
562  : BC_PopupTextBox(window, 
563                 &window->encodings,
564                 client->config.encoding,
565                 x, 
566                 y, 
567                 100,
568                 300)
570         this->client = client;
571         this->window = window;
574 TitleEncoding::~TitleEncoding()
577 int TitleEncoding::handle_event()
579         strcpy(client->config.encoding, get_text());
580         client->send_configure_change();
581         return 1;
584 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
585  : BC_GenericButton(x, y, _("Color..."))
587         this->client = client;
588         this->window = window;
590 int TitleColorButton::handle_event()
592         window->color_thread->start_window(client->config.color, 0);
593         return 1;
596 TitleColorStrokeButton::TitleColorStrokeButton(TitleMain *client, TitleWindow *window, int x, int y)
597  : BC_GenericButton(x, y, _("Outline color..."))
599         this->client = client;
600         this->window = window;
602 int TitleColorStrokeButton::handle_event()
604 #ifdef USE_OUTLINE
605         window->color_stroke_thread->start_window(client->config.color_stroke, 0);
606 #endif
607         return 1;
610 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
611  : BC_PopupTextBox(window, 
612                 &window->paths,
613                 client->motion_to_text(client->config.motion_strategy),
614                 x, 
615                 y, 
616                 120,
617                 100)
619         this->client = client;
620         this->window = window;
622 int TitleMotion::handle_event()
624         client->config.motion_strategy = client->text_to_motion(get_text());
625         client->send_configure_change();
626         return 1;
629 TitleLoop::TitleLoop(TitleMain *client, int x, int y)
630  : BC_CheckBox(x, y, client->config.loop, _("Loop"))
632         this->client = client;
634 int TitleLoop::handle_event()
636         client->config.loop = get_value();
637         client->send_configure_change();
638         return 1;
641 TitleTimecode::TitleTimecode(TitleMain *client, int x, int y)
642  : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
644         this->client = client;
646 int TitleTimecode::handle_event()
648         client->config.timecode = get_value();
649         client->send_configure_change();
650         return 1;
653 TitleFade::TitleFade(TitleMain *client, 
654         TitleWindow *window, 
655         double *value, 
656         int x, 
657         int y)
658  : BC_TextBox(x, y, 90, 1, (float)*value)
660         this->client = client;
661         this->window = window;
662         this->value = value;
665 int TitleFade::handle_event()
667         *value = atof(get_text());
668         client->send_configure_change();
669         return 1;
672 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
673  : BC_PopupTextBox(window, 
674                 &window->fonts,
675                 client->config.font,
676                 x, 
677                 y, 
678                 200,
679                 500)
681         this->client = client;
682         this->window = window;
684 int TitleFont::handle_event()
686         strcpy(client->config.font, get_text());
687         client->send_configure_change();
688         return 1;
691 TitleText::TitleText(TitleMain *client, 
692         TitleWindow *window, 
693         int x, 
694         int y, 
695         int w, 
696         int h)
697  : BC_ScrollTextBox(window, 
698                 x, 
699                 y, 
700                 w,
701                 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
702                 client->config.text)
704         this->client = client;
705         this->window = window;
706 //printf("TitleText::TitleText %s\n", client->config.text);
709 int TitleText::handle_event()
711         strcpy(client->config.text, get_text());
712         client->send_configure_change();
713         return 1;
717 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
718  : BC_TumbleTextBox(window,
719         (int64_t)client->config.dropshadow,
720         (int64_t)0,
721         (int64_t)1000,
722         x, 
723         y, 
724         70)
726         this->client = client;
727         this->window = window;
729 int TitleDropShadow::handle_event()
731         client->config.dropshadow = atol(get_text());
732         client->send_configure_change();
733         return 1;
737 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
738  : BC_TumbleTextBox(window,
739         (int64_t)client->config.x,
740         (int64_t)-2048,
741         (int64_t)2048,
742         x, 
743         y, 
744         60)
746         this->client = client;
747         this->window = window;
749 int TitleX::handle_event()
751         client->config.x = atol(get_text());
752         client->send_configure_change();
753         return 1;
756 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
757  : BC_TumbleTextBox(window,
758         (int64_t)client->config.y, 
759         (int64_t)-2048,
760         (int64_t)2048,
761         x, 
762         y, 
763         60)
765         this->client = client;
766         this->window = window;
768 int TitleY::handle_event()
770         client->config.y = atol(get_text());
771         client->send_configure_change();
772         return 1;
775 TitleStrokeW::TitleStrokeW(TitleMain *client, 
776         TitleWindow *window, 
777         int x, 
778         int y)
779  : BC_TumbleTextBox(window,
780         (float)client->config.stroke_width,
781         (float)-2048,
782         (float)2048,
783         x, 
784         y, 
785         60)
787         this->client = client;
788         this->window = window;
790 int TitleStrokeW::handle_event()
792         client->config.stroke_width = atof(get_text());
793         client->send_configure_change();
794         return 1;
798 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
799  : BC_TumbleTextBox(window,
800         (float)client->config.pixels_per_second, 
801         (float)0,
802         (float)1000,
803         x, 
804         y, 
805         70)
807         this->client = client;
811 int TitleSpeed::handle_event()
813         client->config.pixels_per_second = atof(get_text());
814         client->send_configure_change();
815         return 1;
824 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
825  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
827         this->client = client;
828         this->window = window;
830 int TitleLeft::handle_event()
832         client->config.hjustification = JUSTIFY_LEFT;
833         window->update_justification();
834         client->send_configure_change();
835         return 1;
838 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
839  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
841         this->client = client;
842         this->window = window;
844 int TitleCenter::handle_event()
846         client->config.hjustification = JUSTIFY_CENTER;
847         window->update_justification();
848         client->send_configure_change();
849         return 1;
852 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
853  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
855         this->client = client;
856         this->window = window;
858 int TitleRight::handle_event()
860         client->config.hjustification = JUSTIFY_RIGHT;
861         window->update_justification();
862         client->send_configure_change();
863         return 1;
868 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
869  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
871         this->client = client;
872         this->window = window;
874 int TitleTop::handle_event()
876         client->config.vjustification = JUSTIFY_TOP;
877         window->update_justification();
878         client->send_configure_change();
879         return 1;
882 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
883  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
885         this->client = client;
886         this->window = window;
888 int TitleMid::handle_event()
890         client->config.vjustification = JUSTIFY_MID;
891         window->update_justification();
892         client->send_configure_change();
893         return 1;
896 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
897  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
899         this->client = client;
900         this->window = window;
902 int TitleBottom::handle_event()
904         client->config.vjustification = JUSTIFY_BOTTOM;
905         window->update_justification();
906         client->send_configure_change();
907         return 1;
912 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window)
913  : ColorThread()
915         this->client = client;
916         this->window = window;
919 int TitleColorThread::handle_event(int output)
921         client->config.color = output;
922         window->update_color();
923         window->flush();
924         client->send_configure_change();
925         return 1;
927 TitleColorStrokeThread::TitleColorStrokeThread(TitleMain *client, TitleWindow *window)
928  : ColorThread()
930         this->client = client;
931         this->window = window;
934 int TitleColorStrokeThread::handle_event(int output)
936         client->config.color_stroke = output;
937         window->update_color();
938         window->flush();
939         client->send_configure_change();
940         return 1;