|
From: Emilien K. <cur...@us...> - 2005-08-17 15:01:15
|
Update of /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4385/include/wxDevCenter Modified Files: FileSystem.h FileSystemStandard.h FileSystemListCtrl.h FileSystemCtrl.h FileSystemTreeCtrl.h 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.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/FileSystemTreeCtrl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileSystemTreeCtrl.h 13 Aug 2005 16:27:34 -0000 1.1 --- FileSystemTreeCtrl.h 17 Aug 2005 15:01:06 -0000 1.2 *************** *** 33,51 **** /** Structure permettant de manipuler des fichiers via un FileSystemTreeCtrl.*/ ! class WXDC_DLL_BASE FileSystemTreeItemData : public wxTreeItemData { - friend class wxDevCenter::FileSystem; - protected: - /** Chemin du fichier.*/ - wxString m_strPath; - /** Type de fichier.*/ - int m_iType; - /** Etat du fichier.*/ - int m_iState; public: ! FileSystemTreeItemData(wxString &Path, int iType=0, int iState=0); ! wxString GetPath()const; ! int GetType()const; ! int GetState()const; }; --- 33,40 ---- /** Structure permettant de manipuler des fichiers via un FileSystemTreeCtrl.*/ ! class WXDC_DLL_BASE FileSystemTreeItemData : public wxTreeItemData, public FileDescription { public: ! FileSystemTreeItemData(const FileDescription& FD):wxTreeItemData(), FileDescription(FD){} }; *************** *** 75,80 **** --- 64,85 ---- */ FilePath m_strRootPath; + public: + /** Constructeur. + * Appeler Open ou OpenRoot après sinon, una assertion se déclenchera. + * @param parent Fenetre parente (non NULL). + * @param id Identifiant de filiation. + * @param pos Position. + * @param size Taille. + * @param style Style de l'arbre. + */ + FileSystemTreeCtrl(wxWindow* parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS|wxTR_ROW_LINES|wxTR_FULL_ROW_HIGHLIGHT|wxTR_ROW_LINES|wxTR_SINGLE); + /** Destructeur.*/ + virtual ~FileSystemTreeCtrl(); + + /** Ouvre l'arbre en précisant une racine autre que la base du système de fichiers. * @param strRootPath Chemin virtuel de la racine. *************** *** 82,89 **** */ void Open(FilePath strRootPath, unsigned int nMode=WXDC_FSTC_MODE_NORMAL); /** Ouvre l'arbre à la base du système de fichiers. * @param nMode Mode d'ouverture. */ ! void OpenRoot(unsigned int nMode=WXDC_FSTC_MODE_NORMAL); /** Etend l'arbre pour afficher le fichier/répertoire demandé. --- 87,95 ---- */ void Open(FilePath strRootPath, unsigned int nMode=WXDC_FSTC_MODE_NORMAL); + /** Ouvre l'arbre à la base du système de fichiers. * @param nMode Mode d'ouverture. */ ! void OpenRoot(unsigned int nMode=WXDC_FSTC_MODE_NORMAL){Open(m_pFileSystem->GetRootPath(), nMode);} /** Etend l'arbre pour afficher le fichier/répertoire demandé. *************** *** 109,128 **** * @return Id du noeud de l'arbre correspondant au fichier. Invalide si non trouvé.*/ wxTreeItemId FindChild(wxTreeItemId idParent, wxString strFileName); - - /** Constructeur. - * Appeler Open ou OpenRoot après sinon, una assertion se déclenchera. - * @param parent Fenetre parente (non NULL). - * @param id Identifiant de filiation. - * @param pFileSystem Système de fichier. - * @param pos Position. - * @param size Taille. - * @param style Style de l'arbre. - */ - FileSystemTreeCtrl(wxWindow* parent, wxWindowID id, - FileSystem *pFileSystem, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS|wxTR_ROW_LINES|wxTR_FULL_ROW_HIGHLIGHT|wxTR_ROW_LINES|wxTR_SINGLE ); - /** Destructeur.*/ - virtual ~FileSystemTreeCtrl(); protected: /** Interception de l'évènement de déroulement d'une branche.*/ --- 115,118 ---- *************** *** 145,148 **** --- 135,156 ---- + /** WorkBar spécifique aux FileSystemTreeCtrl. + * Utilisé pour l'automontage de workbar de systèmez de fichiers.*/ + class WXDC_DLL_BASE FileSystemTreeWorkBar : public WorkBar + { + DECLARE_DYNAMIC_CLASS(FileSystemTreeWorkBar); + protected: + /** Arbre du système de fichier.*/ + FileSystemTreeCtrl* m_pFSTreeCtrl; + public: + FileSystemTreeWorkBar(void):WorkBar(){} + virtual ~FileSystemTreeWorkBar(void){} + + /** Fonction de création effective de la fenetre.*/ + virtual bool Create(wxWindow* parent); + }; + + + } #endif /*__WXDEVCENTER_FILESYSTEMTREECTRL*/ Index: FileSystemListCtrl.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/FileSystemListCtrl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileSystemListCtrl.h 13 Aug 2005 16:27:34 -0000 1.1 --- FileSystemListCtrl.h 17 Aug 2005 15:01:06 -0000 1.2 *************** *** 25,32 **** #include <wx/listctrl.h> namespace wxDevCenter { - class FileSystem; class DocManager; class FilePath; --- 25,33 ---- #include <wx/listctrl.h> + #include <wxDevCenter/FileSystem.h> + namespace wxDevCenter { class DocManager; class FilePath; *************** *** 58,61 **** --- 59,75 ---- /** Chaine de filtrage des noms de fichiers.*/ wxString m_strWild; + /** Map des descripteurs de fichiers contenus dans la liste.*/ + FileDescriptionMap m_mapFiles; + protected: + /** Parcours un répertoire et met en cache son contenu. + * @param strPath Chemin du répertoire à ouvrir. + * @param strWild Filtrage des noms de fichiers à afficher. + * @param nMode Mode d'ouverture du répertoire. + */ + virtual void DoCacheDirectory(FilePath strPath, wxString strWild = wxT("*.*"), unsigned int nMode=WXDC_FSLC_MODE_NORMAL); + + /** Met à jour la liste pour correspondre à la cache.*/ + virtual void UpdateListView(); + public: /** Constructeur. *************** *** 69,73 **** */ FileSystemListCtrl(wxWindow* parent, wxWindowID id, - FileSystem *pFileSystem, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLC_ICON|wxLC_ALIGN_TOP|wxLC_AUTOARRANGE); --- 83,86 ---- *************** *** 119,125 **** long CalcItemType(FilePath path); ! /** Supprime tous les éléments de la liste. ! * @return True si OK.*/ ! bool DeleteAllItems(); protected: --- 132,141 ---- long CalcItemType(FilePath path); ! /** Compare deux items. ! * @param pItem1 Descripteur du premier fichier. ! * @param pItem2 Descripteur du second fichier. ! * @return indice de comparaison. ! */ ! static int CompareItems(FileDescription* pItem1, FileDescription* pItem2); protected: Index: FileSystemStandard.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/FileSystemStandard.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** FileSystemStandard.h 13 Aug 2005 14:07:37 -0000 1.12 --- FileSystemStandard.h 17 Aug 2005 15:01:06 -0000 1.13 *************** *** 63,67 **** virtual wxString GetIconName()const{return wxT("desktop");} ! wxString GetProtocoleName()const{return "file";} bool CreateDirectory(FilePath strDir); bool RemoveDirectory(FilePath strDir); --- 63,67 ---- virtual wxString GetIconName()const{return wxT("desktop");} ! wxString GetProtocoleName()const{return wxT("file");} bool CreateDirectory(FilePath strDir); bool RemoveDirectory(FilePath strDir); Index: FileSystemCtrl.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/FileSystemCtrl.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FileSystemCtrl.h 13 Aug 2005 16:27:34 -0000 1.9 --- FileSystemCtrl.h 17 Aug 2005 15:01:06 -0000 1.10 *************** *** 33,37 **** --- 33,44 ---- #include <wx/dialog.h> #include <wx/filedlg.h> + + #include <wx/notebook.h> #include <wx/listbook.h> + #include <wx/choicebk.h> + + + #define WXDC_CLASSBOOK wxBookCtrl + #include <wxDevCenter/FileSystemListCtrl.h> *************** *** 67,70 **** --- 74,82 ---- /** Liste des fichiers.*/ FileSystemListCtrl *m_pList; + + /** Répertoire courant.*/ + FilePath m_strCurrentPath; + /** Wildcard courant.*/ + wxString m_strWildcard; public: *************** *** 73,79 **** * @param id Identifiant de filiation. * @param pFileSystem SYsteme de fichiers à attacher. - * @param strWild Filtrage de listage des fichiers. */ ! FileSystemPanel(wxWindow* parent, wxWindowID id, FileSystem* pFileSystem, wxString strWild="*.*"); /** Destructeur.*/ ~FileSystemPanel(); --- 85,90 ---- * @param id Identifiant de filiation. * @param pFileSystem SYsteme de fichiers à attacher. */ ! FileSystemPanel(wxWindow* parent, wxWindowID id, FileSystem* pFileSystem); /** Destructeur.*/ ~FileSystemPanel(); *************** *** 81,87 **** /** Ouvre un répertoire et affiche son contenu. * @param strDir Chemin du répertoire à ouvrir, vide pour le répertoire racine. * @return Vrai si OK. */ ! bool OpenDirectory(FilePath strDir=""); /** Demande le répertoire actuellement ouvert. --- 92,106 ---- /** Ouvre un répertoire et affiche son contenu. * @param strDir Chemin du répertoire à ouvrir, vide pour le répertoire racine. + * @param strWild Wildcard à appliquer. * @return Vrai si OK. */ ! bool OpenDirectory(FilePath strDir=wxT(""), wxString strWild=wxT("*.*")); ! ! /** Ouvre le répertoire racine du système de fichier. ! * @param strWild Wildcard à appliquer. ! * @return Vrai si OK. ! */ ! bool OpenRootDirectory(wxString strWild=wxT("*.*")); ! /** Demande le répertoire actuellement ouvert. *************** *** 130,135 **** DECLARE_EVENT_TABLE() ! /** ListBook.*/ ! wxListbook* m_pListbook; /** Liste d'images des systèmes de fichiers.*/ wxImageList* m_pImageList; --- 149,154 ---- DECLARE_EVENT_TABLE() ! /** Book.*/ ! WXDC_CLASSBOOK* m_pBook; /** Liste d'images des systèmes de fichiers.*/ wxImageList* m_pImageList; *************** *** 180,187 **** /** Ajoute un système de fichiers à la liste des systèmes de fichiers attachés. * @param pFileSystem Nouveau système de fichiers. - * @param strTitle Nom du système de fichier. - * @param bmp Image représentant le système de fichier. */ ! void AttachFileSystem(FileSystem *pFileSystem, wxString strTitle, wxBitmap& bmp); /** Ajoute l'ensemble des systèmes de fichiers enregistrés dans un gestionnaire de systèmes de fichiers. --- 199,204 ---- /** Ajoute un système de fichiers à la liste des systèmes de fichiers attachés. * @param pFileSystem Nouveau système de fichiers. */ ! void AttachFileSystem(FileSystem *pFileSystem); /** Ajoute l'ensemble des systèmes de fichiers enregistrés dans un gestionnaire de systèmes de fichiers. Index: FileSystem.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/FileSystem.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FileSystem.h 13 Aug 2005 14:07:37 -0000 1.9 --- FileSystem.h 17 Aug 2005 15:01:06 -0000 1.10 *************** *** 43,46 **** --- 43,48 ---- #include <wx/image.h> #include <wx/treectrl.h> + #include <wx/hashmap.h> + *************** *** 104,107 **** --- 106,170 ---- + WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, FileDescriptorExtPropMap, class WXDC_DLL_BASE); + + /** Classe des données de description d'un fichier. + */ + class WXDC_DLL_BASE FileDescriptorData : public wxObjectRefData + { + public: + /** Chemin complet du fichier.*/ + FilePath strPath; + /** Flag de répertoire (Vrai si répertoire).*/ + bool bIsDirectory; + /** Identifiant du type de fichier (ou de répertoire).*/ + long lType; + /** Dicctionnaire des propriétés étendues.*/ + FileDescriptorExtPropMap MapExtProperties; + }; + + /** Classe de description d'un fichier. + */ + class WXDC_DLL_BASE FileDescription : public wxObject + { + DECLARE_CLASS(FileDescription); + private: + FileDescriptorData& GetFileDescriptorData(){return (FileDescriptorData&) *GetRefData();} + const FileDescriptorData& GetFileDescriptorData()const{return (const FileDescriptorData&) *GetRefData();} + + public : + FileDescription():wxObject(){SetRefData(new FileDescriptorData);} + FileDescription(const FileDescription& FileDesc):wxObject(FileDesc){} + FileDescription(const FilePath& strPath, bool bIsDirectory, long lType):wxObject() + { + SetRefData(new FileDescriptorData); + SetFilePath(strPath); + SetIsDirectory(bIsDirectory); + SetType(lType); + } + + FileDescription& operator=(const FileDescription& FD){Ref(FD);return *this;} + + void SetFilePath(const FilePath& strPath){GetFileDescriptorData().strPath = strPath;} + void SetIsDirectory(bool bIsDirectory){GetFileDescriptorData().bIsDirectory = bIsDirectory;} + void SetType(long lType){GetFileDescriptorData().lType = lType;} + void SetExtedndedProperty(const wxString& strName, const wxString& strValue){GetFileDescriptorData().MapExtProperties[strName] = strValue;} + + FilePath GetFilePath()const{return GetFileDescriptorData().strPath;} + bool IsDirectory()const{return GetFileDescriptorData().bIsDirectory;} + long GetType()const{return GetFileDescriptorData().lType;} + wxString GetExtendedProperty(const wxString& strName)const + { + FileDescriptorExtPropMap::const_iterator it = GetFileDescriptorData().MapExtProperties.find(strName); + if(it==GetFileDescriptorData().MapExtProperties.end()) + return wxEmptyString; + else + it->second; + } + wxString operator[](const wxString& strName)const{return GetExtendedProperty(strName);} + }; + + WX_DECLARE_STRING_HASH_MAP_WITH_DECL( FileDescription, FileDescriptionMap, class WXDC_DLL_BASE); + + /** Classe abstraite représentant un système de fichier. * Elle autorise la manipulation de fichier et leur ennumération. *************** *** 136,139 **** --- 199,210 ---- * @return Chemin vers la racine.*/ virtual FilePath GetRootPath()const=0; + /** Retorune le descripteur du répertoire racine du système de fichiers. + * @return Descripteur du dossier du répertoire racine. */ + virtual FileDescription GetRootDescription(); + /** Retorune le descripteur d'un fichier. + * @param strPath Chemin du fichier. + * @return Descripteur du fichier. */ + virtual FileDescription GetFileDescription(FilePath strPath); + /** Crée une recherche de fichier/répertoire et retourne le premier rencontré. * @param strPath Chemin des fichiers/répertoires à rechercher. *************** *** 148,151 **** --- 219,225 ---- * @return Chemin du dernier fichier/répertoire.*/ virtual FilePath GetCurrentFilePath()=0; + /** Retourne un descripteur du fichier courant. + * @return Descripteur du fichier courant. */ + virtual FileDescription GetCurrentFileDescription(); /** @} */ *************** *** 215,218 **** --- 289,294 ---- + + /** Gestionnaire de systèmes de fichiers (virtuels). * Fait le lien entre les noms de fichiers, les systèmes de fichiers et les archives. *************** *** 247,270 **** }; - - class FileSystemTreeCtrl; - - /** WorkBar spécifique aux FileSystemTreeCtrl. - * Utilisé pour l'automontage de workbar de systèmez de fichiers.*/ - class WXDC_DLL_BASE FileSystemTreeWorkBar : public WorkBar - { - DECLARE_DYNAMIC_CLASS(FileSystemTreeWorkBar); - protected: - /** Arbre du système de fichier.*/ - FileSystemTreeCtrl* m_pFSTreeCtrl; - public: - FileSystemTreeWorkBar(void):WorkBar(){} - virtual ~FileSystemTreeWorkBar(void){} - - /** Fonction de création effective de la fenetre.*/ - virtual bool Create(wxWindow* parent); - }; - - } // Fin du namespace #endif --- 323,326 ---- |