1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "georges_edit.h"
24 #include "georges_edit_doc.h"
25 #include "georges_edit_view.h"
26 #include "left_view.h"
30 using namespace NLGEORGES
;
31 using namespace NLMISC
;
35 // ***************************************************************************
37 // ***************************************************************************
39 IMPLEMENT_DYNCREATE(CLeftView
, CView
)
41 // ***************************************************************************
43 BEGIN_MESSAGE_MAP(CLeftView
, CView
)
44 //{{AFX_MSG_MAP(CLeftView)
47 ON_COMMAND(ID_EDIT_COPY
, OnEditCopy
)
48 ON_COMMAND(ID_EDIT_PASTE
, OnEditPaste
)
49 ON_COMMAND(ID_EDIT_CUT
, OnEditCut
)
50 ON_COMMAND(ID_INSERT
, OnInsert
)
51 ON_COMMAND(ID_DELETE
, OnDelete
)
52 ON_COMMAND(ID_EDIT_REDO
, OnEditRedo
)
53 ON_UPDATE_COMMAND_UI(ID_EDIT_REDO
, OnUpdateEditRedo
)
54 ON_COMMAND(ID_EDIT_UNDO
, OnEditUndo
)
55 ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO
, OnUpdateEditUndo
)
56 ON_COMMAND(ID_EDIT_RENAME
, OnEditRename
)
57 ON_COMMAND(ID_EDIT_FETCH1
, OnEditFetch1
)
58 ON_COMMAND(ID_EDIT_FETCH2
, OnEditFetch2
)
59 ON_COMMAND(ID_EDIT_FETCH3
, OnEditFetch3
)
60 ON_COMMAND(ID_EDIT_FETCH4
, OnEditFetch4
)
61 ON_COMMAND(ID_EDIT_HOLD1
, OnEditHold1
)
62 ON_COMMAND(ID_EDIT_HOLD2
, OnEditHold2
)
63 ON_COMMAND(ID_EDIT_HOLD3
, OnEditHold3
)
64 ON_COMMAND(ID_EDIT_HOLD4
, OnEditHold4
)
66 ON_COMMAND(ID_EDIT_COLLAPSEALL
, OnEditCollapseall
)
67 ON_COMMAND(ID_EDIT_EXPANDALL
, OnEditExpandall
)
71 // ***************************************************************************
72 // CLeftView construction/destruction
73 // ***************************************************************************
75 CLeftView::CLeftView()
79 // ***************************************************************************
81 CLeftView::~CLeftView()
85 // ***************************************************************************
87 BOOL
CLeftView::PreCreateWindow(CREATESTRUCT
& cs
)
89 // TODO: Modify the Window class or styles here by modifying
90 // the CREATESTRUCT cs
92 return CView::PreCreateWindow(cs
);
95 // ***************************************************************************
97 // ***************************************************************************
99 void CLeftView::OnDraw(CDC
* pDC
)
101 CGeorgesEditDoc
* pDoc
= GetDocument();
104 // TODO: add draw code for native data here
107 // ***************************************************************************
109 void CLeftView::getSubObject (CGeorgesEditDocSub
*subObject
, HTREEITEM parent
, HTREEITEM item
)
111 // Is this child exist ?
114 int itemImage
= subObject
->getItemImage (GetDocument());
115 item
= TreeCtrl
.InsertItem(nlUtf8ToTStr(subObject
->getName()), itemImage
, itemImage
, parent
);
119 TreeCtrl
.SetItemText(item
, nlUtf8ToTStr(subObject
->getName()));
122 TreeCtrl
.SetItemData (item
, (DWORD_PTR
)subObject
);
125 HTREEITEM child
= TreeCtrl
.GetChildItem (item
);
126 for (uint i
=0; i
<subObject
->getChildrenCount(); i
++)
128 getSubObject (subObject
->getChild (i
), item
, child
);
132 child
= TreeCtrl
.GetNextSiblingItem (child
);
136 // Remove old children
139 HTREEITEM toDelete
= child
;
140 child
= TreeCtrl
.GetNextSiblingItem (child
);
141 nlverify (TreeCtrl
.DeleteItem (toDelete
));
145 // ***************************************************************************
147 void CLeftView::expand ()
149 if (IsWindow (TreeCtrl
))
151 HTREEITEM item
= TreeCtrl
.GetRootItem ();
154 item
= TreeCtrl
.GetChildItem (item
);
157 item
= TreeCtrl
.GetNextSiblingItem (item
);
164 // ***************************************************************************
166 void CLeftView::expand (HTREEITEM item
)
168 TreeCtrl
.Expand (item
, TVE_EXPAND
);
170 HTREEITEM child
= TreeCtrl
.GetChildItem (item
);
174 child
= TreeCtrl
.GetNextSiblingItem (child
);
178 // ***************************************************************************
180 void CLeftView::collapse (HTREEITEM item
)
182 TreeCtrl
.Expand (item
, TVE_COLLAPSE
);
184 HTREEITEM child
= TreeCtrl
.GetChildItem (item
);
188 child
= TreeCtrl
.GetNextSiblingItem (child
);
192 // ***************************************************************************
194 void CLeftView::OnInitialUpdate()
196 CView::OnInitialUpdate();
200 GetClientRect (&rect
);
201 TreeCtrl
.Create (TVS_EDITLABELS
|TVS_HASLINES
|TVS_LINESATROOT
|TVS_HASBUTTONS
|WS_VISIBLE
|WS_CHILD
, rect
, this, 0);
202 TreeCtrl
.SetImageList( &(theApp
.ImageList
.ImageList
), TVSIL_NORMAL
);
205 if (theApp
.StartExpanded
)
208 HTREEITEM child
= TreeCtrl
.GetChildItem (TreeCtrl
.GetRootItem ());
211 child
= TreeCtrl
.GetNextItem (child
, TVGN_NEXT
);
214 if (TreeCtrl
.GetSelectedItem ())
215 TreeCtrl
.SetItemState(TreeCtrl
.GetSelectedItem (), 0, TVIS_BOLD
);
216 TreeCtrl
.Select (child
, TVGN_CARET
);
217 TreeCtrl
.SetItemState(child
, TVIS_BOLD
, TVIS_BOLD
);
222 // ***************************************************************************
223 // CLeftView diagnostics
224 // ***************************************************************************
227 void CLeftView::AssertValid() const
229 CView::AssertValid();
232 // ***************************************************************************
234 void CLeftView::Dump(CDumpContext
& dc
) const
239 // ***************************************************************************
241 CGeorgesEditDoc
* CLeftView::GetDocument() // non-debug version is inline
243 ASSERT(m_pDocument
->IsKindOf(RUNTIME_CLASS(CGeorgesEditDocType
)) ||
244 m_pDocument
->IsKindOf(RUNTIME_CLASS(CGeorgesEditDocDfn
)) ||
245 m_pDocument
->IsKindOf(RUNTIME_CLASS(CGeorgesEditDocForm
)));
246 return (CGeorgesEditDoc
*)m_pDocument
;
250 // ***************************************************************************
251 // CLeftView message handlers
252 // ***************************************************************************
254 BOOL
CLeftView::OnNotify(WPARAM wParam
, LPARAM lParam
, LRESULT
* pResult
)
256 // Selection change ?
257 NMHDR
*pnmh
= (LPNMHDR
) lParam
;
260 case TVN_BEGINLABELEDIT
:
262 // Get tree selection
263 LPNMTVDISPINFO ptvdi
= (LPNMTVDISPINFO
) lParam
;
264 if (ptvdi
->item
.hItem
)
266 // Get the sub object
267 CGeorgesEditDocSub
*subObject
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (ptvdi
->item
.hItem
);
271 if (subObject
->isEditable ())
273 // Get some information about the current node
274 bool deleteInsert
= false;
277 CGeorgesEditDocSub
*parent
= subObject
->getParent ();
278 if (parent
&& parent
->getType () == CGeorgesEditDocSub::Form
)
280 // Does the node in the same form ?
281 CGeorgesEditDoc
*doc
= GetDocument ();
284 // Get the parent node
285 const CFormDfn
*parentDfn
;
287 const CFormDfn
*nodeDfn
;
288 const CType
*nodeType
;
289 CFormElm
*parentNode
;
290 UFormDfn::TEntryType type
;
292 bool parentVDfnArray
;
293 CForm
*form
=doc
->getFormPtr ();
294 CFormElm
*elm
= (CFormElm
*)doc
->getRootNode (subObject
->getSlot ());
295 nlverify ( elm
->getNodeByName (parent
->getFormName (), &parentDfn
, indexDfn
,
296 &nodeDfn
, &nodeType
, &parentNode
, type
, array
, parentVDfnArray
, true, NLGEORGES_FIRST_ROUND
) );
298 // Is a non empty array ?
299 if (array
&& parentNode
)
314 case TVN_ENDLABELEDIT
:
316 // Get tree selection
317 LPNMTVDISPINFO ptvdi
= (LPNMTVDISPINFO
) lParam
;
318 if (ptvdi
->item
.hItem
)
320 // Get the sub object
321 CGeorgesEditDocSub
*subObject
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (ptvdi
->item
.hItem
);
325 if (subObject
->isEditable ())
327 // Get some information about the current node
328 bool deleteInsert
= false;
331 CGeorgesEditDocSub
*parent
= subObject
->getParent ();
332 if (parent
&& parent
->getType () == CGeorgesEditDocSub::Form
)
334 // Does the node in the same form ?
335 CGeorgesEditDoc
*doc
= GetDocument ();
338 // Get the parent node
339 const CFormDfn
*parentDfn
;
341 const CFormDfn
*nodeDfn
;
342 const CType
*nodeType
;
343 CFormElm
*parentNode
;
344 UFormDfn::TEntryType type
;
346 bool parentVDfnArray
;
347 CForm
*form
=doc
->getFormPtr ();
348 CFormElm
*elm
= (CFormElm
*)doc
->getRootNode (subObject
->getSlot ());
349 nlverify ( elm
->getNodeByName (parent
->getFormName (), &parentDfn
, indexDfn
,
350 &nodeDfn
, &nodeType
, &parentNode
, type
, array
, parentVDfnArray
, true, NLGEORGES_FIRST_ROUND
) );
352 // Is a non empty array ?
353 if (array
&& parentNode
&& (ptvdi
->item
.mask
& TVIF_TEXT
))
355 // Change the node name
356 TreeCtrl
.SetItemText (ptvdi
->item
.hItem
, ptvdi
->item
.pszText
);
357 doc
->modify (new CActionString(IAction::FormArrayRename
, tStrToUtf8(ptvdi
->item
.pszText
).c_str(), *doc
,
358 subObject
->getFormName().c_str(), toString (subObject
->getIdInParent()).c_str(),
359 doc
->getLeftView ()->getCurrentSelectionId (), subObject
->getSlot ()));
373 LPNMTREEVIEW itemData
= (LPNMTREEVIEW
) lParam
;
376 if (itemData
->itemOld
.hItem
)
377 TreeCtrl
.SetItemState(itemData
->itemOld
.hItem
, 0, TVIS_BOLD
);
379 CGeorgesEditDoc
*doc
= GetDocument();
382 CGeorgesEditDocSub
*data
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (itemData
->itemNew
.hItem
);
384 doc
->changeSubSelection (data
, this);
385 TreeCtrl
.SetFocus ();
393 GetCursorPos(&tvhti
.pt
);
394 ::ScreenToClient(TreeCtrl
, &tvhti
.pt
);
395 tvhti
.flags
= LVHT_NOWHERE
;
396 TreeView_HitTest(TreeCtrl
, &tvhti
);
399 if(TVHT_ONITEM
& tvhti
.flags
)
402 if (TreeCtrl
.GetSelectedItem ())
403 TreeCtrl
.SetItemState(TreeCtrl
.GetSelectedItem (), 0, TVIS_BOLD
);
404 TreeCtrl
.SelectItem (tvhti
.hItem
);
405 TreeCtrl
.SetItemState(tvhti
.hItem
, TVIS_BOLD
, TVIS_BOLD
);
407 // Get the sub object
408 CGeorgesEditDocSub
*subObject
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (tvhti
.hItem
);
412 if (subObject
->isEditable ())
414 // Get some information about the current node
415 bool deleteInsert
= false;
418 CGeorgesEditDocSub
*parent
= subObject
->getParent ();
419 if (parent
&& parent
->getType () == CGeorgesEditDocSub::Form
)
421 // Does the node in the same form ?
422 CGeorgesEditDoc
*doc
= GetDocument ();
426 const CFormDfn
*parentDfn
;
428 const CFormDfn
*nodeDfn
;
429 const CType
*nodeType
;
431 UFormDfn::TEntryType type
;
433 bool parentVDfnArray
;
434 CForm
*form
=doc
->getFormPtr ();
435 CFormElm
*elm
= (CFormElm
*)doc
->getRootNode (subObject
->getSlot ());
436 nlverify ( elm
->getNodeByName (parent
->getFormName (), &parentDfn
, indexDfn
,
437 &nodeDfn
, &nodeType
, &node
, type
, array
, parentVDfnArray
, true, NLGEORGES_FIRST_ROUND
) );
439 // Is the parent array ?
440 deleteInsert
= array
;
444 // Show right click menu
448 mainMenu
.LoadMenu (IDR_LEFT_VIEW_CONTEXT
);
449 CMenu
*popup
= mainMenu
.GetSubMenu (0);
451 // Enable disable items
452 popup
->EnableMenuItem (4, MF_BYPOSITION
|(deleteInsert
?MF_ENABLED
:MF_GRAYED
));
453 popup
->EnableMenuItem (5, MF_BYPOSITION
|(deleteInsert
?MF_ENABLED
:MF_GRAYED
));
454 popup
->EnableMenuItem (6, MF_BYPOSITION
|(deleteInsert
?MF_ENABLED
:MF_GRAYED
));
456 ::ClientToScreen(TreeCtrl
, &tvhti
.pt
);
457 popup
->TrackPopupMenu (TPM_LEFTALIGN
| TPM_RIGHTBUTTON
, tvhti
.pt
.x
, tvhti
.pt
.y
, this, NULL
);
465 return CView::OnNotify(wParam
, lParam
, pResult
);
468 // ***************************************************************************
470 void CLeftView::getFromDocument ()
472 CGeorgesEditDoc
*doc
= GetDocument();
473 if (doc
&& IsWindow (TreeCtrl
))
476 //TreeCtrl.Expand (TreeCtrl.GetRootItem (), TVE_EXPAND);
477 getSubObject (&doc
->RootObject
, NULL
, TreeCtrl
.GetRootItem ());
481 // ***************************************************************************
483 void CLeftView::OnUpdate(CView
* pSender
, LPARAM lHint
, CObject
* pHint
)
485 if (IsWindow (TreeCtrl
))
491 // ***************************************************************************
493 void CLeftView::OnSize(UINT nType
, int cx
, int cy
)
495 CView::OnSize(nType
, cx
, cy
);
497 if (IsWindow (TreeCtrl
))
500 GetClientRect (&rect
);
501 TreeCtrl
.SetWindowPos (NULL
, 0, 0, rect
.right
-rect
.left
, rect
.bottom
-rect
.top
, SWP_NOZORDER
|SWP_NOOWNERZORDER
);
505 // ***************************************************************************
507 BOOL
CLeftView::PreTranslateMessage(MSG
* pMsg
)
509 if (theApp
.m_pMainWnd
->PreTranslateMessage(pMsg
))
513 if (pMsg
->message
== WM_KEYDOWN
)
516 if ((int) pMsg
->wParam
== VK_TAB
)
518 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
522 CGeorgesEditView
* pView
= doc
->getRightView ();
523 if (pView
->isFocusable ())
525 doc
->switchToView (pView
);
528 if (GetAsyncKeyState (VK_SHIFT
) & (1<<15))
529 pView
->setFocusLastWidget ();
534 else if ((int) pMsg
->wParam
== VK_INSERT
)
539 else if ((int) pMsg
->wParam
== VK_DELETE
)
546 return CView::PreTranslateMessage(pMsg
);
549 // ***************************************************************************
551 void CLeftView::OnSetFocus(CWnd
* pOldWnd
)
553 CView::OnSetFocus(pOldWnd
);
555 TreeCtrl
.SetFocus ();
558 // ***************************************************************************
560 void CLeftView::OnEditCopy()
562 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
565 // What is selected ?
566 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();
570 CEdit
*edit
= TreeCtrl
.GetEditControl();
573 edit
->SendMessage (WM_COPY
);
578 CGeorgesEditDocSub
*subData
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (item
);
581 // Get thte node type
582 CGeorgesEditDocSub::TSub subType
= subData
->getType ();
584 // Good type for copy ?
585 if (subType
== CGeorgesEditDocSub::Form
)
587 theApp
.SerialIntoMemStream (subData
->getFormName ().c_str(), doc
, subData
->getSlot (), true);
595 // ***************************************************************************
597 void CLeftView::OnEditPaste()
599 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
602 // What is selected ?
603 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();
607 CEdit
*edit
= TreeCtrl
.GetEditControl();
610 edit
->SendMessage (WM_PASTE
);
615 CGeorgesEditDocSub
*subData
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (item
);
618 // Get thte node type
619 CGeorgesEditDocSub::TSub subType
= subData
->getType ();
621 // Good type for copy ?
622 if (subType
== CGeorgesEditDocSub::Form
)
624 // Document is modified by this view
625 if (theApp
.FillMemStreamWithClipboard (subData
->getFormName ().c_str(), doc
, subData
->getSlot ()))
627 doc
->modify (new CActionBuffer (IAction::FormPaste
, theApp
.MemStream
.buffer (), theApp
.MemStream
.length(),
628 *doc
, subData
->getFormName ().c_str(), "", doc
->getLeftView ()->getCurrentSelectionId (), subData
->getSlot ()));
637 // ***************************************************************************
639 CGeorgesEditDocSub
*CLeftView::getSelectedObject ()
641 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();
644 return (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (item
);
649 // ***************************************************************************
651 bool CLeftView::changeSubSelection (CGeorgesEditDocSub
*sub
, HTREEITEM item
)
655 item
= TreeCtrl
.GetRootItem ();
658 if ( (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (item
) == sub
)
661 if (TreeCtrl
.GetSelectedItem ())
662 TreeCtrl
.SetItemState(TreeCtrl
.GetSelectedItem (), 0, TVIS_BOLD
);
663 nlverify (TreeCtrl
.SelectItem (item
));
664 TreeCtrl
.SetItemState(item
, TVIS_BOLD
, TVIS_BOLD
);
669 HTREEITEM child
= TreeCtrl
.GetChildItem (item
);
673 if (changeSubSelection (sub
, child
))
677 child
= TreeCtrl
.GetNextSiblingItem (child
);
680 // Selection not found
684 // ***************************************************************************
686 bool CLeftView::changeSubSelection (uint
&sub
, HTREEITEM item
)
690 item
= TreeCtrl
.GetRootItem ();
696 if (TreeCtrl
.GetSelectedItem ())
697 TreeCtrl
.SetItemState(TreeCtrl
.GetSelectedItem (), 0, TVIS_BOLD
);
698 nlverify (TreeCtrl
.SelectItem (item
));
699 TreeCtrl
.SetItemState(item
, TVIS_BOLD
, TVIS_BOLD
);
704 HTREEITEM child
= TreeCtrl
.GetChildItem (item
);
708 if (changeSubSelection (--sub
, child
))
712 child
= TreeCtrl
.GetNextSiblingItem (child
);
715 // Selection not found
719 // ***************************************************************************
721 uint
CLeftView::getCurrentSelectionId (uint
*count
, HTREEITEM item
)
723 if (IsWindow (TreeCtrl
))
729 item
= TreeCtrl
.GetRootItem ();
739 if (TreeCtrl
.GetSelectedItem () == item
)
745 item
= TreeCtrl
.GetChildItem (item
);
752 if (getCurrentSelectionId (count
, item
) != 0xffffffff)
756 item
= TreeCtrl
.GetNextSiblingItem (item
);
764 // ***************************************************************************
766 bool CLeftView::setCurrentSelectionId (uint id
, HTREEITEM item
)
768 if (IsWindow (TreeCtrl
))
773 item
= TreeCtrl
.GetRootItem ();
780 if (TreeCtrl
.GetSelectedItem ())
781 TreeCtrl
.SetItemState(TreeCtrl
.GetSelectedItem (), 0, TVIS_BOLD
);
782 TreeCtrl
.Select (item
, TVGN_CARET
);
783 TreeCtrl
.SetItemState(item
, TVIS_BOLD
, TVIS_BOLD
);
788 item
= TreeCtrl
.GetChildItem (item
);
795 if (setCurrentSelectionId (id
, item
))
799 item
= TreeCtrl
.GetNextSiblingItem (item
);
807 // ***************************************************************************
809 void CLeftView::OnEditCut()
818 // ***************************************************************************
820 void CLeftView::OnInsert()
822 // Get tree selection
823 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();
826 // Get the sub object
827 CGeorgesEditDocSub
*subObject
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (item
);
831 if (subObject
->isEditable ())
833 // Get some information about the current node
834 bool deleteInsert
= false;
837 CGeorgesEditDocSub
*parent
= subObject
->getParent ();
838 if (parent
&& parent
->getType () == CGeorgesEditDocSub::Form
)
840 // Does the node in the same form ?
841 CGeorgesEditDoc
*doc
= GetDocument ();
844 // Get the parent node
845 const CFormDfn
*parentDfn
;
847 const CFormDfn
*nodeDfn
;
848 const CType
*nodeType
;
849 CFormElm
*parentNode
;
850 UFormDfn::TEntryType type
;
852 bool parentVDfnArray
;
853 CForm
*form
=doc
->getFormPtr ();
854 CFormElm
*elm
= (CFormElm
*)doc
->getRootNode (subObject
->getSlot ());
855 nlverify ( elm
->getNodeByName (parent
->getFormName (), &parentDfn
, indexDfn
,
856 &nodeDfn
, &nodeType
, &parentNode
, type
, array
, parentVDfnArray
, true, NLGEORGES_FIRST_ROUND
) );
858 // Is a non empty array ?
859 if (array
&& parentNode
)
862 doc
->modify (new CActionString (IAction::FormArrayInsert
, toString (subObject
->getIdInParent ()).c_str (),
863 *doc
, subObject
->getFormName ().c_str (), "", doc
->getLeftView ()->getCurrentSelectionId (), subObject
->getSlot ()));
872 // ***************************************************************************
874 void CLeftView::OnDelete()
876 // Get tree selection
877 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();
881 CEdit
*edit
= TreeCtrl
.GetEditControl();
884 edit
->SetWindowText (_T(""));
888 // Get the sub object
889 CGeorgesEditDocSub
*subObject
= (CGeorgesEditDocSub
*)TreeCtrl
.GetItemData (item
);
893 if (subObject
->isEditable ())
895 // Get some information about the current node
896 bool deleteInsert
= false;
899 CGeorgesEditDocSub
*parent
= subObject
->getParent ();
900 if (parent
&& parent
->getType () == CGeorgesEditDocSub::Form
)
902 // Does the node in the same form ?
903 CGeorgesEditDoc
*doc
= GetDocument ();
906 // Get the parent node
907 const CFormDfn
*parentDfn
;
909 const CFormDfn
*nodeDfn
;
910 const CType
*nodeType
;
911 CFormElm
*parentNode
;
912 UFormDfn::TEntryType type
;
914 bool parentVDfnArray
;
915 CForm
*form
=doc
->getFormPtr ();
916 CFormElm
*elm
= (CFormElm
*)doc
->getRootNode (subObject
->getSlot ());
917 nlverify ( elm
->getNodeByName (parent
->getFormName (), &parentDfn
, indexDfn
,
918 &nodeDfn
, &nodeType
, &parentNode
, type
, array
, parentVDfnArray
, true, NLGEORGES_FIRST_ROUND
) );
920 // Is a non empty array ?
921 if (array
&& parentNode
)
924 doc
->modify (new CActionBuffer (IAction::FormArrayDelete
, NULL
, 0, *doc
, subObject
->getFormName ().c_str (),
925 toString (subObject
->getIdInParent ()).c_str (), doc
->getLeftView ()->getCurrentSelectionId (), subObject
->getSlot ()));
935 // ***************************************************************************
938 void CLeftView::OnEditRedo()
940 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
947 void CLeftView::OnUpdateEditRedo(CCmdUI
* pCmdUI
)
949 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
952 doc
->OnUpdateEditRedo(pCmdUI
) ;
956 void CLeftView::OnEditUndo()
958 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
965 void CLeftView::OnUpdateEditUndo(CCmdUI
* pCmdUI
)
967 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
970 doc
->OnUpdateEditUndo(pCmdUI
) ;
974 void CLeftView::OnEditRename()
977 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();
979 TreeCtrl
.EditLabel ( item
);
982 void CLeftView::OnEditFetch1()
984 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
988 ((CGeorgesEditDocForm
*)doc
)->OnEditFetch1();
992 void CLeftView::OnEditFetch2()
994 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
998 ((CGeorgesEditDocForm
*)doc
)->OnEditFetch2();
1002 void CLeftView::OnEditFetch3()
1004 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
1008 ((CGeorgesEditDocForm
*)doc
)->OnEditFetch3();
1012 void CLeftView::OnEditFetch4()
1014 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
1018 ((CGeorgesEditDocForm
*)doc
)->OnEditFetch4();
1022 void CLeftView::OnEditHold1()
1024 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
1028 ((CGeorgesEditDocForm
*)doc
)->OnEditHold1();
1032 void CLeftView::OnEditHold2()
1034 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
1038 ((CGeorgesEditDocForm
*)doc
)->OnEditHold2();
1042 void CLeftView::OnEditHold3()
1044 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
1048 ((CGeorgesEditDocForm
*)doc
)->OnEditHold3();
1052 void CLeftView::OnEditHold4()
1054 CGeorgesEditDoc
*doc
= (CGeorgesEditDoc
*)GetDocument( );
1058 ((CGeorgesEditDocForm
*)doc
)->OnEditHold4();
1062 void CLeftView::OnEditCollapseall()
1065 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();
1070 void CLeftView::OnEditExpandall()
1073 HTREEITEM item
= TreeCtrl
.GetSelectedItem ();