Remove spaces and tabs at end of lines.
[synfig.git] / synfig-studio / trunk / src / gtkmm / app.cpp
index 38de4e2..ee4459b 100644 (file)
@@ -8,6 +8,7 @@
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **     Copyright (c) 2007, 2008 Chris Moore
 **     Copyright (c) 2008 Gerald Young
+**  Copyright (c) 2008 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
@@ -54,6 +55,7 @@
 #include <gtkmm/inputdialog.h>
 #include <gtkmm/accelmap.h>
 #include <gtkmm/uimanager.h>
+#include <gtkmm/textview.h>
 
 #include <gtk/gtk.h>
 
@@ -88,6 +90,8 @@
 #include "state_rectangle.h"
 #include "state_smoothmove.h"
 #include "state_scale.h"
+#include "state_star.h"
+#include "state_text.h"
 #include "state_width.h"
 #include "state_rotate.h"
 #include "state_zoom.h"
@@ -271,6 +275,11 @@ bool studio::App::use_colorspace_gamma=true;
 bool studio::App::single_threaded=false;
 #endif
 bool studio::App::restrict_radius_ducks=false;
+bool studio::App::resize_imported_images=false;
+String studio::App::custom_filename_prefix(DEFAULT_FILENAME_PREFIX);
+int studio::App::preferred_x_size=480;
+int studio::App::preferred_y_size=270;
+String studio::App::predefined_size(DEFAULT_PREDEFINED_SIZE);
 #ifdef USE_OPEN_FOR_URLS
 String studio::App::browser_command("open"); // MacOS only
 #else
@@ -503,11 +512,36 @@ public:
                        value=strprintf("%i",(int)App::restrict_radius_ducks);
                        return true;
                }
+               if(key=="resize_imported_images")
+               {
+                       value=strprintf("%i",(int)App::resize_imported_images);
+                       return true;
+               }
                if(key=="browser_command")
                {
                        value=App::browser_command;
                        return true;
                }
+               if(key=="custom_filename_prefix")
+               {
+                       value=App::custom_filename_prefix;
+                       return true;
+               }
+               if(key=="preferred_x_size")
+               {
+                       value=strprintf("%i",App::preferred_x_size);
+                       return true;
+               }
+               if(key=="preferred_y_size")
+               {
+                       value=strprintf("%i",App::preferred_y_size);
+                       return true;
+               }
+               if(key=="predefined_size")
+               {
+                       value=strprintf("%s",App::predefined_size.c_str());
+                       return true;
+               }
 
                return synfigapp::Settings::get_value(key,value);
        }
@@ -572,12 +606,39 @@ public:
                        App::restrict_radius_ducks=i;
                        return true;
                }
+               if(key=="resize_imported_images")
+               {
+                       int i(atoi(value.c_str()));
+                       App::resize_imported_images=i;
+                       return true;
+               }
                if(key=="browser_command")
                {
                        App::browser_command=value;
                        return true;
                }
-
+               if(key=="custom_filename_prefix")
+               {
+                       App::custom_filename_prefix=value;
+                       return true;
+               }
+               if(key=="preferred_x_size")
+               {
+                       int i(atoi(value.c_str()));
+                       App::preferred_x_size=i;
+                       return true;
+               }
+               if(key=="preferred_y_size")
+               {
+                       int i(atoi(value.c_str()));
+                       App::preferred_y_size=i;
+                       return true;
+               }
+               if(key=="predefined_size")
+               {
+                       App::predefined_size=value;
+                       return true;
+               }
                return synfigapp::Settings::set_value(key,value);
        }
 
@@ -594,7 +655,12 @@ public:
 #endif
                ret.push_back("auto_recover_backup_interval");
                ret.push_back("restrict_radius_ducks");
+               ret.push_back("resize_imported_images");
                ret.push_back("browser_command");
+               ret.push_back("custom_filename_prefix");
+               ret.push_back("preferred_x_size");
+               ret.push_back("preferred_y_size");
+               ret.push_back("predefined_size");
                return ret;
        }
 };
@@ -667,6 +733,8 @@ init_ui_manager()
        DEFINE_ACTION("copy", Gtk::StockID("gtk-copy"));
        DEFINE_ACTION("paste", Gtk::StockID("gtk-paste"));
        DEFINE_ACTION("select-all-ducks", _("Select All Ducks"));
