예제 #1
0
	XMLError XMLDocument::Parse( const char* p, size_t len )
	{
		DeleteChildren();
		InitDocument();

		if ( !p || !*p ) {
			SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
			return _errorID;
		}
		if ( len == (size_t)(-1) ) {
			len = strlen( p );
		}
		_charBuffer = new char[ len+1 ];
		memcpy( _charBuffer, p, len );
		_charBuffer[len] = 0;

		p = XMLUtil::SkipWhiteSpace( p );
		p = XMLUtil::ReadBOM( p, &_writeBOM );
		if ( !p || !*p ) {
			SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
			return _errorID;
		}

		ParseDeep( _charBuffer, 0 );
		return _errorID;
	}
예제 #2
0
파일: dir.c 프로젝트: taysom/tau
void SeekTest (void)
{
	int num_children = 10;
	dir_s dir = NilDir;
	DIR *d;
	struct dirent *entry;
	int i;

	dir.name = RndName();
	mkdir(dir.name, 0777);
	AddChildren(&dir, num_children);

	d = opendir(dir.name);
	while ((entry = readdir(d)) != NULL) {
		SaveTell(d, entry, &dir);
	}
	for (i = 0; i < 27; i++) {
		int k = urand(num_children);
		file_s *file = &dir.file[k];
		seekdir(d, file->tell);
		entry = readdir(d);
		if (strcmp(entry->d_name, file->name) != 0) {
			PrError("Seekdir failed. Looking for %s found %s",
				entry->d_name, file->name);
		}
	}
	closedir(d);
	DeleteChildren(&dir);
	rmdir(dir.name);
	free(dir.name);
}
예제 #3
0
	void XMLDocument::Clear()
	{
		DeleteChildren();

		_errorID = XML_NO_ERROR;
		_errorStr1 = 0;
		_errorStr2 = 0;

		delete[] _charBuffer;
		_charBuffer = 0;

#if 0
		_textPool.Trace("text");
		_elementPool.Trace("element");
		_commentPool.Trace("comment");
		_attributePool.Trace("attribute");
#endif

#ifdef DEBUG
		if (Error() == false)
		{
			TIXMLASSERT(_elementPool.CurrentAllocs() == _elementPool.Untracked());
			TIXMLASSERT(_attributePool.CurrentAllocs() == _attributePool.Untracked());
			TIXMLASSERT(_textPool.CurrentAllocs() == _textPool.Untracked());
			TIXMLASSERT(_commentPool.CurrentAllocs() == _commentPool.Untracked());
		}
#endif
	}
