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