Show
Ignore:
Timestamp:
08/19/10 23:35:41 (21 months ago)
Author:
Carsten
Message:

CaWE GUI Editor: Rewrote/fixed broken "delete windows" command.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/CaWE/GuiEditor/WindowTree.cpp

    r36 r123  
    281281        wxASSERT(Windows.Size()==1); // Can't set the name property for more windows since it must always be unique. 
    282282 
    283         wxTreeItemId TreeItem=FindTreeItem(GetRootItem(), Windows[0]); 
    284  
    285283        SetItemText(FindTreeItem(GetRootItem(), Windows[0]), Windows[0]->Name); 
    286284    } 
     
    290288        for (unsigned long WindowNr=0; WindowNr<Windows.Size(); WindowNr++) 
    291289        { 
    292             int ImageNr=0; 
    293  
    294             if (!Windows[WindowNr]->ShowWindow) ImageNr=1; 
    295  
    296             SetItemImage(FindTreeItem(GetRootItem(), Windows[WindowNr]), ImageNr); 
     290            SetItemImage(FindTreeItem(GetRootItem(), Windows[WindowNr]), Windows[WindowNr]->ShowWindow ? 0 : 1); 
    297291        } 
    298292    } 
     
    307301    ArrayT<wxTreeItemId>         TreeItems; 
    308302    ArrayT<cf::GuiSys::WindowT*> ExpandedWindows; 
     303 
     304    // Note that this may well produce TreeItems whose windows have been deleted from the document already. 
    309305    GetTreeItems(GetRootItem(), TreeItems); 
    310306 
     
    344340 
    345341            // Make sure parents are also expanded. 
    346             while(GetItemParent(Result).IsOk()) 
     342            while (GetItemParent(Result).IsOk()) 
    347343            { 
    348344                Result=GetItemParent(Result); 
     
    356352    // Expand all previously expanded items. 
    357353    for (unsigned long ExWinNr=0; ExWinNr<ExpandedWindows.Size(); ExWinNr++) 
    358         Expand(FindTreeItem(GetRootItem(), ExpandedWindows[ExWinNr])); 
     354    { 
     355        wxTreeItemId Result=FindTreeItem(GetRootItem(), ExpandedWindows[ExWinNr]); 
     356 
     357        if (Result.IsOk()) 
     358            Expand(Result); 
     359    } 
    359360 
    360361    Thaw();