Example #1
0
bool
Action::System::redo_(etl::handle<UIInterface> uim)
{
	handle<Action::Undoable> action(redo_action_stack().front());
	most_recent_action_name_=action->get_name();

	try { if(action->is_active()) action->perform(); }
	catch(Action::Error err)
	{
		if(err.get_type()!=Action::Error::TYPE_UNABLE)
		{
			if(err.get_desc().empty())
				uim->error(action->get_local_name()+_(" (Redo): ")+strprintf("%d",err.get_type()));
			else
				uim->error(action->get_local_name()+_(" (Redo): ")+err.get_desc());
		}

		return false;
	}
	catch(std::runtime_error x)
	{
		uim->error(x.what());
		return false;
	}
	catch(...)
	{
		return false;
	}

	inc_action_count();

	if(undo_action_stack_.empty())	signal_undo_status()(true);

	undo_action_stack_.push_front(redo_action_stack_.front());
	redo_action_stack_.pop_front();

	if(redo_action_stack_.empty())	signal_redo_status()(false);

	if(!group_stack_.empty())
		group_stack_.front()->inc_depth();

	signal_redo_();

	return true;
}