예제 #4
0
XMLNode::~XMLNode()
{
    DeleteChildren();
    if ( _parent ) {
        _parent->Unlink( this );
    }
}
예제 #5
0
void CRemoteTreeView::DisplayItem(wxTreeItemId parent, const CDirectoryListing& listing)
{
	DeleteChildren(parent);

	const wxString path = listing.path.GetPath();

	CFilterDialog filter;
	for (unsigned int i = 0; i < listing.GetCount(); ++i) {
		if (!listing[i].is_dir())
			continue;

		if (filter.FilenameFiltered(listing[i].name, path, true, -1, false, 0, listing[i].time))
			continue;

		const wxString& name = listing[i].name;
		CServerPath subdir = listing.path;
		subdir.AddSegment(name);

		CDirectoryListing subListing;

		if (m_pState->m_pEngine->CacheLookup(subdir, subListing) == FZ_REPLY_OK) {
			wxTreeItemId child = AppendItem(parent, name, 0, 2, 0);
			SetItemImages(child, false);

			if (HasSubdirs(subListing, filter))
				AppendItem(child, _T(""), -1, -1);
		}
		else {
			wxTreeItemId child = AppendItem(parent, name, 1, 3, 0);
			SetItemImages(child, true);
		}
	}
	SortChildren(parent);
}
void EXWaitingTreeCtrl::PreExpandItem(HTREEITEM hItem)
{
	if (!NeedsChildren(hItem))
	{
		if (WantsRefresh(hItem))
		{
			// delete child items before populating
			DeleteChildren(hItem);
		}
		else
		{
			// doesn't want new items
			m_hItemToPopulate = NULL;
			return;
		}
	}
	// if it wants new child items, go on
	m_hItemToPopulate = hItem;

	// fix redraw when expanded programatically
	UpdateWindow();
	// hide changes until it's expanded
	SetRedraw(FALSE);
	// add wait msg, to allow item expansion
	m_hItemMsg = InsertItem(m_sWaitMsg, m_hItemToPopulate);
	// zero progress
	m_iItemCount = 1;
	m_iItemIndex = 0;
}
//---------------------------------------------------------
void CData_Source_PgSQL::Update_Source(const wxTreeItemId &Item)
{
	CData_Source_PgSQL_Data	*pData	= Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL )	return;

	if( pData->Get_Type() != TYPE_SOURCE )
	{
		return;
	}

	Freeze();

	DeleteChildren(Item);

	//-----------------------------------------------------
	if( !pData->is_Connected() )
	{
		SetItemImage(Item, IMG_SRC_CLOSED, wxTreeItemIcon_Normal);
		SetItemImage(Item, IMG_SRC_CLOSED, wxTreeItemIcon_Selected);
	}
	else
	{
		SetItemImage(Item, IMG_SRC_OPENED, wxTreeItemIcon_Normal);
		SetItemImage(Item, IMG_SRC_OPENED, wxTreeItemIcon_Selected);

		CSG_Table	Tables;

		RUN_MODULE(DB_PGSQL_Table_List, false,	// CTable_List
				SET_PARAMETER("CONNECTION", pData->Get_Value())
			&&	SET_PARAMETER("TABLES"    , &Tables)
		);

		Tables.Set_Index(1, TABLE_INDEX_Ascending, 0, TABLE_INDEX_Ascending);

		for(int i=0; i<Tables.Get_Count(); i++)
		{
			CSG_String	s(Tables[i].asString(1));

			TSG_Shape_Type	Shape;
			TSG_Vertex_Type	Vertex;

			if( CSG_Shapes_OGIS_Converter::to_ShapeType(s, Shape, Vertex) )
			{
				switch( Shape )
				{
				case SHAPE_TYPE_Point:   Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_POINT  ); break;
				case SHAPE_TYPE_Points:  Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_POINTS ); break;
				case SHAPE_TYPE_Line:    Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_LINE   ); break;
				case SHAPE_TYPE_Polygon: Append_Table(Item, Tables[i].asString(0), TYPE_SHAPES, IMG_POLYGON); break;
				}
			}
			else if( !s.Cmp("RASTER" ) ) Append_Table(Item, Tables[i].asString(0), TYPE_GRIDS , IMG_GRIDS  );
			else if( !s.Cmp("TABLE"  ) ) Append_Table(Item, Tables[i].asString(0), TYPE_TABLE , IMG_TABLE  );
		}

		Expand(Item);
	}

	Thaw();
}
예제 #8
0
파일: Queue.C 프로젝트: juddy/edcde
void Queue::ParseRemoteStatus(char *output)
{
   SetInitChildren();
   DeleteChildren();
   if (_loaded_attributes == false)
      ReadAttributes();
   ProcessJobs(output);
}
예제 #9
0
COXTreeItem::~COXTreeItem()
{
	Unlink();
	DeleteChildren();
	for(int i=0;i < m_Items.GetSize();i++)
		delete m_Items[i];
	if(m_tvi.pszText && m_tvi.pszText != LPSTR_TEXTCALLBACK)
		delete [] m_tvi.pszText;
}	
예제 #10
0
	void XMLDocument::Clear()
	{
		DeleteChildren();

		_errorID = XML_NO_ERROR;
		_errorStr1 = 0;
		_errorStr2 = 0;

		delete [] _charBuffer;
		_charBuffer = 0;
	}
