MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / ReloadItems

Method ReloadItems

Editor/BaseLibraryDialog.cpp:230–275  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

228
229//////////////////////////////////////////////////////////////////////////
230void CBaseLibraryDialog::ReloadItems()
231{
232 m_bIgnoreSelectionChange = true;
233 m_treeCtrl.SetRedraw(FALSE);
234 m_selectedGroup = "";
235 m_pCurrentItem = 0;
236 m_itemsToTree.clear();
237 m_treeCtrl.DeleteAllItems();
238 m_bIgnoreSelectionChange = false;
239
240 if (!m_pLibrary)
241 {
242 m_treeCtrl.SetRedraw(TRUE);
243 return;
244 }
245
246 m_bIgnoreSelectionChange = true;
247
248 std::map<CString,HTREEITEM> groupMap;
249 //HTREEITEM hLibItem = m_treeCtrl.InsertItem( m_selectedLib,0,0 );
250 HTREEITEM hLibItem = TVI_ROOT;
251 for (int i = 0; i < m_pLibrary->GetItemCount(); i++)
252 {
253 CBaseLibraryItem *pItem = (CBaseLibraryItem*)m_pLibrary->GetItem(i);
254 CString group = pItem->GetGroupName();
255 CString name = pItem->GetShortName();
256
257 HTREEITEM hGroupItem = hLibItem;
258 if (!group.IsEmpty())
259 {
260 hGroupItem = stl::find_in_map( groupMap,group,(HTREEITEM)0 );
261 if (!hGroupItem)
262 {
263 hGroupItem = m_treeCtrl.InsertItem( group,0,1,hLibItem );
264 //m_treeCtrl.Expand( hGroupItem,TVE_EXPAND );
265 groupMap[group] = hGroupItem;
266 }
267 }
268 InsertItemToTree( pItem,hGroupItem );
269 }
270 m_treeCtrl.SortChildren( hLibItem );
271 m_treeCtrl.Expand( hLibItem,TVE_EXPAND );
272 m_treeCtrl.SetRedraw(TRUE);
273
274 m_bIgnoreSelectionChange = false;
275}
276
277//////////////////////////////////////////////////////////////////////////
278HTREEITEM CBaseLibraryDialog::InsertItemToTree( CBaseLibraryItem *pItem,HTREEITEM hParent )

Callers

nothing calls this directly

Calls 10

find_in_mapFunction · 0.85
DeleteAllItemsMethod · 0.80
GetGroupNameMethod · 0.80
GetShortNameMethod · 0.80
clearMethod · 0.45
GetItemCountMethod · 0.45
GetItemMethod · 0.45
IsEmptyMethod · 0.45
InsertItemMethod · 0.45
ExpandMethod · 0.45

Tested by

no test coverage detected