1 /* === S Y N F I G ========================================================= */
2 /*! \file dialog_preview.cpp
3 ** \brief Preview dialog File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
32 #include "dialog_preview.h"
34 #include <gtkmm/spinbutton.h>
35 #include <gtkmm/alignment.h>
36 #include <gtkmm/frame.h>
37 #include <gtkmm/box.h>
42 /* === U S I N G =========================================================== */
46 using namespace synfig;
47 using namespace studio;
50 /* === M A C R O S ========================================================= */
52 /* === G L O B A L S ======================================================= */
54 /* === P R O C E D U R E S ================================================= */
56 /* === M E T H O D S ======================================================= */
58 /* === E N T R Y P O I N T ================================================= */
60 //dialog_preview stuff...
61 Dialog_Preview::Dialog_Preview()
62 :Dialog(_("Preview Window"),false,true),
63 settings(this,"preview")
65 get_vbox()->pack_start(preview);
68 Dialog_Preview::~Dialog_Preview()
72 void Dialog_Preview::set_preview(etl::handle<Preview> prev)
75 preview.set_preview(prev);
79 void Dialog_Preview::on_hide()
86 //dialog_previewoptions stuff
87 Dialog_PreviewOptions::Dialog_PreviewOptions()
88 :Dialog(_("Preview Options"),false,true),
89 adj_zoom(0.5,0.1,5.0,0.1,0.2),
90 adj_fps(15,1,120,1,5),
91 check_overbegin(_("_Begin Time"),false),
92 check_overend(_("_End Time"),false),
93 settings(this,"prevoptions")
98 //set the fps of the time widgets
99 Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
100 dialogPadding->set_padding(12, 12, 12, 12);
101 get_vbox()->add(*dialogPadding);
103 Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
104 dialogPadding->add(*dialogBox);
106 Gtk::Frame *generalFrame = manage(new Gtk::Frame(_("General Settings")));
107 generalFrame->set_shadow_type(Gtk::SHADOW_NONE);
108 ((Gtk::Label *) generalFrame->get_label_widget())->set_markup(_("<b>General Settings</b>"));
109 dialogBox->pack_start(*generalFrame, false, false, 0);
111 Gtk::Alignment *generalPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
112 generalPadding->set_padding(6, 0, 24, 0);
113 generalFrame->add(*generalPadding);
115 Gtk::Table *generalTable = manage(new Gtk::Table(2, 2, false));
116 generalTable->set_row_spacings(6);
117 generalTable->set_col_spacings(12);
118 generalPadding->add(*generalTable);
120 Gtk::Label *zoomLabel = manage(new Gtk::Label(_("_Zoom")));
121 zoomLabel->set_alignment(0, 0.5);
122 zoomLabel->set_use_underline(TRUE);
123 Gtk::SpinButton *zoomSpinner = manage(new Gtk::SpinButton(adj_zoom, 0.1, 2));
124 zoomLabel->set_mnemonic_widget(*zoomSpinner);
125 zoomSpinner->set_alignment(1);
126 generalTable->attach(*zoomLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
127 generalTable->attach(*zoomSpinner, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
129 Gtk::Label *fpsLabel = manage(new Gtk::Label(_("_Frames per second")));
130 fpsLabel->set_alignment(0, 0.5);
131 fpsLabel->set_use_underline(TRUE);
132 Gtk::SpinButton *fpsSpinner = manage(new Gtk::SpinButton(adj_fps, 1, 1));
133 fpsLabel->set_mnemonic_widget(*fpsSpinner);
134 fpsSpinner->set_alignment(1);
135 generalTable->attach(*fpsLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
136 generalTable->attach(*fpsSpinner, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
138 Gtk::Frame *timeFrame = manage(new Gtk::Frame(_("Time Settings")));
139 timeFrame->set_shadow_type(Gtk::SHADOW_NONE);
140 ((Gtk::Label *) timeFrame->get_label_widget())->set_markup(_("<b>Time Settings</b>"));
141 dialogBox->pack_start(*timeFrame, false, false, 0);
143 Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
144 timePadding->set_padding(6, 0, 24, 0);
145 timeFrame->add(*timePadding);
147 Gtk::Table *timeTable = manage(new Gtk::Table(2, 2, false));
148 timeTable->set_row_spacings(6);
149 timeTable->set_col_spacings(12);
150 timePadding->add(*timeTable);
152 check_overbegin.set_alignment(0, 0.5);
153 check_overbegin.set_use_underline(TRUE);
154 check_overend.set_alignment(0, 0.5);
155 check_overend.set_use_underline(TRUE);
156 time_begin.set_alignment(1);
157 time_end.set_alignment(1);
158 timeTable->attach(check_overbegin, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
159 timeTable->attach(time_begin, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
160 timeTable->attach(check_overend, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
161 timeTable->attach(time_end, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
163 check_overbegin.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overbegin_toggle));
164 check_overend.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overend_toggle));
166 Gtk::Button *cancelButton = manage(new Gtk::Button(Gtk::StockID("gtk-cancel")));
167 cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_PreviewOptions::on_cancel_pressed));
168 add_action_widget(*cancelButton, 1);
170 Gtk::Button *okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-go-forward")));
171 okbutton->set_label(_("Preview"));
172 okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_ok_pressed));
173 add_action_widget(*okbutton, 0);
175 time_begin.set_sensitive(false);
176 time_end.set_sensitive(false);
180 Dialog_PreviewOptions::~Dialog_PreviewOptions()
184 void Dialog_PreviewOptions::on_ok_pressed()
189 i.overbegin = get_begin_override();
190 i.overend = get_end_override();
191 if(i.overbegin) i.begintime = (float)get_begintime();
192 if(i.overend) i.endtime = (float)get_endtime();
196 signal_finish_.clear();
200 Dialog_PreviewOptions::on_cancel_pressed()
205 void Dialog_PreviewOptions::on_overbegin_toggle()
207 time_begin.set_sensitive(get_begin_override());
210 void Dialog_PreviewOptions::on_overend_toggle()
212 time_end.set_sensitive(get_end_override());
215 void studio::Dialog_PreviewOptions::set_global_fps(float f)
218 time_begin.set_fps(f);