本文整理汇总了C++中CGeorgesEditDoc::getRootNode方法的典型用法代码示例。如果您正苦于以下问题:C++ CGeorgesEditDoc::getRootNode方法的具体用法?C++ CGeorgesEditDoc::getRootNode怎么用?C++ CGeorgesEditDoc::getRootNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGeorgesEditDoc
的用法示例。
在下文中一共展示了CGeorgesEditDoc::getRootNode方法的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
CActionString::CActionString (IAction::TTypeAction type, const char *newValue, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot) : IAction (type, selId, slot)
{
// Set the new value
_NewValue = newValue;
_FormName = formName;
_Log[1] = newValue;
_UserData = userData;
// Backup old value
switch (_Type)
{
case TypeType:
{
CType *type = doc.getTypePtr ();
_OldValue = toString ((int)(type->Type));
setLabel ("Type Type", doc);
_Log[1] = type->getTypeName ((UType::TType)atoi (newValue));
}
break;
case TypeUI:
{
CType *type = doc.getTypePtr ();
_OldValue = toString ((int)(type->UIType));
setLabel ("Type UI", doc);
_Log[1] = type->getUIName ((CType::TUI)atoi (newValue));
}
break;
case TypeDefault:
{
CType *type = doc.getTypePtr ();
_OldValue = type->Default;
setLabel ("Type Default", doc);
}
break;
case TypeMin:
{
CType *type = doc.getTypePtr ();
_OldValue = type->Min;
setLabel ("Type Min", doc);
}
break;
case TypeMax:
{
CType *type = doc.getTypePtr ();
_OldValue = type->Max;
setLabel ("Type Max", doc);
}
break;
case TypeIncrement:
{
CType *type = doc.getTypePtr ();
_OldValue = type->Increment;
setLabel ("Type Increment", doc);
}
break;
case FormTypeValue:
case FormValue:
{
// Form
const NLGEORGES::CForm &form = *(doc.getFormPtr ());
nlverify (doc.getRootNode (_Slot)->getValueByName (_OldValue, formName, UFormElm::NoEval, NULL));
setLabel (formName, doc);
}
break;
case HeaderVersion:
{
CFileHeader *header = doc.getHeaderPtr ();
char versionText[512];
smprintf (versionText, 512, "Version %d.%d", header->MajorVersion, header->MinorVersion);
_OldValue = versionText;
setLabel ("Header Version", doc);
}
break;
case HeaderState:
{
CFileHeader *header = doc.getHeaderPtr ();
_OldValue = toString ((int)(header->State)).c_str ();
setLabel ("Header State", doc);
}
break;
case HeaderComments:
{
_OldValue = doc.getHeaderPtr ()->Comments;
setLabel ("Header Comments", doc);
}
break;
case FormArrayRename:
{
setLabel ((formName+string (" Renamed")).c_str (), doc);
int idInParent = atoi (_UserData.c_str ());
// Get the parent node
const CFormDfn *parentDfn;
uint indexDfn;
const CFormDfn *nodeDfn;
const CType *nodeType;
CFormElm *node;
UFormDfn::TEntryType type;
bool array;
bool vdfnArray;
//.........这里部分代码省略.........
示例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));
}
}
}
}
}