|
From: Emilien K. <cur...@us...> - 2005-09-15 16:12:09
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9964/src Modified Files: Application.cpp ArtProvider.cpp Plugin.cpp Config.cpp Log Message: Modularize Config. Use Config::GetConfig to retreive the unique config object. Index: Config.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Config.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Config.cpp 11 Aug 2005 09:58:17 -0000 1.10 --- Config.cpp 15 Sep 2005 16:11:47 -0000 1.11 *************** *** 34,37 **** --- 34,60 ---- wxNullConfig Config::m_ConfigNull; + Config* Config::s_pConfigManager = NULL; + + // Initialisation of the Config module. + void Config::InitialiseModule() + { + s_pConfigManager = new Configuration; + if(s_pConfigManager!=NULL) + { + s_pConfigManager->Initialize(); + } + } + + // Finalize the config module. + void Config::FinalizeModule() + { + if(s_pConfigManager!=NULL) + { + s_pConfigManager->Finalize(); + delete s_pConfigManager; + s_pConfigManager = NULL; + } + } + Config::Config(void): Index: ArtProvider.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/ArtProvider.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ArtProvider.cpp 15 Sep 2005 09:54:25 -0000 1.3 --- ArtProvider.cpp 15 Sep 2005 16:11:47 -0000 1.4 *************** *** 42,46 **** l=0; ! while(strPathRoot = Application::GetApp().GetConfig().GetDataPath(l++),!strPathRoot.IsEmpty()) { strPathRoot << wxT("/icons/") << id; --- 42,46 ---- l=0; ! while(strPathRoot = Config::GetConfig().GetDataPath(l++),!strPathRoot.IsEmpty()) { strPathRoot << wxT("/icons/") << id; Index: Application.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Application.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Application.cpp 15 Sep 2005 10:15:05 -0000 1.36 --- Application.cpp 15 Sep 2005 16:11:47 -0000 1.37 *************** *** 26,29 **** --- 26,30 ---- #include <wxDevCenter/AboutBox.h> + #include <wxDevCenter/Config.h> #include <wxDevCenter/FileSystem.h> #include <wxDevCenter/FileSystemStandard.h> *************** *** 71,80 **** // Initialisation du gestionnaire de configuration. ! m_ConfigManager.Initialize(); if(!wxApp::OnInit()) return false; ! m_ConfigManager.LogConfig(); wxArtProvider::PushProvider(new ArtProvider); --- 72,81 ---- // Initialisation du gestionnaire de configuration. ! Config::InitialiseModule(); if(!wxApp::OnInit()) return false; ! Config::GetConfig().LogConfig(); wxArtProvider::PushProvider(new ArtProvider); *************** *** 91,95 **** // Crée la config utilisateur. ! m_ConfigManager.CreateUserProfile(); // Enregistre les différents types de documents/vues --- 92,96 ---- // Crée la config utilisateur. ! Config::GetConfig().CreateUserProfile(); // Enregistre les différents types de documents/vues *************** *** 126,130 **** m_ProjectManager.Finalize(); // Enregistrement de la config ! m_ConfigManager.Finalize(); return wxApp::OnExit(); --- 127,131 ---- m_ProjectManager.Finalize(); // Enregistrement de la config ! Config::FinalizeModule(); return wxApp::OnExit(); *************** *** 410,429 **** - wxBitmap Application::LoadAppBitmap(wxString strBmp, long type) - { - wxString str; - wxBitmap Bmp; - - if(!Bmp.LoadFile(GetConfig().GetDataPath() + wxT("/img/") + strBmp, wxBitmapType(type))) - { - str = WXDC_ERROR_LOADDOCVIEWICON; - str.Replace(wxT("%1"), strBmp); - wxMessageBox(str); - return wxNullBitmap; - } - else - return Bmp; - } - // Initialise la ligne de commande. --- 411,414 ---- *************** *** 447,459 **** wxString str; if(parser.Found(wxT("APd"), (wxString*)&str)) ! GetConfig().AddDataPath(str); if(parser.Found(wxT("APf"), (wxString*)&str)) ! GetConfig().AddFeaturesPath(str); if(parser.Found(wxT("APp"), (wxString*)&str)) ! GetConfig().AddPluginsPath(str); if(parser.Found(wxT("APc"), (wxString*)&str)) ! GetConfig().AddGlobalConfPath(str); if(parser.Found(wxT("APu"), (wxString*)&str)) ! GetConfig().AddUserConfPath(str); wxLogDebug("Plop"); return true; --- 432,444 ---- wxString str; if(parser.Found(wxT("APd"), (wxString*)&str)) ! Config::GetConfig().AddDataPath(str); if(parser.Found(wxT("APf"), (wxString*)&str)) ! Config::GetConfig().AddFeaturesPath(str); if(parser.Found(wxT("APp"), (wxString*)&str)) ! Config::GetConfig().AddPluginsPath(str); if(parser.Found(wxT("APc"), (wxString*)&str)) ! Config::GetConfig().AddGlobalConfPath(str); if(parser.Found(wxT("APu"), (wxString*)&str)) ! Config::GetConfig().AddUserConfPath(str); wxLogDebug("Plop"); return true; Index: Plugin.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Plugin.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Plugin.cpp 15 Sep 2005 09:54:25 -0000 1.10 --- Plugin.cpp 15 Sep 2005 16:11:47 -0000 1.11 *************** *** 25,32 **** --- 25,34 ---- #include <wxDevCenter.h> #include <wxDevCenter/Plugin.h> + #include <wxDevCenter/Config.h> using namespace wxDevCenter; using namespace plugins; + #include <wx/file.h> #include <wx/dir.h> *************** *** 73,77 **** long l=0; wxString strPath; ! while(strPath = Application::GetApp().GetConfig().GetPluginsPath(l++), !strPath.IsEmpty()) { strPath += wxT("/") + m_strPath; --- 75,79 ---- long l=0; wxString strPath; ! while(strPath = Config::GetConfig().GetPluginsPath(l++), !strPath.IsEmpty()) { strPath += wxT("/") + m_strPath; *************** *** 264,268 **** wxString strFilePath; ! while(strFilePath = Application::GetApp().GetConfig().GetPluginsPath(l++), !strFilePath.IsEmpty()) { strFilePath << wxT("/") << strName << wxT("/plugin.xml"); --- 266,270 ---- wxString strFilePath; ! while(strFilePath = Config::GetConfig().GetPluginsPath(l++), !strFilePath.IsEmpty()) { strFilePath << wxT("/") << strName << wxT("/plugin.xml"); *************** *** 386,390 **** l=0; ! while(strFilePath = Application::GetApp().GetConfig().GetFeaturesPath(l++), !strFilePath.IsEmpty()) { strFilePath << wxT("/") << strName << wxT("/feature.xml"); --- 388,392 ---- l=0; ! while(strFilePath = Config::GetConfig().GetFeaturesPath(l++), !strFilePath.IsEmpty()) { strFilePath << wxT("/") << strName << wxT("/feature.xml"); *************** *** 511,515 **** wxLogDebug(wxT("Preload feature descriptions :")); l = 0; ! while(strPath=Application::GetApp().GetConfig().GetFeaturesPath(l++), !strPath.IsEmpty()) { if(wxDir::Exists(strPath) && dir.Open(strPath)) --- 513,517 ---- wxLogDebug(wxT("Preload feature descriptions :")); l = 0; ! while(strPath=Config::GetConfig().GetFeaturesPath(l++), !strPath.IsEmpty()) { if(wxDir::Exists(strPath) && dir.Open(strPath)) *************** *** 528,532 **** wxLogDebug(wxT("Preload plugin descriptions :")); l = 0; ! while(strPath=Application::GetApp().GetConfig().GetPluginsPath(l++), !strPath.IsEmpty()) { if(wxDir::Exists(strPath) && dir.Open(strPath)) --- 530,534 ---- wxLogDebug(wxT("Preload plugin descriptions :")); l = 0; ! while(strPath=Config::GetConfig().GetPluginsPath(l++), !strPath.IsEmpty()) { if(wxDir::Exists(strPath) && dir.Open(strPath)) |