Fixed initialisation of tf in file_open(). Without setting the memory to 0,
[cinelerra_cv/mob.git] / plugins / titler / titlewindow.C
blob3238f9d44fecfe6c0f7b4359b0c9cc9f6c3788a5
1 #include "bcdisplayinfo.h"
2 #include "titlewindow.h"
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)
18 PLUGIN_THREAD_OBJECT(TitleMain, TitleThread, TitleWindow)
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; 
44 TitleWindow::~TitleWindow()
46         sizes.remove_all_objects();
47         encodings.remove_all_objects();
48         timecodeformats.remove_all_objects();
49         delete timecodeformat;
50         delete color_thread;
51 #ifdef USE_OUTLINE
52         delete color_stroke_thread;
53 #endif
54         delete title_x;
55         delete title_y;
58 int TitleWindow::create_objects()
60         int x = 10, y = 10;
61         timecodeformats.append(new BC_ListBoxItem(TIME_SECONDS__STR));
62         timecodeformats.append(new BC_ListBoxItem(TIME_HMS__STR));              
63         timecodeformats.append(new BC_ListBoxItem(TIME_HMS2__STR));                     
64         timecodeformats.append(new BC_ListBoxItem(TIME_HMS3__STR));             
65         timecodeformats.append(new BC_ListBoxItem(TIME_HMSF__STR));             
66         //      timecodeformats.append(new BC_ListBoxItem(TIME_SAMPLES__STR));          
67         //      timecodeformats.append(new BC_ListBoxItem(TIME_SAMPLES_HEX__STR));      
68         timecodeformats.append(new BC_ListBoxItem(TIME_FRAMES__STR));           
69         //      timecodeformats.append(new BC_ListBoxItem(TIME_FEET_FRAMES__STR));      
70         
71         encodings.append(new BC_ListBoxItem("ISO8859-1"));
72         encodings.append(new BC_ListBoxItem("ISO8859-2"));
73         encodings.append(new BC_ListBoxItem("ISO8859-3"));
74         encodings.append(new BC_ListBoxItem("ISO8859-4"));
75         encodings.append(new BC_ListBoxItem("ISO8859-5"));
76         encodings.append(new BC_ListBoxItem("ISO8859-6"));
77         encodings.append(new BC_ListBoxItem("ISO8859-7"));
78         encodings.append(new BC_ListBoxItem("ISO8859-8"));
79         encodings.append(new BC_ListBoxItem("ISO8859-9"));
80         encodings.append(new BC_ListBoxItem("ISO8859-10"));
81         encodings.append(new BC_ListBoxItem("ISO8859-11"));
82         encodings.append(new BC_ListBoxItem("ISO8859-12"));
83         encodings.append(new BC_ListBoxItem("ISO8859-13"));
84         encodings.append(new BC_ListBoxItem("ISO8859-14"));
85         encodings.append(new BC_ListBoxItem("ISO8859-15"));
86         encodings.append(new BC_ListBoxItem("KOI8"));
90         sizes.append(new BC_ListBoxItem("8"));
91         sizes.append(new BC_ListBoxItem("9"));
92         sizes.append(new BC_ListBoxItem("10"));
93         sizes.append(new BC_ListBoxItem("11"));
94         sizes.append(new BC_ListBoxItem("12"));
95         sizes.append(new BC_ListBoxItem("13"));
96         sizes.append(new BC_ListBoxItem("14"));
97         sizes.append(new BC_ListBoxItem("16"));
98         sizes.append(new BC_ListBoxItem("18"));
99         sizes.append(new BC_ListBoxItem("20"));
100         sizes.append(new BC_ListBoxItem("22"));
101         sizes.append(new BC_ListBoxItem("24"));
102         sizes.append(new BC_ListBoxItem("26"));
103         sizes.append(new BC_ListBoxItem("28"));
104         sizes.append(new BC_ListBoxItem("32"));
105         sizes.append(new BC_ListBoxItem("36"));
106         sizes.append(new BC_ListBoxItem("40"));
107         sizes.append(new BC_ListBoxItem("48"));
108         sizes.append(new BC_ListBoxItem("56"));
109         sizes.append(new BC_ListBoxItem("64"));
110         sizes.append(new BC_ListBoxItem("72"));
111         sizes.append(new BC_ListBoxItem("100"));
112         sizes.append(new BC_ListBoxItem("128"));
114         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(NO_MOTION)));
115         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(BOTTOM_TO_TOP)));
116         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(TOP_TO_BOTTOM)));
117         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(RIGHT_TO_LEFT)));
118         paths.append(new BC_ListBoxItem(TitleMain::motion_to_text(LEFT_TO_RIGHT)));
122 // Construct font list
123         for(int i = 0; i < client->fonts->total; i++)
124         {
125                 int exists = 0;
126                 for(int j = 0; j < fonts.total; j++)
127                 {
128                         if(!strcasecmp(fonts.values[j]->get_text(), 
129                                 client->fonts->values[i]->fixed_title)) 
130                         {
131                                 exists = 1;
132                                 break;
133                         }
134                 }
136                 if(!exists) fonts.append(new 
137                         BC_ListBoxItem(client->fonts->values[i]->fixed_title));
138         }
140 // Sort font list
141         int done = 0;
142         while(!done)
143         {
144                 done = 1;
145                 for(int i = 0; i < fonts.total - 1; i++)
146                 {
147                         if(strcmp(fonts.values[i]->get_text(), fonts.values[i + 1]->get_text()) > 0)
148                         {
149                                 BC_ListBoxItem *temp = fonts.values[i + 1];
150                                 fonts.values[i + 1] = fonts.values[i];
151                                 fonts.values[i] = temp;
152                                 done = 0;
153                         }
154                 }
155         }       
168         add_tool(font_title = new BC_Title(x, y, _("Font:")));
169         font = new TitleFont(client, this, x, y + 20);
170         font->create_objects();
171         x += 230;
172         add_subwindow(font_tumbler = new TitleFontTumble(client, this, x, y + 20));
173         x += 30;
174         char string[BCTEXTLEN];
175         add_tool(size_title = new BC_Title(x, y, _("Size:")));
176         sprintf(string, "%d", client->config.size);
177         size = new TitleSize(client, this, x, y + 20, string);
178         size->create_objects();
179         x += 140;
181         add_tool(style_title = new BC_Title(x, y, _("Style:")));
182         add_tool(italic = new TitleItalic(client, this, x, y + 20));
183         add_tool(bold = new TitleBold(client, this, x, y + 50));
184 #ifdef USE_OUTLINE
185         add_tool(stroke = new TitleStroke(client, this, x, y + 80));
186 #endif
187         x += 90;
188         add_tool(justify_title = new BC_Title(x, y, _("Justify:")));
189         add_tool(left = new TitleLeft(client, this, x, y + 20));
190         add_tool(center = new TitleCenter(client, this, x, y + 50));
191         add_tool(right = new TitleRight(client, this, x, y + 80));
193         x += 80;
194         add_tool(top = new TitleTop(client, this, x, y + 20));
195         add_tool(mid = new TitleMid(client, this, x, y + 50));
196         add_tool(bottom= new TitleBottom(client, this, x, y + 80));
197         
200         y += 50;
201         x = 10;
203         add_tool(x_title = new BC_Title(x, y, _("X:")));
204         title_x = new TitleX(client, this, x, y + 20);
205         title_x->create_objects();
206         x += 90;
208         add_tool(y_title = new BC_Title(x, y, _("Y:")));
209         title_y = new TitleY(client, this, x, y + 20);
210         title_y->create_objects();
211         x += 90;
213         add_tool(motion_title = new BC_Title(x, y, _("Motion type:")));
215         motion = new TitleMotion(client, this, x, y + 20);
216         motion->create_objects();
217         x += 150;
218         
219         add_tool(loop = new TitleLoop(client, x, y + 20));
220         x += 100;
221         
222         x = 10;
223         y += 50;
225         add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
226         dropshadow = new TitleDropShadow(client, this, x, y + 20);
227         dropshadow->create_objects();
228         x += 100;
230         add_tool(fadein_title = new BC_Title(x, y, _("Fade in (sec):")));
231         add_tool(fade_in = new TitleFade(client, this, &client->config.fade_in, x, y + 20));
232         x += 100;
234         add_tool(fadeout_title = new BC_Title(x, y, _("Fade out (sec):")));
235         add_tool(fade_out = new TitleFade(client, this, &client->config.fade_out, x, y + 20));
236         x += 110;
238         add_tool(speed_title = new BC_Title(x, y, _("Speed:")));
239         speed = new TitleSpeed(client, this, x, y + 20);
240         speed->create_objects();
241         x += 110;
243         add_tool(color_button = new TitleColorButton(client, this, x, y + 20));
244         x += color_button->get_w();
245         color_x = x;
246         color_y = y + 20;
247         color_thread = new TitleColorThread(client, this);
249         x = 10;
250         y += 50;
251         add_tool(encoding_title = new BC_Title(x, y + 3, _("Encoding:")));
252         encoding = new TitleEncoding(client, this, x, y + 20);
253         encoding->create_objects();
255 #ifdef USE_OUTLINE
256         x += 160;
257         add_tool(strokewidth_title = new BC_Title(x, y, _("Outline width:")));
258         stroke_width = new TitleStrokeW(client, 
259                 this, 
260                 x, 
261                 y + 20);
262         stroke_width->create_objects();
264         x += 210;
265         add_tool(color_stroke_button = new TitleColorStrokeButton(client, 
266                 this, 
267                 x, 
268                 y + 20));
269         color_stroke_x = color_x;
270         color_stroke_y = y + 20;
271         color_stroke_thread = new TitleColorStrokeThread(client, this);
272 #endif
275         x = 10;
276         y += 50;
278         add_tool(text_title = new BC_Title(x, y + 3, _("Text:")));
280         x += 100;
281         add_tool(timecode = new TitleTimecode(client, x, y));
284         x += timecode->get_w() + 5;
285         BC_SubWindow *thisw;
286         add_tool(thisw = new BC_Title(x, y+4, _("Format:")));
287         x += thisw->get_w() + 5;
288         timecodeformat = new TitleTimecodeFormat(client, this, x, y);
289         timecodeformat->create_objects();
291         x = 10;
292         y += 30;
293         text = new TitleText(client, 
294                 this, 
295                 x, 
296                 y, 
297                 get_w() - x - 10, 
298                 get_h() - y - 20 - 10);
299         text->create_objects();
301         update_color();
303         show_window();
304         flush();
305         return 0;
308 int TitleWindow::resize_event(int w, int h)
310         client->window_w = w;
311         client->window_h = h;
313         clear_box(0, 0, w, h);
314         font_title->reposition_window(font_title->get_x(), font_title->get_y());
315         font->reposition_window(font->get_x(), font->get_y());
316         font_tumbler->reposition_window(font_tumbler->get_x(), font_tumbler->get_y());
317         x_title->reposition_window(x_title->get_x(), x_title->get_y());
318         title_x->reposition_window(title_x->get_x(), title_x->get_y());
319         y_title->reposition_window(y_title->get_x(), y_title->get_y());
320         title_y->reposition_window(title_y->get_x(), title_y->get_y());
321         style_title->reposition_window(style_title->get_x(), style_title->get_y());
322         italic->reposition_window(italic->get_x(), italic->get_y());
323         bold->reposition_window(bold->get_x(), bold->get_y());
324 #ifdef USE_OUTLINE
325         stroke->reposition_window(stroke->get_x(), stroke->get_y());
326 #endif
327         size_title->reposition_window(size_title->get_x(), size_title->get_y());
328         size->reposition_window(size->get_x(), size->get_y());
329         encoding_title->reposition_window(encoding_title->get_x(), encoding_title->get_y());
330         encoding->reposition_window(encoding->get_x(), encoding->get_y());
331         color_button->reposition_window(color_button->get_x(), color_button->get_y());
332 #ifdef USE_OUTLINE
333         color_stroke_button->reposition_window(color_stroke_button->get_x(), color_stroke_button->get_y());
334 #endif
335         motion_title->reposition_window(motion_title->get_x(), motion_title->get_y());
336         motion->reposition_window(motion->get_x(), motion->get_y());
337         loop->reposition_window(loop->get_x(), loop->get_y());
338         dropshadow_title->reposition_window(dropshadow_title->get_x(), dropshadow_title->get_y());
339         dropshadow->reposition_window(dropshadow->get_x(), dropshadow->get_y());
340         fadein_title->reposition_window(fadein_title->get_x(), fadein_title->get_y());
341         fade_in->reposition_window(fade_in->get_x(), fade_in->get_y());
342         fadeout_title->reposition_window(fadeout_title->get_x(), fadeout_title->get_y());
343         fade_out->reposition_window(fade_out->get_x(), fade_out->get_y());
344         text_title->reposition_window(text_title->get_x(), text_title->get_y());
345 #ifdef USE_OUTLINE
346         stroke_width->reposition_window(stroke_width->get_x(), stroke_width->get_y());
347         strokewidth_title->reposition_window(strokewidth_title->get_x(), strokewidth_title->get_y());
348 #endif
349         timecode->reposition_window(timecode->get_x(), timecode->get_y());
351         text->reposition_window(text->get_x(), 
352                 text->get_y(), 
353                 w - text->get_x() - 10,
354                 BC_TextBox::pixels_to_rows(this, MEDIUMFONT, h - text->get_y() - 10));
358         justify_title->reposition_window(justify_title->get_x(), justify_title->get_y());
359         left->reposition_window(left->get_x(), left->get_y());
360         center->reposition_window(center->get_x(), center->get_y());
361         right->reposition_window(right->get_x(), right->get_y());
362         top->reposition_window(top->get_x(), top->get_y());
363         mid->reposition_window(mid->get_x(), mid->get_y());
364         bottom->reposition_window(bottom->get_x(), bottom->get_y());
365         speed_title->reposition_window(speed_title->get_x(), speed_title->get_y());
366         speed->reposition_window(speed->get_x(), speed->get_y());
367         update_color();
368         flash();
370         return 1;
374 void TitleWindow::previous_font()
376         int current_font = font->get_number();
377         current_font--;
378         if(current_font < 0) current_font = fonts.total - 1;
380         if(current_font < 0 || current_font >= fonts.total) return;
382         for(int i = 0; i < fonts.total; i++)
383         {
384                 fonts.values[i]->set_selected(i == current_font);
385         }
387         font->update(fonts.values[current_font]->get_text());
388         strcpy(client->config.font, fonts.values[current_font]->get_text());
389         client->send_configure_change();
392 void  TitleWindow::next_font()
394         int current_font = font->get_number();
395         current_font++;
396         if(current_font >= fonts.total) current_font = 0;
398         if(current_font < 0 || current_font >= fonts.total) return;
400         for(int i = 0; i < fonts.total; i++)
401         {
402                 fonts.values[i]->set_selected(i == current_font);
403         }
405         font->update(fonts.values[current_font]->get_text());
406         strcpy(client->config.font, fonts.values[current_font]->get_text());
407         client->send_configure_change();
411 int TitleWindow::close_event()
413 // Set result to 1 to indicate a client side close
414         set_done(1);
415         return 1;
418 void TitleWindow::update_color()
420 //printf("TitleWindow::update_color %x\n", client->config.color);
421         set_color(client->config.color);
422         draw_box(color_x, color_y, 100, 30);
423         flash(color_x, color_y, 100, 30);
424 #ifdef USE_OUTLINE
425         set_color(client->config.color_stroke);
426         draw_box(color_stroke_x, color_stroke_y, 100, 30);
427         flash(color_stroke_x, color_stroke_y, 100, 30);
428 #endif
431 void TitleWindow::update_justification()
433         left->update(client->config.hjustification == JUSTIFY_LEFT);
434         center->update(client->config.hjustification == JUSTIFY_CENTER);
435         right->update(client->config.hjustification == JUSTIFY_RIGHT);
436         top->update(client->config.vjustification == JUSTIFY_TOP);
437         mid->update(client->config.vjustification == JUSTIFY_MID);
438         bottom->update(client->config.vjustification == JUSTIFY_BOTTOM);
441 void TitleWindow::update()
443         title_x->update((int64_t)client->config.x);
444         title_y->update((int64_t)client->config.y);
445         italic->update(client->config.style & FONT_ITALIC);
446         bold->update(client->config.style & FONT_BOLD);
447 #ifdef USE_OUTLINE
448         stroke->update(client->config.style & FONT_OUTLINE);
449 #endif
450         size->update(client->config.size);
451         encoding->update(client->config.encoding);
452         timecodeformat->update(client->config.timecodeformat);
453         motion->update(TitleMain::motion_to_text(client->config.motion_strategy));
454         loop->update(client->config.loop);
455         dropshadow->update((float)client->config.dropshadow);
456         fade_in->update((float)client->config.fade_in);
457         fade_out->update((float)client->config.fade_out);
458 #ifdef USE_OUTLINE
459         stroke_width->update((float)client->config.stroke_width);
460 #endif
461         font->update(client->config.font);
462         text->update(client->config.text);
463         speed->update(client->config.pixels_per_second);
464         update_justification();
465         update_color();
469 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
470  : BC_Tumbler(x, y)
472         this->client = client;
473         this->window = window;
475 int TitleFontTumble::handle_up_event()
477         window->previous_font();
478         return 1;
481 int TitleFontTumble::handle_down_event()
483         window->next_font();
484         return 1;
487 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
488  : BC_CheckBox(x, y, client->config.style & FONT_BOLD, _("Bold"))
490         this->client = client;
491         this->window = window;
494 int TitleBold::handle_event()
496         client->config.style = (client->config.style & ~FONT_BOLD) | (get_value() ? FONT_BOLD : 0);
497         client->send_configure_change();
498         return 1;
501 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
502  : BC_CheckBox(x, y, client->config.style & FONT_ITALIC, _("Italic"))
504         this->client = client;
505         this->window = window;
507 int TitleItalic::handle_event()
509         client->config.style = (client->config.style & ~FONT_ITALIC) | (get_value() ? FONT_ITALIC : 0);
510         client->send_configure_change();
511         return 1;
514 TitleStroke::TitleStroke(TitleMain *client, TitleWindow *window, int x, int y)
515  : BC_CheckBox(x, y, client->config.style & FONT_OUTLINE, _("Outline"))
517         this->client = client;
518         this->window = window;
521 int TitleStroke::handle_event()
523         client->config.style = 
524                 (client->config.style & ~FONT_OUTLINE) | 
525                 (get_value() ? FONT_OUTLINE : 0);
526         client->send_configure_change();
527         return 1;
532 TitleSize::TitleSize(TitleMain *client, TitleWindow *window, int x, int y, char *text)
533  : BC_PopupTextBox(window, 
534                 &window->sizes,
535                 text,
536                 x, 
537                 y, 
538                 100,
539                 300)
541         this->client = client;
542         this->window = window;
544 TitleSize::~TitleSize()
547 int TitleSize::handle_event()
549         client->config.size = atol(get_text());
550 //printf("TitleSize::handle_event 1 %s\n", get_text());
551         client->send_configure_change();
552         return 1;
554 void TitleSize::update(int size)
556         char string[BCTEXTLEN];
557         sprintf(string, "%d", size);
558         BC_PopupTextBox::update(string);
560 TitleEncoding::TitleEncoding(TitleMain *client, TitleWindow *window, int x, int y)
561  : BC_PopupTextBox(window, 
562                 &window->encodings,
563                 client->config.encoding,
564                 x, 
565                 y, 
566                 100,
567                 300)
569         this->client = client;
570         this->window = window;
573 TitleEncoding::~TitleEncoding()
576 int TitleEncoding::handle_event()
578         strcpy(client->config.encoding, get_text());
579         client->send_configure_change();
580         return 1;
583 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
584  : BC_GenericButton(x, y, _("Color..."))
586         this->client = client;
587         this->window = window;
589 int TitleColorButton::handle_event()
591         window->color_thread->start_window(client->config.color, 0);
592         return 1;
595 TitleColorStrokeButton::TitleColorStrokeButton(TitleMain *client, TitleWindow *window, int x, int y)
596  : BC_GenericButton(x, y, _("Outline color..."))
598         this->client = client;
599         this->window = window;
601 int TitleColorStrokeButton::handle_event()
603 #ifdef USE_OUTLINE
604         window->color_stroke_thread->start_window(client->config.color_stroke, 0);
605 #endif
606         return 1;
609 TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
610  : BC_PopupTextBox(window, 
611                 &window->paths,
612                 client->motion_to_text(client->config.motion_strategy),
613                 x, 
614                 y, 
615                 120,
616                 100)
618         this->client = client;
619         this->window = window;
621 int TitleMotion::handle_event()
623         client->config.motion_strategy = client->text_to_motion(get_text());
624         client->send_configure_change();
625         return 1;
628 TitleLoop::TitleLoop(TitleMain *client, int x, int y)
629  : BC_CheckBox(x, y, client->config.loop, _("Loop"))
631         this->client = client;
633 int TitleLoop::handle_event()
635         client->config.loop = get_value();
636         client->send_configure_change();
637         return 1;
640 TitleTimecode::TitleTimecode(TitleMain *client, int x, int y)
641  : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
643         this->client = client;
645 int TitleTimecode::handle_event()
647         client->config.timecode = get_value();
648         client->send_configure_change();
649         return 1;
652 TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window, int x, int y)
653  : BC_PopupTextBox(window, 
654                 &window->timecodeformats,
655                 client->config.timecodeformat,
656                 x, 
657                 y, 
658                 140,
659                 160)
661         this->client = client;
662         this->window = window;
665 TitleTimecodeFormat::~TitleTimecodeFormat()
668 int TitleTimecodeFormat::handle_event()
670         strcpy(client->config.timecodeformat, get_text());
671         client->send_configure_change();
672         return 1;
675 TitleFade::TitleFade(TitleMain *client, 
676         TitleWindow *window, 
677         double *value, 
678         int x, 
679         int y)
680  : BC_TextBox(x, y, 90, 1, (float)*value)
682         this->client = client;
683         this->window = window;
684         this->value = value;
687 int TitleFade::handle_event()
689         *value = atof(get_text());
690         client->send_configure_change();
691         return 1;
694 TitleFont::TitleFont(TitleMain *client, TitleWindow *window, int x, int y)
695  : BC_PopupTextBox(window, 
696                 &window->fonts,
697                 client->config.font,
698                 x, 
699                 y, 
700                 200,
701                 500)
703         this->client = client;
704         this->window = window;
706 int TitleFont::handle_event()
708         strcpy(client->config.font, get_text());
709         client->send_configure_change();
710         return 1;
713 TitleText::TitleText(TitleMain *client, 
714         TitleWindow *window, 
715         int x, 
716         int y, 
717         int w, 
718         int h)
719  : BC_ScrollTextBox(window, 
720                 x, 
721                 y, 
722                 w,
723                 BC_TextBox::pixels_to_rows(window, MEDIUMFONT, h),
724                 client->config.text)
726         this->client = client;
727         this->window = window;
728 //printf("TitleText::TitleText %s\n", client->config.text);
731 int TitleText::handle_event()
733         strcpy(client->config.text, get_text());
734         client->send_configure_change();
735         return 1;
739 TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
740  : BC_TumbleTextBox(window,
741         (int64_t)client->config.dropshadow,
742         (int64_t)0,
743         (int64_t)1000,
744         x, 
745         y, 
746         70)
748         this->client = client;
749         this->window = window;
751 int TitleDropShadow::handle_event()
753         client->config.dropshadow = atol(get_text());
754         client->send_configure_change();
755         return 1;
759 TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
760  : BC_TumbleTextBox(window,
761         (int64_t)client->config.x,
762         (int64_t)-2048,
763         (int64_t)2048,
764         x, 
765         y, 
766         60)
768         this->client = client;
769         this->window = window;
771 int TitleX::handle_event()
773         client->config.x = atol(get_text());
774         client->send_configure_change();
775         return 1;
778 TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
779  : BC_TumbleTextBox(window,
780         (int64_t)client->config.y, 
781         (int64_t)-2048,
782         (int64_t)2048,
783         x, 
784         y, 
785         60)
787         this->client = client;
788         this->window = window;
790 int TitleY::handle_event()
792         client->config.y = atol(get_text());
793         client->send_configure_change();
794         return 1;
797 TitleStrokeW::TitleStrokeW(TitleMain *client, 
798         TitleWindow *window, 
799         int x, 
800         int y)
801  : BC_TumbleTextBox(window,
802         (float)client->config.stroke_width,
803         (float)-2048,
804         (float)2048,
805         x, 
806         y, 
807         60)
809         this->client = client;
810         this->window = window;
812 int TitleStrokeW::handle_event()
814         client->config.stroke_width = atof(get_text());
815         client->send_configure_change();
816         return 1;
820 TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
821  : BC_TumbleTextBox(window,
822         (float)client->config.pixels_per_second, 
823         (float)0,
824         (float)1000,
825         x, 
826         y, 
827         70)
829         this->client = client;
833 int TitleSpeed::handle_event()
835         client->config.pixels_per_second = atof(get_text());
836         client->send_configure_change();
837         return 1;
846 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
847  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
849         this->client = client;
850         this->window = window;
852 int TitleLeft::handle_event()
854         client->config.hjustification = JUSTIFY_LEFT;
855         window->update_justification();
856         client->send_configure_change();
857         return 1;
860 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
861  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
863         this->client = client;
864         this->window = window;
866 int TitleCenter::handle_event()
868         client->config.hjustification = JUSTIFY_CENTER;
869         window->update_justification();
870         client->send_configure_change();
871         return 1;
874 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
875  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
877         this->client = client;
878         this->window = window;
880 int TitleRight::handle_event()
882         client->config.hjustification = JUSTIFY_RIGHT;
883         window->update_justification();
884         client->send_configure_change();
885         return 1;
890 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
891  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
893         this->client = client;
894         this->window = window;
896 int TitleTop::handle_event()
898         client->config.vjustification = JUSTIFY_TOP;
899         window->update_justification();
900         client->send_configure_change();
901         return 1;
904 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
905  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
907         this->client = client;
908         this->window = window;
910 int TitleMid::handle_event()
912         client->config.vjustification = JUSTIFY_MID;
913         window->update_justification();
914         client->send_configure_change();
915         return 1;
918 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
919  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
921         this->client = client;
922         this->window = window;
924 int TitleBottom::handle_event()
926         client->config.vjustification = JUSTIFY_BOTTOM;
927         window->update_justification();
928         client->send_configure_change();
929         return 1;
934 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window)
935  : ColorThread()
937         this->client = client;
938         this->window = window;
941 int TitleColorThread::handle_new_color(int output, int /*alpha*/)
943         client->config.color = output;
944         window->update_color();
945         window->flush();
946         client->send_configure_change();
947         return 1;
949 TitleColorStrokeThread::TitleColorStrokeThread(TitleMain *client, TitleWindow *window)
950  : ColorThread()
952         this->client = client;
953         this->window = window;
956 int TitleColorStrokeThread::handle_event(int output)
958         client->config.color_stroke = output;
959         window->update_color();
960         window->flush();
961         client->send_configure_change();
962         return 1;