|
From: Emilien K. <cur...@us...> - 2005-03-16 14:27:53
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/src Modified Files: Application.cpp DocManager.cpp DocType.cpp Document.cpp FileSystem.cpp FileSystemCtrl.cpp FileSystemStandard.cpp MDIFrame.cpp MainFrame.cpp Project.cpp Added Files: Manager.cpp Log Message: Merge de la branche "manager_virtualization". Index: DocType.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/DocType.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DocType.cpp 7 Dec 2004 13:36:28 -0000 1.2 --- DocType.cpp 16 Mar 2005 14:27:37 -0000 1.3 *************** *** 41,46 **** ! DocType::DocType(wxString strDocName, wxClassInfo *pDocClassInfo, wxString strDocDescripton, wxString strExt, wxString strViewName, wxClassInfo *pViewClassInfo, wxString strViewDescripton, wxString strIconBundleName, wxClassInfo *pMiniDocClassInfo): ! DocTemplate(strDocName, pDocClassInfo, "", strDocDescripton) { // Enregistrement des extensions. --- 41,47 ---- ! DocType::DocType(wxString strDocName, wxClassInfo *pDocClassInfo, wxString strDocDescripton, wxString strExt, wxString strViewName, wxClassInfo *pViewClassInfo, wxString strViewDescripton, wxString strIconBundleName, wxClassInfo *WXUNUSED(pMiniDocClassInfo)): ! DocTemplate(strDocName, pDocClassInfo, "", strDocDescripton), ! m_ViewTemplate(pViewClassInfo, strViewName, strViewDescripton, strIconBundleName) { // Enregistrement des extensions. *************** *** 51,62 **** // Enregistrement des données de la vue. ! AddView(strViewName, pViewClassInfo, strIconBundleName, strViewDescripton); // Enregistrement du mini-doc si précisé. ! if(pMiniDocClassInfo!=NULL) ! SetMiniDoc(pMiniDocClassInfo); // Déclaration du type de documents. ! wxGetApp().GetDocManager().AddDocTemplate(this); } --- 52,63 ---- // Enregistrement des données de la vue. ! RegisterViewTemplate(&m_ViewTemplate); // Enregistrement du mini-doc si précisé. ! // if(pMiniDocClassInfo!=NULL) ! // SetMiniDoc(pMiniDocClassInfo); // Déclaration du type de documents. ! wxGetApp().GetDocManager().RegisterDocTemplate(this); } Index: MDIFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MDIFrame.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MDIFrame.cpp 12 Jan 2005 13:50:55 -0000 1.2 --- MDIFrame.cpp 16 Mar 2005 14:27:37 -0000 1.3 *************** *** 93,97 **** { wxString str = pView->GetDocument()->GetDocumentName(); ! long type = pView->GetViewAssociation()->ID; View *pOldView = GetActiveView(); --- 93,97 ---- { wxString str = pView->GetDocument()->GetDocumentName(); ! long type = wxGetApp().GetDocManager().FindDocTemplate(pView->GetDocument()->GetDocTemplate()); View *pOldView = GetActiveView(); *************** *** 101,107 **** pView->SetFrame(this); ! OnViewChanging( pOldView, pView); AddPage(pView, str, true, type); ! OnViewChanged( pView, pOldView); } --- 101,107 ---- pView->SetFrame(this); ! OnViewChanging(pOldView, pView); AddPage(pView, str, true, type); ! OnViewChanged(pView, pOldView); } *************** *** 154,158 **** // Supprime une vue, si elle est attachée, et sans aucun test d'attachement sur le document ! void MDIFrame::DeleteView(View *pView) { int i, iPage; --- 154,158 ---- // Supprime une vue, si elle est attachée, et sans aucun test d'attachement sur le document ! void MDIFrame::RemoveView(View *pView) { int i, iPage; *************** *** 178,184 **** // On retire la vue RemovePage(i); - // On détruit la vue - pView->Destroy(); - break;; } } --- 178,181 ---- Index: FileSystem.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystem.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileSystem.cpp 3 Dec 2004 16:47:45 -0000 1.1 --- FileSystem.cpp 16 Mar 2005 14:27:37 -0000 1.2 *************** *** 188,192 **** FileSystemManager::FileSystemManager(): ! wxObject() { } --- 188,192 ---- FileSystemManager::FileSystemManager(): ! InitializableObjectManager<FileSystem>() { } *************** *** 194,247 **** FileSystemManager::~FileSystemManager() { - while(m_arFileSystems.GetCount()>0) - { - delete m_arFileSystems[0]->pFileSystem; - delete m_arFileSystems[0]; - m_arFileSystems.RemoveAt(0); - } - } - - // Enregistre un nouveau système de fichier. - void FileSystemManager::RegisterFileSystem(FileSystem* pFileSystem, const wxString& strName, const wxIconBundle& Icones) - { - FileSystemManagerAssoc* pFSMA = new FileSystemManagerAssoc; - pFSMA->pFileSystem = pFileSystem; - pFSMA->strName = strName; - pFSMA->Icones = Icones; - m_arFileSystems.Add(pFSMA); - } - - // Désinscrit le système de fichier. - void FileSystemManager::RemoveFileSystem(FileSystem* pFileSystem) - { - int iIndex = Find(pFileSystem); - if(iIndex!=-1) - m_arFileSystems.RemoveAt(iIndex); - } - - // Supprime le système de fichier. - void FileSystemManager::DeleteFileSystem(FileSystem* pFileSystem) - { - int iIndex = Find(pFileSystem); - if(iIndex!=-1) - { - delete m_arFileSystems[iIndex]; - m_arFileSystems.RemoveAt(iIndex); - } - } - - // Retourne le nombre de systèmes de fichiers enregistrés. - unsigned int FileSystemManager::GetCount() - { - return m_arFileSystems.GetCount(); - } - - // Cherche si un système de fichier est attaché. - int FileSystemManager::Find(FileSystem* pFileSystem) - { - for(unsigned int n=0; n<m_arFileSystems.GetCount(); n++) - if(m_arFileSystems[n]->pFileSystem == pFileSystem) - return (int)n; - return -1; } --- 194,197 ---- *************** *** 250,256 **** { wxString strProtocol = strPath.GetFileProtocol(); ! for(unsigned int n=0; n<m_arFileSystems.GetCount(); n++) ! if(m_arFileSystems[n]->pFileSystem->GetProtocoleName()==strProtocol) ! return m_arFileSystems[n]->pFileSystem; return NULL; } --- 200,206 ---- { wxString strProtocol = strPath.GetFileProtocol(); ! for(unsigned int n=0; n<GetCount(); n++) ! if(Item(n).GetProtocoleName()==strProtocol) ! return &Item(n); return NULL; } Index: FileSystemCtrl.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemCtrl.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FileSystemCtrl.cpp 25 Feb 2005 20:58:04 -0000 1.6 --- FileSystemCtrl.cpp 16 Mar 2005 14:27:37 -0000 1.7 *************** *** 26,30 **** #include <wxDevCenter/FileSystem.h> - #include <wxDevCenter/DocManager.h> #include <wx/toolbar.h> --- 26,29 ---- *************** *** 683,689 **** for(unsigned int n=0; n<pFSM->GetCount(); n++) { ! FileSystemManager::FileSystemManagerAssoc& FSMA = pFSM->GetFileSystem((int)n); ! wxBitmap bmp = FSMA.Icones.GetIcon(48); ! AttachFileSystem(FSMA.pFileSystem, FSMA.strName, bmp); } } --- 682,687 ---- for(unsigned int n=0; n<pFSM->GetCount(); n++) { ! wxBitmap bmp = pFSM->Item(n).GetIconBundle().GetIcon(48); ! AttachFileSystem(&(pFSM->Item(n)), pFSM->Item(n).GetFileSystemName(), bmp); } } Index: DocManager.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/DocManager.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DocManager.cpp 7 Mar 2005 15:23:03 -0000 1.7 --- DocManager.cpp 16 Mar 2005 14:27:37 -0000 1.8 *************** *** 23,29 **** #include <wxDevCenter.h> - #include <wxDevCenter/DocManager.h> #include <wxDevCenter/DocView.h> - #include <wxDevCenter/DocManager.h> #include <wxDevCenter/MDIFrame.h> --- 23,27 ---- *************** *** 33,47 **** - WX_DEFINE_OBJARRAY(ViewInfoArray); - - /** Compteur d'identifiants. - * Compteur servant à créer des identifiants uniques pour les types de documents et de vues.*/ - static unsigned int g_nDocIdentCount = WXDC_DOCMANAGER_TYPE_CUSTOMFIRST; - /** Fonction retournant un nouveel identifiant. - * @return Nouvel identifiant. - */ - static inline unsigned int GetNewIdent(){return g_nDocIdentCount++;} - - ////////////////////////////////////////////////////////////////////// // DocTemplate --- 31,34 ---- *************** *** 49,59 **** // Constructeur-initialisation DocTemplate::DocTemplate(wxString strName, wxClassInfo *pDocClassInfo, wxString strExt, wxString strDescription): ! wxObject(), ! m_nID(GetNewIdent()), ! m_strDocName(strName), ! m_pDocClassInfo(pDocClassInfo), ! m_strDescription(strDescription) { - m_ViewInfoArray.Alloc(2); m_strExt.Alloc(4); m_strExt.Add(strExt); --- 36,42 ---- // Constructeur-initialisation DocTemplate::DocTemplate(wxString strName, wxClassInfo *pDocClassInfo, wxString strExt, wxString strDescription): ! ObjectTemplate<Document>(pDocClassInfo, strName, strDescription), ! m_ViewTemplateManager() { m_strExt.Alloc(4); m_strExt.Add(strExt); *************** *** 64,79 **** } - void DocTemplate::AddView(wxString name, wxClassInfo *pCI, wxString strIcon, wxString description) - { - ViewAssociation Assoc; - Assoc.ID = m_ViewInfoArray.GetCount()==0?m_nID:GetNewIdent(); - Assoc.strName = name; - Assoc.pClassInfo = pCI; - Assoc.strDescription = description; - Assoc.strIcons = strIcon; - m_ViewInfoArray.Add(Assoc); - } - - bool DocTemplate::AddExtension(wxString strExt) { --- 47,50 ---- *************** *** 91,95 **** str += "*." + GetExtension(i) + ";"; str.RemoveLast(); ! strWildcard = m_strDocName + " (" + str + ")|" + str; if(bShowStarDotStar) strWildcard += "|" + wxString(WXDC_FILE_WILDCARD_ALLFILE) + "|*.*"; --- 62,66 ---- str += "*." + GetExtension(i) + ";"; str.RemoveLast(); ! strWildcard = GetName() + " (" + str + ")|" + str; if(bShowStarDotStar) strWildcard += "|" + wxString(WXDC_FILE_WILDCARD_ALLFILE) + "|*.*"; *************** *** 102,106 **** // DocManager ! DocManager::DocManager(void) { --- 73,80 ---- // DocManager ! DocManager::DocManager(void): ! MultiObjectTemplateManager<Document, DocTemplate>(), ! m_ViewManager(), ! m_pDefaultViewContainer(NULL) { *************** *** 111,134 **** } - void DocManager::InitDocManager() - { - m_arIconNames.Alloc(25); - m_arIconNames.Add("", WXDC_DOCMANAGER_TYPE_SYSCOUNT); - m_arIconNames[WXDC_DOCMANAGER_TYPE_NONE ] = wxT("none"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_UNKNOW ] = wxT("unknow"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_DIRECTORY ] = wxT("dir"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_DESKTOP ] = wxT("desktop"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_HOME ] = wxT("desktop"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_DOCUMENTS ] = wxT("docs"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_COMPUTER ] = wxT("computer"); - - m_arIconNames[WXDC_DOCMANAGER_TYPE_FLOPPY ] = wxT("floppy"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_HARDDRIVE] = wxT("harddrive"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_CDROM ] = wxT("cd-dvd"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_RAMDISK ] = wxT("ramdisk"); - m_arIconNames[WXDC_DOCMANAGER_TYPE_REMOTE ] = wxT("remote"); - } - - /** --- 85,88 ---- *************** *** 138,164 **** // Document par son chemin. ! Document* DocManager::GetDocument(FilePath &strDocPath)const { ! for(int i=0; i<(int)m_DocArray.GetCount(); i++) ! { ! if(m_DocArray[i]->GetDocumentPath()==strDocPath) ! return m_DocArray[i]; ! } return NULL; } ! // Enregistre un document. ! void DocManager::RegisterDocument(Document* pDocument) { ! m_DocArray.Add(pDocument); } // Crée un document. ! Document* DocManager::CreateDocument(DocTemplate* pDocTemplate) { ! Document *pDoc = (Document*)pDocTemplate->m_pDocClassInfo->CreateObject(); ! m_DocArray.Add(pDoc); pDoc->m_pDocumentManager = this; ! pDoc->m_pDocumentTemplate = pDocTemplate; return pDoc; } --- 92,117 ---- // Document par son chemin. ! const Document* DocManager::GetDocument(FilePath &strDocPath)const { ! for(unsigned int n=0; n<GetDocumentCount(); n++) ! if(GetDocument(n)->GetDocumentPath()==strDocPath) ! return GetDocument(n); return NULL; } ! Document* DocManager::GetDocument(FilePath &strDocPath) { ! for(unsigned int n=0; n<GetDocumentCount(); n++) ! if(GetDocument(n)->GetDocumentPath()==strDocPath) ! return GetDocument(n); ! return NULL; } // Crée un document. ! Document* DocManager::CreateDocument(unsigned int nIndex) { ! Document *pDoc = CreateObject(nIndex); pDoc->m_pDocumentManager = this; ! pDoc->m_pDocumentTemplate = &GetTemplate(nIndex); return pDoc; } *************** *** 173,177 **** // Le document sera détruit automatiquement par la fermeture de la dernière vue. for(int i = pDoc->m_ViewArray.GetCount()-1; i>=0; i--) ! CloseView(pDoc->m_ViewArray.Item(i)); return true; } --- 126,130 ---- // Le document sera détruit automatiquement par la fermeture de la dernière vue. for(int i = pDoc->m_ViewArray.GetCount()-1; i>=0; i--) ! CloseView(&pDoc->m_ViewArray.Item(i)); return true; } *************** *** 183,189 **** bool DocManager::CloseAllDocuments() { ! while(m_DocArray.GetCount()>0) { ! if(!CloseDocument(m_DocArray[0])) return false; } --- 136,142 ---- bool DocManager::CloseAllDocuments() { ! while(GetDocumentCount()>0) { ! if(!CloseDocument(GetDocument(0))) return false; } *************** *** 204,211 **** // Pré-ferme le document. pDocument->OnCloseDocument(); ! // Retire le document de la liste des documents du DocManager ! m_DocArray.Remove(pDocument); ! // Détruit le document. ! delete pDocument; } --- 157,162 ---- // Pré-ferme le document. pDocument->OnCloseDocument(); ! // Détruit le document (finalise, désenregistre et détruit). ! DestroyObject(pDocument); } *************** *** 216,285 **** // Patron de document correspondant à une extension ! int DocManager::GetDocTemplateID(wxString strExt)const { ! int i,j; ! for(i=0; i<(int)m_DocTemplateArray.Count(); i++) ! { ! for(j=0; j<(int)m_DocTemplateArray[i]->GetExtensionCount(); j++) ! { ! if(strExt.CmpNoCase(m_DocTemplateArray[i]->GetExtension(j))==0) ! return m_DocTemplateArray[i]->m_nID; ! } ! } return -1; } // Patron de document correspondant à un nom de patron. ! DocTemplate* DocManager::GetDocTemplate(wxString DocName)const { ! unsigned int i; ! for(i=0; i<m_DocTemplateArray.GetCount(); i++) ! { ! if(m_DocTemplateArray[i]->m_strDocName==DocName) ! return m_DocTemplateArray[i]; ! } ! return NULL; } // Demande à l'utilisateur un type de document. ! int DocManager::ChooseDocTemplate(void) const { wxArrayString aDocTemplateStrings; ! wxString str; unsigned int n; - int i; aDocTemplateStrings.Empty(); ! for(n=0; n<m_DocTemplateArray.GetCount(); n++) { ! str = m_DocTemplateArray[n]->m_strDocName + " - " + m_DocTemplateArray[n]->m_strDescription; aDocTemplateStrings.Add(str); } ! str.Printf("%s - %s", WXDC_NAME, WXDC_DOCUMENT_REQUEST_NEW); ! i = wxGetSingleChoiceIndex(WXDC_DOCUMENT_REQUEST_TYPE, str, aDocTemplateStrings, NULL, -1, -1, true, 350, 200); ! return i!=-1?m_DocTemplateArray[i]->m_nID:-1; } // Demande à l'utilisateur un type de vue. ! int DocManager::ChooseViewType(unsigned int nDocTemplateID) const { wxArrayString aViewStrings; ! wxString str; unsigned int n; ! int i; ! unsigned int nIndex = DocTemplateIndexFromID(nDocTemplateID); aViewStrings.Empty(); ! for(n=0; n<m_DocTemplateArray[nIndex]->GetViewCount(); n++) { ! str = m_DocTemplateArray[nIndex]->GetViewName(n) + " - " + m_DocTemplateArray[nIndex]->GetViewDescription(n); aViewStrings.Add(str); } ! str.Printf("%s - %s", WXDC_NAME, WXDC_VIEW_REQUEST_NEW); ! i = wxGetSingleChoiceIndex(WXDC_VIEW_REQUEST_TYPE, str, aViewStrings, NULL, -1, -1, true, 350, 200); ! return i!=-1?m_DocTemplateArray[nIndex]->m_ViewInfoArray[i].ID:-1; } --- 167,232 ---- // Patron de document correspondant à une extension ! int DocManager::GetDocTemplateFromExt(wxString strExt)const { ! unsigned int m, n; ! for(m=0; m<GetDocTemplateCount(); m++) ! for(n=0; n<GetDocTemplate(m).GetExtensionCount(); n++) ! if(strExt.CmpNoCase(GetDocTemplate(m).GetExtension(n))==0) ! return (int)m; return -1; } // Patron de document correspondant à un nom de patron. ! int DocManager::GetDocTemplateFromName(wxString strDocName)const { ! unsigned int m; ! for(m=0; m<GetDocTemplateCount(); m++) ! if(GetDocTemplate(m).GetName()==strDocName) ! return m; ! return -1; } // Demande à l'utilisateur un type de document. ! int DocManager::ChooseDocTemplate()const { wxArrayString aDocTemplateStrings; ! wxString str, s; unsigned int n; aDocTemplateStrings.Empty(); ! for(n=0; n<GetDocTemplateCount(); n++) { ! str = GetDocTemplate(n).GetName(); ! s = GetDocTemplate(n).GetDescript(); ! if(!s.IsEmpty()) ! str << wxT(" - ") << s; aDocTemplateStrings.Add(str); } ! str.Printf(wxT("%s - %s"), WXDC_NAME, WXDC_DOCUMENT_REQUEST_NEW); ! return wxGetSingleChoiceIndex(WXDC_DOCUMENT_REQUEST_TYPE, str, aDocTemplateStrings, NULL, -1, -1, true, 350, 200); } // Demande à l'utilisateur un type de vue. ! int DocManager::ChooseViewType(unsigned int nDocTemplateIndex) const { wxArrayString aViewStrings; ! wxString str, s; unsigned int n; ! const DocTemplate& DocTempl = GetDocTemplate(nDocTemplateIndex); aViewStrings.Empty(); ! for(n=0; n<DocTempl.GetViewTemplateCount(); n++) { ! str = DocTempl.GetViewTemplate(n).GetName(); ! s = DocTempl.GetViewTemplate(n).GetDescript(); ! if(!s.IsEmpty()) ! str << wxT(" - ") << s; aViewStrings.Add(str); } ! str.Printf(wxT("%s - %s"), WXDC_NAME, WXDC_VIEW_REQUEST_NEW); ! return wxGetSingleChoiceIndex(WXDC_VIEW_REQUEST_TYPE, str, aViewStrings, NULL, -1, -1, true, 350, 200); } *************** *** 287,291 **** void DocManager::RegisterDocTypes() { ! for(unsigned int n=0; n<m_DocTemplateArray.GetCount(); n++) { if(m_DocTemplateArray[n]->Initialize()) --- 234,238 ---- void DocManager::RegisterDocTypes() { ! /* for(unsigned int n=0; n<m_DocTemplateArray.GetCount(); n++) { if(m_DocTemplateArray[n]->Initialize()) *************** *** 305,315 **** n--; } ! } } // Ajoute un patron de document à la liste des patrons. ! void DocManager::AddDocTemplate(DocTemplate* pTemplate) { ! m_DocTemplateArray.Add(pTemplate); } --- 252,265 ---- n--; } ! }*/ } // Ajoute un patron de document à la liste des patrons. ! int DocManager::RegisterDocTemplate(DocTemplate* pTemplate) { ! if(!RegisterTemplate(pTemplate)) ! return -1; ! else ! return FindTemplate(pTemplate); } *************** *** 322,354 **** // Crée une vue ! View* DocManager::CreateView(Document *pDoc, unsigned int nDocViewID) { View *pView = NULL; DocTemplate *pTemplate = pDoc->m_pDocumentTemplate; - ViewAssociation *pVA = NULL; ! for(unsigned int n=0; n<pTemplate->m_ViewInfoArray.GetCount(); n++) { ! if(pTemplate->m_ViewInfoArray[n].ID == nDocViewID) ! pVA = &(pTemplate->m_ViewInfoArray[n]); ! } ! if(pVA==NULL) return NULL; ! pView = (View*)pVA->pClassInfo->CreateObject(); ! pView->m_pViewAssociation = pVA; pView->m_pDocument = NULL; if(pDoc!=NULL) pDoc->AttachView(pView); - pView->Create(m_pDefaultViewContainer, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); pView->Hide(); pView->OnCreate(); pView->Show(); ! m_ViewArray.Add(pView); return pView; } // Ferme la vue spécifiée. bool DocManager::CloseView(View *pView) --- 272,333 ---- // Crée une vue ! View* DocManager::CreateView(Document *pDoc, unsigned int nViewIndex) { View *pView = NULL; DocTemplate *pTemplate = pDoc->m_pDocumentTemplate; ! pView = pTemplate->GetViewTemplate(nViewIndex).CreateObject(); ! if(pView==NULL) ! return NULL; ! ! if(!m_ViewManager.Register(pView)) { ! delete pView; return NULL; + } ! pView->m_pViewTemplate = &pTemplate->GetViewTemplate(nViewIndex); pView->m_pDocument = NULL; if(pDoc!=NULL) pDoc->AttachView(pView); pView->Create(m_pDefaultViewContainer, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); pView->Hide(); pView->OnCreate(); pView->Show(); ! return pView; ! } + /** Crée une vue. + * Crée une vue correspondant au patron de vue spécifié et l'attache au document précisé. + * @param pDoc Document auquel attacher la vue. + * @param pViewTemp Indice de la vue correspondant au patron du type de document. + * @return Adresse de la nouvelle vue, -1 si erreur. + */ + View* DocManager::CreateView(Document *pDoc, ViewTemplate* pViewTemp) + { + View *pView = NULL; + + pView = pViewTemp->CreateObject(); + if(pView==NULL) + return NULL; + + if(!m_ViewManager.Register(pView)) + { + delete pView; + return NULL; + } + + pView->m_pViewTemplate = pViewTemp; + pView->m_pDocument = NULL; + if(pDoc!=NULL) + pDoc->AttachView(pView); + pView->Create(m_pDefaultViewContainer, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); + pView->Hide(); + pView->OnCreate(); + pView->Show(); return pView; } + // Ferme la vue spécifiée. bool DocManager::CloseView(View *pView) *************** *** 356,360 **** Document *pDoc = pView->GetDocument(); ! // On s'assure que le document peut etre fermé si s'est la dernière vue. if(pDoc->m_ViewArray.GetCount()==1) { --- 335,339 ---- Document *pDoc = pView->GetDocument(); ! // On s'assure que le document peut être fermé si s'est la dernière vue. if(pDoc->m_ViewArray.GetCount()==1) { *************** *** 384,440 **** pView->GetDocument()->DetachView(pView); - // Détache la vue de la liste des vues du DocManager. - m_ViewArray.Remove(pView); - // Destruction de la vue. ! pView->GetFrame()->DeleteView(pView); ! } ! ! ! /** ! * Manipulation des minidocuments et des minivues. ! */ ! ! // Crée une MiniVue ! MiniView* DocManager::CreateMiniView(FilePath strSourcePath, wxWindow* pParent, wxWindowID id) ! { ! DocTemplate *pDocTemplate = GetDocTemplate(GetDocTemplateID(strSourcePath.GetFileExt())); ! Archive *pArchive = NULL; ! MiniView *pMiniView = NULL; ! MiniDoc *pMiniDoc = NULL; ! wxClassInfo *pMiniDocCI = NULL; ! ! if(pDocTemplate!=NULL) ! if((pMiniDocCI = pDocTemplate->GetMiniDocClassInfo())!=NULL) ! { ! /** Création du mini-doc si aucun n'existe.*/ ! if((pMiniDoc=GetMiniDoc(strSourcePath))==NULL) ! { ! if((pArchive = wxGetApp().CreateDocumentArchive(strSourcePath, Archive::read))==NULL) ! return NULL; ! pMiniDoc = (MiniDoc*) pMiniDocCI->CreateObject(); ! pMiniDoc->m_strDocFilePath = strSourcePath; ! if(!pMiniDoc->OnInitialize(pArchive)) ! { ! delete pMiniDoc; ! return NULL; ! } ! m_MiniDocArray.Add(pMiniDoc); ! } ! /** Création de la mini-vue.*/ ! pMiniView = pMiniDoc->CreateMiniView(pParent, id); ! pMiniView->SetTitle(strSourcePath); ! pMiniView->m_pMiniDoc = pMiniDoc; ! } ! return pMiniView; ! } ! // Retourne le mini-doc si celui si existe. ! MiniDoc* DocManager::GetMiniDoc(FilePath strDocPath) ! { ! for(int i=0; i<(int)m_MiniDocArray.GetCount(); i++) ! if(m_MiniDocArray[i]->GetFilePath()==strDocPath) ! return m_MiniDocArray[i]; ! return NULL; } --- 363,371 ---- pView->GetDocument()->DetachView(pView); // Destruction de la vue. ! pView->GetFrame()->RemoveView(pView); ! // Désenregistre la vue (désinscrit la vue, la finalize et la détruit). ! m_ViewManager.Unregister(pView); } *************** *** 448,452 **** wxString DocManager::GetAllWildcard(bool bShowStarDotStar, bool bShowAllRegisteredExt)const { ! int i, j; wxString strWild; strWild.Empty(); --- 379,383 ---- wxString DocManager::GetAllWildcard(bool bShowStarDotStar, bool bShowAllRegisteredExt)const { ! unsigned int m, n; wxString strWild; strWild.Empty(); *************** *** 454,477 **** if(bShowAllRegisteredExt) { ! strWild = wxString(WXDC_FILE_WILDCARD_ALLREGISTERED) + "|"; ! for(i=0; i<(int)GetDocTemplateCount(); i++) { ! for(j=0; j<(int)m_DocTemplateArray[i]->GetExtensionCount(); j++) { ! strWild += "*." + m_DocTemplateArray[i]->GetExtension(j) + ";"; } } strWild.RemoveLast(); ! strWild += "|"; } ! for(i=0; i<(int)GetDocTemplateCount(); i++) { ! strWild += m_DocTemplateArray[i]->GetDocWildcard(false); } if(bShowStarDotStar) { ! strWild += wxString(WXDC_FILE_WILDCARD_ALLFILE) + "|*.*|"; } return strWild; --- 385,408 ---- if(bShowAllRegisteredExt) { ! strWild = wxString(WXDC_FILE_WILDCARD_ALLREGISTERED) + wxT("|"); ! for(m=0; m<GetDocTemplateCount(); m++) { ! for(n=0; n<GetDocTemplate(m).GetExtensionCount(); n++) { ! strWild += wxT("*.") + GetDocTemplate(m).GetExtension(n) + wxT(";"); } } strWild.RemoveLast(); ! strWild += wxT("|"); } ! for(m=0; m<GetDocTemplateCount(); m++) { ! strWild += GetDocTemplate(m).GetDocWildcard(false); } if(bShowStarDotStar) { ! strWild += wxString(WXDC_FILE_WILDCARD_ALLFILE) + wxT("|*.*|"); } return strWild; *************** *** 483,491 **** wxImageList* DocManager::GetImageList(int iSize) { ! wxImageList * pIL = new wxImageList(iSize, iSize, true, g_nDocIdentCount); ! for(unsigned int n=0; n<g_nDocIdentCount; n++) { ! wxIconBundle IB = wxGetApp().LoadAppIconBundle(m_arIconNames[n]); pIL->Add(IB.GetIcon(iSize)); } --- 414,422 ---- wxImageList* DocManager::GetImageList(int iSize) { ! wxImageList * pIL = new wxImageList(iSize, iSize, true, GetDocTemplateCount()); ! for(unsigned int n=0; n<GetDocTemplateCount(); n++) { ! wxIconBundle IB = wxGetApp().LoadAppIconBundle(GetDocTemplate(n).GetViewTemplate(0).strIcons); pIL->Add(IB.GetIcon(iSize)); } *************** *** 494,515 **** // Retourne le bundle d'icones associé à un identifiant de type de document. ! wxIconBundle* DocManager::GetIconBundle(unsigned int ID) { ! if(m_arIconBundle.GetCount()<=ID) ! m_arIconBundle.Add(NULL, ID - m_arIconBundle.GetCount() + 1); ! if(m_arIconNames.GetCount()<=ID) ! m_arIconNames.Add("", ID - m_arIconBundle.GetCount() + 1); ! ! if(m_arIconNames[ID].IsEmpty()) ! return NULL; ! else ! { ! if(m_arIconBundle[ID]==NULL) ! { ! wxIconBundle IB = wxGetApp().LoadAppIconBundle(m_arIconNames[ID]); ! m_arIconBundle[ID] = new wxIconBundle(IB); ! } ! return m_arIconBundle[ID]; ! } } --- 425,431 ---- // Retourne le bundle d'icones associé à un identifiant de type de document. ! wxIconBundle* DocManager::GetIconBundle(unsigned int nDocType, unsigned int nViewType) { ! return new wxIconBundle(wxGetApp().LoadAppIconBundle(GetDocTemplate(nDocType).GetViewTemplate(nViewType).strIcons)); } Index: MainFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MainFrame.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MainFrame.cpp 25 Feb 2005 20:58:04 -0000 1.6 --- MainFrame.cpp 16 Mar 2005 14:27:37 -0000 1.7 *************** *** 29,33 **** #include <wxDevCenter/MDIFrame.h> #include <wxDevCenter/FileSystem.h> - #include <wxDevCenter/DocManager.h> #include <wxDevCenter/DocView.h> --- 29,32 ---- *************** *** 316,321 **** if(pActiveView!=NULL) { ! View *pNewView = wxGetApp().GetDocManager().CreateView(pActiveView->GetDocument(), pActiveView->GetViewAssociation()->ID); ! pActiveView->GetDocument()->AttachView(pNewView); AddView(pNewView); pNewView->OnInitialUpdate(); --- 315,319 ---- if(pActiveView!=NULL) { ! View *pNewView = wxGetApp().GetDocManager().CreateView(pActiveView->GetDocument(), pActiveView->GetViewTemplate()); AddView(pNewView); pNewView->OnInitialUpdate(); *************** *** 330,334 **** { Document *pDoc = pActiveView->GetDocument(); ! int iTypeView = wxGetApp().GetDocManager().ChooseViewType(pDoc->GetDocTemplate()->GetDocType()); if(iTypeView!=-1) { --- 328,332 ---- { Document *pDoc = pActiveView->GetDocument(); ! int iTypeView = wxGetApp().GetDocManager().ChooseViewType(wxGetApp().GetDocManager().FindTemplate(pDoc->GetDocTemplate())); if(iTypeView!=-1) { *************** *** 366,370 **** void MainFrame::OnUpdateWhenHasDoc(wxUpdateUIEvent &event) { ! event.Enable(wxGetApp().GetDocManager().GetDocCount()!=0); } --- 364,368 ---- void MainFrame::OnUpdateWhenHasDoc(wxUpdateUIEvent &event) { ! event.Enable(wxGetApp().GetDocManager().GetDocumentCount()!=0); } *************** *** 456,460 **** { InsertViewMenu(pNewView); ! SetIcons(*(wxGetApp().GetDocManager().GetIconBundle(pNewView->GetViewAssociation()->ID))); str.Append(WXDC_NAME).Append(wxT(" - ")).Append(pNewView->GetDocument()->GetDocumentName()); if(pNewView->GetDocument()->GetModifiedFlag()) --- 454,458 ---- { InsertViewMenu(pNewView); ! SetIcons(wxGetApp().LoadAppIconBundle(pNewView->GetViewTemplate()->strIcons)); str.Append(WXDC_NAME).Append(wxT(" - ")).Append(pNewView->GetDocument()->GetDocumentName()); if(pNewView->GetDocument()->GetModifiedFlag()) Index: Project.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Project.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Project.cpp 4 Mar 2005 16:09:46 -0000 1.3 --- Project.cpp 16 Mar 2005 14:27:37 -0000 1.4 *************** *** 36,40 **** */ Project::Project(): ! wxObject(), m_strName(""), m_strPath(""), --- 36,40 ---- */ Project::Project(): ! ManagedObject(), m_strName(""), m_strPath(""), *************** *** 86,94 **** */ ProjectTemplate::ProjectTemplate(wxClassInfo* pProjectClassInfo, wxString strName, wxString strDescript, wxString strIcon, wxString strExt): ! wxObject(), ! m_strName(strName), ! m_strDescript(strDescript), ! m_strIcon(strIcon), ! m_pProjectClassInfo(pProjectClassInfo) { if(!strExt.IsEmpty()) --- 86,91 ---- */ ProjectTemplate::ProjectTemplate(wxClassInfo* pProjectClassInfo, wxString strName, wxString strDescript, wxString strIcon, wxString strExt): ! ObjectTemplate<Project>(pProjectClassInfo, strName, strDescript), ! m_strIcon(strIcon) { if(!strExt.IsEmpty()) *************** *** 121,129 **** } ! // Crée un objet projet. ! Project* ProjectTemplate::CreateProject() ! { ! return (Project*)m_pProjectClassInfo->CreateObject(); ! } --- 118,126 ---- } ! //// Crée un objet projet. ! //Project* ProjectTemplate::CreateProject() ! //{ ! // return (Project*)m_pProjectClassInfo->CreateObject(); ! //} *************** *** 136,140 **** ProjectTemplate(pProjectClassInfo, strName, strDescript, strIcon, strExt) { ! wxGetApp().GetProjectManager().RegisterProjectType(this); } --- 133,137 ---- ProjectTemplate(pProjectClassInfo, strName, strDescript, strIcon, strExt) { ! wxGetApp().GetProjectManager().RegisterTemplate(this); } *************** *** 146,151 **** // Constructeur par défaut. ProjectManager::ProjectManager(): ! ProjectTemplateArray(), ! m_pCurrentProject(NULL) { } --- 143,147 ---- // Constructeur par défaut. ProjectManager::ProjectManager(): ! SingleObjectTemplateManager<Project, ProjectTemplate>() { } *************** *** 157,170 **** } - // Initialisation du gestionnaire. - void ProjectManager::Initialize() - { - } - // Finalisation du gestionnaire. void ProjectManager::Finalize() { ! for(unsigned int n=0; n<GetProjectTemplateCount(); n++) ! GetProjectTemplate(n)->Finalize(); } --- 153,161 ---- } // Finalisation du gestionnaire. void ProjectManager::Finalize() { ! for(unsigned int n=0; n<GetTemplateCount(); n++) ! GetTemplate(n).Finalize(); } *************** *** 176,187 **** { // Préfermeture. ! if(!m_pCurrentProject->CanCloseProject() && !bForce) return false; // Fermeture. ! if(!m_pCurrentProject->OnCloseProject() && !bForce) return false; // Destruction. ! delete m_pCurrentProject; ! m_pCurrentProject = NULL; } return true; --- 167,177 ---- { // Préfermeture. ! if(!GetProject().CanCloseProject() && !bForce) return false; // Fermeture. ! if(!GetProject().OnCloseProject() && !bForce) return false; // Destruction. ! DestroyCurrentObject(); } return true; *************** *** 201,207 **** return false; ! m_pCurrentProject = GetProjectTemplate(iTemplateIndex)->CreateProject(); ! if(m_pCurrentProject) { // Appelle de le chargement du projet. --- 191,197 ---- return false; ! CreateObject(iTemplateIndex); ! if(HasObject()) { // Appelle de le chargement du projet. *************** *** 209,213 **** if(pAr!=NULL) { ! if(m_pCurrentProject->OnOpenProject(*pAr)) { delete pAr; --- 199,203 ---- if(pAr!=NULL) { ! if(GetProject().OnOpenProject(*pAr)) { delete pAr; *************** *** 215,219 **** } } ! delete m_pCurrentProject; } return false; --- 205,209 ---- } } ! DestroyCurrentObject(); } return false; *************** *** 226,234 **** { // Appelle de le chargement du projet. ! FilePath path = m_pCurrentProject->GetPath(); Archive* pAr = wxGetApp().CreateDocumentArchive(path, Archive::write); if(pAr!=NULL) { ! if(m_pCurrentProject->OnSaveProject(*pAr)) { delete pAr; --- 216,224 ---- { // Appelle de le chargement du projet. ! FilePath path = GetProject().GetPath(); Archive* pAr = wxGetApp().CreateDocumentArchive(path, Archive::write); if(pAr!=NULL) { ! if(GetProject().OnSaveProject(*pAr)) { delete pAr; *************** *** 253,262 **** return false; ! m_pCurrentProject = GetProjectTemplate(iTemplateIndex)->CreateProject(); // Appelle de l'initialisation du projet. ! if(!m_pCurrentProject->OnCreateProject()) { ! delete m_pCurrentProject; return false; } --- 243,252 ---- return false; ! CreateObject(iTemplateIndex); // Appelle de l'initialisation du projet. ! if(!GetProject().OnCreateProject()) { ! DestroyCurrentObject(); return false; } *************** *** 265,291 **** } - // Accès à l'index d'un type de projet. - int ProjectManager::GetProjectTemplateIndex(const ProjectTemplate* pTemplate) - { - for(unsigned int n=0; n<GetCount(); n++) - if(Item(n)==pTemplate) - return n; - return -1; - } - - // Enregistre un type de projet. - bool ProjectManager::RegisterProjectType(ProjectTemplate* pTemplate) - { - if(GetProjectTemplateIndex(pTemplate)==-1) - { - if(pTemplate->Initialize()) - { - Add(pTemplate); - return true; - } - } - return false; - } - // Retourne le wildcard de tous les types de projets. wxString ProjectManager::GetAllWildcard(bool bShowStarDotStar, bool bShowAllRegisteredExt)const --- 255,258 ---- *************** *** 298,306 **** { strWild = wxString(WXDC_FILE_WILDCARD_ALLREGISTERED) + wxT("|"); ! for(m=0; m<GetCount(); m++) { ! for(n=0; n<GetProjectTemplate(m)->GetExtensionCount(); n++) { ! strWild << wxT("*.") << GetProjectTemplate(m)->GetExtension(n) << wxT(";"); } } --- 265,273 ---- { strWild = wxString(WXDC_FILE_WILDCARD_ALLREGISTERED) + wxT("|"); ! for(m=0; m<GetTemplateCount(); m++) { ! for(n=0; n<GetTemplate(m).GetExtensionCount(); n++) { ! strWild << wxT("*.") << GetTemplate(m).GetExtension(n) << wxT(";"); } } *************** *** 309,314 **** } ! for(n=0; n<GetCount(); n++) ! strWild << GetProjectTemplate(n)->GetDocWildcard(false); if(bShowStarDotStar) --- 276,281 ---- } ! for(n=0; n<GetTemplateCount(); n++) ! strWild << GetTemplate(n).GetDocWildcard(false); if(bShowStarDotStar) *************** *** 321,326 **** { wxArrayString ar; ! for(unsigned int n=0; n<GetProjectTemplateCount(); n++) ! ar.Add(GetProjectTemplate(n)->GetName() + wxT(" - ") + GetProjectTemplate(n)->GetDescript()); return wxGetSingleChoiceIndex(WXDC_PROJECT_QUERY_TYPE, WXDC_NAME, ar); } --- 288,293 ---- { wxArrayString ar; ! for(unsigned int n=0; n<GetTemplateCount(); n++) ! ar.Add(GetTemplate(n).GetName() + wxT(" - ") + GetTemplate(n).GetDescript()); return wxGetSingleChoiceIndex(WXDC_PROJECT_QUERY_TYPE, WXDC_NAME, ar); } *************** *** 330,336 **** { wxString strExt = strFile.GetFileExt(); ! for(unsigned int n=0; n<GetProjectTemplateCount(); n++) ! for(unsigned int m=0; m<GetProjectTemplate(n)->GetExtensionCount(); m++) ! if(strExt==GetProjectTemplate(n)->GetExtension(m)) return (int)n; return -1; --- 297,303 ---- { wxString strExt = strFile.GetFileExt(); ! for(unsigned int n=0; n<GetTemplateCount(); n++) ! for(unsigned int m=0; m<GetTemplate(n).GetExtensionCount(); m++) ! if(strExt==GetTemplate(n).GetExtension(m)) return (int)n; return -1; Index: Application.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Application.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Application.cpp 10 Mar 2005 16:04:34 -0000 1.16 --- Application.cpp 16 Mar 2005 14:27:36 -0000 1.17 *************** *** 62,66 **** // Initialise le DocManager ! m_DocManager.InitDocManager(); // Initialise le ProjectManager --- 62,66 ---- // Initialise le DocManager ! m_DocManager.Initialize(); // Initialise le ProjectManager *************** *** 76,81 **** // Initialise le gestionnaire de systèmes de fichiers m_pStandardFileSystem = new FileSystemStandard; ! wxIconBundle IB = LoadAppIconBundle("desktop"); ! m_FileSystemManager.RegisterFileSystem(m_pStandardFileSystem, WXDC_SYSTEM_STDFS_NAME, IB); // Crée la fenetre principale --- 76,80 ---- // Initialise le gestionnaire de systèmes de fichiers m_pStandardFileSystem = new FileSystemStandard; ! m_FileSystemManager.Register(m_pStandardFileSystem); // Crée la fenetre principale *************** *** 143,147 **** if(iProjectType==wxNOT_FOUND // Pas de sélection de type || iProjectType==0 // "Tous les types enregistrés" ! || iProjectType==(int)m_ProjectManager.GetProjectTemplateCount()) // "*.*" iProjectType = -1; --- 142,146 ---- if(iProjectType==wxNOT_FOUND // Pas de sélection de type || iProjectType==0 // "Tous les types enregistrés" ! || iProjectType==(int)m_ProjectManager.GetTemplateCount()) // "*.*" iProjectType = -1; *************** *** 218,222 **** if(nDocView==-1) { ! if(m_DocManager.GetDocTemplate(nDocType)->GetViewCount()>1) { nDocView = m_DocManager.ChooseViewType(nDocType); --- 217,221 ---- if(nDocView==-1) { ! if(m_DocManager.GetDocTemplate(nDocType).GetViewTemplateCount()>1) { nDocView = m_DocManager.ChooseViewType(nDocType); *************** *** 225,229 **** } else ! nDocView = nDocType; } --- 224,228 ---- } else ! nDocView = 0; } *************** *** 267,271 **** if(pDoc!=NULL) { ! pView = pDoc->m_ViewArray[0]; pView->GetFrame()->ScrollToView(pView); return true; --- 266,270 ---- if(pDoc!=NULL) { ! pView = &(pDoc->m_ViewArray[0]); pView->GetFrame()->ScrollToView(pView); return true; *************** *** 278,282 **** if(iDocType==-1) { ! iDocType = m_DocManager.GetDocTemplateID(strExt); } --- 277,281 ---- if(iDocType==-1) { ! iDocType = m_DocManager.GetDocTemplateFromExt(strExt); } *************** *** 288,293 **** // Détermine le type de vue. ! if(m_DocManager.GetDocTemplate((unsigned int)iDocType)->GetViewCount()<2) ! nDocView = iDocType; else nDocView = m_DocManager.ChooseViewType(iDocType); --- 287,292 ---- // Détermine le type de vue. ! if(m_DocManager.GetDocTemplate((unsigned int)iDocType).GetViewTemplateCount()<2) ! nDocView = 0; else nDocView = m_DocManager.ChooseViewType(iDocType); *************** *** 325,332 **** iDocType = -1; - // On transforme l'index du wildcard en identifiant de type de document (ID ET PAS INDEX). - if(iDocType!=-1) - iDocType = GetDocManager().DocTemplateIDFromIndex((unsigned int)iDocType-1); - wxArrayString files; FD.GetSelectedFileList(files); --- 324,327 ---- Index: Document.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Document.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Document.cpp 15 Jan 2005 09:47:22 -0000 1.3 --- Document.cpp 16 Mar 2005 14:27:37 -0000 1.4 *************** *** 25,29 **** #include <wxDevCenter/DocView.h> - #include <wxDevCenter/DocManager.h> #include <wxDevCenter/FileSystem.h> #include <wxDevCenter/FileTools.h> --- 25,28 ---- *************** *** 77,81 **** unsigned int i; for(i=0; i<m_ViewArray.GetCount(); i++) ! m_ViewArray[i]->OnChangeFilename(); } --- 76,80 ---- unsigned int i; for(i=0; i<m_ViewArray.GetCount(); i++) ! m_ViewArray[i].OnChangeFilename(); } *************** *** 103,108 **** for(i=0; i<m_ViewArray.GetCount(); i++) { ! if(m_ViewArray[i]!=pSender) ! m_ViewArray[i]->OnUpdate(pSender, nUpdateCode, pUpdateInfo); } } --- 102,107 ---- for(i=0; i<m_ViewArray.GetCount(); i++) { ! if(&m_ViewArray[i]!=pSender) ! m_ViewArray[i].OnUpdate(pSender, nUpdateCode, pUpdateInfo); } } *************** *** 114,118 **** pView->m_pDocument->DetachView(pView); pView->m_pDocument = this; ! m_ViewArray.Add(pView); } --- 113,117 ---- pView->m_pDocument->DetachView(pView); pView->m_pDocument = this; ! m_ViewArray.Register(pView); } *************** *** 120,145 **** void Document::DetachView(View *pView) { ! m_ViewArray.Remove(pView); pView->m_pDocument = NULL; } - // Supprime la vue de la liste des vues (la détruit et enlève le pointeur) - void Document::DeleteView(View *pView) - { - m_ViewArray.Remove(pView); - pView->Destroy(); - } - - // Supprime toutes les vues de la liste des vues (les détruit et enlève les pointeurs) - void Document::DeleteAllViews() - { - for(int i=m_ViewArray.GetCount()-1; i>=0; i--) - { - m_ViewArray[i]->Destroy(); - } - m_ViewArray.Clear(); - } - - ////////////////////////////////////////////////////////////////////// // Processus de sérialisation du document --- 119,126 ---- void Document::DetachView(View *pView) { ! m_ViewArray.Unregister(pView); pView->m_pDocument = NULL; } ////////////////////////////////////////////////////////////////////// // Processus de sérialisation du document --- NEW FILE: Manager.cpp --- (This appears to be a binary file; contents omitted.) Index: FileSystemStandard.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemStandard.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** FileSystemStandard.cpp 7 Mar 2005 15:23:04 -0000 1.13 --- FileSystemStandard.cpp 16 Mar 2005 14:27:37 -0000 1.14 *************** *** 52,60 **** } - wxImageList* FileSystemStandardBase::GetImageList(int width) - { - return wxGetApp().GetDocManager().GetImageList(width); - } - int FileSystemStandardBase::GetFileType(const FilePath& strPath) { --- 52,55 ---- *************** *** 66,76 **** else { ! type = wxGetApp().GetDocManager().GetDocTemplateID(strPath.GetFileExt()); ! if(type==-1) ! type = WXDC_DOCMANAGER_TYPE_UNKNOW; } return type; } ////////////////////////////////////////////////////////////////////// --- 61,111 ---- else { ! type = wxGetApp().GetDocManager().GetDocTemplateFromExt(strPath.GetFileExt()); ! if(type!=-1) ! type += WXDC_STDFS_FILETYPES; ! else ! type = WXDC_STDFS_UNKNOW; } return type; } + wxImageList* FileSystemStandardBase::GetImageList(int width) + { + wxImageList* pIL = new wxImageList(width, width, true, WXDC_STDFS_FILETYPES + wxGetApp().GetDocManager().GetDocTemplateCount()); + + wxIconBundle IB; + IB = wxGetApp().LoadAppIconBundle(wxT("none")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("unknow")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("dir")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("desktop")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("desktop")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("docs")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("computer")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("floppy")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("harddrive")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("cd-dvd")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("ramdisk")); + pIL->Add(IB.GetIcon(width)); + IB = wxGetApp().LoadAppIconBundle(wxT("remote")); + pIL->Add(IB.GetIcon(width)); + + for(unsigned long l=0; l<wxGetApp().GetDocManager().GetDocTemplateCount(); l++) + { + IB = wxGetApp().LoadAppIconBundle(wxGetApp().GetDocManager().GetDocTemplate(l).GetViewTemplate(0).strIcons); + pIL->Add(IB.GetIcon(width)); + } + return pIL; + } + ////////////////////////////////////////////////////////////////////// |