wxsProject::~wxsProject() { delete m_GUI; m_GUI = 0; for ( size_t i=m_Resources.Count(); i-->0; ) { delete m_Resources[i]; m_Resources[i] = 0; } m_Resources.Clear(); wxsTree()->Delete(m_TreeItem); wxsTree()->Refresh(); }
wxsResourceItemId wxsProject::GetResourceTypeTreeId(const wxString& Name) { if ( m_ResBrowserIds.find(Name) != m_ResBrowserIds.end() ) { return m_ResBrowserIds[Name]; } return m_ResBrowserIds[Name] = wxsTree()->AppendItem(m_TreeItem,Name,wxsResourceFactory::ResourceTreeIcon(Name)); }
void wxsResource::BuildTreeEntry(const wxsResourceItemId& Parent) { m_TreeItemId = wxsTree()->AppendItem( Parent, GetResourceName(), OnGetTreeIcon(), OnGetTreeIcon(), new wxsResourceRootTreeItemData(this)); }
void wxsExtResManager::DeleteAll() { m_ClosingAll = true; for ( FilesMapI i = m_Files.begin(); i!=m_Files.end(); ++i ) { delete i->second; } m_Files.clear(); wxsTree()->DeleteExternalResourcesId(); m_ClosingAll = false; }
wxsProject::wxsProject(cbProject* Project): m_Project(Project), m_GUI(0), m_UnknownConfig("unknown_config"), m_UnknownResources("unknown_resource"), m_WasModifiedDuringLoad(false) { // Creating resource tree entery for this project m_TreeItem = wxsTree()->NewProjectItem(GetCBProject()->GetTitle(),this); // Building paths wxFileName PathBuilder(Project->GetFilename()); m_ProjectPath = PathBuilder.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR); }
wxsResource::~wxsResource() { if ( m_Editor ) { wxsEditor* EditorStore = m_Editor; m_Editor = 0; EditorStore->Close(); } if ( m_TreeItemId.IsOk() ) { wxsTree()->Delete(m_TreeItemId); } }
bool wxsExtResManager::Open(const wxString& FileName) { if ( m_Files.find(FileName) == m_Files.end() ) { wxsResource* NewResource = wxsResourceFactory::BuildExternal(FileName); if ( !NewResource ) return false; NewResource->BuildTreeEntry(wxsTree()->ExternalResourcesId()); m_Files[FileName] = NewResource; NewResource->EditOpen(); return true; } m_Files[FileName]->EditOpen(); return true; }
void wxsExtResManager::EditorClosed(wxsResource* Res) { if ( m_ClosingAll ) return; for ( FilesMapI i = m_Files.begin(); i!=m_Files.end(); ++i ) { if ( i->second == Res ) { m_Files.erase(i); // wxsResource dtor calls "wxsTree()->Delete(m_TreeItemId);" itself // no need to call it here, outside the class // (which will crash if following line is uncommented) //wxsTree()->Delete(Res->GetTreeItemId()); delete Res; if ( m_Files.empty() ) { wxsTree()->DeleteExternalResourcesId(); } return; } } }