Changed the "tagrelease" and "tagstable" make targets to use subversion. Also increme...
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / dialog_setup.h
1 /* === S I N F G =========================================================== */
2 /*!     \file dialog_setup.h
3 **      \brief Template Header
4 **
5 **      $Id: dialog_setup.h,v 1.1.1.1 2005/01/07 03:34:36 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 /* === S T A R T =========================================================== */
23
24 #ifndef __SINFG_STUDIO_DIALOG_SETUP_H
25 #define __SINFG_STUDIO_DIALOG_SETUP_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <gtk/gtk.h>
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>
37
38 #include <sinfg/gamma.h>
39 #include <sinfg/time.h>
40 #include <algorithm>
41
42 /* === M A C R O S ========================================================= */
43
44 /* === T Y P E D E F S ===================================================== */
45
46 /* === C L A S S E S & S T R U C T S ======================================= */
47
48 namespace Gtk { class Menu; };
49
50 namespace studio {
51
52 class GammaPattern : public Gtk::DrawingArea
53 {
54         float gamma_r;
55         float gamma_g;
56         float gamma_b;
57         float black_level;
58         float red_blue_level;
59
60         int tile_w, tile_h;
61
62         Gdk::Color black[4],white[4],gray50[4],gray25[4];
63
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; }
67         
68 public:
69         
70         void refresh();
71         
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; };
77
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; }
83         
84         GammaPattern();
85         
86         ~GammaPattern();
87
88         bool redraw(GdkEventExpose*bleh=NULL);
89 }; // END of class GammaPattern
90
91 class BlackLevelSelector : public Gtk::DrawingArea
92 {
93         float level;
94
95         sigc::signal<void> signal_value_changed_;
96
97 public:
98         
99         BlackLevelSelector();
100         
101         ~BlackLevelSelector();
102
103         sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
104         
105         void set_value(float x) { level=x; queue_draw(); }
106
107         const float &get_value()const { return level; } 
108
109         bool redraw(GdkEventExpose*bleh=NULL);
110
111         bool on_event(GdkEvent *event);
112 }; // END of class BlackLevelSelector
113
114 class RedBlueLevelSelector : public Gtk::DrawingArea
115 {
116         float level;
117
118         sigc::signal<void> signal_value_changed_;
119
120 public:
121         
122         RedBlueLevelSelector();
123         
124         ~RedBlueLevelSelector();
125
126         sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
127         
128         void set_value(float x) { level=x; queue_draw(); }
129
130         const float &get_value()const { return level; } 
131
132         bool redraw(GdkEventExpose*bleh=NULL);
133
134         bool on_event(GdkEvent *event);
135 }; // END of class RedBlueSelector
136
137 class Widget_Enum;
138
139 class Dialog_Setup : public Gtk::Dialog
140 {
141                 
142         void on_ok_pressed();
143         void on_apply_pressed();
144
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();
150
151         GammaPattern gamma_pattern;     
152         BlackLevelSelector black_level_selector;
153         RedBlueLevelSelector red_blue_level_selector;
154         Gtk::OptionMenu timestamp_optionmenu;
155         
156         Gtk::Adjustment adj_gamma_r;
157         Gtk::Adjustment adj_gamma_g;
158         Gtk::Adjustment adj_gamma_b;
159
160         Gtk::Adjustment adj_recent_files;
161         Gtk::Adjustment adj_undo_depth;
162
163         Gtk::CheckButton toggle_use_colorspace_gamma;
164
165         sinfg::Time::Format time_format;
166         
167         Gtk::Menu *timestamp_menu;
168         Widget_Enum *widget_enum;
169 public:
170
171         void set_time_format(sinfg::Time::Format time_format);
172
173         const sinfg::Time::Format& get_time_format()const { return time_format; }
174         
175         Dialog_Setup();
176         ~Dialog_Setup();
177
178     void refresh();
179
180 }; // END of Dialog_Waypoint
181
182 }; // END of namespace studio
183
184 /* === E N D =============================================================== */
185
186 #endif