Get rid of all references to the bootstrap script since it was removed
[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("R")));
242                 button_reset->show();
243                 button_reset->set_relief(Gtk::RELIEF_NONE);
244                 button_reset->set_border_width(0);
245                 dynamic_cast<Gtk::Misc*>(button_reset->get_child())->set_padding(0,0);
246                 //button_reset->set_size_request(16/3,16/3);
247                 button_reset->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Defaults::on_reset_color_clicked));
248                 subtable->attach(*button_reset, 0,1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
249                 tooltips_.set_tip(*button_reset,_("Reset Colors to Black and White"));
250
251
252                 attach(*subtable, 0, 1, 0, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 1, 1);
253                 subtable->set_size_request(36,36);
254                 subtable->set_homogeneous(true);
255                 subtable->show();
256         }
257         widget_brush=manage(new Widget_Brush());
258         widget_brush->show();
259         widget_brush->set_size_request(36,36);
260         attach(*widget_brush,1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 1, 1);
261         tooltips_.set_tip(*widget_brush,_("Brush Preview"));
262
263         widget_bline_width=manage(new Widget_Distance());
264         widget_bline_width->show();
265         bline_width_refresh();
266         widget_bline_width->set_digits(2);
267         widget_bline_width->set_range(0,10000000);
268         widget_bline_width->set_size_request(24,-1);
269         widget_bline_width->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_bline_width_changed));
270         attach(*widget_bline_width,1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
271         tooltips_.set_tip(*widget_bline_width,_("Brush Size"));
272
273
274         widget_blend_method=manage(new Widget_Enum());
275         widget_blend_method->show();
276         widget_blend_method->signal_activate().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_blend_method_changed));
277         widget_blend_method->set_param_desc(ParamDesc(Color::BLEND_COMPOSITE,"blend_method"));
278         attach(*widget_blend_method,0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
279         tooltips_.set_tip(*widget_blend_method,_("Default Blend Method"));
280
281         widget_interpolation=manage(new Widget_Enum());
282         widget_interpolation->show();
283         widget_interpolation->signal_activate().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_interpolation_changed));
284         widget_interpolation->set_param_desc(
285                 ParamDesc("interpolation")
286                         .set_hint("enum")
287                         .add_enum_value(INTERPOLATION_TCB,"auto",_("TCB"))
288                         .add_enum_value(INTERPOLATION_CONSTANT,"constant",_("Constant"))
289                         .add_enum_value(INTERPOLATION_HALT,"ease",_("Ease in/out"))
290                         .add_enum_value(INTERPOLATION_LINEAR,"linear",_("Linear"))
291         );
292         attach(*widget_interpolation,0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
293         tooltips_.set_tip(*widget_interpolation,_("Default Interpolation"));
294
295         widget_opacity=manage(new Gtk::HScale(0.0f,1.01f,0.01f));
296         widget_opacity->show();
297         widget_opacity->set_digits(2);
298         widget_opacity->set_value_pos(Gtk::POS_LEFT);
299         widget_opacity->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_opacity_changed));
300         attach(*widget_opacity,0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
301         tooltips_.set_tip(*widget_opacity,_("Default Opacity"));
302
303         widget_gradient=manage(new Widget_Gradient());
304         widget_gradient->show();
305         widget_gradient->set_size_request(-1,GRADIENT_HEIGHT);
306         widget_gradient->signal_clicked().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_gradient_clicked));
307         attach(*widget_gradient,0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 1, 1);
308         tooltips_.set_tip(*widget_gradient,_("Default Gradient"));
309
310
311         // Signals
312         synfigapp::Main::signal_opacity_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::opacity_refresh));
313         synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bline_width_refresh));
314         synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::fg_color_refresh));
315         synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::bg_color_refresh));
316         synfigapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::gradient_refresh));
317         synfigapp::Main::signal_blend_method_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::blend_method_refresh));
318         synfigapp::Main::signal_interpolation_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::interpolation_refresh));
319
320         fg_color_refresh();
321         bg_color_refresh();
322         gradient_refresh();
323         blend_method_refresh();
324         opacity_refresh();
325         interpolation_refresh();
326 /*
327         set_size_request(48,48+GRADIENT_HEIGHT);
328         signal_expose_event().connect(sigc::mem_fun(*this, &studio::Widget_Defaults::redraw));
329         add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
330         add_events(Gdk::BUTTON1_MOTION_MASK);
331
332         synfigapp::Main::signal_foreground_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
333         synfigapp::Main::signal_background_color_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
334         synfigapp::Main::signal_gradient_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
335         synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::queue_draw));
336
337         if(App::dialog_gradient)
338         {
339                 App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
340                 App::dialog_gradient->reset();
341                 App::dialog_gradient->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_gradient));
342         }
343
344         if(App::dialog_color)
345         {
346                 App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
347                 App::dialog_color->reset();
348                 App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_foreground_color));
349         }
350 */
351 }
352
353 Widget_Defaults::~Widget_Defaults()
354 {
355 }
356
357 void
358 Widget_Defaults::fg_color_refresh()
359 {
360         widget_fg_color->set_value(synfigapp::Main::get_foreground_color());
361 }
362
363 void
364 Widget_Defaults::bg_color_refresh()
365 {
366         widget_bg_color->set_value(synfigapp::Main::get_background_color());
367 }
368
369 void
370 Widget_Defaults::gradient_refresh()
371 {
372         widget_gradient->set_value(synfigapp::Main::get_gradient());
373 }
374
375 void
376 Widget_Defaults::bline_width_refresh()
377 {
378         widget_bline_width->set_value(synfigapp::Main::get_bline_width());
379 }
380
381 void
382 Widget_Defaults::blend_method_refresh()
383 {
384         widget_blend_method->set_value(synfigapp::Main::get_blend_method());
385 }
386
387 void
388 Widget_Defaults::interpolation_refresh()
389 {
390         widget_interpolation->set_value(synfigapp::Main::get_interpolation());
391 }
392
393 void
394 Widget_Defaults::opacity_refresh()
395 {
396         widget_opacity->set_value(synfigapp::Main::get_opacity());
397 }
398
399 void
400 Widget_Defaults::on_opacity_changed()
401 {
402         synfigapp::Main::set_opacity(widget_opacity->get_value());
403 }
404
405 void
406 Widget_Defaults::on_blend_method_changed()
407 {
408         synfigapp::Main::set_blend_method(Color::BlendMethod(widget_blend_method->get_value()));
409 }
410
411 void
412 Widget_Defaults::on_interpolation_changed()
413 {
414         synfigapp::Main::set_interpolation(Waypoint::Interpolation(widget_interpolation->get_value()));
415 }
416
417 void
418 Widget_Defaults::on_bline_width_changed()
419 {
420         synfigapp::Main::set_bline_width(widget_bline_width->get_value());
421 }
422
423 void
424 Widget_Defaults::on_fg_color_clicked()
425 {
426         // Left click on foreground
427         App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
428         App::dialog_color->reset();
429         App::dialog_color->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_foreground_color));
430         App::dialog_color->present();
431 }
432
433 void
434 Widget_Defaults::on_bg_color_clicked()
435 {
436         // Left click on background
437         App::dialog_color->set_color(synfigapp::Main::get_background_color());
438         App::dialog_color->reset();
439         App::dialog_color->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_background_color));
440         App::dialog_color->present();
441 }
442
443 void
444 Widget_Defaults::on_swap_color_clicked()
445 {
446         synfigapp::Main::color_swap();
447 }
448
449 void
450 Widget_Defaults::on_reset_color_clicked()
451 {
452         synfigapp::Main::set_background_color(Color::white());
453         synfigapp::Main::set_foreground_color(Color::black());
454 }
455
456 void
457 Widget_Defaults::on_gradient_clicked()
458 {
459         App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
460         App::dialog_gradient->reset();
461         App::dialog_gradient->signal_edited().connect(sigc::ptr_fun(synfigapp::Main::set_gradient));
462         App::dialog_gradient->present();
463 }
464
465 /*
466 bool
467 Widget_Defaults::redraw(GdkEventExpose*bleh)
468 {
469         Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(get_window()));
470
471         const int h(get_height());
472         const int w(get_width());
473         const int size=std::min(h-GRADIENT_HEIGHT,w);
474
475         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());
476         render_color_to_window(get_window(),Gdk::Rectangle(0,0,size/4*3-1,size/4*3-1),synfigapp::Main::get_foreground_color());
477         render_gradient_to_window(get_window(),Gdk::Rectangle(0,h-GRADIENT_HEIGHT,w,GRADIENT_HEIGHT-1),synfigapp::Main::get_gradient());
478
479
480
481
482
483         Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
484
485         gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
486         layout->set_text(synfigapp::Main::get_bline_width().get_string(2));
487         layout->set_alignment(Pango::ALIGN_CENTER);
488         layout->set_width(w/2);
489         get_window()->draw_layout(gc, w*3/4, (h-GRADIENT_HEIGHT)-16, layout);
490
491         return true;
492 }
493
494 bool
495 Widget_Defaults::on_event(GdkEvent *event)
496 {
497         const int x(static_cast<int>(event->button.x));
498         const int y(static_cast<int>(event->button.y));
499
500         const int h(get_height());
501         const int w(get_width());
502         const int size=std::min(h-GRADIENT_HEIGHT,w);
503
504         switch(event->type)
505         {
506         case GDK_MOTION_NOTIFY:
507                 break;
508         case GDK_BUTTON_PRESS:
509 //                      if(event->button.button==1 && y>get_height()-CONTROL_HEIGHT)
510                 break;
511         case GDK_BUTTON_RELEASE:
512                 if(event->button.button==1)
513                 {
514                         if(y>size)
515                         {
516                                 // Left click on gradient
517                                 App::dialog_gradient->set_gradient(synfigapp::Main::get_gradient());
518                                 App::dialog_gradient->reset();
519                                 App::dialog_gradient->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_gradient));
520                                 App::dialog_gradient->present();
521                                 return true;
522                         }
523                         if(x>0 && x<=size)
524                         {
525                                 if(x<size*3/4 && y<size*3/4)
526                                 {
527                                         // Left click on foreground
528                                         App::dialog_color->set_color(synfigapp::Main::get_foreground_color());
529                                         App::dialog_color->reset();
530                                         App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_foreground_color));
531                                         App::dialog_color->present();
532                                         return true;
533                                 }
534                                 if(x>size*3/4 && y>size/4)
535                                 {
536                                         // Left click on background
537                                         App::dialog_color->set_color(synfigapp::Main::get_background_color());
538                                         App::dialog_color->reset();
539                                         App::dialog_color->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_background_color));
540                                         App::dialog_color->present();
541                                         return true;
542                                 }
543                         }
544                         if(x>size) // Left click on BLine Width
545                         {
546                                 Distance dist(synfigapp::Main::get_bline_width());
547
548                                 if(y<size/2) // increase BLine size
549                                 {
550                                         dist+=DEFAULT_INCREMENT;
551                                 }
552                                 else // Decrease BLine size
553                                 {
554                                         dist-=DEFAULT_INCREMENT;
555                                 }
556                                 synfigapp::Main::set_bline_width(dist);
557                         }
558                 }
559                 if(event->button.button==3)
560                 {
561                         if(y>size)
562                         {
563                                 // right click on gradient
564                                 synfigapp::Main::set_gradient_default_colors();
565                                 return true;
566                         }
567                         else
568                         {
569                                 if(x<size)
570                                 {
571                                         // right click on colors
572                                         synfigapp::Main::color_swap();
573                                         return true;
574                                 }
575
576                                 if(x>w/2)
577                                 {
578                                         // right click on bline width
579                                         synfigapp::Main::set_bline_width(DEFAULT_WIDTH);
580                                 }
581
582                         }
583                 }
584                 break;
585         case GDK_SCROLL:
586                 {
587                         Distance dist(synfigapp::Main::get_bline_width());
588
589                         if(event->scroll.direction==GDK_SCROLL_UP)
590                         {
591                                 dist+=DEFAULT_INCREMENT;
592                         }
593                         else if(event->scroll.direction==GDK_SCROLL_DOWN)
594                         {
595                                 dist-=DEFAULT_INCREMENT;
596                         }
597                         synfigapp::Main::set_bline_width(dist);
598                 }
599         default:
600                 break;
601         }
602
603         return false;
604 }
605 */