Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_07_rc2 / src / gtkmm / renddesc.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file gtkmm/renddesc.h
3 **      \brief Header File
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
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.
14 **
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.
19 **      \endlegal
20 **
21 ** === N O T E S ===========================================================
22 **
23 ** ========================================================================= */
24
25 /* === S T A R T =========================================================== */
26
27 #ifndef __SYNFIG_GTKMM_RENDDESC_H
28 #define __SYNFIG_GTKMM_RENDDESC_H
29
30 /* === H E A D E R S ======================================================= */
31
32 #include <gtkmm/table.h>
33 #include <gtkmm/frame.h>
34 #include <synfig/renddesc.h>
35 #include <gtkmm/spinbutton.h>
36 #include <gtkmm/adjustment.h>
37 #include <gtkmm/checkbutton.h>
38 #include <gtkmm/notebook.h>
39 #include "widget_vector.h"
40 #include "widget_time.h"
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 studio {
49
50 class Widget_RendDesc : public Gtk::Notebook
51 {
52         synfig::RendDesc rend_desc_;
53         sigc::signal<void> signal_changed_;
54
55         Gtk::Adjustment adjustment_width;
56         Gtk::Adjustment adjustment_height;
57         Gtk::Adjustment adjustment_xres;
58         Gtk::Adjustment adjustment_yres;
59         Gtk::Adjustment adjustment_phy_width;
60         Gtk::Adjustment adjustment_phy_height;
61         Gtk::Adjustment adjustment_fps;
62         //Gtk::Adjustment adjustment_start_time;
63         //Gtk::Adjustment adjustment_end_time;
64         //Gtk::Adjustment adjustment_start_frame;
65         //Gtk::Adjustment adjustment_end_frame;
66         Gtk::Adjustment adjustment_span;
67
68         Gtk::SpinButton *entry_width;
69         Gtk::SpinButton *entry_height;
70         Gtk::SpinButton *entry_xres;
71         Gtk::SpinButton *entry_yres;
72         Gtk::SpinButton *entry_phy_width;
73         Gtk::SpinButton *entry_phy_height;
74         Gtk::SpinButton *entry_fps;
75 //      Gtk::SpinButton *entry_start_time;
76 //      Gtk::SpinButton *entry_end_time;
77 //      Gtk::SpinButton *entry_start_frame;
78 //      Gtk::SpinButton *entry_end_frame;
79         Gtk::SpinButton *entry_span;
80
81         Gtk::CheckButton *toggle_px_aspect;
82         Gtk::CheckButton *toggle_px_width;
83         Gtk::CheckButton *toggle_px_height;
84
85         Gtk::CheckButton *toggle_im_aspect;
86         Gtk::CheckButton *toggle_im_width;
87         Gtk::CheckButton *toggle_im_height;
88         Gtk::CheckButton *toggle_im_span;
89
90         /* Gtk::Table *time_table; */
91         Gtk::Frame *time_frame;
92
93         Widget_Vector *entry_tl;
94         Widget_Vector *entry_br;
95
96         Widget_Vector *entry_focus;
97
98         Widget_Time *entry_start_time;
99         Widget_Time *entry_end_time;
100
101         mutable int update_lock;
102
103         struct UpdateLock
104         {
105                 int &locked;
106                 UpdateLock(int &locked):locked(locked){locked++;}
107                 ~UpdateLock(){locked--;}
108         };
109
110 public:
111
112         sigc::signal<void> &signal_changed() { return signal_changed_; }
113
114         Widget_RendDesc();
115         ~Widget_RendDesc();
116
117         //! Sets the RendDesc
118         void set_rend_desc(const synfig::RendDesc &rend_desc);
119
120         //! Applies the given RendDesc to the current RendDesc
121         void apply_rend_desc(const synfig::RendDesc &rend_desc);
122
123         //! Retrieves the current RendDesc
124         const synfig::RendDesc &get_rend_desc();
125
126         void disable_time_section();
127
128         void enable_time_section();
129
130         void refresh();
131 private:
132
133         void on_width_changed();
134         void on_height_changed();
135         void on_xres_changed();
136         void on_yres_changed();
137         void on_phy_width_changed();
138         void on_phy_height_changed();
139         void on_tl_changed();
140         void on_br_changed();
141         void on_fps_changed();
142         void on_start_time_changed();
143         void on_end_time_changed();
144         //void on_start_frame_changed();
145         //void on_end_frame_changed();
146         void on_lock_changed();
147         void on_focus_changed();
148         void on_span_changed();
149
150         void create_widgets();
151         void connect_signals();
152         Gtk::Widget *create_image_tab();
153         Gtk::Widget *create_time_tab();
154         Gtk::Widget *create_other_tab();
155 };
156
157 }; // END of namespace studio
158
159 /* === E N D =============================================================== */
160
161 #endif