+       DEFINE_ACTION("unselect-all-ducks", _("Unselect All Ducks"));
+       DEFINE_ACTION("select-all-layers", _("Select All Layers"));
        DEFINE_ACTION("unselect-all-layers", _("Unselect All Layers"));
        DEFINE_ACTION("properties", _("Properties"));
 
@@ -795,8 +863,10 @@ init_ui_manager()
 "              <menuitem action='copy'/>"
 "              <menuitem action='paste'/>"
 "              <separator name='bleh06'/>"
-"              <menuitem action='select-all-ducks'/>"
+"              <menuitem action='select-all-layers'/>"
 "              <menuitem action='unselect-all-layers'/>"
+"              <menuitem action='select-all-ducks'/>"
+"              <menuitem action='unselect-all-ducks'/>"
 "              <separator name='bleh07'/>"
 "              <menuitem action='properties'/>"
 "      </menu>"
@@ -922,7 +992,7 @@ init_ui_manager()
        }
 
        // Add default keyboard accelerators
-#define ACCEL(path,accel)                                              \
+#define ACCEL(accel,path)                                              \
        {                                                                                       \
                Gtk::AccelKey accel_key(accel,path);    \
                Gtk::AccelMap::add_entry(accel_key.get_path(), accel_key.get_key(), accel_key.get_mod());       \
@@ -934,90 +1004,80 @@ init_ui_manager()
                Gtk::AccelMap::add_entry(accel_key.get_path(), accel_key.get_key(), accel_key.get_mod());       \
        }
 
