1 /* === S Y N F I G ========================================================= */
2 /*! \file dialog_preview.cpp
3 ** \brief Preview dialog File
5 ** $Id: dialog_preview.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
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>
40 /* === U S I N G =========================================================== */
44 using namespace synfig;
45 using namespace studio;
48 /* === M A C R O S ========================================================= */
50 /* === G L O B A L S ======================================================= */
52 /* === P R O C E D U R E S ================================================= */
54 /* === M E T H O D S ======================================================= */
56 /* === E N T R Y P O I N T ================================================= */
58 //dialog_preview stuff...
59 Dialog_Preview::Dialog_Preview()
60 :Dialog(_("Preview Window"),false,true),
61 settings(this,"preview")
63 get_vbox()->pack_start(preview);
66 Dialog_Preview::~Dialog_Preview()
70 void Dialog_Preview::set_preview(handle<Preview> prev)
73 preview.set_preview(prev);
77 void Dialog_Preview::on_hide()
84 //dialog_previewoptions stuff
85 Dialog_PreviewOptions::Dialog_PreviewOptions()
86 :Dialog(_("Preview Options"),false,true),
87 adj_zoom(0.5,0.1,5.0,0.1,0.2),
88 adj_fps(15,1,120,1,5),
89 check_overbegin(_("_Begin Time"),false),
90 check_overend(_("_End Time"),false),
91 settings(this,"prevoptions")
96 //set the fps of the time widgets
97 Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
98 dialogPadding->set_padding(12, 12, 12, 12);
99 get_vbox()->add(*dialogPadding);
101 Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
102 dialogPadding->add(*dialogBox);
104 Gtk::Frame *generalFrame = manage(new Gtk::Frame(_("General Settings")));
105 generalFrame->set_shadow_type(Gtk::SHADOW_NONE);
106 ((Gtk::Label *) generalFrame->get_label_widget())->set_markup(_("<b>General Settings</b>"));
107 dialogBox->pack_start(*generalFrame, false, false, 0);
109 Gtk::Alignment *generalPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
110 generalPadding->set_padding(6, 0, 24, 0);
111 generalFrame->add(*generalPadding);
113 Gtk::Table *generalTable = manage(new Gtk::Table(2, 2, false));
114 generalTable->set_row_spacings(6);
115 generalTable->set_col_spacings(12);
116 generalPadding->add(*generalTable);
118 Gtk::Label *zoomLabel = manage(new Gtk::Label(_("_Zoom")));
119 zoomLabel->set_alignment(0, 0.5);
120 zoomLabel->set_use_underline(TRUE);
121 Gtk::SpinButton *zoomSpinner = manage(new Gtk::SpinButton(adj_zoom, 0.1, 2));
122 zoomLabel->set_mnemonic_widget(*zoomSpinner);
123 zoomSpinner->set_alignment(1);
124 generalTable->attach(*zoomLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
125 generalTable->attach(*zoomSpinner, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
127 Gtk::Label *fpsLabel = manage(new Gtk::Label(_("_Frames per second")));
128 fpsLabel->set_alignment(0, 0.5);
129 fpsLabel->set_use_underline(TRUE);
130 Gtk::SpinButton *fpsSpinner = manage(new Gtk::SpinButton(adj_fps, 1, 1));
131 fpsLabel->set_mnemonic_widget(*fpsSpinner);
132 fpsSpinner->set_alignment(1);
133 generalTable->attach(*fpsLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
134 generalTable->attach(*fpsSpinner, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
136 Gtk::Frame *timeFrame = manage(new Gtk::Frame(_("Time Settings")));
137 timeFrame->set_shadow_type(Gtk::SHADOW_NONE);
138 ((Gtk::Label *) timeFrame->get_label_widget())->set_markup(_("<b>Time Settings</b>"));
139 dialogBox->pack_start(*timeFrame, false, false, 0);
141 Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
142 timePadding->set_padding(6, 0, 24, 0);
143 timeFrame->add(*timePadding);
145 Gtk::Table *timeTable = manage(new Gtk::Table(2, 2, false));
146 timeTable->set_row_spacings(6);
147 timeTable->set_col_spacings(12);
148 timePadding->add(*timeTable);
150 check_overbegin.set_alignment(0, 0.5);
151 check_overbegin.set_use_underline(TRUE);
152 check_overend.set_alignment(0, 0.5);
153 check_overend.set_use_underline(TRUE);
154 time_begin.set_alignment(1);
155 time_end.set_alignment(1);
156 timeTable->attach(check_overbegin, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
157 timeTable->attach(time_begin, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
158 timeTable->attach(check_overend, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
159 timeTable->attach(time_end, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
161 check_overbegin.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overbegin_toggle));
162 check_overend.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overend_toggle));
164 Gtk::Button *cancelButton = manage(new Gtk::Button(Gtk::StockID("gtk-cancel")));
165 cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_PreviewOptions::on_cancel_pressed));
166 add_action_widget(*cancelButton, 1);
168 Gtk::Button *okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-go-forward")));
169 okbutton->set_label(_("Preview"));
170 okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_ok_pressed));
171 add_action_widget(*okbutton, 0);
173 time_begin.set_sensitive(false);
174 time_end.set_sensitive(false);
178 Dialog_PreviewOptions::~Dialog_PreviewOptions()
182 void Dialog_PreviewOptions::on_ok_pressed()
187 i.overbegin = get_begin_override();
188 i.overend = get_end_override();
189 if(i.overbegin) i.begintime = (float)get_begintime();
190 if(i.overend) i.endtime = (float)get_endtime();
194 signal_finish_.clear();
198 Dialog_PreviewOptions::on_cancel_pressed()
203 void Dialog_PreviewOptions::on_overbegin_toggle()
205 time_begin.set_sensitive(get_begin_override());
208 void Dialog_PreviewOptions::on_overend_toggle()
210 time_end.set_sensitive(get_end_override());
213 void studio::Dialog_PreviewOptions::set_global_fps(float f)
216 time_begin.set_fps(f);