예제 #11
0
void browsers::TDTbrowser::OnTELLremovecell(wxString cellname, wxString parentname, bool orphan) {
   wxTreeItemId newparent;
   if (orphan) {
      wxTreeItemId item;
      findItem(cellname, item, GetRootItem());
      copyItem(item,GetRootItem());
      item = wxTreeItemId();
      assert(findItem(parentname, newparent, GetRootItem()));
      assert(findItem(cellname, item, newparent));
      DeleteChildren(item);
      Delete(item);
   }
   else
      while (findItem(parentname, newparent, GetRootItem())) {
         wxTreeItemId item;
         assert(findItem(cellname, item, newparent));
         DeleteChildren(item);
         Delete(item);
      }
}
예제 #12
0
void FolderTree::DoExpand(HTREEITEM hItem)
{
	FolderTreeItemInfo* pItem = (FolderTreeItemInfo*) GetItemData(hItem);

	//Reset the drive node if the drive is empty or the media has changed
	if (IsMediaValid(pItem->m_sFQPath))
	{
		//Delete the item if the path is no longer valid
		if (IsFolder(pItem->m_sFQPath))
		{
			//Add the new items to the tree if it does not have any child items
			//already
			if (!GetChildItem(hItem))
				DisplayPath(pItem->m_sFQPath, hItem);
		}
		else if (hItem == m_hMyComputerRoot)
		{
			//Display an hour glass as this may take some time
			//CWaitCursor wait;

			//Enumerate the local drive letters
			auto shared = sp->getViewItems(sp->curProfile);
			DisplayDrives(m_hMyComputerRoot, FALSE, shared);
		}
		else if ((hItem == m_hNetworkRoot) || (pItem->m_pNetResource))
		{
			//Display an hour glass as this may take some time
			//CWaitCursor wait;

			//Enumerate the network resources
			EnumNetwork(hItem);
		}
		else
		{
			//Before we delete it see if we are the only child item
			HTREEITEM hParent = GetParentItem(hItem);

			//Delete the item
			DeleteItem(hItem);

			//Remove all the child items from the parent
			SetHasPlusButton(hParent, false);
		}
	}
	else
	{
		//Display an hour glass as this may take some time
		//CWaitCursor wait;

		//Collapse the drive node and remove all the child items from it
		Expand(hItem, TVE_COLLAPSE);
		DeleteChildren(hItem, true);
	}
}
예제 #13
0
파일: dir.c 프로젝트: taysom/tau
static void Simple (void)
{
	int num_children = 20;
	dir_s dir = NilDir;

	dir.name = RndName();
	mkdir(dir.name, 0777);
	AddChildren(&dir, num_children);
	AuditDir(&dir);
	DeleteChildren(&dir);
	rmdir(dir.name);
	free(dir.name);
}
예제 #14
0
void CTangramHtmlTreeExWnd::PreExpandItem(HTREEITEM hItem)
{
	if(hItem)
	{
		m_hCurSelectedItem = hItem;
		CTangramXHtmlTreeNode *pXTCD = GetItemDataStruct(hItem);
		if(pXTCD->m_hWaitItemMsg)
		{
			m_hItemToPopulate = hItem;

			// fix redraw when expanded programatically
			UpdateWindow();
			// hide changes until it's expanded
			SetRedraw(false);
			// add wait msg, to allow item expansion
			m_hItemMsg = pXTCD->m_hWaitItemMsg;//InsertItem(m_sWaitMsg, m_hItemToPopulate);
			// zero progress
			m_iItemCount = 1;
			m_iItemIndex = 0;
			return;
		}
	}
	if (!NeedsChildren(hItem))
	{
		if (WantsRefresh(hItem))
		{
			// delete child items before populating
			DeleteChildren(hItem);
		}
		else
		{
			// doesn't want new items
			m_hItemToPopulate = NULL;
			return;
		}
	}
	// if it wants new child items, go on
	m_hItemToPopulate = hItem;

	// fix redraw when expanded programatically
	UpdateWindow();
	// hide changes until it's expanded
	SetRedraw(false);
	// add wait msg, to allow item expansion
	m_hItemMsg = InsertItem(m_sWaitMsg, m_hItemToPopulate);
	// zero progress
	m_iItemCount = 1;
	m_iItemIndex = 0;
}
예제 #15
0
BaseObj::~BaseObj()
{
   int i;

   DeleteChildren();
   DeleteFromParent();

   BaseObj *parent = _parent;
   while (parent)
    {
      parent->NotifyDelete(this);
      parent = parent->_parent;
    }

   for (i = 0; i < _numAttributes; i++)
    {
      delete _attributes[i]->ReferenceName;
      delete _attributes[i]->Value;
      delete _attributes[i]->DisplayName;
      delete _attributes[i]->DisplayValue;
      delete _attributes[i]->DefaultValue;
      delete _attributes[i]->DisplayDefaultValue;
      delete _attributes[i]->Help;
      delete _attributes[i]->ContextualHelp;
      delete _attributes[i]->Listing;
      delete _attributes[i]->Dependancies;
      delete _attributes[i];
    }
   delete []_attributes;
   for (i = 0; i < _numActions; i++)
    {
      delete _actions[i]->ReferenceName;
      delete _actions[i]->DisplayName;
      delete _actions[i]->Nmemonic;
      delete _actions[i]->AcceleratorText;
      delete _actions[i]->Accelerator;
      delete _actions[i]->Help;
      delete _actions[i]->ContextualHelp;
      delete _actions[i]->Dependancies;
      delete _actions[i];
    }
   delete []_actions;
   delete []_children;
   free(_lastActionName);
   delete [] _lastActionOutput;
   free(_details);
   free(_displayName);
   free(_name);
}
예제 #16
0
XMLTreeNode::~XMLTreeNode()
{
	DeleteAttributes();
	DeleteChildren();

	if (type) {
		free(type);
		type=0;
	};
	if (data) {
		delete[] data;
		dataSize=0;
	};

	next=0;
}
void EXWaitingTreeCtrl::RefreshSubItems(HTREEITEM hParent)
{
//	if (hParent != TVI_ROOT && !ItemHasChildren(hParent))
//		return;

	SetRedraw(FALSE);
	DeleteChildren(hParent);
	if (hParent == TVI_ROOT)
		PopulateRoot();
	else
	{
		PreExpandItem(hParent);
		ExpandItem(hParent);
	}
	SetRedraw(TRUE);
}
예제 #18
0
void CTangramHtmlTreeExWnd::RefreshSubItems(HTREEITEM hParent)
{
	if (hParent != TVI_ROOT && !ItemHasChildren(hParent))
		return;

	SetRedraw(false);
	DeleteChildren(hParent);
	if (hParent == TVI_ROOT)
		PopulateRoot();
	else
	{
		PreExpandItem(hParent);
		ExpandItem(hParent);
	}
	SetRedraw(true);
}
void EXWaitingTreeCtrl::OnItemExpanded(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;

	if (pNMTreeView->action & TVE_EXPAND)
		ExpandItem(pNMTreeView->itemNew.hItem);
	else if (pNMTreeView->action & TVE_COLLAPSE)
	{
		if (WantsRefresh(pNMTreeView->itemNew.hItem))
		{
			// delete child items
			DeleteChildren(pNMTreeView->itemNew.hItem);
		}
	}

	*pResult = 0;
}
예제 #20
0
파일: cmpctrl.cpp 프로젝트: DDMAL/aruspix
void CmpCtrl::UpdateParts( CmpBookItem *book )
{
    int j, k;
    
    if ( !book->m_partsId.IsOk() ) {
        wxLogDebug( "wxTreeItemId should be Ok" );
        return;
    }
    DeleteChildren( book->m_partsId );
    
    int parts = (int)book->m_bookParts.GetCount();
    if ( parts > 0 )
        SetItemText( book->m_partsId, wxString::Format( _("Parts (%d)"), parts ) );
    else
        SetItemText( book->m_partsId, _("Parts") );
    for ( j = 0; j < parts; j++)
    {
        CmpBookPart *part = &book->m_bookParts[j];
        wxTreeItemId partid;
        partid = AppendItem( book->m_partsId, part->m_name );
        SetTypeImages( partid, IMG_FOLDER );
        for ( k = 0; k < (int)part->m_partpages.GetCount(); k++)
        {
            wxString staves = part->m_partpages[k].m_axfile;
            int img = IMG_DOC;
            int itemType = CMP_TREE_BOOK_PART_PAGE;
            if ( part->m_partpages[k].HasStart() && part->m_partpages[k].HasEnd() ) {
                img = IMG_DOC_START_END;
                itemType = CMP_TREE_BOOK_PART_PAGE_START_END;
            }
            else if ( part->m_partpages[k].HasStart() ) {
                img = IMG_DOC_START;
                itemType = CMP_TREE_BOOK_PART_PAGE_START;
            }
            else if ( part->m_partpages[k].HasEnd() ) {
                img = IMG_DOC_END;
                itemType = CMP_TREE_BOOK_PART_PAGE_END;
            }
            wxTreeItemId id = AppendItem( partid, staves, img, img );
            AxTreeItem *axTreeItem = new AxTreeItem( id, itemType, &part->m_partpages[k] ); 
            m_axItems.Add( axTreeItem );
        }	
    }
}
예제 #21
0
//----------------------------------------------------------------------------
TComponent::~TComponent()
{
	// 子がいれば勘当する
	DeleteChildren();

	// 自分がだれかの子だったら、縁を切る
	std::vector<TComponent*>::iterator c;
	if ( m_Owner )
	{
		for(c=m_Owner->m_Components.begin(); c < m_Owner->m_Components.end();c++)
		{
			if ( *c == this )
			{
				m_Owner->m_Components.erase(c);
				break;
			}
		}
	}
}
예제 #22
0
	XMLError XMLDocument::Parse(const char* p, size_t len)
	{
		const char* start = p;
		Clear();

		if (len == 0 || !p || !*p)
		{
			SetError(XML_ERROR_EMPTY_DOCUMENT, 0, 0);
			return _errorID;
		}
		if (len == (size_t)(-1))
		{
			len = strlen(p);
		}
		_charBuffer = new char[len + 1];
		memcpy(_charBuffer, p, len);
		_charBuffer[len] = 0;

		p = XMLUtil::SkipWhiteSpace(p);
		p = XMLUtil::ReadBOM(p, &_writeBOM);
		if (!p || !*p)
		{
			SetError(XML_ERROR_EMPTY_DOCUMENT, 0, 0);
			return _errorID;
		}

		ptrdiff_t delta = p - start;	// skip initial whitespace, BOM, etc.
		ParseDeep(_charBuffer + delta, 0);
		if (_errorID)
		{
			// clean up now essentially dangling memory.
			// and the parse fail can put objects in the
			// pools that are dead and inaccessible.
			DeleteChildren();
			_elementPool.Clear();
			_attributePool.Clear();
			_textPool.Clear();
			_commentPool.Clear();
		}
		return _errorID;
	}
