Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_04 / synfig-studio / src / gtkmm / dialog_preview.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dialog_preview.h
3 **      \brief Preview dialog Header
4 **
5 **      $Id: dialog_preview.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
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 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_GTKMM_DIALOG_PREVIEW_H
26 #define __SYNFIG_GTKMM_DIALOG_PREVIEW_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <gtkmm/adjustment.h>
31 #include <gtkmm/dialog.h>
32 #include <gtkmm/menu.h>
33 #include <gtkmm/spinbutton.h>
34 #include <gtkmm/dialogsettings.h>
35
36 #include "preview.h"
37 #include <gtkmm/widget_time.h>
38
39 /* === M A C R O S ========================================================= */
40
41 /* === T Y P E D E F S ===================================================== */
42
43
44 /* === C L A S S E S & S T R U C T S ======================================= */
45
46 namespace studio {
47
48 struct PreviewInfo
49 {
50         float zoom,fps,begintime,endtime;
51         bool overbegin,overend;
52 };
53
54 class Dialog_Preview : public Gtk::Dialog
55 {
56         Widget_Preview  preview;
57         DialogSettings  settings;
58         
59         //etl::handle<synfig::Canvas> canvas;
60                         
61 public:
62         Dialog_Preview();
63         ~Dialog_Preview();
64
65     void set_preview(etl::handle<Preview> prev);
66
67         Widget_Preview &get_widget() {return preview;}
68         const Widget_Preview &get_widget() const {return preview;}
69
70         virtual void on_hide();
71         //other forwarding functions...
72 }; // END of Dialog_Preview
73
74 class Dialog_PreviewOptions : public Gtk::Dialog
75 {
76         //all the info needed to construct a render description...      
77         Gtk::Adjustment adj_zoom;       // factor at which to resize the window...
78         
79         Gtk::Adjustment adj_fps;        // how often to take samples of the animation
80         
81         studio::Widget_Time time_begin;
82         studio::Widget_Time time_end;
83                         
84         Gtk::CheckButton check_overbegin;
85         Gtk::CheckButton check_overend;
86         
87         DialogSettings  settings;
88         
89         float   globalfps;
90         
91         // for finishing
92         void on_ok_pressed();
93         
94         //for ui stuff
95         void on_overbegin_toggle();
96         void on_overend_toggle();
97         
98         sigc::signal<void,const PreviewInfo &>  signal_finish_;
99 public:
100         Dialog_PreviewOptions();
101         ~Dialog_PreviewOptions();
102
103         float get_zoom() const { return adj_zoom.get_value(); }
104         void set_zoom(float z) { adj_zoom.set_value(z); }
105         
106         float get_fps() const { return adj_fps.get_value(); }
107         void set_fps(float z) { adj_fps.set_value(z); }
108         
109         float get_global_fps() const { return globalfps; }
110         void set_global_fps(float f);
111         
112         synfig::Time get_begintime() const { return time_begin.get_value(); }
113         void set_begintime(const synfig::Time &t) { time_begin.set_value(t); }
114         
115         synfig::Time get_endtime() const { return time_end.get_value(); }
116         void set_endtime(const synfig::Time &t) { time_end.set_value(t); }
117         
118         bool get_begin_override() const { return check_overbegin.get_active(); }
119         void set_begin_override(bool o) { check_overbegin.set_active(o); }
120         
121         bool get_end_override() const { return check_overend.get_active(); }
122         void set_end_override(bool o) { check_overend.set_active(o); }
123         
124         sigc::signal<void,const PreviewInfo &>  &signal_finish() {return signal_finish_;}
125 };
126
127 }; // END of namespace studio
128
129 /* === E N D =============================================================== */
130
131 #endif