二十二、批处理命令
E-Form++可视化图形组件库支持批处理命令操作,也就是您可以根据自己的需要任意将E-Form++可视化图形组件库画布上的对象的操作集中起来一次性完成,而在Undo/Redo的时候只需要一次就可以完成。
批处理命令的函数如下:
// Starting action.
void BegAction(const UINT &nActionType = 0,const BOOL
&bUpdateAll = FALSE,
const BOOL &bRemoveAllSelection = TRUE,const BOOL
&bEnablePrepare = FALSE);
// Starting action.
void BegAction(const CString& strComment,const UINT
&nActionType = 0,const BOOL &bUpdateAll = FALSE,
const BOOL &bRemoveAllSelection = TRUE,const BOOL
&bEnablePrepare = FALSE);
// Starting action.
void BegActionExt(const UINT& nIDComment,const UINT
&nActionType = 0,const BOOL &bUpdateAll = FALSE,
const BOOL &bRemoveAllSelection = TRUE,const BOOL
&bEnablePrepare = FALSE);
// Prepare and starting the group action
void BegActionExt(CFODirectActionMacro* pUndoGrp);
// Change action's comment
// strComment -- comment string of the action
void SetUndoComment(const CString& strComment);
// Change action's comment
// nIDComment -- string id for the action
void SetUndoComment(const UINT& nIDComment);
// Add action.
// pAction -- pointer of the action
virtual void AddAction(CFOAction *pAction);
// Add action.
// pAction -- pointer of the action
virtual void AddMacroAction(CFOActionMacro *pAction);
// Add action.
// pList -- list of the actions
virtual void AddMultiActions(CActionList *pList);
// End current macro action.
void EndAction();
调用示范如下:
先调用,BegAction,然后调用
AddAction增加您想要的命令到批处理命令中,最后调用EndAction来确认执行即可:
CFOGroupAction*
xxx::DoMacroAction(CFODrawShapeList* pShapeList)
{
// Prepare actions.
BegActionExt(IDS_CMD_GROUP_SHAPE,(UINT)FOP_EXT_MOVESHAPES_BACK);
CFOAddCompAction *pChildAction = new
CFOAddCompAction(GetCurrentModel(), pReturn);
pChildAction->SetCompShape(pCompNew);
AddAction(pChildAction);
pReturn->Release();
}
}
EndAction();
return NULL;
}
|