|
From: Emilien K. <cur...@us...> - 2005-03-15 21:27:50
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29768/src Modified Files: Tag: manager-virtualization Application.cpp DocManager.cpp DocType.cpp Document.cpp FileSystemCtrl.cpp FileSystemStandard.cpp MDIFrame.cpp MainFrame.cpp Project.cpp Log Message: Passage du DocManager et consorts à la nouvelle architecture des gestionnaires. Diverses modifs de l'archi des gestionnaires. Index: DocType.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/DocType.cpp,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** DocType.cpp 7 Dec 2004 13:36:28 -0000 1.2 --- DocType.cpp 15 Mar 2005 21:27:32 -0000 1.2.4.1 *************** *** 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: FileSystemCtrl.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemCtrl.cpp,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** FileSystemCtrl.cpp 8 Mar 2005 18:46:25 -0000 1.6.2.1 --- FileSystemCtrl.cpp 15 Mar 2005 21:27:32 -0000 1.6.2.2 *************** *** 26,30 **** #include <wxDevCenter/FileSystem.h> - #include <wxDevCenter/DocManager.h> #include <wx/toolbar.h> --- 26,29 ---- Index: DocManager.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/DocManager.cpp,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** DocManager.cpp 7 Mar 2005 15:23:03 -0000 1.7 --- DocManager.cpp 15 Mar 2005 21:27:32 -0000 1.7.2.1 *************** *** 23,29 **** #include <wxDevCenter.h> - #include <wxDevCenter/DocManager.h> #include <wxDevCenter/DocView.h> - #include <wxDevCenter/DocManager.h> #include <wxDevCenter/MDIFrame.h> --- 23,27 ---- *************** *** 33,38 **** - WX_DEFINE_OBJARRAY(ViewInfoArray); - /** Compteur d'identifiants. * Compteur servant à créer des identifiants uniques pour les types de documents et de vues.*/ --- 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); --- 45,51 ---- // 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) { --- 56,59 ---- *************** *** 91,95 **** str += "*." + GetExtension(i) + ";"; str.RemoveLast(); ! strWildcard = m_strDocName + " (" + str + ")|" + str; if(bShowStarDotStar) strWildcard += "|" + wxString(WXDC_FILE_WILDCARD_ALLFILE) + "|*.*"; --- 71,75 ---- str += "*." + GetExtension(i) + ";"; str.RemoveLast(); ! strWildcard = GetName() + " (" + str + ")|" + str; if(bShowStarDotStar) strWildcard += "|" + wxString(WXDC_FILE_WILDCARD_ALLFILE) + "|*.*"; *************** *** 102,106 **** // DocManager ! DocManager::DocManager(void) { --- 82,89 ---- // 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"); - } - - /** --- 94,97 ---- *************** *** 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; } --- 101,126 ---- // 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; } --- 135,139 ---- // 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; } --- 145,151 ---- 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; } --- 166,171 ---- // 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; } --- 176,241 ---- // 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()) --- 243,247 ---- 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); } --- 261,274 ---- 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) --- 281,342 ---- // 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) { --- 344,348 ---- 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,392 **** 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); } --- 372,380 ---- 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); } *************** *** 396,441 **** */ ! // 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; ! } --- 384,429 ---- */ ! //// Crée une MiniVue ! //MiniView* DocManager::CreateMiniView(FilePath strSourcePath, wxWindow* pParent, wxWindowID id) ! //{ ! // DocTemplate *pDocTemplate = &GetDocTemplate(GetDocTemplateFromExt(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; ! // } ! // pDocTemplate->m_pMiniDoc = 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(unsigned int n=0; n<GetDocTemplateCount(); n++) ! // if(GetDocTemplate(n).GetFilePath()==strDocPath) ! // return m_MiniDocArray[i]; ! // return NULL; ! //} *************** *** 448,452 **** wxString DocManager::GetAllWildcard(bool bShowStarDotStar, bool bShowAllRegisteredExt)const { ! int i, j; wxString strWild; strWild.Empty(); --- 436,440 ---- 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; --- 442,465 ---- if(bShowAllRegisteredExt) { ! strWild = wxString(WXDC_FILE_WILDCARD_ALLREGISTERED) + wxT("|"); ! for(m=0; m<GetDocTemplateCount(); m++) { ! for(n=0; n<GetDocTemplate(n).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)); } --- 471,479 ---- 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]; ! } } --- 482,488 ---- // 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.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** MainFrame.cpp 25 Feb 2005 20:58:04 -0000 1.6 --- MainFrame.cpp 15 Mar 2005 21:27:32 -0000 1.6.2.1 *************** *** 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: MDIFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MDIFrame.cpp,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** MDIFrame.cpp 12 Jan 2005 13:50:55 -0000 1.2 --- MDIFrame.cpp 15 Mar 2005 21:27:32 -0000 1.2.4.1 *************** *** 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: Application.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Application.cpp,v retrieving revision 1.15.2.2 retrieving revision 1.15.2.3 diff -C2 -d -r1.15.2.2 -r1.15.2.3 *** Application.cpp 8 Mar 2005 18:46:24 -0000 1.15.2.2 --- Application.cpp 15 Mar 2005 21:27:32 -0000 1.15.2.3 *************** *** 60,64 **** // Initialise le DocManager ! m_DocManager.InitDocManager(); // Initialise le ProjectManager --- 60,64 ---- // Initialise le DocManager ! m_DocManager.Initialize(); // Initialise le ProjectManager *************** *** 215,219 **** if(nDocView==-1) { ! if(m_DocManager.GetDocTemplate(nDocType)->GetViewCount()>1) { nDocView = m_DocManager.ChooseViewType(nDocType); --- 215,219 ---- if(nDocView==-1) { ! if(m_DocManager.GetDocTemplate(nDocType).GetViewTemplateCount()>1) { nDocView = m_DocManager.ChooseViewType(nDocType); *************** *** 222,226 **** } else ! nDocView = nDocType; } --- 222,226 ---- } else ! nDocView = 0; } *************** *** 264,268 **** if(pDoc!=NULL) { ! pView = pDoc->m_ViewArray[0]; pView->GetFrame()->ScrollToView(pView); return true; --- 264,268 ---- if(pDoc!=NULL) { ! pView = &(pDoc->m_ViewArray[0]); pView->GetFrame()->ScrollToView(pView); return true; *************** *** 275,279 **** if(iDocType==-1) { ! iDocType = m_DocManager.GetDocTemplateID(strExt); } --- 275,279 ---- if(iDocType==-1) { ! iDocType = m_DocManager.GetDocTemplateFromExt(strExt); } *************** *** 285,290 **** // Détermine le type de vue. ! if(m_DocManager.GetDocTemplate((unsigned int)iDocType)->GetViewCount()<2) ! nDocView = iDocType; else nDocView = m_DocManager.ChooseViewType(iDocType); --- 285,290 ---- // Détermine le type de vue. ! if(m_DocManager.GetDocTemplate((unsigned int)iDocType).GetViewTemplateCount()<2) ! nDocView = 0; else nDocView = m_DocManager.ChooseViewType(iDocType); *************** *** 322,329 **** 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); --- 322,325 ---- Index: Project.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Project.cpp,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** Project.cpp 8 Mar 2005 17:26:28 -0000 1.3.2.1 --- Project.cpp 15 Mar 2005 21:27:32 -0000 1.3.2.2 *************** *** 153,161 **** } - // Initialisation du gestionnaire. - void ProjectManager::Initialize() - { - } - // Finalisation du gestionnaire. void ProjectManager::Finalize() --- 153,156 ---- Index: Document.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Document.cpp,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** Document.cpp 15 Jan 2005 09:47:22 -0000 1.3 --- Document.cpp 15 Mar 2005 21:27:32 -0000 1.3.4.1 *************** *** 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 Index: FileSystemStandard.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemStandard.cpp,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** FileSystemStandard.cpp 7 Mar 2005 15:23:04 -0000 1.13 --- FileSystemStandard.cpp 15 Mar 2005 21:27:32 -0000 1.13.2.1 *************** *** 52,60 **** } - wxImageList* FileSystemStandardBase::GetImageList(int width) - { - return wxGetApp().GetDocManager().GetImageList(width); - } - int FileSystemStandardBase::GetFileType(const FilePath& strPath) { --- 52,55 ---- *************** *** 66,70 **** else { ! type = wxGetApp().GetDocManager().GetDocTemplateID(strPath.GetFileExt()); if(type==-1) type = WXDC_DOCMANAGER_TYPE_UNKNOW; --- 61,65 ---- else { ! type = WXDC_FS_DIRTYPE_NB + wxGetApp().GetDocManager().GetDocTemplateFromExt(strPath.GetFileExt()); if(type==-1) type = WXDC_DOCMANAGER_TYPE_UNKNOW; *************** *** 73,76 **** --- 68,109 ---- } + wxImageList* FileSystemStandardBase::GetImageList(int width) + { + wxImageList* pIL = new wxImageList(width, width, true, WXDC_FS_DIRTYPE_NB + 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; + } + ////////////////////////////////////////////////////////////////////// |