Extract translatable strings from some more files
[synfig.git] / synfig-studio / trunk / src / gtkmm / widget_defaults.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file widget_defaults.cpp
3 **      \brief Template File
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === H E A D E R S ======================================================= */
24
25 #ifdef USING_PCH
26 #       include "pch.h"
27 #else
28 #ifdef HAVE_CONFIG_H
29 #       include <config.h>
30 #endif
31
32 #include "widget_defaults.h"
33 #include "widget_color.h"
34 #include "widget_gradient.h"
35 #include "dialog_color.h"
36 #include "dialog_gradient.h"
37 #include "app.h"
38 #include <gtkmm/menu.h>
39 #include <gtkmm/scale.h>
40 #include <synfig/exception.h>
41 #include <synfigapp/main.h>
42 #include "canvasview.h"
43 #include "widget_distance.h"
44 #include "widget_enum.h"
45
46 #include "general.h"
47
48 #endif
49
50 /* === U S I N G =========================================================== */
51
52 using namespace std;
53 using namespace etl;
54 using namespace synfig;
55 using namespace studio;
56
57 /* === M A C R O S ========================================================= */
58
59 #define GRADIENT_HEIGHT         16
60 #define DEFAULT_INCREMENT       (0.25)
61 #define DEFAULT_WIDTH           (synfig::Distance(3,synfig::Distance::SYSTEM_POINTS))
62
63 /* === G L O B A L S ======================================================= */
64
65 class studio::Widget_Brush : public Gtk::DrawingArea
66 {
67 public:
68         Widget_Brush()
69         {
70                 signal_expose_event().connect(sigc::mem_fun(*this, &studio::Widget_Brush::redraw));
71
72                 set_size_request(24,24);
73                 add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
74                 add_events(Gdk::BUTTON1_MOTION_MASK);
75
76                 synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
77                 synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
78                 synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw));
79                 studio::App::signal_instance_selected().connect(sigc::hide(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw)));
80         }
81
82         bool
83         redraw(GdkEventExpose */*bleh*/)
84         {
85                 Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(get_window()));
86
87                 const int h(get_height());
88                 const int w(get_width());
89
90                 float pixelsize(0);
91                 if(App::get_selected_canvas_view())
92                 {
93                         const RendDesc& rend_desc(App::get_selected_canvas_view()->get_canvas()->rend_desc());
94                         pixelsize=synfigapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc);
95                 }
96                 else
97                 {
98                         RendDesc rend_desc;
99                         pixelsize=synfigapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc);
100                 }
101                 // Fill in the background color
102                 render_color_to_window(get_window(),Gdk::Rectangle(0,0,w,h),synfigapp::Main::get_background_color());
103
104 /*
105                 gc->set_rgb_fg_color(colorconv_synfig2gdk(synfigapp::Main::get_background_color()));
106                 gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
107                 get_window()->draw_rectangle(
108                         gc,
109                         true,   // Fill?
110                         0,0,    // x,y
111                         w,h     //w,h
112                 );
113 */
114
115                 // Draw in the circle
116                 gc->set_rgb_fg_color(colorconv_synfig2gdk(synfigapp::Main::get_foreground_color()));
117                 gc->set_function(Gdk::COPY);
118                 gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
119                 get_window()->draw_arc(
120                         gc,
121                         true,
122                         round_to_int(((float)w/2.0f)-pixelsize/2.0f),
123                         round_to_int(((float)h/2.0f)-pixelsize/2.0f),
124                         round_to_int(pixelsize+0.6),
125                         round_to_int(pixelsize+0.6),
126                         0,
127                         360*64
128                 );
129
130                 return true;
131         }
132
133         bool
134         on_event(GdkEvent *event)
135         {
136 //              const int x(static_cast<int>(event->button.x));
137                 const int y(static_cast<int>(event->button.y));
138
139                 const int h(get_height());
140 //              const int w(get_width());
141
142                 switch(event->type)
143                 {
144                         case GDK_MOTION_NOTIFY:
145                                 break;
146                         case GDK_BUTTON_RELEASE:
147                                 if(event->button.button==1) // Left click
148                                 {
149                                         Distance dist(synfigapp::Main::get_bline_width());
150
151                                         if(y<h/2) // increase BLine size
152                                         {
153                                                 dist+=DEFAULT_INCREMENT;
154                                         }
155                                         else // Decrease BLine size
156                                         {
157                                                 dist-=DEFAULT_INCREMENT;
158                                         }
159                                         synfigapp::Main::set_bline_width(dist);
160                                         return true;
161                                 }
162                                 if(event->button.button==3)
163                                 {
164                                         // right click on bline width
165                                         synfigapp::Main::set_bline_width(DEFAULT_WIDTH);
166                                         return true;
167                                 }
168                                 break;
169                         case GDK_SCROLL:
170                                 {
171                                         Distance dist(synfigapp::Main::get_bline_width());
172
173                                         switch(event->scroll.direction){
174                                                 case GDK_SCROLL_UP:
175                                                 case GDK_SCROLL_RIGHT:
176                                                         dist+=DEFAULT_INCREMENT;
177                                                 break;
178                                                 case GDK_SCROLL_DOWN:
179                                                 case GDK_SCROLL_LEFT:
180                                                         dist-=DEFAULT_INCREMENT;
181                                                 break;
182                                         }
183                                         synfigapp::Main::set_bline_width(dist);
184                                         return true;
185                                 }
186                         default:
187                                 break;
188                 }
189
190                 return false;
191         }
192
193 };
194
195 /* === P R O C E D U R E S ================================================= */
196
197 /* === M E T H O D S ======================================================= */
198
199 Widget_Defaults::Widget_Defaults()
200 {
201         //set_size_request(48,48+GRADIENT_HEIGHT+16);
202         //set_size_request(48,-1);
203
204         {
205                 Gtk::Table* subtable(manage(new Gtk::Table()));
206
207                 // Foreground Color
208                 widget_fg_color=manage(new Widget_Color());
209                 widget_fg_color->show();
210                 widget_fg_color->set_size_request(16,16);
211                 widget_fg_color->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Defaults::on_fg_color_clicked));
212                 subtable->attach(*widget_fg_color, 0, 2, 0, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
213                 tooltips_.set_tip(*widget_fg_color,_("Foreground Color"));
214
215                 // Background Color
216                 widget_bg_color=manage(new Widget_Color());
217                 widget_bg_color->show();
218                 widget_bg_color->set_size_request(16,16);
219                 widget_bg_color->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Defaults::on_bg_color_clicked));
220                 subtable->attach(*widget_bg_color, 1, 3, 1, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
221                 tooltips_.set_tip(*widget_bg_color,_("Background Color"));
222
223                 Gtk::Image* icon;
224
225                 // Swap button
226                 Gtk::Button* button_swap(manage(new Gtk::Button()));
227                 button_swap->show();
228                 button_swap->set_relief(Gtk::RELIEF_NONE);
229                 button_swap->set_border_width(0);
230                 icon=manage(new Gtk::Image(Gtk::StockID("synfig-swap_colors"),Gtk::IconSize(1)));
231                 icon->show();
232                 button_swap->add(*icon);
233                 //button_swap->get_child()->set_size_request(16/3,16/3);
234                 //button_swap->set_size_request(16/3,16/3);
235                 dynamic_cast<Gtk::Misc*>(button_swap->get_child())->set_padding(0,0);
236                 button_swap->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Defaults::on_swap_color_clicked));
237                 subtable->attach(*button_swap, 2, 3, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
238                 tooltips_.set_tip(*button_swap,_("Swap Background and\nForeground Colors"));
239
240                 // Reset button
241                 Gtk::Button* button_reset(manage(new Gtk::Button()));
242                 button_reset->show();
243                 button_reset->set_relief(Gtk::RELIEF_NONE);
244                 button_reset->set_border_width(0);
245                 icon=manage(new Gtk::Image(Gtk::StockID("synfig-reset_colors"),Gtk::IconSize(1)));
246                 icon->show();
247                 button_reset->add(*icon);
248                 dynamic_cast<Gtk::Misc*>(button_reset->get_child())->set_padding(0,0);
249                 //button_reset->set_size_request(16/3,16/3);
250                 button_reset->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Defaults::on_reset_color_clicked));
251                 subtable->attach(*button_reset, 0,1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
252                 tooltips_.set_tip(*button_reset,_("Reset Colors to Black and White"));
253
254
255                 attach(*subtable, 0, 1, 0, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 1, 1);
256                 subtable->set_size_request(36,36);
257                 subtable->set_homogeneous(true);
258                 subtable->show();
259         }
260         widget_brush=manage(new Widget_Brush());
261         widget_brush->show();
262         widget_brush->set_size_request(36,36);
263         attach(*widget_brush,1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 1, 1);
264         tooltips_.set_tip(*widget_brush,_("Brush Preview"));
265
266         widget_bline_width=manage(new Widget_Distance());
267         widget_bline_width->show();
268         bline_width_refresh();
269         widget_bline_width->set_digits(2);
270         widget_bline_width->set_range(0,10000000);
271         widget_bline_width->set_size_request(24,-1);
272         widget_bline_width->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_bline_width_changed));
273         attach(*widget_bline_width,1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
274         tooltips_.set_tip(*widget_bline_width,_("Brush Size"));
275
276
277         widget_blend_method=manage(new Widget_Enum());
278         widget_blend_method->show();
279         widget_blend_method->signal_activate().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_blend_method_changed));
280         widget_blend_method->set_param_desc(ParamDesc(Color::BLEND_COMPOSITE,"blend_method"));
281         attach(*widget_blend_method,0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
282         tooltips_.set_tip(*widget_blend_method,_("Default Blend Method"));
283
284         widget_interpolation=manage(new Widget_Enum());
285         widget_interpolation->show();
286         widget_interpolation->signal_activate().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_interpolation_changed));
287         widget_interpolation->set_param_desc(
288                 ParamDesc("interpolation")
289                         .set_hint("enum")
290                         .add_enum_value(INTERPOLATION_TCB,"auto",_("_TCB"))
291                         .add_enum_value(INTERPOLATION_CONSTANT,"constant",_("_Constant"))
292                         .add_enum_value(INTERPOLATION_HALT,"ease",_("_Ease In/Out"))
293                         .add_enum_value(INTERPOLATION_LINEAR,"linear",_("_Linear"))
294         );
295         attach(*widget_interpolation,0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
296         tooltips_.set_tip(*widget_interpolation,_("Default Interpolation"));
297
298         widget_opacity=manage(new Gtk::HScale(0.0f,1.01f,0.01f));
299         widget_opacity->show();
300         widget_opacity->set_digits(2);
301         widget_opacity->set_value_pos(Gtk::POS_LEFT);
302         widget_opacity->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_opacity_changed));
303         attach(*widget_opacity,0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
304         tooltips_.set_tip(*widget_opacity,_("Default Opacity"));
305
306         widget_gradient=manage(new Widget_Gradient());
307         widget_gradient->show();
308         widget_gradient->set_size_request(-1,GRADIENT_HEIGHT);
309         widget_gradient->signal_clicked().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_gradient_clicked));
310         attach(*widget_gradient,0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
311         tooltips_.set_tip(*widget_gradient,_("Default Gradient"));
312
313
314         // Signals
315         synfigapp::Main::signal_opacity_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::opacity_refresh));
316         synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bline_width_refresh));
317         synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::fg_color_refresh));
318         synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bg_color_refresh));
319         synfigapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::gradient_refresh));
320         synfigapp::Main::signal_blend_method_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::blend_method_refresh));
321         synfigapp::Main::signal_interpolation_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::interpolation_refresh));
322
323         fg_color_refresh();
324         bg_color_refresh();
325         gradient_refresh();
326         blend_method_refresh();
327         opacity_refresh();
328         interpolation_refresh();
329 /*
330         set_size_request(48,48+GRADIENT_HEIGHT);
331         signal_expose_event().connect(sigc::mem_fun(*this, &studio::Widget_Defaults::redraw));
332         add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
333         add_events(Gdk::BUTTON1_MOTION_MASK);
334
335         synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
336         synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
337         synfigapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
338         synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
339
340         if(App::dialog_gradient)
341         {
342                 App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
343                 App::dialog_gradient->reset();
344                 App::dialog_gradient->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_gradient));
345         }
346
347         if(App::dialog_color)
348         {
349                 App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
350                 App::dialog_color->reset();
351                 App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_foreground_color));
352         }
353 */
354 }
355
356 Widget_Defaults::~Widget_Defaults()
357 {
358 }
359
360 void
361 Widget_Defaults::fg_color_refresh()
362 {
363         widget_fg_color->set_value(synfigapp::Main::get_foreground_color());
364 }
365
366 void
367 Widget_Defaults::bg_color_refresh()
368 {
369         widget_bg_color->set_value(synfigapp::Main::get_background_color());
370 }
371
372 void
373 Widget_Defaults::gradient_refresh()
374 {
375         widget_gradient->set_value(synfigapp::Main::get_gradient());
376 }
377
378 void
379 Widget_Defaults::bline_width_refresh()
380 {
381         widget_bline_width->set_value(synfigapp::Main::get_bline_width());
382 }
383
384 void
385 Widget_Defaults::blend_method_refresh()
386 {
387         widget_blend_method->set_value(synfigapp::Main::get_blend_method());
388 }
389
390 void
391 Widget_Defaults::interpolation_refresh()
392 {
393         widget_interpolation->set_value(synfigapp::Main::get_interpolation());
394 }
395
396 void
397 Widget_Defaults::opacity_refresh()
398 {
399         widget_opacity->set_value(synfigapp::Main::get_opacity());
400 }
401
402 void
403 Widget_Defaults::on_opacity_changed()
404 {
405         synfigapp::Main::set_opacity(widget_opacity->get_value());
406 }
407
408 void
409 Widget_Defaults::on_blend_method_changed()
410 {
411         synfigapp::Main::set_blend_method(Color::BlendMethod(widget_blend_method->get_value()));
412 }
413
414 void
415 Widget_Defaults::on_interpolation_changed()
416 {
417         synfigapp::Main::set_interpolation(Waypoint::Interpolation(widget_interpolation->get_value()));
418 }
419
420 void
421 Widget_Defaults::on_bline_width_changed()
422 {
423         synfigapp::Main::set_bline_width(widget_bline_width->get_value());
424 }
425
426 void
427 Widget_Defaults::on_fg_color_clicked()
428 {
429         // Left click on foreground
430         App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
431         App::dialog_color->reset();
432         App::dialog_color->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_foreground_color));
433         App::dialog_color->present();
434 }
435
436 void
437 Widget_Defaults::on_bg_color_clicked()
438 {
439         // Left click on background
440         App::dialog_color->set_color(synfigapp::Main::get_background_color());
441         App::dialog_color->reset();
442         App::dialog_color->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_background_color));
443         App::dialog_color->present();
444 }
445
446 void
447 Widget_Defaults::on_swap_color_clicked()
448 {
449         synfigapp::Main::color_swap();
450 }
451
452 void
453 Widget_Defaults::on_reset_color_clicked()
454 {
455         synfigapp::Main::set_background_color(Color::white());
456         synfigapp::Main::set_foreground_color(Color::black());
457 }
458
459 void
460 Widget_Defaults::on_gradient_clicked()
461 {
462         App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
463         App::dialog_gradient->reset();
464         App::dialog_gradient->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_gradient));
465         App::dialog_gradient->present();
466 }
467
468 /*
469 bool
470 Widget_Defaults::redraw(GdkEventExpose*bleh)
471 {
472         Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(get_window()));
473
474         const int h(get_height());
475         const int w(get_width());
476         const int size=std::min(h-GRADIENT_HEIGHT,w);
477
478         render_color_to_window(get_window(),Gdk::Rectangle(size/4,size/4,size/4*3-1,size/4*3-1),synfigapp::Main::get_background_color());
479         render_color_to_window(get_window(),Gdk::Rectangle(0,0,size/4*3-1,size/4*3-1),synfigapp::Main::get_foreground_color());
480         render_gradient_to_window(get_window(),Gdk::Rectangle(0,h-GRADIENT_HEIGHT,w,GRADIENT_HEIGHT-1),synfigapp::Main::get_gradient());
481
482
483
484
485
486         Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
487
488         gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
489         layout->set_text(synfigapp::Main::get_bline_width().get_string(2));
490         layout->set_alignment(Pango::ALIGN_CENTER);
491         layout->set_width(w/2);
492         get_window()->draw_layout(gc, w*3/4, (h-GRADIENT_HEIGHT)-16, layout);
493
494         return true;
495 }
496
497 bool
498 Widget_Defaults::on_event(GdkEvent *event)
499 {
500         const int x(static_cast<int>(event->button.x));
501         const int y(static_cast<int>(event->button.y));
502
503         const int h(get_height());
504         const int w(get_width());
505         const int size=std::min(h-GRADIENT_HEIGHT,w);
506
507         switch(event->type)
508         {
509         case GDK_MOTION_NOTIFY:
510                 break;
511         case GDK_BUTTON_PRESS:
512 //                      if(event->button.button==1 && y>get_height()-CONTROL_HEIGHT)
513                 break;
514         case GDK_BUTTON_RELEASE:
515                 if(event->button.button==1)
516                 {
517                         if(y>size)
518                         {
519                                 // Left click on gradient
520                                 App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
521                                 App::dialog_gradient->reset();
522                                 App::dialog_gradient->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_gradient));
523                                 App::dialog_gradient->present();
524                                 return true;
525                         }
526                         if(x>0 && x<=size)
527                         {
528                                 if(x<size*3/4 && y<size*3/4)
529                                 {
530                                         // Left click on foreground
531                                         App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
532                                         App::dialog_color->reset();
533                                         App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_foreground_color));
534                                         App::dialog_color->present();
535                                         return true;
536                                 }
537                                 if(x>size*3/4 && y>size/4)
538                                 {
539                                         // Left click on background
540                                         App::dialog_color->set_color(synfigapp::Main::get_background_color());
541                                         App::dialog_color->reset();
542                                         App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_background_color));
543                                         App::dialog_color->present();
544                                         return true;
545                                 }
546                         }
547                         if(x>size) // Left click on BLine Width
548                         {
549                                 Distance dist(synfigapp::Main::get_bline_width());
550
551                                 if(y<size/2) // increase BLine size
552                                 {
553                                         dist+=DEFAULT_INCREMENT;
554                                 }
555                                 else // Decrease BLine size
556                                 {
557                                         dist-=DEFAULT_INCREMENT;
558                                 }
559                                 synfigapp::Main::set_bline_width(dist);
560                         }
561                 }
562                 if(event->button.button==3)
563                 {
564                         if(y>size)
565                         {
566                                 // right click on gradient
567                                 synfigapp::Main::set_gradient_default_colors();
568                                 return true;
569                         }
570                         else
571                         {
572                                 if(x<size)
573                                 {
574                                         // right click on colors
575                                         synfigapp::Main::color_swap();
576                                         return true;
577                                 }
578
579                                 if(x>w/2)
580                                 {
581                                         // right click on bline width
582                                         synfigapp::Main::set_bline_width(DEFAULT_WIDTH);
583                                 }
584
585                         }
586                 }
587                 break;
588         case GDK_SCROLL:
589                 {
590                         Distance dist(synfigapp::Main::get_bline_width());
591
592                         if(event->scroll.direction==GDK_SCROLL_UP)
593                         {
594                                 dist+=DEFAULT_INCREMENT;
595                         }
596                         else if(event->scroll.direction==GDK_SCROLL_DOWN)
597                         {
598                                 dist-=DEFAULT_INCREMENT;
599                         }
600                         synfigapp::Main::set_bline_width(dist);
601                 }
602         default:
603                 break;
604         }
605
606         return false;
607 }
608 */