本文整理汇总了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);
}
示例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
//.........这里部分代码省略.........