1 /* === S Y N F I G ========================================================= */
2 /*! \file dialog_setup.cpp
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2007, 2008 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
33 #include "dialog_setup.h"
35 #include <gtkmm/scale.h>
36 #include <gtkmm/table.h>
37 #include <gtkmm/frame.h>
38 #include <gtkmm/notebook.h>
39 #include <gtkmm/spinbutton.h>
40 #include "widget_enum.h"
41 #include "autorecover.h"
43 #include <ETL/stringf>
49 /* === U S I N G =========================================================== */
53 using namespace synfig;
54 using namespace studio;
56 /* === M A C R O S ========================================================= */
58 /* === G L O B A L S ======================================================= */
60 /* === P R O C E D U R E S ================================================= */
62 /* === M E T H O D S ======================================================= */
65 attach_label(Gtk::Table *table, String str, guint col, guint xpadding, guint ypadding)
67 Gtk::Label* label(manage(new Gtk::Label((str + ":").c_str())));
68 label->set_alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
69 table->attach(*label, 0, 1, col, col+1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
72 Dialog_Setup::Dialog_Setup():
73 Dialog(_("Synfig Studio Setup"),false,true),
74 adj_gamma_r(2.2,0.1,3.0,0.025,0.025,0.025),
75 adj_gamma_g(2.2,0.1,3.0,0.025,0.025,0.025),
76 adj_gamma_b(2.2,0.1,3.0,0.025,0.025,0.025),
77 adj_recent_files(15,1,50,1,1,1),
78 adj_undo_depth(100,10,5000,1,1,1),
79 toggle_use_colorspace_gamma(_("Visually Linear Color Selection")),
80 #ifdef SINGLE_THREADED
81 toggle_single_threaded(_("Use Only a Single Thread")),
83 toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant"))
87 Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
89 add_action_widget(*ok_button,2);
90 ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::on_ok_pressed));
92 Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
94 add_action_widget(*apply_button,1);
95 apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::on_apply_pressed));
97 Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
98 cancel_button->show();
99 add_action_widget(*cancel_button,0);
100 cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::hide));
104 Gtk::Notebook *notebook=manage(new class Gtk::Notebook());
105 get_vbox()->pack_start(*notebook);
109 Gtk::Table *gamma_table=manage(new Gtk::Table(2,2,false));
110 notebook->append_page(*gamma_table,_("Gamma"));
111 //gamma_frame->add(*gamma_table);
113 gamma_table->attach(gamma_pattern, 0, 2, 0, 1, Gtk::EXPAND, Gtk::SHRINK|Gtk::FILL, 0, 0);
115 Gtk::HScale* scale_gamma_r(manage(new Gtk::HScale(adj_gamma_r)));
116 gamma_table->attach(*manage(new Gtk::Label(_("Red"))), 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
117 gamma_table->attach(*scale_gamma_r, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
118 adj_gamma_r.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_r_change));
120 Gtk::HScale* scale_gamma_g(manage(new Gtk::HScale(adj_gamma_g)));
121 gamma_table->attach(*manage(new Gtk::Label(_("Green"))), 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
122 gamma_table->attach(*scale_gamma_g, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
123 adj_gamma_g.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_g_change));
125 Gtk::HScale* scale_gamma_b(manage(new Gtk::HScale(adj_gamma_b)));
126 gamma_table->attach(*manage(new Gtk::Label(_("Blue"))), 0, 1, 3, 4, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
127 gamma_table->attach(*scale_gamma_b, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
128 adj_gamma_b.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_b_change));
130 gamma_table->attach(*manage(new Gtk::Label(_("Black Level"))), 0, 1, 4, 5, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
131 gamma_table->attach(black_level_selector, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
132 black_level_selector.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_black_level_change));
134 //gamma_table->attach(*manage(new Gtk::Label(_("Red-Blue Level"))), 0, 1, 5, 6, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
135 //gamma_table->attach(red_blue_level_selector, 1, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
136 //red_blue_level_selector.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_red_blue_level_change));
140 Gtk::Table *misc_table=manage(new Gtk::Table(2,2,false));
141 notebook->append_page(*misc_table,_("Misc."));
143 int xpadding(8), ypadding(8);
146 timestamp_menu=manage(new class Gtk::Menu());
147 attach_label(misc_table, _("Timestamp"), 0, xpadding, ypadding);
148 misc_table->attach(timestamp_optionmenu, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
150 #define ADD_TIMESTAMP(desc,x) \
151 timestamp_menu->items().push_back( \
152 Gtk::Menu_Helpers::MenuElem( \
157 &studio::Dialog_Setup::set_time_format), \
159 ADD_TIMESTAMP("HH:MM:SS.FF", Time::FORMAT_VIDEO );
160 ADD_TIMESTAMP("(HHh MMm SSs) FFf", Time::FORMAT_NORMAL );
161 ADD_TIMESTAMP("(HHhMMmSSs)FFf", Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES );
162 ADD_TIMESTAMP("HHh MMm SSs FFf", Time::FORMAT_NORMAL | Time::FORMAT_FULL );
163 ADD_TIMESTAMP("HHhMMmSSsFFf", Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES | Time::FORMAT_FULL);
164 ADD_TIMESTAMP("FFf", Time::FORMAT_FRAMES );
166 timestamp_optionmenu.set_menu(*timestamp_menu);
171 ParamDesc param_desc;
174 .add_enum_value(Distance::SYSTEM_UNITS,"u",_("Units"))
175 .add_enum_value(Distance::SYSTEM_PIXELS,"px",_("Pixels"))
176 .add_enum_value(Distance::SYSTEM_POINTS,"pt",_("Points"))
177 .add_enum_value(Distance::SYSTEM_INCHES,"in",_("Inches"))
178 .add_enum_value(Distance::SYSTEM_METERS,"m",_("Meters"))
179 .add_enum_value(Distance::SYSTEM_CENTIMETERS,"cm",_("Centimeters"))
180 .add_enum_value(Distance::SYSTEM_MILLIMETERS,"mm",_("Millimeters"));
182 widget_enum=manage(new Widget_Enum());
183 widget_enum->set_param_desc(param_desc);
185 attach_label(misc_table, _("Unit System"), 1, xpadding, ypadding);
186 misc_table->attach(*widget_enum, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
189 // Misc - recent files
190 Gtk::SpinButton* recent_files_spinbutton(manage(new Gtk::SpinButton(adj_recent_files,1,0)));
191 attach_label(misc_table, _("Recent Files"), 2, xpadding, ypadding);
192 misc_table->attach(*recent_files_spinbutton, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
194 // Misc - use_colorspace_gamma
195 misc_table->attach(toggle_use_colorspace_gamma, 0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
197 #ifdef SINGLE_THREADED
198 // Misc - single_threaded
199 misc_table->attach(toggle_single_threaded, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
202 // Misc - auto backup interval
203 attach_label(misc_table, _("Auto Backup Interval (0 to disable)"), 3, xpadding, ypadding);
204 misc_table->attach(auto_backup_interval, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
206 // Misc - restrict_radius_ducks
207 misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
209 // Misc - browser_command
210 attach_label(misc_table, _("Browser Command"), 4, xpadding, ypadding);
211 misc_table->attach(textbox_browser_command, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
216 Dialog_Setup::~Dialog_Setup()
221 Dialog_Setup::on_ok_pressed()
228 Dialog_Setup::on_apply_pressed()
230 App::gamma.set_all(1.0/adj_gamma_r.get_value(),1.0/adj_gamma_g.get_value(),1.0/adj_gamma_b.get_value(),black_level_selector.get_value(),red_blue_level_selector.get_value());
232 App::set_max_recent_files((int)adj_recent_files.get_value());
234 // Set the time format
235 App::set_time_format(get_time_format());
237 // Set the use_colorspace_gamma flag
238 App::use_colorspace_gamma=toggle_use_colorspace_gamma.get_active();
240 #ifdef SINGLE_THREADED
241 // Set the single_threaded flag
242 App::single_threaded=toggle_single_threaded.get_active();
245 // Set the auto backup interval
246 App::auto_recover->set_timeout(auto_backup_interval.get_value() * 1000);
248 App::distance_system=Distance::System(widget_enum->get_value());
250 // Set the restrict_radius_ducks flag
251 App::restrict_radius_ducks=toggle_restrict_radius_ducks.get_active();
253 // Set the browser_command textbox
254 App::browser_command=textbox_browser_command.get_text();
256 App::save_settings();
260 Dialog_Setup::on_gamma_r_change()
262 gamma_pattern.set_gamma_r(1.0/adj_gamma_r.get_value());
263 gamma_pattern.refresh();
264 gamma_pattern.queue_draw();
268 Dialog_Setup::on_gamma_g_change()
270 gamma_pattern.set_gamma_g(1.0/adj_gamma_g.get_value());
271 gamma_pattern.refresh();
272 gamma_pattern.queue_draw();
276 Dialog_Setup::on_gamma_b_change()
278 gamma_pattern.set_gamma_b(1.0/adj_gamma_b.get_value());
279 gamma_pattern.refresh();
280 gamma_pattern.queue_draw();
284 Dialog_Setup::on_black_level_change()
286 gamma_pattern.set_black_level(black_level_selector.get_value());
287 gamma_pattern.refresh();
288 gamma_pattern.queue_draw();
292 Dialog_Setup::on_red_blue_level_change()
294 gamma_pattern.set_red_blue_level(red_blue_level_selector.get_value());
295 gamma_pattern.refresh();
296 gamma_pattern.queue_draw();
301 Dialog_Setup::refresh()
303 // Refresh the temporary gamma; do this before adjusting the sliders,
304 // or variables will be used before their initialization.
305 gamma_pattern.set_gamma_r(App::gamma.get_gamma_r());
306 gamma_pattern.set_gamma_g(App::gamma.get_gamma_g());
307 gamma_pattern.set_gamma_b(App::gamma.get_gamma_b());
308 gamma_pattern.set_black_level(App::gamma.get_black_level());
309 gamma_pattern.set_red_blue_level(App::gamma.get_red_blue_level());
311 adj_gamma_r.set_value(1.0/App::gamma.get_gamma_r());
312 adj_gamma_g.set_value(1.0/App::gamma.get_gamma_g());
313 adj_gamma_b.set_value(1.0/App::gamma.get_gamma_b());
314 black_level_selector.set_value(App::gamma.get_black_level());
315 red_blue_level_selector.set_value(App::gamma.get_red_blue_level());
317 gamma_pattern.refresh();
319 adj_recent_files.set_value(App::get_max_recent_files());
321 // Refresh the time format
322 set_time_format(App::get_time_format());
324 widget_enum->set_value(App::distance_system);
326 // Refresh the status of the use_colorspace_gamma flag
327 toggle_use_colorspace_gamma.set_active(App::use_colorspace_gamma);
329 #ifdef SINGLE_THREADED
330 // Refresh the status of the single_threaded flag
331 toggle_single_threaded.set_active(App::single_threaded);
334 // Refresh the value of the auto backup interval
335 auto_backup_interval.set_value(App::auto_recover->get_timeout() / 1000);
337 // Refresh the status of the restrict_radius_ducks flag
338 toggle_restrict_radius_ducks.set_active(App::restrict_radius_ducks);
340 // Refresh the browser_command textbox
341 textbox_browser_command.set_text(App::browser_command);
344 GammaPattern::GammaPattern():
348 set_size_request(tile_w*4,tile_h*3);
349 signal_expose_event().connect(sigc::mem_fun(*this, &studio::GammaPattern::redraw));
352 GammaPattern::~GammaPattern()
357 GammaPattern::refresh()
381 black[1].set_rgb(black[0].get_red(),0,0);
382 gray25[1].set_rgb(gray25[0].get_red(),0,0);
383 gray50[1].set_rgb(gray50[0].get_red(),0,0);
384 white[1].set_rgb(white[0].get_red(),0,0);
387 black[2].set_rgb(0,black[0].get_green(),0);
388 gray25[2].set_rgb(0,gray25[0].get_green(),0);
389 gray50[2].set_rgb(0,gray50[0].get_green(),0);
390 white[2].set_rgb(0,white[0].get_green(),0);
393 black[3].set_rgb(0,0,black[0].get_blue());
394 gray25[3].set_rgb(0,0,gray25[0].get_blue());
395 gray50[3].set_rgb(0,0,gray50[0].get_blue());
396 white[3].set_rgb(0,0,white[0].get_blue());
400 GammaPattern::redraw(GdkEventExpose */*bleh*/)
402 static const char hlines[] = { 3, 0 };
404 Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(get_window()));
407 Gdk::Color trueblack("#000000");
412 gc->set_rgb_fg_color(black[i]);
413 get_window()->draw_rectangle(gc, true, i*tile_w, 0, tile_w, tile_h);
415 gc->set_stipple(Gdk::Bitmap::create(hlines,2,2));
416 gc->set_fill(Gdk::STIPPLED);
417 gc->set_rgb_fg_color(white[i]);
418 get_window()->draw_rectangle(gc, true, i*tile_w, 0, tile_w, tile_h);
420 gc->set_fill(Gdk::SOLID);
421 gc->set_rgb_fg_color(gray50[i]);
423 get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2);
429 gc->set_rgb_fg_color(black[i]);
430 get_window()->draw_rectangle(gc, true, i*tile_w, tile_h, tile_w, tile_h);
432 gc->set_stipple(Gdk::Bitmap::create(hlines,2,2));
433 gc->set_fill(Gdk::STIPPLED);
434 gc->set_rgb_fg_color(gray50[i]);
435 get_window()->draw_rectangle(gc, true, i*tile_w, tile_h, tile_w, tile_h);
437 gc->set_fill(Gdk::SOLID);
438 gc->set_rgb_fg_color(gray25[i]);
440 get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h+tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2);
443 // Black-level Pattern
444 gc->set_rgb_fg_color(trueblack);
445 get_window()->draw_rectangle(gc, true, 0, tile_h*2, tile_w*4, tile_h);
446 gc->set_fill(Gdk::SOLID);
449 gc->set_rgb_fg_color(black[i]);
451 get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h*2+tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2);
458 BlackLevelSelector::BlackLevelSelector()
460 set_size_request(-1,24);
461 signal_expose_event().connect(sigc::mem_fun(*this, &studio::BlackLevelSelector::redraw));
463 add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
464 add_events(Gdk::BUTTON1_MOTION_MASK);
465 add_events(Gdk::BUTTON1_MOTION_MASK);
468 BlackLevelSelector::~BlackLevelSelector()
473 BlackLevelSelector::redraw(GdkEventExpose */*bleh*/)
475 const int w(get_width()),h(get_height());
479 Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(get_window()));
486 color.set_rgb(i*65536/w,i*65536/w,i*65536/w);
488 gc->set_rgb_fg_color(color);
489 get_window()->draw_rectangle(gc, true, i, 0, 1, h);
493 gc->set_rgb_fg_color(Gdk::Color("#000000"));
494 get_window()->draw_rectangle(gc, false, 0, 0, w-1, h-1);
496 // Draw the position of the current value
497 i=(int)(level*w+0.5);
498 gc->set_rgb_fg_color(Gdk::Color("#ff0000"));
499 get_window()->draw_rectangle(gc, true, i, 1, 1, h-1);
501 // Print out the value
502 Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
503 layout->set_text(etl::strprintf("%0.01f%%",level*100.0f));
504 layout->set_alignment(Pango::ALIGN_CENTER);
505 gc->set_rgb_fg_color(Gdk::Color("#a00000"));
506 get_window()->draw_layout(gc, w/2, 4, layout);
514 BlackLevelSelector::on_event(GdkEvent *event)
516 int x(round_to_int(event->button.x));
517 //int y(round_to_int(event->button.y));
521 case GDK_MOTION_NOTIFY:
522 level=(float)x/(float)get_width();
523 if(level<0.0f)level=0.0f;
524 if(level>1.0f)level=1.0f;
525 signal_value_changed_();
529 case GDK_BUTTON_PRESS:
530 case GDK_BUTTON_RELEASE:
531 if(event->button.button==1)
533 level=(float)x/(float)get_width();
534 if(level<0.0f)level=0.0f;
535 if(level>1.0f)level=1.0f;
536 signal_value_changed_();
550 Dialog_Setup::set_time_format(synfig::Time::Format x)
553 if (x <= Time::FORMAT_VIDEO)
554 timestamp_optionmenu.set_history(0);
555 else if (x == (Time::FORMAT_NORMAL))
556 timestamp_optionmenu.set_history(1);
557 else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES))
558 timestamp_optionmenu.set_history(2);
559 else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_FULL))
560 timestamp_optionmenu.set_history(3);
561 else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES | Time::FORMAT_FULL))
562 timestamp_optionmenu.set_history(4);
563 else if (x == (Time::FORMAT_FRAMES))
564 timestamp_optionmenu.set_history(5);
566 timestamp_optionmenu.set_history(1);
584 RedBlueLevelSelector::RedBlueLevelSelector()
586 set_size_request(-1,24);
587 signal_expose_event().connect(sigc::mem_fun(*this, &studio::RedBlueLevelSelector::redraw));
589 add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
590 add_events(Gdk::BUTTON1_MOTION_MASK);
591 add_events(Gdk::BUTTON1_MOTION_MASK);
594 RedBlueLevelSelector::~RedBlueLevelSelector()
599 RedBlueLevelSelector::redraw(GdkEventExpose */*bleh*/)
601 const int w(get_width()),h(get_height());
605 Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(get_window()));
612 float red_blue(((float(i)/float(w)+0.5f)-1.0f)/2.0f+1.0f);
613 float blue_red(2.0f-(red_blue));
614 if(red_blue>1.0f)red_blue=1.0f;
615 if(blue_red>1.0f)blue_red=1.0f;
618 round_to_int(min(red_blue,1.0f)*65535),
619 round_to_int(sqrt(min(red_blue,blue_red))*65535),
620 round_to_int(min(blue_red,1.0f)*65535)
623 gc->set_rgb_fg_color(color);
624 get_window()->draw_rectangle(gc, true, i, 0, 1, h);
628 gc->set_rgb_fg_color(Gdk::Color("#000000"));
629 get_window()->draw_rectangle(gc, false, 0, 0, w-1, h-1);
631 // Draw the position of the current value
632 i=(int)(((level-1.0f)*2.0f+1.0f-0.5f)*w+0.5);
633 gc->set_rgb_fg_color(Gdk::Color("#00ff00"));
634 get_window()->draw_rectangle(gc, true, i, 1, 1, h-1);
636 // Print out the value
637 Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
638 layout->set_text(etl::strprintf("%0.02f",level));
639 layout->set_alignment(Pango::ALIGN_CENTER);
640 gc->set_rgb_fg_color(Gdk::Color("#a00000"));
641 get_window()->draw_layout(gc, w/2, 4, layout);
649 RedBlueLevelSelector::on_event(GdkEvent *event)
651 int x(round_to_int(event->button.x));
652 //int y(round_to_int(event->button.y));
656 case GDK_MOTION_NOTIFY:
657 level=(((float)(x)/(float)get_width()+0.5)-1.0f)/2.0f+1.0f;
658 if(level<0.5f)level=0.5f;
659 if(level>1.5f)level=1.5f;
660 signal_value_changed_();
664 case GDK_BUTTON_PRESS:
665 case GDK_BUTTON_RELEASE:
666 if(event->button.button==1)
668 level=(((float)(x)/(float)get_width()+0.5)-1.0f)/2.0f+1.0f;
669 if(level<0.5f)level=0.5f;
670 if(level>1.5f)level=1.5f;
671 signal_value_changed_();