-       ACCEL("<Actions>//select-all-ducks","<Control>a");
-       ACCEL("<Actions>//unselect-all-layers","<Control>d");
-       ACCEL("<Actions>//render","F9");
-       ACCEL("<Actions>//preview","F11");
-       ACCEL("<Actions>//properties","F8");
-       ACCEL("<Actions>//options","F12");
-       ACCEL("<Actions>//import","<control>i");
-       ACCEL2(Gtk::AccelKey(GDK_Escape,static_cast<Gdk::ModifierType>(0),"<Actions>//stop"));
-       ACCEL("<Actions>//toggle-grid-show","<Control>g");
-       ACCEL("<Actions>//toggle-grid-snap","<Control>l");
-       ACCEL2(Gtk::AccelKey('`',Gdk::CONTROL_MASK,"<Actions>//toggle-low-res"));
-       ACCEL("<Actions>//mask-position-ducks", "<Mod1>1");
-       ACCEL("<Actions>//mask-vertex-ducks", "<Mod1>2");
-       ACCEL("<Actions>//mask-tangent-ducks", "<Mod1>3");
-       ACCEL("<Actions>//mask-radius-ducks", "<Mod1>4");
-       ACCEL("<Actions>//mask-width-ducks", "<Mod1>5");
-       ACCEL("<Actions>//mask-angle-ducks", "<Mod1>6");
-
-       ACCEL2(Gtk::AccelKey(GDK_Page_Up,Gdk::SHIFT_MASK,"<Actions>//action-layer_raise"));
-       ACCEL2(Gtk::AccelKey(GDK_Page_Down,Gdk::SHIFT_MASK,"<Actions>//action-layer_lower"));
-
-       ACCEL("<Actions>//quality-01","<Control>1");
-       ACCEL("<Actions>//quality-02","<Control>2");
-       ACCEL("<Actions>//quality-03","<Control>3");
-       ACCEL("<Actions>//quality-04","<Control>4");
-       ACCEL("<Actions>//quality-05","<Control>5");
-       ACCEL("<Actions>//quality-06","<Control>6");
-       ACCEL("<Actions>//quality-07","<Control>7");
-       ACCEL("<Actions>//quality-08","<Control>8");
-       ACCEL("<Actions>//quality-09","<Control>9");
-       ACCEL("<Actions>//quality-10","<Control>0");
-       ACCEL("<Actions>//undo","<Control>z");
-       ACCEL("<Actions>//redo","<Control>r");
-       ACCEL("<Actions>//action-layer_remove","Delete");
-
-/*     ACCEL2(Gtk::AccelKey(']',static_cast<Gdk::ModifierType>(0),"<Actions>//jump-next-keyframe"));
-       ACCEL2(Gtk::AccelKey('[',static_cast<Gdk::ModifierType>(0),"<Actions>//jump-prev-keyframe"));
-       ACCEL2(Gtk::AccelKey('=',static_cast<Gdk::ModifierType>(0),"<Actions>//canvas-zoom-in"));
-       ACCEL2(Gtk::AccelKey('-',static_cast<Gdk::ModifierType>(0),"<Actions>//canvas-zoom-out"));
-       ACCEL("<Actions>//time-zoom-in","+");
-       ACCEL("<Actions>//time-zoom-out","_");
-*/
-       ACCEL2(Gtk::AccelKey('(',Gdk::CONTROL_MASK,"<Actions>//decrease-low-res-pixel-size"));
-       ACCEL2(Gtk::AccelKey(')',Gdk::CONTROL_MASK,"<Actions>//increase-low-res-pixel-size"));
-
-       ACCEL2(Gtk::AccelKey('(',Gdk::MOD1_MASK|Gdk::CONTROL_MASK,"<Actions>//amount-dec"));
-       ACCEL2(Gtk::AccelKey(')',Gdk::MOD1_MASK|Gdk::CONTROL_MASK,"<Actions>//amount-inc"));
-
-       ACCEL2(Gtk::AccelKey(']',Gdk::CONTROL_MASK,"<Actions>//jump-next-keyframe"));
-       ACCEL2(Gtk::AccelKey('[',Gdk::CONTROL_MASK,"<Actions>//jump-prev-keyframe"));
-       ACCEL2(Gtk::AccelKey('=',Gdk::CONTROL_MASK,"<Actions>//canvas-zoom-in"));
-       ACCEL2(Gtk::AccelKey('-',Gdk::CONTROL_MASK,"<Actions>//canvas-zoom-out"));
-       ACCEL2(Gtk::AccelKey('+',Gdk::CONTROL_MASK,"<Actions>//time-zoom-in"));
-       ACCEL2(Gtk::AccelKey('_',Gdk::CONTROL_MASK,"<Actions>//time-zoom-out"));
-       ACCEL2(Gtk::AccelKey('.',Gdk::CONTROL_MASK,"<Actions>//seek-next-frame"));
-       ACCEL2(Gtk::AccelKey(',',Gdk::CONTROL_MASK,"<Actions>//seek-prev-frame"));
-       ACCEL2(Gtk::AccelKey('>',Gdk::CONTROL_MASK,"<Actions>//seek-next-second"));
-       ACCEL2(Gtk::AccelKey('<',Gdk::CONTROL_MASK,"<Actions>//seek-prev-second"));
-       ACCEL2(Gtk::AccelKey('o',Gdk::MOD1_MASK,"<Actions>//toggle-onion-skin"));
-       ACCEL("<Actions>//play",              "<Control>p");
-       ACCEL("<Actions>//seek-begin","Home");
-       ACCEL("<Actions>//seek-end","End");
-
-       ACCEL("<Actions>//state-normal",      "<Mod1>a");
-       ACCEL("<Actions>//state-smooth_move", "<Mod1>v");
-       ACCEL("<Actions>//state-scale",       "<Mod1>d");
-       ACCEL("<Actions>//state-rotate",      "<Mod1>s");
-
-       ACCEL("<Actions>//state-bline",       "<Mod1>b");
-       ACCEL("<Actions>//state-circle",      "<Mod1>c");
-       ACCEL("<Actions>//state-rectangle",   "<Mod1>r");
-       ACCEL("<Actions>//state-gradient",    "<Mod1>g");
-
-       ACCEL("<Actions>//state-eyedrop",     "<Mod1>e");
-       ACCEL("<Actions>//state-fill",        "<Mod1>f");
-       ACCEL("<Actions>//state-zoom",        "<Mod1>z");
-       ACCEL("<Actions>//state-polygon",     "<Mod1>p");
-
-       ACCEL("<Actions>//state-draw",        "<Mod1>w");
-       ACCEL("<Actions>//state-sketch",      "<Mod1>k");
-       ACCEL("<Actions>//state-width",       "<Mod1>t");
-       ACCEL("<Actions>//state-mirror",      "<Mod1>m");
-
-       ACCEL("<Actions>//canvas-zoom-fit","<Control><Shift>z");
+       // the toolbox
+       ACCEL("<Mod1>a",                                                                                                        "<Actions>//state-normal"                                       );
+       ACCEL("<Mod1>v",                                                                                                        "<Actions>//state-smooth_move"                          );
+       ACCEL("<Mod1>s",                                                                                                        "<Actions>//state-scale"                                        );
+       ACCEL("<Mod1>t",                                                                                                        "<Actions>//state-rotate"                                       );
+       ACCEL("<Mod1>m",                                                                                                        "<Actions>//state-mirror"                                       );
+       ACCEL("<Mod1>c",                                                                                                        "<Actions>//state-circle"                                       );
+       ACCEL("<Mod1>r",                                                                                                        "<Actions>//state-rectangle"                            );
+       ACCEL("<Mod1>q",                                                                                                        "<Actions>//state-star"                                         );
+       ACCEL("<Mod1>g",                                                                                                        "<Actions>//state-gradient"                                     );
+       ACCEL("<Mod1>p",                                                                                                        "<Actions>//state-polygon"                                      );
+       ACCEL("<Mod1>b",                                                                                                        "<Actions>//state-bline"                                        );
+       ACCEL("<Mod1>x",                                                                                                        "<Actions>//state-text"                                         );
+       ACCEL("<Mod1>f",                                                                                                        "<Actions>//state-fill"                                         );
+       ACCEL("<Mod1>e",                                                                                                        "<Actions>//state-eyedrop"                                      );
+       ACCEL("<Mod1>z",                                                                                                        "<Actions>//state-zoom"                                         );
+       ACCEL("<Mod1>d",                                                                                                        "<Actions>//state-draw"                                         );
+       ACCEL("<Mod1>k",                                                                                                        "<Actions>//state-sketch"                                       );
+       ACCEL("<Mod1>w",                                                                                                        "<Actions>//state-width"                                        );
+
+       // everything else
+       ACCEL("<Control>a",                                                                                                     "<Actions>//select-all-ducks"                           );
+       ACCEL("<Control>d",                                                                                                     "<Actions>//unselect-all-ducks"                         );
+       ACCEL("<Control><Shift>a",                                                                                      "<Actions>//select-all-layers"                          );
+       ACCEL("<Control><Shift>d",                                                                                      "<Actions>//unselect-all-layers"                        );
+       ACCEL("F9",                                                                                                                     "<Actions>//render"                                                     );
+       ACCEL("F11",                                                                                                            "<Actions>//preview"                                            );
+       ACCEL("F8",                                                                                                                     "<Actions>//properties"                                         );
+       ACCEL("F12",                                                                                                            "<Actions>//options"                                            );
+       ACCEL("<control>i",                                                                                                     "<Actions>//import"                                                     );
+       ACCEL2(Gtk::AccelKey(GDK_Escape,static_cast<Gdk::ModifierType>(0),      "<Actions>//stop"                                                       ));
+       ACCEL("<Control>g",                                                                                                     "<Actions>//toggle-grid-show"                           );
+       ACCEL("<Control>l",                                                                                                     "<Actions>//toggle-grid-snap"                           );
+       ACCEL2(Gtk::AccelKey('`',Gdk::CONTROL_MASK,                                                     "<Actions>//toggle-low-res"                                     ));
+       ACCEL("<Mod1>1",                                                                                                        "<Actions>//mask-position-ducks"                        );
+       ACCEL("<Mod1>2",                                                                                                        "<Actions>//mask-vertex-ducks"                          );
+       ACCEL("<Mod1>3",                                                                                                        "<Actions>//mask-tangent-ducks"                         );
+       ACCEL("<Mod1>4",                                                                                                        "<Actions>//mask-radius-ducks"                          );
+       ACCEL("<Mod1>5",                                                                                                        "<Actions>//mask-width-ducks"                           );
+       ACCEL("<Mod1>6",                                                                                                        "<Actions>//mask-angle-ducks"                           );
+       ACCEL2(Gtk::AccelKey(GDK_Page_Up,Gdk::SHIFT_MASK,                                       "<Actions>//action-LayerRaise"                          ));
+       ACCEL2(Gtk::AccelKey(GDK_Page_Down,Gdk::SHIFT_MASK,                                     "<Actions>//action-LayerLower"                          ));
+       ACCEL("<Control>1",                                                                                                     "<Actions>//quality-01"                                         );
+       ACCEL("<Control>2",                                                                                                     "<Actions>//quality-02"                                         );
+       ACCEL("<Control>3",                                                                                                     "<Actions>//quality-03"                                         );
+       ACCEL("<Control>4",                                                                                                     "<Actions>//quality-04"                                         );
+       ACCEL("<Control>5",                                                                                                     "<Actions>//quality-05"                                         );
+       ACCEL("<Control>6",                                                                                                     "<Actions>//quality-06"                                         );
+       ACCEL("<Control>7",                                                                                                     "<Actions>//quality-07"                                         );
+       ACCEL("<Control>8",                                                                                                     "<Actions>//quality-08"                                         );
+       ACCEL("<Control>9",                                                                                                     "<Actions>//quality-09"                                         );
+       ACCEL("<Control>0",                                                                                                     "<Actions>//quality-10"                                         );
+       ACCEL("<Control>z",                                                                                                     "<Actions>//undo"                                                       );
+       ACCEL("<Control>r",                                                                                                     "<Actions>//redo"                                                       );
+       ACCEL2(Gtk::AccelKey(GDK_Delete,Gdk::CONTROL_MASK,                                      "<Actions>//action-LayerRemove"                         ));
+       ACCEL2(Gtk::AccelKey('(',Gdk::CONTROL_MASK,                                                     "<Actions>//decrease-low-res-pixel-size"        ));
+       ACCEL2(Gtk::AccelKey(')',Gdk::CONTROL_MASK,                                                     "<Actions>//increase-low-res-pixel-size"        ));
+       ACCEL2(Gtk::AccelKey('(',Gdk::MOD1_MASK|Gdk::CONTROL_MASK,                      "<Actions>//amount-dec"                                         ));
+       ACCEL2(Gtk::AccelKey(')',Gdk::MOD1_MASK|Gdk::CONTROL_MASK,                      "<Actions>//amount-inc"                                         ));
+       ACCEL2(Gtk::AccelKey(']',Gdk::CONTROL_MASK,                                                     "<Actions>//jump-next-keyframe"                         ));
+       ACCEL2(Gtk::AccelKey('[',Gdk::CONTROL_MASK,                                                     "<Actions>//jump-prev-keyframe"                         ));
+       ACCEL2(Gtk::AccelKey('=',Gdk::CONTROL_MASK,                                                     "<Actions>//canvas-zoom-in"                                     ));
+       ACCEL2(Gtk::AccelKey('-',Gdk::CONTROL_MASK,                                                     "<Actions>//canvas-zoom-out"                            ));
+       ACCEL2(Gtk::AccelKey('+',Gdk::CONTROL_MASK,                                                     "<Actions>//time-zoom-in"                                       ));
+       ACCEL2(Gtk::AccelKey('_',Gdk::CONTROL_MASK,                                                     "<Actions>//time-zoom-out"                                      ));
+       ACCEL2(Gtk::AccelKey('.',Gdk::CONTROL_MASK,                                                     "<Actions>//seek-next-frame"                            ));
+       ACCEL2(Gtk::AccelKey(',',Gdk::CONTROL_MASK,                                                     "<Actions>//seek-prev-frame"                            ));
+       ACCEL2(Gtk::AccelKey('>',Gdk::CONTROL_MASK,                                                     "<Actions>//seek-next-second"                           ));
+       ACCEL2(Gtk::AccelKey('<',Gdk::CONTROL_MASK,                                                     "<Actions>//seek-prev-second"                           ));
+       ACCEL("<Mod1>o",                                                                                                        "<Actions>//toggle-onion-skin"                          );
+       ACCEL("<Control><Shift>z",                                                                                      "<Actions>//canvas-zoom-fit"                            );
+       ACCEL("<Control>p",                                                                                                     "<Actions>//play"                                                       );
+       ACCEL("Home",                                                                                                           "<Actions>//seek-begin"                                         );
+       ACCEL("End",                                                                                                            "<Actions>//seek-end"                                           );
 
 #undef ACCEL
 }
