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