Stable Tag: Copying everything over
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / instance.cpp
index a70d474..09fc936 100644 (file)
@@ -1,20 +1,21 @@
-/* === S I N F G =========================================================== */
-/*!    \file instance.cpp
+/* === S Y N F I G ========================================================= */
+/*!    \file gtkmm/instance.cpp
 **     \brief writeme
 **
-**     $Id: instance.cpp,v 1.2 2005/01/13 18:37:30 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
 #include <sigc++/retype_return.h>
 #include <sigc++/retype.h>
 //#include <sigc++/hide.h>
-#include <sinfg/valuenode_composite.h>
+#include <synfig/valuenode_composite.h>
 #include "widget_waypointmodel.h"
 #include <gtkmm/actiongroup.h>
 #include "iconcontroler.h"
+#include <sys/stat.h>
+#include <errno.h>
 
 #endif
 
 using namespace std;
 using namespace etl;
-using namespace sinfg;
+using namespace synfig;
 using namespace studio;
 using namespace SigC;
 
@@ -69,7 +72,7 @@ int studio::Instance::instance_count_=0;
 /* === M E T H O D S ======================================================= */
 
 Instance::Instance(Canvas::Handle canvas):
-       sinfgapp::Instance              (canvas),
+       synfigapp::Instance             (canvas),
 //     canvas_tree_store_              (Gtk::TreeStore::create(CanvasTreeModel())),
 //     canvas_tree_store_              (Gtk::TreeStore::create()),
        history_tree_store_             (HistoryTreeStore::create(this)),
@@ -80,7 +83,7 @@ Instance::Instance(Canvas::Handle canvas):
        canvas_tree_store_=Gtk::TreeStore::create(model);
 
        id_=instance_count_++;
-       
+
        // Connect up all the signals
        signal_filename_changed().connect(sigc::mem_fun(*this,&studio::Instance::update_all_titles));
        signal_unsaved_status_changed().connect(sigc::hide(sigc::mem_fun(*this,&studio::Instance::update_all_titles)));
@@ -94,9 +97,9 @@ Instance::Instance(Canvas::Handle canvas):
                        )
                )
        );
-       
+
        canvas_tree_store_=Gtk::TreeStore::create(canvas_tree_model);
-       
+
        refresh_canvas_tree();
 }
 
@@ -123,20 +126,20 @@ Instance::create(Canvas::Handle canvas)
 
        // Add the new instance to the application's instance list
        App::instance_list.push_back(instance);
-       
+
        // Set up the instance with the default UI manager
-       instance->sinfgapp::Instance::set_ui_interface(App::get_ui_interface());
-       
+       instance->synfigapp::Instance::set_ui_interface(App::get_ui_interface());
+
        // Signal the new instance
        App::signal_instance_created()(instance);
-       
+
        // And then make sure that is has been selected
        App::set_selected_instance(instance);
-       
+
        // Create the initial window for the root canvas
        instance->focus(canvas);
-       
-       return instance;        
+
+       return instance;
 }
 
 handle<CanvasView>
@@ -149,11 +152,11 @@ Instance::find_canvas_view(Canvas::Handle canvas)
                canvas=canvas->parent();
 
        CanvasViewList::iterator iter;
-       
+
        for(iter=canvas_view_list().begin();iter!=canvas_view_list().end();iter++)
                if((*iter)->get_canvas()==canvas)
                        return *iter;
-       
+
        return CanvasView::create(this,canvas);
 }
 
@@ -182,9 +185,9 @@ Instance::set_redo_status(bool x)
 }
 
 bool
