Example #1
0
void wxGxTreeViewBase::OnObjectDeleted(wxGxCatalogEvent& event)
{
	wxTreeItemId TreeItemId = m_TreeMap[event.GetObjectID()];
	if(TreeItemId.IsOk())
		Delete(TreeItemId);
	m_TreeMap.erase(event.GetObjectID());
}
Example #2
0
void wxGxTreeViewBase::OnObjectRefreshed(wxGxCatalogEvent& event)
{
	wxTreeItemId TreeItemId = m_TreeMap[event.GetObjectID()];
	if(TreeItemId.IsOk())
	{
		wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(TreeItemId);
		if(pData != NULL)
		{
			if(pData->m_bExpandedOnce)
			{
                //deleted via refresh
				//DeleteChildren(TreeItemId);
				pData->m_bExpandedOnce = false;
				Expand(TreeItemId);
			}
            else
            {
                wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
			    wxGxObjectContainer* pGxObjectContainer = dynamic_cast<wxGxObjectContainer*>(pGxObject);
				wxBusyCursor wait;
			    if(pGxObjectContainer && pGxObjectContainer->HasChildren() && !ItemHasChildren(TreeItemId))
                {
                    SetItemHasChildren(TreeItemId);
                }
            }
		}
	}
}
void wxGISToolExecuteView::OnObjectRefreshed(wxGxCatalogEvent& event)
{
    if(m_nParentGxObjectId == event.GetObjectID())
        RefreshAll();

    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
    if(!pGxObject)
        return;
    wxGxObject* pParentGxObject = pGxObject->GetParent();
    if(pParentGxObject && pParentGxObject->GetId() == m_nParentGxObjectId)
    {
        OnObjectChanged(event);
    }
}
void wxGxContentView::OnObjectAdded(wxGxCatalogEvent& event)
{
    //wxLogDebug(wxT("ContentView Object %d Add"), event.GetObjectID());
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
    if(pGxObject)
    {
//        wxLogDebug(wxT("ContentView Object %d '%s' Add"), pGxObject->GetId(), pGxObject->GetFullName());

		const wxGxObject* pParentGxObject = pGxObject->GetParent();
		if(!pParentGxObject)
			return;
	    if(pParentGxObject->GetId() == m_nParentGxObjectID)
        {
		    if(AddObject(pGxObject))
            {
                wxGxAutoRenamer* pGxAutoRenamer = dynamic_cast<wxGxAutoRenamer*>(pGxObject->GetParent());
                if(pGxAutoRenamer && pGxAutoRenamer->IsBeginRename(this, pGxObject->GetPath()))
                {
                    BeginRename(pGxObject->GetId());
                }
                else
                {
                    SORTDATA sortdata = { m_bSortAsc, m_currentSortCol };
                    SortItems(GxObjectCVCompareFunction, (long)&sortdata);
                    SetColumnImage(m_currentSortCol, m_bSortAsc ? 0 : 1);
                }
            }
        }
    }
}
Example #5
0
void wxGxTreeViewBase::OnObjectAdded(wxGxCatalogEvent& event)
{
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
	if(!pGxObject)
		return;
    wxGxObject* pParentObject = pGxObject->GetParent();
	wxTreeItemId ParentTreeItemId = m_TreeMap[pParentObject->GetId()];
	if(ParentTreeItemId.IsOk())
	{
		wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ParentTreeItemId);
		if(pData != NULL)
		{
            wxGxObjectContainer* pGxObjectContainer = wxDynamicCast(pParentObject, wxGxObjectContainer);
            if(pGxObjectContainer->AreChildrenViewable())
            {
			    if(pData->m_bExpandedOnce)
                {
				    AddTreeItem(pGxObject, ParentTreeItemId);
                    SortChildren(ParentTreeItemId);
                }
			    else
                {
				    SetItemHasChildren(ParentTreeItemId, true);
                }
            }
		}
	}
}
void wxGISToolExecuteView::OnObjectDeleted(wxGxCatalogEvent& event)
{
    for(long i = 0; i < GetItemCount(); ++i)
    {
        if(GetItemData(i) == event.GetObjectID())
            DeleteItem(i);
    }
}
void wxGISToolExecuteView::OnObjectAdded(wxGxCatalogEvent& event)
{
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
    if(!pGxObject)
        return;

    wxGxObject* pParentGxObject = pGxObject->GetParent();
    if(pParentGxObject && pParentGxObject->GetId() == m_nParentGxObjectId)
    {
        AddObject(pGxObject);
        SortItems(GxTaskCompareFunction, 0);
    }
}
Example #8
0
void wxGxDiscConnection::OnObjectAdded(wxGxCatalogEvent& event)
{
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
	if(!pGxObject)
		return;
    wxString sPath(pGxObject->GetPath(), wxConvUTF8);
    wxString sConnPath(GetPath(), wxConvUTF8);
    if(sPath.StartsWith(sConnPath))
    {
        if(!IsPathWatched(sPath) && pGxObject->IsKindOf(wxCLASSINFO(wxGxFolder)))
        {
            wxFileName oFileName = wxFileName::DirName(sPath);
            m_pWatcher->Add(oFileName);
        }
    }
}
void wxGxContentView::OnObjectDeleted(wxGxCatalogEvent& event)
{
    //wxLogDebug(wxT("ContentView Object %d Delete"), event.GetObjectID());
    //wxCriticalSectionLocker locker(m_CritSectCont);
	for(long i = 0; i < GetItemCount(); ++i)
	{
		LPITEMDATA pItemData = (LPITEMDATA)GetItemData(i);
		if(pItemData == NULL)
			continue;
		if(pItemData->nObjectID != event.GetObjectID())
			continue;
        SetItemData(i, 0);
		//delete pItemData;
		DeleteItem(i);
		//Refresh();
        //wxListCtrl::Refresh();
    }
}
Example #10
0
void wxGxTreeView::OnObjectAdded(wxGxCatalogEvent& event)
{
    wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
	if(!pGxObject)
		return;
    wxGxObject* pParentObject = pGxObject->GetParent();
	wxTreeItemId ParentTreeItemId = m_TreeMap[pParentObject->GetId()];
	if(ParentTreeItemId.IsOk())
	{
		wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ParentTreeItemId);
		if(pData != NULL)
		{
            wxGxAutoRenamer* pGxAutoRenamer = dynamic_cast<wxGxAutoRenamer*>(pParentObject);
			if(pData->m_bExpandedOnce)
            {
				AddTreeItem(pGxObject, ParentTreeItemId);
                SortChildren(ParentTreeItemId);
                if(pGxAutoRenamer && pGxAutoRenamer->IsBeginRename(this, pGxObject->GetPath()))
                {
                    BeginRename(pGxObject->GetId());
                }
            }
			else
            {
                if(pGxAutoRenamer && pGxAutoRenamer->IsBeginRename(this, pGxObject->GetPath()))
                {
                    Expand(ParentTreeItemId);
				    AddTreeItem(pGxObject, ParentTreeItemId);
                    SortChildren(ParentTreeItemId);
                    BeginRename(pGxObject->GetId());
                }
                else
                {
				    SetItemHasChildren(ParentTreeItemId, true);
                }
            }
		}
	}
}
void wxGxContentView::OnObjectRefreshed(wxGxCatalogEvent& event)
{
    //wxLogDebug(wxT("ContentView Object %d Refresh"), event.GetObjectID());
    if(m_nParentGxObjectID == event.GetObjectID())
        RefreshAll();
}
void wxGxContentView::OnObjectChanged(wxGxCatalogEvent& event)
{
    //wxLogDebug(wxT("ContentView Object %d Change"), event.GetObjectID());
    if(event.GetObjectID() == m_nParentGxObjectID)
	{
        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
		wxGxObjectContainer* pObjectContainer = wxDynamicCast(pGxObject, wxGxObjectContainer);
		if(pObjectContainer != NULL)
		{
			wxBusyCursor wait;
			if(GetItemCount() > 0 && !pObjectContainer->HasChildren())
			{
			    ResetContents();
			}
			else if(GetItemCount() == 0 && pObjectContainer->HasChildren())
			{
				RefreshAll();
				return;
			}
		}
	}

    bool bItemsHaveChanges = false;

	for(long i = 0; i < GetItemCount(); ++i)
	{
		LPITEMDATA pItemData = (LPITEMDATA)GetItemData(i);
		if(pItemData == NULL)
			continue;
		if(pItemData->nObjectID != event.GetObjectID())
			continue;

        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(event.GetObjectID());
		IGxObjectUI* pObjUI =  dynamic_cast<IGxObjectUI*>(pGxObject);
		wxIcon icon_small, icon_large;
		if(pObjUI != NULL)
		{
			icon_small = pObjUI->GetSmallImage();
			icon_large = pObjUI->GetLargeImage();
		}

        bool bChangeIcon = false;
        int pos = GetIconPos(icon_small, icon_large);
        bChangeIcon = pItemData->iImageIndex != pos;
		pItemData->iImageIndex = pos;

		wxString sName;
		if(m_pCatalog->GetShowExt())
			sName = pGxObject->GetName();
		else
			sName = pGxObject->GetBaseName();

		wxString sType = pGxObject->GetCategory();

        if (GetItemText(i, 0) != sName)
        {
		    SetItem(i, 0, sName, pos);
            if (m_currentSortCol == 0)
            {
                bItemsHaveChanges = true;
            }
        }
        else if(bChangeIcon)
        {
            SetItemImage(i, pos);
        }

        if(m_current_style == enumGISCVReport)
	    {
            if (GetItemText(i, 1) != sType)
            {
		        SetItem(i, 1, sType);
                if (m_currentSortCol == 1)
                {
                    bItemsHaveChanges = true;
                }
            }
            IGxDataset* pDSet = dynamic_cast<IGxDataset*>(pGxObject);
            if(pDSet)
            {
                if (pDSet->IsMetadataFilled())
                {
                    if (pDSet->GetSize() > 0)
                        SetItem(i, 2, wxFileName::GetHumanReadableSize(pDSet->GetSize()));
                    if (pDSet->GetModificationDate().IsValid())
                        SetItem(i, 3, pDSet->GetModificationDate().Format());
                }
                else
                {
                    wxCriticalSectionLocker locker(m_CritSectFillMeta);
                    m_anFillMetaIDs.Add(pGxObject->GetId());
                }
            }
	    }
	}

    if(bItemsHaveChanges)
    {
        SORTDATA sortdata = {m_bSortAsc, m_currentSortCol};
	    SortItems(GxObjectCVCompareFunction, (long)&sortdata);
    	SetColumnImage(m_currentSortCol, m_bSortAsc ? 0 : 1);
    }

//	wxListCtrl::Refresh();

}
Example #13
0
void wxGxTreeViewBase::OnObjectChanged(wxGxCatalogEvent& event)
{
	wxTreeItemId TreeItemId = m_TreeMap[event.GetObjectID()];
	if(TreeItemId.IsOk())
	{
		wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(TreeItemId);
		if(pData != NULL)
		{
            wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pData->m_nObjectID);
			IGxObjectUI* pGxObjectUI = dynamic_cast<IGxObjectUI*>(pGxObject);
			wxGxObjectContainer* pGxObjectContainer = dynamic_cast<wxGxObjectContainer*>(pGxObject);
            IGxObjectTreeAttr* pGxObjectAttr = dynamic_cast<IGxObjectTreeAttr*>(pGxObject);
			if(pGxObjectUI != NULL)
			{
                wxString sName;
                if(m_pCatalog->GetShowExt())
                    sName = pGxObject->GetName();
                else
                    sName = pGxObject->GetBaseName();

                if(pGxObjectAttr && pGxObjectAttr->ShowCount())
                {
                    sName.Append(wxString::Format(wxT(" [%d]"), pGxObjectAttr->GetCount()));
                }

				wxIcon icon = pGxObjectUI->GetSmallImage();

                int pos(wxNOT_FOUND);
				if(icon.IsOk())
                {
                    for(size_t i = 0; i < m_IconsArray.size(); ++i)
                    {
                        if(m_IconsArray[i].oIcon.IsSameAs(icon))
                        {
                            pos = m_IconsArray[i].iImageIndex;
                            break;
                        }
                    }
                    if(pos == wxNOT_FOUND)
                    {
                        pos = m_TreeImageList.Add(icon);
                        ICONDATA myicondata = {icon, pos};
                        m_IconsArray.push_back(myicondata);
                    }
                    SetItemImage(TreeItemId, pos);
					//m_TreeImageList.Replace(pData->m_smallimage_index, icon);
                }
				SetItemText(TreeItemId, sName);
				if(pGxObjectContainer != NULL)
				{
					wxBusyCursor wait;
					bool bItemHasChildren = pGxObjectContainer->HasChildren();
					if(ItemHasChildren(TreeItemId) && !bItemHasChildren)
					{						
						CollapseAndReset(TreeItemId);
						pData->m_bExpandedOnce = false;
                        UpdateGxSelection();
					}
					SetItemHasChildren(TreeItemId, bItemHasChildren && pGxObjectContainer->AreChildrenViewable());
				}
                
                if(pGxObjectAttr)
                {
                    SetItemBold(TreeItemId, pGxObjectAttr->IsBold());
                    SetItemTextColour(TreeItemId, pGxObjectAttr->GetColor());                    
                }
				//wxTreeCtrl::Refresh();
			}
		}
	}
}