@@ -1082,6 +1142,11 @@ App::App(int *argc, char ***argv):
 
        // Initialize the Synfig library
        try { synfigapp_main=etl::smart_ptr<synfigapp::Main>(new synfigapp::Main(etl::dirname((*argv)[0]),&synfig_init_cb)); }
+       catch(std::runtime_error x)
+       {
+               get_ui_interface()->error(strprintf("%s\n\n%s", _("Failed to initialize synfig!"), x.what()));
+               throw;
+       }
        catch(...)
        {
                get_ui_interface()->error(_("Failed to initialize synfig!"));
@@ -1181,21 +1246,22 @@ App::App(int *argc, char ***argv):
                studio_init_cb.task(_("Init ModMirror...")); module_list_.push_back(new ModMirror()); module_list_.back()->start();
 
                /* row 2 */
-               state_manager->add_state(&state_bline);
                state_manager->add_state(&state_circle);
                state_manager->add_state(&state_rectangle);
+               state_manager->add_state(&state_star);
                state_manager->add_state(&state_gradient);
                if(!getenv("SYNFIG_DISABLE_POLYGON")) state_manager->add_state(&state_polygon); // Enabled - for working without ducks
 
                /* row 3 */
-               if(!getenv("SYNFIG_DISABLE_DRAW"   )) state_manager->add_state(&state_draw); // Enabled for now.  Let's see whether they're good enough yet.
-               if(!getenv("SYNFIG_DISABLE_SKETCH" )) state_manager->add_state(&state_sketch);
+               state_manager->add_state(&state_bline);
+               state_manager->add_state(&state_text);
                state_manager->add_state(&state_fill);
                state_manager->add_state(&state_eyedrop);
                state_manager->add_state(&state_zoom);
 
-               // Disabled by default - it doesn't work properly?
-               if(getenv("SYNFIG_ENABLE_WIDTH"    )) state_manager->add_state(&state_width);
+               if(!getenv("SYNFIG_DISABLE_DRAW"   )) state_manager->add_state(&state_draw); // Enabled for now.  Let's see whether they're good enough yet.
+               if(!getenv("SYNFIG_DISABLE_SKETCH" )) state_manager->add_state(&state_sketch);
+               if(!getenv("SYNFIG_DISABLE_WIDTH"  )) state_manager->add_state(&state_width); // Enabled since 0.61.09
 
                studio_init_cb.task(_("Init ModPalette..."));
                module_list_.push_back(new ModPalette()); module_list_.back()->start();
@@ -1302,7 +1368,7 @@ App::~App()
        delete auto_recover;
 
        delete about;
-       
+
        toolbox->hide();
 
 //     studio::App::iteration(false);
@@ -1370,7 +1436,8 @@ App::set_recent_file_window_size(etl::handle<Instance> instance)
                // find the canvas
                synfig::Canvas::Handle canvas;
                try {
-                       canvas = instance->get_canvas()->find_canvas(String(canvas_window_size, current, separator-current));
+                       String warnings;
+                       canvas = instance->get_canvas()->find_canvas(String(canvas_window_size, current, separator-current), warnings);
                }
                catch(Exception::IDNotFound) {
                        // can't find the canvas; skip to the next canvas or return
@@ -1610,10 +1677,13 @@ App::load_settings()
                                {
                                        if(!window_size_broken && !file_window_size)
                                                window_size_broken = true;
-                                       if(!window_size_broken)
-                                               add_recent_file(recent_file,recent_file_window_size);
-                                       else
-                                               add_recent_file(recent_file);
+                                       if (std::ifstream(recent_file.c_str()))
+                                       {
+                                               if(!window_size_broken)
+                                                       add_recent_file(recent_file,recent_file_window_size);
+                                               else
+                                                       add_recent_file(recent_file);
+                                       }
                                }
                        }
                        if(!window_size_broken && file_window_size)
@@ -1662,6 +1732,11 @@ App::reset_initial_window_configuration()
        synfigapp::Main::settings().set_value("pref.single_threaded","0");
 #endif
        synfigapp::Main::settings().set_value("pref.restrict_radius_ducks","0");
+       synfigapp::Main::settings().set_value("pref.resize_imported_images","0");
+       synfigapp::Main::settings().set_value("pref.custom_filename_prefix",DEFAULT_FILENAME_PREFIX);
+       synfigapp::Main::settings().set_value("pref.preferred_x_size","480");
+       synfigapp::Main::settings().set_value("pref.preferred_y_size","270");
+       synfigapp::Main::settings().set_value("pref.predefined_size",DEFAULT_PREDEFINED_SIZE);
        synfigapp::Main::settings().set_value("window.toolbox.pos","4 4");
 }
 