예제 #23
0
	XMLDocument::~XMLDocument()
	{
		DeleteChildren();
		delete [] _charBuffer;

#if 0
		_textPool.Trace( "text" );
		_elementPool.Trace( "element" );
		_commentPool.Trace( "comment" );
		_attributePool.Trace( "attribute" );
#endif

#ifdef DEBUG
		if ( Error() == false ) {
			TIXMLASSERT( _elementPool.CurrentAllocs()   == _elementPool.Untracked() );
			TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );
			TIXMLASSERT( _textPool.CurrentAllocs()      == _textPool.Untracked() );
			TIXMLASSERT( _commentPool.CurrentAllocs()   == _commentPool.Untracked() );
		}
#endif
	}
예제 #24
0
LRESULT FolderTree::OnItemExpanding(int /*idCtrl*/, LPNMHDR pnmh, BOOL &bHandled)
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pnmh;
	if (pNMTreeView->action == TVE_EXPAND)
	{
		bool bHasPlus = HasPlusButton(pNMTreeView->itemNew.hItem);
		bool bHasChildren = (GetChildItem(pNMTreeView->itemNew.hItem) != NULL);

		if (bHasPlus && !bHasChildren)
			DoExpand(pNMTreeView->itemNew.hItem);
	}
	else if(pNMTreeView->action == TVE_COLLAPSE)
	{
		FolderTreeItemInfo* pItem = (FolderTreeItemInfo*) GetItemData(pNMTreeView->itemNew.hItem);
		//ASSERT(pItem);

		//Display an hour glass as this may take some time
		//CWaitCursor wait;

		//tstring sPath = ItemToPath(pNMTreeView->itemNew.hItem);
		
		//Collapse the node and remove all the child items from it
		Expand(pNMTreeView->itemNew.hItem, TVE_COLLAPSE);

		//Never uppdate the child indicator for a network node which is not a share
		bool bUpdateChildIndicator = true;
		if (pItem->m_bNetworkNode)
		{
			if (pItem->m_pNetResource)
				bUpdateChildIndicator = (pItem->m_pNetResource->dwDisplayType == RESOURCEDISPLAYTYPE_SHARE);
			else
				bUpdateChildIndicator = false;
		}
		DeleteChildren(pNMTreeView->itemNew.hItem, bUpdateChildIndicator);
	}

	bHandled = FALSE; //Allow the message to be reflected again
	return 0;
}
예제 #25
0
	~Attribute()
	{
		DeleteChildren();
	}
