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