|
From: Emilien K. <cur...@us...> - 2005-05-14 12:16:08
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15322/src Modified Files: AboutBox.cpp Application.cpp DocManager.cpp DocType.cpp Document.cpp FileSystem.cpp FileSystemStandard.cpp FileTools.cpp Frame.cpp MDIFrame.cpp MainFrame.cpp Manager.cpp Plugin.cpp Project.cpp View.cpp WorkBar.cpp Added Files: AppImpl.cpp Element.cpp Log Message: Transition to the new feature/plugin system based on the Element class. Index: DocType.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/DocType.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DocType.cpp 16 Mar 2005 14:27:37 -0000 1.3 --- DocType.cpp 14 May 2005 12:15:56 -0000 1.4 *************** *** 59,63 **** // Déclaration du type de documents. ! wxGetApp().GetDocManager().RegisterDocTemplate(this); } --- 59,63 ---- // Déclaration du type de documents. ! Application::GetApp().GetDocManager().RegisterDocTemplate(this); } --- NEW FILE: Element.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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AboutBox.cpp 3 Dec 2004 17:27:29 -0000 1.2 --- AboutBox.cpp 14 May 2005 12:15:56 -0000 1.3 *************** *** 87,92 **** { SetBackgroundColour(*wxWHITE); ! m_WXDCLogo = wxGetApp().LoadAppBitmap("wxDevCenter.png", wxBITMAP_TYPE_PNG); ! m_WXLogo = wxGetApp().LoadAppBitmap("wx.png", wxBITMAP_TYPE_PNG); } --- 87,92 ---- { SetBackgroundColour(*wxWHITE); ! m_WXDCLogo = Application::GetApp().LoadAppBitmap("wxDevCenter.png", wxBITMAP_TYPE_PNG); ! m_WXLogo = Application::GetApp().LoadAppBitmap("wx.png", wxBITMAP_TYPE_PNG); } *************** *** 114,118 **** wxListbook(parent, id) { ! PluginManager& PM = wxGetApp().GetPluginManager(); for(unsigned int n=0; n<PM.GetCount(); n++) --- 114,118 ---- wxListbook(parent, id) { ! /* PluginManager& PM = Application::GetApp().GetPluginManager(); for(unsigned int n=0; n<PM.GetCount(); n++) *************** *** 122,126 **** pWindow = new wxWindow(this, -1); AddPage(pWindow, PM[n].GetName()); ! } } --- 122,126 ---- pWindow = new wxWindow(this, -1); AddPage(pWindow, PM[n].GetName()); ! }*/ } Index: MDIFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MDIFrame.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MDIFrame.cpp 4 Apr 2005 08:11:23 -0000 1.5 --- MDIFrame.cpp 14 May 2005 12:15:56 -0000 1.6 *************** *** 44,48 **** ViewFrame(pTopFrame) { ! SetImageList(wxGetApp().GetDocManager().GetImageList(WXDC_SETUP_NOTEBOOK_ICON_SIZE)); } --- 44,48 ---- ViewFrame(pTopFrame) { ! SetImageList(Application::GetApp().GetDocManager().GetImageList(WXDC_SETUP_NOTEBOOK_ICON_SIZE)); } *************** *** 93,97 **** { wxString str = pView->GetDocument()->GetDocumentName(); ! long type = wxGetApp().GetDocManager().FindDocTemplate(pView->GetDocument()->GetDocTemplate()); View *pOldView = GetActiveView(); --- 93,97 ---- { wxString str = pView->GetDocument()->GetDocumentName(); ! long type = Application::GetApp().GetDocManager().FindDocTemplate(pView->GetDocument()->GetDocTemplate()); View *pOldView = GetActiveView(); *************** *** 186,190 **** while(GetPageCount()>0) { ! if(!wxGetApp().GetDocManager().CloseView((View*)GetPage(0))) return false; } --- 186,190 ---- while(GetPageCount()>0) { ! if(!Application::GetApp().GetDocManager().CloseView((View*)GetPage(0))) return false; } Index: View.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/View.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** View.cpp 12 Apr 2005 12:12:02 -0000 1.5 --- View.cpp 14 May 2005 12:15:56 -0000 1.6 *************** *** 30,36 **** using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS(wxDevCenter::View, wxPanel) ! BEGIN_EVENT_TABLE(wxDevCenter::View, wxPanel) END_EVENT_TABLE() --- 30,36 ---- using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS2(View, wxPanel, Element) ! BEGIN_EVENT_TABLE(View, wxPanel) END_EVENT_TABLE() *************** *** 39,42 **** --- 39,43 ---- View::View(): wxPanel(), + plugins::PluginItem(), m_pDocument(NULL) { Index: FileTools.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileTools.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FileTools.cpp 28 Feb 2005 15:26:23 -0000 1.5 --- FileTools.cpp 14 May 2005 12:15:56 -0000 1.6 *************** *** 62,72 **** } - FilePath::FilePath(const wchar_t* psz): - wxString(psz) - { - Validate(); - } - - // Retourne le nom du fichier "titre.ext" wxString FilePath::GetFileName()const --- 62,65 ---- Index: FileSystem.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystem.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileSystem.cpp 17 Mar 2005 17:51:24 -0000 1.4 --- FileSystem.cpp 14 May 2005 12:15:56 -0000 1.5 *************** *** 59,62 **** --- 59,64 ---- // Fonctions de la classe de base + IMPLEMENT_CLASS2(FileSystem, wxEvtHandler, Element) + // Retourne le répertoire parent. FilePath FileSystem::GetParentDirectory(FilePath strPath) *************** *** 82,86 **** FilePath str = pItemData->GetPath(); if(!pTree->GetFileSystem()->IsDirectory(str)) ! wxGetApp().OpenDocument(str); } else --- 84,88 ---- FilePath str = pItemData->GetPath(); if(!pTree->GetFileSystem()->IsDirectory(str)) ! Application::GetApp().OpenDocument(str); } else *************** *** 232,236 **** FileSystemManager::FileSystemManager(): ! InitializableObjectManager<FileSystem>() { } --- 234,238 ---- FileSystemManager::FileSystemManager(): ! ElementManager<FileSystem>() { } *************** *** 263,270 **** bool FileSystemManager::Register(FileSystem* pFileSystem, bool bMountWorkBar) { ! if(!InitializableObjectManager<FileSystem>::Register(pFileSystem)) return false; if(bMountWorkBar) ! wxGetApp().GetWorkBarManager().RegisterWorkBar(CLASSINFO(FileSystemTreeWorkBar), pFileSystem->GetFileSystemName(), pFileSystem->GetProtocoleName(), pFileSystem); return true; } --- 265,272 ---- bool FileSystemManager::Register(FileSystem* pFileSystem, bool bMountWorkBar) { ! if(!ElementManager<FileSystem>::Register(pFileSystem)) return false; if(bMountWorkBar) ! Application::GetApp().GetWorkBarManager().RegisterWorkBar(CLASSINFO(FileSystemTreeWorkBar), pFileSystem->GetFileSystemName(), pFileSystem->GetProtocoleName(), pFileSystem); return true; } *************** *** 273,278 **** bool FileSystemManager::Unregister(FileSystem* pFileSystem) { ! wxGetApp().GetWorkBarManager().UnregisterWorkBar(CLASSINFO(FileSystemTreeWorkBar), pFileSystem); ! return InitializableObjectManager<FileSystem>::Unregister(pFileSystem); } --- 275,280 ---- bool FileSystemManager::Unregister(FileSystem* pFileSystem) { ! Application::GetApp().GetWorkBarManager().UnregisterWorkBar(CLASSINFO(FileSystemTreeWorkBar), pFileSystem); ! return ElementManager<FileSystem>::Unregister(pFileSystem); } Index: Plugin.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Plugin.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Plugin.cpp 7 Mar 2005 15:23:04 -0000 1.2 --- Plugin.cpp 14 May 2005 12:15:56 -0000 1.3 *************** *** 26,126 **** #include <wxDevCenter/Plugin.h> - using namespace wxDevCenter; /** ! * Implémentation de la classe wxDevCenter::Plugin. */ ! Plugin::Plugin(wxString strName, wxString strDescript): wxObject(), ! m_strName(strName), ! m_strDescript(strDescript) { - wxGetApp().GetPluginManager().Add(this); } ! Plugin::~Plugin(void) { } ! // Retourne le nom du plugin. ! wxString Plugin::GetName()const { ! return m_strName; } ! // Retourne la description du plugin. ! wxString Plugin::GetDescription()const { ! return m_strDescript; } ! // Retourne une image représentant le logo du plugin. ! wxBitmap Plugin::GetLogo(wxSize sz) { ! wxBitmap bmp(sz.x, sz.y); ! return bmp; } ! // Initialisation du plugin. ! void Plugin::InitPlugin() { } ! // Finalisalisation du plugin. ! void Plugin::FinalPlugin() { } ! // Retourne un panneau "A propos de" du plugin. ! wxPanel* Plugin::CreateAboutPanel(wxWindow* WXUNUSED(pParent), wxWindowID WXUNUSED(id)) { ! return NULL; } /** ! * Implémentation de la classe wxDevCenter::PluginManager. */ ! PluginManager::PluginManager(void): ! PluginArray() { } ! PluginManager::~PluginManager(void) { } ! // Ajoute un plugin. ! void PluginManager::Add(Plugin* pPlugin) { ! PluginArray::Add(pPlugin); } ! // Initialise les plugins. ! void PluginManager::InitPlugins() { ! for(unsigned int n=0; n<GetCount(); n++) ! Item(n)->InitPlugin(); } ! // Finalise les plugins. ! void PluginManager::FinalPlugins() { ! for(unsigned int n=0; n<GetCount(); n++) ! Item(n)->FinalPlugin(); } ! // Dump des plugins. ! void PluginManager::Dump() { wxString str; ! str << "Plugins : " << GetCount() << "\n"; ! for(unsigned int n=0; n<GetCount(); n++) ! str << Item(n)->GetName(); ! wxMessageBox(str); } --- 26,822 ---- #include <wxDevCenter/Plugin.h> using namespace wxDevCenter; + using namespace plugins; + + /** ! * Implémentation de la classe wxDevCenter::plugins::ModuleRefData. */ ! ModuleRefData::ModuleRefData(): ! wxObjectRefData(), ! m_flagState(Initial), ! m_DLL(), ! m_Elements() ! { ! } ! ! ModuleRefData::~ModuleRefData() ! { ! } ! ! // Débugage : Dump du contenu. ! wxDEBUG_CODE( ! wxString ModuleRefData::Dump() ! { ! wxString str; ! str << m_strPath << wxT(" : ") << m_Elements.GetCount() << wxT(" objects registered.") << wxT("\n"); ! return str; ! } ! ) ! ! // Charge le module. ! bool ModuleRefData::Load(wxString strPath) ! { ! wxLogDebug("Loading module %s", strPath); ! ! BaseElementManager* pOldBEM = Element::s_pElementManager; ! Element::s_pElementManager = &m_Elements; ! ! m_strPath = strPath; ! ! bool flag = m_DLL.Load(strPath, wxDL_VERBATIM); ! ! Element::s_pElementManager = pOldBEM; ! ! return flag; ! } ! ! // 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++) ! { ! wxLogDebug("Initialize element %ld : %s", l, m_Elements[l].GetClassInfo()->GetClassName()); ! if(!m_Elements[l].IsInitialized()) ! bOK &= m_Elements[l].Initialize(); ! } ! return bOK; ! } ! ! // Finalise le contenu du module. ! bool ModuleRefData::Finalize() ! { ! return false; ! } ! ! ! ! /** ! * Implémentation de la classe wxDevCenter::plugins::Module. ! */ ! ! IMPLEMENT_CLASS(Module, wxObject) ! ! // Constructeur. ! Module::Module(): ! wxObject() ! { ! } ! ! // 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; ! } ! ! ! // 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; ! } ! ! ! /** ! * Implémentation de la classe wxDevCenter::plugins::Plugin. ! */ ! ! IMPLEMENT_CLASS(Plugin, wxObject) ! ! // Constructeur. ! Plugin::Plugin(): wxObject(), ! m_pLoader(NULL), ! m_Status(Initial) { } ! // Débugage : Dump du contenu. ! wxDEBUG_CODE( ! wxString Plugin::Dump() { + wxString str; + str << m_strName << wxT(" (") << m_Version.ToString() << wxT(")") << wxT(" : ") << m_strDescript << wxT("\n"); + str << wxT("Used plugins : ") << m_arrstrPlugins.GetCount() << wxT("\n"); + 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; } + ) ! // Teste si le plugin est chargé. ! bool Plugin::IsLoaded()const { ! return (m_Status&Loaded)!=0; } ! ! // Teste si le plugin peut être chargé. ! bool Plugin::CheckValidity() { ! return false; } ! // Précharge la description du plugin. ! bool Plugin::PreLoad(wxString strName) { ! wxString strFilePath = Application::GetApp().GetConfig().GetPluginsPath() + wxT("/") + strName + wxT("/plugin.xml"); ! PluginDescriptionFile File(strFilePath); ! if(File.IsValid()) ! { ! m_strName = File.GetName(); ! m_strDescript = File.GetDescript(); ! m_Version = File.GetVersion(); ! m_strAuthor = File.GetAuthor(); ! m_strLicence = File.GetLicence(); ! m_strNotes = File.GetNotes(); ! m_strURL = File.GetURL(); ! File.FillModuleArray(m_arrstrModules); ! File.FillDependantPluginArray(m_arrstrPlugins); ! m_Status = PreLoaded; ! return true; ! } ! m_Status = ErrDescript; ! wxLogDebug("Invalid feature description file"); ! return false; } ! // Charge le plugin. ! bool Plugin::Load(wxString strName) { + unsigned long l; + bool bOk = true; + + wxLogDebug("Loading plugin %s ...", strName); + + // Préchargement des plugins dépendants. + for(l=0; l<m_arrstrPlugins.GetCount(); l++) + 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); + + return bOk; } ! // Décharge le plugin. ! bool Plugin::Unload() { + return false; } ! // Initialise le plugin. ! bool Plugin::Initialize() { ! return false; ! } ! ! // Finalise le plugin. ! bool Plugin::Finalize() ! { ! return false; } + /** ! * Implémentation de la classe wxDevCenter::plugins::Plugin. */ ! IMPLEMENT_CLASS(Feature, wxObject) ! ! // Constructeur. ! Feature::Feature(): ! wxObject(), ! m_pLoader(NULL), ! m_Status(Initial) { } ! // Débugage : Dump du contenu. ! wxDEBUG_CODE( ! wxString Feature::Dump() { + wxString str; + str << m_strName << wxT(" (") << m_Version.ToString() << wxT(")") << wxT(" : ") << m_strDescript << wxT("\n"); + str << wxT("Used features : ") << m_arrstrFeatures.GetCount() << wxT("\n"); + for(long l=0; l<(long)m_arrstrFeatures.GetCount(); l++) + str << wxT(" - ") << m_arrstrFeatures[l] << wxT("\n"); + str << wxT("Used plugins : ") << m_arrstrPlugins.GetCount() << wxT("\n"); + for(long l=0; l<(long)m_arrstrPlugins.GetCount(); l++) + str << wxT(" - ") << m_arrstrPlugins[l] << wxT("\n"); + return str; } + ) ! // Teste si la fonctionnalité peut être chargé. ! bool Feature::CheckValidity() { ! return false; } ! // Teste si la fonctionnalité est chargée. ! bool Feature::IsLoaded()const { ! return (m_Status&Loaded)!=0; } ! // Précharge la description de la fonctionnalité. ! bool Feature::PreLoad(wxString strName) { ! wxString strFilePath = Application::GetApp().GetConfig().GetFeaturesPath() + wxT("/") + strName + wxT("/feature.xml"); ! FeatureDescriptionFile File(strFilePath); ! if(File.IsValid()) ! { ! m_strName = File.GetName(); ! m_strDescript = File.GetDescript(); ! m_Version = File.GetVersion(); ! m_strAuthor = File.GetAuthor(); ! m_strLicence = File.GetLicence(); ! m_strNotes = File.GetNotes(); ! m_strURL = File.GetURL(); ! File.FillDependantFeatureArray(m_arrstrFeatures); ! File.FillDependantPluginArray(m_arrstrPlugins); ! m_Status = PreLoaded; ! return true; ! } ! wxLogDebug("Invalid feature description file"); ! m_Status = ErrDescript; ! return false; } ! // Charge la fonctionnalité. ! bool Feature::Load(wxString strName) ! { ! unsigned long l; ! bool bOk = true; ! ! wxLogDebug("Loading feature %s ...", strName); ! ! // Préchargement des fonctionnalité dépendantes. ! for(l=0; l<m_arrstrFeatures.GetCount(); l++) ! bOk &= m_pLoader->LoadFeature(m_arrstrFeatures[l])!=NULL; ! ! // Préchargement des plugins dépendants. ! for(l=0; l<m_arrstrPlugins.GetCount(); l++) ! bOk &= m_pLoader->LoadPlugin(m_arrstrPlugins[l])!=NULL; ! ! m_Status = Loaded | (bOk?0:Partial); ! ! return bOk; ! } ! ! // Décharge la fonctionnalité. ! bool Feature::Unload() ! { ! return false; ! } ! ! // Initialise la fonctionnalité. ! bool Feature::Initialize() ! { ! return false; ! } ! ! // Finalise la fonctionnalité. ! bool Feature::Finalize() ! { ! return false; ! } ! ! // Retourne une image représentant le logo du plugin. ! wxBitmap Feature::GetLogo(wxSize WXUNUSED(sz)) ! { ! return wxNullBitmap; ! } ! ! // Retourne les crédits de la fonctionnalité. ! wxString Feature::GetCredits()const ! { ! return wxT(""); ! } ! ! // Retourne la licence de la fonctionnalité. ! wxString Feature::GetLicence()const ! { ! return wxT(""); ! } ! ! ! /** ! * Implémentation de la classe wxDevCenter::PluginLoader. ! */ ! ! IMPLEMENT_CLASS(PluginLoader, wxObject) ! ! PluginLoader::PluginLoader(): ! wxObject(), ! m_FeatureMap(), ! m_PluginMap(), ! m_ModuleMap() ! { ! } ! ! // Charge tous les plugins. ! bool PluginLoader::Load() ! { ! // Précharge les descriptions de plugins. ! PreLoadDescription(); ! ! // Charge les fonctionnalités et leurs dépendances. ! for(FeatureMap::iterator iterFeature = m_FeatureMap.begin(); iterFeature != m_FeatureMap.end(); ++iterFeature ) ! LoadFeature(iterFeature->first); ! ! // Charge les plugins et leurs dépendances. ! for(PluginMap::iterator iterPlugin = m_PluginMap.begin(); iterPlugin != m_PluginMap.end(); ++iterPlugin) ! LoadPlugin(iterPlugin->first); ! ! return true; ! } ! ! // Précharge la description des fonctionnalités et des plugins. ! void PluginLoader::PreLoadDescription() { wxString str; ! bool bCont; ! wxDir dir; ! ! wxLogDebug("Preload feature descriptions :"); ! dir.Open(Application::GetApp().GetConfig().GetFeaturesPath()); ! bCont = dir.GetFirst(&str, wxEmptyString, wxDIR_DIRS); ! while(bCont) ! { ! wxLogDebug(" -> %s", str); ! PreLoadFeature(str); ! bCont = dir.GetNext(&str); ! } ! wxLogDebug("Preload plugin descriptions :"); ! dir.Open(Application::GetApp().GetConfig().GetPluginsPath()); ! bCont = dir.GetFirst(&str, wxEmptyString, wxDIR_DIRS); ! while(bCont) ! { ! wxLogDebug(" -> %s", str); ! PreLoadPlugin(str); ! bCont = dir.GetNext(&str); ! } ! ! } ! ! ! // Précharge la description d'une fonctionnalité. ! Feature* PluginLoader::PreLoadFeature(wxString strName) ! { ! Feature& feature = m_FeatureMap[strName]; ! feature.SetPluginLoader(this); ! feature.PreLoad(strName); ! return &feature; ! } ! ! // Précharge la description d'un plugin. ! plugins::Plugin* PluginLoader::PreLoadPlugin(wxString strName) ! { ! plugins::Plugin& plugin = m_PluginMap[strName]; ! plugin.SetPluginLoader(this); ! plugin.PreLoad(strName); ! return &plugin; ! } ! ! ! ! // Débugage : Dump du contenu. ! wxDEBUG_CODE( ! wxString PluginLoader::Dump() ! { ! wxString str; ! str << wxT("Plugin loader : ") << wxT("\n"); ! ! str << wxT("Features : ") << m_FeatureMap.size() << wxT("\n"); ! FeatureMap::iterator it1; ! for( it1 = m_FeatureMap.begin(); it1 != m_FeatureMap.end(); ++it1 ) ! { ! str << wxT(">> ") << it1->first << wxT("\n"); ! str << it1->second.Dump(); ! } ! ! str << wxT("Plugins : ") << m_PluginMap.size() << wxT("\n"); ! PluginMap::iterator it2; ! for( it2 = m_PluginMap.begin(); it2 != m_PluginMap.end(); ++it2 ) ! { ! str << wxT(">> ") << it2->first << wxT("\n"); ! str << it2->second.Dump(); ! } ! ! 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"); ! str << it3->second.Dump(); ! } ! ! return str; ! } ! ) ! ! ! // Charge un module à l'adresse spécifiée. ! Module* PluginLoader::LoadModule(wxString strPath) ! { ! wxLogDebug("Loading module %s", strPath); ! ! strPath.Prepend(Application::GetApp().GetConfig().GetPluginsPath() + wxT("/")); ! ! Module& module = m_ModuleMap[strPath]; ! if(module.IsLoaded()) ! return &module; ! else if(module.Load(strPath)) ! return &module; ! else ! return NULL; ! } ! ! // Charge un plugin ainsi que toutes ses dépendances. ! plugins::Plugin* PluginLoader::LoadPlugin(wxString strName) ! { ! wxLogDebug("Loading plugin %s", strName); ! ! plugins::Plugin& plugin = m_PluginMap[strName]; ! if(plugin.IsLoaded()) ! return &plugin; ! else if(plugin.Load(strName)) ! return &plugin; ! else ! return NULL; ! } ! ! // Charge une fonctionnalité. ! Feature* PluginLoader::LoadFeature(wxString strName) ! { ! wxLogDebug("Loading feature %s", strName); ! ! Feature& feature = m_FeatureMap[strName]; ! if(feature.IsLoaded()) ! return &feature; ! else if(feature.Load(strName)) ! return &feature; ! else ! return NULL; ! } ! ! // Initialise un plugin ainsi que toutes ses dépendances. ! bool PluginLoader::InitializePlugin(wxString strName) ! { ! wxLogDebug("Initializing plugin %s", strName); ! ! Plugin& plugin = m_PluginMap[strName]; ! if(plugin.IsInitialized()) ! return true; ! else ! return plugin.Initialize(); ! } ! ! // Initialise une fonctionnalité. ! bool PluginLoader::InitializeFeature(wxString strName) ! { ! wxLogDebug("Initializing feature %s", strName); ! ! Feature& feature = m_FeatureMap[strName]; ! if(feature.IsInitialized()) ! return true; ! else ! return feature.Initialize(); ! } ! ! // Initialise un module. ! bool PluginLoader::InitializeModule(wxString strName) ! { ! wxLogDebug("Initializing module %s", strName); ! ! Module& module = m_ModuleMap[strName]; ! if(module.IsInitialized()) ! return true; ! else ! return module.Initialize(); ! } ! ! ! // Initialise le contenu chargé. ! void PluginLoader::Initialize() ! { ! wxString str; ! ! wxLogDebug("Initializing ..."); ! ! wxLogDebug("Initialize feature :"); ! FeatureMap::iterator it1; ! for( it1 = m_FeatureMap.begin(); it1 != m_FeatureMap.end(); ++it1 ) ! InitializeFeature(it1->first); ! ! wxLogDebug("Initialize plugin :"); ! PluginMap::iterator it2; ! for( it2 = m_PluginMap.begin(); it2 != m_PluginMap.end(); ++it2 ) ! InitializePlugin(it2->first); ! ! wxLogDebug("Initialize module :"); ! ModuleMap::iterator it3; ! for( it3 = m_ModuleMap.begin(); it3 != m_ModuleMap.end(); ++it3 ) ! InitializeModule(it3->first); ! } ! ! // Finalise le contenu chargé. ! void PluginLoader::Finalize() ! { ! } ! ! ! /** ! * Implémentation de la classe wxDevCenter::plugins::FeatureDescriptionFile. ! */ ! ! // Constructeur. ! FeatureDescriptionFile::FeatureDescriptionFile(wxString strPath): ! wxObject(), ! m_Doc(), ! m_bOk(false) ! { ! if(m_Doc.Load(strPath)) ! Parse(); ! } ! ! // Destructeur. ! FeatureDescriptionFile::~FeatureDescriptionFile() ! { ! } ! ! ! // Parse le fichier xml. ! void FeatureDescriptionFile::Parse() ! { ! wxXmlNode* pRoot = m_Doc.GetRoot(); ! ! // Test de l'entité racine ! if(pRoot->GetName()!=wxT("feature")) ! return; ! ! // Récupération de l'identifiant. ! m_strIdent = pRoot->GetPropVal(wxT("id"), wxT("")); ! // Récupération du nom. ! m_strName = pRoot->GetPropVal(wxT("label"), wxT("")); ! // Récupération de la version. ! m_strVersion = pRoot->GetPropVal(wxT("version"), wxT("0.0.0.0")); ! // Récupération de l'auteur. ! m_strAuthor = pRoot->GetPropVal(wxT("provider-name"), wxT("unknow")); ! // Récupération de l'adresse web. ! m_strURL = pRoot->GetPropVal(wxT("url"), wxT("")); ! ! wxXmlNode* pChild = pRoot->GetChildren(); ! while(pChild!=NULL) ! { ! if(pChild->GetName()==wxT("description")) // Récupération de la description. ! m_strDescript = pChild->GetContent(); ! else if(pChild->GetName()==wxT("license")) // Récupération de la licence. ! m_strLicence = pChild->GetContent(); ! else if(pChild->GetName()==wxT("copyright")) // Récupération des notes. ! m_strNotes = pChild->GetContent(); ! else if(pChild->GetName()==wxT("requires")) // Récupération des dépendances. ! { ! wxXmlNode* pDep = pChild->GetChildren(); ! while(pDep!=NULL) ! { ! if(pDep->GetName()==wxT("feature")) // Import d'une fonctionnalité. ! m_arrstrFeatures.Add(pDep->GetPropVal(wxT("name"), wxT(""))); ! else if(pDep->GetName()==wxT("plugin")) // Import d'un plugin. ! m_arrstrPlugins.Add(pDep->GetPropVal(wxT("name"), wxT(""))); ! pDep = pDep->GetNext(); ! } ! } ! pChild = pChild->GetNext(); ! } ! ! // Suppression des noms vides ! unsigned long l; ! for(l=0; l<m_arrstrFeatures.GetCount(); l++) ! if(m_arrstrFeatures[l].IsEmpty()) ! m_arrstrFeatures.RemoveAt(l--); ! for(l=0; l<m_arrstrPlugins.GetCount(); l++) ! if(m_arrstrPlugins[l].IsEmpty()) ! m_arrstrPlugins.RemoveAt(l--); ! ! m_bOk = true; ! } ! ! ! ! // Remplit une liste de nom des fonctionnalités dépendantes. ! void FeatureDescriptionFile::FillDependantFeatureArray(wxArrayString& array) ! { ! unsigned long l; ! for(l=0; l<m_arrstrFeatures.GetCount(); l++) ! array.Add(m_arrstrFeatures[l]); ! } ! ! // Remplit une liste de nom des plugins dépendants. ! void FeatureDescriptionFile::FillDependantPluginArray(wxArrayString& array) ! { ! unsigned long l; ! for(l=0; l<m_arrstrPlugins.GetCount(); l++) ! array.Add(m_arrstrPlugins[l]); ! } ! ! ! ! /** ! * Implémentation de la classe wxDevCenter::plugins::PluginDescriptionFile. ! */ ! ! // Constructeur. ! PluginDescriptionFile::PluginDescriptionFile(wxString strPath): ! wxObject(), ! m_Doc(), ! m_bOk(false) ! { ! if(m_Doc.Load(strPath)) ! Parse(); ! } ! ! // Destructeur. ! PluginDescriptionFile::~PluginDescriptionFile() ! { ! } ! ! // Parse le fichier xml. ! void PluginDescriptionFile::Parse() ! { ! wxXmlNode* pRoot = m_Doc.GetRoot(); ! ! // Test de l'entité racine ! if(pRoot->GetName()!=wxT("plugin")) ! return; ! ! // Récupération de l'identifiant. ! m_strIdent = pRoot->GetPropVal(wxT("id"), wxT("")); ! // Récupération du nom. ! m_strName = pRoot->GetPropVal(wxT("label"), wxT("")); ! // Récupération de la version. ! m_strVersion = pRoot->GetPropVal(wxT("version"), wxT("0.0.0.0")); ! // Récupération de l'auteur. ! m_strAuthor = pRoot->GetPropVal(wxT("provider-name"), wxT("unknow")); ! // Récupération de l'adresse web. ! m_strURL = pRoot->GetPropVal(wxT("url"), wxT("")); ! ! wxXmlNode* pChild = pRoot->GetChildren(); ! while(pChild!=NULL) ! { ! if(pChild->GetName()==wxT("description")) // Récupération de la description. ! m_strDescript = pChild->GetContent(); ! else if(pChild->GetName()==wxT("license")) // Récupération de la licence. ! m_strLicence = pChild->GetContent(); ! else if(pChild->GetName()==wxT("copyright")) // Récupération des notes. ! m_strNotes = pChild->GetContent(); ! else if(pChild->GetName()==wxT("requires")) // Récupération des dépendances. ! { ! wxXmlNode* pDep = pChild->GetChildren(); ! while(pDep!=NULL) ! { ! 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(); ! } ! } ! pChild = pChild->GetNext(); ! } ! ! // 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()) ! m_arrstrPlugins.RemoveAt(l--); ! ! m_bOk = true; ! } ! ! // Remplit une liste de nom des plugins dépendants. ! void PluginDescriptionFile::FillDependantPluginArray(wxArrayString& array) ! { ! unsigned long l; ! for(l=0; l<m_arrstrPlugins.GetCount(); l++) ! array.Add(m_arrstrPlugins[l]); ! } ! ! // 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]); } --- NEW FILE: AppImpl.cpp --- (This appears to be a binary file; contents omitted.) Index: Frame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Frame.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Frame.cpp 15 Apr 2005 15:45:07 -0000 1.8 --- Frame.cpp 14 May 2005 12:15:56 -0000 1.9 *************** *** 144,148 **** bool TopFrame::Destroy() { ! wxGetApp().GetWorkBarManager().UnregisterFrame(this); return wxFrame::Destroy(); } --- 144,148 ---- bool TopFrame::Destroy() { ! Application::GetApp().GetWorkBarManager().UnregisterFrame(this); return wxFrame::Destroy(); } Index: WorkBar.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/WorkBar.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WorkBar.cpp 15 Apr 2005 15:44:34 -0000 1.5 --- WorkBar.cpp 14 May 2005 12:15:56 -0000 1.6 *************** *** 40,43 **** --- 40,100 ---- /** + * WorkBarTemplate. + */ + + IMPLEMENT_CLASS2(WorkBarTemplate, Element, wxObject) + + bool WorkBarTemplate::Initialize() + { + return ObjectTemplate<WorkBar>::Initialize(); + } + + void WorkBarTemplate::Finalize() + { + ObjectTemplate<WorkBar>::Finalize(); + } + + bool WorkBarTemplate::Destroy(bool bForce) + { + return ObjectTemplate<WorkBar>::Destroy(bForce); + } + + bool WorkBarTemplate::CanDestroy()const + { + return ObjectTemplate<WorkBar>::CanDestroy(); + } + + /** + * WorkBarType. + */ + + IMPLEMENT_CLASS(WorkBarType, WorkBarTemplate) + + bool WorkBarType::Initialize() + { + wxLogDebug("WorkBarType::Initialize !!"); + + if(!WorkBarTemplate::Initialize()) + return false; + Application::GetApp().GetWorkBarManager().RegisterWorkBar(this); + return true; + } + + void WorkBarType::Finalize() + { + } + + bool WorkBarType::Destroy(bool bForce) + { + return false; + } + + bool WorkBarType::CanDestroy()const + { + return false; + } + + + /** * WorkBarManager. */ *************** *** 85,88 **** --- 142,163 ---- } + // Enregistre un type de workbar. + void WorkBarManager::RegisterWorkBar(WorkBarTemplate* pTempl) + { + if(RegisterTemplate(pTempl)) + AddBarToAllFrames(FindTemplate(pTempl)); + } + + // Désenregistre un type de workbar. + void WorkBarManager::UnegisterWorkBar(WorkBarTemplate* pTempl) + { + int i = FindTemplate(pTempl); + if(i!=-1) + { + RemoveBarFromAllFrames((unsigned int)i); + UnregisterTemplate(pTempl); + } + } + // Désenregistre un type de barre. void WorkBarManager::UnregisterWorkBar(wxClassInfo* pClassInfo, ::wxObject* pExtraObj) Index: DocManager.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/DocManager.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DocManager.cpp 16 Mar 2005 14:27:37 -0000 1.8 --- DocManager.cpp 14 May 2005 12:15:56 -0000 1.9 *************** *** 34,37 **** --- 34,39 ---- // DocTemplate + IMPLEMENT_CLASS(DocTemplate, Element) + // Constructeur-initialisation DocTemplate::DocTemplate(wxString strName, wxClassInfo *pDocClassInfo, wxString strExt, wxString strDescription): *************** *** 47,50 **** --- 49,74 ---- } + bool DocTemplate::Initialize() + { + return ObjectTemplate<Document>::Initialize(); + } + + void DocTemplate::Finalize() + { + ObjectTemplate<Document>::Finalize(); + plugins::PluginItem::Finalize(); + } + + bool DocTemplate::Destroy(bool bForce) + { + return plugins::PluginItem::Destroy(bForce); + } + + bool DocTemplate::CanDestroy()const + { + return plugins::PluginItem::CanDestroy(); + } + + bool DocTemplate::AddExtension(wxString strExt) { *************** *** 90,94 **** */ - // Document par son chemin. const Document* DocManager::GetDocument(FilePath &strDocPath)const --- 114,117 ---- *************** *** 418,422 **** for(unsigned int n=0; n<GetDocTemplateCount(); n++) { ! wxIconBundle IB = wxGetApp().LoadAppIconBundle(GetDocTemplate(n).GetViewTemplate(0).strIcons); pIL->Add(IB.GetIcon(iSize)); } --- 441,445 ---- for(unsigned int n=0; n<GetDocTemplateCount(); n++) { ! wxIconBundle IB = Application::GetApp().LoadAppIconBundle(GetDocTemplate(n).GetViewTemplate(0).strIcons); pIL->Add(IB.GetIcon(iSize)); } *************** *** 427,431 **** wxIconBundle* DocManager::GetIconBundle(unsigned int nDocType, unsigned int nViewType) { ! return new wxIconBundle(wxGetApp().LoadAppIconBundle(GetDocTemplate(nDocType).GetViewTemplate(nViewType).strIcons)); } --- 450,454 ---- wxIconBundle* DocManager::GetIconBundle(unsigned int nDocType, unsigned int nViewType) { ! return new wxIconBundle(Application::GetApp().LoadAppIconBundle(GetDocTemplate(nDocType).GetViewTemplate(nViewType).strIcons)); } Index: MainFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MainFrame.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MainFrame.cpp 4 Apr 2005 10:25:53 -0000 1.14 --- MainFrame.cpp 14 May 2005 12:15:56 -0000 1.15 *************** *** 57,90 **** using namespace wxDevCenter; - // Definition des identifiants des menus standards : - #define IDM_FILE_NEW wxID_NEW - #define IDM_FILE_OPEN wxID_OPEN - #define IDM_FILE_SAVE wxID_SAVE - #define IDM_FILE_SAVEAS wxID_SAVEAS - #define IDM_FILE_CLOSE wxID_CLOSE - #define IDM_FILE_CLOSEALL 0x0005 - - #define IDM_PROJECT_OPEN 0x0100 - #define IDM_PROJECT_NEW 0x0101 - #define IDM_PROJECT_CLOSE 0x0102 - - #define IDM_WINDOW_CLONE 0x0200 - #define IDM_WINDOW_NEW 0x0201 - #define IDM_WINDOW_CLOSE 0x0202 - #define IDM_WINDOW_CLOSEALL 0x0203 - #define IDM_WINDOW_PREV 0x0204 - #define IDM_WINDOW_NEXT 0x0205 - #define IDM_WINDOW_FIRST 0x0210 - #define IDM_WINDOW_LAST 0x021F - - #define IDM_WINDOW_WORKBAR 0x0300 - #define IDM_WINDOW_WORKBAR_FIRST 0x0301 - #define IDM_WINDOW_WORKBAR_LAST 0x03FF - - #define IDM_HELP_ABOUT 0x0400 - #define IDM_HELP_INDEX 0x0401 - #define IDM_HELP_CONTENT 0x0402 - - #define WXDC_NBSYSTEMMENU 3 --- 57,60 ---- *************** *** 166,170 **** // Chargement de l'icone de l'application. ! m_Icon = wxGetApp().LoadAppIcon("wxDevCenter", wxSize(16, 16)); SetIcon(m_Icon); --- 136,140 ---- // Chargement de l'icone de l'application. ! m_Icon = Application::GetApp().LoadAppIcon("wxDevCenter", wxSize(16, 16)); SetIcon(m_Icon); *************** *** 185,189 **** void MainFrame::OnClose(wxCloseEvent &event) { ! if(!wxGetApp().GetDocManager().CloseAllDocuments()) event.Veto(); else --- 155,159 ---- void MainFrame::OnClose(wxCloseEvent &event) { ! if(!Application::GetApp().GetDocManager().CloseAllDocuments()) event.Veto(); else *************** *** 204,208 **** void MainFrame::OnMenuProjectOpen(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().LoadProject(); } --- 174,178 ---- void MainFrame::OnMenuProjectOpen(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().LoadProject(); } *************** *** 210,214 **** void MainFrame::OnMenuProjectClose(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().CloseProject(); } --- 180,184 ---- void MainFrame::OnMenuProjectClose(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().CloseProject(); } *************** *** 216,220 **** void MainFrame::OnMenuProjectNew(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().CreateProject(); } --- 186,190 ---- void MainFrame::OnMenuProjectNew(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().CreateProject(); } *************** *** 222,226 **** void MainFrame::OnMenuFileNew(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().CreateNewDocument(); } --- 192,196 ---- void MainFrame::OnMenuFileNew(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().CreateNewDocument(); } *************** *** 228,232 **** void MainFrame::OnMenuFileOpen(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().OpenDocument(); } --- 198,202 ---- void MainFrame::OnMenuFileOpen(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().OpenDocument(); } *************** *** 234,238 **** void MainFrame::OnMenuFileSave(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().SaveDocument(GetViewFrame()->GetActiveView()->GetDocument()); } --- 204,208 ---- void MainFrame::OnMenuFileSave(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().SaveDocument(GetViewFrame()->GetActiveView()->GetDocument()); } *************** *** 240,244 **** void MainFrame::OnMenuFileSaveAs(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().SaveDocument(GetViewFrame()->GetActiveView()->GetDocument(), true); } --- 210,214 ---- void MainFrame::OnMenuFileSaveAs(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().SaveDocument(GetViewFrame()->GetActiveView()->GetDocument(), true); } *************** *** 252,256 **** { pDoc = pView->GetDocument(); ! wxGetApp().GetDocManager().CloseDocument(pDoc); } } --- 222,226 ---- { pDoc = pView->GetDocument(); ! Application::GetApp().GetDocManager().CloseDocument(pDoc); } } *************** *** 259,263 **** void MainFrame::OnMenuFileCloseAll(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().GetDocManager().CloseAllDocuments(); } --- 229,233 ---- void MainFrame::OnMenuFileCloseAll(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().GetDocManager().CloseAllDocuments(); } *************** *** 266,270 **** void MainFrame::OnMenuWindowClose(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().GetDocManager().CloseView(GetViewFrame()->GetActiveView()); } --- 236,240 ---- void MainFrame::OnMenuWindowClose(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().GetDocManager().CloseView(GetViewFrame()->GetActiveView()); } *************** *** 281,285 **** if(pActiveView!=NULL) { ! View *pNewView = wxGetApp().GetDocManager().CreateView(pActiveView->GetDocument(), pActiveView->GetViewTemplate()); AddView(pNewView); pNewView->OnInitialUpdate(); --- 251,255 ---- if(pActiveView!=NULL) { ! View *pNewView = Application::GetApp().GetDocManager().CreateView(pActiveView->GetDocument(), pActiveView->GetViewTemplate()); AddView(pNewView); pNewView->OnInitialUpdate(); *************** *** 294,301 **** { Document *pDoc = pActiveView->GetDocument(); ! int iTypeView = wxGetApp().GetDocManager().ChooseViewType(wxGetApp().GetDocManager().FindTemplate(pDoc->GetDocTemplate())); if(iTypeView!=-1) { ! View *pNewView = wxGetApp().GetDocManager().CreateView(pDoc, iTypeView); pDoc->AttachView(pNewView); AddView(pNewView); --- 264,271 ---- { Document *pDoc = pActiveView->GetDocument(); ! int iTypeView = Application::GetApp().GetDocManager().ChooseViewType(Application::GetApp().GetDocManager().FindTemplate(pDoc->GetDocTemplate())); if(iTypeView!=-1) { ! View *pNewView = Application::GetApp().GetDocManager().CreateView(pDoc, iTypeView); pDoc->AttachView(pNewView); AddView(pNewView); *************** *** 320,334 **** void MainFrame::OnMenuHelpAbout(wxCommandEvent& WXUNUSED(event)) { ! wxGetApp().AboutBox(0); } void MainFrame::OnUpdateProjectClose(wxUpdateUIEvent &event) { ! event.Enable(wxGetApp().IsProjectActive()); } void MainFrame::OnUpdateWhenHasDoc(wxUpdateUIEvent &event) { ! event.Enable(wxGetApp().GetDocManager().GetDocumentCount()!=0); } --- 290,304 ---- void MainFrame::OnMenuHelpAbout(wxCommandEvent& WXUNUSED(event)) { ! Application::GetApp().AboutBox(0); } void MainFrame::OnUpdateProjectClose(wxUpdateUIEvent &event) { ! event.Enable(Application::GetApp().IsProjectActive()); } void MainFrame::OnUpdateWhenHasDoc(wxUpdateUIEvent &event) { ! event.Enable(Application::GetApp().GetDocManager().GetDocumentCount()!=0); } *************** *** 433,437 **** { InsertViewMenu(pNewView); ! SetIcons(wxGetApp().LoadAppIconBundle(pNewView->GetViewTemplate()->strIcons)); str.Append(WXDC_NAME).Append(wxT(" - ")).Append(pNewView->GetDocument()->GetDocumentName()); if(pNewView->GetDocument()->GetModifiedFlag()) --- 403,407 ---- { InsertViewMenu(pNewView); ! SetIcons(Application::GetApp().LoadAppIconBundle(pNewView->GetViewTemplate()->strIcons)); str.Append(WXDC_NAME).Append(wxT(" - ")).Append(pNewView->GetDocument()->GetDocumentName()); if(pNewView->GetDocument()->GetModifiedFlag()) *************** *** 439,442 **** --- 409,413 ---- SetTitle(str); } + UpdateWindowUI(); event.Skip(); } *************** *** 450,454 **** { FilePath str = filenames[0]; ! wxGetApp().OpenDocument(str); return true; } --- 421,425 ---- { FilePath str = filenames[0]; ! Application::GetApp().OpenDocument(str); return true; } *************** *** 504,508 **** } - // Reconstruit le menu des WorkBar. void MainFrame::RebuildWorkBarMenu() --- 475,478 ---- *************** *** 529,533 **** cbBarInfo* pBI = m_pFrameLayout->FindBarByWindow((wxWindow*)&m_WorkBarArray.Item(event.GetId()-IDM_WINDOW_WORKBAR_FIRST)); if(pBI) ! event.Check( (pBI->mState&wxCBAR_HIDDEN ) == 0 ); else event.Enable(false); --- 499,503 ---- cbBarInfo* pBI = m_pFrameLayout->FindBarByWindow((wxWindow*)&m_WorkBarArray.Item(event.GetId()-IDM_WINDOW_WORKBAR_FIRST)); if(pBI) ! event.Check( !(pBI->mState==wxCBAR_HIDDEN) ); else event.Enable(false); *************** *** 540,542 **** if(pBI) m_pFrameLayout->InverseVisibility(pBI); ! } \ No newline at end of file --- 510,523 ---- if(pBI) m_pFrameLayout->InverseVisibility(pBI); ! } ! ! ! /** Force la mise à jour de la fenetre via les wxUpdateUIEvent.*/ ! void MainFrame::UpdateWindowUI(long flags) ! { ! wxFrame::UpdateWindowUI(flags); ! ! for(unsigned long l=0; l<m_WorkBarArray.GetCount(); l++) ! m_WorkBarArray[l].UpdateWindowUI(flags); ! ! } Index: Application.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Application.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Application.cpp 4 Apr 2005 10:25:53 -0000 1.22 --- Application.cpp 14 May 2005 12:15:56 -0000 1.23 *************** *** 39,46 **** #include <wx/tokenzr.h> - // Déclaration de la classe application - IMPLEMENT_APP(wxDevCenter::Application); - - // Utilisation du namespace using namespace wxDevCenter; --- 39,42 ---- *************** *** 50,53 **** --- 46,53 ---- END_EVENT_TABLE() + #include <wx/datetime.h> + + + Application* Application::ms_pTheApp = NULL; bool Application::OnInit(void) *************** *** 67,77 **** m_WorkBarManager.Initialize(); // Crée la config utilisateur. m_ConfigManager.CreateUserProfile(); - // Charge les plugins. - LoadPlugins(); - m_PluginManager.InitPlugins(); - // Enregistre les différents types de documents/vues m_DocManager.RegisterDocTypes(); --- 67,78 ---- m_WorkBarManager.Initialize(); + // Charge les plugins : phase de tests + m_PluginLoader.Load(); + wxLogDebug(m_PluginLoader.Dump()); + m_PluginLoader.Initialize(); + // Crée la config utilisateur. m_ConfigManager.CreateUserProfile(); // Enregistre les différents types de documents/vues m_DocManager.RegisterDocTypes(); *************** *** 92,96 **** // Enregistre la fenêtre principale dans le WorkBarManager ! wxGetApp().GetWorkBarManager().RegisterFrame(m_pMainFrame); // Lance l'application. --- 93,97 ---- // Enregistre la fenêtre principale dans le WorkBarManager ! Application::GetApp().GetWorkBarManager().RegisterFrame(m_pMainFrame); // Lance l'application. *************** *** 105,110 **** // Enregistrement de la config m_ConfigManager.Finalize(); - // Finalisation des plugins. - m_PluginManager.FinalPlugins(); return wxApp::OnExit(); --- 106,109 ---- *************** *** 131,134 **** --- 130,134 ---- m_IconBundleCache(40) { + ms_pTheApp = this; } *************** *** 193,226 **** ////////////////////////////////////////////////////////////////////// - // Gestion des plugins - - // Charge les plugins depuis le répertoire des plugins. - void Application::LoadPlugins() - { - unsigned int n; - wxString strPath = GetConfig().ReadConfig(WXDC_CONFIG_PLUGIN_PATH, wxT("")); - if(!strPath.IsEmpty()) - { - wxArrayString arFiles; - wxArrayString arWild; - wxStringTokenizer ST(WXDC_CONFIG_PLUGIN_WILDCARD, wxT(";")); - while(ST.HasMoreTokens()) - arWild.Add(ST.GetNextToken()); - for(n=0; n<arWild.GetCount(); n++) - wxDir::GetAllFiles(strPath, &arFiles, arWild[n]); - - for(n=0; n<arFiles.GetCount(); n++) - { - wxDynamicLibrary DL; - if(DL.Load(arFiles[n])) - DL.Detach(); - } - } - } - - - - - ////////////////////////////////////////////////////////////////////// // Gestion des documents --- 193,196 ---- *************** *** 470,471 **** --- 440,442 ---- } + Index: Project.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Project.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Project.cpp 15 Apr 2005 15:41:46 -0000 1.5 --- Project.cpp 14 May 2005 12:15:56 -0000 1.6 *************** *** 30,34 **** using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS(wxDevCenter::Project, wxEvtHandler); /** --- 30,37 ---- using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS2(Project, Element, wxEvtHandler) ! ! IMPLEMENT_DYNAMIC_CLASS2(ProjectTemplate, Element, wxObject) ! /** *************** *** 37,41 **** Project::Project(): wxEvtHandler(), ! InitializableInterface(), m_strName(""), m_strPath(""), --- 40,44 ---- Project::Project(): wxEvtHandler(), ! Element(), m_strName(""), m_strPath(""), *************** *** 88,91 **** --- 91,95 ---- ProjectTemplate::ProjectTemplate(wxClassInfo* pProjectClassInfo, wxString strName, wxString strDescript, wxString strIcon, wxString strExt): ObjectTemplate<Project>(pProjectClassInfo, strName, strDescript), + wxObject(), m_strIcon(strIcon) { *************** *** 134,138 **** ProjectTemplate(pProjectClassInfo, strName, strDescript, strIcon, strExt) { ! wxGetApp().GetProjectManager().RegisterTemplate(this); } --- 138,142 ---- ProjectTemplate(pProjectClassInfo, strName, strDescript, strIcon, strExt) { ! Application::GetApp().GetProjectManager().RegisterTemplate(this); } *************** *** 197,201 **** { // Appelle de le chargement du projet. ! Archive* pAr = wxGetApp().CreateDocumentArchive(strFile, Archive::read); if(pAr!=NULL) { --- 201,205 ---- { // Appelle de le chargement du projet. ! Archive* pAr = Application::GetApp().CreateDocumentArchive(strFile, Archive::read); if(pAr!=NULL) { *************** *** 218,222 **** // Appelle de le chargement du projet. FilePath path = GetProject().GetPath(); ! Archive* pAr = wxGetApp().CreateDocumentArchive(path, Archive::write); if(pAr!=NULL) { --- 222,226 ---- // Appelle de le chargement du projet. FilePath path = GetProject().GetPath(); ! Archive* pAr = Application::GetApp().CreateDocumentArchive(path, Archive::write); if(pAr!=NULL) { Index: Document.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Document.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Document.cpp 15 Apr 2005 15:41:37 -0000 1.10 --- Document.cpp 14 May 2005 12:15:56 -0000 1.11 *************** *** 30,34 **** using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS(wxDevCenter::Document, wxEvtHandler) BEGIN_EVENT_TABLE(Document, wxEvtHandler) --- 30,34 ---- using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS2(Document, Element, wxEvtHandler) BEGIN_EVENT_TABLE(Document, wxEvtHandler) *************** *** 38,41 **** --- 38,42 ---- Document::Document(void): + Element(), wxEvtHandler(), m_pDocumentManager(NULL), *************** *** 172,176 **** SetDocumentPath(strDocumentPath); ! Archive *pArchive = wxGetApp().CreateDocumentArchive(strDocumentPath, wxStreamBuffer::read); if(pArchive==NULL) { --- 173,177 ---- SetDocumentPath(strDocumentPath); ! Archive *pArchive = Application::GetApp().CreateDocumentArchive(strDocumentPath, wxStreamBuffer::read); if(pArchive==NULL) { *************** *** 191,195 **** SetDocumentPath(strDocumentPath); ! Archive *pArchive = wxGetApp().CreateDocumentArchive(strDocumentPath, wxStreamBuffer::write); if(pArchive==NULL) { --- 192,196 ---- SetDocumentPath(strDocumentPath); ! Archive *pArchive = Application::GetApp().CreateDocumentArchive(strDocumentPath, wxStreamBuffer::write); if(pArchive==NULL) { *************** *** 292,296 **** ////////////////////////////////////////////////////////////////////// ! IMPLEMENT_DYNAMIC_CLASS(wxDevCenter::ActionDocument, wxDevCenter::Document) BEGIN_EVENT_TABLE(ActionDocument, Document) --- 293,297 ---- ////////////////////////////////////////////////////////////////////// ! IMPLEMENT_DYNAMIC_CLASS(ActionDocument, Document) BEGIN_EVENT_TABLE(ActionDocument, Document) Index: Manager.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Manager.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Manager.cpp 16 Mar 2005 14:27:37 -0000 1.2 --- Manager.cpp 14 May 2005 12:15:56 -0000 1.3 *************** *** 26,28 **** #include <wxDevCenter/Manager.h> ! IMPLEMENT_DYNAMIC_CLASS(wxDevCenter::ManagedObject, wxObject); --- 26,30 ---- #include <wxDevCenter/Manager.h> ! using namespace wxDevCenter; ! ! Index: FileSystemStandard.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/FileSystemStandard.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** FileSystemStandard.cpp 16 Mar 2005 14:27:37 -0000 1.14 --- FileSystemStandard.cpp 14 May 2005 12:15:56 -0000 1.15 *************** *** 61,65 **** else { ! type = wxGetApp().GetDocManager().GetDocTemplateFromExt(strPath.GetFileExt()); if(type!=-1) type += WXDC_STDFS_FILETYPES; --- 61,65 ---- else { ! type = Application::GetApp().GetDocManager().GetDocTemplateFromExt(strPath.GetFileExt()); if(type!=-1) type += WXDC_STDFS_FILETYPES; *************** *** 72,106 **** wxImageList* FileSystemStandardBase::GetImageList(int width) { ! wxImageList* pIL = new wxImageList(width, width, true, WXDC_STDFS_FILETYPES + 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)); } --- 72,106 ---- wxImageList* FileSystemStandardBase::GetImageList(int width) { ! wxImageList* pIL = new wxImageList(width, width, true, WXDC_STDFS_FILETYPES + Application::GetApp().GetDocManager().GetDocTemplateCount()); wxIconBundle IB; ! IB = Application::GetApp().LoadAppIconBundle(wxT("none")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("unknow")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("dir")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("desktop")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("desktop")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("docs")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("computer")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("floppy")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("harddrive")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("cd-dvd")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("ramdisk")); pIL->Add(IB.GetIcon(width)); ! IB = Application::GetApp().LoadAppIconBundle(wxT("remote")); pIL->Add(IB.GetIcon(width)); ! for(unsigned long l=0; l<Application::GetApp().GetDocManager().GetDocTemplateCount(); l++) { ! IB = Application::GetApp().LoadAppIconBundle(Application::GetApp().GetDocManager().GetDocTemplate(l).GetViewTemplate(0).strIcons); pIL->Add(IB.GetIcon(width)); } |