|
From: Emilien K. <cur...@us...> - 2005-01-15 14:05:48
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22486/src Modified Files: Application.cpp FileSystemCtrl.cpp Log Message: Choix du type de document selon le choix de filtrage de la boite de dialogue à l'ouverture. Si "Tous document enregistrés" ou "*.*" est choisi, alors l'extension est utilisé pour reconnaitre le document. Index: FileSystemCtrl.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemCtrl.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileSystemCtrl.cpp 12 Jan 2005 17:40:25 -0000 1.4 --- FileSystemCtrl.cpp 15 Jan 2005 14:05:17 -0000 1.5 *************** *** 782,785 **** --- 782,792 ---- + // Retourne l'index du filtre sélectionné. + int FileSystemDialog::GetFilterIndex() + { + return m_pWildChoice->GetSelection(); + } + + // Intercepte le chngement de wildcard. void FileSystemDialog::OnChoice(wxCommandEvent& event) Index: Application.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Application.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Application.cpp 12 Jan 2005 17:35:05 -0000 1.6 --- Application.cpp 15 Jan 2005 14:05:17 -0000 1.7 *************** *** 230,234 **** // Ouvre un document (depuis un fichier ou le package selon la source spécifiée). // Retourne false si l'ouverture à échouée. ! bool Application::OpenDocument(FilePath &strPath) { wxString strProtocol, strExt; --- 230,234 ---- // Ouvre un document (depuis un fichier ou le package selon la source spécifiée). // Retourne false si l'ouverture à échouée. ! bool Application::OpenDocument(FilePath &strPath, int iDocType) { wxString strProtocol, strExt; *************** *** 256,263 **** ! int nDocType, nDocView; ! nDocType = m_DocManager.GetDocTemplateID(strExt); ! if(nDocType==-1) { wxMessageBox(WXDC_ERROR_FILEEXTNOTREGISTERED); --- 256,268 ---- ! int nDocView; ! // Détermine le type de document si non précisé. ! if(iDocType==-1) ! { ! iDocType = m_DocManager.GetDocTemplateID(strExt); ! } ! ! if(iDocType==-1) { wxMessageBox(WXDC_ERROR_FILEEXTNOTREGISTERED); *************** *** 265,275 **** } ! if(m_DocManager.GetDocTemplate((unsigned int)nDocType)->GetViewCount()<2) ! nDocView = nDocType; else ! nDocView = m_DocManager.ChooseViewType(nDocType); // Création du document ! pDoc = m_DocManager.CreateDocument(nDocType); // Chargement du document if(!pDoc->OnOpenDocument(strPath)) --- 270,281 ---- } ! // Détermine le type de vue. ! if(m_DocManager.GetDocTemplate((unsigned int)iDocType)->GetViewCount()<2) ! nDocView = iDocType; else ! nDocView = m_DocManager.ChooseViewType(iDocType); // Création du document ! pDoc = m_DocManager.CreateDocument(iDocType); // Chargement du document if(!pDoc->OnOpenDocument(strPath)) *************** *** 296,299 **** --- 302,315 ---- if(FD.ShowModal()==wxID_OK) { + int iDocType = FD.GetFilterIndex(); + if(iDocType==wxNOT_FOUND // Pas de sélection de type + || iDocType==0 // "Tous les types enregistrés" + || iDocType==(int)GetDocManager().GetDocTemplateCount()) // "*.*" + 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); *************** *** 301,305 **** { FilePath path = files[n]; ! OpenDocument(path); } } --- 317,321 ---- { FilePath path = files[n]; ! OpenDocument(path, iDocType); } } |