@@ -1778,7 +1853,7 @@ static OPENFILENAME ofn={};
 bool
 App::dialog_open_file(const std::string &title, std::string &filename, std::string preference)
 {
-       info("App::dialog_open_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
+       // info("App::dialog_open_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
 
 #ifdef USE_WIN32_FILE_DIALOGS
        static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ;
@@ -1845,7 +1920,7 @@ App::dialog_open_file(const std::string &title, std::string &filename, std::stri
 
     if(dialog->run() == GTK_RESPONSE_ACCEPT) {
         filename = dialog->get_filename();
-               info("Saving preference %s = '%s' in App::dialog_open_file()", preference.c_str(), dirname(filename).c_str());
+               // info("Saving preference %s = '%s' in App::dialog_open_file()", preference.c_str(), dirname(filename).c_str());
                _preferences.set_value(preference, dirname(filename));
         delete dialog;
         return true;
@@ -1904,7 +1979,7 @@ App::dialog_open_file(const std::string &title, std::string &filename, std::stri
 bool
 App::dialog_save_file(const std::string &title, std::string &filename, std::string preference)
 {
-       info("App::dialog_save_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
+       // info("App::dialog_save_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
 
 #if USE_WIN32_FILE_DIALOGS
        static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ;
@@ -1967,7 +2042,8 @@ App::dialog_save_file(const std::string &title, std::string &filename, std::stri
        {
                file_type_enum = manage(new Widget_Enum());
                file_type_enum->set_param_desc(ParamDesc().set_hint("enum")
-                                                                          .add_enum_value(synfig::RELEASE_VERSION_0_61_08, "0.61.08", strprintf("0.61.08 (%s)", _("current")))
+                                                                          .add_enum_value(synfig::RELEASE_VERSION_0_61_09, "0.61.09", strprintf("0.61.09 (%s)", _("current")))
+                                                                          .add_enum_value(synfig::RELEASE_VERSION_0_61_08, "0.61.08", "0.61.08")
                                                                           .add_enum_value(synfig::RELEASE_VERSION_0_61_07, "0.61.07", "0.61.07")
                                                                           .add_enum_value(synfig::RELEASE_VERSION_0_61_06, "0.61.06", strprintf("0.61.06 %s", _("and older"))));
                file_type_enum->set_value(RELEASE_VERSION_END-1); // default to the most recent version
@@ -2003,7 +2079,7 @@ App::dialog_save_file(const std::string &title, std::string &filename, std::stri
                if (preference == ANIMATION_DIR_PREFERENCE)
                        set_file_version(synfig::ReleaseVersion(file_type_enum->get_value()));
         filename = dialog->get_filename();
-               info("Saving preference %s = '%s' in App::dialog_save_file()", preference.c_str(), dirname(filename).c_str());
+               // info("Saving preference %s = '%s' in App::dialog_save_file()", preference.c_str(), dirname(filename).c_str());
                _preferences.set_value(preference, dirname(filename));
         delete dialog;
         return true;
@@ -2123,7 +2199,7 @@ try_open_url(const std::string &url)
        if( command_line[0] == "kfmclient" ) command_line.push_back("openURL");
        command_line.push_back(url);
 
-       try { Glib::spawn_async(".", command_line, Glib::SPAWN_SEARCH_PATH); }
+       try { Glib::spawn_async(".", command_line, Glib::SPAWN_SEARCH_PATH); return true; }
        catch( Glib::SpawnError& exception ){
 
                while ( !browsers.empty() )
@@ -2145,7 +2221,7 @@ try_open_url(const std::string &url)
                        try { Glib::spawn_async(".", command_line, Glib::SPAWN_SEARCH_PATH); }
                        // Failed, move on to the next one
                        catch(Glib::SpawnError& exception){ continue; }
-                       return true; // No exception means we succeeded!                        
+                       return true; // No exception means we succeeded!
                }
        }
 
@@ -2183,8 +2259,8 @@ App::dialog_entry(const std::string &title, const std::string &message,std::stri
        Gtk::Dialog dialog(
                title,          // Title
                true,           // Modal
-               true            // use_separator
-       );
+               true);          // use_separator
+
        Gtk::Label label(message);
        label.show();
        dialog.get_vbox()->pack_start(label);
@@ -2193,11 +2269,13 @@ App::dialog_entry(const std::string &title, const std::string &message,std::stri
        entry.set_text(text);
        entry.show();
        entry.set_activates_default(true);
+
        dialog.get_vbox()->pack_start(entry);
 
        dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK);
        dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL);
        dialog.set_default_response(Gtk::RESPONSE_OK);
+
        entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK));
        dialog.show();
 
@@ -2209,8 +2287,39 @@ App::dialog_entry(const std::string &title, const std::string &message,std::stri
        return true;
 }
 
+bool
+App::dialog_paragraph(const std::string &title, const std::string &message,std::string &text)
+{
+       Gtk::Dialog dialog(
+               title,          // Title
+               true,           // Modal
+               true);          // use_separator
 
+       Gtk::Label label(message);
+       label.show();
+       dialog.get_vbox()->pack_start(label);
+
+       Glib::RefPtr<Gtk::TextBuffer> text_buffer(Gtk::TextBuffer::create());
+       text_buffer->set_text(text);
+       Gtk::TextView text_view(text_buffer);
+       text_view.show();
+
+       dialog.get_vbox()->pack_start(text_view);
+
+       dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK);
+       dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL);
+       dialog.set_default_response(Gtk::RESPONSE_OK);
 
+       //text_entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK));
+       dialog.show();
+
+       if(dialog.run()!=Gtk::RESPONSE_OK)
+               return false;
+
+       text=text_buffer->get_text();
+
+       return true;
+}
 
 bool
 App::open(std::string filename)
@@ -2236,8 +2345,9 @@ App::open_as(std::string filename,std::string as)
        try
        {
                OneMoment one_moment;
+               String errors, warnings;
 
-               etl::handle<synfig::Canvas> canvas(open_canvas_as(filename,as));
+               etl::handle<synfig::Canvas> canvas(open_canvas_as(filename,as,errors,warnings));
                if(canvas && get_instance(canvas))
                {
                        get_instance(canvas)->find_canvas_view(canvas)->present();
@@ -2247,9 +2357,12 @@ App::open_as(std::string filename,std::string as)
                else
                {
                        if(!canvas)
-                               throw (String)strprintf(_("Unable to open file \"%s\""),filename.c_str());
+                               throw (String)strprintf(_("Unable to load \"%s\":\n\n"),filename.c_str()) + errors;
 
-                       if (as.find(DEFAULT_FILENAME_PREFIX) != 0)
+                       if (warnings != "")
+                               dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str()));
+
+                       if (as.find(custom_filename_prefix.c_str()) != 0)
                                add_recent_file(as);
 
                        handle<Instance> instance(Instance::create(canvas));
@@ -2270,6 +2383,11 @@ App::open_as(std::string filename,std::string as)
                dialog_error_blocking(_("Error"), x);
                return false;
        }
+       catch(runtime_error x)
+       {
+               dialog_error_blocking(_("Error"), x.what());
+               return false;
+       }
        catch(...)
        {
                dialog_error_blocking(_("Error"), _("Uncaught error on file open (BUG)"));
@@ -2285,7 +2403,7 @@ App::new_instance()
 {
        handle<synfig::Canvas> canvas=synfig::Canvas::create();
 
-       String file_name(strprintf("%s%d", DEFAULT_FILENAME_PREFIX, Instance::get_count()+1));
+       String file_name(strprintf("%s%d", App::custom_filename_prefix.c_str(), Instance::get_count()+1));
        canvas->set_name(file_name);
        file_name += ".sifz";
 
@@ -2294,10 +2412,12 @@ App::new_instance()
        canvas->rend_desc().set_time_end(5.0);
        canvas->rend_desc().set_x_res(DPI2DPM(72.0f));
        canvas->rend_desc().set_y_res(DPI2DPM(72.0f));
-       canvas->rend_desc().set_tl(Vector(-4,2.25));
-       canvas->rend_desc().set_br(Vector(4,-2.25));
-       canvas->rend_desc().set_w(480);
-       canvas->rend_desc().set_h(270);
+       // The top left and botton right positions are expressed in units
+       // Original convention is that 1 unit = 60 pixels
+       canvas->rend_desc().set_tl(Vector(-(preferred_x_size/60.0)/2.0,(preferred_y_size/60.0)/2.0));
+       canvas->rend_desc().set_br(Vector((preferred_x_size/60.0)/2.0,-(preferred_y_size/60.0)/2.0));
+       canvas->rend_desc().set_w(preferred_x_size);
+       canvas->rend_desc().set_h(preferred_y_size);
        canvas->rend_desc().set_antialias(1);
        canvas->rend_desc().set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
        canvas->set_file_name(file_name);