|
From: Emilien K. <cur...@us...> - 2005-10-11 19:54:33
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29659/src Modified Files: Frame.cpp MainFrame.cpp DocManager.cpp AboutBox.cpp Config.cpp Application.cpp FileSystemTreeCtrl.cpp Plugin.cpp MDIFrame.cpp FileSystemStandard.cpp Added Files: PluginFileSystem.cpp Log Message: Move bakefiles to /build/bakefiles. Modularize frames. Create PluginFileSystem and show it in AboutBox. --- NEW FILE: PluginFileSystem.cpp --- (This appears to be a binary file; contents omitted.) Index: AboutBox.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/AboutBox.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AboutBox.cpp 14 Sep 2005 20:01:53 -0000 1.5 --- AboutBox.cpp 11 Oct 2005 19:54:24 -0000 1.6 *************** *** 24,28 **** #include <wxDevCenter.h> #include <wxDevCenter/AboutBox.h> ! #include <wxDevCenter/Plugin.h> #include <wxDevCenter/ArtProvider.h> --- 24,29 ---- #include <wxDevCenter.h> #include <wxDevCenter/AboutBox.h> ! #include <wxDevCenter/PluginFileSystem.h> ! #include <wxDevCenter/FileSystemTreeCtrl.h> #include <wxDevCenter/ArtProvider.h> *************** *** 112,127 **** ////////////////////////////////////////////////////////////////////// // Impl�mentation des fonctions de la classe des plugins AboutBoxPluginPage::AboutBoxPluginPage(wxWindow* parent, wxWindowID id): ! wxListbook(parent, id) { ! /* PluginManager& PM = Application::GetApp().GetPluginManager(); ! for(unsigned int n=0; n<PM.GetCount(); n++) ! { ! wxWindow* pWindow = PM[n].CreateAboutPanel(this, -1); ! if(pWindow==NULL) ! pWindow = new wxWindow(this, -1); ! AddPage(pWindow, PM[n].GetName()); ! }*/ } --- 113,138 ---- ////////////////////////////////////////////////////////////////////// // Impl�mentation des fonctions de la classe des plugins + BEGIN_EVENT_TABLE(wxDevCenter::AboutBoxPluginPage, wxPanel) + EVT_TREE_ITEM_ACTIVATED(wxID_ANY, AboutBoxPluginPage::OnActivateItem) + END_EVENT_TABLE() + AboutBoxPluginPage::AboutBoxPluginPage(wxWindow* parent, wxWindowID id): ! wxPanel(parent, id), ! m_PluginFileSystem() { ! m_pFileSystemTreeCtrl = new FileSystemTreeCtrl(this, -1); ! m_pFileSystemTreeCtrl->SetFileSystem(&m_PluginFileSystem); ! m_pFileSystemTreeCtrl->OpenRoot(); ! ! wxSizer* pSizer = new wxBoxSizer(wxHORIZONTAL); ! pSizer->Add(m_pFileSystemTreeCtrl, 1, wxEXPAND); ! SetSizerAndFit(pSizer); ! } ! void AboutBoxPluginPage::OnActivateItem(wxTreeEvent& event) ! { ! FileSystemTreeItemData* pData = (FileSystemTreeItemData*) m_pFileSystemTreeCtrl->GetItemData(event.GetItem()); ! ! wxLogWarning("Plop : %s, %s", event.GetLabel().GetData(), pData->GetFilePath().GetData()); } Index: MainFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MainFrame.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** MainFrame.cpp 14 Sep 2005 20:01:53 -0000 1.22 --- MainFrame.cpp 11 Oct 2005 19:54:24 -0000 1.23 *************** *** 23,27 **** ! #include <wxDevCenter.h> #include <wxDevCenter/MainFrame.h> --- 23,27 ---- ! #include <wxDevCenterPlugin.h> #include <wxDevCenter/MainFrame.h> *************** *** 35,38 **** --- 35,39 ---- #include <wxDevCenter/ArtProvider.h> + #include <wx/dataobj.h> #include <wx/dnd.h> *************** *** 50,55 **** #define WXDC_VIEWMENU_INSERT_AFTER 1 ! IMPLEMENT_CLASS(MainFrame, TopFrame) BEGIN_EVENT_TABLE(MainFrame, TopFrame) --- 51,57 ---- #define WXDC_VIEWMENU_INSERT_AFTER 1 + TopFrameTemplate MainFrameTemplate(CLASSINFO(MainFrame)); ! IMPLEMENT_DYNAMIC_CLASS(MainFrame, TopFrame) BEGIN_EVENT_TABLE(MainFrame, TopFrame) *************** *** 95,99 **** MainFrame::MainFrame(void): ! TopFrame(WXDC_NAME, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN), m_pLayoutManager(NULL), m_WorkBarArray(), --- 97,101 ---- MainFrame::MainFrame(void): ! TopFrame(), m_pLayoutManager(NULL), m_WorkBarArray(), *************** *** 102,105 **** --- 104,113 ---- m_pMenuItemWorkBar(NULL) { + } + + bool MainFrame::Create(const wxString& title, const wxPoint& pos, const wxSize& size, long style) + { + if(!TopFrame::Create(title, pos, size, style)) + return false; // Création de la fenetre cadre cliente. *************** *** 123,126 **** --- 131,136 ---- SetDropTarget(new MainFrameDropTarget); + + return true; } *************** *** 138,145 **** void MainFrame::OnClose(wxCloseEvent &event) { ! if(!Application::GetApp().GetDocManager().CloseAllDocuments()) event.Veto(); - else - Destroy(); } --- 148,153 ---- void MainFrame::OnClose(wxCloseEvent &event) { ! if(!Destroy(false)) event.Veto(); } *************** *** 304,310 **** // Ajoute une vue ! void MainFrame::AddView(View *pView) { GetViewFrame()->AddView(pView); } --- 312,319 ---- // Ajoute une vue ! bool MainFrame::AddView(View *pView) { GetViewFrame()->AddView(pView); + return true; } *************** *** 419,420 **** --- 428,430 ---- wxFrame::UpdateWindowUI(flags); } + Index: Config.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Config.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Config.cpp 15 Sep 2005 16:11:47 -0000 1.11 --- Config.cpp 11 Oct 2005 19:54:24 -0000 1.12 *************** *** 27,30 **** --- 27,31 ---- #include <wx/fileconf.h> #include <wx/filefn.h> + #include <wx/tokenzr.h> using namespace wxDevCenter; *************** *** 168,172 **** void Config::AddDataPath(wxString strPath) { ! m_strDataPath.Insert(strPath, 0); } --- 169,178 ---- void Config::AddDataPath(wxString strPath) { ! wxStringTokenizer tkz(strPath, wxT("&;")); ! while ( tkz.HasMoreTokens() ) ! { ! wxString token = tkz.GetNextToken(); ! m_strDataPath.Insert(token, 0); ! } } *************** *** 174,178 **** void Config::AddFeaturesPath(wxString strPath) { ! m_strFeaturesPath.Insert(strPath, 0); } --- 180,189 ---- void Config::AddFeaturesPath(wxString strPath) { ! wxStringTokenizer tkz(strPath, wxT("&;")); ! while ( tkz.HasMoreTokens() ) ! { ! wxString token = tkz.GetNextToken(); ! m_strFeaturesPath.Insert(token, 0); ! } } *************** *** 180,184 **** void Config::AddPluginsPath(wxString strPath) { ! m_strPluginsPath.Insert(strPath, 0); } --- 191,200 ---- void Config::AddPluginsPath(wxString strPath) { ! wxStringTokenizer tkz(strPath, wxT("&;")); ! while ( tkz.HasMoreTokens() ) ! { ! wxString token = tkz.GetNextToken(); ! m_strPluginsPath.Insert(token, 0); ! } } *************** *** 186,190 **** void Config::AddGlobalConfPath(wxString strPath) { ! m_strConfPath.Insert(strPath, 0); } --- 202,211 ---- void Config::AddGlobalConfPath(wxString strPath) { ! wxStringTokenizer tkz(strPath, wxT("&;")); ! while ( tkz.HasMoreTokens() ) ! { ! wxString token = tkz.GetNextToken(); ! m_strConfPath.Insert(token, 0); ! } } *************** *** 192,196 **** void Config::AddUserConfPath(wxString strPath) { ! m_strUserConfPath.Insert(strPath, 0); } --- 213,222 ---- void Config::AddUserConfPath(wxString strPath) { ! wxStringTokenizer tkz(strPath, wxT("&;")); ! while ( tkz.HasMoreTokens() ) ! { ! wxString token = tkz.GetNextToken(); ! m_strUserConfPath.Insert(token, 0); ! } } Index: Plugin.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Plugin.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Plugin.cpp 15 Sep 2005 16:11:47 -0000 1.11 --- Plugin.cpp 11 Oct 2005 19:54:24 -0000 1.12 *************** *** 37,41 **** */ ! ModuleRefData::ModuleRefData(): wxObjectRefData(), m_flagState(Initial), --- 37,41 ---- */ ! DynLibRefData::DynLibRefData(): wxObjectRefData(), m_flagState(Initial), *************** *** 45,49 **** } ! ModuleRefData::~ModuleRefData() { } --- 45,49 ---- } ! DynLibRefData::~DynLibRefData() { } *************** *** 51,55 **** // Débugage : Dump du contenu. wxDEBUG_CODE( ! wxString ModuleRefData::Dump() { wxString str; --- 51,55 ---- // Débugage : Dump du contenu. wxDEBUG_CODE( ! wxString DynLibRefData::Dump() { wxString str; *************** *** 62,67 **** ) ! // Charge le module. ! bool ModuleRefData::Load(wxString strLongName) { wxString strFileName; --- 62,67 ---- ) ! // Charge le dynlib. ! bool DynLibRefData::Load(wxString strLongName) { wxString strFileName; *************** *** 82,86 **** m_strPath = strPath; ! wxLogDebug(wxT("Loading module %s"), m_strPath.GetData()); BaseElementManager* pOldBEM = Element::s_pElementManager; Element::s_pElementManager = &m_Elements; --- 82,86 ---- m_strPath = strPath; ! wxLogDebug(wxT("Loading dynlib %s"), m_strPath.GetData()); BaseElementManager* pOldBEM = Element::s_pElementManager; Element::s_pElementManager = &m_Elements; *************** *** 91,100 **** { m_flagState |= Loaded; ! wxLogDebug(wxT("Module %s loaded"), strLongName.GetData()); } else { m_flagState = Error; ! wxLogDebug(wxT("Module %s loading error"), strLongName.GetData()); } return flag; --- 91,100 ---- { m_flagState |= Loaded; ! wxLogDebug(wxT("Dynlib %s loaded"), strLongName.GetData()); } else { m_flagState = Error; ! wxLogDebug(wxT("Dynlib %s loading error"), strLongName.GetData()); } return flag; *************** *** 102,120 **** } m_flagState = Error; ! wxLogDebug(wxT("Module %s not found"), strLongName.GetData()); return false; } ! // Décharge le module. ! bool ModuleRefData::Unload() { return false; } ! // Initialise le contenu du module. ! bool ModuleRefData::Initialize() { ! wxLogDebug("ModuleRefData::Initialize : %d", m_Elements.GetCount()); bool bOK = true; for(long l=0; l<(long)m_Elements.GetCount(); l++) --- 102,120 ---- } m_flagState = Error; ! wxLogDebug(wxT("Dynlib %s not found"), strLongName.GetData()); return false; } ! // Décharge le dynlib. ! bool DynLibRefData::Unload() { return false; } ! // Initialise le contenu du dynlib. ! bool DynLibRefData::Initialize() { ! wxLogDebug("DynlibRefData::Initialize : %d", m_Elements.GetCount()); bool bOK = true; for(long l=0; l<(long)m_Elements.GetCount(); l++) *************** *** 131,136 **** } ! // Finalise le contenu du module. ! bool ModuleRefData::Finalize() { /** @todo Finalize all dependant elements.*/ --- 131,136 ---- } ! // Finalise le contenu du dynlib. ! bool DynLibRefData::Finalize() { /** @todo Finalize all dependant elements.*/ *************** *** 141,151 **** /** ! * Implémentation de la classe wxDevCenter::plugins::Module. */ ! IMPLEMENT_CLASS(Module, wxObject) // Constructeur. ! Module::Module(): wxObject() { --- 141,151 ---- /** ! * Implémentation de la classe wxDevCenter::plugins::DynLib. */ ! IMPLEMENT_CLASS(DynLib, wxObject) // Constructeur. ! DynLib::DynLib(): wxObject() { *************** *** 154,181 **** // Débugage : Dump du contenu. wxDEBUG_CODE( ! wxString Module::Dump() { ! ModuleRefData* pModRef = GetModuleRef(); if(pModRef!=NULL) return pModRef->Dump(); else ! return wxT("Null module"); } ) ! // Teste si le module est chargé. ! bool Module::IsLoaded()const { ! if(GetModuleRef()!=NULL) ! return GetModuleRef()->IsLoaded(); else return false; } ! // Teste si le module est initialisé. ! bool Module::IsInitialized()const { ! if(GetModuleRef()!=NULL) ! return GetModuleRef()->IsInitialized(); else return false; --- 154,191 ---- // Débugage : Dump du contenu. wxDEBUG_CODE( ! wxString DynLib::Dump() { ! DynLibRefData* pModRef = GetDynLibRef(); if(pModRef!=NULL) return pModRef->Dump(); else ! return wxT("Null dynlib"); } ) ! // Retourne le nom de la dynlib. ! wxString DynLib::GetName() { ! if(GetDynLibRef()!=NULL) ! return GetDynLibRef()->m_strPath.AfterLast(wxT('/')); ! else ! return wxT(""); ! } ! ! ! // Teste si le dynlib est chargé. ! bool DynLib::IsLoaded()const ! { ! if(GetDynLibRef()!=NULL) ! return GetDynLibRef()->IsLoaded(); else return false; } ! // Teste si le dynlib est initialisé. ! bool DynLib::IsInitialized()const { ! if(GetDynLibRef()!=NULL) ! return GetDynLibRef()->IsInitialized(); else return false; *************** *** 183,210 **** ! // Charge le module et enregistre son contenu. ! bool Module::Load(wxString strPath) { AllocExclusive(); ! return GetModuleRef()->Load(strPath); } ! // Décharge le module. ! bool Module::Unload() { return false; } ! // Initialise le contenu du module. ! bool Module::Initialize() { ! if(GetModuleRef()!=NULL) ! return GetModuleRef()->Initialize(); else return false; } ! // Finalise le contenu du module. ! bool Module::Finalize() { return false; --- 193,220 ---- ! // Charge le dynlib et enregistre son contenu. ! bool DynLib::Load(wxString strPath) { AllocExclusive(); ! return GetDynLibRef()->Load(strPath); } ! // Décharge le dynlib. ! bool DynLib::Unload() { return false; } ! // Initialise le contenu du dynlib. ! bool DynLib::Initialize() { ! if(GetDynLibRef()!=NULL) ! return GetDynLibRef()->Initialize(); else return false; } ! // Finalise le contenu du dynlib. ! bool DynLib::Finalize() { return false; *************** *** 239,245 **** for(long l=0; l<(long)m_arrstrPlugins.GetCount(); l++) str << wxT(" - ") << m_arrstrPlugins[l] << wxT("\n"); ! str << wxT("Used modules : ") << m_arrstrModules.GetCount() << wxT("\n"); ! for(long l=0; l<(long)m_arrstrModules.GetCount(); l++) ! str << wxT(" - ") << m_arrstrModules[l] << wxT("\n"); } return str; --- 249,255 ---- for(long l=0; l<(long)m_arrstrPlugins.GetCount(); l++) str << wxT(" - ") << m_arrstrPlugins[l] << wxT("\n"); ! str << wxT("Used dynlibs : ") << m_arrstrDynLibs.GetCount() << wxT("\n"); ! for(long l=0; l<(long)m_arrstrDynLibs.GetCount(); l++) ! str << wxT(" - ") << m_arrstrDynLibs[l] << wxT("\n"); } return str; *************** *** 282,286 **** m_strNotes = File.GetNotes(); m_strURL = File.GetURL(); ! File.FillModuleArray(m_arrstrModules); File.FillDependantPluginArray(m_arrstrPlugins); m_Status |= PreLoaded; --- 292,296 ---- m_strNotes = File.GetNotes(); m_strURL = File.GetURL(); ! File.FillDynLibArray(m_arrstrDynLibs); File.FillDependantPluginArray(m_arrstrPlugins); m_Status |= PreLoaded; *************** *** 305,311 **** bOk &= m_pLoader->LoadPlugin(m_arrstrPlugins[l])!=NULL; ! // Préchargement des modules. ! for(l=0; l<m_arrstrModules.GetCount(); l++) ! bOk &= m_pLoader->LoadModule(strName + wxT("/") + m_arrstrModules[l])!=NULL; m_Status |= Loaded | (bOk?0:Partial); --- 315,321 ---- bOk &= m_pLoader->LoadPlugin(m_arrstrPlugins[l])!=NULL; ! // Préchargement des dynlibs. ! for(l=0; l<m_arrstrDynLibs.GetCount(); l++) ! bOk &= m_pLoader->LoadDynLib(strName + wxT("/") + m_arrstrDynLibs[l])!=NULL; m_Status |= Loaded | (bOk?0:Partial); *************** *** 478,487 **** IMPLEMENT_CLASS(PluginLoader, wxObject) PluginLoader::PluginLoader(): wxObject(), m_FeatureMap(), m_PluginMap(), ! m_ModuleMap() { } --- 488,577 ---- IMPLEMENT_CLASS(PluginLoader, wxObject) + PluginLoader PluginLoader::s_PluginManager; + PluginLoader::PluginLoader(): wxObject(), m_FeatureMap(), m_PluginMap(), ! m_DynLibMap() ! { ! } ! ! // Accesseur sur une feature. ! Feature* PluginLoader::GetFeature(long l) ! { ! FeatureMap::iterator it = m_FeatureMap.begin(); ! l++; ! while(it!=m_FeatureMap.end() && l>0) ! { ! it++; ! l--; ! } ! if(it!=m_FeatureMap.end()) ! return &(it->second); ! else ! return NULL; ! } ! ! // Accesseur sur un plugin. ! Plugin* PluginLoader::GetPlugin(long l) ! { ! PluginMap::iterator it = m_PluginMap.begin(); ! l++; ! while(it!=m_PluginMap.end() && l>0) ! { ! it++; ! l--; ! } ! if(it!=m_PluginMap.end()) ! return &(it->second); ! else ! return NULL; ! } ! ! // Accesseur sur une dynlib. ! DynLib* PluginLoader::GetDynLib(long l) ! { ! DynLibMap::iterator it = m_DynLibMap.begin(); ! l++; ! while(it!=m_DynLibMap.end() && l>0) ! { ! it++; ! l--; ! } ! if(it!=m_DynLibMap.end()) ! return &(it->second); ! else ! return NULL; ! } ! ! // Accesseur sur une feature. ! Feature* PluginLoader::GetFeature(wxString strFeature) { + FeatureMap::iterator it = m_FeatureMap.find(strFeature); + if(it==m_FeatureMap.end()) + return NULL; + else + return &(it->second); + } + + // Accesseur sur un plugin. + Plugin* PluginLoader::GetPlugin(wxString strPlugin) + { + PluginMap::iterator it = m_PluginMap.find(strPlugin); + if(it==m_PluginMap.end()) + return NULL; + else + return &(it->second); + } + + // Accesseur sur une dynlib. + DynLib* PluginLoader::GetDynLib(wxString strDynLib) + { + DynLibMap::iterator it = m_DynLibMap.find(strDynLib); + if(it==m_DynLibMap.end()) + return NULL; + else + return &(it->second); } *************** *** 589,595 **** } ! str << wxT("*** Modules : ") << m_ModuleMap.size() << wxT(" ***\n"); ! ModuleMap::iterator it3; ! for( it3 = m_ModuleMap.begin(); it3 != m_ModuleMap.end(); ++it3 ) { str << wxT(">> ") << it3->first << wxT("\n"); --- 679,685 ---- } ! str << wxT("*** DynLibs : ") << m_DynLibMap.size() << wxT(" ***\n"); ! DynLibMap::iterator it3; ! for( it3 = m_DynLibMap.begin(); it3 != m_DynLibMap.end(); ++it3 ) { str << wxT(">> ") << it3->first << wxT("\n"); *************** *** 602,615 **** ! // Charge un module à l'adresse spécifiée. ! Module* PluginLoader::LoadModule(wxString strPath) { ! wxLogDebug(wxT("Loading module %s"), strPath.GetData()); ! Module& module = m_ModuleMap[strPath]; ! if(module.IsLoaded()) ! return &module; ! else if(module.Load(strPath)) ! return &module; else return NULL; --- 692,705 ---- ! // Charge un dynlib à l'adresse spécifiée. ! DynLib* PluginLoader::LoadDynLib(wxString strPath) { ! wxLogDebug(wxT("Loading dynlib %s"), strPath.GetData()); ! DynLib& dynlib = m_DynLibMap[strPath]; ! if(dynlib.IsLoaded()) ! return &dynlib; ! else if(dynlib.Load(strPath)) ! return &dynlib; else return NULL; *************** *** 668,681 **** } ! // Initialise un module. ! bool PluginLoader::InitializeModule(wxString strName) { ! wxLogDebug(wxT("Initializing module %s"), strName.GetData()); ! Module& module = m_ModuleMap[strName]; ! if(module.IsInitialized()) return true; else ! return module.Initialize(); } --- 758,771 ---- } ! // Initialise un dynlib. ! bool PluginLoader::InitializeDynLib(wxString strName) { ! wxLogDebug(wxT("Initializing dynlib %s"), strName.GetData()); ! DynLib& dynlib = m_DynLibMap[strName]; ! if(dynlib.IsInitialized()) return true; else ! return dynlib.Initialize(); } *************** *** 698,705 **** InitializePlugin(it2->first); ! wxLogDebug("Initialize module :"); ! ModuleMap::iterator it3; ! for( it3 = m_ModuleMap.begin(); it3 != m_ModuleMap.end(); ++it3 ) ! InitializeModule(it3->first); } --- 788,795 ---- InitializePlugin(it2->first); ! wxLogDebug("Initialize dynlib :"); ! DynLibMap::iterator it3; ! for( it3 = m_DynLibMap.begin(); it3 != m_DynLibMap.end(); ++it3 ) ! InitializeDynLib(it3->first); } *************** *** 863,868 **** if(pDep->GetName()==wxT("plugin")) // Import d'un plugin. m_arrstrPlugins.Add(pDep->GetPropVal(wxT("name"), wxT(""))); ! else if(pDep->GetName()==wxT("module")) // Import d'un module. ! m_arrstrModules.Add(pDep->GetPropVal(wxT("name"), wxT(""))); pDep = pDep->GetNext(); --- 953,958 ---- if(pDep->GetName()==wxT("plugin")) // Import d'un plugin. m_arrstrPlugins.Add(pDep->GetPropVal(wxT("name"), wxT(""))); ! else if(pDep->GetName()==wxT("dynlib")) // Import d'un dynlib. ! m_arrstrDynLibs.Add(pDep->GetPropVal(wxT("name"), wxT(""))); pDep = pDep->GetNext(); *************** *** 874,880 **** // Suppression des noms vides unsigned long l; ! for(l=0; l<m_arrstrModules.GetCount(); l++) ! if(m_arrstrModules[l].IsEmpty()) ! m_arrstrModules.RemoveAt(l--); for(l=0; l<m_arrstrPlugins.GetCount(); l++) if(m_arrstrPlugins[l].IsEmpty()) --- 964,970 ---- // Suppression des noms vides unsigned long l; ! for(l=0; l<m_arrstrDynLibs.GetCount(); l++) ! if(m_arrstrDynLibs[l].IsEmpty()) ! m_arrstrDynLibs.RemoveAt(l--); for(l=0; l<m_arrstrPlugins.GetCount(); l++) if(m_arrstrPlugins[l].IsEmpty()) *************** *** 892,901 **** } ! // Remplit une liste des chemins relatifs des modules à charger. ! void PluginDescriptionFile::FillModuleArray(wxArrayString& array) { unsigned long l; ! for(l=0; l<m_arrstrModules.GetCount(); l++) ! array.Add(m_arrstrModules[l]); } --- 982,991 ---- } ! // Remplit une liste des chemins relatifs des dynlibs à charger. ! void PluginDescriptionFile::FillDynLibArray(wxArrayString& array) { unsigned long l; ! for(l=0; l<m_arrstrDynLibs.GetCount(); l++) ! array.Add(m_arrstrDynLibs[l]); } Index: FileSystemTreeCtrl.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemTreeCtrl.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileSystemTreeCtrl.cpp 15 Sep 2005 09:54:25 -0000 1.3 --- FileSystemTreeCtrl.cpp 11 Oct 2005 19:54:24 -0000 1.4 *************** *** 91,94 **** --- 91,111 ---- } + // Ouvre l'arbre à la base du système de fichiers. + void FileSystemTreeCtrl::OpenRoot(unsigned int nMode) + { + wxTreeItemId Id; + wxString str; + + DeleteAllItems(); + m_strRootPath = m_pFileSystem->GetRootPath(); + m_nMode = nMode; + Id = AddRoot(m_pFileSystem->GetRoot(), m_pFileSystem->GetFileType(m_pFileSystem->GetRootPath()), -1, new FileSystemTreeItemData(m_pFileSystem->GetRootDescription())); + AppendItem(Id, WXDC_FSTC_EXPAND_MARKER); + + Expand(GetRootItem()); + SelectItem(GetRootItem()); + } + + // Interception de l'évènement de déroulement d'une branche. void FileSystemTreeCtrl::OnTreeItemExpanding(wxTreeEvent &event) *************** *** 106,120 **** 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(); --- 123,147 ---- wxString str; + FileSystemTreeItemData *pParentItemData = (FileSystemTreeItemData*)GetItemData(idItem); + wxString strPath = pParentItemData->GetFilePath(); + + wxLogDebug("RefreshContent : %s (%s)", GetItemText(idItem).GetData(), strPath.GetData()); + DeleteChildren(idItem); + // Insertion des répertoires if(m_nMode&WXDC_FSTC_MODE_DIR) { ! FP = m_pFileSystem->FindFirst(strPath, wxDIR_DIRS); ! while(!FP.IsEmpty()) { pItemData = new FileSystemTreeItemData(m_pFileSystem->GetCurrentFileDescription()); NewId = AppendItem(idItem, FP, pItemData->GetType(), -1, pItemData); + wxLogDebug("Append dir : %s (%s)", FP.GetData(), pItemData->GetFilePath().GetData()); + + pItemData = (FileSystemTreeItemData*) GetItemData(NewId); + wxLogDebug("Test : %s ", pItemData->GetFilePath().GetData()); + AppendItem(NewId, WXDC_FSTC_EXPAND_MARKER); FP = m_pFileSystem->FindNext(); *************** *** 125,134 **** 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(); } --- 152,161 ---- if(m_nMode&WXDC_FSTC_MODE_FILE) { ! FP = m_pFileSystem->FindFirst(strPath, wxDIR_FILES); ! while(!FP.IsEmpty()) { pItemData = new FileSystemTreeItemData(m_pFileSystem->GetCurrentFileDescription()); NewId = AppendItem(idItem, FP, pItemData->GetType(), -1, pItemData); + wxLogDebug("Append file : %s (%s)", FP.GetData(), pItemData->GetFilePath().GetData()); FP = m_pFileSystem->FindNext(); } Index: Frame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Frame.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Frame.cpp 15 Sep 2005 10:15:05 -0000 1.12 --- Frame.cpp 11 Oct 2005 19:54:24 -0000 1.13 *************** *** 65,77 **** ////////////////////////////////////////////////////////////////////// ! IMPLEMENT_CLASS(TopFrame, wxFrame) ! BEGIN_EVENT_TABLE(wxDevCenter::TopFrame, wxFrame) END_EVENT_TABLE() ! TopFrame::TopFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style): ! wxFrame(NULL, -1, title, pos, size, style), m_pViewFrame(NULL) { } --- 65,83 ---- ////////////////////////////////////////////////////////////////////// ! IMPLEMENT_ABSTRACT_CLASS(TopFrame, wxFrame) ! BEGIN_EVENT_TABLE(TopFrame, wxFrame) END_EVENT_TABLE() ! TopFrame::TopFrame(): ! Element(), ! wxFrame(), m_pViewFrame(NULL) { + } + + bool TopFrame::Create(const wxString& title, const wxPoint& pos, const wxSize& size, long style) + { + return wxFrame::Create(NULL, -1, title, pos, size, style); } *************** *** 80,83 **** --- 86,122 ---- } + bool TopFrame::Initialize() + { + Element::Initialize(); + return true; + } + + void TopFrame::Finalize() + { + Element::Finalize(); + } + + bool TopFrame::Destroy(bool bForce) + { + // Do not call Element::Finalize because use of wxFrame::Destroy() + + bool bClose = Application::GetApp().GetDocManager().CloseAllDocuments(); + + if(bForce || bClose) + { + WorkBarManager::GetManager().UnregisterFrame(this); + Element::Destroy(bForce); + return wxFrame::Destroy(); + } + else + return false; + } + + bool TopFrame::CanDestroy() + { + Element::CanDestroy(); + return Application::GetApp().GetDocManager().CloseAllDocuments(); + } + // Surcharge le procédé d'exécution des évènements. *************** *** 101,111 **** - // Surcharge du processus de destruction. - bool TopFrame::Destroy() - { - WorkBarManager::GetManager().UnregisterFrame(this); - return wxFrame::Destroy(); - } - // Retourne le layout attaché à la fenetre. wxDevCenter::Layout TopFrame::GetLayout() --- 140,143 ---- *************** *** 116,119 **** --- 148,162 ---- ////////////////////////////////////////////////////////////////////// + // TopFrameManager + ////////////////////////////////////////////////////////////////////// + + TopFrameManager TopFrameManager::s_TopFrameManager; + + TopFrameTemplate::TopFrameTemplate(wxClassInfo* pClassInfo):ObjectTemplate<TopFrame>(pClassInfo, wxT("Test"), wxT("")) + { + TopFrameManager::GetManager().RegisterTemplate(this); + } + + ////////////////////////////////////////////////////////////////////// // ViewFrame ////////////////////////////////////////////////////////////////////// Index: DocManager.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/DocManager.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** DocManager.cpp 14 Sep 2005 20:01:53 -0000 1.13 --- DocManager.cpp 11 Oct 2005 19:54:24 -0000 1.14 *************** *** 24,29 **** #include <wxDevCenter.h> #include <wxDevCenter/DocView.h> ! #include <wxDevCenter/MainFrame.h> ! #include <wxDevCenter/MDIFrame.h> #include <wxDevCenter/ArtProvider.h> --- 24,28 ---- #include <wxDevCenter.h> #include <wxDevCenter/DocView.h> ! #include <wxDevCenter/Frame.h> #include <wxDevCenter/ArtProvider.h> *************** *** 299,303 **** pView->OnCreate(); ! Application::GetApp().GetMainFrame().AddView(pView); pView->OnInitialUpdate(); --- 298,302 ---- pView->OnCreate(); ! Application::GetApp().GetTopFrame().AddView(pView); pView->OnInitialUpdate(); Index: MDIFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MDIFrame.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MDIFrame.cpp 14 Sep 2005 14:19:11 -0000 1.8 --- MDIFrame.cpp 11 Oct 2005 19:54:24 -0000 1.9 *************** *** 23,27 **** ! #include <wxDevCenter.h> #include <wxDevCenter/MDIFrame.h> --- 23,27 ---- ! #include <wxDevCenterPlugin.h> #include <wxDevCenter/MDIFrame.h> Index: Application.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Application.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Application.cpp 15 Sep 2005 16:11:47 -0000 1.37 --- Application.cpp 11 Oct 2005 19:54:24 -0000 1.38 *************** *** 26,42 **** #include <wxDevCenter/AboutBox.h> #include <wxDevCenter/Config.h> #include <wxDevCenter/FileSystem.h> #include <wxDevCenter/FileSystemStandard.h> #include <wxDevCenter/FileSystemCtrl.h> - #include <wxDevCenter/Frame.h> - #include <wxDevCenter/MainFrame.h> - #include <wxDevCenter/DocView.h> #include <wxDevCenter/FileTools.h> #include <wxDevCenter/Project.h> - #include <wxDevCenter/ArtProvider.h> - #include <wxDevCenter/Command.h> #include <wxDevCenter/WorkBar.h> #include <wx/dynlib.h> #include <wx/sysopt.h> --- 26,44 ---- #include <wxDevCenter/AboutBox.h> + #include <wxDevCenter/ArtProvider.h> + #include <wxDevCenter/Command.h> #include <wxDevCenter/Config.h> + #include <wxDevCenter/DocView.h> #include <wxDevCenter/FileSystem.h> #include <wxDevCenter/FileSystemStandard.h> #include <wxDevCenter/FileSystemCtrl.h> #include <wxDevCenter/FileTools.h> + #include <wxDevCenter/Frame.h> + #include <wxDevCenter/Plugin.h> #include <wxDevCenter/Project.h> #include <wxDevCenter/WorkBar.h> + + #include <wx/dir.h> #include <wx/dynlib.h> #include <wx/sysopt.h> *************** *** 81,93 **** wxArtProvider::PushProvider(new ArtProvider); // Initialise les gestionnaires m_DocManager.Initialize(); m_ProjectManager.Initialize(); WorkBarManager::GetManager().Initialize(); // Charge les plugins : phase de tests ! m_PluginLoader.Load(); ! wxLogDebug(m_PluginLoader.Dump()); ! m_PluginLoader.Initialize(); // Crée la config utilisateur. --- 83,98 ---- wxArtProvider::PushProvider(new ArtProvider); + // Initialise les gestionnaires m_DocManager.Initialize(); m_ProjectManager.Initialize(); WorkBarManager::GetManager().Initialize(); + TopFrameManager::GetManager().Initialize(); // Charge les plugins : phase de tests ! plugins::PluginLoader::GetManager().Load(); ! wxLogDebug(plugins::PluginLoader::GetManager().Dump()); ! plugins::PluginLoader::GetManager().Initialize(); ! // Crée la config utilisateur. *************** *** 98,103 **** // Initialise le gestionnaire de systèmes de fichiers ! m_pStandardFileSystem = new FileSystemStandard; ! FileSystemManager::GetManager().Register(m_pStandardFileSystem, true); // Initialise les menus par défaut. --- 103,108 ---- // Initialise le gestionnaire de systèmes de fichiers ! // m_pStandardFileSystem = FileSystemStandard::CreateFileSystemStandard(); ! // FileSystemManager::GetManager().Register(m_pStandardFileSystem, true); // Initialise les menus par défaut. *************** *** 105,119 **** // Crée la fenetre principale ! m_pMainFrame = new MainFrame(); ! SetTopWindow(m_pMainFrame); // Fixe le conteneur de vue par défaut du DocManager ! m_DocManager.m_pDefaultViewContainer = (wxWindow*) m_pMainFrame->GetViewFrame(); // Affiche la fenetre principale. ! m_pMainFrame->Show(true); // Enregistre la fenêtre principale dans le WorkBarManager ! WorkBarManager::GetManager().RegisterFrame(m_pMainFrame); // Lance l'application. --- 110,134 ---- // Crée la fenetre principale ! m_pTopFrame = (TopFrame*) TopFrameManager::GetManager().CreateTopFrame(); ! if(m_pTopFrame==NULL) ! { ! wxLogError(wxT("No top frame implementation")); ! return false; ! } ! if(!m_pTopFrame->Create(WXDC_NAME, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE)) ! { ! wxLogError(wxT("Can not create top frame")); ! return false; ! } ! SetTopWindow(m_pTopFrame); // Fixe le conteneur de vue par défaut du DocManager ! m_DocManager.m_pDefaultViewContainer = (wxWindow*) m_pTopFrame->GetViewFrame(); // Affiche la fenetre principale. ! m_pTopFrame->Show(true); // Enregistre la fenêtre principale dans le WorkBarManager ! WorkBarManager::GetManager().RegisterFrame(m_pTopFrame); // Lance l'application. *************** *** 333,337 **** } ! m_pMainFrame->AddView(pView); pView->OnInitialUpdate(); --- 348,352 ---- } ! m_pTopFrame->AddView(pView); pView->OnInitialUpdate(); Index: FileSystemStandard.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemStandard.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** FileSystemStandard.cpp 14 Sep 2005 20:17:00 -0000 1.19 --- FileSystemStandard.cpp 11 Oct 2005 19:54:24 -0000 1.20 *************** *** 36,41 **** ////////////////////////////////////////////////////////////////////// // Standard file system ! bool FileSystemStandardBase::CreateDirectory(FilePath strDir) { strDir.RemoveProtocol(); --- 36,56 ---- ////////////////////////////////////////////////////////////////////// // Standard file system + IMPLEMENT_ABSTRACT_CLASS(FileSystemStandard, FileSystem) ! bool FileSystemStandard::Initialize() ! { ! if(FileSystem::Initialize()) ! return FileSystemManager::GetManager().Register(this, true); ! else ! return false; ! } ! ! void FileSystemStandard::Finalize() ! { ! FileSystemManager::GetManager().Unregister(this); ! FileSystem::Finalize(); ! } ! ! bool FileSystemStandard::CreateDirectory(FilePath strDir) { strDir.RemoveProtocol(); *************** *** 43,47 **** } ! bool FileSystemStandardBase::RemoveDirectory(FilePath strDir) { strDir.RemoveProtocol(); --- 58,62 ---- } ! bool FileSystemStandard::RemoveDirectory(FilePath strDir) { strDir.RemoveProtocol(); *************** *** 49,53 **** } ! bool FileSystemStandardBase::RemoveFile(FilePath strFilePath) { strFilePath.RemoveProtocol(); --- 64,68 ---- } ! bool FileSystemStandard::RemoveFile(FilePath strFilePath) { strFilePath.RemoveProtocol(); *************** *** 55,59 **** } ! int FileSystemStandardBase::GetFileType(const FilePath& strPath) { long type; --- 70,74 ---- } ! int FileSystemStandard::GetFileType(const FilePath& strPath) { long type; *************** *** 73,77 **** } ! wxImageList* FileSystemStandardBase::GetImageList(int width) { wxImageList* pIL = new wxImageList(width, width, true, WXDC_STDFS_FILETYPES + Application::GetApp().GetDocManager().GetDocTemplateCount()); --- 88,92 ---- } ! wxImageList* FileSystemStandard::GetImageList(int width) { wxImageList* pIL = new wxImageList(width, width, true, WXDC_STDFS_FILETYPES + Application::GetApp().GetDocManager().GetDocTemplateCount()); *************** *** 96,105 **** } ! wxInputStream* FileSystemStandardBase::GetInputStream(FilePath strPath) { return new wxFileInputStream(GetPhysicalFilePath(strPath)); } ! wxOutputStream* FileSystemStandardBase::GetOutputStream(FilePath strPath) { return new wxFileOutputStream(GetPhysicalFilePath(strPath)); --- 111,120 ---- } ! wxInputStream* FileSystemStandard::GetInputStream(FilePath strPath) { return new wxFileInputStream(GetPhysicalFilePath(strPath)); } ! wxOutputStream* FileSystemStandard::GetOutputStream(FilePath strPath) { return new wxFileOutputStream(GetPhysicalFilePath(strPath)); |