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