1 /* === S Y N F I G ========================================================= */
2 /*! \file dialog_setup.h
3 ** \brief Template Header
5 ** $Id: dialog_setup.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_STUDIO_DIALOG_SETUP_H
26 #define __SYNFIG_STUDIO_DIALOG_SETUP_H
28 /* === H E A D E R S ======================================================= */
31 #include <gtkmm/adjustment.h>
32 #include <gtkmm/table.h>
33 #include <gtkmm/button.h>
34 #include <gtkmm/dialog.h>
35 #include <gtkmm/drawingarea.h>
36 #include <gtkmm/optionmenu.h>
37 #include <gtkmm/checkbutton.h>
39 #include <synfig/gamma.h>
40 #include <synfig/time.h>
43 /* === M A C R O S ========================================================= */
45 /* === T Y P E D E F S ===================================================== */
47 /* === C L A S S E S & S T R U C T S ======================================= */
49 namespace Gtk { class Menu; };
53 class GammaPattern : public Gtk::DrawingArea
63 Gdk::Color black[4],white[4],gray50[4],gray25[4];
65 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; }
66 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; }
67 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; }
73 void set_gamma_r(float x) { gamma_r=x; }
74 void set_gamma_g(float x) { gamma_g=x; };
75 void set_gamma_b(float x) { gamma_b=x; };
76 void set_black_level(float x) { black_level=x; };
77 void set_red_blue_level(float x) { red_blue_level=x; };
79 float get_gamma_r()const { return gamma_r; }
80 float get_gamma_g()const { return gamma_g; }
81 float get_gamma_b()const { return gamma_b; }
82 float get_black_level()const { return black_level; }
83 float get_red_blue_level()const { return red_blue_level; }
89 bool redraw(GdkEventExpose*bleh=NULL);
90 }; // END of class GammaPattern
92 class BlackLevelSelector : public Gtk::DrawingArea
96 sigc::signal<void> signal_value_changed_;
100 BlackLevelSelector();
102 ~BlackLevelSelector();
104 sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
106 void set_value(float x) { level=x; queue_draw(); }
108 const float &get_value()const { return level; }
110 bool redraw(GdkEventExpose*bleh=NULL);
112 bool on_event(GdkEvent *event);
113 }; // END of class BlackLevelSelector
115 class RedBlueLevelSelector : public Gtk::DrawingArea
119 sigc::signal<void> signal_value_changed_;
123 RedBlueLevelSelector();
125 ~RedBlueLevelSelector();
127 sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
129 void set_value(float x) { level=x; queue_draw(); }
131 const float &get_value()const { return level; }
133 bool redraw(GdkEventExpose*bleh=NULL);
135 bool on_event(GdkEvent *event);
136 }; // END of class RedBlueSelector
140 class Dialog_Setup : public Gtk::Dialog
143 void on_ok_pressed();
144 void on_apply_pressed();
146 void on_gamma_r_change();
147 void on_gamma_g_change();
148 void on_gamma_b_change();
149 void on_black_level_change();
150 void on_red_blue_level_change();
152 GammaPattern gamma_pattern;
153 BlackLevelSelector black_level_selector;
154 RedBlueLevelSelector red_blue_level_selector;
155 Gtk::OptionMenu timestamp_optionmenu;
157 Gtk::Adjustment adj_gamma_r;
158 Gtk::Adjustment adj_gamma_g;
159 Gtk::Adjustment adj_gamma_b;
161 Gtk::Adjustment adj_recent_files;
162 Gtk::Adjustment adj_undo_depth;
164 Gtk::CheckButton toggle_use_colorspace_gamma;
166 synfig::Time::Format time_format;
168 Gtk::Menu *timestamp_menu;
169 Widget_Enum *widget_enum;
172 void set_time_format(synfig::Time::Format time_format);
174 const synfig::Time::Format& get_time_format()const { return time_format; }
181 }; // END of Dialog_Waypoint
183 }; // END of namespace studio
185 /* === E N D =============================================================== */