本文整理汇总了C++中CGeorgesEditDoc::getFormPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ CGeorgesEditDoc::getFormPtr方法的具体用法?C++ CGeorgesEditDoc::getFormPtr怎么用?C++ CGeorgesEditDoc::getFormPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGeorgesEditDoc
的用法示例。
在下文中一共展示了CGeorgesEditDoc::getFormPtr方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDelete
void CLeftView::OnDelete()
{
// Get tree selection
HTREEITEM item = TreeCtrl.GetSelectedItem ();
if (item)
{
// Edit the label ?
CEdit *edit = TreeCtrl.GetEditControl();
if (edit)
{
edit->SetWindowText ("");
}
else
{
// Get the sub object
CGeorgesEditDocSub *subObject = (CGeorgesEditDocSub*)TreeCtrl.GetItemData (item);
if (subObject)
{
// Editable ?
if (subObject->isEditable ())
{
// Get some information about the current node
bool deleteInsert = false;
// Is a form child ?
CGeorgesEditDocSub *parent = subObject->getParent ();
if (parent && parent->getType () == CGeorgesEditDocSub::Form)
{
// Does the node in the same form ?
CGeorgesEditDoc *doc = GetDocument ();
if (doc)
{
// Get the parent node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *parentNode;
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a non empty array ?
if (array && parentNode)
{
// Document modified
doc->modify (new CActionBuffer (IAction::FormArrayDelete, NULL, 0, *doc, subObject->getFormName ().c_str (),
toString (subObject->getIdInParent ()).c_str (), doc->getLeftView ()->getCurrentSelectionId (), subObject->getSlot ()));
}
}
}
}
}
}
}
}
示例2: PutText
// ---------------------------------------------------------------------------
void CGeorgesImpl::PutText (const std::string& _sText)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CMainFrame *pWnd = dynamic_cast< CMainFrame* >( theApp.m_pMainWnd );
CChildFrame *pChild = (CChildFrame*)pWnd->MDIGetActive ();
if (pChild == NULL) return;
// Get active document
CGeorgesEditDoc *doc = (CGeorgesEditDoc *)pChild->GetActiveDocument();
if (doc)
{
// Get the left view
CLeftView* pView = doc->getLeftView ();
// Check type
CGeorgesEditDocSub *subDoc = doc->getSelectedObject ();
if (subDoc)
{
// Get the node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *node;
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (subDoc->getSlot ());
nlverify ( elm->getNodeByName (subDoc->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// It is an array ?
if (array&&(type == UFormDfn::EntryType))
{
// Modify the node
doc->modify (new CActionString (IAction::FormTypeValue, _sText.c_str(), *doc, subDoc->getFormName ().c_str (), "",
doc->getLeftView ()->getCurrentSelectionId (), subDoc->getSlot ()));
doc->modify (new CActionString (IAction::FormArrayRename, _sText.c_str(), *doc, subDoc->getFormName ().c_str (),
toString (subDoc->getIdInParent ()).c_str (), doc->getLeftView ()->getCurrentSelectionId (), subDoc->getSlot ()));
doc->updateDocumentStructure ();
doc->UpdateAllViews (pView);
}
else if ((UFormDfn::EntryDfn)&&(!array))
{
// Get the right view
CGeorgesEditView* view = doc->getRightView ();
if (view->FormDialog.WidgetFocused != 0xffffffff)
{
// Set the string
doc->modify (new CActionString (IAction::FormValue, _sText.c_str(), *doc,
view->FormDialog.Widgets[view->FormDialog.WidgetFocused]->getFormName ().c_str (), "",
doc->getLeftView ()->getCurrentSelectionId (), subDoc->getSlot ()));
doc->updateDocumentStructure ();
doc->UpdateAllViews (pView);
}
}
}
}
}
示例3: LineDown
// ---------------------------------------------------------------------------
void CGeorgesImpl::LineDown ()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CMainFrame* pWnd = dynamic_cast< CMainFrame* >( theApp.m_pMainWnd );
CMDIChildWnd *pChild = pWnd->MDIGetActive ();
if (pChild == NULL) return;
// Get active document
CGeorgesEditDoc *doc = (CGeorgesEditDoc *)pChild->GetActiveDocument ();
if (doc)
{
// Get the left view
CLeftView* pView = doc->getLeftView ();
// Check type
CGeorgesEditDocSub *subDoc = doc->getSelectedObject ();
if (subDoc)
{
// Get the node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *node;
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (subDoc->getSlot ());
nlverify ( elm->getNodeByName (subDoc->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a type entry ?
if ( (type == UFormDfn::EntryType) && !array )
{
// Select next
if ((subDoc->getIdInParent ()+1) < subDoc->getParent ()->getChildrenCount ())
doc->changeSubSelection (subDoc->getParent ()->getChild (subDoc->getIdInParent ()+1), pView);
}
}
}
}
示例4: doAction
bool CActionBuffer::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool firstTime)
{
IAction::doAction (doc, redo, modified, firstTime);
modified = false;
bool ok = true;
uint index = (uint)redo;
// Backup old value
switch (_Type)
{
case FormPaste:
{
// Fill memstream with the new buffer
theApp.FillMemStreamWithBuffer (&_Value[index][0], _Value[index].size ());
// Reserial the document
nlverify (theApp.SerialFromMemStream (_FormName.c_str (), &doc, _Slot));
modified = true;
update (true, Redraw, doc, _FormName.c_str ());
}
break;
case FormArrayDelete:
{
if (redo)
{
// Get the parent node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *parentNode;
UFormDfn::TEntryType type;
bool array;
CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (_Slot);
nlverify ( elm->arrayDeleteNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, true, atoi (_UserData.c_str ())) );
modified = true;
}
else
{
// Insert a node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *parentNode;
UFormDfn::TEntryType type;
bool array;
CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (_Slot);
nlverify ( elm->arrayInsertNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, true, atoi (_UserData.c_str ())) );
// Paste the node
// Fill memstream with the new buffer
theApp.FillMemStreamWithBuffer (&_OldValue[0], _OldValue.size ());
// Reserial the document
nlverify (theApp.SerialFromMemStream (_FormName.c_str (), &doc, _Slot));
modified = true;
}
update (true, Redraw, doc, _FormName.c_str ());
}
break;
case FormArraySize:
{
if (redo)
{
// Get the size
int size = 0;
if ( _UserData.empty() || (sscanf (_UserData.c_str(), "%d", &size) == 1) )
{
if (size < 0)
size = 0;
// Array exist ?
if (size > 0)
{
// Get / create the node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *node;
UFormDfn::TEntryType type;
bool array;
bool created;
CForm *form=doc.getFormPtr ();
CFormElm *elm = doc.getRootNode (_Slot);
nlverify ( elm->createNodeByName (_FormName.c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &node, type, array, created) );
nlassert (node);
// Get the array node
CFormElmArray *arrayPtr = safe_cast<CFormElmArray*> (node);
//.........这里部分代码省略.........
示例5: IAction
CActionStringVector::CActionStringVector (IAction::TTypeAction type, const std::vector<std::string> &stringVector, CGeorgesEditDoc &doc, const char *formName, uint selId, uint slot) : IAction (type, selId, slot)
{
// Set the new value
_FormName = formName;
_NewValue = stringVector;
// Backup old value
switch (_Type)
{
case DfnParents:
{
// Dfn
const NLGEORGES::CFormDfn &dfn = *(doc.getDfnPtr ());
// Add the parents
_OldValue.resize (dfn.getNumParent ());
uint parent;
for (parent=0; parent<dfn.getNumParent (); parent++)
{
// Add the label and value
_OldValue[parent] = dfn.getParentFilename (parent);
}
setLabel ("Dfn Parents", doc);
}
break;
case FormParents:
{
// Get the form
const NLGEORGES::CForm &form = *(doc.getFormPtr ());
// Resize old string array
_OldValue.resize (form.getParentCount ());
// For each parent
uint parent;
for (parent=0; parent<form.getParentCount (); parent++)
{
// Get the parent filename
_OldValue[parent] = form.getParentFilename (parent);
}
setLabel ("Form Parents", doc);
}
break;
/* case FormArrayReplace:
case FormArrayAppend:
{
// Get the form
const NLGEORGES::CForm &form = *(doc.getFormPtr ());
// Get the node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *node;
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
CFormElm *elm = doc.getRootNode (slot);
nlverify ( elm->getNodeByName (formName, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true) );
// Get the atom
_OldValue.clear ();
if (node)
{
// Get the atom
CFormElmArray *arrayPtr = safe_cast<CFormElmArray*>(node);
uint size;
nlverify (arrayPtr->getArraySize (size));
_OldValue.resize (size);
uint elm;
for (elm=0; elm<_OldValue.size (); elm++)
{
if (arrayPtr->Elements[elm])
{
CFormElmAtom *atom = safe_cast<CFormElmAtom*>(arrayPtr->Elements[elm]);
atom->getValue (_OldValue[elm], false);
}
}
}
if (_Type == FormArrayReplace)
setLabel ("Form Array Replace", doc);
else
setLabel ("Form Array Append", doc);
}
break;*/
default:
nlstop;
}
}
示例6: OnNotify
BOOL CLeftView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// Selection change ?
NMHDR *pnmh = (LPNMHDR) lParam;
switch (pnmh->code)
{
case TVN_BEGINLABELEDIT:
{
// Get tree selection
LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO) lParam;
if (ptvdi->item.hItem)
{
// Get the sub object
CGeorgesEditDocSub *subObject = (CGeorgesEditDocSub*)TreeCtrl.GetItemData (ptvdi->item.hItem);
if (subObject)
{
// Editable ?
if (subObject->isEditable ())
{
// Get some information about the current node
bool deleteInsert = false;
// Is a form child ?
CGeorgesEditDocSub *parent = subObject->getParent ();
if (parent && parent->getType () == CGeorgesEditDocSub::Form)
{
// Does the node in the same form ?
CGeorgesEditDoc *doc = GetDocument ();
if (doc)
{
// Get the parent node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *parentNode;
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a non empty array ?
if (array && parentNode)
{
// Edit the tree
*pResult = 0;
return TRUE;
}
}
}
}
}
}
*pResult = 1;
return TRUE;
}
break;
case TVN_ENDLABELEDIT:
{
// Get tree selection
LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO) lParam;
if (ptvdi->item.hItem)
{
// Get the sub object
CGeorgesEditDocSub *subObject = (CGeorgesEditDocSub*)TreeCtrl.GetItemData (ptvdi->item.hItem);
if (subObject)
{
// Editable ?
if (subObject->isEditable ())
{
// Get some information about the current node
bool deleteInsert = false;
// Is a form child ?
CGeorgesEditDocSub *parent = subObject->getParent ();
if (parent && parent->getType () == CGeorgesEditDocSub::Form)
{
// Does the node in the same form ?
CGeorgesEditDoc *doc = GetDocument ();
if (doc)
{
// Get the parent node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *parentNode;
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = (CFormElm *)doc->getRootNode (subObject->getSlot ());
nlverify ( elm->getNodeByName (parent->getFormName ().c_str (), &parentDfn, indexDfn,
&nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a non empty array ?
if (array && parentNode && (ptvdi->item.mask & TVIF_TEXT))
//.........这里部分代码省略.........
示例7: PutGroupText
// ---------------------------------------------------------------------------
void CGeorgesImpl::PutGroupText (const std::vector<std::string>& _vText, bool append)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CMainFrame *pWnd = dynamic_cast< CMainFrame* >( theApp.m_pMainWnd );
CChildFrame *pChild = (CChildFrame*)pWnd->MDIGetActive ();
if (pChild == NULL) return;
// Get active document
CGeorgesEditDoc *doc = (CGeorgesEditDoc *)pChild->GetActiveDocument();
if (doc)
{
// Get the left view
CLeftView* pView = doc->getLeftView ();
// Check type
CGeorgesEditDocSub *subDoc = doc->getSelectedObject ();
if (subDoc)
{
// Get the node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *node;
UFormDfn::TEntryType type;
bool array;
bool parentVDfnArray;
CForm *form=doc->getFormPtr ();
CFormElm *elm = doc->getRootNode (subDoc->getSlot ());
nlverify ( elm->getNodeByName (subDoc->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) );
// Is a type entry ?
if ((type == UFormDfn::EntryType) && array)
{
std::string formName = subDoc->getFormName ();
uint slot = subDoc->getSlot ();
// Current node size
uint size = 0;
if (node)
{
CFormElmArray *arrayPtr = safe_cast<CFormElmArray*>(node);
nlverify (arrayPtr->getArraySize (size));
}
// Modify the size of the array
char value[512];
smprintf (value, 512, "%d", _vText.size () + ((append)?size:0));
doc->modify (new CActionBuffer (IAction::FormArraySize, NULL, 0, *doc, formName.c_str (),
value, doc->getLeftView ()->getCurrentSelectionId (), slot));
uint i;
for (i=0; i<_vText.size (); i++)
{
uint index = i + ((append)?size:0);
std::string formNameAtom = formName + "[" + toString (index) + "]";
doc->modify (new CActionString (IAction::FormTypeValue, _vText[i].c_str (), *doc, formNameAtom.c_str (), "",
doc->getLeftView ()->getCurrentSelectionId (), slot));
doc->modify (new CActionString (IAction::FormArrayRename, _vText[i].c_str(), *doc, formNameAtom.c_str (),
toString (index).c_str (), doc->getLeftView ()->getCurrentSelectionId (), slot));
}
}
}
}
}