r550: References to a shared plugin that is moved up or down must be updated.
[cinelerra_cv.git] / plugins / titler / titlewindow.C
blobe610da04a2c2b47aa861a20a9b2307cc57a8bcb7
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         delete color_thread;
49 #ifdef USE_OUTLINE
50         delete color_stroke_thread;
51 #endif
52         delete title_x;
53         delete title_y;
56 int TitleWindow::create_objects()
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"));
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"));
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)));
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                 }
125                 if(!exists) fonts.append(new 
126                         BC_ListBoxItem(client->fonts->values[i]->fixed_title));
127         }
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         }       
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;
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));
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         
189         y += 50;
190         x = 10;
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;
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;
202         add_tool(motion_title = new BC_Title(x, y, _("Motion type:")));
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;
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;
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;
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;
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;
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);
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();
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();
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
264         x = 10;
265         y += 50;
267         add_tool(text_title = new BC_Title(x, y + 3, _("Text:")));
269         x += 100;
270         add_tool(timecode = new TitleTimecode(client, x, y));
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();
284         update_color();
286         show_window();
287         flush();
288         return 0;
291 int TitleWindow::resize_event(int w, int h)
293         client->window_w = w;
294         client->window_h = h;
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());
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));
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();
353         return 1;
357 void TitleWindow::previous_font()
359         int current_font = font->get_number();
360         current_font--;
361         if(current_font < 0) current_font = fonts.total - 1;
363         if(current_font < 0 || current_font >= fonts.total) return;
365         for(int i = 0; i < fonts.total; i++)
366         {
367                 fonts.values[i]->set_selected(i == current_font);
368         }
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();
375 void  TitleWindow::next_font()
377         int current_font = font->get_number();
378         current_font++;
379         if(current_font >= fonts.total) current_font = 0;
381         if(current_font < 0 || current_font >= fonts.total) return;
383         for(int i = 0; i < fonts.total; i++)
384         {
385                 fonts.values[i]->set_selected(i == current_font);
386         }
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();
394 int TitleWindow::close_event()
396 // Set result to 1 to indicate a client side close
397         set_done(1);
398         return 1;
401 void TitleWindow::update_color()
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
414 void TitleWindow::update_justification()
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);
424 void TitleWindow::update()
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();
451 TitleFontTumble::TitleFontTumble(TitleMain *client, TitleWindow *window, int x, int y)
452  : BC_Tumbler(x, y)
454         this->client = client;
455         this->window = window;
457 int TitleFontTumble::handle_up_event()
459         window->previous_font();
460         return 1;
463 int TitleFontTumble::handle_down_event()
465         window->next_font();
466         return 1;
469 TitleBold::TitleBold(TitleMain *client, TitleWindow *window, int x, int y)
470  : BC_CheckBox(x, y, client->config.style & FONT_BOLD, _("Bold"))
472         this->client = client;
473         this->window = window;
476 int TitleBold::handle_event()
478         client->config.style = (client->config.style & ~FONT_BOLD) | (get_value() ? FONT_BOLD : 0);
479         client->send_configure_change();
480         return 1;
483 TitleItalic::TitleItalic(TitleMain *client, TitleWindow *window, int x, int y)
484  : BC_CheckBox(x, y, client->config.style & FONT_ITALIC, _("Italic"))
486         this->client = client;
487         this->window = window;
489 int TitleItalic::handle_event()
491         client->config.style = (client->config.style & ~FONT_ITALIC) | (get_value() ? FONT_ITALIC : 0);
492         client->send_configure_change();
493         return 1;
496 TitleStroke::TitleStroke(TitleMain *client, TitleWindow *window, int x, int y)
497  : BC_CheckBox(x, y, client->config.style & FONT_OUTLINE, _("Outline"))
499         this->client = client;
500         this->window = window;
503 int TitleStroke::handle_event()
505         client->config.style = 
506                 (client->config.style & ~FONT_OUTLINE) | 
507                 (get_value() ? FONT_OUTLINE : 0);
508         client->send_configure_change();
509         return 1;
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)
523         this->client = client;
524         this->window = window;
526 TitleSize::~TitleSize()
529 int TitleSize::handle_event()
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;
536 void TitleSize::update(int size)
538         char string[BCTEXTLEN];
539         sprintf(string, "%d", size);
540         BC_PopupTextBox::update(string);
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)
551         this->client = client;
552         this->window = window;
555 TitleEncoding::~TitleEncoding()
558 int TitleEncoding::handle_event()
560         strcpy(client->config.encoding, get_text());
561         client->send_configure_change();
562         return 1;
565 TitleColorButton::TitleColorButton(TitleMain *client, TitleWindow *window, int x, int y)
566  : BC_GenericButton(x, y, _("Color..."))
568         this->client = client;
569         this->window = window;
571 int TitleColorButton::handle_event()
573         window->color_thread->start_window(client->config.color, 0);
574         return 1;
577 TitleColorStrokeButton::TitleColorStrokeButton(TitleMain *client, TitleWindow *window, int x, int y)
578  : BC_GenericButton(x, y, _("Outline color..."))
580         this->client = client;
581         this->window = window;
583 int TitleColorStrokeButton::handle_event()
585 #ifdef USE_OUTLINE
586         window->color_stroke_thread->start_window(client->config.color_stroke, 0);
587 #endif
588         return 1;
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)
600         this->client = client;
601         this->window = window;
603 int TitleMotion::handle_event()
605         client->config.motion_strategy = client->text_to_motion(get_text());
606         client->send_configure_change();
607         return 1;
610 TitleLoop::TitleLoop(TitleMain *client, int x, int y)
611  : BC_CheckBox(x, y, client->config.loop, _("Loop"))
613         this->client = client;
615 int TitleLoop::handle_event()
617         client->config.loop = get_value();
618         client->send_configure_change();
619         return 1;
622 TitleTimecode::TitleTimecode(TitleMain *client, int x, int y)
623  : BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
625         this->client = client;
627 int TitleTimecode::handle_event()
629         client->config.timecode = get_value();
630         client->send_configure_change();
631         return 1;
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)
641         this->client = client;
642         this->window = window;
643         this->value = value;
646 int TitleFade::handle_event()
648         *value = atof(get_text());
649         client->send_configure_change();
650         return 1;
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)
662         this->client = client;
663         this->window = window;
665 int TitleFont::handle_event()
667         strcpy(client->config.font, get_text());
668         client->send_configure_change();
669         return 1;
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)
685         this->client = client;
686         this->window = window;
687 //printf("TitleText::TitleText %s\n", client->config.text);
690 int TitleText::handle_event()
692         strcpy(client->config.text, get_text());
693         client->send_configure_change();
694         return 1;
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)
707         this->client = client;
708         this->window = window;
710 int TitleDropShadow::handle_event()
712         client->config.dropshadow = atol(get_text());
713         client->send_configure_change();
714         return 1;
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)
727         this->client = client;
728         this->window = window;
730 int TitleX::handle_event()
732         client->config.x = atol(get_text());
733         client->send_configure_change();
734         return 1;
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)
746         this->client = client;
747         this->window = window;
749 int TitleY::handle_event()
751         client->config.y = atol(get_text());
752         client->send_configure_change();
753         return 1;
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)
768         this->client = client;
769         this->window = window;
771 int TitleStrokeW::handle_event()
773         client->config.stroke_width = atof(get_text());
774         client->send_configure_change();
775         return 1;
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)
788         this->client = client;
792 int TitleSpeed::handle_event()
794         client->config.pixels_per_second = atof(get_text());
795         client->send_configure_change();
796         return 1;
805 TitleLeft::TitleLeft(TitleMain *client, TitleWindow *window, int x, int y)
806  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_LEFT, _("Left"))
808         this->client = client;
809         this->window = window;
811 int TitleLeft::handle_event()
813         client->config.hjustification = JUSTIFY_LEFT;
814         window->update_justification();
815         client->send_configure_change();
816         return 1;
819 TitleCenter::TitleCenter(TitleMain *client, TitleWindow *window, int x, int y)
820  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_CENTER, _("Center"))
822         this->client = client;
823         this->window = window;
825 int TitleCenter::handle_event()
827         client->config.hjustification = JUSTIFY_CENTER;
828         window->update_justification();
829         client->send_configure_change();
830         return 1;
833 TitleRight::TitleRight(TitleMain *client, TitleWindow *window, int x, int y)
834  : BC_Radial(x, y, client->config.hjustification == JUSTIFY_RIGHT, _("Right"))
836         this->client = client;
837         this->window = window;
839 int TitleRight::handle_event()
841         client->config.hjustification = JUSTIFY_RIGHT;
842         window->update_justification();
843         client->send_configure_change();
844         return 1;
849 TitleTop::TitleTop(TitleMain *client, TitleWindow *window, int x, int y)
850  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_TOP, _("Top"))
852         this->client = client;
853         this->window = window;
855 int TitleTop::handle_event()
857         client->config.vjustification = JUSTIFY_TOP;
858         window->update_justification();
859         client->send_configure_change();
860         return 1;
863 TitleMid::TitleMid(TitleMain *client, TitleWindow *window, int x, int y)
864  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_MID, _("Mid"))
866         this->client = client;
867         this->window = window;
869 int TitleMid::handle_event()
871         client->config.vjustification = JUSTIFY_MID;
872         window->update_justification();
873         client->send_configure_change();
874         return 1;
877 TitleBottom::TitleBottom(TitleMain *client, TitleWindow *window, int x, int y)
878  : BC_Radial(x, y, client->config.vjustification == JUSTIFY_BOTTOM, _("Bottom"))
880         this->client = client;
881         this->window = window;
883 int TitleBottom::handle_event()
885         client->config.vjustification = JUSTIFY_BOTTOM;
886         window->update_justification();
887         client->send_configure_change();
888         return 1;
893 TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window)
894  : ColorThread()
896         this->client = client;
897         this->window = window;
900 int TitleColorThread::handle_new_color(int output, int /*alpha*/)
902         client->config.color = output;
903         window->update_color();
904         window->flush();
905         client->send_configure_change();
906         return 1;
908 TitleColorStrokeThread::TitleColorStrokeThread(TitleMain *client, TitleWindow *window)
909  : ColorThread()
911         this->client = client;
912         this->window = window;
915 int TitleColorStrokeThread::handle_event(int output)
917         client->config.color_stroke = output;
918         window->update_color();
919         window->flush();
920         client->send_configure_change();
921         return 1;