-studio::Instance::save_as(const sinfg::String &file_name)const
+studio::Instance::save_as(const synfig::String &file_name)const
 {
-       if(sinfgapp::Instance::save_as(file_name))
+       if(synfigapp::Instance::save_as(file_name))
        {
                App::add_recent_file(file_name);
                return true;
@@ -193,9 +196,9 @@ studio::Instance::save_as(const sinfg::String &file_name)const
 }
 
 bool
-studio::Instance::save_as(const sinfg::String &file_name)
+studio::Instance::save_as(const synfig::String &file_name)
 {
-       if(sinfgapp::Instance::save_as(file_name))
+       if(synfigapp::Instance::save_as(file_name))
        {
                App::add_recent_file(file_name);
                return true;
@@ -212,23 +215,23 @@ studio::Instance::save()
                return true;
        }
 
-       return sinfgapp::Instance::save();
-       
+       return synfigapp::Instance::save();
+
 }
 
 void
 studio::Instance::dialog_save_as()
 {
        string filename="*.sif";
-       
+
        Canvas::Handle canvas(get_canvas());
-       
+
        {
                OneMoment one_moment;
                std::set<Node*>::iterator iter;
                for(iter=canvas->parent_set.begin();iter!=canvas->parent_set.end();++iter)
                {
-                       sinfg::Node* node(*iter);
+                       synfig::Node* node(*iter);
                        for(;!node->parent_set.empty();node=*node->parent_set.begin())
                        {
                                Layer::Handle parent_layer(dynamic_cast<Layer*>(node));
@@ -240,7 +243,7 @@ studio::Instance::dialog_save_as()
                                                "files that are currently open. Close these\n"
                                                "other files first before trying to use \"SaveAs\"."
                                        );
-                                       
+
                                        return;
                                }
                                if(parent_layer)
@@ -248,8 +251,14 @@ studio::Instance::dialog_save_as()
                        }
                }
        }
-       
-       while(App::dialog_saveas_file("SaveAs", filename))
+
+       // show the canvas' name if it has one, else its ID
+       while(App::dialog_saveas_file(_("Choose a Filename to Save As") +
+                                                                 String(" (") +
+                                                                 (canvas->get_name().empty()
+                                                                  ? canvas->get_id()
+                                                                  : canvas->get_name()) +
+                                                                 ") ...", filename))
        {
                // If the filename still has wildcards, then we should
                // continue looking for the file we want
@@ -272,14 +281,27 @@ studio::Instance::dialog_save_as()
                {
                        continue;
                }
-                       
+
+               {
+                       struct stat     s;
+                       // if stat() succeeds, or it fails with something other than 'file doesn't exist', the file exists
+                       // if the file exists and the user doesn't want to overwrite it, keep prompting for a filename
+                       if ((stat(filename.c_str(), &s) != -1 || errno != ENOENT) &&
+                               !App::dialog_yes_no("File exists",
+                                                                       "A file named '" +
+                                                                       filename +
+                                                                       "' already exists.\n\n"
+                                                                       "Do you want to replace it with the file you are saving?"))
+                               continue;
+               }
+
                if(save_as(filename))
                        break;
-               
+
                App::dialog_error_blocking("SaveAs - Error","Unable to save file");
        }
 }
-       
+
 void
 Instance::update_all_titles()
 {
@@ -318,6 +340,9 @@ Instance::close()
        for(std::list<etl::handle<CanvasView> >::iterator iter=canvas_view_list().begin();iter!=canvas_view_list().end();iter++)
                (*iter)->hide();
 
+       // Consume pending events before deleting the canvas views
+       while(studio::App::events_pending())studio::App::iteration(false);
+
        // Delete all of the canvas views
        canvas_view_list().clear();
 
@@ -335,14 +360,14 @@ Instance::close()
        }
 }
 
