-/*! ========================================================================
-** Synfig
-** Template File
-** $Id: about.cpp,v 1.2 2005/01/13 21:11:16 darco Exp $
+/* === S Y N F I G ========================================================= */
+/*! \file about.cpp
+** \brief About dialog implementation
**
-** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** $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
** 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 O T E S ===========================================================
-**
-** ========================================================================= */
+** \endlegal
+*/
+/* ========================================================================= */
/* === H E A D E R S ======================================================= */
# include <config.h>
#endif
-#include <iostream>
-#include <string>
+#include <vector>
-#include <ETL/stringf>
+#include <gtk/gtk.h>
+
+#include <gtkmm/aboutdialog.h>
-#include <gtkmm/image.h>
-#include <gdkmm/pixbufloader.h>
-#include <gtkmm/button.h>
-#include <gtkmm/label.h>
-#include <gtkmm/fixed.h>
+#include <ETL/stringf>
#include <synfig/general.h>
+// This is generated at make time from .svn or .git/svn or autorevision.conf
+#include <autorevision.h>
+
#include "about.h"
#include "app.h"
+#include "general.h"
+
#endif
+/* === U S I N G =========================================================== */
+
using namespace std;
using namespace etl;
using namespace studio;
# define IMAGE_EXT "png"
#endif
-/* === 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 ================================================= */
+#define stringify_(x) #x
+#define stringify(x) stringify_(x)
-class studio::AboutProgress : public synfig::ProgressCallback
-{
- About &about;
-
-public:
-
- AboutProgress(About &about):about(about) { }
-
- virtual bool task(const std::string &task)
- {
- if(about.tasklabel)
- {
- about.tasklabel->set_label(task);
- about.tasklabel->show();
- }
- else
- {
- cerr<<task<<endl;
- }
-
- while(studio::App::events_pending())studio::App::iteration(false);
- return true;
- }
-
- virtual bool error(const std::string &task)
- {
- if(about.tasklabel)
- {
- about.tasklabel->set_label(_("ERROR:")+task);
- about.tasklabel->show();
- }
- else
- {
- cerr<<task<<endl;
- }
-
- while(studio::App::events_pending())studio::App::iteration(false);
- return true;
- }
+/* === G L O B A L S ======================================================= */
- virtual bool warning(const std::string &task)
- {
- if(about.tasklabel)
- {
- about.tasklabel->set_label(_("WARNING:")+task);
- about.tasklabel->show();
- }
- else
- {
- cerr<<task<<endl;
- }
-
- while(studio::App::events_pending())studio::App::iteration(false);
- return true;
- }
+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;
- virtual bool amount_complete(int current, int total)
- {
- if(about.progressbar)
- {
- about.progressbar->set_fraction((float)current/(float)total);
- about.progressbar->show();
- }
- else
- cerr<<current<<'/'<<total<<endl;
-
- while(studio::App::events_pending())studio::App::iteration(false);
- return true;
- }
-}; // END of class AboutProgress
+/* === P R O C E D U R E S ================================================= */
/* === M E T H O D S ======================================================= */
-About::About():
- Gtk::Window(Gtk::WINDOW_POPUP),
- can_self_destruct(true)
+About::About()
{
- int image_w=300,image_h=350;
+
+#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<Glib::ustring> 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("Chris Moore (dooglus)");
+ authors.push_back("Chris Norman (pixelgeek)");
+ 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("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("Yue Shi Lai");
+ set_authors(authors);
+
+ std::vector<Glib::ustring> artists;
+ artists.push_back("Robert B. Quattlebaum Jr. (darco)");
+ 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("Franco Iacomella (Yaco)");
+
+ 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_SEPERATOR+IMAGE_DIR;
+ imagepath=App::get_base_path()+ETL_DIRECTORY_SEPARATOR+IMAGE_DIR;
#else
imagepath=IMAGE_DIR;
#endif
- imagepath+=ETL_DIRECTORY_SEPERATOR;
-
-
- // Create the Logo
+ 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+"about_dialog."IMAGE_EXT);
- Logo->set_size_request(image_w,image_h);
- Logo->set_alignment(0.5,0.5);
- Logo->set_padding(0,0);
-
- // Create the Copyright Label
- Gtk::Label *CopyrightLabel = manage(new class Gtk::Label(SYNFIG_COPYRIGHT));
- CopyrightLabel->set_size_request(image_w,24);
- CopyrightLabel->set_alignment(0.5,0.5);
- CopyrightLabel->set_padding(0,0);
- CopyrightLabel->set_justify(Gtk::JUSTIFY_CENTER);
- CopyrightLabel->set_line_wrap(false);
-
- // Create the Version information label
- Gtk::Label *VersionLabel = manage(new class Gtk::Label("Version"));
- VersionLabel->set_size_request(image_w,80);
- VersionLabel->set_flags(Gtk::CAN_FOCUS);
- VersionLabel->set_alignment(0.5,0.5);
- VersionLabel->set_padding(0,0);
- VersionLabel->set_justify(Gtk::JUSTIFY_CENTER);
- VersionLabel->set_line_wrap(false);
-
- // Set the version label to contain the correct information
- string ver;
- ver+="Version "VERSION" ("__DATE__" "__TIME__")\n";
- ver+="Using SYNFIG ";
- ver+=synfig::get_version();
+ 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__
- ver+=strprintf(" and GNU G++ %d.%d.%d",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
+ extra_info += strprintf(_("GNU G++ %d.%d.%d\n"),__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
#endif
- ver+=strprintf("\nGtk+ %d.%d.%d",gtk_major_version,gtk_minor_version,gtk_micro_version);
+ 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
- ver+="\nDEBUG BUILD";
+ extra_info += "\n\nDEBUG BUILD";
#endif
- VersionLabel->set_text(ver);
-
- // Create the image that will be used on the close button
- Gtk::Image *image2 = manage(new class Gtk::Image(Gtk::StockID("gtk-close"), Gtk::IconSize(4)));
- image2->set_alignment(0.5,0.5);
- image2->set_padding(0,0);
-
- // Create the close button, and attach the image to it
- CloseButton = manage(new class Gtk::Button());
- CloseButton->set_size_request(24,24);
- CloseButton->set_flags(Gtk::CAN_FOCUS);
- _tooltips.set_tip(*CloseButton, "Close", "");
- CloseButton->set_relief(Gtk::RELIEF_NONE);
- CloseButton->add(*image2);
-
- // Create the progress bar
- progressbar = manage(new class Gtk::ProgressBar());
- progressbar->set_size_request(image_w,24);
-
- // Create the current task label
- tasklabel = manage(new class Gtk::Label());
- tasklabel->set_size_request(image_w,24);
- tasklabel->set_use_underline(false);
-
- // Create the Gtk::Fixed container and put all of the widgets into it
- Gtk::Fixed *fixed1 = manage(new class Gtk::Fixed());
- fixed1->put(*Logo, 0, 0);
- fixed1->put(*CopyrightLabel, 0, image_h-25);
- fixed1->put(*CloseButton, image_w-24, 0);
- fixed1->put(*VersionLabel, 0, image_h-90);
- fixed1->put(*progressbar, 0, image_h+24);
- fixed1->put(*tasklabel, 0, image_h);
-
- // Set up the parameters for this pop-up window
- set_title("Synfig Studio "VERSION);
- set_modal(false);
- property_window_position().set_value(Gtk::WIN_POS_CENTER);
- set_resizable(false);
- add(*fixed1);
-
- // show everything off
- Logo->show();
- CopyrightLabel->show();
- image2->show();
- CloseButton->show();
- VersionLabel->show();
- fixed1->show();
-
- // Connect relevant signals
- CloseButton->signal_clicked().connect(sigc::mem_fun(*this, &About::close));
-
- cb=new AboutProgress(*this);
-}
-About::~About()
-{
- delete cb;
-}
+ set_comments(extra_info);
-void About::close()
-{
- hide();
- if(can_self_destruct)
- delete this;
+#endif
+
+ // Hide the dialog when you click close
+ signal_response().connect(sigc::mem_fun(*this, &About::close));
}
-void
-About::set_can_self_destruct(bool x)
-{
- can_self_destruct=x;
- if(x==true)
- CloseButton->show();
- else
- CloseButton->hide();
+void About::close(int){
+ hide();
}
-synfig::ProgressCallback *
-About::get_callback()
+void About::on_link_clicked(Gtk::AboutDialog&, const Glib::ustring &url)
{
- return cb;
+ App::open_url(url);
}