X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Faction_system.cpp;h=7aef9250a8c3e8380dcbd1cbfe3c1f747dfea0ea;hb=4ba22fb51d97f1ecce04dcc5e40569a4354c1bae;hp=54ca6d5414a003017863d469326c376087cb60e1;hpb=c34eaa5441242b3e9a7b7645e9ee4983d14eae85;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/action_system.cpp b/synfig-studio/trunk/src/synfigapp/action_system.cpp index 54ca6d5..7aef925 100644 --- a/synfig-studio/trunk/src/synfigapp/action_system.cpp +++ b/synfig-studio/trunk/src/synfigapp/action_system.cpp @@ -2,7 +2,7 @@ /*! \file action_system.cpp ** \brief Template File ** -** $Id: action_system.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley @@ -33,6 +33,8 @@ #include "instance.h" #include "canvasinterface.h" +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -64,15 +66,18 @@ Action::System::~System() } bool -Action::System::perform_action(handle action) +Action::System::perform_action(etl::handle action) { + //// debug actions + // synfig::info("%s:%d perform_action: '%s'", __FILE__, __LINE__, action->get_name().c_str()); + handle uim(get_ui_interface()); assert(action); if(!action->is_ready()) { - uim->error(action->get_name()+": "+_("Action is not ready.")); + uim->error(action->get_local_name()+": "+_("Action is not ready.")); return false; } @@ -103,7 +108,7 @@ Action::System::perform_action(handle action) if(!undoable_action) { if(uim->yes_no( - action->get_name(), + action->get_local_name(), _("This action cannot be undone! Are you sure you want to continue?"), UIInterface::RESPONSE_NO ) == UIInterface::RESPONSE_NO @@ -123,15 +128,15 @@ Action::System::perform_action(handle action) try { action->perform(); } catch(Action::Error err) { - uim->task(action->get_name()+' '+_("Failed")); + uim->task(action->get_local_name()+' '+_("Failed")); inuse=false; if(err.get_type()!=Action::Error::TYPE_UNABLE) { if(err.get_desc().empty()) - uim->error(action->get_name()+": "+strprintf("%d",err.get_type())); + uim->error(action->get_local_name()+": "+strprintf("%d",err.get_type())); else - uim->error(action->get_name()+": "+err.get_desc()); + uim->error(action->get_local_name()+": "+err.get_desc()); } // If action failed for whatever reason, just return false and do @@ -140,10 +145,10 @@ Action::System::perform_action(handle action) } catch(std::exception err) { - uim->task(action->get_name()+' '+_("Failed")); + uim->task(action->get_local_name()+' '+_("Failed")); inuse=false; - uim->error(action->get_name()+": "+err.what()); + uim->error(action->get_local_name()+": "+err.what()); // If action failed for whatever reason, just return false and do // not add the action onto the list @@ -151,7 +156,7 @@ Action::System::perform_action(handle action) } catch(...) { - uim->task(action->get_name()+' '+_("Failed")); + uim->task(action->get_local_name()+' '+_("Failed")); inuse=false; // If action failed for whatever reason, just return false and do @@ -184,7 +189,7 @@ Action::System::perform_action(handle action) inuse=false; - uim->task(action->get_name()+' '+_("Successful")); + uim->task(action->get_local_name()+' '+_("Successful")); // If the action has "dirtied" the preview, signal it. if(0)if(canvas_specific && canvas_specific->is_dirty()) @@ -196,7 +201,6 @@ Action::System::perform_action(handle action) { handle canvas_interface=static_cast(this)->find_canvas_interface(canvas); assert(canvas_interface); - DEBUGPOINT(); //canvas_interface->signal_dirty_preview()(); } } @@ -207,7 +211,7 @@ Action::System::perform_action(handle action) } bool -synfigapp::Action::System::undo_(handle uim) +synfigapp::Action::System::undo_(etl::handle uim) { handle action(undo_action_stack().front()); most_recent_action_=action; @@ -218,9 +222,9 @@ synfigapp::Action::System::undo_(handle uim) if(err.get_type()!=Action::Error::TYPE_UNABLE) { if(err.get_desc().empty()) - uim->error(action->get_name()+_(" (Undo): ")+strprintf("%d",err.get_type())); + uim->error(action->get_local_name()+_(" (Undo): ")+strprintf("%d",err.get_type())); else - uim->error(action->get_name()+_(" (Undo): ")+err.get_desc()); + uim->error(action->get_local_name()+_(" (Undo): ")+err.get_desc()); } return false; @@ -280,7 +284,7 @@ synfigapp::Action::System::undo() if(!undo_(uim)) { - uim->error(undo_action_stack_.front()->get_name()+": "+_("Failed to undo.")); + uim->error(undo_action_stack_.front()->get_local_name()+": "+_("Failed to undo.")); inuse=false; return false; } @@ -297,7 +301,6 @@ synfigapp::Action::System::undo() { handle canvas_interface=static_cast(this)->find_canvas_interface(canvas); assert(canvas_interface); - //DEBUGPOINT(); //canvas_interface->signal_dirty_preview()(); } } @@ -306,7 +309,7 @@ synfigapp::Action::System::undo() } bool -Action::System::redo_(handle uim) +Action::System::redo_(etl::handle uim) { handle action(redo_action_stack().front()); most_recent_action_=action; @@ -317,9 +320,9 @@ Action::System::redo_(handle uim) if(err.get_type()!=Action::Error::TYPE_UNABLE) { if(err.get_desc().empty()) - uim->error(action->get_name()+_(" (Redo): ")+strprintf("%d",err.get_type())); + uim->error(action->get_local_name()+_(" (Redo): ")+strprintf("%d",err.get_type())); else - uim->error(action->get_name()+_(" (Redo): ")+err.get_desc()); + uim->error(action->get_local_name()+_(" (Redo): ")+err.get_desc()); } return false; @@ -379,7 +382,7 @@ Action::System::redo() if(!redo_(uim)) { - uim->error(redo_action_stack_.front()->get_name()+": "+_("Failed to redo.")); + uim->error(redo_action_stack_.front()->get_local_name()+": "+_("Failed to redo.")); inuse=false; return false; } @@ -396,7 +399,6 @@ Action::System::redo() { handle canvas_interface=static_cast(this)->find_canvas_interface(canvas); assert(canvas_interface); - //DEBUGPOINT(); //canvas_interface->signal_dirty_preview()(); } } @@ -509,7 +511,6 @@ Action::System::set_action_status(etl::handle action, bool x) Canvas::Handle canvas=canvas_specific->get_canvas(); handle canvas_interface=static_cast(this)->find_canvas_interface(canvas); assert(canvas_interface); - //DEBUGPOINT(); //canvas_interface->signal_dirty_preview()(); } @@ -530,7 +531,6 @@ Action::System::set_action_status(etl::handle action, bool x) Canvas::Handle canvas=canvas_specific->get_canvas(); handle canvas_interface=static_cast(this)->find_canvas_interface(canvas); assert(canvas_interface); - DEBUGPOINT(); //canvas_interface->signal_dirty_preview()(); } @@ -540,7 +540,7 @@ Action::System::set_action_status(etl::handle action, bool x) return false; } -Action::PassiveGrouper::PassiveGrouper(etl::loose_handle instance_,synfig::String name_): +Action::PassiveGrouper::PassiveGrouper(etl::loose_handle instance_,synfig::String name_): instance_(instance_), name_(name_), redraw_requested_(false), @@ -551,14 +551,12 @@ Action::PassiveGrouper::PassiveGrouper(etl::loose_handle instanc } void -Action::PassiveGrouper::request_redraw(handle x) +Action::PassiveGrouper::request_redraw(etl::handle x) { -/* DEBUGPOINT(); - if(instance_->group_stack_.empty()) +/* if(instance_->group_stack_.empty()) { if(x!=canvas_interface_) { - DEBUGPOINT(); x->signal_dirty_preview()(); } @@ -566,21 +564,16 @@ Action::PassiveGrouper::request_redraw(handle x) } else { - DEBUGPOINT(); if(instance_->group_stack_.back()==this) { - DEBUGPOINT(); redraw_requested_=true; } else { - DEBUGPOINT(); instance_->group_stack_.back()->request_redraw(x); redraw_requested_=false; } - DEBUGPOINT(); } - DEBUGPOINT(); */ if(x) { @@ -676,7 +669,6 @@ Action::PassiveGrouper::~PassiveGrouper() if(instance_->group_stack_.empty()) { assert(canvas_interface_); - DEBUGPOINT(); canvas_interface_->signal_dirty_preview()(); } else