@@ -11,6 +11,8 @@ typedef CTypedPtrMap <CMapStringToPtr, CString, CObject*> CObjectMap;
11
11
12
12
typedef int (* t_CompareObjects) (const int iColumn, const CObject * item1, const CObject * item2);
13
13
14
+ #define ID_TREEVIEW (WM_USER + 1004 )
15
+
14
16
typedef struct t_gen_sort_param
15
17
{
16
18
// initialise via constructor - makes sure we don't leave something out!
@@ -61,6 +63,7 @@ class CGenPropertyPage : public CPropertyPage
61
63
CFindInfo * m_pObjectFindInfo; // the findinfo structure
62
64
CListCtrl * m_ctlList; // the list control which displays the items
63
65
CStatic * m_ctlSummary; // count of items shown
66
+ bool m_bWantTreeControl; // true if it wants to show a tree control instead of a list control
64
67
65
68
// count of columns is used for arrays below
66
69
int m_iColumnCount; // how many columns there are
@@ -76,27 +79,39 @@ class CGenPropertyPage : public CPropertyPage
76
79
BOOL m_reverse; // if true, reverse sort
77
80
t_CompareObjects m_CompareObjects; // for comparing when sorting
78
81
82
+ CTreeCtrl m_cTreeCtrl; // for the tree views
83
+ map<CString, HTREEITEM> m_GroupsMap; // for inserting into groups
84
+
79
85
// set up variables for use later on
80
86
81
- void CGenPropertyPage::SetUpPage (CString strObjectType,
82
- CObjectMap * ObjectMap,
83
- CListCtrl * ctlList,
84
- CStatic * ctlSummary,
85
- t_CompareObjects CompareObjects,
86
- CFindInfo * pFindInfo,
87
- const unsigned long iMask);
87
+ void CGenPropertyPage::SetUpPage (CString strObjectType,
88
+ CObjectMap * ObjectMap,
89
+ CListCtrl * ctlList,
90
+ CStatic * ctlSummary,
91
+ t_CompareObjects CompareObjects,
92
+ CFindInfo * pFindInfo,
93
+ const unsigned long iMask,
94
+ const bool bWantTreeControl);
88
95
89
96
// add an new item
90
97
91
98
void OnAddItem (CDialog & dlg); // adds a new item to the list
92
99
void OnChangeItem (CDialog & dlg); // changes an existing item
100
+ bool ChangeOneItem (CDialog & dlg, CString * pstrObjectName, const int nItem, HTREEITEM hdlItem); // changes one existing item
101
+ bool DeleteOneItem (CString * pstrObjectName, int & iIncluded, int & iExecuting); // deletes one existing item
93
102
void OnDeleteItem () ; // delete an item from the list
94
103
void OnCopyItem () ; // copy an item to the clipboard in XML
104
+ bool CopyOneItem (CString * pstrObjectName, CArchive & ar) ; // copy an item to the clipboard in XML
95
105
void OnPasteItem () ; // paste an item from the clipboard in XML
96
106
void OnColumnclickItemList (NMHDR* pNMHDR, LRESULT* pResult);
97
107
void LoadList (void ); // load up list initially or after load from file
98
108
bool EditFilterText (CString & sText ); // edit the filter text
99
-
109
+ void SortItems (void ); // sort the tree/list control
110
+ int GetSelectedItemCount () const ; // how many items are selected?
111
+ int GetItemCount () const ; // how many items are there in the list/tree?
112
+ void CheckParentHasChildren (HTREEITEM hdlParent); // if this group is empty, delete it
113
+
114
+
100
115
// ================== start of virtual functions =======================
101
116
102
117
// dialog management - initialise, load, unload, check if changed, get name
@@ -121,6 +136,10 @@ void CGenPropertyPage::SetUpPage (CString strObjectType,
121
136
virtual __int64 GetModificationNumber (CObject * pItem) const = 0; // get modification number
122
137
virtual CString GetScriptName (CObject * pItem) const = 0; // get script subroutine name
123
138
virtual CString GetLabel (CObject * pItem) const = 0; // get item label
139
+ virtual CString GetGroup (CObject * pItem) const = 0; // get item group
140
+ virtual CString GetDescription (CObject * pItem) const = 0; // get item description for tree control
141
+ virtual int GetSequence (CObject * pItem) const = 0; // get item sequence for sorting
142
+ virtual CString GetFindText (CObject * pItem) const = 0; // get text for searching on
124
143
125
144
// list management - add the item to the list control
126
145
virtual int AddItem (CObject * pItem, // add one item to the list control
@@ -139,12 +158,18 @@ void CGenPropertyPage::SetUpPage (CString strObjectType,
139
158
140
159
// ================== end of virtual functions =======================
141
160
142
- // add a single item - returns new item number
161
+ // add a single list control item - returns new item number
162
+
163
+ int add_list_item (CObject * pItem,
164
+ const CString * pstrObjectName,
165
+ const int nItem,
166
+ const BOOL bInsert);
167
+
168
+ // add a single tree control item - returns new item number
169
+
170
+ HTREEITEM add_tree_item (CObject * pItem,
171
+ const CString * pstrObjectName);
143
172
144
- int add_item (CObject * pItem,
145
- const CString * pstrObjectName,
146
- const int nItem,
147
- const BOOL bInsert);
148
173
149
174
// Overrides
150
175
// ClassWizard generate virtual function overrides
@@ -173,12 +198,20 @@ void CGenPropertyPage::SetUpPage (CString strObjectType,
173
198
174
199
// for finding
175
200
201
+ // finds item n in the tree control
202
+ static HTREEITEM get_tree_item (CTreeCtrl * pTree, const int n);
203
+
176
204
static void InitiateSearch (const CObject * pObject,
177
205
CFindInfo & FindInfo);
178
206
179
- static bool GetNextLine (const CObject * pObject,
180
- CFindInfo & FindInfo,
181
- CString & strLine);
207
+ static bool GetNextListLine (const CObject * pObject,
208
+ CFindInfo & FindInfo,
209
+ CString & strLine);
210
+
211
+
212
+ static bool GetNextTreeLine (const CObject * pObject,
213
+ CFindInfo & FindInfo,
214
+ CString & strLine);
182
215
183
216
void DoFind (bool bAgain);
184
217
0 commit comments