-       
+
 void
 Instance::insert_canvas(Gtk::TreeRow row,Canvas::Handle canvas)
 {
        CanvasTreeModel canvas_tree_model;
        assert(canvas);
 
-       row[canvas_tree_model.icon] = Gtk::Button().render_icon(Gtk::StockID("sinfg-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);     
+       row[canvas_tree_model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
        row[canvas_tree_model.id] = canvas->get_id();
        row[canvas_tree_model.name] = canvas->get_name();
        if(canvas->is_root())
@@ -352,18 +377,18 @@ Instance::insert_canvas(Gtk::TreeRow row,Canvas::Handle canvas)
                row[canvas_tree_model.label] = canvas->get_id();
        else
        if(!canvas->get_name().empty())
-               row[canvas_tree_model.label] = canvas->get_name();              
+               row[canvas_tree_model.label] = canvas->get_name();
        else
-               row[canvas_tree_model.label] = _("[Unnamed]");          
-               
+               row[canvas_tree_model.label] = _("[Unnamed]");
+
        row[canvas_tree_model.canvas] = canvas;
        row[canvas_tree_model.is_canvas] = true;
        row[canvas_tree_model.is_value_node] = false;
 
        {
-               sinfg::Canvas::Children::iterator iter;
-               sinfg::Canvas::Children &children(canvas->children());
-       
+               synfig::Canvas::Children::iterator iter;
+               synfig::Canvas::Children &children(canvas->children());
+
                for(iter=children.begin();iter!=children.end();iter++)
                        insert_canvas(*(canvas_tree_store()->append(row.children())),*iter);
        }
@@ -378,8 +403,8 @@ Instance::insert_canvas(Gtk::TreeRow row,Canvas::Handle canvas)
                valuenode_row[canvas_tree_model.is_canvas] = false;
                valuenode_row[canvas_tree_model.is_value_node] = false;
 
-               sinfg::ValueNodeList::iterator iter;
-               sinfg::ValueNodeList &value_node_list(canvas->value_node_list());
+               synfig::ValueNodeList::iterator iter;
+               synfig::ValueNodeList &value_node_list(canvas->value_node_list());
 
                for(iter=value_node_list.begin();iter!=value_node_list.end();iter++)
                        insert_value_node(*(canvas_tree_store()->append(valuenode_row.children())),canvas,*iter);
@@ -390,7 +415,7 @@ Instance::insert_canvas(Gtk::TreeRow row,Canvas::Handle canvas)
 
 /*
 void
-Instance::insert_value_node(Gtk::TreeRow row,Canvas::Handle canvas,etl::handle<sinfg::ValueNode> value_node)
+Instance::insert_value_node(Gtk::TreeRow row,Canvas::Handle canvas,etl::handle<synfig::ValueNode> value_node)
 {
        CanvasTreeModel canvas_tree_model;
        assert(value_node);
@@ -428,7 +453,7 @@ Instance::dialog_cvs_commit()
        {
                string message;
 
-               if(sinfgapp::Instance::get_action_count())
+               if(synfigapp::Instance::get_action_count())
                {
                        if(!App::dialog_yes_no(_("CVS Commit"), _("This will save any changes you have made. Are you sure?")))
                                return;
@@ -443,7 +468,7 @@ Instance::dialog_cvs_commit()
 
                if(!App::dialog_entry(_("CVS Commit"),_("Enter a log message describing the changes you have made"), message))
                        return;
-               
+
                OneMoment one_moment;
                cvs_commit(message);
        }
@@ -466,7 +491,7 @@ Instance::dialog_cvs_add()
        try
        {
                string message;
-               
+
                //if(!App::dialog_entry(_("CVS Add"),_("Enter a log message describing the file"), message))
                //      return;
                OneMoment one_moment;
@@ -493,11 +518,11 @@ Instance::dialog_cvs_update()
                App::dialog_error_blocking(_("Info"),_("This file is up-to-date"));
                return;
        }
-       
+
        try
        {
                String filename(get_file_name());
-               if(sinfgapp::Instance::get_action_count())
+               if(synfigapp::Instance::get_action_count())
                {
                        if(!App::dialog_yes_no(_("CVS Update"), _("This will save any changes you have made. Are you sure?")))
                                return;
@@ -506,7 +531,7 @@ Instance::dialog_cvs_update()
                OneMoment one_moment;
                time_t oldtime=get_original_timestamp();
                cvs_update();
-               calc_repository_info();         
+               calc_repository_info();
                // If something has been updated...
                if(oldtime!=get_original_timestamp())
                {
@@ -564,17 +589,17 @@ Instance::_revert(Instance *instance)
        String filename(instance->get_file_name());
 
        Canvas::Handle canvas(instance->get_canvas());
-       
+
        instance->close();
 
        if(canvas->count()!=1)
        {
                one_moment.hide();
-               App::dialog_error_blocking(_("Error: Revert Failed"),_("The revert operation has failed. This can be due to it being\nreferenced by another composition that is already open, or\nbecause of an internal error in SINFG Studio. Try closing any\ncompositions that might reference this composition and try\nagain, or restart SINFG studio."));
+               App::dialog_error_blocking(_("Error: Revert Failed"),_("The revert operation has failed. This can be due to it being\nreferenced by another composition that is already open, or\nbecause of an internal error in Synfig Studio. Try closing any\ncompositions that might reference this composition and try\nagain, or restart Synfig Studio."));
                one_moment.show();
        }
        canvas=0;
-       
+
        App::open(filename);
 }
 
@@ -597,8 +622,8 @@ Instance::revert()
 bool
 Instance::safe_revert()
 {
-       if(sinfgapp::Instance::get_action_count())
-               if(!App::dialog_yes_no(_("Revert to saved"), _("You will loose any changes you have made since your last save.\nAre you sure?")))
+       if(synfigapp::Instance::get_action_count())
+               if(!App::dialog_yes_no(_("Revert to saved"), _("You will lose any changes you have made since your last save.\nAre you sure?")))
                        return false;
        revert();
        return true;
@@ -607,56 +632,54 @@ Instance::safe_revert()
 bool
 Instance::safe_close()
 {
-       handle<sinfgapp::UIInterface> uim;
+       handle<synfigapp::UIInterface> uim;
        uim=find_canvas_view(get_canvas())->get_ui_interface();
 
        if(get_action_count())
        {
                string str=strprintf(_("Would you like to save your changes to %s?"),basename(get_file_name()).c_str() );
-               int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES);
-               if(answer==sinfgapp::UIInterface::RESPONSE_YES)
+               int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES);
+               if(answer==synfigapp::UIInterface::RESPONSE_YES)
                        save();
-               if(answer==sinfgapp::UIInterface::RESPONSE_CANCEL)
+               if(answer==synfigapp::UIInterface::RESPONSE_CANCEL)
                        return false;
        }
 
        if(is_modified())
        {
                string str=strprintf(_("%s has changes not yet on the CVS repository.\nWould you like to commit these changes?"),basename(get_file_name()).c_str());
-               int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES);
+               int answer=uim->yes_no_cancel(get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES);
 
-               if(answer==sinfgapp::UIInterface::RESPONSE_YES)
+               if(answer==synfigapp::UIInterface::RESPONSE_YES)
                        dialog_cvs_commit();
-               if(answer==sinfgapp::UIInterface::RESPONSE_CANCEL)
+               if(answer==synfigapp::UIInterface::RESPONSE_CANCEL)
                        return false;
        }
-       
-       close();
 
-       while(studio::App::events_pending())studio::App::iteration(false);
+       close();
 
        return true;
 }
 
 
 void
-Instance::add_actions_to_group(const Glib::RefPtr<Gtk::ActionGroup>& action_group, sinfg::String& ui_info,   const sinfgapp::Action::ParamList &param_list, sinfgapp::Action::Category category)const
+Instance::add_actions_to_group(const Glib::RefPtr<Gtk::ActionGroup>& action_group, synfig::String& ui_info,   const synfigapp::Action::ParamList &param_list, synfigapp::Action::Category category)const
 {
-       sinfgapp::Action::CanidateList canidate_list;
-       sinfgapp::Action::CanidateList::iterator iter;
-       
-       canidate_list=compile_canidate_list(param_list,category);
-       
-       canidate_list.sort();
-
-       if(canidate_list.empty())
-               sinfg::warning("Action CanidateList is empty!");
-       
-       for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
+       synfigapp::Action::CandidateList candidate_list;
+       synfigapp::Action::CandidateList::iterator iter;
+
+       candidate_list=compile_candidate_list(param_list,category);
+
+       candidate_list.sort();
+
+       if(candidate_list.empty())
+               synfig::warning("Action CandidateList is empty!");
+
+       for(iter=candidate_list.begin();iter!=candidate_list.end();++iter)
        {
                Gtk::StockID stock_id(get_action_stock_id(*iter));
-               
-               if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+
+               if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
                {
                        action_group->add(Gtk::Action::create(
                                "action-"+iter->name,
@@ -680,25 +703,25 @@ Instance::add_actions_to_group(const Glib::RefPtr<Gtk::ActionGroup>& action_grou
 }
 
 void
-Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList &param_list,sinfgapp::Action::Category category)const
+Instance::add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList &param_list,synfigapp::Action::Category category)const
 {
-       sinfgapp::Action::CanidateList canidate_list;
-       sinfgapp::Action::CanidateList::iterator iter;
-       
-       canidate_list=compile_canidate_list(param_list,category);
-       
-       canidate_list.sort();
-
-       if(canidate_list.empty())
-               sinfg::warning("Action CanidateList is empty!");
-       
-       for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
+       synfigapp::Action::CandidateList candidate_list;
+       synfigapp::Action::CandidateList::iterator iter;
+
+       candidate_list=compile_candidate_list(param_list,category);
+
+       candidate_list.sort();
+
+       if(candidate_list.empty())
+               synfig::warning("Action CandidateList is empty!");
+
+       for(iter=candidate_list.begin();iter!=candidate_list.end();++iter)
        {
-               if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+               if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
                {
                        Gtk::Image* image(manage(new Gtk::Image()));
                        Gtk::Stock::lookup(get_action_stock_id(*iter),Gtk::ICON_SIZE_MENU,*image);
-                       
+
                        /*
                        if(iter->task=="raise")
                                Gtk::Stock::lookup(Gtk::Stock::GO_UP,Gtk::ICON_SIZE_MENU,*image);
@@ -720,9 +743,9 @@ Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList
                                Gtk::Stock::lookup(Gtk::Stock::DELETE,Gtk::ICON_SIZE_MENU,*image);
                        else
                        {
-                               Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
+                               Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
                                Gtk::Stock::lookup(Gtk::StockID("gtk-"+iter->task),Gtk::ICON_SIZE_MENU,*image) ||
-                               Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
+                               Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
                        }
                        */
                        menu->items().push_back(
@@ -746,34 +769,34 @@ Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList
 }
 
 void
-Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList &param_list,const sinfgapp::Action::ParamList &param_list2,sinfgapp::Action::Category category)const
+Instance::add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList &param_list,const synfigapp::Action::ParamList &param_list2,synfigapp::Action::Category category)const
 {
-       sinfgapp::Action::CanidateList canidate_list;
-       sinfgapp::Action::CanidateList canidate_list2;
-       
-       sinfgapp::Action::CanidateList::iterator iter;
-       
-       canidate_list=compile_canidate_list(param_list,category);
-       canidate_list2=compile_canidate_list(param_list2,category);
-       
-       canidate_list.sort();
-
-       if(canidate_list.empty())
-               sinfg::warning("Action CanidateList is empty!");
-       if(canidate_list2.empty())
-               sinfg::warning("Action CanidateList2 is empty!");
-
-       // Seperate out the canidate lists so that there are no conflicts
-       for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
+       synfigapp::Action::CandidateList candidate_list;
+       synfigapp::Action::CandidateList candidate_list2;
+
+       synfigapp::Action::CandidateList::iterator iter;
+
+       candidate_list=compile_candidate_list(param_list,category);
+       candidate_list2=compile_candidate_list(param_list2,category);
+
+       candidate_list.sort();
+
+       if(candidate_list.empty())
+               synfig::warning("Action CandidateList is empty!");
+       if(candidate_list2.empty())
+               synfig::warning("Action CandidateList2 is empty!");
+
+       // Seperate out the candidate lists so that there are no conflicts
+       for(iter=candidate_list.begin();iter!=candidate_list.end();++iter)
        {
-               sinfgapp::Action::CanidateList::iterator iter2(canidate_list2.find(iter->name));
-               if(iter2!=canidate_list2.end())
-                       canidate_list2.erase(iter2);
+               synfigapp::Action::CandidateList::iterator iter2(candidate_list2.find(iter->name));
+               if(iter2!=candidate_list2.end())
+                       candidate_list2.erase(iter2);
        }
-               
-       for(iter=canidate_list2.begin();iter!=canidate_list2.end();++iter)
+
+       for(iter=candidate_list2.begin();iter!=candidate_list2.end();++iter)
        {
-               if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+               if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
                {
                        Gtk::Image* image(manage(new Gtk::Image()));
                        Gtk::Stock::lookup(get_action_stock_id(*iter),Gtk::ICON_SIZE_MENU,*image);
@@ -798,9 +821,9 @@ Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList
                                Gtk::Stock::lookup(Gtk::Stock::DELETE,Gtk::ICON_SIZE_MENU,*image);
                        else
                        {
-                               Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
+                               Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
                                Gtk::Stock::lookup(Gtk::StockID("gtk-"+iter->task),Gtk::ICON_SIZE_MENU,*image) ||
-                               Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
+                               Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
                        }
 */
                        menu->items().push_back(
@@ -822,9 +845,9 @@ Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList
                }
        }
 
-       for(iter=canidate_list.begin();iter!=canidate_list.end();++iter)
+       for(iter=candidate_list.begin();iter!=candidate_list.end();++iter)
        {
-               if(!(iter->category&sinfgapp::Action::CATEGORY_HIDDEN))
+               if(!(iter->category&synfigapp::Action::CATEGORY_HIDDEN))
                {
                        Gtk::Image* image(manage(new Gtk::Image()));
                        Gtk::Stock::lookup(get_action_stock_id(*iter),Gtk::ICON_SIZE_MENU,*image);
@@ -848,9 +871,9 @@ Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList
                                Gtk::Stock::lookup(Gtk::Stock::DELETE,Gtk::ICON_SIZE_MENU,*image);
                        else
                        {
-                               Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
+                               Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->name),Gtk::ICON_SIZE_MENU,*image) ||
                                Gtk::Stock::lookup(Gtk::StockID("gtk-"+iter->task),Gtk::ICON_SIZE_MENU,*image) ||
-                               Gtk::Stock::lookup(Gtk::StockID("sinfg-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
+                               Gtk::Stock::lookup(Gtk::StockID("synfig-"+iter->task),Gtk::ICON_SIZE_MENU,*image);
                        }
 */
                        menu->items().push_back(
@@ -874,25 +897,25 @@ Instance::add_actions_to_menu(Gtk::Menu *menu, const sinfgapp::Action::ParamList
 }
 
 void
-Instance::process_action(String name, sinfgapp::Action::ParamList param_list)
+Instance::process_action(String name, synfigapp::Action::ParamList param_list)
 {
-       assert(sinfgapp::Action::book().count(name));
+       assert(synfigapp::Action::book().count(name));
+
+       synfigapp::Action::BookEntry entry(synfigapp::Action::book().find(name)->second);
 
-       sinfgapp::Action::BookEntry entry(sinfgapp::Action::book().find(name)->second);
-       
-       sinfgapp::Action::Handle action(entry.factory());
+       synfigapp::Action::Handle action(entry.factory());
 
        if(!action)
        {
-               sinfg::error("Bad Action");
+               synfig::error("Bad Action");
                return;
        }
-       
+
        action->set_param_list(param_list);
 
-       sinfgapp::Action::ParamVocab param_vocab(entry.get_param_vocab());
-       sinfgapp::Action::ParamVocab::const_iterator iter;
-       
+       synfigapp::Action::ParamVocab param_vocab(entry.get_param_vocab());
+       synfigapp::Action::ParamVocab::const_iterator iter;
+
        for(iter=param_vocab.begin();iter!=param_vocab.end();++iter)
        {
                if(!iter->get_mutual_exclusion().empty() && param_list.count(iter->get_mutual_exclusion()))
@@ -906,7 +929,7 @@ Instance::process_action(String name, sinfgapp::Action::ParamList param_list)
                {
                        switch(iter->get_type())
                        {
-                       case sinfgapp::Action::Param::TYPE_STRING:
+                       case synfigapp::Action::Param::TYPE_STRING:
                        {
                                String str;
                                if(!studio::App::dialog_entry(entry.local_name, iter->get_local_name()+":"+iter->get_desc(),str))
@@ -915,16 +938,16 @@ Instance::process_action(String name, sinfgapp::Action::ParamList param_list)
                                break;
                        }
                        default:
-                               sinfg::error("Unsupported user-supplied action parameter");
+                               synfig::error("Unsupported user-supplied action parameter");
                                return;
                                break;
                        }
                }
        }
-               
+
        if(!action->is_ready())
        {
-               sinfg::error("Action not ready");
+               synfig::error("Action not ready");
                return;
        }
 
@@ -932,23 +955,23 @@ Instance::process_action(String name, sinfgapp::Action::ParamList param_list)
 }
 
 void
-Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas, sinfgapp::ValueDesc value_desc, float location)
+Instance::make_param_menu(Gtk::Menu *menu,synfig::Canvas::Handle canvas, synfigapp::ValueDesc value_desc, float location)
 {
        Gtk::Menu& parammenu(*menu);
-       
-       etl::handle<sinfgapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
-       
+
+       etl::handle<synfigapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
+
        if(!canvas_interface)
                return;
-       
-       sinfgapp::Action::ParamList param_list,param_list2;
+
+       synfigapp::Action::ParamList param_list,param_list2;
        param_list=canvas_interface->generate_param_list(value_desc);
        param_list.add("origin",location);
 
        if(value_desc.get_value_type()==ValueBase::TYPE_BLINEPOINT && value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
        {
                param_list2=canvas_interface->generate_param_list(
-                       sinfgapp::ValueDesc(
+                       synfigapp::ValueDesc(
                                ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node())
                                ,0
                        )
@@ -956,7 +979,7 @@ Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas, sinfgapp
                param_list2.add("origin",location);
        }
 
-       
+
        // Populate the convert menu by looping through
        // the ValueNode book and find the ones that are
        // relevant.
@@ -971,7 +994,7 @@ Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas, sinfgapp
                                        sigc::hide_return(
                                                sigc::bind(
                                                        sigc::bind(
-                                                               sigc::mem_fun(*canvas_interface.get(),&sinfgapp::CanvasInterface::convert),
+                                                               sigc::mem_fun(*canvas_interface.get(),&synfigapp::CanvasInterface::convert),
                                                                iter->first
                                                        ),
                                                        value_desc
@@ -981,23 +1004,23 @@ Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas, sinfgapp
                        }
                }
 
-               parammenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::CONVERT,*convert_menu));                       
+               parammenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::CONVERT,*convert_menu));
        }
 
        if(param_list2.empty())
-               add_actions_to_menu(&parammenu, param_list,sinfgapp::Action::CATEGORY_VALUEDESC|sinfgapp::Action::CATEGORY_VALUENODE);
+               add_actions_to_menu(&parammenu, param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
        else
-               add_actions_to_menu(&parammenu, param_list2,param_list,sinfgapp::Action::CATEGORY_VALUEDESC|sinfgapp::Action::CATEGORY_VALUENODE);
+               add_actions_to_menu(&parammenu, param_list2,param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
 
        if(value_desc.get_value_type()==ValueBase::TYPE_BLINEPOINT && value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
        {
-               value_desc=sinfgapp::ValueDesc(ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()),0);
+               value_desc=synfigapp::ValueDesc(ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()),0);
        }
 
        if(value_desc.is_value_node() && ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node()))
        {
                ValueNode_Animated::Handle value_node(ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node()));
-               
+
                try
                {
                        WaypointList::iterator iter(value_node->find(canvas->get_time()));
@@ -1021,9 +1044,9 @@ Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas, sinfgapp
 }
 
 void
-edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<sinfgapp::ValueDesc> value_desc_list)
+edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<synfigapp::ValueDesc> value_desc_list)
 {
-       etl::handle<sinfgapp::CanvasInterface> canvas_interface(canvas_view->canvas_interface());
+       etl::handle<synfigapp::CanvasInterface> canvas_interface(canvas_view->canvas_interface());
 
        Gtk::Dialog dialog(
                "Edit Multiple Waypoints",              // Title
@@ -1035,28 +1058,28 @@ edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<sinfgapp::
        widget_waypoint_model.show();
 
        dialog.get_vbox()->pack_start(widget_waypoint_model);
-       
-       
+
+
        dialog.add_button(Gtk::StockID("gtk-apply"),1);
        dialog.add_button(Gtk::StockID("gtk-cancel"),0);
        dialog.show();
-       
+
        DEBUGPOINT();
        if(dialog.run()==0 || widget_waypoint_model.get_waypoint_model().is_trivial())
                return;
        DEBUGPOINT();
-       sinfgapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Set Waypoints"));
+       synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Set Waypoints"));
 
-       std::list<sinfgapp::ValueDesc>::iterator iter;
+       std::list<synfigapp::ValueDesc>::iterator iter;
        for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
        {
-               sinfgapp::ValueDesc value_desc(*iter);
-               
+               synfigapp::ValueDesc value_desc(*iter);
+
                if(!value_desc.is_valid())
                        continue;
 
                ValueNode_Animated::Handle value_node;
-               
+
                // If this value isn't a ValueNode_Animated, but
                // it is somewhat constant, then go ahead and convert
                // it to a ValueNode_Animated.
@@ -1067,28 +1090,28 @@ edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<sinfgapp::
                                value=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node())->get_value();
                        else
                                value=value_desc.get_value();
-                       
+
                        value_node=ValueNode_Animated::create(value,canvas_interface->get_time());
-                       
-                       sinfgapp::Action::Handle action;
-                       
+
+                       synfigapp::Action::Handle action;
+
                        if(!value_desc.is_value_node())
                        {
-                               action=sinfgapp::Action::create("value_desc_connect");
+                               action=synfigapp::Action::create("value_desc_connect");
                                action->set_param("dest",value_desc);
                                action->set_param("src",ValueNode::Handle(value_node));
                        }
                        else
                        {
-                               action=sinfgapp::Action::create("value_node_replace");
+                               action=synfigapp::Action::create("value_node_replace");
                                action->set_param("dest",value_desc.get_value_node());
                                action->set_param("src",ValueNode::Handle(value_node));
                        }
-                       
+
                        action->set_param("canvas",canvas_view->get_canvas());
                        action->set_param("canvas_interface",canvas_interface);
-                       
-       
+
+
                        if(!canvas_interface->get_instance()->perform_action(action))
                        {
                                canvas_view->get_ui_interface()->error(_("Unable to convert to animated waypoint"));
@@ -1101,12 +1124,12 @@ edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<sinfgapp::
                        if(value_desc.is_value_node())
                                value_node=ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node());
                }
-               
-               
+
+
                if(value_node)
                {
-                       
-                       sinfgapp::Action::Handle action(sinfgapp::Action::create("waypoint_set_smart"));
+
+                       synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set_smart"));
 
                        if(!action)
                        {
@@ -1114,14 +1137,14 @@ edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<sinfgapp::
                                group.cancel();
                                return;
                        }
-                               
+
 
                        action->set_param("canvas",canvas_view->get_canvas());
-                       action->set_param("canvas_interface",canvas_interface);                 
-                       action->set_param("value_node",ValueNode::Handle(value_node));                  
-                       action->set_param("time",canvas_interface->get_time());                                         
+                       action->set_param("canvas_interface",canvas_interface);
+                       action->set_param("value_node",ValueNode::Handle(value_node));
+                       action->set_param("time",canvas_interface->get_time());
                        action->set_param("model",widget_waypoint_model.get_waypoint_model());
-               
+
                        if(!canvas_interface->get_instance()->perform_action(action))
                        {
                                canvas_view->get_ui_interface()->error(_("Unable to set a specific waypoint"));
@@ -1135,19 +1158,19 @@ edit_several_waypoints(etl::handle<CanvasView> canvas_view, std::list<sinfgapp::
                        //group.cancel();
                        //return;
                }
-                       
+
        }
 }
 
 void
-Instance::make_param_menu(Gtk::Menu *menu,sinfg::Canvas::Handle canvas,const std::list<sinfgapp::ValueDesc>& value_desc_list)
+Instance::make_param_menu(Gtk::Menu *menu,synfig::Canvas::Handle canvas,const std::list<synfigapp::ValueDesc>& value_desc_list)
 {
-       etl::handle<sinfgapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
+       etl::handle<synfigapp::CanvasInterface> canvas_interface(find_canvas_interface(canvas));
 
-       sinfgapp::Action::ParamList param_list;
+       synfigapp::Action::ParamList param_list;
        param_list=canvas_interface->generate_param_list(value_desc_list);
 
-       add_actions_to_menu(menu, param_list,sinfgapp::Action::CATEGORY_VALUEDESC|sinfgapp::Action::CATEGORY_VALUENODE);
+       add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
 
        // Add the edit waypoints option if that might be useful
        if(canvas->rend_desc().get_time_end()-Time::epsilon()>canvas->rend_desc().get_time_start())