1 /* === S Y N F I G ========================================================= */
2 /*! \file dialog_setup.h
3 ** \brief Template Header
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 /* === S T A R T =========================================================== */
26 #ifndef __SYNFIG_STUDIO_DIALOG_SETUP_H
27 #define __SYNFIG_STUDIO_DIALOG_SETUP_H
29 /* === H E A D E R S ======================================================= */
32 #include <gtkmm/adjustment.h>
33 #include <gtkmm/table.h>
34 #include <gtkmm/button.h>
35 #include <gtkmm/dialog.h>
36 #include <gtkmm/drawingarea.h>
37 #include <gtkmm/optionmenu.h>
38 #include <gtkmm/checkbutton.h>
39 #include <gtkmm/widget_time.h>
41 #include <synfig/gamma.h>
42 #include <synfig/time.h>
45 /* === M A C R O S ========================================================= */
47 /* === T Y P E D E F S ===================================================== */
49 /* === C L A S S E S & S T R U C T S ======================================= */
51 namespace Gtk { class Menu; };
55 class GammaPattern : public Gtk::DrawingArea
65 Gdk::Color black[4],white[4],gray50[4],gray25[4];
67 float r_F32_to_F32(float x)const { float f((pow(x,gamma_r)*std::min(red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; }
68 float g_F32_to_F32(float x)const { float f((pow(x,gamma_g)*sqrt(std::min(2.0f-red_blue_level,red_blue_level))*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; }
69 float b_F32_to_F32(float x)const { float f((pow(x,gamma_b)*std::min(2.0f-red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; }
75 void set_gamma_r(float x) { gamma_r=x; }
76 void set_gamma_g(float x) { gamma_g=x; };
77 void set_gamma_b(float x) { gamma_b=x; };
78 void set_black_level(float x) { black_level=x; };
79 void set_red_blue_level(float x) { red_blue_level=x; };
81 float get_gamma_r()const { return gamma_r; }
82 float get_gamma_g()const { return gamma_g; }
83 float get_gamma_b()const { return gamma_b; }
84 float get_black_level()const { return black_level; }
85 float get_red_blue_level()const { return red_blue_level; }
91 bool redraw(GdkEventExpose*bleh=NULL);
92 }; // END of class GammaPattern
94 class BlackLevelSelector : public Gtk::DrawingArea
98 sigc::signal<void> signal_value_changed_;
102 BlackLevelSelector();
104 ~BlackLevelSelector();
106 sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
108 void set_value(float x) { level=x; queue_draw(); }
110 const float &get_value()const { return level; }
112 bool redraw(GdkEventExpose*bleh=NULL);
114 bool on_event(GdkEvent *event);
115 }; // END of class BlackLevelSelector
117 class RedBlueLevelSelector : public Gtk::DrawingArea
121 sigc::signal<void> signal_value_changed_;
125 RedBlueLevelSelector();
127 ~RedBlueLevelSelector();
129 sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
131 void set_value(float x) { level=x; queue_draw(); }
133 const float &get_value()const { return level; }
135 bool redraw(GdkEventExpose*bleh=NULL);
137 bool on_event(GdkEvent *event);
138 }; // END of class RedBlueSelector
142 class Dialog_Setup : public Gtk::Dialog
145 void on_ok_pressed();
146 void on_apply_pressed();
148 void on_gamma_r_change();
149 void on_gamma_g_change();
150 void on_gamma_b_change();
151 void on_black_level_change();
152 void on_red_blue_level_change();
154 GammaPattern gamma_pattern;
155 BlackLevelSelector black_level_selector;
156 RedBlueLevelSelector red_blue_level_selector;
157 Gtk::OptionMenu timestamp_optionmenu;
159 Gtk::Adjustment adj_gamma_r;
160 Gtk::Adjustment adj_gamma_g;
161 Gtk::Adjustment adj_gamma_b;
163 Gtk::Adjustment adj_recent_files;
164 Gtk::Adjustment adj_undo_depth;
166 Gtk::CheckButton toggle_use_colorspace_gamma;
167 #ifdef SINGLE_THREADED
168 Gtk::CheckButton toggle_single_threaded;
171 synfig::Time::Format time_format;
173 Gtk::Menu *timestamp_menu;
174 Widget_Enum *widget_enum;
176 Widget_Time auto_backup_interval;
178 Gtk::CheckButton toggle_restrict_radius_ducks;
180 Gtk::Entry textbox_browser_command;
183 void set_time_format(synfig::Time::Format time_format);
185 const synfig::Time::Format& get_time_format()const { return time_format; }
192 }; // END of Dialog_Waypoint
194 }; // END of namespace studio
196 /* === E N D =============================================================== */