当前位置: 首页>>代码示例>>C++>>正文


C++ handle::get_local_name方法代码示例

本文整理汇总了C++中etl::handle::get_local_name方法的典型用法代码示例。如果您正苦于以下问题:C++ handle::get_local_name方法的具体用法?C++ handle::get_local_name怎么用?C++ handle::get_local_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在etl::handle的用法示例。


在下文中一共展示了handle::get_local_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool /*is_active*/, bool is_undo, bool is_redo)
{
	assert(action);

	row[model.action] = action;
	row[model.name] = static_cast<Glib::ustring>(action->get_local_name());
	row[model.is_active] = action->is_active();
	row[model.is_undo] = is_undo;
	row[model.is_redo] = is_redo;

	synfigapp::Action::CanvasSpecific *specific_action;
	specific_action=dynamic_cast<synfigapp::Action::CanvasSpecific*>(action.get());
	if(specific_action)
	{
		row[model.canvas] = specific_action->get_canvas();
		row[model.canvas_id] = specific_action->get_canvas()->get_id();
	}

	etl::handle<synfigapp::Action::Group> group;
	group=etl::handle<synfigapp::Action::Group>::cast_dynamic(action);
	if(group)
	{
		synfigapp::Action::ActionList::const_iterator iter;
		for(iter=group->action_list().begin();iter!=group->action_list().end();++iter)
		{
			Gtk::TreeRow child_row = *(append(row.children()));
			insert_action(child_row,*iter,true,is_undo,is_redo);
		}
	}

	//row[model.icon] = Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
}
开发者ID:Permutatrix,项目名称:synfig,代码行数:33,代码来源:historytreestore.cpp

示例2: canvas_specific

bool
Action::System::perform_action(etl::handle<Action::Base> action)
{
	if (getenv("SYNFIG_DEBUG_ACTIONS"))
		synfig::info("%s:%d perform_action: '%s'", __FILE__, __LINE__, action->get_name().c_str());

	handle<UIInterface> uim(get_ui_interface());

	assert(action);

	if(!action->is_ready())
	{
		uim->error(action->get_local_name()+": "+_("Action is not ready."));
		return false;
	}

	most_recent_action_name_=action->get_name();

	static bool inuse=false;

	if(inuse) return false;

	inuse=true;
	try {

	assert(action);

	Action::CanvasSpecific* canvas_specific(dynamic_cast<Action::CanvasSpecific*>(action.get()));

	if(canvas_specific && canvas_specific->get_canvas())
	{
		handle<CanvasInterface> canvas_interface=static_cast<Instance*>(this)->find_canvas_interface(canvas_specific->get_canvas());
		assert(canvas_interface);
		uim=canvas_interface->get_ui_interface();
	}

	handle<Action::Undoable> undoable_action=handle<Action::Undoable>::cast_dynamic(action);

	// If we cannot undo this action, make sure
	// that the user knows this.
	if(!undoable_action)
	{
		if(uim->yes_no(
			action->get_local_name(),
			_("This action cannot be undone! Are you sure you want to continue?"),
			UIInterface::RESPONSE_NO
			) == UIInterface::RESPONSE_NO
		)
			return false;
		else
		{
			// Because this action cannot be undone,
			// we need to clear the undo stack
			clear_undo_stack();
		}
	}
	else
		assert(undoable_action->is_active());

	// Perform the action
	try { action->perform(); }
	catch(Action::Error err)
	{
		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_local_name()+": "+strprintf("%d",err.get_type()));
			else
				uim->error(action->get_local_name()+": "+err.get_desc());
		}

		// If action failed for whatever reason, just return false and do
		// not add the action onto the list
		return false;
	}
	catch(std::exception err)
	{
		uim->task(action->get_local_name()+' '+_("Failed"));
		inuse=false;

		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
		return false;
	}
	catch(...)
	{
		uim->task(action->get_local_name()+' '+_("Failed"));
		inuse=false;

		// If action failed for whatever reason, just return false and do
		// not add the action onto the list
		return false;
	}

	// Clear the redo stack
//.........这里部分代码省略.........
开发者ID:ZurbaXI,项目名称:synfig,代码行数:101,代码来源:action_system.cpp


注:本文中的etl::handle::get_local_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。