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 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
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.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SYNFIG_STUDIO_DIALOG_SETUP_H
25 #define __SYNFIG_STUDIO_DIALOG_SETUP_H
27 /* === H E A D E R S ======================================================= */
30 #include <gtkmm/adjustment.h>
31 #include <gtkmm/table.h>
32 #include <gtkmm/button.h>
33 #include <gtkmm/dialog.h>
34 #include <gtkmm/drawingarea.h>
35 #include <gtkmm/optionmenu.h>
36 #include <gtkmm/checkbutton.h>
38 #include <synfig/gamma.h>
39 #include <synfig/time.h>
42 /* === M A C R O S ========================================================= */
44 /* === T Y P E D E F S ===================================================== */
46 /* === C L A S S E S & S T R U C T S ======================================= */
48 namespace Gtk { class Menu; };
52 class GammaPattern : public Gtk::DrawingArea
62 Gdk::Color black[4],white[4],gray50[4],gray25[4];
64 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; }
65 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; }
66 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; }
72 void set_gamma_r(float x) { gamma_r=x; }
73 void set_gamma_g(float x) { gamma_g=x; };
74 void set_gamma_b(float x) { gamma_b=x; };
75 void set_black_level(float x) { black_level=x; };
76 void set_red_blue_level(float x) { red_blue_level=x; };
78 float get_gamma_r()const { return gamma_r; }
79 float get_gamma_g()const { return gamma_g; }
80 float get_gamma_b()const { return gamma_b; }
81 float get_black_level()const { return black_level; }
82 float get_red_blue_level()const { return red_blue_level; }
88 bool redraw(GdkEventExpose*bleh=NULL);
89 }; // END of class GammaPattern
91 class BlackLevelSelector : public Gtk::DrawingArea
95 sigc::signal<void> signal_value_changed_;
101 ~BlackLevelSelector();
103 sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
105 void set_value(float x) { level=x; queue_draw(); }
107 const float &get_value()const { return level; }
109 bool redraw(GdkEventExpose*bleh=NULL);
111 bool on_event(GdkEvent *event);
112 }; // END of class BlackLevelSelector
114 class RedBlueLevelSelector : public Gtk::DrawingArea
118 sigc::signal<void> signal_value_changed_;
122 RedBlueLevelSelector();
124 ~RedBlueLevelSelector();
126 sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
128 void set_value(float x) { level=x; queue_draw(); }
130 const float &get_value()const { return level; }
132 bool redraw(GdkEventExpose*bleh=NULL);
134 bool on_event(GdkEvent *event);
135 }; // END of class RedBlueSelector
139 class Dialog_Setup : public Gtk::Dialog
142 void on_ok_pressed();
143 void on_apply_pressed();
145 void on_gamma_r_change();
146 void on_gamma_g_change();
147 void on_gamma_b_change();
148 void on_black_level_change();
149 void on_red_blue_level_change();
151 GammaPattern gamma_pattern;
152 BlackLevelSelector black_level_selector;
153 RedBlueLevelSelector red_blue_level_selector;
154 Gtk::OptionMenu timestamp_optionmenu;
156 Gtk::Adjustment adj_gamma_r;
157 Gtk::Adjustment adj_gamma_g;
158 Gtk::Adjustment adj_gamma_b;
160 Gtk::Adjustment adj_recent_files;
161 Gtk::Adjustment adj_undo_depth;
163 Gtk::CheckButton toggle_use_colorspace_gamma;
165 synfig::Time::Format time_format;
167 Gtk::Menu *timestamp_menu;
168 Widget_Enum *widget_enum;
171 void set_time_format(synfig::Time::Format time_format);
173 const synfig::Time::Format& get_time_format()const { return time_format; }
180 }; // END of Dialog_Waypoint
182 }; // END of namespace studio
184 /* === E N D =============================================================== */