|
From: Emilien K. <cur...@us...> - 2005-08-17 15:01:15
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4385/src Modified Files: FileSystemListCtrl.cpp FileSystem.cpp FileSystemTreeCtrl.cpp FileSystemCtrl.cpp Log Message: Make all FileSystem controls using FileDescription for manipulating files. Make FileSystemDialog use the default wxBookCtrl instead of wxListbook beacause wxListbook looks buggy on linux. Index: FileSystemTreeCtrl.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemTreeCtrl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileSystemTreeCtrl.cpp 13 Aug 2005 16:27:34 -0000 1.1 --- FileSystemTreeCtrl.cpp 17 Aug 2005 15:01:06 -0000 1.2 *************** *** 26,58 **** using namespace wxDevCenter; ! ////////////////////////////////////////////////////////////////////// ! // ! // FileSystemTreeItemData ! // ! ////////////////////////////////////////////////////////////////////// ! FileSystemTreeItemData::FileSystemTreeItemData(wxString &Path, int iType, int iState): ! wxTreeItemData(), ! m_strPath(Path), ! m_iType(iType), ! m_iState(iState) ! { ! } ! ! wxString FileSystemTreeItemData::GetPath()const ! { ! return m_strPath; ! } ! ! int FileSystemTreeItemData::GetType()const ! { ! return m_iType; ! } ! ! int FileSystemTreeItemData::GetState()const ! { ! return m_iState; ! } ! ! --- 26,30 ---- using namespace wxDevCenter; ! #define WXDC_FSTC_EXPAND_MARKER wxT("...") *************** *** 70,84 **** ! FileSystemTreeCtrl::FileSystemTreeCtrl(wxWindow* parent, wxWindowID id, ! wxDevCenter::FileSystem *pFileSystem, ! const wxPoint& pos, const wxSize& size, long style): wxTreeCtrl(parent, id, pos, size, style), ! m_pFileSystem(pFileSystem), m_nMode(WXDC_FSTC_MODE_NORMAL), m_strRootPath() { - if((m_pFileSystem!=NULL)&&(style&WXDC_FSTC_PROCESS_EVENT)!=0) - PushEventHandler(m_pFileSystem); - SetImageList(m_pFileSystem->GetImageList(WXDC_SETUP_TREE_ICON_SIZE)); } --- 42,51 ---- ! FileSystemTreeCtrl::FileSystemTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style): wxTreeCtrl(parent, id, pos, size, style), ! m_pFileSystem(NULL), m_nMode(WXDC_FSTC_MODE_NORMAL), m_strRootPath() { } *************** *** 103,107 **** } ! void FileSystemTreeCtrl::Open(FilePath strRootPath, unsigned int nMode) { --- 70,74 ---- } ! // Ouvre l'arbre en précisant une racine autre que la base du système de fichiers. void FileSystemTreeCtrl::Open(FilePath strRootPath, unsigned int nMode) { *************** *** 115,120 **** m_strRootPath = strRootPath; m_nMode = nMode; ! SetItemData(Id, new FileSystemTreeItemData( m_strRootPath , CalcItemType(m_strRootPath))); ! AppendItem(Id, "..."); Expand(GetRootItem()); --- 82,87 ---- m_strRootPath = strRootPath; m_nMode = nMode; ! SetItemData(Id, new FileSystemTreeItemData(m_pFileSystem->GetFileDescription(m_strRootPath))); ! AppendItem(Id, WXDC_FSTC_EXPAND_MARKER); Expand(GetRootItem()); *************** *** 125,145 **** } ! void FileSystemTreeCtrl::OpenRoot(unsigned int nMode) { ! wxTreeItemId Id; ! m_nMode = nMode; ! DeleteAllItems(); ! m_strRootPath = m_pFileSystem->GetRootPath(); ! FileSystemTreeItemData *pItemData = new FileSystemTreeItemData(m_strRootPath, CalcItemType(FilePath(m_strRootPath))); ! Id = AddRoot(m_pFileSystem->GetRoot(), pItemData->GetType(), -1, pItemData); ! AppendItem(Id, "..."); ! Expand(GetRootItem()); ! SelectItem(GetRootItem()); } // Etend l'arbre pour afficher le fichier/répertoire demandé. wxTreeItemId FileSystemTreeCtrl::ExpandTo(FilePath strPath) --- 92,142 ---- } + // Interception de l'évènement de déroulement d'une branche. + void FileSystemTreeCtrl::OnTreeItemExpanding(wxTreeEvent &event) + { + RefreshContent(event.GetItem()); + event.Skip(); + } ! // Rafraichi le contenu d'un répertoire. ! void FileSystemTreeCtrl::RefreshContent(wxTreeItemId idItem) { ! FileSystemTreeItemData *pItemData; ! wxTreeItemId NewId; ! wxString FP; ! wxString str; ! ! DeleteChildren(idItem); ! // Insertion des répertoires ! if(m_nMode&WXDC_FSTC_MODE_DIR) ! { ! str = ((FileSystemTreeItemData*)GetItemData(idItem))->GetFilePath(); ! FP = m_pFileSystem->FindFirst( str, wxDIR_DIRS); ! while(FP!="") ! { ! pItemData = new FileSystemTreeItemData(m_pFileSystem->GetCurrentFileDescription()); ! NewId = AppendItem(idItem, FP, pItemData->GetType(), -1, pItemData); ! AppendItem(NewId, WXDC_FSTC_EXPAND_MARKER); ! FP = m_pFileSystem->FindNext(); ! } ! } ! // Insertion des fichiers ! if(m_nMode&WXDC_FSTC_MODE_FILE) ! { ! str = ((FileSystemTreeItemData*)GetItemData(idItem))->GetFilePath(); ! FP = m_pFileSystem->FindFirst( str, wxDIR_FILES); ! while(FP!="") ! { ! pItemData = new FileSystemTreeItemData(m_pFileSystem->GetCurrentFileDescription()); ! NewId = AppendItem(idItem, FP, pItemData->GetType(), -1, pItemData); ! FP = m_pFileSystem->FindNext(); ! } ! } } + // Etend l'arbre pour afficher le fichier/répertoire demandé. wxTreeItemId FileSystemTreeCtrl::ExpandTo(FilePath strPath) *************** *** 164,168 **** while(idChild.IsOk()) { ! FilePath strChildPath = ((FileSystemTreeItemData*) GetItemData(idChild))->GetPath(); if(strPath.StartsWith(strChildPath)) { --- 161,165 ---- while(idChild.IsOk()) { ! FilePath strChildPath = ((FileSystemTreeItemData*) GetItemData(idChild))->GetFilePath(); if(strPath.StartsWith(strChildPath)) { *************** *** 179,188 **** - void FileSystemTreeCtrl::OnTreeItemExpanding(wxTreeEvent &event) - { - RefreshContent(event.GetItem()); - event.Skip(); - } - // Retourne le type associé au chemin spécifié. // Le type retourné est le type étendu (cad type de répertoire pris en compte) --- 176,179 ---- *************** *** 219,264 **** void FileSystemTreeCtrl::OnGetTooltip(wxTreeEvent& event) { ! event.SetToolTip( ((FileSystemTreeItemData*)GetItemData(event.GetItem()))->GetPath() ); } ! // Rafraichi le contenu d'un répertoire. ! void FileSystemTreeCtrl::RefreshContent(wxTreeItemId idItem) { ! FileSystemTreeItemData *pItemData; ! wxTreeItemId NewId; ! wxString FP; ! wxString str; ! DeleteChildren(idItem); - // Insertion des répertoires - if(m_nMode&WXDC_FSTC_MODE_DIR) - { - str = ((FileSystemTreeItemData*)GetItemData(idItem))->GetPath(); - FP = m_pFileSystem->FindFirst( str, wxDIR_DIRS); - while(FP!="") - { - str = m_pFileSystem->GetCurrentFilePath(); - pItemData = new FileSystemTreeItemData(str, CalcItemType(str)); - NewId = AppendItem(idItem, FP, pItemData->GetType(), -1, pItemData); - AppendItem(NewId, "..."); - FP = m_pFileSystem->FindNext(); - } - } - // Insertion des fichiers - if(m_nMode&WXDC_FSTC_MODE_FILE) - { - str = ((FileSystemTreeItemData*)GetItemData(idItem))->GetPath(); - FP = m_pFileSystem->FindFirst( str, wxDIR_FILES); - while(FP!="") - { - str = m_pFileSystem->GetCurrentFilePath(); - pItemData = new FileSystemTreeItemData(str, CalcItemType(str)); - NewId = AppendItem(idItem, FP, pItemData->GetType(), -1, pItemData); - FP = m_pFileSystem->FindNext(); - } - } - } --- 210,246 ---- void FileSystemTreeCtrl::OnGetTooltip(wxTreeEvent& event) { ! event.SetToolTip( ((FileSystemTreeItemData*)GetItemData(event.GetItem()))->GetFilePath() ); } ! ! ! ////////////////////////////////////////////////////////////////////// ! // Barre de travail des systèmes de fichiers automontés. ! ////////////////////////////////////////////////////////////////////// ! ! IMPLEMENT_DYNAMIC_CLASS(FileSystemTreeWorkBar, WorkBar); ! ! // Fonction de création effective de la fenetre. ! bool FileSystemTreeWorkBar::Create(wxWindow* parent) { ! if(m_pExtraObject==NULL) ! return false; ! if(!m_pExtraObject->IsKindOf(CLASSINFO(FileSystem))) ! return false; ! if(!WorkBar::Create(parent)) ! return false; ! ! m_pFSTreeCtrl = new FileSystemTreeCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_ROW_LINES|wxTR_FULL_ROW_HIGHLIGHT|wxTR_ROW_LINES|wxTR_SINGLE|WXDC_FSTC_PROCESS_EVENT); ! wxBoxSizer* pSizer = new wxBoxSizer(wxVERTICAL); ! pSizer->Add(m_pFSTreeCtrl, 1, wxGROW); ! SetSizer(pSizer); ! m_pFSTreeCtrl->SetFileSystem((FileSystem*)m_pExtraObject); ! m_pFSTreeCtrl->OpenRoot(); ! return true; ! } ! Index: FileSystemListCtrl.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemListCtrl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileSystemListCtrl.cpp 13 Aug 2005 16:27:34 -0000 1.1 --- FileSystemListCtrl.cpp 17 Aug 2005 15:01:06 -0000 1.2 *************** *** 38,51 **** // Constructeur. ! FileSystemListCtrl::FileSystemListCtrl(wxWindow* parent, wxWindowID id, FileSystem *pFileSystem, const wxPoint& pos, const wxSize& size, long style): wxListCtrl(parent, id, pos, size, style), ! m_pFileSystem(pFileSystem), m_nMode(WXDC_FSLC_MODE_NORMAL), m_strPath(), m_strWild("*.*") { - SetImageList(m_pFileSystem->GetImageList(WXDC_SETUP_LIST_BIG_ICON_SIZE), wxIMAGE_LIST_NORMAL); - SetImageList(m_pFileSystem->GetImageList(WXDC_SETUP_LIST_LITTLE_ICON_SIZE), wxIMAGE_LIST_SMALL); - OpenRoot(); } --- 38,48 ---- // Constructeur. ! FileSystemListCtrl::FileSystemListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style): wxListCtrl(parent, id, pos, size, style), ! m_pFileSystem(NULL), m_nMode(WXDC_FSLC_MODE_NORMAL), m_strPath(), m_strWild("*.*") { } *************** *** 64,94 **** } - // Supprime tous les éléments de la liste. - bool FileSystemListCtrl::DeleteAllItems() - { - long item =-1; - for(;;) - { - item = GetNextItem(item); - if(item==-1) - break; - delete (wxString*) GetItemData(item); - } - return wxListCtrl::DeleteAllItems(); - } ! // Met à jour la liste. ! void FileSystemListCtrl::UpdateList() { ! DeleteAllItems(); ! ! wxString str = m_pFileSystem->FindFirst(m_strPath, m_nMode&0x0003); ! long item = 0; while(!str.IsEmpty()) { ! FilePath strFilePath = m_pFileSystem->GetCurrentFilePath(); ! ! if(!m_pFileSystem->IsDirectory(strFilePath)) ! if(!FileSystem::TestWildcard(strFilePath, m_strWild)) { str = m_pFileSystem->FindNext(); --- 61,79 ---- } ! // Parcours un répertoire et met en cache son contenu. ! void FileSystemListCtrl::DoCacheDirectory(FilePath strPath, wxString strWild, unsigned int nMode) { ! // Efface le cache. ! m_mapFiles.clear(); ! ! // Parcours le répertoire ! wxString str = m_pFileSystem->FindFirst(strPath, nMode&0x0003); while(!str.IsEmpty()) { ! FileDescription FD = m_pFileSystem->GetCurrentFileDescription(); ! ! if(!FD.IsDirectory()) ! if(!FileSystem::TestWildcard(str, strWild)) { str = m_pFileSystem->FindNext(); *************** *** 96,103 **** } ! item = InsertItem(item+1, str, CalcItemType(strFilePath)); ! SetItemData(item, (long)(void*)new wxString(strFilePath)); ! ! //SetItem(item, 1, strFilePath); str = m_pFileSystem->FindNext(); } --- 81,85 ---- } ! m_mapFiles[str] = FD; str = m_pFileSystem->FindNext(); } *************** *** 105,108 **** --- 87,146 ---- + + + // Compare deux items. + int FileSystemListCtrl::CompareItems(FileDescription* pItem1, FileDescription* pItem2) + { + if((pItem1==NULL)||(pItem2==NULL)) + return 0; + + if(pItem1->IsDirectory() && !pItem2->IsDirectory()) + return -1; + if(!pItem1->IsDirectory() && pItem2->IsDirectory()) + return 1; + + return pItem1->GetFilePath().GetFileName().CmpNoCase(pItem2->GetFilePath().GetFileName()); + } + + int wxCALLBACK CompareTwoListItems(long item1, long item2, long sortData) + { + FileSystemListCtrl* pFSListCtrl = wxDynamicCast((FileSystemListCtrl*)sortData, FileSystemListCtrl); + if(pFSListCtrl) + return pFSListCtrl->CompareItems((FileDescription*)item1, (FileDescription*)item2); + else + return 0; + } + + + // Met à jour la liste pour correspondre à la cache. + void FileSystemListCtrl::UpdateListView() + { + // Vide la vue. + DeleteAllItems(); + + // Pour chaque item de la cache, l'insérer. + long lNum = 0; + FileDescriptionMap::iterator it; + for( it = m_mapFiles.begin(); it != m_mapFiles.end(); ++it ) + { + const FileDescription* pFD = &it->second; + long lItem = InsertItem(lNum++, it->first, pFD->GetType()); + SetItemData(lItem, (long)pFD); + } + + // Tri par ordre alphabetique. + SortItems((wxListCtrlCompare)CompareTwoListItems, (long)this); + } + + + + // Met à jour la liste. + void FileSystemListCtrl::UpdateList() + { + DoCacheDirectory(m_strPath, m_strWild, m_nMode); + UpdateListView(); + } + + // Ouvre la liste dans un répertoire spécifique. void FileSystemListCtrl::Open(FilePath strPath, wxString strWild, unsigned int nMode) *************** *** 164,171 **** if (item==-1) break; ! FilePath path = wxString(*((wxString*)GetItemData(item))); ! if(!m_pFileSystem->IsDirectory(path)) { ! files.Add(path); } } --- 202,210 ---- if (item==-1) break; ! FileDescription* pFD = ((FileDescription*)GetItemData(item)); ! if(pFD!=NULL) { ! if(!pFD->IsDirectory()) ! files.Add(pFD->GetFilePath()); } } *************** *** 184,192 **** { file = files[0]; ! strList = file.GetFileName(); for(unsigned int n=1; n<files.GetCount(); n++) { ! file = files[n]; ! strList += ";" + file.GetFileName(); } } --- 223,230 ---- { file = files[0]; ! strList = file; for(unsigned int n=1; n<files.GetCount(); n++) { ! strList += wxT(";") + files[n]; } } Index: FileSystem.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystem.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FileSystem.cpp 2 Aug 2005 12:50:54 -0000 1.6 --- FileSystem.cpp 17 Aug 2005 15:01:06 -0000 1.7 *************** *** 32,35 **** --- 32,41 ---- using namespace wxDevCenter; + ////////////////////////////////////////////////////////////////////// + // Descripteur de fichier + ////////////////////////////////////////////////////////////////////// + + IMPLEMENT_CLASS(FileDescription, wxObject) + *************** *** 67,70 **** --- 73,93 ---- } + // Retourne un descripteur du fichier courant. + FileDescription FileSystem::GetCurrentFileDescription() + { + return GetFileDescription(GetCurrentFilePath()); + } + + // Retorune le descripteur du répertoire racine du système de fichiers. + FileDescription FileSystem::GetRootDescription() + { + return GetFileDescription(GetRootPath()); + } + + // Retorune le descripteur d'un fichier. + FileDescription FileSystem::GetFileDescription(FilePath strPath) + { + return FileDescription(strPath, IsDirectory(strPath), GetFileType(strPath)); + } *************** *** 82,86 **** { FileSystemTreeItemData* pItemData = (FileSystemTreeItemData*)pTree->GetItemData(event.GetItem()); ! FilePath str = pItemData->GetPath(); if(!pTree->GetFileSystem()->IsDirectory(str)) Application::GetApp().OpenDocument(str); --- 105,109 ---- { FileSystemTreeItemData* pItemData = (FileSystemTreeItemData*)pTree->GetItemData(event.GetItem()); ! FilePath str = pItemData->GetFilePath(); if(!pTree->GetFileSystem()->IsDirectory(str)) Application::GetApp().OpenDocument(str); *************** *** 98,102 **** { FileSystemTreeItemData* pItemData = (FileSystemTreeItemData*) pTree->GetItemData(event.GetItem()); ! FilePath str = pItemData->GetPath(); if(!pTree->GetFileSystem()->IsDirectory(str)) { --- 121,125 ---- { FileSystemTreeItemData* pItemData = (FileSystemTreeItemData*) pTree->GetItemData(event.GetItem()); ! FilePath str = pItemData->GetFilePath(); if(!pTree->GetFileSystem()->IsDirectory(str)) { *************** *** 281,306 **** - ////////////////////////////////////////////////////////////////////// - // Barre de travail des systèmes de fichiers automontés. - ////////////////////////////////////////////////////////////////////// - - IMPLEMENT_DYNAMIC_CLASS(FileSystemTreeWorkBar, WorkBar); - - // Fonction de création effective de la fenetre. - bool FileSystemTreeWorkBar::Create(wxWindow* parent) - { - if(m_pExtraObject==NULL) - return false; - if(!m_pExtraObject->IsKindOf(CLASSINFO(FileSystem))) - return false; - if(!WorkBar::Create(parent)) - return false; - - m_pFSTreeCtrl = new FileSystemTreeCtrl(this, -1, (FileSystem*)m_pExtraObject, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_ROW_LINES|wxTR_FULL_ROW_HIGHLIGHT|wxTR_ROW_LINES|wxTR_SINGLE|WXDC_FSTC_PROCESS_EVENT); - wxBoxSizer* pSizer = new wxBoxSizer(wxVERTICAL); - pSizer->Add(m_pFSTreeCtrl, 1, wxGROW); - SetSizer(pSizer); - m_pFSTreeCtrl->OpenRoot(); - return true; - } - --- 304,305 ---- Index: FileSystemCtrl.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemCtrl.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FileSystemCtrl.cpp 13 Aug 2005 16:27:34 -0000 1.10 --- FileSystemCtrl.cpp 17 Aug 2005 15:01:06 -0000 1.11 *************** *** 53,77 **** // Constructeur. ! FileSystemPanel::FileSystemPanel(wxWindow* parent, wxWindowID id, FileSystem* pFileSystem, wxString strWild): wxPanel(parent, id), m_pFileSystem(pFileSystem), m_pSplitter(NULL), m_pTree(NULL), ! m_pList(NULL) { m_pSplitter = new wxSplitterWindow(this, -1); ! m_pTree = new FileSystemTreeCtrl(m_pSplitter, ID_TREE, m_pFileSystem); ! m_pList = new FileSystemListCtrl(m_pSplitter, ID_LIST, m_pFileSystem); - m_pSplitter->SplitVertically(m_pTree, m_pList, 128); - m_pSplitter->SetMinimumPaneSize(64); ! m_pTree->OpenRoot(WXDC_FSTC_MODE_DIR); ! m_pList->OpenRoot(strWild, WXDC_FSLC_MODE_FILE|WXDC_FSLC_MODE_DIR); wxSizer *pGlobalSizer = new wxBoxSizer(wxVERTICAL); pGlobalSizer->Add(m_pSplitter, 1, wxGROW); SetSizer(pGlobalSizer); } --- 53,81 ---- // Constructeur. ! FileSystemPanel::FileSystemPanel(wxWindow* parent, wxWindowID id, FileSystem* pFileSystem): wxPanel(parent, id), m_pFileSystem(pFileSystem), m_pSplitter(NULL), m_pTree(NULL), ! m_pList(NULL), ! m_strCurrentPath(wxT("")), ! m_strWildcard(wxT("")) { m_pSplitter = new wxSplitterWindow(this, -1); ! m_pTree = new FileSystemTreeCtrl(m_pSplitter, ID_TREE); ! m_pList = new FileSystemListCtrl(m_pSplitter, ID_LIST); ! m_pTree->SetFileSystem(m_pFileSystem); ! m_pList->SetFileSystem(m_pFileSystem); ! m_pSplitter->SplitVertically(m_pTree, m_pList, 0); ! m_pSplitter->SetMinimumPaneSize(64); wxSizer *pGlobalSizer = new wxBoxSizer(wxVERTICAL); pGlobalSizer->Add(m_pSplitter, 1, wxGROW); SetSizer(pGlobalSizer); + + OpenRootDirectory(); } *************** *** 82,87 **** // Ouvre un répertoire et affiche son contenu. ! bool FileSystemPanel::OpenDirectory(FilePath strDir) { wxTreeItemId item = m_pTree->ExpandTo(strDir); if(item.IsOk()) --- 86,94 ---- // Ouvre un répertoire et affiche son contenu. ! bool FileSystemPanel::OpenDirectory(FilePath strDir, wxString strWild) { + m_strCurrentPath = strDir; + m_strWildcard = strWild; + wxTreeItemId item = m_pTree->ExpandTo(strDir); if(item.IsOk()) *************** *** 89,102 **** m_pTree->Expand(item); m_pTree->SelectItem(item); ! m_pList->ReOpen(strDir); } return true; } // Demande le répertoire actuellement ouvert. wxString FileSystemPanel::GetCurrentDirectory() { ! FileSystemTreeItemData *pData = (FileSystemTreeItemData *)m_pTree->GetItemData(m_pTree->GetSelection()); ! return pData!=NULL?pData->GetPath():""; } --- 96,120 ---- m_pTree->Expand(item); m_pTree->SelectItem(item); ! m_pList->Open(strDir, strWild, WXDC_FSLC_MODE_FILE|WXDC_FSLC_MODE_DIR); } return true; } + // Ouvre le répertoire racine du système de fichier. + bool FileSystemPanel::OpenRootDirectory(wxString strWild) + { + m_strCurrentPath = m_pFileSystem->GetRootPath(); + m_strWildcard = strWild; + m_pTree->OpenRoot(WXDC_FSTC_MODE_DIR); + m_pList->OpenRoot(strWild, WXDC_FSLC_MODE_FILE|WXDC_FSLC_MODE_DIR); + return true; + } + + + // Demande le répertoire actuellement ouvert. wxString FileSystemPanel::GetCurrentDirectory() { ! return m_strCurrentPath; } *************** *** 117,121 **** wxString FileSystemPanel::GetSelectedFiles() { ! return m_pList!=NULL?m_pList->GetSelectedFiles():""; } --- 135,139 ---- wxString FileSystemPanel::GetSelectedFiles() { ! return m_pList!=NULL?m_pList->GetSelectedFiles():wxT(""); } *************** *** 139,149 **** { long lItem = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); ! FilePath str = *((wxString*) m_pList->GetItemData(lItem)); ! if(m_pFileSystem->IsDirectory(str)) { ! OpenDirectory(str); } ! else ! event.Skip(); } --- 157,170 ---- { long lItem = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); ! FileDescription* pFD = (FileDescription*)m_pList->GetItemData(lItem); ! if(pFD!=NULL) { ! if(pFD->IsDirectory()) ! { ! OpenDirectory(pFD->GetFilePath()); ! return; ! } } ! event.Skip(); } *************** *** 152,156 **** { FileSystemTreeItemData *pData = (FileSystemTreeItemData *)m_pTree->GetItemData(event.GetItem()); ! wxString str = pData->GetPath(); m_pList->ReOpen(str); event.Skip(); --- 173,177 ---- { FileSystemTreeItemData *pData = (FileSystemTreeItemData *)m_pTree->GetItemData(event.GetItem()); ! wxString str = pData->GetFilePath(); m_pList->ReOpen(str); event.Skip(); *************** *** 191,196 **** /** Panneau de navigation.*/ ! m_pListbook = new wxListbook(this, -1); ! pGlobalSizer->Add(m_pListbook, 1, wxGROW|wxALL, 4); wxSizer* pBottomSizer = new wxBoxSizer(wxHORIZONTAL); --- 212,217 ---- /** Panneau de navigation.*/ ! m_pBook = new WXDC_CLASSBOOK(this, -1); ! pGlobalSizer->Add(m_pBook, 1, wxGROW|wxALL, 4); wxSizer* pBottomSizer = new wxBoxSizer(wxHORIZONTAL); *************** *** 227,231 **** /** Liste d'image.*/ m_pImageList = new wxImageList(48, 48); ! m_pListbook->SetImageList(m_pImageList); /** Fin de l'initialisation.*/ --- 248,252 ---- /** Liste d'image.*/ m_pImageList = new wxImageList(48, 48); ! m_pBook->SetImageList(m_pImageList); /** Fin de l'initialisation.*/ *************** *** 252,257 **** FileSystemPanel* pPanel = NULL; ! if(m_pListbook->GetSelection()!=wxNOT_FOUND) ! pPanel = (FileSystemPanel*) m_pListbook->GetPage(m_pListbook->GetSelection()); if(pPanel!=NULL) --- 273,278 ---- FileSystemPanel* pPanel = NULL; ! if(m_pBook->GetSelection()!=wxNOT_FOUND) ! pPanel = (FileSystemPanel*) m_pBook->GetPage(m_pBook->GetSelection()); if(pPanel!=NULL) *************** *** 263,272 **** { wxString strProtocol = strPath.GetFileProtocol(); ! for(unsigned int n=0; n<m_pListbook->GetPageCount(); n++) { ! FileSystemPanel* pPanel = (FileSystemPanel*) m_pListbook->GetPage(n); if(pPanel->GetProtocol()==strProtocol) { ! m_pListbook->SetSelection(n); pPanel->OpenDirectory(strPath); break; --- 284,293 ---- { wxString strProtocol = strPath.GetFileProtocol(); ! for(unsigned int n=0; n<m_pBook->GetPageCount(); n++) { ! FileSystemPanel* pPanel = (FileSystemPanel*) m_pBook->GetPage(n); if(pPanel->GetProtocol()==strProtocol) { ! m_pBook->SetSelection(n); pPanel->OpenDirectory(strPath); break; *************** *** 276,284 **** // Ajoute un système de fichiers à la liste des systèmes de fichiers attachés. ! void FileSystemDialog::AttachFileSystem(FileSystem *pFileSystem, wxString strTitle, wxBitmap& bmp) { ! FileSystemPanel *pPanel = new FileSystemPanel(m_pListbook, -1, pFileSystem); ! m_pImageList->Add(bmp); ! m_pListbook->AddPage(pPanel, strTitle, true, m_pImageList->GetImageCount()-1); } --- 297,305 ---- // Ajoute un système de fichiers à la liste des systèmes de fichiers attachés. ! void FileSystemDialog::AttachFileSystem(FileSystem *pFileSystem) { ! FileSystemPanel *pPanel = new FileSystemPanel(m_pBook, -1, pFileSystem); ! m_pImageList->Add(wxArtProvider::GetBitmap(pFileSystem->GetIconName(), wxART_OTHER, wxSize(48, 48))); ! m_pBook->AddPage(pPanel, pFileSystem->GetFileSystemName(), true, m_pImageList->GetImageCount()-1); } *************** *** 288,294 **** for(unsigned int n=0; n<pFSM->GetCount(); n++) { ! wxBitmap bmp = wxArtProvider::GetBitmap(pFSM->Item(n).GetIconName(), wxART_OTHER, wxSize(16, 16)); ! // wxBitmap bmp = pFSM->Item(n).GetIconBundle().GetIcon(48); ! AttachFileSystem(&(pFSM->Item(n)), pFSM->Item(n).GetFileSystemName(), bmp); } } --- 309,313 ---- for(unsigned int n=0; n<pFSM->GetCount(); n++) { ! AttachFileSystem(&(pFSM->Item(n))); } } *************** *** 320,325 **** { unsigned int n; ! for(n=0; n<m_pListbook->GetPageCount(); n++) ! ((FileSystemPanel*)m_pListbook->GetPage(n))->SetWildcard(strWild); for(n=0; n<m_arWildcard.GetCount(); n++) --- 339,344 ---- { unsigned int n; ! for(n=0; n<m_pBook->GetPageCount(); n++) ! ((FileSystemPanel*)m_pBook->GetPage(n))->SetWildcard(strWild); for(n=0; n<m_arWildcard.GetCount(); n++) *************** *** 331,338 **** FileSystemPanel* FileSystemDialog::GetActualPanel() { ! int i = m_pListbook->GetSelection(); if(i==-1) return NULL; ! return (FileSystemPanel*) m_pListbook->GetPage(i); } --- 350,357 ---- FileSystemPanel* FileSystemDialog::GetActualPanel() { ! int i = m_pBook->GetSelection(); if(i==-1) return NULL; ! return (FileSystemPanel*) m_pBook->GetPage(i); } *************** *** 350,354 **** void FileSystemDialog::GetSelectedFileList(wxArrayString& files) { ! if(m_pListbook->GetPageCount()>0) GetActualPanel()->GetSelectedFilesList(files); if(files.GetCount()==0) --- 369,373 ---- void FileSystemDialog::GetSelectedFileList(wxArrayString& files) { ! if(m_pBook->GetPageCount()>0) GetActualPanel()->GetSelectedFilesList(files); if(files.GetCount()==0) *************** *** 382,387 **** { // Retourne le répertoire demandé ! int iPanelSel = m_pListbook->GetSelection(); ! FileSystemPanel* pPanel = iPanelSel!=-1?(FileSystemPanel*) m_pListbook->GetPage(iPanelSel):NULL; if(pPanel!=NULL) m_strPath = pPanel->GetCurrentDirectory(); --- 401,406 ---- { // Retourne le répertoire demandé ! int iPanelSel = m_pBook->GetSelection(); ! FileSystemPanel* pPanel = iPanelSel!=-1?(FileSystemPanel*) m_pBook->GetPage(iPanelSel):NULL; if(pPanel!=NULL) m_strPath = pPanel->GetCurrentDirectory(); |