From 11ed86e5b0107bd81693d7f00c5aadc5bced3412 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Fri, 26 Feb 2010 21:34:42 +0100 Subject: [PATCH] Basic support for Target Parameters. Non functional yet. --- synfig-studio/src/gtkmm/Makefile.am | 2 + synfig-studio/src/gtkmm/dialog_targetparam.cpp | 104 +++++++++++++++++++++++++ synfig-studio/src/gtkmm/dialog_targetparam.h | 72 +++++++++++++++++ synfig-studio/src/gtkmm/render.cpp | 22 +++++- synfig-studio/src/gtkmm/render.h | 4 + 5 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 synfig-studio/src/gtkmm/dialog_targetparam.cpp create mode 100644 synfig-studio/src/gtkmm/dialog_targetparam.h diff --git a/synfig-studio/src/gtkmm/Makefile.am b/synfig-studio/src/gtkmm/Makefile.am index c5cc73d..384a865 100644 --- a/synfig-studio/src/gtkmm/Makefile.am +++ b/synfig-studio/src/gtkmm/Makefile.am @@ -68,6 +68,7 @@ DIALOG_HH = \ dialog_preview.h \ dialog_setup.h \ dialog_soundselect.h \ + dialog_targetparam.h \ dialog_waypoint.h DIALOG_CC = \ @@ -77,6 +78,7 @@ DIALOG_CC = \ dialog_preview.cpp \ dialog_setup.cpp \ dialog_soundselect.cpp \ + dialog_targetparam.cpp \ dialog_waypoint.cpp diff --git a/synfig-studio/src/gtkmm/dialog_targetparam.cpp b/synfig-studio/src/gtkmm/dialog_targetparam.cpp new file mode 100644 index 0000000..b6231d0 --- /dev/null +++ b/synfig-studio/src/gtkmm/dialog_targetparam.cpp @@ -0,0 +1,104 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_targetparam.cpp +** \brief Implementation for the TargetParam Dialog +** +** $Id$ +** +** \legal +** Copyright (c) 2010 Carlos López González +** +** 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. +** +** 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 +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "dialog_targetparam.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +//using namespace etl; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +/* === E N T R Y P O I N T ================================================= */ + +Dialog_TargetParam::Dialog_TargetParam(synfig::TargetParam &tparam) +{ + set_title("TargetParam Dialog"); + set_tparam(tparam); + // Available Video Codecs Combo Box Text. + vcodec = Gtk::manage(new Gtk::ComboBoxText()); + Gtk::Label* label(manage(new Gtk::Label(_("Available Video Codecs:")))); + label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + get_vbox()->pack_start(*label, true, true, 0); + //vcodec->signal_changed().connect(sigc::mem_fun(*this, &Dialog_TargetParam::on_video_codec_changed)); + vcodec->prepend_text("flv"); + vcodec->prepend_text("h263p"); + vcodec->prepend_text("huffyuv"); + vcodec->prepend_text("libtheora"); + vcodec->prepend_text("libx264"); + vcodec->prepend_text("libxvid"); + vcodec->prepend_text("mjpeg"); + vcodec->prepend_text("mpeg2video"); + vcodec->prepend_text("mpeg4"); + vcodec->prepend_text("msmpeg4"); + vcodec->prepend_text("msmpeg4v1"); + vcodec->prepend_text("msmpeg4v2"); + vcodec->prepend_text("wmv1"); + vcodec->prepend_text("wmv2"); + get_vbox()->pack_start(*vcodec, true, true, 0); + + //Bitrate Spin Button + Gtk::Adjustment* bradj(manage(new class Gtk::Adjustment(double(tparam.bitrate), 10.0,1000.0))); + bitrate = Gtk::manage(new class Gtk::SpinButton(*bradj)); + Gtk::Label* label2(manage(new Gtk::Label(_("Video Bit Rate:")))); + label2->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + get_vbox()->pack_start(*label2, true, true, 0); + get_vbox()->pack_start(*bitrate,true, true, 0); + + get_vbox()->show_all(); + + ok_button = manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))); + ok_button->show(); + add_action_widget(*ok_button,0); + ok_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_ok)); +} + +void +Dialog_TargetParam::on_ok() +{ + hide(); +} + +Dialog_TargetParam::~Dialog_TargetParam() +{ +} diff --git a/synfig-studio/src/gtkmm/dialog_targetparam.h b/synfig-studio/src/gtkmm/dialog_targetparam.h new file mode 100644 index 0000000..87781ce --- /dev/null +++ b/synfig-studio/src/gtkmm/dialog_targetparam.h @@ -0,0 +1,72 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_targetparam.h +** \brief Targetparam Dialog Header +** +** $Id$ +** +** \legal +** Copyright (c) 2010 Carlos López González +** +** 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. +** +** 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 +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_STUDIO_DIALOG_TARGETPARAM_H +#define __SYNFIG_STUDIO_DIALOG_TARGETPARAM_H + +/* === H E A D E R S ======================================================= */ +#include +#include +#include +#include + +#include + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace studio { + +class Dialog_TargetParam : public Gtk::Dialog +{ + synfig::TargetParam tparam_; + Gtk::Button *ok_button; + Gtk::Button *cancelbutton; + Gtk::SpinButton *bitrate; + Gtk::ComboBoxText *vcodec; + + void on_ok(); + void on_cancel(); + //void on_video_codec_changed(); + +public: + Dialog_TargetParam(synfig::TargetParam &tparam); + ~Dialog_TargetParam(); + + synfig::TargetParam get_tparam() const { return tparam_; } + void set_tparam(const synfig::TargetParam &tp) {tparam_=tp; } + +}; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif + + + diff --git a/synfig-studio/src/gtkmm/render.cpp b/synfig-studio/src/gtkmm/render.cpp index cec4215..4caca02 100644 --- a/synfig-studio/src/gtkmm/render.cpp +++ b/synfig-studio/src/gtkmm/render.cpp @@ -37,6 +37,7 @@ #include #include #include "asyncrenderer.h" +#include "dialog_targetparam.h" #include "general.h" @@ -66,7 +67,8 @@ RenderSettings::RenderSettings(Gtk::Window& parent, etl::handleshow(); choose_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_choose_pressed)); + Gtk::Button *tparam_button(manage(new class Gtk::Button(Gtk::StockID(_("Parameters..."))))); + tparam_button->show(); + tparam_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_targetparam_pressed)); + Gtk::Frame *target_frame=manage(new Gtk::Frame(_("Target"))); target_frame->set_shadow_type(Gtk::SHADOW_NONE); ((Gtk::Label *) target_frame->get_label_widget())->set_markup(_("Target")); @@ -128,7 +134,8 @@ RenderSettings::RenderSettings(Gtk::Window& parent, etl::handleset_alignment(0, 0.5); targetLabel->set_mnemonic_widget(optionmenu_target); target_table->attach(*targetLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - target_table->attach(optionmenu_target, 1, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + target_table->attach(optionmenu_target, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + target_table->attach(*tparam_button, 2, 3, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); toggle_single_frame.signal_toggled().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_single_frame_toggle)); @@ -239,6 +246,15 @@ RenderSettings::on_choose_pressed() } void +RenderSettings::on_targetparam_pressed() +{ + Dialog_TargetParam *dialogtp = new Dialog_TargetParam(tparam); + if(dialogtp->run()==GTK_RESPONSE_ACCEPT) + tparam=dialogtp->get_tparam(); + delete dialogtp; +} + +void RenderSettings::on_render_pressed() { String filename=entry_filename.get_text(); @@ -283,7 +299,7 @@ RenderSettings::on_render_pressed() return; } - Target::Handle target=Target::create(calculated_target_name,filename); + Target::Handle target=Target::create(calculated_target_name,filename, tparam); if(!target) { canvas_interface_->get_ui_interface()->error(_("Unable to create target for ")+filename); diff --git a/synfig-studio/src/gtkmm/render.h b/synfig-studio/src/gtkmm/render.h index 0a6263a..729251b 100644 --- a/synfig-studio/src/gtkmm/render.h +++ b/synfig-studio/src/gtkmm/render.h @@ -39,6 +39,7 @@ #include #include +#include #include @@ -80,6 +81,8 @@ class RenderSettings : public Gtk::Dialog etl::handle async_renderer; + synfig::TargetParam tparam; + public: RenderSettings(Gtk::Window& parent,etl::handle canvas_interface); ~RenderSettings(); @@ -92,6 +95,7 @@ private: void on_choose_pressed(); void on_render_pressed(); void on_cancel_pressed(); + void on_targetparam_pressed(); void on_finished(); }; // END of class RenderSettings -- 2.7.4