Beispiel #1
0
// Starts a refresh of an item.
// If the physical item has been deleted,
// updates selection, zoom and working item accordingly.
//
void CDirstatDoc::RefreshItem(CItem *item)
{
    ASSERT(item != NULL);

    CWaitCursor wc;

    ClearReselectChildStack();

    if(item->IsAncestorOf(GetZoomItem()))
    {
        SetZoomItem(item);
    }

    // FIXME: Multi-select
    if(item->IsAncestorOf(GetSelection(0)))
    {
        SetSelection(item);
        UpdateAllViews(NULL, HINT_SELECTIONCHANGED);
    }

    SetWorkingItemAncestor(item);

    CItem *parent = item->GetParent();

    if(!item->StartRefresh())
    {
        if(GetZoomItem() == item)
        {
            SetZoomItem(parent);
        }
        // FIXME: Multi-select
        if(GetSelection(0) == item)
        {
            SetSelection(parent);
            UpdateAllViews(NULL, HINT_SELECTIONCHANGED);
        }
        if(m_workingItem == item)
        {
            SetWorkingItem(parent);
        }
    }

    UpdateAllViews(NULL);
}
void CDirstatDoc::OnTreemapZoomin()
{
	CItem *p= GetSelection();
	CItem *z= NULL;
	while (p != GetZoomItem())
	{
		z= p;
		p= p->GetParent();
	}
	ASSERT(z != NULL);
	SetZoomItem(z);
}
void CDirstatDoc::SetSelection(const CItem *item, bool keepReselectChildStack)
{
	CItem *newzoom= CItem::FindCommonAncestor(m_zoomItem, item);
	if (newzoom != m_zoomItem)
		SetZoomItem(newzoom);

	bool keep= keepReselectChildStack || m_selectedItem == item;

	m_selectedItem= const_cast<CItem *>(item);
	GetMainFrame()->SetSelectionMessageText();

	if (!keep)
		ClearReselectChildStack();
}
void CDirstatDoc::OnTreemapZoomout()
{
	SetZoomItem(GetZoomItem()->GetParent());
}