本文整理汇总了C++中CAction::Prepare2方法的典型用法代码示例。如果您正苦于以下问题:C++ CAction::Prepare2方法的具体用法?C++ CAction::Prepare2怎么用?C++ CAction::Prepare2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAction
的用法示例。
在下文中一共展示了CAction::Prepare2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PerformAction
//.........这里部分代码省略.........
}
}
o->m_groupObjects.RemoveAll();
{ // this allows us to remove the group type and the group object - davo
// CUndo* temp = m_undo;
// m_undo = 0;
//DeleteObject(gid);
// m_undo = temp;
}*/
g_pLayerBar->m_layerDlg.RefreshLayers();
break;
case ACTION_GROUPOPEN:
*ar >> id >> b;
o = GetObject(id);
// START UNDO INFO //
actionNew->m_type = ACTION_GROUPOPEN;
tid = o->GetInstanceID();
tb = !b;
*arNew << tid << tb;
// END UNDO INFO //
o->m_bGroupOpen = b;
g_pLayerBar->m_layerDlg.RefreshLayers();
break;
case ACTION_GROUPREMOVE:
*ar >> gid >> oid >> objLayer >> prevObj;
// START UNDO INFO //
actionNew->m_type = ACTION_GROUPADD;
*arNew << gid << oid;
// END UNDO INFO //
o = GetObject(oid);
o2 = GetObject(gid);
o->m_groupObjects.RemoveAt(o->m_groupObjects.Find(oid));
o->UpdateGroupInfo(FALSE);
o2->m_bInGroup = FALSE;
o2->m_group = NULL;
for (i = 0; i < layout->layers.GetCount(); i++) {
lyr = layout->layers.GetNext(pos);
if (lyr->m_layerID == objLayer) {
lyr->m_zOrder.InsertAfter(lyr->m_zOrder.FindIndex(prevObj), oid);
break;
}
}
g_pLayerBar->m_layerDlg.RefreshLayers();
break;
case ACTION_GROUPADD:
*ar >> gid >> oid;
o = GetObject(oid);
o2 = GetObject(gid);
o->m_bInGroup = TRUE;
o->m_group = o2;
lyr = GetObjectLayer(oid);
if(!lyr)
{
CErrorDlg Error;
Error.Error("Error", "Unable to work out what layer the object is on in ACTION_GROUPADD, please report this to scirra");
return 0;
}
pos = lyr->m_zOrder.Find(oid);
prevObj = lyr->m_zOrder.GetPrev(pos);
// START UNDO INFO //
actionNew->m_type = ACTION_GROUPREMOVE;
*arNew << gid << oid << lyr->m_layerID << prevObj;
// END UNDO INFO //
lyr->m_zOrder.RemoveAt(lyr->m_zOrder.Find(oid));
o->m_group->m_groupObjects.AddTail(oid);
g_pLayerBar->m_layerDlg.RefreshLayers();
break;
}
action->Unprepare2();
actionNew->Prepare2();
if(action == 0)
{
int a = 0;
a --;
}
if(actionNew == 0)
{
int a = 0;
a--;
}
return actionNew;
}
示例2: OnLayerDel
void CLayerDlg::OnLayerDel()
{
if(!m_layerListBox.layout_editor)
return;
if(m_layerListBox.GetCurSel() == -1)
return;
CLayer *layer = (CLayer*)m_layerListBox.GetItemDataPtr(m_layerListBox.GetCurSel());
if (layer->m_layerType == LAYER_NONFRAME) return;
if (m_layerListBox.layout_editor->layout->layers.GetCount() == 2)
{
CErrorDlg error;
error.Error("Error removing layer", "You can't remove the last layer.");
return;
}
bool do_delete = false;
if (layer)
{
CExtMsgBox msg(NULL, CONF_DELETE, CONFIRMATION, __EXT_MB_YESNO | __EXT_MB_ICONINFORMATION | __EXT_MB_DO_NOT_ASK_AGAIN, 0, "DeleteLayer", __EXT_MB_EX_CHECK_BOX_IS_NOT_CHECKED_INTIALLY);
int result = msg.DoModal();
if (result == IDYES)
do_delete = true;
else
msg.ResetMsgBox();
}
if (do_delete)
{
POSITION pos = layer->m_zOrder.GetHeadPosition();
vector<long> deletelist;
for (int i = 0; i < layer->m_zOrder.GetCount(); i++) {
deletelist.push_back(layer->m_zOrder.GetNext(pos));
}
for(int i = 0; i < deletelist.size(); i++)
{
m_layerListBox.layout_editor->DeleteObject(deletelist.at(i), TRUE);
}
// START UNDO INFO //
CAction *action = new CAction();
action->m_type = ACTION_CHANGEZORDER;
CArchive *ar = action->Prepare1();
m_layerListBox.layout_editor->SerializeAllZLists(ar);
action->Prepare2();
m_layerListBox.layout_editor->m_undo->AddAction(action);
// END UNDO INFO //
m_layerListBox.layout_editor->layout->layers.RemoveAt(m_layerListBox.layout_editor->layout->layers.Find(layer));
m_layerListBox.DeleteString(m_layerListBox.GetCurSel());
m_layerListBox.SetCurSel(0);
OnSelchange();
g_PropertyBar->Update(layout_editor, TYPE_LAYER, NULL, NULL,NULL, layout_editor->application, 0, layout_editor->layout->layers.GetAt(layout_editor->layout->layers.GetTailPosition())); // update the property editor
m_layerListBox.layout_editor->Invalidate();
CChildFrame* pCF = (CChildFrame*)m_layerListBox.layout_editor->GetParentFrame();
pCF->object_bar.Refresh();
layout_editor->layout->SetChanged(true);
}
}