예제 #26
0
파일: cmpctrl.cpp 프로젝트: DDMAL/aruspix
void CmpCtrl::Update( )
{
    wxASSERT( m_cmpFilePtr );
    wxASSERT( m_cmpEnvPtr );
    
    wxTreeItemId id;
    AxTreeItem *axTreeItem = NULL;
	int i, j;
	
	DeleteChildren( m_booksId );
    int books = (int)m_cmpFilePtr->m_bookFiles.GetCount();
    if ( books > 0 )
        SetItemText( m_booksId, wxString::Format( _("Books (%d)"), books ) );
    else
        SetItemText( m_booksId, _("Books") );
    // For specific menu
    axTreeItem = new AxTreeItem( m_booksId, CMP_TREE_BOOKS, NULL ); 
    m_axItems.Add( axTreeItem );
    
    for ( i = 0; i < books; i++)
    {
		RecBookFile *book = m_cmpFilePtr->m_bookFiles[i].m_recBookFilePtr;
        wxTreeItemId m_bookId = AppendItem( m_booksId, m_cmpFilePtr->m_bookFiles[i].m_shortname );
		SetTypeImages( m_bookId, IMG_FOLDER );
		
        // The name of the book
        AppendItem( m_bookId, m_cmpFilePtr->m_bookFiles[i].m_bookname, IMG_TEXT, IMG_TEXT_S );
        
        // The Aruspix files of the book
        m_cmpFilePtr->m_bookFiles[i].m_axFilesId = AppendItem( m_bookId, _("Aruspix files") );
		SetTypeImages( m_cmpFilePtr->m_bookFiles[i].m_axFilesId, IMG_FOLDER );        
		int ax = (int)book->m_axFiles.GetCount();
		if ( ax > 0 )
			SetItemText( m_cmpFilePtr->m_bookFiles[i].m_axFilesId, wxString::Format( _("Aruspix files (%d)"), ax ) );
		else
			SetItemText( m_cmpFilePtr->m_bookFiles[i].m_axFilesId, _("Aruspix files") );
		for ( j = 0; j < ax; j++)
		{
			id = AppendItem( m_cmpFilePtr->m_bookFiles[i].m_axFilesId, book->m_axFiles[j].m_filename, IMG_AXZ, IMG_AXZ_S );
			if (  book->m_axFiles[j].m_flags & FILE_DESACTIVATED ) 
				SetItemTextColour( id , *wxLIGHT_GREY );
			if ( !wxFileExists( book->m_axFileDir + wxFileName::GetPathSeparator() +  book->m_axFiles[j].m_filename ) ) 
				SetItemTextColour( id , *wxRED );
			else if ( RecFile::IsRecognized( book->m_axFileDir + wxFileName::GetPathSeparator() +  book->m_axFiles[j].m_filename ) )
			{
				SetItemImage( id, IMG_AXZ_OK ); 
				SetItemImage( id, IMG_AXZ_OK_S,  wxTreeItemIcon_Selected );
                axTreeItem = new AxTreeItem( id, CMP_TREE_BOOK_AXFILE, &m_cmpFilePtr->m_bookFiles[i] ); 
                m_axItems.Add( axTreeItem );
			}	
		}
		
        // The parts of the book
		m_cmpFilePtr->m_bookFiles[i].m_partsId = AppendItem( m_bookId, _("Parts") );
		SetTypeImages( m_cmpFilePtr->m_bookFiles[i].m_partsId, IMG_FOLDER );
        // for the parts we associate the book object
        axTreeItem = new AxTreeItem( m_cmpFilePtr->m_bookFiles[i].m_partsId, CMP_TREE_BOOK_PARTS, &m_cmpFilePtr->m_bookFiles[i] ); 
        m_axItems.Add( axTreeItem );
        // We have a separate method for this
        UpdateParts( &m_cmpFilePtr->m_bookFiles[i] );
    }
	
    DeleteChildren( m_cmpId );
    int collations = (int)m_cmpFilePtr->m_collations.GetCount();
    if ( collations > 0 )
        SetItemText( m_cmpId, wxString::Format( _("Collations (%d)"), collations ) );
    else
        SetItemText( m_cmpId, _("Collations") );
    // For specific menu
    axTreeItem = new AxTreeItem( m_cmpId, CMP_TREE_COLLATIONS, NULL ); 
    m_axItems.Add( axTreeItem );
    
    for ( i = 0; i < collations; i++)
    {
		//RecBookFile *book = m_cmpFilePtr->m_bookFiles[i].m_recBookFilePtr;
		m_cmpFilePtr->m_collations[i].m_colId = AppendItem( m_cmpId, m_cmpFilePtr->m_collations[i].m_name );
		SetTypeImages( m_cmpFilePtr->m_collations[i].m_colId, IMG_FOLDER );
        // for the parts we associate the collation object
        axTreeItem = new AxTreeItem( m_cmpFilePtr->m_collations[i].m_colId, CMP_TREE_COLLATION, &m_cmpFilePtr->m_collations[i] ); 
        m_axItems.Add( axTreeItem );
        // We have a separate method for this
        UpdateCollationParts( &m_cmpFilePtr->m_collations[i] );
	}
	
    m_cmpFilePtr->Modify();
}
예제 #27
0
void CLocalTreeView::DisplayDir(wxTreeItemId parent, const wxString& dirname, const wxString& knownSubdir /*=_T("")*/)
{
	CLocalFileSystem local_filesystem;

	{
		wxLogNull log;
		if (!local_filesystem.BeginFindFiles(dirname, true))
		{
			if (knownSubdir != _T(""))
			{
				wxTreeItemId item = GetSubdir(parent, knownSubdir);
				if (item != wxTreeItemId())
					return;

				const wxString fullName = dirname + knownSubdir;
				item = AppendItem(parent, knownSubdir, GetIconIndex(::dir, fullName),
#ifdef __WXMSW__
						-1
#else
						GetIconIndex(opened_dir, fullName)
#endif
					);
				CheckSubdirStatus(item, fullName);
			}
			else
			{
				m_setSelection = true;
				DeleteChildren(parent);
				m_setSelection = false;
			}
			return;
		}
	}

	wxASSERT(parent);
	m_setSelection = true;
	DeleteChildren(parent);
	m_setSelection = false;

	CFilterManager filter;

	bool matchedKnown = false;

	wxString file;
	bool wasLink;
	int attributes;
	bool is_dir;
	const wxLongLong size(-1);
	wxDateTime date;
	while (local_filesystem.GetNextFile(file, wasLink, is_dir, 0, &date, &attributes))
	{
		wxASSERT(is_dir);
		if (file == _T(""))
		{
			wxGetApp().DisplayEncodingWarning();
			continue;
		}

		wxString fullName = dirname + file;
#ifdef __WXMSW__
		if (file.CmpNoCase(knownSubdir))
#else
		if (file != knownSubdir)
#endif
		{
			if (filter.FilenameFiltered(file, dirname, true, size, true, attributes, date.IsValid() ? &date : 0))
				continue;
		}
		else
			matchedKnown = true;

		wxTreeItemId item = AppendItem(parent, file, GetIconIndex(::dir, fullName),
#ifdef __WXMSW__
				-1
#else
				GetIconIndex(opened_dir, fullName)
#endif
			);

		CheckSubdirStatus(item, fullName);
	}

	if (!matchedKnown && knownSubdir != _T(""))
	{
		const wxString fullName = dirname + knownSubdir;
		wxTreeItemId item = AppendItem(parent, knownSubdir, GetIconIndex(::dir, fullName),
#ifdef __WXMSW__
				-1
#else
				GetIconIndex(opened_dir, fullName)
#endif
			);

		CheckSubdirStatus(item, fullName);
	}

	SortChildren(parent);
}
예제 #28
0
void CRemoteTreeView::SetDirectoryListing(std::shared_ptr<CDirectoryListing> const& pListing, bool modified)
{
	m_busy = true;

	if (!pListing) {
		m_ExpandAfterList = wxTreeItemId();
		DeleteAllItems();
		AddRoot(_T(""));
		m_busy = false;
		if (FindFocus() == this) {
			wxNavigationKeyEvent *evt = new wxNavigationKeyEvent();
			evt->SetFromTab(true);
			evt->SetEventObject(this);
			evt->SetDirection(true);
			QueueEvent(evt);
		}
		Enable(false);
		m_contextMenuItem = wxTreeItemId();
		return;
	}
	Enable(true);
#ifdef __WXGTK__
	GetParent()->m_dirtyTabOrder = true;
#endif

	if (pListing->get_unsure_flags() && !(pListing->get_unsure_flags() & ~(CDirectoryListing::unsure_unknown | CDirectoryListing::unsure_file_mask))) {
		// Just files changed, does not affect directory tree
		m_busy = false;
		return;
	}

#ifndef __WXMSW__
	Freeze();
#endif
	wxTreeItemId parent = MakeParent(pListing->path, !modified);
	if (!parent)
	{
		m_busy = false;
#ifndef __WXMSW__
		Thaw();
#endif
		return;
	}

	if (!IsExpanded(parent) && parent != m_ExpandAfterList)
	{
		DeleteChildren(parent);
		CFilterManager filter;
		if (HasSubdirs(*pListing, filter))
			AppendItem(parent, _T(""), -1, -1);
	}
	else
	{
		RefreshItem(parent, *pListing, !modified);

		if (m_ExpandAfterList == parent)
		{
#ifndef __WXMSW__
			// Prevent CalculatePositions from being called
			wxGenericTreeItem *anchor = m_anchor;
			m_anchor = 0;
#endif
			Expand(parent);
#ifndef __WXMSW__
			m_anchor = anchor;
#endif
		}
	}
	m_ExpandAfterList = wxTreeItemId();

	SetItemImages(parent, false);

#ifndef __WXMSW__
	Thaw();
#endif
	if (!modified)
		SafeSelectItem(parent);
#ifndef __WXMSW__
	else
		Refresh();
#endif

	m_busy = false;
}
예제 #29
0
	~Entry()
	{
		DeleteChildren();
		free(fName);
	}
예제 #30
0
파일: trpage_scene.cpp 프로젝트: bouffa/osg
// Destructor
trpgReadGroupBase::~trpgReadGroupBase()
{
    DeleteChildren();
}