textbox click policy prefs
[goodguy/history.git] / cinelerra-5.1 / plugins / titler / titlewindow.C.stroker
1 #include "bcdisplayinfo.h"
2 #include "language.h"
3 #include "titlewindow.h"
4
5 #include <string.h>
6
7
8 PLUGIN_THREAD_OBJECT(TitleMain, TitleThread, TitleWindow)
9
10
11 TitleWindow::TitleWindow(TitleMain *client, int x, int y)
12  : BC_Window(client->gui_string,
13         x,
14         y,
15         client->window_w,
16         client->window_h,
17         100,
18         100,
19         1,
20         0,
21         1)
22 {
23         this->client = client;
24 }
25
26 TitleWindow::~TitleWindow()
27 {
28         sizes.remove_all_objects();
29         encodings.remove_all_objects();
30         delete color_thread;
31 #ifdef USE_OUTLINE
32         delete color_stroke_thread;
33 #endif
34         delete title_x;
35         delete title_y;
36 }
37
38 int TitleWindow::create_objects()
39 {
40         int x = 10, y = 10;
41
42         encodings.append(new BC_ListBoxItem("ISO8859-1"));
43         encodings.append(new BC_ListBoxItem("ISO8859-2"));
44         encodings.append(new BC_ListBoxItem("ISO8859-3"));
45         encodings.append(new BC_ListBoxItem("ISO8859-4"));
46         encodings.append(new BC_ListBoxItem("ISO8859-5"));
47         encodings.append(new BC_ListBoxItem("ISO8859-6"));
48         encodings.append(new BC_ListBoxItem("ISO8859-7"));
49         encodings.append(new BC_ListBoxItem("ISO8859-8"));
50         encodings.append(new BC_ListBoxItem("ISO8859-9"));
51         encodings.append(new BC_ListBoxItem("ISO8859-10"));
52         encodings.append(new BC_ListBoxItem("ISO8859-11"));
53         encodings.append(new BC_ListBoxItem("ISO8859-12"));
54         encodings.append(new BC_ListBoxItem("ISO8859-13"));
55         encodings.append(new BC_ListBoxItem("ISO8859-14"));
56         encodings.append(new BC_ListBoxItem("ISO8859-15"));
57         encodings.append(new BC_ListBoxItem("KOI8"));
58
59
60
61         sizes.append(new BC_ListBoxItem("8"));
62         sizes.append(new BC_ListBoxItem("9"));
63         sizes.append(new BC_ListBoxItem("10"));
64         sizes.append(new BC_ListBoxItem("11"));
65         sizes.append(new BC_ListBoxItem("12"));
66         sizes.append(new BC_ListBoxItem("13"));
67         sizes.append(new BC_ListBoxItem("14"));
68         sizes.append(new BC_ListBoxItem("16"));
69         sizes.append(new BC_ListBoxItem("18"));
70         sizes.append(new BC_ListBoxItem("20"));
71         sizes.append(new BC_ListBoxItem("22"));
72         sizes.append(new BC_ListBoxItem("24"));
73         sizes.append(new BC_ListBoxItem("26"));
74         sizes.append(new BC_ListBoxItem("28"));
75         sizes.append(new BC_ListBoxItem("32"));
76         sizes.append(new BC_ListBoxItem("36"));
77         sizes.append(new BC_ListBoxItem("40"));
78         sizes.append(new BC_ListBoxItem("48"));
79         sizes.append(new BC_ListBoxItem("56"));
80         sizes.append(new BC_ListBoxItem("64"));
81         sizes.append(new BC_ListBoxItem("72"));
82         sizes.append(new BC_ListBoxItem("100"));
83         sizes.append(new BC_ListBoxItem("128"));
84
85         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
86         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
87         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
88         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
89         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
90
91
92
93 // Construct font list
94         for(int i = 0; i < client->fonts->total; i++)
95         {
96                 int exists = 0;
97                 for(int j = 0; j < fonts.total; j++)
98                 {
99                         if(!strcasecmp(fonts.values[j]->get_text(),
100                                 client->fonts->values[i]->fixed_title))
101                         {
102                                 exists = 1;
103                                 break;
104                         }
105                 }
106
107                 if(!exists) fonts.append(new
108                         BC_ListBoxItem(client->fonts->values[i]->fixed_title));
109         }
110
111 // Sort font list
112         int done = 0;
113         while(!done)
114         {
115                 done = 1;
116                 for(int i = 0; i < fonts.total - 1; i++)
117                 {
118                         if(strcmp(fonts.values[i]->get_text(), fonts.values[i + 1]->get_text()) > 0)
119                         {
120                                 BC_ListBoxItem *temp = fonts.values[i + 1];
121                                 fonts.values[i + 1] = fonts.values[i];
122                                 fonts.values[i] = temp;
123                                 done = 0;
124                         }
125                 }
126         }
127
128
129
130
131
132
133
134
135
136
137
138
139         add_tool(font_title = new BC_Title(x, y, _("Font:")));
140         font = new TitleFont(client, this, x, y + 20);
141         font->create_objects();
142         x += 230;
143         add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y + 20));
144         x += 30;
145         char string[BCTEXTLEN];
146         add_tool(size_title = new BC_Title(x, y, _("Size:")));
147         sprintf(string, "%d", client->config.size);
148         size = new TitleSize(client, this, x, y + 20, string);
149         size->create_objects();
150         x += 140;
151
152         add_tool(style_title = new BC_Title(x, y, _("Style:")));
153         add_tool(italic = new TitleItalic(client, this, x, y + 20));
154         add_tool(bold = new TitleBold(client, this, x, y + 50));
155 #ifdef USE_OUTLINE
156         add_tool(stroke = new TitleStroke(client, this, x, y + 80));
157 #endif
158         x += 90;
159         add_tool(justify_title = new BC_Title(x, y, _("Justify:")));
160         add_tool(left = new TitleLeft(client, this, x, y + 20));
161         add_tool(center = new TitleCenter(client, this, x, y + 50));
162         add_tool(right = new TitleRight(client, this, x, y + 80));
163
164         x += 80;
165         add_tool(top = new TitleTop(client, this, x, y + 20));
166         add_tool(mid = new TitleMid(client, this, x, y + 50));
167         add_tool(bottom= new TitleBottom(client, this, x, y + 80));
168
169
170
171         y += 50;
172         x = 10;
173
174         add_tool(x_title = new BC_Title(x, y, _("X:")));
175         title_x = new TitleX(client, this, x, y + 20);
176         title_x->create_objects();
177         x += 90;
178
179         add_tool(y_title = new BC_Title(x, y, _("Y:")));
180         title_y = new TitleY(client, this, x, y + 20);
181         title_y->create_objects();
182         x += 90;
183
184         add_tool(motion_title = new BC_Title(x, y, _("Motion type:")));
185
186         motion = new TitleMotion(client, this, x, y + 20);
187         motion->create_objects();
188         x += 150;
189
190         add_tool(loop = new TitleLoop(client, x, y + 20));
191         x += 100;
192
193         x = 10;
194         y += 50;
195
196         add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
197         dropshadow = new TitleDropShadow(client, this, x, y + 20);
198         dropshadow->create_objects();
199         x += 100;
200
201         add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
202         add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
203         x += 100;
204
205         add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
206         add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
207         x += 110;
208
209         add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
210         speed = new TitleSpeed(client, this, x, y + 20);
211         speed->create_objects();
212         x += 110;
213
214         add_tool(color_button = new TitleColorButton(client, this, x, y + 20));
215         x += 90;
216         color_x = x;
217         color_y = y + 20;
218         color_thread = new TitleColorThread(client, this);
219
220         x = 10;
221         y += 50;
222         add_tool(encoding_title = new BC_Title(x, y + 3, _("Encoding:")));
223         encoding = new TitleEncoding(client, this, x, y + 20);
224         encoding->create_objects();
225
226 #ifdef USE_OUTLINE
227         x += 160;
228         add_tool(strokewidth_title = new BC_Title(x, y, _("Outline width:")));
229         stroke_width = new TitleStrokeW(client,
230                 this,
231                 x,
232                 y + 20);
233         stroke_width->create_objects();
234
235         x += 210;
236         add_tool(color_stroke_button = new TitleColorStrokeButton(client,
237                 this,
238                 x,
239                 y + 20));
240         color_stroke_x = color_x;
241         color_stroke_y = y + 20;
242         color_stroke_thread = new TitleColorStrokeThread(client, this);
243 #endif
244
245
246         x = 10;
247         y += 50;
248
249         add_tool(text_title = new BC_Title(x, y + 3, _("Text:")));
250
251         x += 100;
252         add_tool(timecode = new TitleTimecode(client, x, y));
253
254
255
256         x = 10;
257         y += 30;
258         text = new TitleText(client,
259                 this,
260                 x,
261                 y,
262                 get_w() - x - 10,
263                 get_h() - y - 20 - 10);
264         text->create_objects();
265
266         update_color();
267
268         show_window();
269         flush();
270         return 0;
271 }
272
273 int TitleWindow::resize_event(int w, int h)
274 {
275         client->window_w = w;
276         client->window_h = h;
277
278         clear_box(0, 0, w, h);
279         font_title->reposition_window(font_title->get_x(), font_title->get_y());
280         font->reposition_window(font->get_x(), font->get_y());
281         font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
282         x_title->reposition_window(x_title->get_x(), x_title->get_y());
283         title_x->reposition_window(title_x->get_x(), title_x->get_y());
284         y_title->reposition_window(y_title->get_x(), y_title->get_y());
285         title_y->reposition_window(title_y->get_x(), title_y->get_y());
286         style_title->reposition_window(style_title->get_x(), style_title->get_y());
287         italic->reposition_window(italic->get_x(), italic->get_y());
288         bold->reposition_window(bold->get_x(), bold->get_y());
289 #ifdef USE_OUTLINE
290         stroke->reposition_window(stroke->get_x(), stroke->get_y());
291 #endif
292         size_title->reposition_window(size_title->get_x(), size_title->get_y());
293         size->reposition_window(size->get_x(), size->get_y());
294         encoding_title->reposition_window(encoding_title->get_x(), encoding_title->get_y());
295         encoding->reposition_window(encoding->get_x(), encoding->get_y());
296         color_button->reposition_window(color_button->get_x(), color_button->get_y());
297 #ifdef USE_OUTLINE
298         color_stroke_button->reposition_window(color_stroke_button->get_x(), color_stroke_button->get_y());
299 #endif
300         motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
301         motion->reposition_window(motion->get_x(), motion->get_y());
302         loop->reposition_window(loop->get_x(), loop->get_y());
303         dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
304         dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
305         fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
306         fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
307         fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
308         fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
309         text_title->reposition_window(text_title->get_x(), text_title->get_y());
310 #ifdef USE_OUTLINE
311         stroke_width->reposition_window(stroke_width->get_x(), stroke_width->get_y());
312         strokewidth_title->reposition_window(strokewidth_title->get_x(), strokewidth_title->get_y());
313 #endif
314         timecode->reposition_window(timecode->get_x(), timecode->get_y());
315
316         text->reposition_window(text->get_x(),
317                 text->get_y(),
318                 w - text->get_x() - 10,
319                 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));
320
321
322
323         justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
324         left->reposition_window(left->get_x(), left->get_y());
325         center->reposition_window(center->get_x(), center->get_y());
326         right->reposition_window(right->get_x(), right->get_y());
327         top->reposition_window(top->get_x(), top->get_y());
328         mid->reposition_window(mid->get_x(), mid->get_y());
329         bottom->reposition_window(bottom->get_x(), bottom->get_y());
330         speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
331         speed->reposition_window(speed->get_x(), speed->get_y());
332         update_color();
333         flash();
334
335         return 1;
336 }
337
338
339 void TitleWindow::previous_font()
340 {
341         int current_font = font->get_number();
342         current_font--;
343         if(current_font < 0) current_font = fonts.total - 1;
344
345         if(current_font < 0 || current_font >= fonts.total) return;
346
347         for(int i = 0; i < fonts.total; i++)
348         {
349                 fonts.values[i]->set_selected(i == current_font);
350         }
351
352         font->update(fonts.values[current_font]->get_text());
353         strcpy(client->config.font, fonts.values[current_font]->get_text());
354         client->send_configure_change();
355 }
356
357 void  TitleWindow::next_font()
358 {
359         int current_font = font->get_number();
360         current_font++;
361         if(current_font >= fonts.total) current_font = 0;
362
363         if(current_font < 0 || current_font >= fonts.total) return;
364
365         for(int i = 0; i < fonts.total; i++)
366         {
367                 fonts.values[i]->set_selected(i == current_font);
368         }
369
370         font->update(fonts.values[current_font]->get_text());
371         strcpy(client->config.font, fonts.values[current_font]->get_text());
372         client->send_configure_change();
373 }
374
375
376 int TitleWindow::close_event()
377 {
378 // Set result to 1 to indicate a client side close
379         set_done(1);
380         return 1;
381 }
382
383 void TitleWindow::update_color()
384 {
385 //printf("TitleWindow::update_color %x\n", client->config.color);
386         set_color(client->config.color);
387         draw_box(color_x, color_y, 100, 30);
388         flash(color_x, color_y, 100, 30);
389 #ifdef USE_OUTLINE
390         set_color(client->config.color_stroke);
391         draw_box(color_stroke_x, color_stroke_y, 100, 30);
392         flash(color_stroke_x, color_stroke_y, 100, 30);
393 #endif
394 }
395
396 void TitleWindow::update_justification()
397 {
398         left->update(client->config.hjustification == JUSTIFY_LEFT);
399         center->update(client->config.hjustification == JUSTIFY_CENTER);
400         right->update(client->config.hjustification == JUSTIFY_RIGHT);
401         top->update(client->config.vjustification == JUSTIFY_TOP);
402         mid->update(client->config.vjustification == JUSTIFY_MID);
403         bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
404 }
405
406 void TitleWindow::update()
407 {
408         title_x->update((int64_t)client->config.x);
409         title_y->update((int64_t)client->config.y);
410         italic->update(client->config.style & FONT_ITALIC);
411         bold->update(client->config.style & FONT_BOLD);
412 #ifdef USE_OUTLINE
413         stroke->update(client->config.style & FONT_OUTLINE);
414 #endif
415         size->update(client->config.size);
416         encoding->update(client->config.encoding);
417         motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
418         loop->update(client->config.loop);
419         dropshadow->update((float)client->config.dropshadow);
420         fade_in->update((float)client->config.fade_in);
421         fade_out->update((float)client->config.fade_out);
422 #ifdef USE_OUTLINE
423         stroke_width->update((float)client->config.stroke_width);
424 #endif
425         font->update(client->config.font);
426         text->update(client->config.text);
427         speed->update(client->config.pixels_per_second);
428         update_justification();
429         update_color();
430 }
431
432
433 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
434  : BC_Tumbler(x, y)
435 {
436         this->client = client;
437         this->window = window;
438 }
439 int TitleFontTumble::handle_up_event()
440 {
441         window->previous_font();
442         return 1;
443 }
444
445 int TitleFontTumble::handle_down_event()
446 {
447         window->next_font();
448         return 1;
449 }
450
451 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
452  : BC_CheckBox(x, y, client->config.style & FONT_BOLD, _("Bold"))
453 {
454         this->client = client;
455         this->window = window;
456 }
457
458 int TitleBold::handle_event()
459 {
460         client->config.style = (client->config.style & ~FONT_BOLD) | (get_value() ? FONT_BOLD : 0);
461         client->send_configure_change();
462         return 1;
463 }
464
465 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
466  : BC_CheckBox(x, y, client->config.style & FONT_ITALIC, _("Italic"))
467 {
468         this->client = client;
469         this->window = window;
470 }
471 int TitleItalic::handle_event()
472 {
473         client->config.style = (client->config.style & ~FONT_ITALIC) | (get_value() ? FONT_ITALIC : 0);
474         client->send_configure_change();
475         return 1;
476 }
477
478 TitleStroke::TitleStroke(TitleMain *client, TitleWindow *window, int x, int y)
479  : BC_CheckBox(x, y, client->config.style & FONT_OUTLINE, _("Outline"))
480 {
481         this->client = client;
482         this->window = window;
483 }
484
485 int TitleStroke::handle_event()
486 {
487         client->config.style =
488                 (client->config.style & ~FONT_OUTLINE) |
489                 (get_value() ? FONT_OUTLINE : 0);
490         client->send_configure_change();
491         return 1;
492 }
493
494
495
496 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
497  : BC_PopupTextBox(window,
498                 &window->sizes,
499                 text,
500                 x,
501                 y,
502                 100,
503                 300)
504 {
505         this->client = client;
506         this->window = window;
507 }
508 TitleSize::~TitleSize()
509 {
510 }
511 int TitleSize::handle_event()
512 {
513         client->config.size = atol(get_text());
514 //printf("TitleSize::handle_event 1 %s\n", get_text());
515         client->send_configure_change();
516         return 1;
517 }
518 void TitleSize::update(int size)
519 {
520         char string[BCTEXTLEN];
521         sprintf(string, "%d", size);
522         BC_PopupTextBox::update(string);
523 }
524 TitleEncoding::TitleEncoding(TitleMain *client, TitleWindow *window, int x, int y)
525  : BC_PopupTextBox(window,
526                 &window->encodings,
527                 client->config.encoding,
528                 x,
529                 y,
530                 100,
531                 300)
532 {
533         this->client = client;
534         this->window = window;
535 }
536
537 TitleEncoding::~TitleEncoding()
538 {
539 }
540 int TitleEncoding::handle_event()
541 {
542         strcpy(client->config.encoding, get_text());
543         client->send_configure_change();
544         return 1;
545 }
546
547 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
548  : BC_GenericButton(x, y, _("Color..."))
549 {
550         this->client = client;
551         this->window = window;
552 }
553 int TitleColorButton::handle_event()
554 {
555         window->color_thread->start_window(client->config.color, 0);
556         return 1;
557 }
558
559 TitleColorStrokeButton::TitleColorStrokeButton(TitleMain *client, TitleWindow *window, int x, int y)
560  : BC_GenericButton(x, y, _("Outline color..."))
561 {
562         this->client = client;
563         this->window = window;
564 }
565 int TitleColorStrokeButton::handle_event()
566 {
567 #ifdef USE_OUTLINE
568         window->color_stroke_thread->start_window(client->config.color_stroke, 0);
569 #endif
570         return 1;
571 }
572
573 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
574  : BC_PopupTextBox(window,
575                 &window->paths,
576                 client->motion_to_text(client->config.motion_strategy),
577                 x,
578                 y,
579                 120,
580                 100)
581 {
582         this->client = client;
583         this->window = window;
584 }
585 int TitleMotion::handle_event()
586 {
587         client->config.motion_strategy = client->text_to_motion(get_text());
588         client->send_configure_change();
589         return 1;
590 }
591
592 TitleLoop::TitleLoop(TitleMain *client, int x, int y)
593  : BC_CheckBox(x, y, client->config.loop, _("Loop"))
594 {
595         this->client = client;
596 }
597 int TitleLoop::handle_event()
598 {
599         client->config.loop = get_value();
600         client->send_configure_change();
601         return 1;
602 }
603
604 TitleTimecode::TitleTimecode(TitleMain *client, int x, int y)
605  : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
606 {
607         this->client = client;
608 }
609 int TitleTimecode::handle_event()
610 {
611         client->config.timecode = get_value();
612         client->send_configure_change();
613         return 1;
614 }
615
616 TitleFade::TitleFade(TitleMain *client,
617         TitleWindow *window,
618         double *value,
619         int x,
620         int y)
621  : BC_TextBox(x, y, 90, 1, (float)*value)
622 {
623         this->client = client;
624         this->window = window;
625         this->value = value;
626 }
627
628 int TitleFade::handle_event()
629 {
630         *value = atof(get_text());
631         client->send_configure_change();
632         return 1;
633 }
634
635 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
636  : BC_PopupTextBox(window,
637                 &window->fonts,
638                 client->config.font,
639                 x,
640                 y,
641                 200,
642                 500)
643 {
644         this->client = client;
645         this->window = window;
646 }
647 int TitleFont::handle_event()
648 {
649         strcpy(client->config.font, get_text());
650         client->send_configure_change();
651         return 1;
652 }
653
654 TitleText::TitleText(TitleMain *client,
655         TitleWindow *window,
656         int x,
657         int y,
658         int w,
659         int h)
660  : BC_ScrollTextBox(window,
661                 x,
662                 y,
663                 w,
664                 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
665                 client->config.text)
666 {
667         this->client = client;
668         this->window = window;
669 //printf("TitleText::TitleText %s\n", client->config.text);
670 }
671
672 int TitleText::handle_event()
673 {
674         strcpy(client->config.text, get_text());
675         client->send_configure_change();
676         return 1;
677 }
678
679
680 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
681  : BC_TumbleTextBox(window,
682         (int64_t)client->config.dropshadow,
683         (int64_t)0,
684         (int64_t)1000,
685         x,
686         y,
687         70)
688 {
689         this->client = client;
690         this->window = window;
691 }
692 int TitleDropShadow::handle_event()
693 {
694         client->config.dropshadow = atol(get_text());
695         client->send_configure_change();
696         return 1;
697 }
698
699
700 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
701  : BC_TumbleTextBox(window,
702         (int64_t)client->config.x,
703         (int64_t)-2048,
704         (int64_t)2048,
705         x,
706         y,
707         60)
708 {
709         this->client = client;
710         this->window = window;
711 }
712 int TitleX::handle_event()
713 {
714         client->config.x = atol(get_text());
715         client->send_configure_change();
716         return 1;
717 }
718
719 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
720  : BC_TumbleTextBox(window,
721         (int64_t)client->config.y,
722         (int64_t)-2048,
723         (int64_t)2048,
724         x,
725         y,
726         60)
727 {
728         this->client = client;
729         this->window = window;
730 }
731 int TitleY::handle_event()
732 {
733         client->config.y = atol(get_text());
734         client->send_configure_change();
735         return 1;
736 }
737
738 TitleStrokeW::TitleStrokeW(TitleMain *client,
739         TitleWindow *window,
740         int x,
741         int y)
742  : BC_TumbleTextBox(window,
743         (float)client->config.stroke_width,
744         (float)-2048,
745         (float)2048,
746         x,
747         y,
748         60)
749 {
750         this->client = client;
751         this->window = window;
752 }
753 int TitleStrokeW::handle_event()
754 {
755         client->config.stroke_width = atof(get_text());
756         client->send_configure_change();
757         return 1;
758 }
759
760
761 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
762  : BC_TumbleTextBox(window,
763         (float)client->config.pixels_per_second,
764         (float)0,
765         (float)1000,
766         x,
767         y,
768         70)
769 {
770         this->client = client;
771 }
772
773
774 int TitleSpeed::handle_event()
775 {
776         client->config.pixels_per_second = atof(get_text());
777         client->send_configure_change();
778         return 1;
779 }
780
781
782
783
784
785
786
787 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
788  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
789 {
790         this->client = client;
791         this->window = window;
792 }
793 int TitleLeft::handle_event()
794 {
795         client->config.hjustification = JUSTIFY_LEFT;
796         window->update_justification();
797         client->send_configure_change();
798         return 1;
799 }
800
801 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
802  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
803 {
804         this->client = client;
805         this->window = window;
806 }
807 int TitleCenter::handle_event()
808 {
809         client->config.hjustification = JUSTIFY_CENTER;
810         window->update_justification();
811         client->send_configure_change();
812         return 1;
813 }
814
815 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
816  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
817 {
818         this->client = client;
819         this->window = window;
820 }
821 int TitleRight::handle_event()
822 {
823         client->config.hjustification = JUSTIFY_RIGHT;
824         window->update_justification();
825         client->send_configure_change();
826         return 1;
827 }
828
829
830
831 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
832  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
833 {
834         this->client = client;
835         this->window = window;
836 }
837 int TitleTop::handle_event()
838 {
839         client->config.vjustification = JUSTIFY_TOP;
840         window->update_justification();
841         client->send_configure_change();
842         return 1;
843 }
844
845 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
846  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
847 {
848         this->client = client;
849         this->window = window;
850 }
851 int TitleMid::handle_event()
852 {
853         client->config.vjustification = JUSTIFY_MID;
854         window->update_justification();
855         client->send_configure_change();
856         return 1;
857 }
858
859 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
860  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
861 {
862         this->client = client;
863         this->window = window;
864 }
865 int TitleBottom::handle_event()
866 {
867         client->config.vjustification = JUSTIFY_BOTTOM;
868         window->update_justification();
869         client->send_configure_change();
870         return 1;
871 }
872
873
874
875 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window)
876  : ColorThread()
877 {
878         this->client = client;
879         this->window = window;
880 }
881
882 int TitleColorThread::handle_event(int output)
883 {
884         client->config.color = output;
885         window->update_color();
886         window->flush();
887         client->send_configure_change();
888         return 1;
889 }
890 TitleColorStrokeThread::TitleColorStrokeThread(TitleMain *client, TitleWindow *window)
891  : ColorThread()
892 {
893         this->client = client;
894         this->window = window;
895 }
896
897 int TitleColorStrokeThread::handle_event(int output)
898 {
899         client->config.color_stroke = output;
900         window->update_color();
901         window->flush();
902         client->send_configure_change();
903         return 1;
904 }