From 76ba27a6690b007a956b56ba4c537c952c8c4889 Mon Sep 17 00:00:00 2001 From: Nikita Kitaev Date: Fri, 16 Apr 2010 17:35:57 -0700 Subject: [PATCH] Move dialogs into subfolder --- synfig-studio/src/gui/Makefile.am | 44 +- synfig-studio/src/gui/about.cpp | 248 ------ synfig-studio/src/gui/about.h | 55 -- synfig-studio/src/gui/app.cpp | 8 +- synfig-studio/src/gui/canvasoptions.cpp | 215 ------ synfig-studio/src/gui/canvasoptions.h | 82 -- synfig-studio/src/gui/canvasproperties.cpp | 255 ------- synfig-studio/src/gui/canvasproperties.h | 87 --- synfig-studio/src/gui/canvasview.cpp | 6 +- synfig-studio/src/gui/canvasview.h | 8 +- synfig-studio/src/gui/cellrenderer_value.cpp | 4 +- synfig-studio/src/gui/dialog_color.cpp | 155 ---- synfig-studio/src/gui/dialog_color.h | 88 --- synfig-studio/src/gui/dialog_gradient.cpp | 185 ----- synfig-studio/src/gui/dialog_gradient.h | 115 --- synfig-studio/src/gui/dialog_keyframe.cpp | 166 ---- synfig-studio/src/gui/dialog_keyframe.h | 79 -- synfig-studio/src/gui/dialog_preview.cpp | 220 ------ synfig-studio/src/gui/dialog_preview.h | 132 ---- synfig-studio/src/gui/dialog_setup.cpp | 839 --------------------- synfig-studio/src/gui/dialog_setup.h | 222 ------ synfig-studio/src/gui/dialog_soundselect.cpp | 129 ---- synfig-studio/src/gui/dialog_soundselect.h | 86 --- synfig-studio/src/gui/dialog_targetparam.cpp | 150 ---- synfig-studio/src/gui/dialog_targetparam.h | 71 -- synfig-studio/src/gui/dialog_waypoint.cpp | 141 ---- synfig-studio/src/gui/dialog_waypoint.h | 109 --- synfig-studio/src/gui/dialogs/about.cpp | 248 ++++++ synfig-studio/src/gui/dialogs/about.h | 55 ++ synfig-studio/src/gui/dialogs/canvasoptions.cpp | 215 ++++++ synfig-studio/src/gui/dialogs/canvasoptions.h | 82 ++ synfig-studio/src/gui/dialogs/canvasproperties.cpp | 255 +++++++ synfig-studio/src/gui/dialogs/canvasproperties.h | 87 +++ synfig-studio/src/gui/dialogs/dialog_color.cpp | 155 ++++ synfig-studio/src/gui/dialogs/dialog_color.h | 88 +++ synfig-studio/src/gui/dialogs/dialog_gradient.cpp | 185 +++++ synfig-studio/src/gui/dialogs/dialog_gradient.h | 115 +++ synfig-studio/src/gui/dialogs/dialog_keyframe.cpp | 166 ++++ synfig-studio/src/gui/dialogs/dialog_keyframe.h | 79 ++ synfig-studio/src/gui/dialogs/dialog_preview.cpp | 220 ++++++ synfig-studio/src/gui/dialogs/dialog_preview.h | 132 ++++ synfig-studio/src/gui/dialogs/dialog_setup.cpp | 839 +++++++++++++++++++++ synfig-studio/src/gui/dialogs/dialog_setup.h | 222 ++++++ .../src/gui/dialogs/dialog_soundselect.cpp | 129 ++++ synfig-studio/src/gui/dialogs/dialog_soundselect.h | 86 +++ .../src/gui/dialogs/dialog_targetparam.cpp | 150 ++++ synfig-studio/src/gui/dialogs/dialog_targetparam.h | 71 ++ synfig-studio/src/gui/dialogs/dialog_waypoint.cpp | 141 ++++ synfig-studio/src/gui/dialogs/dialog_waypoint.h | 109 +++ .../src/gui/modules/mod_palette/dock_paledit.cpp | 2 +- synfig-studio/src/gui/render.cpp | 2 +- synfig-studio/src/gui/state_eyedrop.cpp | 2 +- synfig-studio/src/gui/state_fill.cpp | 2 +- synfig-studio/src/gui/toolbox.cpp | 6 +- synfig-studio/src/gui/widget_defaults.cpp | 4 +- synfig-studio/src/gui/widget_waypoint.cpp | 2 +- 56 files changed, 3874 insertions(+), 3874 deletions(-) delete mode 100644 synfig-studio/src/gui/about.cpp delete mode 100644 synfig-studio/src/gui/about.h delete mode 100644 synfig-studio/src/gui/canvasoptions.cpp delete mode 100644 synfig-studio/src/gui/canvasoptions.h delete mode 100644 synfig-studio/src/gui/canvasproperties.cpp delete mode 100644 synfig-studio/src/gui/canvasproperties.h delete mode 100644 synfig-studio/src/gui/dialog_color.cpp delete mode 100644 synfig-studio/src/gui/dialog_color.h delete mode 100644 synfig-studio/src/gui/dialog_gradient.cpp delete mode 100644 synfig-studio/src/gui/dialog_gradient.h delete mode 100644 synfig-studio/src/gui/dialog_keyframe.cpp delete mode 100644 synfig-studio/src/gui/dialog_keyframe.h delete mode 100644 synfig-studio/src/gui/dialog_preview.cpp delete mode 100644 synfig-studio/src/gui/dialog_preview.h delete mode 100644 synfig-studio/src/gui/dialog_setup.cpp delete mode 100644 synfig-studio/src/gui/dialog_setup.h delete mode 100644 synfig-studio/src/gui/dialog_soundselect.cpp delete mode 100644 synfig-studio/src/gui/dialog_soundselect.h delete mode 100644 synfig-studio/src/gui/dialog_targetparam.cpp delete mode 100644 synfig-studio/src/gui/dialog_targetparam.h delete mode 100644 synfig-studio/src/gui/dialog_waypoint.cpp delete mode 100644 synfig-studio/src/gui/dialog_waypoint.h create mode 100644 synfig-studio/src/gui/dialogs/about.cpp create mode 100644 synfig-studio/src/gui/dialogs/about.h create mode 100644 synfig-studio/src/gui/dialogs/canvasoptions.cpp create mode 100644 synfig-studio/src/gui/dialogs/canvasoptions.h create mode 100644 synfig-studio/src/gui/dialogs/canvasproperties.cpp create mode 100644 synfig-studio/src/gui/dialogs/canvasproperties.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_color.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_color.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_gradient.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_gradient.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_keyframe.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_keyframe.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_preview.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_preview.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_setup.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_setup.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_soundselect.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_soundselect.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_targetparam.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_targetparam.h create mode 100644 synfig-studio/src/gui/dialogs/dialog_waypoint.cpp create mode 100644 synfig-studio/src/gui/dialogs/dialog_waypoint.h diff --git a/synfig-studio/src/gui/Makefile.am b/synfig-studio/src/gui/Makefile.am index def8451..5fcced4 100644 --- a/synfig-studio/src/gui/Makefile.am +++ b/synfig-studio/src/gui/Makefile.am @@ -53,24 +53,24 @@ PALETTE_CC = \ DIALOG_HH = \ - dialog_color.h \ - dialog_gradient.h \ - dialog_keyframe.h \ - dialog_preview.h \ - dialog_setup.h \ - dialog_soundselect.h \ - dialog_targetparam.h \ - dialog_waypoint.h + dialogs/dialog_color.h \ + dialogs/dialog_gradient.h \ + dialogs/dialog_keyframe.h \ + dialogs/dialog_preview.h \ + dialogs/dialog_setup.h \ + dialogs/dialog_soundselect.h \ + dialogs/dialog_targetparam.h \ + dialogs/dialog_waypoint.h DIALOG_CC = \ - dialog_color.cpp \ - dialog_gradient.cpp \ - dialog_keyframe.cpp \ - dialog_preview.cpp \ - dialog_setup.cpp \ - dialog_soundselect.cpp \ - dialog_targetparam.cpp \ - dialog_waypoint.cpp + dialogs/dialog_color.cpp \ + dialogs/dialog_gradient.cpp \ + dialogs/dialog_keyframe.cpp \ + dialogs/dialog_preview.cpp \ + dialogs/dialog_setup.cpp \ + dialogs/dialog_soundselect.cpp \ + dialogs/dialog_targetparam.cpp \ + dialogs/dialog_waypoint.cpp DOCK_HH = \ @@ -262,14 +262,14 @@ OTHER_HH = \ compview.h \ eventkey.h \ smach.h \ - about.h \ + dialogs/about.h \ adjust_window.h \ app.h \ asyncrenderer.h \ audiocontainer.h \ autorecover.h \ - canvasoptions.h \ - canvasproperties.h \ + dialogs/canvasoptions.h \ + dialogs/canvasproperties.h \ canvasview.h \ devicetracker.h \ dialogsettings.h \ @@ -297,14 +297,14 @@ OTHER_HH = \ OTHER_CC = \ main.cpp \ - about.cpp \ + dialogs/about.cpp \ adjust_window.cpp \ app.cpp \ asyncrenderer.cpp \ audiocontainer.cpp \ autorecover.cpp \ - canvasoptions.cpp \ - canvasproperties.cpp \ + dialogs/canvasoptions.cpp \ + dialogs/canvasproperties.cpp \ canvasview.cpp \ devicetracker.cpp \ dialogsettings.cpp \ diff --git a/synfig-studio/src/gui/about.cpp b/synfig-studio/src/gui/about.cpp deleted file mode 100644 index 600d135..0000000 --- a/synfig-studio/src/gui/about.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file about.cpp -** \brief About dialog implementation -** -** $Id$ -** -** \legal -** Copyright (c) 2008 Paul Wise -** -** 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 - -#include - -#include - -#include - -#include - -// This is generated at make time from .svn or .git/svn or autorevision.conf -#include - -#include "about.h" -#include "app.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 ========================================================= */ - -#ifndef VERSION -#define VERSION "unknown" -#define PACKAGE "synfigstudio" -#endif - -#ifdef WIN32 -# ifdef IMAGE_DIR -# undef IMAGE_DIR -# define IMAGE_DIR "share\\pixmaps" -# endif -#endif - -#ifndef IMAGE_DIR -# define IMAGE_DIR "/usr/local/share/pixmaps" -#endif - -#ifndef IMAGE_EXT -# define IMAGE_EXT "png" -#endif - -#define stringify_(x) #x -#define stringify(x) stringify_(x) - -/* === G L O B A L S ======================================================= */ - -extern const guint gtk_major_version; -extern const guint gtk_minor_version; -extern const guint gtk_micro_version; -extern const guint gtk_binary_age; -extern const guint gtk_interface_age; - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -About::About() -{ - -#ifdef HAVE_GTK_ABOUTDIALOG_SET_PROGRAM_NAME - set_program_name(PACKAGE_NAME); -#else - set_name(PACKAGE_NAME); -#endif - set_version(VERSION); - set_comments(_("2D vector animation studio")); - - set_url_hook(sigc::mem_fun(*this, &About::on_link_clicked)); - set_website("http://www.synfig.org/"); - set_website_label(_("Visit the Synfig website")); - - set_copyright(_("Copyright 2001-2008\nRobert B. Quattlebaum Jr.,\nAdrian Bentley and Synfig contributors")); - Glib::ustring license = - "This program 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.\n\n" - - "This program 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.\n\n" - - "You should have received a copy of the GNU General Public License along " - "with this program; if not, write to the Free Software Foundation, Inc., " - "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or visit: http://www.gnu.org/"; - set_license(license); -#ifdef HAVE_GTK_ABOUTDIALOG_SET_WRAP_LICENSE - set_wrap_license(true); -#endif - - std::vector authors; - authors.push_back(_("Original developers:")); - authors.push_back(""); - authors.push_back("Robert B. Quattlebaum Jr (darco)"); - authors.push_back("Adrian Bentley"); - authors.push_back(""); - authors.push_back(_("Contributors:")); - authors.push_back(""); - authors.push_back("Adrian Winchell (SnapSilverlight)"); - authors.push_back("Andreas Jochens"); - authors.push_back("Carlos López González (genete)"); - authors.push_back("Carlos A. Sosa Navarro"); - authors.push_back("Chris Moore (dooglus)"); - authors.push_back("Chris Norman (pixelgeek)"); - authors.push_back("Cyril Brulebois (KiBi)"); - authors.push_back("Daniel Fort"); - authors.push_back("Daniel Hornung (rubikcube)"); - authors.push_back("David Roden (Bombe)"); - authors.push_back("Dmitriy Pomerantsev (Atrus)"); - authors.push_back("Douglas Lau"); - authors.push_back("Gerald Young (Yoyobuae)"); - authors.push_back("Gerco Ballintijn"); - authors.push_back("IL'dar AKHmetgaleev (AkhIL)"); - authors.push_back("Konstantin Dmitriev (zelgadis)"); - authors.push_back("Luka Pravica"); - authors.push_back("Martin Michlmayr (tbm)"); - authors.push_back("Miguel Gea Milvaques (xerakko)"); - authors.push_back("Paul Wise (pabs)"); - authors.push_back("Ralf Corsepius"); - authors.push_back("Ray Frederikson"); - authors.push_back("Timo Paulssen (timonator)"); - authors.push_back("Yue Shi Lai"); - set_authors(authors); - - std::vector artists; - artists.push_back("Aurore D (rore)"); - artists.push_back("Carlos López González (genete)"); - artists.push_back("Chris Norman (pixelgeek)"); - artists.push_back("Daniel Hornung (rubikcube)"); - artists.push_back("David Rylander (rylleman)"); - artists.push_back("Franco Iacomella (Yaco)"); - artists.push_back("Gerald Young (Yoyobuae)"); - artists.push_back("Henrique Lopes Barone"); - artists.push_back("Robert B. Quattlebaum Jr. (darco)"); - - set_artists(artists); - - // TRANSLATORS: change this to your name, separate multiple names with \n - set_translator_credits(_("translator-credits")); - - std::string imagepath; -#ifdef WIN32 - imagepath=App::get_base_path()+ETL_DIRECTORY_SEPARATOR+IMAGE_DIR; -#else - imagepath=IMAGE_DIR; -#endif - char* synfig_root=getenv("SYNFIG_ROOT"); - if(synfig_root) { - imagepath=synfig_root; - imagepath+=ETL_DIRECTORY_SEPARATOR; - imagepath+="share"; - imagepath+=ETL_DIRECTORY_SEPARATOR; - imagepath+="pixmaps"; - } - imagepath+=ETL_DIRECTORY_SEPARATOR; - - Gtk::Image *Logo = manage(new class Gtk::Image()); - Logo->set(imagepath+"synfig_icon."IMAGE_EXT); - set_logo(Logo->get_pixbuf()); - -#ifdef SHOW_EXTRA_INFO - - string extra_info = get_comments() + "\n"; - - #ifdef DEVEL_VERSION - extra_info += strprintf(_("\nDevelopment version:\n%s\n"),DEVEL_VERSION); - #endif - - extra_info += "\n"; - - extra_info += strprintf(_("Built on %s" /* at %s */ "\n"), __DATE__ /* , __TIME__ */ ); - - extra_info += "\n"; - - extra_info += strprintf(_("Built with:\n"), ETL_VERSION); - extra_info += strprintf(_("ETL %s\n"), ETL_VERSION); - extra_info += strprintf(_("Synfig API %s\n"), stringify(SYNFIG_VERSION)); - extra_info += strprintf(_("Synfig library %d\n"), SYNFIG_LIBRARY_VERSION); - extra_info += strprintf(_("GTK+ %d.%d.%d\n"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); - #ifdef __GNUC__ - extra_info += strprintf(_("GNU G++ %d.%d.%d\n"),__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__); - #endif - - extra_info += "\n"; - - extra_info += strprintf(_("Using:\n"), synfig::get_version()); - extra_info += strprintf(_("Synfig %s\n"), synfig::get_version()); - extra_info += strprintf(_("GTK+ %d.%d.%d"),gtk_major_version,gtk_minor_version,gtk_micro_version); - - #ifdef _DEBUG - extra_info += "\n\nDEBUG BUILD"; - #endif - - set_comments(extra_info); - -#endif - - // Hide the dialog when you click close - signal_response().connect(sigc::mem_fun(*this, &About::close)); -} - -void About::close(int){ - hide(); -} - -void About::on_link_clicked(Gtk::AboutDialog&, const Glib::ustring &url) -{ - App::open_url(url); -} diff --git a/synfig-studio/src/gui/about.h b/synfig-studio/src/gui/about.h deleted file mode 100644 index f00a773..0000000 --- a/synfig-studio/src/gui/about.h +++ /dev/null @@ -1,55 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file about.h -** \brief About dialog class -** -** $Id$ -** -** \legal -** Copyright (c) 2008 Paul Wise -** -** 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_GTKMM_ABOUT_H -#define __SYNFIG_GTKMM_ABOUT_H - -/* === H E A D E R S ======================================================= */ - -#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 About : public Gtk::AboutDialog -{ -public: - - About(); - void close(int); - void on_link_clicked(Gtk::AboutDialog&, const Glib::ustring &url); -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/app.cpp b/synfig-studio/src/gui/app.cpp index 9f2fa22..d3378f1 100644 --- a/synfig-studio/src/gui/app.cpp +++ b/synfig-studio/src/gui/app.cpp @@ -66,13 +66,13 @@ #include #include "app.h" -#include "about.h" +#include "dialogs/about.h" #include "splash.h" #include "instance.h" #include "canvasview.h" -#include "dialog_setup.h" -#include "dialog_gradient.h" -#include "dialog_color.h" +#include "dialogs/dialog_setup.h" +#include "dialogs/dialog_gradient.h" +#include "dialogs/dialog_color.h" #include "toolbox.h" #include "onemoment.h" diff --git a/synfig-studio/src/gui/canvasoptions.cpp b/synfig-studio/src/gui/canvasoptions.cpp deleted file mode 100644 index dfc15ed..0000000 --- a/synfig-studio/src/gui/canvasoptions.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasoptions.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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 "canvasoptions.h" -#include -#include -#include -#include -#include -#include "canvasview.h" -#include "workarea.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -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 ======================================================= */ - -CanvasOptions::CanvasOptions(etl::loose_handle canvas_view): - Gtk::Dialog(_("Canvas Options"),*canvas_view,false,true), - canvas_view_(canvas_view), - toggle_grid_snap(_("_Snap to grid"), true), - toggle_grid_show(_("S_how grid"), true), - toggle_time_snap(_("Snap to _frame"), true) -{ - vector_grid_size.set_canvas(canvas_view->get_canvas()); - - Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - dialogPadding->set_padding(12, 12, 12, 12); - - Gtk::Notebook *notebook=manage(new class Gtk::Notebook()); - dialogPadding->add(*notebook); - - toggle_grid_snap.signal_toggled().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_grid_snap_toggle)); - toggle_grid_show.signal_toggled().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_grid_show_toggle)); - - Gtk::Alignment *gridPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - gridPadding->set_padding(12, 12, 12, 12); - notebook->append_page(*gridPadding, _("Grid")); - - Gtk::VBox *gridBox = manage(new Gtk::VBox(false, 12)); - gridPadding->add(*gridBox); - - Gtk::Table *gridTable = manage(new Gtk::Table(3, 2, false)); - gridTable->set_row_spacings(6); - gridTable->set_col_spacings(12); - gridBox->pack_start(*gridTable, false, false, 0); - - Gtk::Label *gridSizeLabel = manage(new Gtk::Label(_("_Grid size"), true)); - gridSizeLabel->set_alignment(0, 0.5); - gridSizeLabel->set_mnemonic_widget(vector_grid_size); - - toggle_grid_show.set_alignment(0, 0.5); - toggle_grid_snap.set_alignment(0, 0.5); - - gridTable->attach(*gridSizeLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - gridTable->attach(vector_grid_size, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - gridTable->attach(toggle_grid_show, 0, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - gridTable->attach(toggle_grid_snap, 0, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - - Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - timePadding->set_padding(12, 12, 12, 12); - notebook->append_page(*timePadding, _("Time")); - - Gtk::VBox *timeBox = manage(new Gtk::VBox(false, 12)); - timePadding->add(*timeBox); - - timeBox->pack_start(toggle_time_snap, false, false, 0); - - Gtk::Alignment *unitPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - unitPadding->set_padding(12, 12, 12, 12); - notebook->append_page(*unitPadding, _("Units")); - unitPadding->add(*manage(new Gtk::Label(_("Not yet implemented!")))); - - Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); - ok_button->show(); - add_action_widget(*ok_button,2); - ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_ok_pressed)); - - Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); - apply_button->show(); - add_action_widget(*apply_button,1); - apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_apply_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_cancel_pressed)); - - //set_default_response(1); - - - get_vbox()->pack_start(*dialogPadding); - get_vbox()->show_all(); - - signal_show().connect(sigc::mem_fun(*this, &studio::CanvasOptions::refresh)); - - vector_grid_size.set_digits(5); - - update_title(); -} - -CanvasOptions::~CanvasOptions() -{ -} - -void -CanvasOptions::update_title() -{ - set_title(_("Options")+String(" - ")+canvas_view_->get_canvas()->get_name()); -} - -void -CanvasOptions::refresh() -{ - if(canvas_view_->work_area->grid_status()) - toggle_grid_show.set_active(true); - else - toggle_grid_show.set_active(false); - - if(canvas_view_->work_area->get_grid_snap()) - toggle_grid_snap.set_active(true); - else - toggle_grid_snap.set_active(false); - - vector_grid_size.set_value(canvas_view_->work_area->get_grid_size()); - - tooltips.set_tip(toggle_time_snap,_("Not yet implemented")); - toggle_time_snap.set_sensitive(false); - - update_title(); -} - -void -CanvasOptions::on_grid_snap_toggle() -{ -} - -void -CanvasOptions::on_grid_show_toggle() -{ -} - -void -CanvasOptions::on_apply_pressed() -{ - canvas_view_->set_grid_snap_toggle(toggle_grid_snap.get_active()); - if(toggle_grid_snap.get_active()) - canvas_view_->work_area->enable_grid_snap(); - else - canvas_view_->work_area->disable_grid_snap(); - - canvas_view_->set_grid_show_toggle(toggle_grid_show.get_active()); - if(toggle_grid_show.get_active()) - canvas_view_->work_area->enable_grid(); - else - canvas_view_->work_area->disable_grid(); - - canvas_view_->work_area->set_grid_size(vector_grid_size.get_value()); -} - -void -CanvasOptions::on_ok_pressed() -{ - on_apply_pressed(); - hide(); -} - -void -CanvasOptions::on_cancel_pressed() -{ - refresh(); - hide(); -} diff --git a/synfig-studio/src/gui/canvasoptions.h b/synfig-studio/src/gui/canvasoptions.h deleted file mode 100644 index 452ab3f..0000000 --- a/synfig-studio/src/gui/canvasoptions.h +++ /dev/null @@ -1,82 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasoptions.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_GTKMM_CANVASOPTIONS_H -#define __SYNFIG_GTKMM_CANVASOPTIONS_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include -#include "widget_value.h" -#include "widget_vector.h" - -/* === 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 CanvasView; - -class CanvasOptions : public Gtk::Dialog -{ - Gtk::Tooltips tooltips; - - etl::loose_handle canvas_view_; - - Gtk::CheckButton toggle_grid_snap; - Gtk::CheckButton toggle_grid_show; - - Widget_Vector vector_grid_size; - - Gtk::CheckButton toggle_time_snap; - -public: - CanvasOptions(etl::loose_handle canvas_view); - ~CanvasOptions(); - - void refresh(); - void update_title(); -private: - - void on_grid_snap_toggle(); - void on_grid_show_toggle(); - - void on_ok_pressed(); - void on_apply_pressed(); - void on_cancel_pressed(); -}; // END of class CanvasOptions - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/canvasproperties.cpp b/synfig-studio/src/gui/canvasproperties.cpp deleted file mode 100644 index d095331..0000000 --- a/synfig-studio/src/gui/canvasproperties.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasproperties.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** -** 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 "canvasproperties.h" -#include -#include -#include -#include -#include -#include "metadatatreestore.h" -#include -#include -#include "app.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -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 ======================================================= */ - -CanvasProperties::CanvasProperties(Gtk::Window& parent,etl::handle canvas_interface): - Gtk::Dialog(_("Canvas Properties"),parent,false,true), - canvas_interface_(canvas_interface) -{ - widget_rend_desc.show(); - widget_rend_desc.signal_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::on_rend_desc_changed)); - - Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - dialogPadding->set_padding(12, 12, 12, 12); - get_vbox()->pack_start(*dialogPadding, false, false, 0); - - Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12)); - dialogPadding->add(*dialogBox); - - Gtk::Frame *info_frame=manage(new Gtk::Frame(_("Canvas Info"))); - info_frame->set_shadow_type(Gtk::SHADOW_NONE); - ((Gtk::Label *) info_frame->get_label_widget())->set_markup(_("Canvas Info")); - dialogBox->pack_start(*info_frame, false, false, 0); - - Gtk::Alignment *infoPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - infoPadding->set_padding(6, 0, 24, 0); - info_frame->add(*infoPadding); - - Gtk::Table *info_table=manage(new Gtk::Table(2,2,false)); - info_table->set_row_spacings(6); - info_table->set_col_spacings(12); - infoPadding->add(*info_table); - - // The root canvas doesn't have an ID, so don't - // display it if this is a root canvas. - if(!canvas_interface_->get_canvas()->is_root()) - { - Gtk::Label *idLabel = manage(new Gtk::Label(_("_ID"), true)); - idLabel->set_alignment(0, 0.5); - idLabel->set_mnemonic_widget(entry_id); - info_table->attach(*idLabel, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(entry_id, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - } - Gtk::Label *nameLabel = manage(new Gtk::Label(_("_Name"), true)); - nameLabel->set_alignment(0, 0.5); - nameLabel->set_mnemonic_widget(entry_name); - Gtk::Label *descriptionLabel = manage(new Gtk::Label(_("_Description"), true)); - descriptionLabel->set_alignment(0, 0.5); - descriptionLabel->set_mnemonic_widget(entry_description); - info_table->attach(*nameLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(*descriptionLabel, 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(entry_name, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(entry_description, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - dialogBox->pack_start(widget_rend_desc, false, false, 0); - - canvas_interface_->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh)); - canvas_interface_->signal_id_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh)); - - Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); - ok_button->show(); - add_action_widget(*ok_button,2); - ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_ok_pressed)); - - Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); - apply_button->show(); - add_action_widget(*apply_button,1); - apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_apply_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_cancel_pressed)); - - //set_default_response(1); - - get_vbox()->show_all(); - refresh(); - - update_title(); -} - -Gtk::Widget& -CanvasProperties::create_meta_data_view() -{ - MetaDataTreeStore::Model model; - meta_data_tree_view=(manage(new class Gtk::TreeView())); - - meta_data_tree_view->append_column(_("Key"),model.key); - meta_data_tree_view->append_column_editable(_("Data"),model.data); - meta_data_tree_view->set_model(MetaDataTreeStore::create(canvas_interface_)); - meta_data_tree_view->set_rules_hint(); - meta_data_tree_view->show(); - - Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); - scrolledwindow->set_flags(Gtk::CAN_FOCUS); - scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - scrolledwindow->add(*meta_data_tree_view); - scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - scrolledwindow->show(); - - - - Gtk::Table *table=manage(new Gtk::Table()); - table->attach(*scrolledwindow, 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - - Gtk::Button* button_add(manage(new Gtk::Button(Gtk::StockID("gtk-add")))); - button_add->show(); - button_add->signal_clicked().connect(sigc::mem_fun(*this,&CanvasProperties::on_button_meta_data_add)); - table->attach(*button_add, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - Gtk::Button* button_delete(manage(new Gtk::Button(Gtk::StockID("gtk-delete")))); - button_delete->show(); - button_delete->signal_clicked().connect(sigc::mem_fun(*this,&CanvasProperties::on_button_meta_data_delete)); - table->attach(*button_delete, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - table->show(); - return *table; -} - -void -CanvasProperties::on_button_meta_data_add() -{ - synfig::String key; - if(App::dialog_entry(_("New MetaData Entry"), _("Please enter the name of the key"),key) && !key.empty()) - { - canvas_interface_->set_meta_data(key," "); - } - -} - -void -CanvasProperties::on_button_meta_data_delete() -{ -} - -void -CanvasProperties::update_title() -{ - set_title(_("Properties")+String(" - ")+canvas_interface_->get_canvas()->get_name()); -} - -void -CanvasProperties::refresh() -{ - widget_rend_desc.set_rend_desc(canvas_interface_->get_canvas()->rend_desc()); - entry_id.set_text(canvas_interface_->get_canvas()->get_id()); - entry_name.set_text(canvas_interface_->get_canvas()->get_name()); - entry_description.set_text(canvas_interface_->get_canvas()->get_description()); - - dirty_rend_desc=false; - - update_title(); -} - -CanvasProperties::~CanvasProperties() -{ -} - -void -CanvasProperties::on_rend_desc_changed() -{ - dirty_rend_desc=true; -} - -void -CanvasProperties::on_apply_pressed() -{ - synfigapp::Action::PassiveGrouper group(canvas_interface_->get_instance().get(),_("Edit Canvas Properties")); - - // fetch these three values first, because each set_() method refreshes the dialog with currently set values - String id = entry_id.get_text(); - String name = entry_name.get_text(); - String description = entry_description.get_text(); - - // do this first, because the other three cause the dialog to be refreshed with currently set values - if (dirty_rend_desc) canvas_interface_->set_rend_desc(widget_rend_desc.get_rend_desc()); - - if (id != canvas_interface_->get_canvas()->get_id() && !id.empty()) canvas_interface_->set_id(id); - if (name != canvas_interface_->get_canvas()->get_name()) canvas_interface_->set_name(name); - if (description != canvas_interface_->get_canvas()->get_description()) canvas_interface_->set_description(description); - - dirty_rend_desc=false; -} - -void -CanvasProperties::on_ok_pressed() -{ - on_apply_pressed(); - hide(); -} - -void -CanvasProperties::on_cancel_pressed() -{ - refresh(); - hide(); -} diff --git a/synfig-studio/src/gui/canvasproperties.h b/synfig-studio/src/gui/canvasproperties.h deleted file mode 100644 index 3a32d40..0000000 --- a/synfig-studio/src/gui/canvasproperties.h +++ /dev/null @@ -1,87 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasproperties.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_GTKMM_CANVASPROPERTIES_H -#define __SYNFIG_GTKMM_CANVASPROPERTIES_H - -/* === H E A D E R S ======================================================= */ - -#include - -#include -#include -#include -#include -#include - -#include "renddesc.h" - -/* === 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 Gtk { class TreeView; }; -namespace synfigapp { class CanvasInterface; }; - -namespace studio -{ -class CanvasProperties : public Gtk::Dialog -{ - Gtk::Tooltips tooltips; - - etl::handle canvas_interface_; - Widget_RendDesc widget_rend_desc; - Gtk::Entry entry_id; - Gtk::Entry entry_name; - Gtk::Entry entry_description; - - bool dirty_rend_desc; - - Gtk::TreeView* meta_data_tree_view; - void on_button_meta_data_add(); - void on_button_meta_data_delete(); - -public: - CanvasProperties(Gtk::Window& parent,etl::handle canvas_interface); - ~CanvasProperties(); - - void refresh(); - void update_title(); -private: - void on_rend_desc_changed(); - - Gtk::Widget& create_meta_data_view(); - - void on_ok_pressed(); - void on_apply_pressed(); - void on_cancel_pressed(); -}; // END of class CanvasProperties - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/canvasview.cpp b/synfig-studio/src/gui/canvasview.cpp index ffa7f6c..2193902 100644 --- a/synfig-studio/src/gui/canvasview.cpp +++ b/synfig-studio/src/gui/canvasview.cpp @@ -80,7 +80,7 @@ #include "cellrenderer_value.h" #include "cellrenderer_timetrack.h" #include "workarea.h" -#include "dialog_color.h" +#include "dialogs/dialog_color.h" #include "eventkey.h" #include "state_polygon.h" @@ -97,8 +97,8 @@ #include "toolbox.h" -#include "dialog_preview.h" -#include "dialog_soundselect.h" +#include "dialogs/dialog_preview.h" +#include "dialogs/dialog_soundselect.h" #include "preview.h" #include "audiocontainer.h" diff --git a/synfig-studio/src/gui/canvasview.h b/synfig-studio/src/gui/canvasview.h index 11005d3..0adeebd 100644 --- a/synfig-studio/src/gui/canvasview.h +++ b/synfig-studio/src/gui/canvasview.h @@ -52,8 +52,8 @@ #include #include "instance.h" -#include "canvasproperties.h" -#include "canvasoptions.h" +#include "dialogs/canvasproperties.h" +#include "dialogs/canvasoptions.h" #include "render.h" #include "cellrenderer_timetrack.h" #include "app.h" @@ -65,8 +65,8 @@ #include "keyframetreestore.h" #include "keyframetree.h" -#include "dialog_waypoint.h" -#include "dialog_keyframe.h" +#include "dialogs/dialog_waypoint.h" +#include "dialogs/dialog_keyframe.h" #include "framedial.h" #include "toggleducksdial.h" #include "resolutiondial.h" diff --git a/synfig-studio/src/gui/cellrenderer_value.cpp b/synfig-studio/src/gui/cellrenderer_value.cpp index f0403fd..252867c 100644 --- a/synfig-studio/src/gui/cellrenderer_value.cpp +++ b/synfig-studio/src/gui/cellrenderer_value.cpp @@ -51,8 +51,8 @@ #include "cellrenderer_value.h" #include "widget_gradient.h" -#include "dialog_gradient.h" -#include "dialog_color.h" +#include "dialogs/dialog_gradient.h" +#include "dialogs/dialog_color.h" #include #include "general.h" diff --git a/synfig-studio/src/gui/dialog_color.cpp b/synfig-studio/src/gui/dialog_color.cpp deleted file mode 100644 index 6953a75..0000000 --- a/synfig-studio/src/gui/dialog_color.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_color.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_color.h" -#include "widget_color.h" -#include -#include -#include -#include "app.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -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 ======================================================= */ - -Dialog_Color::Dialog_Color(): - Dialog(_("Colors"), false, true), - dialog_settings(this, "color"), - busy_(false) -{ - set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); - - create_color_edit_widget(); - create_set_color_button("synfig-set_outline_color", _("Set as Outline"), 0, - sigc::mem_fun(*this, &Dialog_Color::on_set_oc_pressed)); - create_set_color_button("synfig-set_fill_color", _("Set as Fill"), 1, - sigc::mem_fun(*this, &Dialog_Color::on_set_fc_pressed)); - create_close_button(); - - add_accel_group(App::ui_manager()->get_accel_group()); - show_all_children(); -} - -Dialog_Color::~Dialog_Color() -{ -} - -void -Dialog_Color::create_color_edit_widget() -{ - color_edit_widget = manage(new Widget_ColorEdit()); - color_edit_widget->signal_value_changed().connect(sigc::mem_fun(*this, - &studio::Dialog_Color::on_color_changed)); - get_vbox()->pack_start(*color_edit_widget); -} - -void -Dialog_Color::create_set_color_button(const char *stock_id, - const Glib::ustring& tip_text, int index, - const sigc::slot0& callback) -{ - Gtk::Button *set_color_button = manage(new Gtk::Button()); - Gtk::Image *set_color_icon = manage(new Gtk::Image(Gtk::StockID(stock_id), - Gtk::IconSize::IconSize(Gtk::ICON_SIZE_BUTTON))); - set_color_button->add(*set_color_icon); - set_color_icon->show(); - tooltips.set_tip(*set_color_button, tip_text); - set_color_button->show(); - add_action_widget(*set_color_button, index); - set_color_button->signal_clicked().connect(callback); -} - -void -Dialog_Color::create_close_button() -{ - Gtk::Button *close_button(manage(new Gtk::Button(Gtk::StockID("gtk-close")))); - close_button->show(); - add_action_widget(*close_button, 2); - close_button->signal_clicked().connect(sigc::hide_return(sigc::mem_fun(*this, - &Dialog_Color::on_close_pressed))); - signal_delete_event().connect(sigc::hide(sigc::mem_fun(*this, - &Dialog_Color::on_close_pressed))); -} - -void -Dialog_Color::on_color_changed() -{ - busy_ = true; - signal_edited_(get_color()); - busy_ = false; -} - -void -Dialog_Color::on_set_oc_pressed() -{ - busy_ = true; - synfigapp::Main::set_outline_color(get_color()); - busy_ = false; -} - -void -Dialog_Color::on_set_fc_pressed() -{ - busy_ = true; - synfigapp::Main::set_fill_color(get_color()); - busy_ = false; -} - -bool -Dialog_Color::on_close_pressed() -{ - busy_ = false; - grab_focus(); - reset(); - hide(); - return true; -} - -void -Dialog_Color::reset() -{ - signal_edited_.clear(); -} diff --git a/synfig-studio/src/gui/dialog_color.h b/synfig-studio/src/gui/dialog_color.h deleted file mode 100644 index ee350cf..0000000 --- a/synfig-studio/src/gui/dialog_color.h +++ /dev/null @@ -1,88 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_color.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_COLOR_H -#define __SYNFIG_STUDIO_DIALOG_COLOR_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include - -#include "widget_coloredit.h" -#include "dialogsettings.h" - -/* === 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 Widget_Color; - -class Dialog_Color : public Gtk::Dialog -{ - DialogSettings dialog_settings; - Gtk::Tooltips tooltips; - - Widget_ColorEdit* color_edit_widget; - - sigc::signal signal_edited_; - - bool busy_; - - void create_color_edit_widget(); - void create_set_color_button(const char *stock_id, - const Glib::ustring& tip_text, int index, - const sigc::slot0& callback); - void create_close_button(); - - void on_color_changed(); - void on_set_oc_pressed(); - void on_set_fc_pressed(); - bool on_close_pressed(); - -public: - Dialog_Color(); - ~Dialog_Color(); - - sigc::signal& signal_edited() { return signal_edited_; } - - void set_color(const synfig::Color& x) { color_edit_widget->set_value(x); } - synfig::Color get_color() const { return color_edit_widget->get_value(); } - void reset(); - - bool busy() const { return busy_; } - -}; // END of Dialog_Color - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialog_gradient.cpp b/synfig-studio/src/gui/dialog_gradient.cpp deleted file mode 100644 index fe060b9..0000000 --- a/synfig-studio/src/gui/dialog_gradient.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_gradient.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_gradient.h" -#include "widget_gradient.h" -#include -#include -#include -#include -#include -#include -#include -#include "widget_color.h" -#include -#include "app.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -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 ======================================================= */ - -Dialog_Gradient::Dialog_Gradient(): - Dialog(_("Gradient Editor"),false,true), - dialog_settings(this,"gradient"), - adjustment_pos(0,0.0,1.0,0.001,0.001,0) -{ - set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); - set_keep_above(false); - - set_role("gradient_editor"); - - // Setup the buttons - set_default_button = manage(new class Gtk::Button(Gtk::StockID(_("Set as Default")))); - set_default_button->show(); - add_action_widget(*set_default_button,2); - set_default_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Gradient::on_set_default_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Gradient::hide)); - - Gtk::Table* table(manage(new Gtk::Table(2,2,false))); - get_vbox()->pack_start(*table); - - widget_gradient=manage(new Widget_Gradient()); - widget_gradient->set_editable(); - widget_gradient->signal_cpoint_selected().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_cpoint_selected)); - widget_gradient->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_changed)); - //table->attach(*manage(new Gtk::Label(_("Not yet fully implemented"))), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - table->attach(*widget_gradient, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - - widget_color=manage(new Widget_ColorEdit()); - widget_color->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_values_adjusted)); - widget_color->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_changed)); - widget_color->signal_activated().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_values_adjusted)); - table->attach(*widget_color, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - - - spinbutton_pos=manage(new class Gtk::SpinButton(adjustment_pos,0.0001,4)); - spinbutton_pos->set_update_policy(Gtk::UPDATE_ALWAYS); - adjustment_pos.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_values_adjusted)); - adjustment_pos.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_changed)); - table->attach(*spinbutton_pos, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - - add_accel_group(App::ui_manager()->get_accel_group()); - - show_all_children(); -} - -Dialog_Gradient::~Dialog_Gradient() -{ -} - -void -Dialog_Gradient::set_gradient(const synfig::Gradient& x) -{ - widget_gradient->set_value(x); -} - -void -Dialog_Gradient::reset() -{ - value_changed_connection.disconnect(); - signal_edited_.clear(); -} - -void -Dialog_Gradient::on_set_default_pressed() -{ - synfigapp::Main::set_gradient(get_gradient()); -} - -void -Dialog_Gradient::on_changed() -{ - signal_edited_(get_gradient()); -} - -void -Dialog_Gradient::on_cpoint_selected(synfig::Gradient::CPoint x) -{ - widget_color->set_value(x.color); - adjustment_pos.set_value(x.pos); -} - -void -Dialog_Gradient::on_values_adjusted() -{ - synfig::Gradient::CPoint x(widget_gradient->get_selected_cpoint()); - x.color=widget_color->get_value(); - x.pos=adjustment_pos.get_value(); - widget_gradient->update_cpoint(x); -} - -static void -dialog_gradient_value_desc_edit(synfig::Gradient /*g*/,synfigapp::ValueDesc /*x*/,handle /*canvas_interface*/) -{ -// canvas_interface->connect_value(x,ValueBase(g)); -} - -void -Dialog_Gradient::edit(const synfigapp::ValueDesc &x, etl::handle canvas_interface, synfig::Time time) -{ - reset(); - if(x.is_const()) - set_gradient(x.get_value().get(Gradient())); - else if(x.is_value_node()) - set_gradient((*x.get_value_node())(time).get(Gradient())); - - signal_edited().connect( - sigc::bind( - sigc::bind( - sigc::ptr_fun(dialog_gradient_value_desc_edit), - canvas_interface - ), - x - ) - ); - - present(); -} diff --git a/synfig-studio/src/gui/dialog_gradient.h b/synfig-studio/src/gui/dialog_gradient.h deleted file mode 100644 index 698ba3c..0000000 --- a/synfig-studio/src/gui/dialog_gradient.h +++ /dev/null @@ -1,115 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_gradient.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_GRADIENT_H -#define __SYNFIG_STUDIO_DIALOG_GRADIENT_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "widget_gradient.h" -#include "widget_coloredit.h" - -#include -#include - -#include "dialogsettings.h" - -/* === 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 Gtk { class Menu; class SpinButton; class Adjustment; }; - -namespace synfigapp { -class CanvasInterface; -}; - -namespace studio { - -class Widget_Gradient; -class Widget_ColorEdit; - -class Dialog_Gradient : public Gtk::Dialog -{ - DialogSettings dialog_settings; - - Gtk::SpinButton *spinbutton_pos; - - Gtk::Adjustment adjustment_pos; - - - sigc::signal signal_edited_; - - sigc::connection value_changed_connection; - - void on_set_default_pressed(); - - void on_cpoint_selected(synfig::Gradient::CPoint x); - void on_values_adjusted(); - - Widget_Gradient* widget_gradient; - Widget_ColorEdit* widget_color; - Gtk::Button *set_default_button; - - void on_changed(); - -public: - - sigc::signal& signal_edited() { return signal_edited_; } - - void set_gradient(const synfig::Gradient& x); - - const synfig::Gradient& get_gradient()const { return widget_gradient->get_value(); } - - void set_default_button_set_sensitive(bool sensitive) { set_default_button->set_sensitive(sensitive); } - - void reset(); - - - Dialog_Gradient(); - ~Dialog_Gradient(); - //! Interface to external calls to fill in the Gradient Editor Dialog - //! when a Constant ValueNode or a Animated ValueNode is double cliked. - void edit(const synfigapp::ValueDesc &x, etl::handle canvas_interface, synfig::Time time=0); -}; // END of Dialog_Gradient - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialog_keyframe.cpp b/synfig-studio/src/gui/dialog_keyframe.cpp deleted file mode 100644 index b746490..0000000 --- a/synfig-studio/src/gui/dialog_keyframe.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_keyframe.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_keyframe.h" -#include -#include -#include "widget_waypointmodel.h" -#include -#include - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -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 ======================================================= */ - -Dialog_Keyframe::Dialog_Keyframe(Gtk::Window& parent, etl::handle canvas_interface): - Gtk::Dialog(_("Keyframe Dialog"),parent,false,true), - canvas_interface(canvas_interface) -{ - // Set up the buttons - { - Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); - ok_button->show(); - add_action_widget(*ok_button,2); - ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_ok_pressed)); - - Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); - apply_button->show(); - add_action_widget(*apply_button,1); - apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_apply_pressed)); - - Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete")))); - delete_button->show(); - add_action_widget(*delete_button,3); - delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_delete_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::hide)); - } - - Gtk::Table *table=manage(new Gtk::Table(2,2,false)); - - get_vbox()->pack_start(*table); - -/* // \todo Allow setting descriptions for keyframes - - entry_description.set_text(_("Not yet implemented")); - - table->attach(*manage(new Gtk::Label(_("Description"))), 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - table->attach(entry_description, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); -*/ - - table->show_all(); - - widget_waypoint_model=Gtk::manage(new Widget_WaypointModel()); - widget_waypoint_model->show(); - table->attach(*widget_waypoint_model, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - -} - -Dialog_Keyframe::~Dialog_Keyframe() -{ -} - -const synfig::Keyframe& -Dialog_Keyframe::get_keyframe()const -{ - return keyframe_; -} - -void -Dialog_Keyframe::set_keyframe(const synfig::Keyframe& x) -{ - keyframe_=x; -} - -void -Dialog_Keyframe::on_ok_pressed() -{ - on_apply_pressed(); - hide(); -} - - -void -Dialog_Keyframe::on_delete_pressed() -{ - synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeRemove")); - - assert(action); - - action->set_param("canvas",canvas_interface->get_canvas()); - action->set_param("canvas_interface",canvas_interface); - action->set_param("keyframe",keyframe_); - action->set_param("model",widget_waypoint_model->get_waypoint_model()); - - if(canvas_interface->get_instance()->perform_action(action)) - { - hide(); - } -} - - -void -Dialog_Keyframe::on_apply_pressed() -{ - if(widget_waypoint_model->get_waypoint_model().is_trivial()) - return; - - synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeWaypointSet")); - - assert(action); - - action->set_param("canvas",canvas_interface->get_canvas()); - action->set_param("canvas_interface",canvas_interface); - action->set_param("keyframe",keyframe_); - action->set_param("model",widget_waypoint_model->get_waypoint_model()); - - if(!canvas_interface->get_instance()->perform_action(action)) - { - } -} diff --git a/synfig-studio/src/gui/dialog_keyframe.h b/synfig-studio/src/gui/dialog_keyframe.h deleted file mode 100644 index 1222fd6..0000000 --- a/synfig-studio/src/gui/dialog_keyframe.h +++ /dev/null @@ -1,79 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_keyframe.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_KEYFRAME_H -#define __SYNFIG_STUDIO_DIALOG_KEYFRAME_H - -/* === H E A D E R S ======================================================= */ - -#include -#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 Widget_WaypointModel; - -class Dialog_Keyframe : public Gtk::Dialog -{ - Gtk::Tooltips tooltips_; - etl::handle canvas_interface; - - synfig::Keyframe keyframe_; - - Gtk::Entry entry_description; - - Widget_WaypointModel* widget_waypoint_model; - - void on_ok_pressed(); - void on_apply_pressed(); - void on_delete_pressed(); - -public: - Dialog_Keyframe(Gtk::Window& parent,etl::handle canvas_interface); - ~Dialog_Keyframe(); - - const synfig::Keyframe& get_keyframe()const; - void set_keyframe(const synfig::Keyframe& x); - -private: - -}; // END of class Dialog_Keyframe - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialog_preview.cpp b/synfig-studio/src/gui/dialog_preview.cpp deleted file mode 100644 index 0782869..0000000 --- a/synfig-studio/src/gui/dialog_preview.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_preview.cpp -** \brief Preview dialog File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_preview.h" -#include "preview.h" -#include -#include -#include -#include -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; -using namespace Gtk; - -/* === 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_preview stuff... -Dialog_Preview::Dialog_Preview() -:Dialog(_("Preview Window"),false,true), -settings(this,"preview") -{ - get_vbox()->pack_start(preview); -} - -Dialog_Preview::~Dialog_Preview() -{ -} - -void Dialog_Preview::set_preview(etl::handle prev) -{ - get_window().clear(); - preview.set_preview(prev); - //preview.update(); -} - -void Dialog_Preview::on_hide() -{ - Dialog::on_hide(); - preview.stop(); - preview.stoprender(); -} - -//dialog_previewoptions stuff -Dialog_PreviewOptions::Dialog_PreviewOptions() -: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), -settings(this,"prevoptions") -{ - //framerate = 15.0f; - //zoom = 0.2f; - - //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(_("General Settings")); - 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(_("Time Settings")); - 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)); - - 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)); - add_action_widget(*okbutton, 0); - - time_begin.set_sensitive(false); - time_end.set_sensitive(false); - show_all(); -} - -Dialog_PreviewOptions::~Dialog_PreviewOptions() -{ -} - -void Dialog_PreviewOptions::on_ok_pressed() -{ - PreviewInfo i; - i.zoom = get_zoom(); - i.fps = get_fps(); - i.overbegin = get_begin_override(); - 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()); -} - -void Dialog_PreviewOptions::on_overend_toggle() -{ - time_end.set_sensitive(get_end_override()); -} - -void studio::Dialog_PreviewOptions::set_global_fps(float f) -{ - globalfps = f; - time_begin.set_fps(f); - time_end.set_fps(f); -} diff --git a/synfig-studio/src/gui/dialog_preview.h b/synfig-studio/src/gui/dialog_preview.h deleted file mode 100644 index 9286552..0000000 --- a/synfig-studio/src/gui/dialog_preview.h +++ /dev/null @@ -1,132 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_preview.h -** \brief Preview dialog Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_GTKMM_DIALOG_PREVIEW_H -#define __SYNFIG_GTKMM_DIALOG_PREVIEW_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include - -#include "preview.h" -#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 { - -struct PreviewInfo -{ - float zoom,fps,begintime,endtime; - bool overbegin,overend; -}; - -class Dialog_Preview : public Gtk::Dialog -{ - Widget_Preview preview; - DialogSettings settings; - - //etl::handle canvas; - -public: - Dialog_Preview(); - ~Dialog_Preview(); - - void set_preview(etl::handle prev); - - Widget_Preview &get_widget() {return preview;} - const Widget_Preview &get_widget() const {return preview;} - - virtual void on_hide(); - //other forwarding functions... -}; // END of Dialog_Preview - -class Dialog_PreviewOptions : public Gtk::Dialog -{ - //all the info needed to construct a render description... - Gtk::Adjustment adj_zoom; // factor at which to resize the window... - - Gtk::Adjustment adj_fps; // how often to take samples of the animation - - studio::Widget_Time time_begin; - studio::Widget_Time time_end; - - Gtk::CheckButton check_overbegin; - Gtk::CheckButton check_overend; - - DialogSettings settings; - - float globalfps; - - // for finishing - void on_ok_pressed(); - void on_cancel_pressed(); - - //for ui stuff - void on_overbegin_toggle(); - void on_overend_toggle(); - - sigc::signal signal_finish_; -public: - Dialog_PreviewOptions(); - ~Dialog_PreviewOptions(); - - float get_zoom() const { return adj_zoom.get_value(); } - void set_zoom(float z) { adj_zoom.set_value(z); } - - float get_fps() const { return adj_fps.get_value(); } - void set_fps(float z) { adj_fps.set_value(z); } - - float get_global_fps() const { return globalfps; } - void set_global_fps(float f); - - synfig::Time get_begintime() const { return time_begin.get_value(); } - void set_begintime(const synfig::Time &t) { time_begin.set_value(t); } - - synfig::Time get_endtime() const { return time_end.get_value(); } - void set_endtime(const synfig::Time &t) { time_end.set_value(t); } - - bool get_begin_override() const { return check_overbegin.get_active(); } - void set_begin_override(bool o) { check_overbegin.set_active(o); } - - bool get_end_override() const { return check_overend.get_active(); } - void set_end_override(bool o) { check_overend.set_active(o); } - - sigc::signal &signal_finish() {return signal_finish_;} -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialog_setup.cpp b/synfig-studio/src/gui/dialog_setup.cpp deleted file mode 100644 index 6272cb3..0000000 --- a/synfig-studio/src/gui/dialog_setup.cpp +++ /dev/null @@ -1,839 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_setup.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** Copyright (c) 2008, 2009 Carlos López -** -** 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_setup.h" -#include "app.h" -#include -#include -#include -#include -#include "widget_enum.h" -#include "autorecover.h" - -#include -#include -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -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 ======================================================= */ - -static void -attach_label(Gtk::Table *table, String str, guint col, guint xpadding, guint ypadding) -{ - Gtk::Label* label(manage(new Gtk::Label((str + ":").c_str()))); - label->set_alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); - table->attach(*label, 0, 1, col, col+1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); -} - -Dialog_Setup::Dialog_Setup(): - Dialog(_("Synfig Studio Setup"),false,true), - adj_gamma_r(2.2,0.1,3.0,0.025,0.025,0.025), - adj_gamma_g(2.2,0.1,3.0,0.025,0.025,0.025), - adj_gamma_b(2.2,0.1,3.0,0.025,0.025,0.025), - adj_recent_files(15,1,50,1,1,0), - adj_undo_depth(100,10,5000,1,1,1), - toggle_use_colorspace_gamma(_("Visually Linear Color Selection")), -#ifdef SINGLE_THREADED - toggle_single_threaded(_("Use Only a Single Thread")), -#endif - toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant")), - toggle_resize_imported_images(_("Scale New Imported Images to Fit Canvas")), - adj_pref_x_size(480,1,10000,1,10,0), - adj_pref_y_size(270,1,10000,1,10,0), - adj_pref_fps(24.0,1.0,100,0.1,1,0) - - { - // Setup the buttons - - Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); - ok_button->show(); - add_action_widget(*ok_button,2); - ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::on_ok_pressed)); - - Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); - apply_button->show(); - add_action_widget(*apply_button,1); - apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::on_apply_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::hide)); - - - // Notebook - Gtk::Notebook *notebook=manage(new class Gtk::Notebook()); - get_vbox()->pack_start(*notebook); - - - // Gamma - Gtk::Table *gamma_table=manage(new Gtk::Table(2,2,false)); - notebook->append_page(*gamma_table,_("Gamma")); - - gamma_table->attach(gamma_pattern, 0, 2, 0, 1, Gtk::EXPAND, Gtk::SHRINK|Gtk::FILL, 0, 0); - - Gtk::HScale* scale_gamma_r(manage(new Gtk::HScale(adj_gamma_r))); - gamma_table->attach(*manage(new Gtk::Label(_("Red"))), 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - gamma_table->attach(*scale_gamma_r, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - adj_gamma_r.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_r_change)); - - Gtk::HScale* scale_gamma_g(manage(new Gtk::HScale(adj_gamma_g))); - gamma_table->attach(*manage(new Gtk::Label(_("Green"))), 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - gamma_table->attach(*scale_gamma_g, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - adj_gamma_g.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_g_change)); - - Gtk::HScale* scale_gamma_b(manage(new Gtk::HScale(adj_gamma_b))); - gamma_table->attach(*manage(new Gtk::Label(_("Blue"))), 0, 1, 3, 4, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - gamma_table->attach(*scale_gamma_b, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - adj_gamma_b.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_b_change)); - - gamma_table->attach(*manage(new Gtk::Label(_("Black Level"))), 0, 1, 4, 5, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - gamma_table->attach(black_level_selector, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - black_level_selector.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_black_level_change)); - - //gamma_table->attach(*manage(new Gtk::Label(_("Red-Blue Level"))), 0, 1, 5, 6, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - //gamma_table->attach(red_blue_level_selector, 1, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - //red_blue_level_selector.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_red_blue_level_change)); - - - // Misc - Gtk::Table *misc_table=manage(new Gtk::Table(2,2,false)); - notebook->append_page(*misc_table,_("Misc.")); - - int xpadding(8), ypadding(8); - - // Misc - Timestamp - timestamp_menu=manage(new class Gtk::Menu()); - attach_label(misc_table, _("Timestamp"), 0, xpadding, ypadding); - misc_table->attach(timestamp_optionmenu, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - -#define ADD_TIMESTAMP(desc,x) \ - timestamp_menu->items().push_back( \ - Gtk::Menu_Helpers::MenuElem( \ - desc, \ - sigc::bind( \ - sigc::mem_fun( \ - *this, \ - &studio::Dialog_Setup::set_time_format), \ - x))); - ADD_TIMESTAMP("HH:MM:SS.FF", Time::FORMAT_VIDEO ); - ADD_TIMESTAMP("(HHh MMm SSs) FFf", Time::FORMAT_NORMAL ); - ADD_TIMESTAMP("(HHhMMmSSs)FFf", Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES ); - ADD_TIMESTAMP("HHh MMm SSs FFf", Time::FORMAT_NORMAL | Time::FORMAT_FULL ); - ADD_TIMESTAMP("HHhMMmSSsFFf", Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES | Time::FORMAT_FULL); - ADD_TIMESTAMP("FFf", Time::FORMAT_FRAMES ); - - timestamp_optionmenu.set_menu(*timestamp_menu); - -#undef ADD_TIMESTAMP - - { - ParamDesc param_desc; - param_desc - .set_hint("enum") - .add_enum_value(Distance::SYSTEM_UNITS,"u",_("Units")) - .add_enum_value(Distance::SYSTEM_PIXELS,"px",_("Pixels")) - .add_enum_value(Distance::SYSTEM_POINTS,"pt",_("Points")) - .add_enum_value(Distance::SYSTEM_INCHES,"in",_("Inches")) - .add_enum_value(Distance::SYSTEM_METERS,"m",_("Meters")) - .add_enum_value(Distance::SYSTEM_CENTIMETERS,"cm",_("Centimeters")) - .add_enum_value(Distance::SYSTEM_MILLIMETERS,"mm",_("Millimeters")); - - widget_enum=manage(new Widget_Enum()); - widget_enum->set_param_desc(param_desc); - - attach_label(misc_table, _("Unit System"), 1, xpadding, ypadding); - misc_table->attach(*widget_enum, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - } - - // Misc - recent files - Gtk::SpinButton* recent_files_spinbutton(manage(new Gtk::SpinButton(adj_recent_files,1,0))); - attach_label(misc_table, _("Recent Files"), 2, xpadding, ypadding); - misc_table->attach(*recent_files_spinbutton, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - - // Misc - use_colorspace_gamma - misc_table->attach(toggle_use_colorspace_gamma, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - -#ifdef SINGLE_THREADED - // Misc - single_threaded - misc_table->attach(toggle_single_threaded, 0, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); -#endif - - // Misc - auto backup interval - attach_label(misc_table, _("Auto Backup Interval (0 to disable)"), 3, xpadding, ypadding); - misc_table->attach(auto_backup_interval, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - - // Misc - restrict_radius_ducks - misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 8, 9, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - - // Misc - resize_imported_images - misc_table->attach(toggle_resize_imported_images, 0, 2, 9, 10, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - - // Misc - browser_command - attach_label(misc_table, _("Browser Command"), 4, xpadding, ypadding); - misc_table->attach(textbox_browser_command, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - - // Document - Gtk::Table *document_table = manage(new Gtk::Table(2, 4, false)); - notebook->append_page(*document_table, _("Document")); - - // Document - Preferred file name prefix - attach_label(document_table, _("New Document filename prefix"), 0, xpadding, ypadding); - document_table->attach(textbox_custom_filename_prefix, 1, 4, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - tooltips_.set_tip(textbox_custom_filename_prefix, _("File name prefix for the new created document")); - - // Document - New Document X size - pref_x_size_spinbutton = Gtk::manage(new Gtk::SpinButton(adj_pref_x_size, 1, 0)); - attach_label(document_table, _("New Document X size"),1, xpadding, ypadding); - document_table->attach(*pref_x_size_spinbutton, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - tooltips_.set_tip(*pref_x_size_spinbutton, _("Width in pixels of the new created document")); - - // Document - New Document Y size - pref_y_size_spinbutton = Gtk::manage(new Gtk::SpinButton(adj_pref_y_size, 1, 0)); - attach_label(document_table,_("New Document Y size"), 2, xpadding, ypadding); - document_table->attach(*pref_y_size_spinbutton, 1, 2, 2, 3,Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - tooltips_.set_tip(*pref_y_size_spinbutton, _("High in pixels of the new created document")); - - //Document - Template for predefined sizes of canvases. - size_template_combo = Gtk::manage(new Gtk::ComboBoxText()); - Gtk::Label* label(manage(new Gtk::Label(_("Predefined Resolutions:")))); - label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); - document_table->attach(*label, 2, 3, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - document_table->attach(*size_template_combo, 2, 3, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - size_template_combo->signal_changed().connect(sigc::mem_fun(*this, &studio::Dialog_Setup::on_size_template_combo_change)); - size_template_combo->prepend_text(_("4096x3112 Full Aperture 4K")); - size_template_combo->prepend_text(_("2048x1556 Full Aperture Native 2K")); - size_template_combo->prepend_text(_("1920x1080 HDTV 1080p/i")); - size_template_combo->prepend_text(_("1280x720 HDTV 720p")); - size_template_combo->prepend_text(_("720x576 DVD PAL")); - size_template_combo->prepend_text(_("720x480 DVD NTSC")); - size_template_combo->prepend_text(_("720x540 Web 720x")); - size_template_combo->prepend_text(_("720x405 Web 720x HD")); - size_template_combo->prepend_text(_("640x480 Web 640x")); - size_template_combo->prepend_text(_("640x360 Web 640x HD")); - size_template_combo->prepend_text(_("480x360 Web 480x")); - size_template_combo->prepend_text(_("480x270 Web 480x HD")); - size_template_combo->prepend_text(_("360x270 Web 360x")); - size_template_combo->prepend_text(_("360x203 Web 360x HD")); - size_template_combo->prepend_text(DEFAULT_PREDEFINED_SIZE); - - //Document - Template for predefined fps - fps_template_combo = Gtk::manage(new Gtk::ComboBoxText()); - Gtk::Label* label1(manage(new Gtk::Label(_("Predefined FPS:")))); - label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); - document_table->attach(*label1, 2, 3, 3, 4, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - document_table->attach(*fps_template_combo,2, 3, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - fps_template_combo->signal_changed().connect(sigc::mem_fun(*this, &studio::Dialog_Setup::on_fps_template_combo_change)); - //Document - Fill the FPS combo box with proper strings (not localised) - float f[8]; - f[0] = 60; - f[1] = 50; - f[2] = 30; - f[3] = 25; - f[4] = 24.967; - f[5] = 24; - f[6] = 15; - f[7] = 12; - for (int i=0; i<8; i++) - fps_template_combo->prepend_text(strprintf("%5.3f", f[i])); - - fps_template_combo->prepend_text(DEFAULT_PREDEFINED_FPS); - - // Document - New Document FPS - pref_fps_spinbutton = Gtk::manage(new Gtk::SpinButton(adj_pref_fps, 1, 3)); - attach_label(document_table,_("New Document FPS"), 4, xpadding, ypadding); - document_table->attach(*pref_fps_spinbutton, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); - tooltips_.set_tip(*pref_fps_spinbutton, _("Frames per second of the new created document")); - - show_all_children(); -} - -Dialog_Setup::~Dialog_Setup() -{ -} - -void -Dialog_Setup::on_ok_pressed() -{ - on_apply_pressed(); - hide(); -} - -void -Dialog_Setup::on_apply_pressed() -{ - App::gamma.set_all(1.0/adj_gamma_r.get_value(),1.0/adj_gamma_g.get_value(),1.0/adj_gamma_b.get_value(),black_level_selector.get_value(),red_blue_level_selector.get_value()); - - App::set_max_recent_files((int)adj_recent_files.get_value()); - - // Set the time format - App::set_time_format(get_time_format()); - - // Set the use_colorspace_gamma flag - App::use_colorspace_gamma=toggle_use_colorspace_gamma.get_active(); - -#ifdef SINGLE_THREADED - // Set the single_threaded flag - App::single_threaded=toggle_single_threaded.get_active(); -#endif - - // Set the auto backup interval - App::auto_recover->set_timeout(auto_backup_interval.get_value() * 1000); - - App::distance_system=Distance::System(widget_enum->get_value()); - - // Set the restrict_radius_ducks flag - App::restrict_radius_ducks=toggle_restrict_radius_ducks.get_active(); - - // Set the resize_imported_images flag - App::resize_imported_images=toggle_resize_imported_images.get_active(); - - // Set the browser_command textbox - App::browser_command=textbox_browser_command.get_text(); - - // Set the preferred file name prefix - App::custom_filename_prefix=textbox_custom_filename_prefix.get_text(); - - // Set the preferred new Document X dimension - App::preferred_x_size=int(adj_pref_x_size.get_value()); - - // Set the preferred new Document Y dimension - App::preferred_y_size=int(adj_pref_y_size.get_value()); - - // Set the preferred Predefined size - App::predefined_size=size_template_combo->get_active_text(); - - // Set the preferred Predefined fps - App::predefined_fps=fps_template_combo->get_active_text(); - - // Set the preferred FPS - App::preferred_fps=Real(adj_pref_fps.get_value()); - - App::save_settings(); -} - -void -Dialog_Setup::on_gamma_r_change() -{ - gamma_pattern.set_gamma_r(1.0/adj_gamma_r.get_value()); - gamma_pattern.refresh(); - gamma_pattern.queue_draw(); -} - -void -Dialog_Setup::on_gamma_g_change() -{ - gamma_pattern.set_gamma_g(1.0/adj_gamma_g.get_value()); - gamma_pattern.refresh(); - gamma_pattern.queue_draw(); -} - -void -Dialog_Setup::on_gamma_b_change() -{ - gamma_pattern.set_gamma_b(1.0/adj_gamma_b.get_value()); - gamma_pattern.refresh(); - gamma_pattern.queue_draw(); -} - -void -Dialog_Setup::on_black_level_change() -{ - gamma_pattern.set_black_level(black_level_selector.get_value()); - gamma_pattern.refresh(); - gamma_pattern.queue_draw(); -} - -void -Dialog_Setup::on_red_blue_level_change() -{ - gamma_pattern.set_red_blue_level(red_blue_level_selector.get_value()); - gamma_pattern.refresh(); - gamma_pattern.queue_draw(); -} - -void -Dialog_Setup::on_size_template_combo_change() -{ - String selection(size_template_combo->get_active_text()); - if(selection==DEFAULT_PREDEFINED_SIZE) - { - pref_y_size_spinbutton->set_sensitive(true); - pref_x_size_spinbutton->set_sensitive(true); - return; - } - String::size_type locx=selection.find_first_of("x"); // here should be some comparison with string::npos - String::size_type locspace=selection.find_first_of(" "); - String x_size(selection.substr(0,locx)); - String y_size(selection.substr(locx+1,locspace)); - int x=atoi(x_size.c_str()); - int y=atoi(y_size.c_str()); - adj_pref_x_size.set_value(x); - adj_pref_y_size.set_value(y); - pref_y_size_spinbutton->set_sensitive(false); - pref_x_size_spinbutton->set_sensitive(false); - - return; -} - -void -Dialog_Setup::on_fps_template_combo_change() -{ - String selection(fps_template_combo->get_active_text()); - if(selection==DEFAULT_PREDEFINED_FPS) - { - pref_fps_spinbutton->set_sensitive(true); - return; - } - adj_pref_fps.set_value(atof(selection.c_str())); - pref_fps_spinbutton->set_sensitive(false); - return; -} - -void -Dialog_Setup::refresh() -{ - // Refresh the temporary gamma; do this before adjusting the sliders, - // or variables will be used before their initialization. - gamma_pattern.set_gamma_r(App::gamma.get_gamma_r()); - gamma_pattern.set_gamma_g(App::gamma.get_gamma_g()); - gamma_pattern.set_gamma_b(App::gamma.get_gamma_b()); - gamma_pattern.set_black_level(App::gamma.get_black_level()); - gamma_pattern.set_red_blue_level(App::gamma.get_red_blue_level()); - - adj_gamma_r.set_value(1.0/App::gamma.get_gamma_r()); - adj_gamma_g.set_value(1.0/App::gamma.get_gamma_g()); - adj_gamma_b.set_value(1.0/App::gamma.get_gamma_b()); - black_level_selector.set_value(App::gamma.get_black_level()); - red_blue_level_selector.set_value(App::gamma.get_red_blue_level()); - - gamma_pattern.refresh(); - - adj_recent_files.set_value(App::get_max_recent_files()); - - // Refresh the time format - set_time_format(App::get_time_format()); - - widget_enum->set_value(App::distance_system); - - // Refresh the status of the use_colorspace_gamma flag - toggle_use_colorspace_gamma.set_active(App::use_colorspace_gamma); - -#ifdef SINGLE_THREADED - // Refresh the status of the single_threaded flag - toggle_single_threaded.set_active(App::single_threaded); -#endif - - // Refresh the value of the auto backup interval - auto_backup_interval.set_value(App::auto_recover->get_timeout() / 1000); - - // Refresh the status of the restrict_radius_ducks flag - toggle_restrict_radius_ducks.set_active(App::restrict_radius_ducks); - - // Refresh the status of the resize_imported_images flag - toggle_resize_imported_images.set_active(App::resize_imported_images); - - // Refresh the browser_command textbox - textbox_browser_command.set_text(App::browser_command); - - // Refresh the preferred filename prefix - textbox_custom_filename_prefix.set_text(App::custom_filename_prefix); - - // Refresh the preferred new Document X dimension - adj_pref_x_size.set_value(App::preferred_x_size); - - // Refresh the preferred new Document Y dimension - adj_pref_y_size.set_value(App::preferred_y_size); - - // Refresh the preferred Predefined size - size_template_combo->set_active_text(App::predefined_size); - - //Refresh the preferred FPS - adj_pref_fps.set_value(App::preferred_fps); - - //Refresh the predefined FPS - fps_template_combo->set_active_text(App::predefined_fps); -} - -GammaPattern::GammaPattern(): - tile_w(80), - tile_h(80) -{ - set_size_request(tile_w*4,tile_h*3); - signal_expose_event().connect(sigc::mem_fun(*this, &studio::GammaPattern::redraw)); -} - -GammaPattern::~GammaPattern() -{ -} - -void -GammaPattern::refresh() -{ - black[0].set_rgb_p( - r_F32_to_F32(0.0), - g_F32_to_F32(0.0), - b_F32_to_F32(0.0) - ); - white[0].set_rgb_p( - r_F32_to_F32(1.0), - g_F32_to_F32(1.0), - b_F32_to_F32(1.0) - ); - gray50[0].set_rgb_p( - r_F32_to_F32(0.5), - g_F32_to_F32(0.5), - b_F32_to_F32(0.5) - ); - gray25[0].set_rgb_p( - r_F32_to_F32(0.25), - g_F32_to_F32(0.25), - b_F32_to_F32(0.25) - ); - - // Reds - black[1].set_rgb(black[0].get_red(),0,0); - gray25[1].set_rgb(gray25[0].get_red(),0,0); - gray50[1].set_rgb(gray50[0].get_red(),0,0); - white[1].set_rgb(white[0].get_red(),0,0); - - // Greens - black[2].set_rgb(0,black[0].get_green(),0); - gray25[2].set_rgb(0,gray25[0].get_green(),0); - gray50[2].set_rgb(0,gray50[0].get_green(),0); - white[2].set_rgb(0,white[0].get_green(),0); - - // blues - black[3].set_rgb(0,0,black[0].get_blue()); - gray25[3].set_rgb(0,0,gray25[0].get_blue()); - gray50[3].set_rgb(0,0,gray50[0].get_blue()); - white[3].set_rgb(0,0,white[0].get_blue()); -} - -bool -GammaPattern::redraw(GdkEventExpose */*bleh*/) -{ - static const char hlines[] = { 3, 0 }; - - Glib::RefPtr gc(Gdk::GC::create(get_window())); - - int i; - Gdk::Color trueblack("#000000"); - - // 50% Pattern - for(i=0;i<4;i++) - { - gc->set_rgb_fg_color(black[i]); - get_window()->draw_rectangle(gc, true, i*tile_w, 0, tile_w, tile_h); - - gc->set_stipple(Gdk::Bitmap::create(hlines,2,2)); - gc->set_fill(Gdk::STIPPLED); - gc->set_rgb_fg_color(white[i]); - get_window()->draw_rectangle(gc, true, i*tile_w, 0, tile_w, tile_h); - - gc->set_fill(Gdk::SOLID); - gc->set_rgb_fg_color(gray50[i]); - - get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2); - } - - // 25% Pattern - for(i=0;i<4;i++) - { - gc->set_rgb_fg_color(black[i]); - get_window()->draw_rectangle(gc, true, i*tile_w, tile_h, tile_w, tile_h); - - gc->set_stipple(Gdk::Bitmap::create(hlines,2,2)); - gc->set_fill(Gdk::STIPPLED); - gc->set_rgb_fg_color(gray50[i]); - get_window()->draw_rectangle(gc, true, i*tile_w, tile_h, tile_w, tile_h); - - gc->set_fill(Gdk::SOLID); - gc->set_rgb_fg_color(gray25[i]); - - get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h+tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2); - } - - // Black-level Pattern - gc->set_rgb_fg_color(trueblack); - get_window()->draw_rectangle(gc, true, 0, tile_h*2, tile_w*4, tile_h); - gc->set_fill(Gdk::SOLID); - for(i=0;i<4;i++) - { - gc->set_rgb_fg_color(black[i]); - - get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h*2+tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2); - } - - return true; -} - - -BlackLevelSelector::BlackLevelSelector() -{ - set_size_request(-1,24); - signal_expose_event().connect(sigc::mem_fun(*this, &studio::BlackLevelSelector::redraw)); - - add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); - add_events(Gdk::BUTTON1_MOTION_MASK); - add_events(Gdk::BUTTON1_MOTION_MASK); -} - -BlackLevelSelector::~BlackLevelSelector() -{ -} - -bool -BlackLevelSelector::redraw(GdkEventExpose */*bleh*/) -{ - const int w(get_width()),h(get_height()); - - Gdk::Color color; - - Glib::RefPtr gc(Gdk::GC::create(get_window())); - - int i; - - // Draw the gradient - for(i=0;iset_rgb_fg_color(color); - get_window()->draw_rectangle(gc, true, i, 0, 1, h); - } - - // Draw a frame - gc->set_rgb_fg_color(Gdk::Color("#000000")); - get_window()->draw_rectangle(gc, false, 0, 0, w-1, h-1); - - // Draw the position of the current value - i=(int)(level*w+0.5); - gc->set_rgb_fg_color(Gdk::Color("#ff0000")); - get_window()->draw_rectangle(gc, true, i, 1, 1, h-1); - - // Print out the value - Glib::RefPtr layout(Pango::Layout::create(get_pango_context())); - layout->set_text(etl::strprintf("%0.01f%%",level*100.0f)); - layout->set_alignment(Pango::ALIGN_CENTER); - gc->set_rgb_fg_color(Gdk::Color("#a00000")); - get_window()->draw_layout(gc, w/2, 4, layout); - - return true; -} - - - -bool -BlackLevelSelector::on_event(GdkEvent *event) -{ - int x(round_to_int(event->button.x)); - //int y(round_to_int(event->button.y)); - - switch(event->type) - { - case GDK_MOTION_NOTIFY: - level=(float)x/(float)get_width(); - if(level<0.0f)level=0.0f; - if(level>1.0f)level=1.0f; - signal_value_changed_(); - queue_draw(); - return true; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - if(event->button.button==1) - { - level=(float)x/(float)get_width(); - if(level<0.0f)level=0.0f; - if(level>1.0f)level=1.0f; - signal_value_changed_(); - queue_draw(); - return true; - } - break; - default: - break; - } - - return false; -} - - -void -Dialog_Setup::set_time_format(synfig::Time::Format x) -{ - time_format=x; - if (x <= Time::FORMAT_VIDEO) - timestamp_optionmenu.set_history(0); - else if (x == (Time::FORMAT_NORMAL)) - timestamp_optionmenu.set_history(1); - else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES)) - timestamp_optionmenu.set_history(2); - else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_FULL)) - timestamp_optionmenu.set_history(3); - else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES | Time::FORMAT_FULL)) - timestamp_optionmenu.set_history(4); - else if (x == (Time::FORMAT_FRAMES)) - timestamp_optionmenu.set_history(5); - else - timestamp_optionmenu.set_history(1); -} - - - - - - - - - - - - - - - - -RedBlueLevelSelector::RedBlueLevelSelector() -{ - set_size_request(-1,24); - signal_expose_event().connect(sigc::mem_fun(*this, &studio::RedBlueLevelSelector::redraw)); - - add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); - add_events(Gdk::BUTTON1_MOTION_MASK); - add_events(Gdk::BUTTON1_MOTION_MASK); -} - -RedBlueLevelSelector::~RedBlueLevelSelector() -{ -} - -bool -RedBlueLevelSelector::redraw(GdkEventExpose */*bleh*/) -{ - const int w(get_width()),h(get_height()); - - Gdk::Color color; - - Glib::RefPtr gc(Gdk::GC::create(get_window())); - - int i; - - // Draw the gradient - for(i=0;i1.0f)red_blue=1.0f; - if(blue_red>1.0f)blue_red=1.0f; - - color.set_rgb( - round_to_int(min(red_blue,1.0f)*65535), - round_to_int(sqrt(min(red_blue,blue_red))*65535), - round_to_int(min(blue_red,1.0f)*65535) - ); - - gc->set_rgb_fg_color(color); - get_window()->draw_rectangle(gc, true, i, 0, 1, h); - } - - // Draw a frame - gc->set_rgb_fg_color(Gdk::Color("#000000")); - get_window()->draw_rectangle(gc, false, 0, 0, w-1, h-1); - - // Draw the position of the current value - i=(int)(((level-1.0f)*2.0f+1.0f-0.5f)*w+0.5); - gc->set_rgb_fg_color(Gdk::Color("#00ff00")); - get_window()->draw_rectangle(gc, true, i, 1, 1, h-1); - - // Print out the value - Glib::RefPtr layout(Pango::Layout::create(get_pango_context())); - layout->set_text(etl::strprintf("%0.02f",level)); - layout->set_alignment(Pango::ALIGN_CENTER); - gc->set_rgb_fg_color(Gdk::Color("#a00000")); - get_window()->draw_layout(gc, w/2, 4, layout); - - return true; -} - - - -bool -RedBlueLevelSelector::on_event(GdkEvent *event) -{ - int x(round_to_int(event->button.x)); - //int y(round_to_int(event->button.y)); - - switch(event->type) - { - case GDK_MOTION_NOTIFY: - level=(((float)(x)/(float)get_width()+0.5)-1.0f)/2.0f+1.0f; - if(level<0.5f)level=0.5f; - if(level>1.5f)level=1.5f; - signal_value_changed_(); - queue_draw(); - return true; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - if(event->button.button==1) - { - level=(((float)(x)/(float)get_width()+0.5)-1.0f)/2.0f+1.0f; - if(level<0.5f)level=0.5f; - if(level>1.5f)level=1.5f; - signal_value_changed_(); - queue_draw(); - return true; - } - break; - default: - break; - } - - return false; -} diff --git a/synfig-studio/src/gui/dialog_setup.h b/synfig-studio/src/gui/dialog_setup.h deleted file mode 100644 index 3d94956..0000000 --- a/synfig-studio/src/gui/dialog_setup.h +++ /dev/null @@ -1,222 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_setup.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** Copyright (c) 2008, 2009 Carlos López -** -** 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_SETUP_H -#define __SYNFIG_STUDIO_DIALOG_SETUP_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* === M A C R O S ========================================================= */ -#ifndef DEFAULT_PREDEFINED_SIZE -#define DEFAULT_PREDEFINED_SIZE _("Custom Size") -#endif -#ifndef DEFAULT_PREDEFINED_FPS -#define DEFAULT_PREDEFINED_FPS _("Custom fps") -#endif - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace Gtk { class Menu; }; - -namespace studio { - -class GammaPattern : public Gtk::DrawingArea -{ - float gamma_r; - float gamma_g; - float gamma_b; - float black_level; - float red_blue_level; - - int tile_w, tile_h; - - Gdk::Color black[4],white[4],gray50[4],gray25[4]; - - float r_F32_to_F32(float x)const { float f((pow(x,gamma_r)*std::min(red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; } - float g_F32_to_F32(float x)const { float f((pow(x,gamma_g)*sqrt(std::min(2.0f-red_blue_level,red_blue_level))*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; } - float b_F32_to_F32(float x)const { float f((pow(x,gamma_b)*std::min(2.0f-red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; } - -public: - - void refresh(); - - void set_gamma_r(float x) { gamma_r=x; } - void set_gamma_g(float x) { gamma_g=x; }; - void set_gamma_b(float x) { gamma_b=x; }; - void set_black_level(float x) { black_level=x; }; - void set_red_blue_level(float x) { red_blue_level=x; }; - - float get_gamma_r()const { return gamma_r; } - float get_gamma_g()const { return gamma_g; } - float get_gamma_b()const { return gamma_b; } - float get_black_level()const { return black_level; } - float get_red_blue_level()const { return red_blue_level; } - - GammaPattern(); - - ~GammaPattern(); - - bool redraw(GdkEventExpose*bleh=NULL); -}; // END of class GammaPattern - -class BlackLevelSelector : public Gtk::DrawingArea -{ - float level; - - sigc::signal signal_value_changed_; - -public: - - BlackLevelSelector(); - - ~BlackLevelSelector(); - - sigc::signal& signal_value_changed() { return signal_value_changed_; } - - void set_value(float x) { level=x; queue_draw(); } - - const float &get_value()const { return level; } - - bool redraw(GdkEventExpose*bleh=NULL); - - bool on_event(GdkEvent *event); -}; // END of class BlackLevelSelector - -class RedBlueLevelSelector : public Gtk::DrawingArea -{ - float level; - - sigc::signal signal_value_changed_; - -public: - - RedBlueLevelSelector(); - - ~RedBlueLevelSelector(); - - sigc::signal& signal_value_changed() { return signal_value_changed_; } - - void set_value(float x) { level=x; queue_draw(); } - - const float &get_value()const { return level; } - - bool redraw(GdkEventExpose*bleh=NULL); - - bool on_event(GdkEvent *event); -}; // END of class RedBlueSelector - -class Widget_Enum; - -class Dialog_Setup : public Gtk::Dialog -{ - - void on_ok_pressed(); - void on_apply_pressed(); - - void on_gamma_r_change(); - void on_gamma_g_change(); - void on_gamma_b_change(); - void on_black_level_change(); - void on_red_blue_level_change(); - void on_size_template_combo_change(); - void on_fps_template_combo_change(); - - GammaPattern gamma_pattern; - BlackLevelSelector black_level_selector; - RedBlueLevelSelector red_blue_level_selector; - Gtk::OptionMenu timestamp_optionmenu; - - Gtk::Adjustment adj_gamma_r; - Gtk::Adjustment adj_gamma_g; - Gtk::Adjustment adj_gamma_b; - - Gtk::Adjustment adj_recent_files; - Gtk::Adjustment adj_undo_depth; - - Gtk::CheckButton toggle_use_colorspace_gamma; -#ifdef SINGLE_THREADED - Gtk::CheckButton toggle_single_threaded; -#endif - - synfig::Time::Format time_format; - - Gtk::Menu *timestamp_menu; - Widget_Enum *widget_enum; - - Widget_Time auto_backup_interval; - - Gtk::CheckButton toggle_restrict_radius_ducks; - Gtk::CheckButton toggle_resize_imported_images; - - Gtk::Entry textbox_browser_command; - - Gtk::ComboBoxText* size_template_combo; - Gtk::ComboBoxText* fps_template_combo; - Gtk::Entry textbox_custom_filename_prefix; - Gtk::Adjustment adj_pref_x_size; - Gtk::Adjustment adj_pref_y_size; - Gtk::Adjustment adj_pref_fps; - Gtk::SpinButton* pref_fps_spinbutton; - Gtk::SpinButton* pref_y_size_spinbutton; - Gtk::SpinButton* pref_x_size_spinbutton; - Gtk::Tooltips tooltips_; -public: - - void set_time_format(synfig::Time::Format time_format); - - const synfig::Time::Format& get_time_format()const { return time_format; } - - Dialog_Setup(); - ~Dialog_Setup(); - - void refresh(); - -}; // END of Dialog_Waypoint - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialog_soundselect.cpp b/synfig-studio/src/gui/dialog_soundselect.cpp deleted file mode 100644 index 0892616..0000000 --- a/synfig-studio/src/gui/dialog_soundselect.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_soundselect.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2008 David Roden -** -** 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_soundselect.h" -#include -#include -#include -#include - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; - -/* === 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 ================================================= */ - -studio::Dialog_SoundSelect::Dialog_SoundSelect(Gtk::Window &parent, etl::handle ci) -:Dialog(_("Sound Select"), parent, false, true), -canvas_interface(ci) -{ - Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - dialogPadding->set_padding(12, 12, 12, 12); - get_vbox()->pack_start(*dialogPadding, false, false, 0); - - Gtk::Frame *soundFrame = manage(new Gtk::Frame(_("Sound Parameters"))); - ((Gtk::Label *) soundFrame->get_label_widget())->set_markup(_("Sound Parameters")); - soundFrame->set_shadow_type(Gtk::SHADOW_NONE); - dialogPadding->add(*soundFrame); - - Gtk::Alignment *framePadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - framePadding->set_padding(6, 0, 24, 0); - soundFrame->add(*framePadding); - - Gtk::Label *fileLabel = manage(new Gtk::Label(_("_Sound File"), true)); - fileLabel->set_alignment(0, 0.5); - fileLabel->set_mnemonic_widget(soundfile); - Gtk::Label *offsetLabel = manage(new Gtk::Label(_("Time _Offset"), true)); - offsetLabel->set_alignment(0, 0.5); - offsetLabel->set_mnemonic_widget(offset); - - Gtk::Table *table = manage(new Gtk::Table(2, 2, false)); - table->set_row_spacings(6); - table->set_col_spacings(12); - framePadding->add(*table); - - table->attach(*fileLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); - table->attach(soundfile, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); - table->attach(*offsetLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); - table->attach(offset, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); - - okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-ok"))); - add_action_widget(*okbutton, 0); - - get_vbox()->show_all(); - - offset.set_value(0); - - okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_SoundSelect::on_ok)); -} - -studio::Dialog_SoundSelect::~Dialog_SoundSelect() -{ -} - -void studio::Dialog_SoundSelect::on_file() -{ - signal_file_changed_(soundfile.get_value()); -} - -void studio::Dialog_SoundSelect::on_offset() -{ - signal_offset_changed_(offset.get_value()); -} - -void studio::Dialog_SoundSelect::on_ok() -{ - hide(); - - //signal_finish_(a); - signal_file_changed_(soundfile.get_value()); - signal_offset_changed_(offset.get_value()); -} - -void studio::Dialog_SoundSelect::set_global_fps(float f) -{ - offset.set_fps(f); -} diff --git a/synfig-studio/src/gui/dialog_soundselect.h b/synfig-studio/src/gui/dialog_soundselect.h deleted file mode 100644 index d23ce93..0000000 --- a/synfig-studio/src/gui/dialog_soundselect.h +++ /dev/null @@ -1,86 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_soundselect.h -** \brief Sound Select Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2008 David Roden -** -** 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_DIALOG_SOUNDSELECT_H -#define __SYNFIG_DIALOG_SOUNDSELECT_H - -/* === H E A D E R S ======================================================= */ -#include "dockdialog.h" -#include "widget_filename.h" -#include "widget_time.h" - -#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 { - -struct AudioBaseInfo -{ - std::string file; - synfig::Time offset; -}; - -class Dialog_SoundSelect : public Gtk::Dialog -{ - Widget_Filename soundfile; - Widget_Time offset; - Gtk::Button *okbutton; - - etl::handle canvas_interface; - - sigc::signal signal_file_changed_; - sigc::signal signal_offset_changed_; - - void on_file(); - void on_offset(); - void on_ok(); - -public: - Dialog_SoundSelect(Gtk::Window &parent,etl::handle ci ); - ~Dialog_SoundSelect(); - - //float get_global_fps() const { return globalfps; } - void set_global_fps(float f); - - synfig::Time get_offset() const { return offset.get_value(); } - void set_offset(const synfig::Time &t) {offset.set_value(t); } - - std::string get_file() const { return soundfile.get_value(); } - void set_file(const std::string &f) {soundfile.set_value(f); } - - sigc::signal &signal_file_changed() { return signal_file_changed_; } - sigc::signal &signal_offset_changed() { return signal_offset_changed_; } -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialog_targetparam.cpp b/synfig-studio/src/gui/dialog_targetparam.cpp deleted file mode 100644 index 29cce71..0000000 --- a/synfig-studio/src/gui/dialog_targetparam.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* === 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 studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ -//! Allowed video codecs -/*! \warning This variable is linked to allowed_video_codecs_description, - * if you change this you must change the other acordingly. - * \warning These codecs are linked to the filename extensions for - * mod_ffmpeg. If you change this you must change the others acordingly. - */ -const char* allowed_video_codecs[] = -{ - "flv", "h263p", "huffyuv", "libtheora", "libx264", "libxvid", - "mjpeg", "mpeg1video", "mpeg2video", "mpeg4", "msmpeg4", - "msmpeg4v1", "msmpeg4v2", "wmv1", "wmv2", NULL -}; - -//! Allowed video codecs description. -/*! \warning This variable is linked to allowed_video_codecs, - * if you change this you must change the other acordingly. - */ -const char* allowed_video_codecs_description[] = -{ - "Flash Video (FLV) / Sorenson Spark / Sorenson H.263.", - "H.263+ / H.263-1998 / H.263 version 2.", - "Huffyuv / HuffYUV.", - "libtheora Theora.", - "libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10.", - "libxvidcore MPEG-4 part 2.", - "MJPEG (Motion JPEG).", - "raw MPEG-1 video.", - "raw MPEG-2 video.", - "MPEG-4 part 2.", - "MPEG-4 part 2 Microsoft variant version 3.", - "MPEG-4 part 2 Microsoft variant version 1.", - "MPEG-4 part 2 Microsoft variant version 2.", - "Windows Media Video 7.", - "Windows Media Video 8.", - NULL -}; -/* === 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); - for (int i = 0; allowed_video_codecs[i] != NULL && - allowed_video_codecs_description[i] != NULL; i++) - vcodec->append_text(allowed_video_codecs_description[i]); - for (int i = 0; allowed_video_codecs[i] != NULL && - allowed_video_codecs_description[i] != NULL; i++) - if(!get_tparam().video_codec.compare(allowed_video_codecs[i])) - vcodec->set_active_text(allowed_video_codecs_description[i]); - - 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,Gtk::RESPONSE_OK); - ok_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_ok)); - - cancel_button = manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); - cancel_button->show(); - add_action_widget(*cancel_button,Gtk::RESPONSE_CANCEL); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_cancel)); - -} - -void -Dialog_TargetParam::on_ok() -{ - std::string codecnamed = vcodec->get_active_text(); - for (int i = 0; allowed_video_codecs[i] != NULL && - allowed_video_codecs_description[i] != NULL; i++) - if(!codecnamed.compare(allowed_video_codecs_description[i])) - tparam_.video_codec=allowed_video_codecs[i]; - tparam_.bitrate=bitrate->get_value(); - hide(); -} - -void -Dialog_TargetParam::on_cancel() -{ - hide(); -} - -Dialog_TargetParam::~Dialog_TargetParam() -{ -} - diff --git a/synfig-studio/src/gui/dialog_targetparam.h b/synfig-studio/src/gui/dialog_targetparam.h deleted file mode 100644 index 8fa8cfb..0000000 --- a/synfig-studio/src/gui/dialog_targetparam.h +++ /dev/null @@ -1,71 +0,0 @@ -/* === 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 *cancel_button; - Gtk::SpinButton *bitrate; - Gtk::ComboBoxText *vcodec; - - void on_ok(); - void on_cancel(); - -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/gui/dialog_waypoint.cpp b/synfig-studio/src/gui/dialog_waypoint.cpp deleted file mode 100644 index 5fbf61c..0000000 --- a/synfig-studio/src/gui/dialog_waypoint.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_waypoint.cpp -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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 -#include "dialog_waypoint.h" -#include -#include -#include -#include -#include "widget_value.h" -#include "app.h" -#include -#include -#include "widget_time.h" -#include "widget_waypoint.h" - -#include "general.h" - -#endif - -using namespace synfig; -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 ======================================================= */ - -Dialog_Waypoint::Dialog_Waypoint(Gtk::Window& parent,etl::handle canvas): - Dialog(_("Waypoint Editor"),parent,false,true), - canvas(canvas) -{ - assert(canvas); - waypointwidget=manage(new class Widget_Waypoint(canvas)); - get_vbox()->pack_start(*waypointwidget); - - Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); - ok_button->show(); - add_action_widget(*ok_button,2); - ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_ok_pressed)); - - Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); - apply_button->show(); - add_action_widget(*apply_button,1); - apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_apply_pressed)); - - Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete")))); - delete_button->show(); - add_action_widget(*delete_button,3); - delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_delete_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::hide)); - - - waypointwidget->show_all(); -} - -Dialog_Waypoint::~Dialog_Waypoint() -{ -} - -void -Dialog_Waypoint::on_ok_pressed() -{ - hide(); - signal_changed_(); -} - -void -Dialog_Waypoint::on_apply_pressed() -{ - signal_changed_(); -} - -void -Dialog_Waypoint::on_delete_pressed() -{ - hide(); - signal_delete_(); -} - -void -Dialog_Waypoint::set_waypoint(synfig::ValueNode_Animated::Waypoint x) -{ - waypointwidget->set_waypoint(x); -} - -const synfig::ValueNode_Animated::Waypoint & -Dialog_Waypoint::get_waypoint()const -{ - return waypointwidget->get_waypoint(); -} - -void -Dialog_Waypoint::set_value_desc(synfigapp::ValueDesc value_desc) -{ - value_desc_=value_desc; - if(value_desc.get_value_node() && value_desc.get_value_node()->get_parent_canvas()) - waypointwidget->set_canvas(value_desc.get_value_node()->get_parent_canvas()); -} - -void -Dialog_Waypoint::reset() -{ -} diff --git a/synfig-studio/src/gui/dialog_waypoint.h b/synfig-studio/src/gui/dialog_waypoint.h deleted file mode 100644 index bbeab02..0000000 --- a/synfig-studio/src/gui/dialog_waypoint.h +++ /dev/null @@ -1,109 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_waypoint.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** 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_GTKMM_DIALOG_WAYPOINT_H -#define __SYNFIG_GTKMM_DIALOG_WAYPOINT_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -#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 Widget_ValueBase; -class Widget_Waypoint; - -class Dialog_Waypoint : public Gtk::Dialog -{ - Widget_Waypoint *waypointwidget; - etl::handle canvas; - synfig::ValueNode_Animated::WaypointList::iterator waypoint; - synfigapp::ValueDesc value_desc_; - - sigc::signal signal_changed_; - - sigc::signal signal_delete_; - void on_ok_pressed(); - void on_apply_pressed(); - void on_delete_pressed(); - -public: - Dialog_Waypoint(Gtk::Window& parent,etl::handle canvas); - ~Dialog_Waypoint(); - - void reset(); - - void set_value_desc(synfigapp::ValueDesc value_desc); - synfigapp::ValueDesc get_value_desc()const { return value_desc_; } - - void set_waypoint(synfig::ValueNode_Animated::Waypoint x); - const synfig::ValueNode_Animated::Waypoint &get_waypoint()const; - - sigc::signal &signal_changed() - {return signal_changed_; } - - sigc::signal &signal_delete() - {return signal_delete_; } -}; // END of Dialog_Waypoint - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialogs/about.cpp b/synfig-studio/src/gui/dialogs/about.cpp new file mode 100644 index 0000000..600d135 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/about.cpp @@ -0,0 +1,248 @@ +/* === S Y N F I G ========================================================= */ +/*! \file about.cpp +** \brief About dialog implementation +** +** $Id$ +** +** \legal +** Copyright (c) 2008 Paul Wise +** +** 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 + +#include + +#include + +#include + +#include + +// This is generated at make time from .svn or .git/svn or autorevision.conf +#include + +#include "about.h" +#include "app.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 ========================================================= */ + +#ifndef VERSION +#define VERSION "unknown" +#define PACKAGE "synfigstudio" +#endif + +#ifdef WIN32 +# ifdef IMAGE_DIR +# undef IMAGE_DIR +# define IMAGE_DIR "share\\pixmaps" +# endif +#endif + +#ifndef IMAGE_DIR +# define IMAGE_DIR "/usr/local/share/pixmaps" +#endif + +#ifndef IMAGE_EXT +# define IMAGE_EXT "png" +#endif + +#define stringify_(x) #x +#define stringify(x) stringify_(x) + +/* === G L O B A L S ======================================================= */ + +extern const guint gtk_major_version; +extern const guint gtk_minor_version; +extern const guint gtk_micro_version; +extern const guint gtk_binary_age; +extern const guint gtk_interface_age; + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +About::About() +{ + +#ifdef HAVE_GTK_ABOUTDIALOG_SET_PROGRAM_NAME + set_program_name(PACKAGE_NAME); +#else + set_name(PACKAGE_NAME); +#endif + set_version(VERSION); + set_comments(_("2D vector animation studio")); + + set_url_hook(sigc::mem_fun(*this, &About::on_link_clicked)); + set_website("http://www.synfig.org/"); + set_website_label(_("Visit the Synfig website")); + + set_copyright(_("Copyright 2001-2008\nRobert B. Quattlebaum Jr.,\nAdrian Bentley and Synfig contributors")); + Glib::ustring license = + "This program 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.\n\n" + + "This program 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.\n\n" + + "You should have received a copy of the GNU General Public License along " + "with this program; if not, write to the Free Software Foundation, Inc., " + "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or visit: http://www.gnu.org/"; + set_license(license); +#ifdef HAVE_GTK_ABOUTDIALOG_SET_WRAP_LICENSE + set_wrap_license(true); +#endif + + std::vector authors; + authors.push_back(_("Original developers:")); + authors.push_back(""); + authors.push_back("Robert B. Quattlebaum Jr (darco)"); + authors.push_back("Adrian Bentley"); + authors.push_back(""); + authors.push_back(_("Contributors:")); + authors.push_back(""); + authors.push_back("Adrian Winchell (SnapSilverlight)"); + authors.push_back("Andreas Jochens"); + authors.push_back("Carlos López González (genete)"); + authors.push_back("Carlos A. Sosa Navarro"); + authors.push_back("Chris Moore (dooglus)"); + authors.push_back("Chris Norman (pixelgeek)"); + authors.push_back("Cyril Brulebois (KiBi)"); + authors.push_back("Daniel Fort"); + authors.push_back("Daniel Hornung (rubikcube)"); + authors.push_back("David Roden (Bombe)"); + authors.push_back("Dmitriy Pomerantsev (Atrus)"); + authors.push_back("Douglas Lau"); + authors.push_back("Gerald Young (Yoyobuae)"); + authors.push_back("Gerco Ballintijn"); + authors.push_back("IL'dar AKHmetgaleev (AkhIL)"); + authors.push_back("Konstantin Dmitriev (zelgadis)"); + authors.push_back("Luka Pravica"); + authors.push_back("Martin Michlmayr (tbm)"); + authors.push_back("Miguel Gea Milvaques (xerakko)"); + authors.push_back("Paul Wise (pabs)"); + authors.push_back("Ralf Corsepius"); + authors.push_back("Ray Frederikson"); + authors.push_back("Timo Paulssen (timonator)"); + authors.push_back("Yue Shi Lai"); + set_authors(authors); + + std::vector artists; + artists.push_back("Aurore D (rore)"); + artists.push_back("Carlos López González (genete)"); + artists.push_back("Chris Norman (pixelgeek)"); + artists.push_back("Daniel Hornung (rubikcube)"); + artists.push_back("David Rylander (rylleman)"); + artists.push_back("Franco Iacomella (Yaco)"); + artists.push_back("Gerald Young (Yoyobuae)"); + artists.push_back("Henrique Lopes Barone"); + artists.push_back("Robert B. Quattlebaum Jr. (darco)"); + + set_artists(artists); + + // TRANSLATORS: change this to your name, separate multiple names with \n + set_translator_credits(_("translator-credits")); + + std::string imagepath; +#ifdef WIN32 + imagepath=App::get_base_path()+ETL_DIRECTORY_SEPARATOR+IMAGE_DIR; +#else + imagepath=IMAGE_DIR; +#endif + char* synfig_root=getenv("SYNFIG_ROOT"); + if(synfig_root) { + imagepath=synfig_root; + imagepath+=ETL_DIRECTORY_SEPARATOR; + imagepath+="share"; + imagepath+=ETL_DIRECTORY_SEPARATOR; + imagepath+="pixmaps"; + } + imagepath+=ETL_DIRECTORY_SEPARATOR; + + Gtk::Image *Logo = manage(new class Gtk::Image()); + Logo->set(imagepath+"synfig_icon."IMAGE_EXT); + set_logo(Logo->get_pixbuf()); + +#ifdef SHOW_EXTRA_INFO + + string extra_info = get_comments() + "\n"; + + #ifdef DEVEL_VERSION + extra_info += strprintf(_("\nDevelopment version:\n%s\n"),DEVEL_VERSION); + #endif + + extra_info += "\n"; + + extra_info += strprintf(_("Built on %s" /* at %s */ "\n"), __DATE__ /* , __TIME__ */ ); + + extra_info += "\n"; + + extra_info += strprintf(_("Built with:\n"), ETL_VERSION); + extra_info += strprintf(_("ETL %s\n"), ETL_VERSION); + extra_info += strprintf(_("Synfig API %s\n"), stringify(SYNFIG_VERSION)); + extra_info += strprintf(_("Synfig library %d\n"), SYNFIG_LIBRARY_VERSION); + extra_info += strprintf(_("GTK+ %d.%d.%d\n"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + #ifdef __GNUC__ + extra_info += strprintf(_("GNU G++ %d.%d.%d\n"),__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__); + #endif + + extra_info += "\n"; + + extra_info += strprintf(_("Using:\n"), synfig::get_version()); + extra_info += strprintf(_("Synfig %s\n"), synfig::get_version()); + extra_info += strprintf(_("GTK+ %d.%d.%d"),gtk_major_version,gtk_minor_version,gtk_micro_version); + + #ifdef _DEBUG + extra_info += "\n\nDEBUG BUILD"; + #endif + + set_comments(extra_info); + +#endif + + // Hide the dialog when you click close + signal_response().connect(sigc::mem_fun(*this, &About::close)); +} + +void About::close(int){ + hide(); +} + +void About::on_link_clicked(Gtk::AboutDialog&, const Glib::ustring &url) +{ + App::open_url(url); +} diff --git a/synfig-studio/src/gui/dialogs/about.h b/synfig-studio/src/gui/dialogs/about.h new file mode 100644 index 0000000..f00a773 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/about.h @@ -0,0 +1,55 @@ +/* === S Y N F I G ========================================================= */ +/*! \file about.h +** \brief About dialog class +** +** $Id$ +** +** \legal +** Copyright (c) 2008 Paul Wise +** +** 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_GTKMM_ABOUT_H +#define __SYNFIG_GTKMM_ABOUT_H + +/* === H E A D E R S ======================================================= */ + +#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 About : public Gtk::AboutDialog +{ +public: + + About(); + void close(int); + void on_link_clicked(Gtk::AboutDialog&, const Glib::ustring &url); +}; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/canvasoptions.cpp b/synfig-studio/src/gui/dialogs/canvasoptions.cpp new file mode 100644 index 0000000..dfc15ed --- /dev/null +++ b/synfig-studio/src/gui/dialogs/canvasoptions.cpp @@ -0,0 +1,215 @@ +/* === S Y N F I G ========================================================= */ +/*! \file canvasoptions.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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 "canvasoptions.h" +#include +#include +#include +#include +#include +#include "canvasview.h" +#include "workarea.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +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 ======================================================= */ + +CanvasOptions::CanvasOptions(etl::loose_handle canvas_view): + Gtk::Dialog(_("Canvas Options"),*canvas_view,false,true), + canvas_view_(canvas_view), + toggle_grid_snap(_("_Snap to grid"), true), + toggle_grid_show(_("S_how grid"), true), + toggle_time_snap(_("Snap to _frame"), true) +{ + vector_grid_size.set_canvas(canvas_view->get_canvas()); + + Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + dialogPadding->set_padding(12, 12, 12, 12); + + Gtk::Notebook *notebook=manage(new class Gtk::Notebook()); + dialogPadding->add(*notebook); + + toggle_grid_snap.signal_toggled().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_grid_snap_toggle)); + toggle_grid_show.signal_toggled().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_grid_show_toggle)); + + Gtk::Alignment *gridPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + gridPadding->set_padding(12, 12, 12, 12); + notebook->append_page(*gridPadding, _("Grid")); + + Gtk::VBox *gridBox = manage(new Gtk::VBox(false, 12)); + gridPadding->add(*gridBox); + + Gtk::Table *gridTable = manage(new Gtk::Table(3, 2, false)); + gridTable->set_row_spacings(6); + gridTable->set_col_spacings(12); + gridBox->pack_start(*gridTable, false, false, 0); + + Gtk::Label *gridSizeLabel = manage(new Gtk::Label(_("_Grid size"), true)); + gridSizeLabel->set_alignment(0, 0.5); + gridSizeLabel->set_mnemonic_widget(vector_grid_size); + + toggle_grid_show.set_alignment(0, 0.5); + toggle_grid_snap.set_alignment(0, 0.5); + + gridTable->attach(*gridSizeLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); + gridTable->attach(vector_grid_size, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); + gridTable->attach(toggle_grid_show, 0, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); + gridTable->attach(toggle_grid_snap, 0, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); + + Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + timePadding->set_padding(12, 12, 12, 12); + notebook->append_page(*timePadding, _("Time")); + + Gtk::VBox *timeBox = manage(new Gtk::VBox(false, 12)); + timePadding->add(*timeBox); + + timeBox->pack_start(toggle_time_snap, false, false, 0); + + Gtk::Alignment *unitPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + unitPadding->set_padding(12, 12, 12, 12); + notebook->append_page(*unitPadding, _("Units")); + unitPadding->add(*manage(new Gtk::Label(_("Not yet implemented!")))); + + Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); + ok_button->show(); + add_action_widget(*ok_button,2); + ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_ok_pressed)); + + Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); + apply_button->show(); + add_action_widget(*apply_button,1); + apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_apply_pressed)); + + Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); + cancel_button->show(); + add_action_widget(*cancel_button,0); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_cancel_pressed)); + + //set_default_response(1); + + + get_vbox()->pack_start(*dialogPadding); + get_vbox()->show_all(); + + signal_show().connect(sigc::mem_fun(*this, &studio::CanvasOptions::refresh)); + + vector_grid_size.set_digits(5); + + update_title(); +} + +CanvasOptions::~CanvasOptions() +{ +} + +void +CanvasOptions::update_title() +{ + set_title(_("Options")+String(" - ")+canvas_view_->get_canvas()->get_name()); +} + +void +CanvasOptions::refresh() +{ + if(canvas_view_->work_area->grid_status()) + toggle_grid_show.set_active(true); + else + toggle_grid_show.set_active(false); + + if(canvas_view_->work_area->get_grid_snap()) + toggle_grid_snap.set_active(true); + else + toggle_grid_snap.set_active(false); + + vector_grid_size.set_value(canvas_view_->work_area->get_grid_size()); + + tooltips.set_tip(toggle_time_snap,_("Not yet implemented")); + toggle_time_snap.set_sensitive(false); + + update_title(); +} + +void +CanvasOptions::on_grid_snap_toggle() +{ +} + +void +CanvasOptions::on_grid_show_toggle() +{ +} + +void +CanvasOptions::on_apply_pressed() +{ + canvas_view_->set_grid_snap_toggle(toggle_grid_snap.get_active()); + if(toggle_grid_snap.get_active()) + canvas_view_->work_area->enable_grid_snap(); + else + canvas_view_->work_area->disable_grid_snap(); + + canvas_view_->set_grid_show_toggle(toggle_grid_show.get_active()); + if(toggle_grid_show.get_active()) + canvas_view_->work_area->enable_grid(); + else + canvas_view_->work_area->disable_grid(); + + canvas_view_->work_area->set_grid_size(vector_grid_size.get_value()); +} + +void +CanvasOptions::on_ok_pressed() +{ + on_apply_pressed(); + hide(); +} + +void +CanvasOptions::on_cancel_pressed() +{ + refresh(); + hide(); +} diff --git a/synfig-studio/src/gui/dialogs/canvasoptions.h b/synfig-studio/src/gui/dialogs/canvasoptions.h new file mode 100644 index 0000000..32f90f9 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/canvasoptions.h @@ -0,0 +1,82 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/canvasoptions.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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_GTKMM_CANVASOPTIONS_H +#define __SYNFIG_GTKMM_CANVASOPTIONS_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include +#include +#include "widget_value.h" +#include "widget_vector.h" + +/* === 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 CanvasView; + +class CanvasOptions : public Gtk::Dialog +{ + Gtk::Tooltips tooltips; + + etl::loose_handle canvas_view_; + + Gtk::CheckButton toggle_grid_snap; + Gtk::CheckButton toggle_grid_show; + + Widget_Vector vector_grid_size; + + Gtk::CheckButton toggle_time_snap; + +public: + CanvasOptions(etl::loose_handle canvas_view); + ~CanvasOptions(); + + void refresh(); + void update_title(); +private: + + void on_grid_snap_toggle(); + void on_grid_show_toggle(); + + void on_ok_pressed(); + void on_apply_pressed(); + void on_cancel_pressed(); +}; // END of class CanvasOptions + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/canvasproperties.cpp b/synfig-studio/src/gui/dialogs/canvasproperties.cpp new file mode 100644 index 0000000..25e48eb --- /dev/null +++ b/synfig-studio/src/gui/dialogs/canvasproperties.cpp @@ -0,0 +1,255 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/canvasproperties.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore +** +** 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 "dialogs/canvasproperties.h" +#include +#include +#include +#include +#include +#include "metadatatreestore.h" +#include +#include +#include "app.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +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 ======================================================= */ + +CanvasProperties::CanvasProperties(Gtk::Window& parent,etl::handle canvas_interface): + Gtk::Dialog(_("Canvas Properties"),parent,false,true), + canvas_interface_(canvas_interface) +{ + widget_rend_desc.show(); + widget_rend_desc.signal_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::on_rend_desc_changed)); + + Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + dialogPadding->set_padding(12, 12, 12, 12); + get_vbox()->pack_start(*dialogPadding, false, false, 0); + + Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12)); + dialogPadding->add(*dialogBox); + + Gtk::Frame *info_frame=manage(new Gtk::Frame(_("Canvas Info"))); + info_frame->set_shadow_type(Gtk::SHADOW_NONE); + ((Gtk::Label *) info_frame->get_label_widget())->set_markup(_("Canvas Info")); + dialogBox->pack_start(*info_frame, false, false, 0); + + Gtk::Alignment *infoPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + infoPadding->set_padding(6, 0, 24, 0); + info_frame->add(*infoPadding); + + Gtk::Table *info_table=manage(new Gtk::Table(2,2,false)); + info_table->set_row_spacings(6); + info_table->set_col_spacings(12); + infoPadding->add(*info_table); + + // The root canvas doesn't have an ID, so don't + // display it if this is a root canvas. + if(!canvas_interface_->get_canvas()->is_root()) + { + Gtk::Label *idLabel = manage(new Gtk::Label(_("_ID"), true)); + idLabel->set_alignment(0, 0.5); + idLabel->set_mnemonic_widget(entry_id); + info_table->attach(*idLabel, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + info_table->attach(entry_id, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + } + Gtk::Label *nameLabel = manage(new Gtk::Label(_("_Name"), true)); + nameLabel->set_alignment(0, 0.5); + nameLabel->set_mnemonic_widget(entry_name); + Gtk::Label *descriptionLabel = manage(new Gtk::Label(_("_Description"), true)); + descriptionLabel->set_alignment(0, 0.5); + descriptionLabel->set_mnemonic_widget(entry_description); + info_table->attach(*nameLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + info_table->attach(*descriptionLabel, 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + info_table->attach(entry_name, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + info_table->attach(entry_description, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + + dialogBox->pack_start(widget_rend_desc, false, false, 0); + + canvas_interface_->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh)); + canvas_interface_->signal_id_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh)); + + Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); + ok_button->show(); + add_action_widget(*ok_button,2); + ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_ok_pressed)); + + Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); + apply_button->show(); + add_action_widget(*apply_button,1); + apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_apply_pressed)); + + Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); + cancel_button->show(); + add_action_widget(*cancel_button,0); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_cancel_pressed)); + + //set_default_response(1); + + get_vbox()->show_all(); + refresh(); + + update_title(); +} + +Gtk::Widget& +CanvasProperties::create_meta_data_view() +{ + MetaDataTreeStore::Model model; + meta_data_tree_view=(manage(new class Gtk::TreeView())); + + meta_data_tree_view->append_column(_("Key"),model.key); + meta_data_tree_view->append_column_editable(_("Data"),model.data); + meta_data_tree_view->set_model(MetaDataTreeStore::create(canvas_interface_)); + meta_data_tree_view->set_rules_hint(); + meta_data_tree_view->show(); + + Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); + scrolledwindow->set_flags(Gtk::CAN_FOCUS); + scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scrolledwindow->add(*meta_data_tree_view); + scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); + scrolledwindow->show(); + + + + Gtk::Table *table=manage(new Gtk::Table()); + table->attach(*scrolledwindow, 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + + Gtk::Button* button_add(manage(new Gtk::Button(Gtk::StockID("gtk-add")))); + button_add->show(); + button_add->signal_clicked().connect(sigc::mem_fun(*this,&CanvasProperties::on_button_meta_data_add)); + table->attach(*button_add, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + + Gtk::Button* button_delete(manage(new Gtk::Button(Gtk::StockID("gtk-delete")))); + button_delete->show(); + button_delete->signal_clicked().connect(sigc::mem_fun(*this,&CanvasProperties::on_button_meta_data_delete)); + table->attach(*button_delete, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + + table->show(); + return *table; +} + +void +CanvasProperties::on_button_meta_data_add() +{ + synfig::String key; + if(App::dialog_entry(_("New MetaData Entry"), _("Please enter the name of the key"),key) && !key.empty()) + { + canvas_interface_->set_meta_data(key," "); + } + +} + +void +CanvasProperties::on_button_meta_data_delete() +{ +} + +void +CanvasProperties::update_title() +{ + set_title(_("Properties")+String(" - ")+canvas_interface_->get_canvas()->get_name()); +} + +void +CanvasProperties::refresh() +{ + widget_rend_desc.set_rend_desc(canvas_interface_->get_canvas()->rend_desc()); + entry_id.set_text(canvas_interface_->get_canvas()->get_id()); + entry_name.set_text(canvas_interface_->get_canvas()->get_name()); + entry_description.set_text(canvas_interface_->get_canvas()->get_description()); + + dirty_rend_desc=false; + + update_title(); +} + +CanvasProperties::~CanvasProperties() +{ +} + +void +CanvasProperties::on_rend_desc_changed() +{ + dirty_rend_desc=true; +} + +void +CanvasProperties::on_apply_pressed() +{ + synfigapp::Action::PassiveGrouper group(canvas_interface_->get_instance().get(),_("Edit Canvas Properties")); + + // fetch these three values first, because each set_() method refreshes the dialog with currently set values + String id = entry_id.get_text(); + String name = entry_name.get_text(); + String description = entry_description.get_text(); + + // do this first, because the other three cause the dialog to be refreshed with currently set values + if (dirty_rend_desc) canvas_interface_->set_rend_desc(widget_rend_desc.get_rend_desc()); + + if (id != canvas_interface_->get_canvas()->get_id() && !id.empty()) canvas_interface_->set_id(id); + if (name != canvas_interface_->get_canvas()->get_name()) canvas_interface_->set_name(name); + if (description != canvas_interface_->get_canvas()->get_description()) canvas_interface_->set_description(description); + + dirty_rend_desc=false; +} + +void +CanvasProperties::on_ok_pressed() +{ + on_apply_pressed(); + hide(); +} + +void +CanvasProperties::on_cancel_pressed() +{ + refresh(); + hide(); +} diff --git a/synfig-studio/src/gui/dialogs/canvasproperties.h b/synfig-studio/src/gui/dialogs/canvasproperties.h new file mode 100644 index 0000000..dcb2b77 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/canvasproperties.h @@ -0,0 +1,87 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/canvasproperties.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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_GTKMM_CANVASPROPERTIES_H +#define __SYNFIG_GTKMM_CANVASPROPERTIES_H + +/* === H E A D E R S ======================================================= */ + +#include + +#include +#include +#include +#include +#include + +#include "renddesc.h" + +/* === 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 Gtk { class TreeView; }; +namespace synfigapp { class CanvasInterface; }; + +namespace studio +{ +class CanvasProperties : public Gtk::Dialog +{ + Gtk::Tooltips tooltips; + + etl::handle canvas_interface_; + Widget_RendDesc widget_rend_desc; + Gtk::Entry entry_id; + Gtk::Entry entry_name; + Gtk::Entry entry_description; + + bool dirty_rend_desc; + + Gtk::TreeView* meta_data_tree_view; + void on_button_meta_data_add(); + void on_button_meta_data_delete(); + +public: + CanvasProperties(Gtk::Window& parent,etl::handle canvas_interface); + ~CanvasProperties(); + + void refresh(); + void update_title(); +private: + void on_rend_desc_changed(); + + Gtk::Widget& create_meta_data_view(); + + void on_ok_pressed(); + void on_apply_pressed(); + void on_cancel_pressed(); +}; // END of class CanvasProperties + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_color.cpp b/synfig-studio/src/gui/dialogs/dialog_color.cpp new file mode 100644 index 0000000..d5753ca --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_color.cpp @@ -0,0 +1,155 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_color.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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 "dialogs/dialog_color.h" +#include "widget_color.h" +#include +#include +#include +#include "app.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +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 ======================================================= */ + +Dialog_Color::Dialog_Color(): + Dialog(_("Colors"), false, true), + dialog_settings(this, "color"), + busy_(false) +{ + set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); + + create_color_edit_widget(); + create_set_color_button("synfig-set_outline_color", _("Set as Outline"), 0, + sigc::mem_fun(*this, &Dialog_Color::on_set_oc_pressed)); + create_set_color_button("synfig-set_fill_color", _("Set as Fill"), 1, + sigc::mem_fun(*this, &Dialog_Color::on_set_fc_pressed)); + create_close_button(); + + add_accel_group(App::ui_manager()->get_accel_group()); + show_all_children(); +} + +Dialog_Color::~Dialog_Color() +{ +} + +void +Dialog_Color::create_color_edit_widget() +{ + color_edit_widget = manage(new Widget_ColorEdit()); + color_edit_widget->signal_value_changed().connect(sigc::mem_fun(*this, + &studio::Dialog_Color::on_color_changed)); + get_vbox()->pack_start(*color_edit_widget); +} + +void +Dialog_Color::create_set_color_button(const char *stock_id, + const Glib::ustring& tip_text, int index, + const sigc::slot0& callback) +{ + Gtk::Button *set_color_button = manage(new Gtk::Button()); + Gtk::Image *set_color_icon = manage(new Gtk::Image(Gtk::StockID(stock_id), + Gtk::IconSize::IconSize(Gtk::ICON_SIZE_BUTTON))); + set_color_button->add(*set_color_icon); + set_color_icon->show(); + tooltips.set_tip(*set_color_button, tip_text); + set_color_button->show(); + add_action_widget(*set_color_button, index); + set_color_button->signal_clicked().connect(callback); +} + +void +Dialog_Color::create_close_button() +{ + Gtk::Button *close_button(manage(new Gtk::Button(Gtk::StockID("gtk-close")))); + close_button->show(); + add_action_widget(*close_button, 2); + close_button->signal_clicked().connect(sigc::hide_return(sigc::mem_fun(*this, + &Dialog_Color::on_close_pressed))); + signal_delete_event().connect(sigc::hide(sigc::mem_fun(*this, + &Dialog_Color::on_close_pressed))); +} + +void +Dialog_Color::on_color_changed() +{ + busy_ = true; + signal_edited_(get_color()); + busy_ = false; +} + +void +Dialog_Color::on_set_oc_pressed() +{ + busy_ = true; + synfigapp::Main::set_outline_color(get_color()); + busy_ = false; +} + +void +Dialog_Color::on_set_fc_pressed() +{ + busy_ = true; + synfigapp::Main::set_fill_color(get_color()); + busy_ = false; +} + +bool +Dialog_Color::on_close_pressed() +{ + busy_ = false; + grab_focus(); + reset(); + hide(); + return true; +} + +void +Dialog_Color::reset() +{ + signal_edited_.clear(); +} diff --git a/synfig-studio/src/gui/dialogs/dialog_color.h b/synfig-studio/src/gui/dialogs/dialog_color.h new file mode 100644 index 0000000..e8e442c --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_color.h @@ -0,0 +1,88 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/dialog_color.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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_COLOR_H +#define __SYNFIG_STUDIO_DIALOG_COLOR_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include + +#include "widget_coloredit.h" +#include "dialogsettings.h" + +/* === 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 Widget_Color; + +class Dialog_Color : public Gtk::Dialog +{ + DialogSettings dialog_settings; + Gtk::Tooltips tooltips; + + Widget_ColorEdit* color_edit_widget; + + sigc::signal signal_edited_; + + bool busy_; + + void create_color_edit_widget(); + void create_set_color_button(const char *stock_id, + const Glib::ustring& tip_text, int index, + const sigc::slot0& callback); + void create_close_button(); + + void on_color_changed(); + void on_set_oc_pressed(); + void on_set_fc_pressed(); + bool on_close_pressed(); + +public: + Dialog_Color(); + ~Dialog_Color(); + + sigc::signal& signal_edited() { return signal_edited_; } + + void set_color(const synfig::Color& x) { color_edit_widget->set_value(x); } + synfig::Color get_color() const { return color_edit_widget->get_value(); } + void reset(); + + bool busy() const { return busy_; } + +}; // END of Dialog_Color + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_gradient.cpp b/synfig-studio/src/gui/dialogs/dialog_gradient.cpp new file mode 100644 index 0000000..ce38992 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_gradient.cpp @@ -0,0 +1,185 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_gradient.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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 "dialogs/dialog_gradient.h" +#include "widget_gradient.h" +#include +#include +#include +#include +#include +#include +#include +#include "widget_color.h" +#include +#include "app.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +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 ======================================================= */ + +Dialog_Gradient::Dialog_Gradient(): + Dialog(_("Gradient Editor"),false,true), + dialog_settings(this,"gradient"), + adjustment_pos(0,0.0,1.0,0.001,0.001,0) +{ + set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); + set_keep_above(false); + + set_role("gradient_editor"); + + // Setup the buttons + set_default_button = manage(new class Gtk::Button(Gtk::StockID(_("Set as Default")))); + set_default_button->show(); + add_action_widget(*set_default_button,2); + set_default_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Gradient::on_set_default_pressed)); + + Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); + cancel_button->show(); + add_action_widget(*cancel_button,0); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Gradient::hide)); + + Gtk::Table* table(manage(new Gtk::Table(2,2,false))); + get_vbox()->pack_start(*table); + + widget_gradient=manage(new Widget_Gradient()); + widget_gradient->set_editable(); + widget_gradient->signal_cpoint_selected().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_cpoint_selected)); + widget_gradient->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_changed)); + //table->attach(*manage(new Gtk::Label(_("Not yet fully implemented"))), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + table->attach(*widget_gradient, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + + widget_color=manage(new Widget_ColorEdit()); + widget_color->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_values_adjusted)); + widget_color->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_changed)); + widget_color->signal_activated().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_values_adjusted)); + table->attach(*widget_color, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + + + spinbutton_pos=manage(new class Gtk::SpinButton(adjustment_pos,0.0001,4)); + spinbutton_pos->set_update_policy(Gtk::UPDATE_ALWAYS); + adjustment_pos.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_values_adjusted)); + adjustment_pos.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Gradient::on_changed)); + table->attach(*spinbutton_pos, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + + + add_accel_group(App::ui_manager()->get_accel_group()); + + show_all_children(); +} + +Dialog_Gradient::~Dialog_Gradient() +{ +} + +void +Dialog_Gradient::set_gradient(const synfig::Gradient& x) +{ + widget_gradient->set_value(x); +} + +void +Dialog_Gradient::reset() +{ + value_changed_connection.disconnect(); + signal_edited_.clear(); +} + +void +Dialog_Gradient::on_set_default_pressed() +{ + synfigapp::Main::set_gradient(get_gradient()); +} + +void +Dialog_Gradient::on_changed() +{ + signal_edited_(get_gradient()); +} + +void +Dialog_Gradient::on_cpoint_selected(synfig::Gradient::CPoint x) +{ + widget_color->set_value(x.color); + adjustment_pos.set_value(x.pos); +} + +void +Dialog_Gradient::on_values_adjusted() +{ + synfig::Gradient::CPoint x(widget_gradient->get_selected_cpoint()); + x.color=widget_color->get_value(); + x.pos=adjustment_pos.get_value(); + widget_gradient->update_cpoint(x); +} + +static void +dialog_gradient_value_desc_edit(synfig::Gradient /*g*/,synfigapp::ValueDesc /*x*/,handle /*canvas_interface*/) +{ +// canvas_interface->connect_value(x,ValueBase(g)); +} + +void +Dialog_Gradient::edit(const synfigapp::ValueDesc &x, etl::handle canvas_interface, synfig::Time time) +{ + reset(); + if(x.is_const()) + set_gradient(x.get_value().get(Gradient())); + else if(x.is_value_node()) + set_gradient((*x.get_value_node())(time).get(Gradient())); + + signal_edited().connect( + sigc::bind( + sigc::bind( + sigc::ptr_fun(dialog_gradient_value_desc_edit), + canvas_interface + ), + x + ) + ); + + present(); +} diff --git a/synfig-studio/src/gui/dialogs/dialog_gradient.h b/synfig-studio/src/gui/dialogs/dialog_gradient.h new file mode 100644 index 0000000..0359106 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_gradient.h @@ -0,0 +1,115 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/dialog_gradient.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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_GRADIENT_H +#define __SYNFIG_STUDIO_DIALOG_GRADIENT_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "widget_gradient.h" +#include "widget_coloredit.h" + +#include +#include + +#include "dialogsettings.h" + +/* === 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 Gtk { class Menu; class SpinButton; class Adjustment; }; + +namespace synfigapp { +class CanvasInterface; +}; + +namespace studio { + +class Widget_Gradient; +class Widget_ColorEdit; + +class Dialog_Gradient : public Gtk::Dialog +{ + DialogSettings dialog_settings; + + Gtk::SpinButton *spinbutton_pos; + + Gtk::Adjustment adjustment_pos; + + + sigc::signal signal_edited_; + + sigc::connection value_changed_connection; + + void on_set_default_pressed(); + + void on_cpoint_selected(synfig::Gradient::CPoint x); + void on_values_adjusted(); + + Widget_Gradient* widget_gradient; + Widget_ColorEdit* widget_color; + Gtk::Button *set_default_button; + + void on_changed(); + +public: + + sigc::signal& signal_edited() { return signal_edited_; } + + void set_gradient(const synfig::Gradient& x); + + const synfig::Gradient& get_gradient()const { return widget_gradient->get_value(); } + + void set_default_button_set_sensitive(bool sensitive) { set_default_button->set_sensitive(sensitive); } + + void reset(); + + + Dialog_Gradient(); + ~Dialog_Gradient(); + //! Interface to external calls to fill in the Gradient Editor Dialog + //! when a Constant ValueNode or a Animated ValueNode is double cliked. + void edit(const synfigapp::ValueDesc &x, etl::handle canvas_interface, synfig::Time time=0); +}; // END of Dialog_Gradient + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_keyframe.cpp b/synfig-studio/src/gui/dialogs/dialog_keyframe.cpp new file mode 100644 index 0000000..f6774b2 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_keyframe.cpp @@ -0,0 +1,166 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_keyframe.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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 "dialogs/dialog_keyframe.h" +#include +#include +#include "widget_waypointmodel.h" +#include +#include + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +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 ======================================================= */ + +Dialog_Keyframe::Dialog_Keyframe(Gtk::Window& parent, etl::handle canvas_interface): + Gtk::Dialog(_("Keyframe Dialog"),parent,false,true), + canvas_interface(canvas_interface) +{ + // Set up the buttons + { + Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); + ok_button->show(); + add_action_widget(*ok_button,2); + ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_ok_pressed)); + + Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); + apply_button->show(); + add_action_widget(*apply_button,1); + apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_apply_pressed)); + + Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete")))); + delete_button->show(); + add_action_widget(*delete_button,3); + delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_delete_pressed)); + + Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); + cancel_button->show(); + add_action_widget(*cancel_button,0); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::hide)); + } + + Gtk::Table *table=manage(new Gtk::Table(2,2,false)); + + get_vbox()->pack_start(*table); + +/* // \todo Allow setting descriptions for keyframes + + entry_description.set_text(_("Not yet implemented")); + + table->attach(*manage(new Gtk::Label(_("Description"))), 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + table->attach(entry_description, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); +*/ + + table->show_all(); + + widget_waypoint_model=Gtk::manage(new Widget_WaypointModel()); + widget_waypoint_model->show(); + table->attach(*widget_waypoint_model, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + +} + +Dialog_Keyframe::~Dialog_Keyframe() +{ +} + +const synfig::Keyframe& +Dialog_Keyframe::get_keyframe()const +{ + return keyframe_; +} + +void +Dialog_Keyframe::set_keyframe(const synfig::Keyframe& x) +{ + keyframe_=x; +} + +void +Dialog_Keyframe::on_ok_pressed() +{ + on_apply_pressed(); + hide(); +} + + +void +Dialog_Keyframe::on_delete_pressed() +{ + synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeRemove")); + + assert(action); + + action->set_param("canvas",canvas_interface->get_canvas()); + action->set_param("canvas_interface",canvas_interface); + action->set_param("keyframe",keyframe_); + action->set_param("model",widget_waypoint_model->get_waypoint_model()); + + if(canvas_interface->get_instance()->perform_action(action)) + { + hide(); + } +} + + +void +Dialog_Keyframe::on_apply_pressed() +{ + if(widget_waypoint_model->get_waypoint_model().is_trivial()) + return; + + synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeWaypointSet")); + + assert(action); + + action->set_param("canvas",canvas_interface->get_canvas()); + action->set_param("canvas_interface",canvas_interface); + action->set_param("keyframe",keyframe_); + action->set_param("model",widget_waypoint_model->get_waypoint_model()); + + if(!canvas_interface->get_instance()->perform_action(action)) + { + } +} diff --git a/synfig-studio/src/gui/dialogs/dialog_keyframe.h b/synfig-studio/src/gui/dialogs/dialog_keyframe.h new file mode 100644 index 0000000..a316ecb --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_keyframe.h @@ -0,0 +1,79 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/dialog_keyframe.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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_KEYFRAME_H +#define __SYNFIG_STUDIO_DIALOG_KEYFRAME_H + +/* === H E A D E R S ======================================================= */ + +#include +#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 Widget_WaypointModel; + +class Dialog_Keyframe : public Gtk::Dialog +{ + Gtk::Tooltips tooltips_; + etl::handle canvas_interface; + + synfig::Keyframe keyframe_; + + Gtk::Entry entry_description; + + Widget_WaypointModel* widget_waypoint_model; + + void on_ok_pressed(); + void on_apply_pressed(); + void on_delete_pressed(); + +public: + Dialog_Keyframe(Gtk::Window& parent,etl::handle canvas_interface); + ~Dialog_Keyframe(); + + const synfig::Keyframe& get_keyframe()const; + void set_keyframe(const synfig::Keyframe& x); + +private: + +}; // END of class Dialog_Keyframe + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_preview.cpp b/synfig-studio/src/gui/dialogs/dialog_preview.cpp new file mode 100644 index 0000000..0d5d776 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_preview.cpp @@ -0,0 +1,220 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_preview.cpp +** \brief Preview dialog File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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 "dialogs/dialog_preview.h" +#include "preview.h" +#include +#include +#include +#include +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +using namespace studio; +using namespace Gtk; + +/* === 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_preview stuff... +Dialog_Preview::Dialog_Preview() +:Dialog(_("Preview Window"),false,true), +settings(this,"preview") +{ + get_vbox()->pack_start(preview); +} + +Dialog_Preview::~Dialog_Preview() +{ +} + +void Dialog_Preview::set_preview(etl::handle prev) +{ + get_window().clear(); + preview.set_preview(prev); + //preview.update(); +} + +void Dialog_Preview::on_hide() +{ + Dialog::on_hide(); + preview.stop(); + preview.stoprender(); +} + +//dialog_previewoptions stuff +Dialog_PreviewOptions::Dialog_PreviewOptions() +: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), +settings(this,"prevoptions") +{ + //framerate = 15.0f; + //zoom = 0.2f; + + //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(_("General Settings")); + 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(_("Time Settings")); + 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)); + + 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)); + add_action_widget(*okbutton, 0); + + time_begin.set_sensitive(false); + time_end.set_sensitive(false); + show_all(); +} + +Dialog_PreviewOptions::~Dialog_PreviewOptions() +{ +} + +void Dialog_PreviewOptions::on_ok_pressed() +{ + PreviewInfo i; + i.zoom = get_zoom(); + i.fps = get_fps(); + i.overbegin = get_begin_override(); + 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()); +} + +void Dialog_PreviewOptions::on_overend_toggle() +{ + time_end.set_sensitive(get_end_override()); +} + +void studio::Dialog_PreviewOptions::set_global_fps(float f) +{ + globalfps = f; + time_begin.set_fps(f); + time_end.set_fps(f); +} diff --git a/synfig-studio/src/gui/dialogs/dialog_preview.h b/synfig-studio/src/gui/dialogs/dialog_preview.h new file mode 100644 index 0000000..31847fb --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_preview.h @@ -0,0 +1,132 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/dialog_preview.h +** \brief Preview dialog Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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_GTKMM_DIALOG_PREVIEW_H +#define __SYNFIG_GTKMM_DIALOG_PREVIEW_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include +#include + +#include "preview.h" +#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 { + +struct PreviewInfo +{ + float zoom,fps,begintime,endtime; + bool overbegin,overend; +}; + +class Dialog_Preview : public Gtk::Dialog +{ + Widget_Preview preview; + DialogSettings settings; + + //etl::handle canvas; + +public: + Dialog_Preview(); + ~Dialog_Preview(); + + void set_preview(etl::handle prev); + + Widget_Preview &get_widget() {return preview;} + const Widget_Preview &get_widget() const {return preview;} + + virtual void on_hide(); + //other forwarding functions... +}; // END of Dialog_Preview + +class Dialog_PreviewOptions : public Gtk::Dialog +{ + //all the info needed to construct a render description... + Gtk::Adjustment adj_zoom; // factor at which to resize the window... + + Gtk::Adjustment adj_fps; // how often to take samples of the animation + + studio::Widget_Time time_begin; + studio::Widget_Time time_end; + + Gtk::CheckButton check_overbegin; + Gtk::CheckButton check_overend; + + DialogSettings settings; + + float globalfps; + + // for finishing + void on_ok_pressed(); + void on_cancel_pressed(); + + //for ui stuff + void on_overbegin_toggle(); + void on_overend_toggle(); + + sigc::signal signal_finish_; +public: + Dialog_PreviewOptions(); + ~Dialog_PreviewOptions(); + + float get_zoom() const { return adj_zoom.get_value(); } + void set_zoom(float z) { adj_zoom.set_value(z); } + + float get_fps() const { return adj_fps.get_value(); } + void set_fps(float z) { adj_fps.set_value(z); } + + float get_global_fps() const { return globalfps; } + void set_global_fps(float f); + + synfig::Time get_begintime() const { return time_begin.get_value(); } + void set_begintime(const synfig::Time &t) { time_begin.set_value(t); } + + synfig::Time get_endtime() const { return time_end.get_value(); } + void set_endtime(const synfig::Time &t) { time_end.set_value(t); } + + bool get_begin_override() const { return check_overbegin.get_active(); } + void set_begin_override(bool o) { check_overbegin.set_active(o); } + + bool get_end_override() const { return check_overend.get_active(); } + void set_end_override(bool o) { check_overend.set_active(o); } + + sigc::signal &signal_finish() {return signal_finish_;} +}; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_setup.cpp b/synfig-studio/src/gui/dialogs/dialog_setup.cpp new file mode 100644 index 0000000..333b7c5 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_setup.cpp @@ -0,0 +1,839 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_setup.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore +** Copyright (c) 2008, 2009 Carlos López +** +** 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 "dialogs/dialog_setup.h" +#include "app.h" +#include +#include +#include +#include +#include "widget_enum.h" +#include "autorecover.h" + +#include +#include +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +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 ======================================================= */ + +static void +attach_label(Gtk::Table *table, String str, guint col, guint xpadding, guint ypadding) +{ + Gtk::Label* label(manage(new Gtk::Label((str + ":").c_str()))); + label->set_alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); + table->attach(*label, 0, 1, col, col+1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); +} + +Dialog_Setup::Dialog_Setup(): + Dialog(_("Synfig Studio Setup"),false,true), + adj_gamma_r(2.2,0.1,3.0,0.025,0.025,0.025), + adj_gamma_g(2.2,0.1,3.0,0.025,0.025,0.025), + adj_gamma_b(2.2,0.1,3.0,0.025,0.025,0.025), + adj_recent_files(15,1,50,1,1,0), + adj_undo_depth(100,10,5000,1,1,1), + toggle_use_colorspace_gamma(_("Visually Linear Color Selection")), +#ifdef SINGLE_THREADED + toggle_single_threaded(_("Use Only a Single Thread")), +#endif + toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant")), + toggle_resize_imported_images(_("Scale New Imported Images to Fit Canvas")), + adj_pref_x_size(480,1,10000,1,10,0), + adj_pref_y_size(270,1,10000,1,10,0), + adj_pref_fps(24.0,1.0,100,0.1,1,0) + + { + // Setup the buttons + + Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); + ok_button->show(); + add_action_widget(*ok_button,2); + ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::on_ok_pressed)); + + Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); + apply_button->show(); + add_action_widget(*apply_button,1); + apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::on_apply_pressed)); + + Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); + cancel_button->show(); + add_action_widget(*cancel_button,0); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Setup::hide)); + + + // Notebook + Gtk::Notebook *notebook=manage(new class Gtk::Notebook()); + get_vbox()->pack_start(*notebook); + + + // Gamma + Gtk::Table *gamma_table=manage(new Gtk::Table(2,2,false)); + notebook->append_page(*gamma_table,_("Gamma")); + + gamma_table->attach(gamma_pattern, 0, 2, 0, 1, Gtk::EXPAND, Gtk::SHRINK|Gtk::FILL, 0, 0); + + Gtk::HScale* scale_gamma_r(manage(new Gtk::HScale(adj_gamma_r))); + gamma_table->attach(*manage(new Gtk::Label(_("Red"))), 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + gamma_table->attach(*scale_gamma_r, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + adj_gamma_r.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_r_change)); + + Gtk::HScale* scale_gamma_g(manage(new Gtk::HScale(adj_gamma_g))); + gamma_table->attach(*manage(new Gtk::Label(_("Green"))), 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + gamma_table->attach(*scale_gamma_g, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + adj_gamma_g.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_g_change)); + + Gtk::HScale* scale_gamma_b(manage(new Gtk::HScale(adj_gamma_b))); + gamma_table->attach(*manage(new Gtk::Label(_("Blue"))), 0, 1, 3, 4, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + gamma_table->attach(*scale_gamma_b, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + adj_gamma_b.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_gamma_b_change)); + + gamma_table->attach(*manage(new Gtk::Label(_("Black Level"))), 0, 1, 4, 5, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + gamma_table->attach(black_level_selector, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + black_level_selector.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_black_level_change)); + + //gamma_table->attach(*manage(new Gtk::Label(_("Red-Blue Level"))), 0, 1, 5, 6, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + //gamma_table->attach(red_blue_level_selector, 1, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + //red_blue_level_selector.signal_value_changed().connect(sigc::mem_fun(*this,&studio::Dialog_Setup::on_red_blue_level_change)); + + + // Misc + Gtk::Table *misc_table=manage(new Gtk::Table(2,2,false)); + notebook->append_page(*misc_table,_("Misc.")); + + int xpadding(8), ypadding(8); + + // Misc - Timestamp + timestamp_menu=manage(new class Gtk::Menu()); + attach_label(misc_table, _("Timestamp"), 0, xpadding, ypadding); + misc_table->attach(timestamp_optionmenu, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + +#define ADD_TIMESTAMP(desc,x) \ + timestamp_menu->items().push_back( \ + Gtk::Menu_Helpers::MenuElem( \ + desc, \ + sigc::bind( \ + sigc::mem_fun( \ + *this, \ + &studio::Dialog_Setup::set_time_format), \ + x))); + ADD_TIMESTAMP("HH:MM:SS.FF", Time::FORMAT_VIDEO ); + ADD_TIMESTAMP("(HHh MMm SSs) FFf", Time::FORMAT_NORMAL ); + ADD_TIMESTAMP("(HHhMMmSSs)FFf", Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES ); + ADD_TIMESTAMP("HHh MMm SSs FFf", Time::FORMAT_NORMAL | Time::FORMAT_FULL ); + ADD_TIMESTAMP("HHhMMmSSsFFf", Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES | Time::FORMAT_FULL); + ADD_TIMESTAMP("FFf", Time::FORMAT_FRAMES ); + + timestamp_optionmenu.set_menu(*timestamp_menu); + +#undef ADD_TIMESTAMP + + { + ParamDesc param_desc; + param_desc + .set_hint("enum") + .add_enum_value(Distance::SYSTEM_UNITS,"u",_("Units")) + .add_enum_value(Distance::SYSTEM_PIXELS,"px",_("Pixels")) + .add_enum_value(Distance::SYSTEM_POINTS,"pt",_("Points")) + .add_enum_value(Distance::SYSTEM_INCHES,"in",_("Inches")) + .add_enum_value(Distance::SYSTEM_METERS,"m",_("Meters")) + .add_enum_value(Distance::SYSTEM_CENTIMETERS,"cm",_("Centimeters")) + .add_enum_value(Distance::SYSTEM_MILLIMETERS,"mm",_("Millimeters")); + + widget_enum=manage(new Widget_Enum()); + widget_enum->set_param_desc(param_desc); + + attach_label(misc_table, _("Unit System"), 1, xpadding, ypadding); + misc_table->attach(*widget_enum, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + } + + // Misc - recent files + Gtk::SpinButton* recent_files_spinbutton(manage(new Gtk::SpinButton(adj_recent_files,1,0))); + attach_label(misc_table, _("Recent Files"), 2, xpadding, ypadding); + misc_table->attach(*recent_files_spinbutton, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + + // Misc - use_colorspace_gamma + misc_table->attach(toggle_use_colorspace_gamma, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + +#ifdef SINGLE_THREADED + // Misc - single_threaded + misc_table->attach(toggle_single_threaded, 0, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); +#endif + + // Misc - auto backup interval + attach_label(misc_table, _("Auto Backup Interval (0 to disable)"), 3, xpadding, ypadding); + misc_table->attach(auto_backup_interval, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + + // Misc - restrict_radius_ducks + misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 8, 9, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + + // Misc - resize_imported_images + misc_table->attach(toggle_resize_imported_images, 0, 2, 9, 10, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + + // Misc - browser_command + attach_label(misc_table, _("Browser Command"), 4, xpadding, ypadding); + misc_table->attach(textbox_browser_command, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + + // Document + Gtk::Table *document_table = manage(new Gtk::Table(2, 4, false)); + notebook->append_page(*document_table, _("Document")); + + // Document - Preferred file name prefix + attach_label(document_table, _("New Document filename prefix"), 0, xpadding, ypadding); + document_table->attach(textbox_custom_filename_prefix, 1, 4, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + tooltips_.set_tip(textbox_custom_filename_prefix, _("File name prefix for the new created document")); + + // Document - New Document X size + pref_x_size_spinbutton = Gtk::manage(new Gtk::SpinButton(adj_pref_x_size, 1, 0)); + attach_label(document_table, _("New Document X size"),1, xpadding, ypadding); + document_table->attach(*pref_x_size_spinbutton, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + tooltips_.set_tip(*pref_x_size_spinbutton, _("Width in pixels of the new created document")); + + // Document - New Document Y size + pref_y_size_spinbutton = Gtk::manage(new Gtk::SpinButton(adj_pref_y_size, 1, 0)); + attach_label(document_table,_("New Document Y size"), 2, xpadding, ypadding); + document_table->attach(*pref_y_size_spinbutton, 1, 2, 2, 3,Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + tooltips_.set_tip(*pref_y_size_spinbutton, _("High in pixels of the new created document")); + + //Document - Template for predefined sizes of canvases. + size_template_combo = Gtk::manage(new Gtk::ComboBoxText()); + Gtk::Label* label(manage(new Gtk::Label(_("Predefined Resolutions:")))); + label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + document_table->attach(*label, 2, 3, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + document_table->attach(*size_template_combo, 2, 3, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + size_template_combo->signal_changed().connect(sigc::mem_fun(*this, &studio::Dialog_Setup::on_size_template_combo_change)); + size_template_combo->prepend_text(_("4096x3112 Full Aperture 4K")); + size_template_combo->prepend_text(_("2048x1556 Full Aperture Native 2K")); + size_template_combo->prepend_text(_("1920x1080 HDTV 1080p/i")); + size_template_combo->prepend_text(_("1280x720 HDTV 720p")); + size_template_combo->prepend_text(_("720x576 DVD PAL")); + size_template_combo->prepend_text(_("720x480 DVD NTSC")); + size_template_combo->prepend_text(_("720x540 Web 720x")); + size_template_combo->prepend_text(_("720x405 Web 720x HD")); + size_template_combo->prepend_text(_("640x480 Web 640x")); + size_template_combo->prepend_text(_("640x360 Web 640x HD")); + size_template_combo->prepend_text(_("480x360 Web 480x")); + size_template_combo->prepend_text(_("480x270 Web 480x HD")); + size_template_combo->prepend_text(_("360x270 Web 360x")); + size_template_combo->prepend_text(_("360x203 Web 360x HD")); + size_template_combo->prepend_text(DEFAULT_PREDEFINED_SIZE); + + //Document - Template for predefined fps + fps_template_combo = Gtk::manage(new Gtk::ComboBoxText()); + Gtk::Label* label1(manage(new Gtk::Label(_("Predefined FPS:")))); + label1->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + document_table->attach(*label1, 2, 3, 3, 4, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + document_table->attach(*fps_template_combo,2, 3, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + fps_template_combo->signal_changed().connect(sigc::mem_fun(*this, &studio::Dialog_Setup::on_fps_template_combo_change)); + //Document - Fill the FPS combo box with proper strings (not localised) + float f[8]; + f[0] = 60; + f[1] = 50; + f[2] = 30; + f[3] = 25; + f[4] = 24.967; + f[5] = 24; + f[6] = 15; + f[7] = 12; + for (int i=0; i<8; i++) + fps_template_combo->prepend_text(strprintf("%5.3f", f[i])); + + fps_template_combo->prepend_text(DEFAULT_PREDEFINED_FPS); + + // Document - New Document FPS + pref_fps_spinbutton = Gtk::manage(new Gtk::SpinButton(adj_pref_fps, 1, 3)); + attach_label(document_table,_("New Document FPS"), 4, xpadding, ypadding); + document_table->attach(*pref_fps_spinbutton, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + tooltips_.set_tip(*pref_fps_spinbutton, _("Frames per second of the new created document")); + + show_all_children(); +} + +Dialog_Setup::~Dialog_Setup() +{ +} + +void +Dialog_Setup::on_ok_pressed() +{ + on_apply_pressed(); + hide(); +} + +void +Dialog_Setup::on_apply_pressed() +{ + App::gamma.set_all(1.0/adj_gamma_r.get_value(),1.0/adj_gamma_g.get_value(),1.0/adj_gamma_b.get_value(),black_level_selector.get_value(),red_blue_level_selector.get_value()); + + App::set_max_recent_files((int)adj_recent_files.get_value()); + + // Set the time format + App::set_time_format(get_time_format()); + + // Set the use_colorspace_gamma flag + App::use_colorspace_gamma=toggle_use_colorspace_gamma.get_active(); + +#ifdef SINGLE_THREADED + // Set the single_threaded flag + App::single_threaded=toggle_single_threaded.get_active(); +#endif + + // Set the auto backup interval + App::auto_recover->set_timeout(auto_backup_interval.get_value() * 1000); + + App::distance_system=Distance::System(widget_enum->get_value()); + + // Set the restrict_radius_ducks flag + App::restrict_radius_ducks=toggle_restrict_radius_ducks.get_active(); + + // Set the resize_imported_images flag + App::resize_imported_images=toggle_resize_imported_images.get_active(); + + // Set the browser_command textbox + App::browser_command=textbox_browser_command.get_text(); + + // Set the preferred file name prefix + App::custom_filename_prefix=textbox_custom_filename_prefix.get_text(); + + // Set the preferred new Document X dimension + App::preferred_x_size=int(adj_pref_x_size.get_value()); + + // Set the preferred new Document Y dimension + App::preferred_y_size=int(adj_pref_y_size.get_value()); + + // Set the preferred Predefined size + App::predefined_size=size_template_combo->get_active_text(); + + // Set the preferred Predefined fps + App::predefined_fps=fps_template_combo->get_active_text(); + + // Set the preferred FPS + App::preferred_fps=Real(adj_pref_fps.get_value()); + + App::save_settings(); +} + +void +Dialog_Setup::on_gamma_r_change() +{ + gamma_pattern.set_gamma_r(1.0/adj_gamma_r.get_value()); + gamma_pattern.refresh(); + gamma_pattern.queue_draw(); +} + +void +Dialog_Setup::on_gamma_g_change() +{ + gamma_pattern.set_gamma_g(1.0/adj_gamma_g.get_value()); + gamma_pattern.refresh(); + gamma_pattern.queue_draw(); +} + +void +Dialog_Setup::on_gamma_b_change() +{ + gamma_pattern.set_gamma_b(1.0/adj_gamma_b.get_value()); + gamma_pattern.refresh(); + gamma_pattern.queue_draw(); +} + +void +Dialog_Setup::on_black_level_change() +{ + gamma_pattern.set_black_level(black_level_selector.get_value()); + gamma_pattern.refresh(); + gamma_pattern.queue_draw(); +} + +void +Dialog_Setup::on_red_blue_level_change() +{ + gamma_pattern.set_red_blue_level(red_blue_level_selector.get_value()); + gamma_pattern.refresh(); + gamma_pattern.queue_draw(); +} + +void +Dialog_Setup::on_size_template_combo_change() +{ + String selection(size_template_combo->get_active_text()); + if(selection==DEFAULT_PREDEFINED_SIZE) + { + pref_y_size_spinbutton->set_sensitive(true); + pref_x_size_spinbutton->set_sensitive(true); + return; + } + String::size_type locx=selection.find_first_of("x"); // here should be some comparison with string::npos + String::size_type locspace=selection.find_first_of(" "); + String x_size(selection.substr(0,locx)); + String y_size(selection.substr(locx+1,locspace)); + int x=atoi(x_size.c_str()); + int y=atoi(y_size.c_str()); + adj_pref_x_size.set_value(x); + adj_pref_y_size.set_value(y); + pref_y_size_spinbutton->set_sensitive(false); + pref_x_size_spinbutton->set_sensitive(false); + + return; +} + +void +Dialog_Setup::on_fps_template_combo_change() +{ + String selection(fps_template_combo->get_active_text()); + if(selection==DEFAULT_PREDEFINED_FPS) + { + pref_fps_spinbutton->set_sensitive(true); + return; + } + adj_pref_fps.set_value(atof(selection.c_str())); + pref_fps_spinbutton->set_sensitive(false); + return; +} + +void +Dialog_Setup::refresh() +{ + // Refresh the temporary gamma; do this before adjusting the sliders, + // or variables will be used before their initialization. + gamma_pattern.set_gamma_r(App::gamma.get_gamma_r()); + gamma_pattern.set_gamma_g(App::gamma.get_gamma_g()); + gamma_pattern.set_gamma_b(App::gamma.get_gamma_b()); + gamma_pattern.set_black_level(App::gamma.get_black_level()); + gamma_pattern.set_red_blue_level(App::gamma.get_red_blue_level()); + + adj_gamma_r.set_value(1.0/App::gamma.get_gamma_r()); + adj_gamma_g.set_value(1.0/App::gamma.get_gamma_g()); + adj_gamma_b.set_value(1.0/App::gamma.get_gamma_b()); + black_level_selector.set_value(App::gamma.get_black_level()); + red_blue_level_selector.set_value(App::gamma.get_red_blue_level()); + + gamma_pattern.refresh(); + + adj_recent_files.set_value(App::get_max_recent_files()); + + // Refresh the time format + set_time_format(App::get_time_format()); + + widget_enum->set_value(App::distance_system); + + // Refresh the status of the use_colorspace_gamma flag + toggle_use_colorspace_gamma.set_active(App::use_colorspace_gamma); + +#ifdef SINGLE_THREADED + // Refresh the status of the single_threaded flag + toggle_single_threaded.set_active(App::single_threaded); +#endif + + // Refresh the value of the auto backup interval + auto_backup_interval.set_value(App::auto_recover->get_timeout() / 1000); + + // Refresh the status of the restrict_radius_ducks flag + toggle_restrict_radius_ducks.set_active(App::restrict_radius_ducks); + + // Refresh the status of the resize_imported_images flag + toggle_resize_imported_images.set_active(App::resize_imported_images); + + // Refresh the browser_command textbox + textbox_browser_command.set_text(App::browser_command); + + // Refresh the preferred filename prefix + textbox_custom_filename_prefix.set_text(App::custom_filename_prefix); + + // Refresh the preferred new Document X dimension + adj_pref_x_size.set_value(App::preferred_x_size); + + // Refresh the preferred new Document Y dimension + adj_pref_y_size.set_value(App::preferred_y_size); + + // Refresh the preferred Predefined size + size_template_combo->set_active_text(App::predefined_size); + + //Refresh the preferred FPS + adj_pref_fps.set_value(App::preferred_fps); + + //Refresh the predefined FPS + fps_template_combo->set_active_text(App::predefined_fps); +} + +GammaPattern::GammaPattern(): + tile_w(80), + tile_h(80) +{ + set_size_request(tile_w*4,tile_h*3); + signal_expose_event().connect(sigc::mem_fun(*this, &studio::GammaPattern::redraw)); +} + +GammaPattern::~GammaPattern() +{ +} + +void +GammaPattern::refresh() +{ + black[0].set_rgb_p( + r_F32_to_F32(0.0), + g_F32_to_F32(0.0), + b_F32_to_F32(0.0) + ); + white[0].set_rgb_p( + r_F32_to_F32(1.0), + g_F32_to_F32(1.0), + b_F32_to_F32(1.0) + ); + gray50[0].set_rgb_p( + r_F32_to_F32(0.5), + g_F32_to_F32(0.5), + b_F32_to_F32(0.5) + ); + gray25[0].set_rgb_p( + r_F32_to_F32(0.25), + g_F32_to_F32(0.25), + b_F32_to_F32(0.25) + ); + + // Reds + black[1].set_rgb(black[0].get_red(),0,0); + gray25[1].set_rgb(gray25[0].get_red(),0,0); + gray50[1].set_rgb(gray50[0].get_red(),0,0); + white[1].set_rgb(white[0].get_red(),0,0); + + // Greens + black[2].set_rgb(0,black[0].get_green(),0); + gray25[2].set_rgb(0,gray25[0].get_green(),0); + gray50[2].set_rgb(0,gray50[0].get_green(),0); + white[2].set_rgb(0,white[0].get_green(),0); + + // blues + black[3].set_rgb(0,0,black[0].get_blue()); + gray25[3].set_rgb(0,0,gray25[0].get_blue()); + gray50[3].set_rgb(0,0,gray50[0].get_blue()); + white[3].set_rgb(0,0,white[0].get_blue()); +} + +bool +GammaPattern::redraw(GdkEventExpose */*bleh*/) +{ + static const char hlines[] = { 3, 0 }; + + Glib::RefPtr gc(Gdk::GC::create(get_window())); + + int i; + Gdk::Color trueblack("#000000"); + + // 50% Pattern + for(i=0;i<4;i++) + { + gc->set_rgb_fg_color(black[i]); + get_window()->draw_rectangle(gc, true, i*tile_w, 0, tile_w, tile_h); + + gc->set_stipple(Gdk::Bitmap::create(hlines,2,2)); + gc->set_fill(Gdk::STIPPLED); + gc->set_rgb_fg_color(white[i]); + get_window()->draw_rectangle(gc, true, i*tile_w, 0, tile_w, tile_h); + + gc->set_fill(Gdk::SOLID); + gc->set_rgb_fg_color(gray50[i]); + + get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2); + } + + // 25% Pattern + for(i=0;i<4;i++) + { + gc->set_rgb_fg_color(black[i]); + get_window()->draw_rectangle(gc, true, i*tile_w, tile_h, tile_w, tile_h); + + gc->set_stipple(Gdk::Bitmap::create(hlines,2,2)); + gc->set_fill(Gdk::STIPPLED); + gc->set_rgb_fg_color(gray50[i]); + get_window()->draw_rectangle(gc, true, i*tile_w, tile_h, tile_w, tile_h); + + gc->set_fill(Gdk::SOLID); + gc->set_rgb_fg_color(gray25[i]); + + get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h+tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2); + } + + // Black-level Pattern + gc->set_rgb_fg_color(trueblack); + get_window()->draw_rectangle(gc, true, 0, tile_h*2, tile_w*4, tile_h); + gc->set_fill(Gdk::SOLID); + for(i=0;i<4;i++) + { + gc->set_rgb_fg_color(black[i]); + + get_window()->draw_rectangle(gc, true, i*tile_w+tile_w/4, tile_h*2+tile_h/4, tile_w-tile_w/2, tile_h-tile_h/2); + } + + return true; +} + + +BlackLevelSelector::BlackLevelSelector() +{ + set_size_request(-1,24); + signal_expose_event().connect(sigc::mem_fun(*this, &studio::BlackLevelSelector::redraw)); + + add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); + add_events(Gdk::BUTTON1_MOTION_MASK); + add_events(Gdk::BUTTON1_MOTION_MASK); +} + +BlackLevelSelector::~BlackLevelSelector() +{ +} + +bool +BlackLevelSelector::redraw(GdkEventExpose */*bleh*/) +{ + const int w(get_width()),h(get_height()); + + Gdk::Color color; + + Glib::RefPtr gc(Gdk::GC::create(get_window())); + + int i; + + // Draw the gradient + for(i=0;iset_rgb_fg_color(color); + get_window()->draw_rectangle(gc, true, i, 0, 1, h); + } + + // Draw a frame + gc->set_rgb_fg_color(Gdk::Color("#000000")); + get_window()->draw_rectangle(gc, false, 0, 0, w-1, h-1); + + // Draw the position of the current value + i=(int)(level*w+0.5); + gc->set_rgb_fg_color(Gdk::Color("#ff0000")); + get_window()->draw_rectangle(gc, true, i, 1, 1, h-1); + + // Print out the value + Glib::RefPtr layout(Pango::Layout::create(get_pango_context())); + layout->set_text(etl::strprintf("%0.01f%%",level*100.0f)); + layout->set_alignment(Pango::ALIGN_CENTER); + gc->set_rgb_fg_color(Gdk::Color("#a00000")); + get_window()->draw_layout(gc, w/2, 4, layout); + + return true; +} + + + +bool +BlackLevelSelector::on_event(GdkEvent *event) +{ + int x(round_to_int(event->button.x)); + //int y(round_to_int(event->button.y)); + + switch(event->type) + { + case GDK_MOTION_NOTIFY: + level=(float)x/(float)get_width(); + if(level<0.0f)level=0.0f; + if(level>1.0f)level=1.0f; + signal_value_changed_(); + queue_draw(); + return true; + break; + case GDK_BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + if(event->button.button==1) + { + level=(float)x/(float)get_width(); + if(level<0.0f)level=0.0f; + if(level>1.0f)level=1.0f; + signal_value_changed_(); + queue_draw(); + return true; + } + break; + default: + break; + } + + return false; +} + + +void +Dialog_Setup::set_time_format(synfig::Time::Format x) +{ + time_format=x; + if (x <= Time::FORMAT_VIDEO) + timestamp_optionmenu.set_history(0); + else if (x == (Time::FORMAT_NORMAL)) + timestamp_optionmenu.set_history(1); + else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES)) + timestamp_optionmenu.set_history(2); + else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_FULL)) + timestamp_optionmenu.set_history(3); + else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES | Time::FORMAT_FULL)) + timestamp_optionmenu.set_history(4); + else if (x == (Time::FORMAT_FRAMES)) + timestamp_optionmenu.set_history(5); + else + timestamp_optionmenu.set_history(1); +} + + + + + + + + + + + + + + + + +RedBlueLevelSelector::RedBlueLevelSelector() +{ + set_size_request(-1,24); + signal_expose_event().connect(sigc::mem_fun(*this, &studio::RedBlueLevelSelector::redraw)); + + add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); + add_events(Gdk::BUTTON1_MOTION_MASK); + add_events(Gdk::BUTTON1_MOTION_MASK); +} + +RedBlueLevelSelector::~RedBlueLevelSelector() +{ +} + +bool +RedBlueLevelSelector::redraw(GdkEventExpose */*bleh*/) +{ + const int w(get_width()),h(get_height()); + + Gdk::Color color; + + Glib::RefPtr gc(Gdk::GC::create(get_window())); + + int i; + + // Draw the gradient + for(i=0;i1.0f)red_blue=1.0f; + if(blue_red>1.0f)blue_red=1.0f; + + color.set_rgb( + round_to_int(min(red_blue,1.0f)*65535), + round_to_int(sqrt(min(red_blue,blue_red))*65535), + round_to_int(min(blue_red,1.0f)*65535) + ); + + gc->set_rgb_fg_color(color); + get_window()->draw_rectangle(gc, true, i, 0, 1, h); + } + + // Draw a frame + gc->set_rgb_fg_color(Gdk::Color("#000000")); + get_window()->draw_rectangle(gc, false, 0, 0, w-1, h-1); + + // Draw the position of the current value + i=(int)(((level-1.0f)*2.0f+1.0f-0.5f)*w+0.5); + gc->set_rgb_fg_color(Gdk::Color("#00ff00")); + get_window()->draw_rectangle(gc, true, i, 1, 1, h-1); + + // Print out the value + Glib::RefPtr layout(Pango::Layout::create(get_pango_context())); + layout->set_text(etl::strprintf("%0.02f",level)); + layout->set_alignment(Pango::ALIGN_CENTER); + gc->set_rgb_fg_color(Gdk::Color("#a00000")); + get_window()->draw_layout(gc, w/2, 4, layout); + + return true; +} + + + +bool +RedBlueLevelSelector::on_event(GdkEvent *event) +{ + int x(round_to_int(event->button.x)); + //int y(round_to_int(event->button.y)); + + switch(event->type) + { + case GDK_MOTION_NOTIFY: + level=(((float)(x)/(float)get_width()+0.5)-1.0f)/2.0f+1.0f; + if(level<0.5f)level=0.5f; + if(level>1.5f)level=1.5f; + signal_value_changed_(); + queue_draw(); + return true; + break; + case GDK_BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + if(event->button.button==1) + { + level=(((float)(x)/(float)get_width()+0.5)-1.0f)/2.0f+1.0f; + if(level<0.5f)level=0.5f; + if(level>1.5f)level=1.5f; + signal_value_changed_(); + queue_draw(); + return true; + } + break; + default: + break; + } + + return false; +} diff --git a/synfig-studio/src/gui/dialogs/dialog_setup.h b/synfig-studio/src/gui/dialogs/dialog_setup.h new file mode 100644 index 0000000..53f4165 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_setup.h @@ -0,0 +1,222 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/dialog_setup.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore +** Copyright (c) 2008, 2009 Carlos López +** +** 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_SETUP_H +#define __SYNFIG_STUDIO_DIALOG_SETUP_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* === M A C R O S ========================================================= */ +#ifndef DEFAULT_PREDEFINED_SIZE +#define DEFAULT_PREDEFINED_SIZE _("Custom Size") +#endif +#ifndef DEFAULT_PREDEFINED_FPS +#define DEFAULT_PREDEFINED_FPS _("Custom fps") +#endif + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace Gtk { class Menu; }; + +namespace studio { + +class GammaPattern : public Gtk::DrawingArea +{ + float gamma_r; + float gamma_g; + float gamma_b; + float black_level; + float red_blue_level; + + int tile_w, tile_h; + + Gdk::Color black[4],white[4],gray50[4],gray25[4]; + + float r_F32_to_F32(float x)const { float f((pow(x,gamma_r)*std::min(red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; } + float g_F32_to_F32(float x)const { float f((pow(x,gamma_g)*sqrt(std::min(2.0f-red_blue_level,red_blue_level))*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; } + float b_F32_to_F32(float x)const { float f((pow(x,gamma_b)*std::min(2.0f-red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; } + +public: + + void refresh(); + + void set_gamma_r(float x) { gamma_r=x; } + void set_gamma_g(float x) { gamma_g=x; }; + void set_gamma_b(float x) { gamma_b=x; }; + void set_black_level(float x) { black_level=x; }; + void set_red_blue_level(float x) { red_blue_level=x; }; + + float get_gamma_r()const { return gamma_r; } + float get_gamma_g()const { return gamma_g; } + float get_gamma_b()const { return gamma_b; } + float get_black_level()const { return black_level; } + float get_red_blue_level()const { return red_blue_level; } + + GammaPattern(); + + ~GammaPattern(); + + bool redraw(GdkEventExpose*bleh=NULL); +}; // END of class GammaPattern + +class BlackLevelSelector : public Gtk::DrawingArea +{ + float level; + + sigc::signal signal_value_changed_; + +public: + + BlackLevelSelector(); + + ~BlackLevelSelector(); + + sigc::signal& signal_value_changed() { return signal_value_changed_; } + + void set_value(float x) { level=x; queue_draw(); } + + const float &get_value()const { return level; } + + bool redraw(GdkEventExpose*bleh=NULL); + + bool on_event(GdkEvent *event); +}; // END of class BlackLevelSelector + +class RedBlueLevelSelector : public Gtk::DrawingArea +{ + float level; + + sigc::signal signal_value_changed_; + +public: + + RedBlueLevelSelector(); + + ~RedBlueLevelSelector(); + + sigc::signal& signal_value_changed() { return signal_value_changed_; } + + void set_value(float x) { level=x; queue_draw(); } + + const float &get_value()const { return level; } + + bool redraw(GdkEventExpose*bleh=NULL); + + bool on_event(GdkEvent *event); +}; // END of class RedBlueSelector + +class Widget_Enum; + +class Dialog_Setup : public Gtk::Dialog +{ + + void on_ok_pressed(); + void on_apply_pressed(); + + void on_gamma_r_change(); + void on_gamma_g_change(); + void on_gamma_b_change(); + void on_black_level_change(); + void on_red_blue_level_change(); + void on_size_template_combo_change(); + void on_fps_template_combo_change(); + + GammaPattern gamma_pattern; + BlackLevelSelector black_level_selector; + RedBlueLevelSelector red_blue_level_selector; + Gtk::OptionMenu timestamp_optionmenu; + + Gtk::Adjustment adj_gamma_r; + Gtk::Adjustment adj_gamma_g; + Gtk::Adjustment adj_gamma_b; + + Gtk::Adjustment adj_recent_files; + Gtk::Adjustment adj_undo_depth; + + Gtk::CheckButton toggle_use_colorspace_gamma; +#ifdef SINGLE_THREADED + Gtk::CheckButton toggle_single_threaded; +#endif + + synfig::Time::Format time_format; + + Gtk::Menu *timestamp_menu; + Widget_Enum *widget_enum; + + Widget_Time auto_backup_interval; + + Gtk::CheckButton toggle_restrict_radius_ducks; + Gtk::CheckButton toggle_resize_imported_images; + + Gtk::Entry textbox_browser_command; + + Gtk::ComboBoxText* size_template_combo; + Gtk::ComboBoxText* fps_template_combo; + Gtk::Entry textbox_custom_filename_prefix; + Gtk::Adjustment adj_pref_x_size; + Gtk::Adjustment adj_pref_y_size; + Gtk::Adjustment adj_pref_fps; + Gtk::SpinButton* pref_fps_spinbutton; + Gtk::SpinButton* pref_y_size_spinbutton; + Gtk::SpinButton* pref_x_size_spinbutton; + Gtk::Tooltips tooltips_; +public: + + void set_time_format(synfig::Time::Format time_format); + + const synfig::Time::Format& get_time_format()const { return time_format; } + + Dialog_Setup(); + ~Dialog_Setup(); + + void refresh(); + +}; // END of Dialog_Waypoint + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_soundselect.cpp b/synfig-studio/src/gui/dialogs/dialog_soundselect.cpp new file mode 100644 index 0000000..10ac1f6 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_soundselect.cpp @@ -0,0 +1,129 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_soundselect.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 David Roden +** +** 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 "dialogs/dialog_soundselect.h" +#include +#include +#include +#include + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; + +/* === 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 ================================================= */ + +studio::Dialog_SoundSelect::Dialog_SoundSelect(Gtk::Window &parent, etl::handle ci) +:Dialog(_("Sound Select"), parent, false, true), +canvas_interface(ci) +{ + Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + dialogPadding->set_padding(12, 12, 12, 12); + get_vbox()->pack_start(*dialogPadding, false, false, 0); + + Gtk::Frame *soundFrame = manage(new Gtk::Frame(_("Sound Parameters"))); + ((Gtk::Label *) soundFrame->get_label_widget())->set_markup(_("Sound Parameters")); + soundFrame->set_shadow_type(Gtk::SHADOW_NONE); + dialogPadding->add(*soundFrame); + + Gtk::Alignment *framePadding = manage(new Gtk::Alignment(0, 0, 1, 1)); + framePadding->set_padding(6, 0, 24, 0); + soundFrame->add(*framePadding); + + Gtk::Label *fileLabel = manage(new Gtk::Label(_("_Sound File"), true)); + fileLabel->set_alignment(0, 0.5); + fileLabel->set_mnemonic_widget(soundfile); + Gtk::Label *offsetLabel = manage(new Gtk::Label(_("Time _Offset"), true)); + offsetLabel->set_alignment(0, 0.5); + offsetLabel->set_mnemonic_widget(offset); + + Gtk::Table *table = manage(new Gtk::Table(2, 2, false)); + table->set_row_spacings(6); + table->set_col_spacings(12); + framePadding->add(*table); + + table->attach(*fileLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); + table->attach(soundfile, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); + table->attach(*offsetLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); + table->attach(offset, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0); + + okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-ok"))); + add_action_widget(*okbutton, 0); + + get_vbox()->show_all(); + + offset.set_value(0); + + okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_SoundSelect::on_ok)); +} + +studio::Dialog_SoundSelect::~Dialog_SoundSelect() +{ +} + +void studio::Dialog_SoundSelect::on_file() +{ + signal_file_changed_(soundfile.get_value()); +} + +void studio::Dialog_SoundSelect::on_offset() +{ + signal_offset_changed_(offset.get_value()); +} + +void studio::Dialog_SoundSelect::on_ok() +{ + hide(); + + //signal_finish_(a); + signal_file_changed_(soundfile.get_value()); + signal_offset_changed_(offset.get_value()); +} + +void studio::Dialog_SoundSelect::set_global_fps(float f) +{ + offset.set_fps(f); +} diff --git a/synfig-studio/src/gui/dialogs/dialog_soundselect.h b/synfig-studio/src/gui/dialogs/dialog_soundselect.h new file mode 100644 index 0000000..0aaf706 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_soundselect.h @@ -0,0 +1,86 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/dialog_soundselect.h +** \brief Sound Select Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 David Roden +** +** 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_DIALOG_SOUNDSELECT_H +#define __SYNFIG_DIALOG_SOUNDSELECT_H + +/* === H E A D E R S ======================================================= */ +#include "dockdialog.h" +#include "widget_filename.h" +#include "widget_time.h" + +#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 { + +struct AudioBaseInfo +{ + std::string file; + synfig::Time offset; +}; + +class Dialog_SoundSelect : public Gtk::Dialog +{ + Widget_Filename soundfile; + Widget_Time offset; + Gtk::Button *okbutton; + + etl::handle canvas_interface; + + sigc::signal signal_file_changed_; + sigc::signal signal_offset_changed_; + + void on_file(); + void on_offset(); + void on_ok(); + +public: + Dialog_SoundSelect(Gtk::Window &parent,etl::handle ci ); + ~Dialog_SoundSelect(); + + //float get_global_fps() const { return globalfps; } + void set_global_fps(float f); + + synfig::Time get_offset() const { return offset.get_value(); } + void set_offset(const synfig::Time &t) {offset.set_value(t); } + + std::string get_file() const { return soundfile.get_value(); } + void set_file(const std::string &f) {soundfile.set_value(f); } + + sigc::signal &signal_file_changed() { return signal_file_changed_; } + sigc::signal &signal_offset_changed() { return signal_offset_changed_; } +}; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_targetparam.cpp b/synfig-studio/src/gui/dialogs/dialog_targetparam.cpp new file mode 100644 index 0000000..81e12b4 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_targetparam.cpp @@ -0,0 +1,150 @@ +/* === 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 "dialogs/dialog_targetparam.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ +//! Allowed video codecs +/*! \warning This variable is linked to allowed_video_codecs_description, + * if you change this you must change the other acordingly. + * \warning These codecs are linked to the filename extensions for + * mod_ffmpeg. If you change this you must change the others acordingly. + */ +const char* allowed_video_codecs[] = +{ + "flv", "h263p", "huffyuv", "libtheora", "libx264", "libxvid", + "mjpeg", "mpeg1video", "mpeg2video", "mpeg4", "msmpeg4", + "msmpeg4v1", "msmpeg4v2", "wmv1", "wmv2", NULL +}; + +//! Allowed video codecs description. +/*! \warning This variable is linked to allowed_video_codecs, + * if you change this you must change the other acordingly. + */ +const char* allowed_video_codecs_description[] = +{ + "Flash Video (FLV) / Sorenson Spark / Sorenson H.263.", + "H.263+ / H.263-1998 / H.263 version 2.", + "Huffyuv / HuffYUV.", + "libtheora Theora.", + "libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10.", + "libxvidcore MPEG-4 part 2.", + "MJPEG (Motion JPEG).", + "raw MPEG-1 video.", + "raw MPEG-2 video.", + "MPEG-4 part 2.", + "MPEG-4 part 2 Microsoft variant version 3.", + "MPEG-4 part 2 Microsoft variant version 1.", + "MPEG-4 part 2 Microsoft variant version 2.", + "Windows Media Video 7.", + "Windows Media Video 8.", + NULL +}; +/* === 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); + for (int i = 0; allowed_video_codecs[i] != NULL && + allowed_video_codecs_description[i] != NULL; i++) + vcodec->append_text(allowed_video_codecs_description[i]); + for (int i = 0; allowed_video_codecs[i] != NULL && + allowed_video_codecs_description[i] != NULL; i++) + if(!get_tparam().video_codec.compare(allowed_video_codecs[i])) + vcodec->set_active_text(allowed_video_codecs_description[i]); + + 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,Gtk::RESPONSE_OK); + ok_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_ok)); + + cancel_button = manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))); + cancel_button->show(); + add_action_widget(*cancel_button,Gtk::RESPONSE_CANCEL); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_TargetParam::on_cancel)); + +} + +void +Dialog_TargetParam::on_ok() +{ + std::string codecnamed = vcodec->get_active_text(); + for (int i = 0; allowed_video_codecs[i] != NULL && + allowed_video_codecs_description[i] != NULL; i++) + if(!codecnamed.compare(allowed_video_codecs_description[i])) + tparam_.video_codec=allowed_video_codecs[i]; + tparam_.bitrate=bitrate->get_value(); + hide(); +} + +void +Dialog_TargetParam::on_cancel() +{ + hide(); +} + +Dialog_TargetParam::~Dialog_TargetParam() +{ +} + diff --git a/synfig-studio/src/gui/dialogs/dialog_targetparam.h b/synfig-studio/src/gui/dialogs/dialog_targetparam.h new file mode 100644 index 0000000..5575c20 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_targetparam.h @@ -0,0 +1,71 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/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 *cancel_button; + Gtk::SpinButton *bitrate; + Gtk::ComboBoxText *vcodec; + + void on_ok(); + void on_cancel(); + +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/gui/dialogs/dialog_waypoint.cpp b/synfig-studio/src/gui/dialogs/dialog_waypoint.cpp new file mode 100644 index 0000000..642b4d6 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_waypoint.cpp @@ -0,0 +1,141 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_waypoint.cpp +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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 +#include "dialogs/dialog_waypoint.h" +#include +#include +#include +#include +#include "widget_value.h" +#include "app.h" +#include +#include +#include "widget_time.h" +#include "widget_waypoint.h" + +#include "general.h" + +#endif + +using namespace synfig; +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 ======================================================= */ + +Dialog_Waypoint::Dialog_Waypoint(Gtk::Window& parent,etl::handle canvas): + Dialog(_("Waypoint Editor"),parent,false,true), + canvas(canvas) +{ + assert(canvas); + waypointwidget=manage(new class Widget_Waypoint(canvas)); + get_vbox()->pack_start(*waypointwidget); + + Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); + ok_button->show(); + add_action_widget(*ok_button,2); + ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_ok_pressed)); + + Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); + apply_button->show(); + add_action_widget(*apply_button,1); + apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_apply_pressed)); + + Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete")))); + delete_button->show(); + add_action_widget(*delete_button,3); + delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_delete_pressed)); + + Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); + cancel_button->show(); + add_action_widget(*cancel_button,0); + cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::hide)); + + + waypointwidget->show_all(); +} + +Dialog_Waypoint::~Dialog_Waypoint() +{ +} + +void +Dialog_Waypoint::on_ok_pressed() +{ + hide(); + signal_changed_(); +} + +void +Dialog_Waypoint::on_apply_pressed() +{ + signal_changed_(); +} + +void +Dialog_Waypoint::on_delete_pressed() +{ + hide(); + signal_delete_(); +} + +void +Dialog_Waypoint::set_waypoint(synfig::ValueNode_Animated::Waypoint x) +{ + waypointwidget->set_waypoint(x); +} + +const synfig::ValueNode_Animated::Waypoint & +Dialog_Waypoint::get_waypoint()const +{ + return waypointwidget->get_waypoint(); +} + +void +Dialog_Waypoint::set_value_desc(synfigapp::ValueDesc value_desc) +{ + value_desc_=value_desc; + if(value_desc.get_value_node() && value_desc.get_value_node()->get_parent_canvas()) + waypointwidget->set_canvas(value_desc.get_value_node()->get_parent_canvas()); +} + +void +Dialog_Waypoint::reset() +{ +} diff --git a/synfig-studio/src/gui/dialogs/dialog_waypoint.h b/synfig-studio/src/gui/dialogs/dialog_waypoint.h new file mode 100644 index 0000000..5bb8d24 --- /dev/null +++ b/synfig-studio/src/gui/dialogs/dialog_waypoint.h @@ -0,0 +1,109 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialogs/dialog_waypoint.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** 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_GTKMM_DIALOG_WAYPOINT_H +#define __SYNFIG_GTKMM_DIALOG_WAYPOINT_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#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 Widget_ValueBase; +class Widget_Waypoint; + +class Dialog_Waypoint : public Gtk::Dialog +{ + Widget_Waypoint *waypointwidget; + etl::handle canvas; + synfig::ValueNode_Animated::WaypointList::iterator waypoint; + synfigapp::ValueDesc value_desc_; + + sigc::signal signal_changed_; + + sigc::signal signal_delete_; + void on_ok_pressed(); + void on_apply_pressed(); + void on_delete_pressed(); + +public: + Dialog_Waypoint(Gtk::Window& parent,etl::handle canvas); + ~Dialog_Waypoint(); + + void reset(); + + void set_value_desc(synfigapp::ValueDesc value_desc); + synfigapp::ValueDesc get_value_desc()const { return value_desc_; } + + void set_waypoint(synfig::ValueNode_Animated::Waypoint x); + const synfig::ValueNode_Animated::Waypoint &get_waypoint()const; + + sigc::signal &signal_changed() + {return signal_changed_; } + + sigc::signal &signal_delete() + {return signal_delete_; } +}; // END of Dialog_Waypoint + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/modules/mod_palette/dock_paledit.cpp b/synfig-studio/src/gui/modules/mod_palette/dock_paledit.cpp index 1c39a2a..f82de2d 100644 --- a/synfig-studio/src/gui/modules/mod_palette/dock_paledit.cpp +++ b/synfig-studio/src/gui/modules/mod_palette/dock_paledit.cpp @@ -43,7 +43,7 @@ #include #include #include "../../app.h" -#include "../../dialog_color.h" +#include "../../dialogs/dialog_color.h" #include "../../general.h" diff --git a/synfig-studio/src/gui/render.cpp b/synfig-studio/src/gui/render.cpp index e958682..ae2a597 100644 --- a/synfig-studio/src/gui/render.cpp +++ b/synfig-studio/src/gui/render.cpp @@ -37,7 +37,7 @@ #include #include #include "asyncrenderer.h" -#include "dialog_targetparam.h" +#include "dialogs/dialog_targetparam.h" #include "general.h" diff --git a/synfig-studio/src/gui/state_eyedrop.cpp b/synfig-studio/src/gui/state_eyedrop.cpp index dcd57a1..e7cf4bb 100644 --- a/synfig-studio/src/gui/state_eyedrop.cpp +++ b/synfig-studio/src/gui/state_eyedrop.cpp @@ -34,7 +34,7 @@ #include "workarea.h" #include #include "app.h" -#include "dialog_color.h" +#include "dialogs/dialog_color.h" #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" diff --git a/synfig-studio/src/gui/state_fill.cpp b/synfig-studio/src/gui/state_fill.cpp index f4df2ba..cf6c750 100644 --- a/synfig-studio/src/gui/state_fill.cpp +++ b/synfig-studio/src/gui/state_fill.cpp @@ -34,7 +34,7 @@ #include "workarea.h" #include #include "app.h" -#include "dialog_color.h" +#include "dialogs/dialog_color.h" #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" diff --git a/synfig-studio/src/gui/toolbox.cpp b/synfig-studio/src/gui/toolbox.cpp index ea40e7d..e6786a8 100644 --- a/synfig-studio/src/gui/toolbox.cpp +++ b/synfig-studio/src/gui/toolbox.cpp @@ -69,10 +69,10 @@ #include "instance.h" #include "app.h" #include "canvasview.h" -#include "dialog_gradient.h" -#include "dialog_color.h" +#include "dialogs/dialog_gradient.h" +#include "dialogs/dialog_color.h" #include "dialog_tooloptions.h" -#include "dialog_preview.h" +#include "dialogs/dialog_preview.h" #include "dockable.h" #include "dockmanager.h" #include "dockdialog.h" diff --git a/synfig-studio/src/gui/widget_defaults.cpp b/synfig-studio/src/gui/widget_defaults.cpp index 20cabfe..b956ab5 100644 --- a/synfig-studio/src/gui/widget_defaults.cpp +++ b/synfig-studio/src/gui/widget_defaults.cpp @@ -34,8 +34,8 @@ #include "widget_defaults.h" #include "widget_color.h" #include "widget_gradient.h" -#include "dialog_color.h" -#include "dialog_gradient.h" +#include "dialogs/dialog_color.h" +#include "dialogs/dialog_gradient.h" #include "app.h" #include #include diff --git a/synfig-studio/src/gui/widget_waypoint.cpp b/synfig-studio/src/gui/widget_waypoint.cpp index d456130..26d0cba 100644 --- a/synfig-studio/src/gui/widget_waypoint.cpp +++ b/synfig-studio/src/gui/widget_waypoint.cpp @@ -34,7 +34,7 @@ #include #include #include -#include "dialog_waypoint.h" +#include "dialogs/dialog_waypoint.h" #include #include #include -- 2.7.4