synfig-studio  1.0.3
dialog_preview.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
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 <gui/dialogsettings.h>
35 
36 #include "preview.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 
49 {
52  bool use_cairo;
53 };
54 
55 class Dialog_Preview : public Gtk::Window
56 {
57  Widget_Preview preview;
58  DialogSettings settings;
59 
60  //etl::handle<synfig::Canvas> canvas;
61 
62 public:
65 
66  void set_preview(etl::handle<Preview> prev);
67 
68  Widget_Preview &get_widget() {return preview;}
69  const Widget_Preview &get_widget() const {return preview;}
70 
71  virtual void on_show();
72  virtual void on_hide();
73  //other forwarding functions...
74 
75  //child widgets:
76 
77 private:
78  bool on_key_pressed(GdkEventKey*);
79  void close_window_handler();
80 
81 protected:
82  Gtk::Table preview_table;
83 
84 }; // END of Dialog_Preview
85 
86 class Dialog_PreviewOptions : public Gtk::Dialog
87 {
88  //all the info needed to construct a render description...
89  Glib::RefPtr<Gtk::Adjustment> adj_zoom; // factor at which to resize the window...
90 
91  Glib::RefPtr<Gtk::Adjustment> adj_fps; // how often to take samples of the animation
92 
93  Gtk::CheckButton check_use_cairo;
94 
95  studio::Widget_Time time_begin;
96  studio::Widget_Time time_end;
97 
98  Gtk::CheckButton check_overbegin;
99  Gtk::CheckButton check_overend;
100 
101  DialogSettings settings;
102 
103  float globalfps;
104 
105  // for finishing
106  void on_ok_pressed();
107  void on_cancel_pressed();
108 
109  //for ui stuff
110  void on_overbegin_toggle();
111  void on_overend_toggle();
112 
113  sigc::signal<void,const PreviewInfo &> signal_finish_;
114 public:
117 
118  float get_zoom() const { return adj_zoom->get_value(); }
119  void set_zoom(float z) { adj_zoom->set_value(z); }
120 
121  float get_fps() const { return adj_fps->get_value(); }
122  void set_fps(float z) { adj_fps->set_value(z); }
123 
124  float get_global_fps() const { return globalfps; }
125  void set_global_fps(float f);
126 
127  synfig::Time get_begintime() const { return time_begin.get_value(); }
128  void set_begintime(const synfig::Time &t) { time_begin.set_value(t); }
129 
130  synfig::Time get_endtime() const { return time_end.get_value(); }
131  void set_endtime(const synfig::Time &t) { time_end.set_value(t); }
132 
133  bool get_begin_override() const { return check_overbegin.get_active(); }
134  void set_begin_override(bool o) { check_overbegin.set_active(o); }
135 
136  bool get_end_override() const { return check_overend.get_active(); }
137  void set_end_override(bool o) { check_overend.set_active(o); }
138 
139  bool get_use_cairo() const { return check_use_cairo.get_active(); }
140  void set_use_cairo(bool u) { check_use_cairo.set_active(u); }
141 
142  sigc::signal<void,const PreviewInfo &> &signal_finish() {return signal_finish_;}
143 };
144 
145 }; // END of namespace studio
146 
147 /* === E N D =============================================================== */
148 
149 #endif