-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file dialog_preview.cpp
** \brief Preview dialog File
**
-** $Id: dialog_preview.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+** $Id$
**
** \legal
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
** \endlegal
*/
/* ========================================================================= */
#include "dialog_preview.h"
#include "preview.h"
#include <gtkmm/spinbutton.h>
+#include <gtkmm/alignment.h>
+#include <gtkmm/frame.h>
+#include <gtkmm/box.h>
+#include "general.h"
#endif
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
using namespace Gtk;
:Dialog(_("Preview Options"),false,true),
adj_zoom(0.5,0.1,5.0,0.1,0.2),
adj_fps(15,1,120,1,5),
-check_overbegin(_("Begin Time"),false),
-check_overend(_("End Time"),false),
+check_overbegin(_("_Begin Time"),false),
+check_overend(_("_End Time"),false),
settings(this,"prevoptions")
{
//framerate = 15.0f;
//zoom = 0.2f;
-
- //set the fps of the time widgets
- Gtk::Table *ot = manage(new class Gtk::Table);
-
- ot->attach(*manage(new class Gtk::Label(_("Zoom"))),0,1,0,1);
- ot->attach(*manage(new class Gtk::Label(_("FPS"))),1,2,0,1);
-
- ot->attach(*manage(new class Gtk::SpinButton(adj_zoom,0.1,2)),0,1,1,2);
- ot->attach(*manage(new class Gtk::SpinButton(adj_fps,1,1)),1,2,1,2);
-
- ot->attach(check_overbegin,0,1,2,3);
- ot->attach(check_overend,1,2,2,3);
+
+ //set the fps of the time widgets
+ Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
+ dialogPadding->set_padding(12, 12, 12, 12);
+ get_vbox()->add(*dialogPadding);
+
+ Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
+ dialogPadding->add(*dialogBox);
+
+ Gtk::Frame *generalFrame = manage(new Gtk::Frame(_("General Settings")));
+ generalFrame->set_shadow_type(Gtk::SHADOW_NONE);
+ ((Gtk::Label *) generalFrame->get_label_widget())->set_markup(_("<b>General Settings</b>"));
+ dialogBox->pack_start(*generalFrame, false, false, 0);
+
+ Gtk::Alignment *generalPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
+ generalPadding->set_padding(6, 0, 24, 0);
+ generalFrame->add(*generalPadding);
+
+ Gtk::Table *generalTable = manage(new Gtk::Table(2, 2, false));
+ generalTable->set_row_spacings(6);
+ generalTable->set_col_spacings(12);
+ generalPadding->add(*generalTable);
+
+ Gtk::Label *zoomLabel = manage(new Gtk::Label(_("_Zoom")));
+ zoomLabel->set_alignment(0, 0.5);
+ zoomLabel->set_use_underline(TRUE);
+ Gtk::SpinButton *zoomSpinner = manage(new Gtk::SpinButton(adj_zoom, 0.1, 2));
+ zoomLabel->set_mnemonic_widget(*zoomSpinner);
+ zoomSpinner->set_alignment(1);
+ generalTable->attach(*zoomLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+ generalTable->attach(*zoomSpinner, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+
+ Gtk::Label *fpsLabel = manage(new Gtk::Label(_("_Frames per second")));
+ fpsLabel->set_alignment(0, 0.5);
+ fpsLabel->set_use_underline(TRUE);
+ Gtk::SpinButton *fpsSpinner = manage(new Gtk::SpinButton(adj_fps, 1, 1));
+ fpsLabel->set_mnemonic_widget(*fpsSpinner);
+ fpsSpinner->set_alignment(1);
+ generalTable->attach(*fpsLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+ generalTable->attach(*fpsSpinner, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+
+ Gtk::Frame *timeFrame = manage(new Gtk::Frame(_("Time Settings")));
+ timeFrame->set_shadow_type(Gtk::SHADOW_NONE);
+ ((Gtk::Label *) timeFrame->get_label_widget())->set_markup(_("<b>Time Settings</b>"));
+ dialogBox->pack_start(*timeFrame, false, false, 0);
+
+ Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
+ timePadding->set_padding(6, 0, 24, 0);
+ timeFrame->add(*timePadding);
+
+ Gtk::Table *timeTable = manage(new Gtk::Table(2, 2, false));
+ timeTable->set_row_spacings(6);
+ timeTable->set_col_spacings(12);
+ timePadding->add(*timeTable);
+
+ check_overbegin.set_alignment(0, 0.5);
+ check_overbegin.set_use_underline(TRUE);
+ check_overend.set_alignment(0, 0.5);
+ check_overend.set_use_underline(TRUE);
+ time_begin.set_alignment(1);
+ time_end.set_alignment(1);
+ timeTable->attach(check_overbegin, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+ timeTable->attach(time_begin, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+ timeTable->attach(check_overend, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+ timeTable->attach(time_end, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
+
check_overbegin.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overbegin_toggle));
check_overend.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overend_toggle));
-
- ot->attach(time_begin,0,1,3,4);
- ot->attach(time_end,1,2,3,4);
-
- Gtk::Button *okbutton = manage(new Gtk::Button(_("Preview")));
+
+ Gtk::Button *cancelButton = manage(new Gtk::Button(Gtk::StockID("gtk-cancel")));
+ cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_PreviewOptions::on_cancel_pressed));
+ add_action_widget(*cancelButton, 1);
+
+ Gtk::Button *okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-go-forward")));
+ okbutton->set_label(_("Preview"));
okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_ok_pressed));
- ot->attach(*okbutton,0,2,4,5);
-
- ot->show_all();
-
- get_vbox()->pack_start(*ot);
-
+ add_action_widget(*okbutton, 0);
+
time_begin.set_sensitive(false);
time_end.set_sensitive(false);
+ show_all();
}
Dialog_PreviewOptions::~Dialog_PreviewOptions()
i.overend = get_end_override();
if(i.overbegin) i.begintime = (float)get_begintime();
if(i.overend) i.endtime = (float)get_endtime();
-
+
hide();
signal_finish_(i);
signal_finish_.clear();
}
+void
+Dialog_PreviewOptions::on_cancel_pressed()
+{
+ hide();
+}
+
void Dialog_PreviewOptions::on_overbegin_toggle()
{
time_begin.set_sensitive(get_begin_override());
time_end.set_sensitive(get_end_override());
}
-void studio::Dialog_PreviewOptions::set_global_fps(float f)
-{
- globalfps = f;
- time_begin.set_fps(f);
+void studio::Dialog_PreviewOptions::set_global_fps(float f)
+{
+ globalfps = f;
+ time_begin.set_fps(f);
time_end.set_fps(f);
}