diff --git a/3d-viewer/3d_frame.cpp b/3d-viewer/3d_frame.cpp index 40d091be3b..5f968f7e0a 100644 --- a/3d-viewer/3d_frame.cpp +++ b/3d-viewer/3d_frame.cpp @@ -113,7 +113,7 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event ) void EDA_3D_FRAME::GetSettings() { wxString text; - wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application + wxConfig* config = wxGetApp().GetSettings(); // Current config used by application if( config ) { @@ -140,7 +140,7 @@ void EDA_3D_FRAME::GetSettings() void EDA_3D_FRAME::SaveSettings() { wxString text; - wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by application + wxConfig* Config = wxGetApp().GetSettings(); // Current config used by application if( !Config ) return; diff --git a/common/basicframe.cpp b/common/basicframe.cpp index d758a45b6f..ba30fa7e74 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -100,10 +100,8 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, EDA_BASE_FRAME::~EDA_BASE_FRAME() { - if( wxGetApp().m_HtmlCtrl ) - delete wxGetApp().m_HtmlCtrl; - - wxGetApp().m_HtmlCtrl = NULL; + if( wxGetApp().GetHtmlHelpController() ) + wxGetApp().SetHtmlHelpController( NULL ); delete m_autoSaveTimer; @@ -174,7 +172,7 @@ void EDA_BASE_FRAME::LoadSettings() int Ypos_min; wxConfig* config; - config = wxGetApp().m_EDA_Config; + config = wxGetApp().GetSettings(); int maximized = 0; @@ -219,7 +217,7 @@ void EDA_BASE_FRAME::SaveSettings() wxString text; wxConfig* config; - config = wxGetApp().m_EDA_Config; + config = wxGetApp().GetSettings(); if( ( config == NULL ) || IsIconized() ) return; @@ -275,7 +273,7 @@ void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, wxFileHistory * fileHistory = aFileHistory; if( fileHistory == NULL ) - fileHistory = & wxGetApp().m_fileHistory; + fileHistory = & wxGetApp().GetFileHistory(); fileHistory->AddFileToHistory( FullFileName ); } @@ -289,7 +287,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type, wxFileHistory * fileHistory = aFileHistory; if( fileHistory == NULL ) - fileHistory = & wxGetApp().m_fileHistory; + fileHistory = & wxGetApp().GetFileHistory(); int baseId = fileHistory->GetBaseId(); @@ -321,28 +319,28 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) /* We have to get document for beginners, * or the the full specific doc * if event id is wxID_INDEX, we want the document for beginners. - * else the specific doc file (its name is in wxGetApp().m_HelpFileName) + * else the specific doc file (its name is in wxGetApp().GetHelpFileName()) * The document for beginners is the same for all KiCad utilities */ if( event.GetId() == wxID_INDEX ) { // Temporary change the help filename - wxString tmp = wxGetApp().m_HelpFileName; + wxString tmp = wxGetApp().GetHelpFileName(); // Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf" - wxGetApp().m_HelpFileName = wxT( "getting_started_in_kicad.pdf" ); + wxGetApp().GetHelpFileName() = wxT( "getting_started_in_kicad.pdf" ); wxString helpFile = wxGetApp().GetHelpFile(); if( !helpFile ) { // Try to find "Getting_Started_in_KiCad.pdf" - wxGetApp().m_HelpFileName = wxT( "Getting_Started_in_KiCad.pdf" ); + wxGetApp().GetHelpFileName() = wxT( "Getting_Started_in_KiCad.pdf" ); helpFile = wxGetApp().GetHelpFile(); } if( !helpFile ) { msg.Printf( _( "Help file %s could not be found." ), - GetChars( wxGetApp().m_HelpFileName ) ); + GetChars( wxGetApp().GetHelpFileName() ) ); DisplayError( this, msg ); } else @@ -350,26 +348,26 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) GetAssociatedDocument( this, helpFile ); } - wxGetApp().m_HelpFileName = tmp; + wxGetApp().SetHelpFileName( tmp ); return; } #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML - if( wxGetApp().m_HtmlCtrl == NULL ) + if( wxGetApp().GetHtmlHelpController() == NULL ) { wxGetApp().InitOnLineHelp(); } - if( wxGetApp().m_HtmlCtrl ) + if( wxGetApp().GetHtmlHelpController() ) { - wxGetApp().m_HtmlCtrl->DisplayContents(); - wxGetApp().m_HtmlCtrl->Display( wxGetApp().m_HelpFileName ); + wxGetApp().GetHtmlHelpController()->DisplayContents(); + wxGetApp().GetHtmlHelpController()->Display( wxGetApp().GetHelpFileName() ); } else { - msg.Printf( _( "Help file %s not found." ), GetChars( wxGetApp().m_HelpFileName ) ); + msg.Printf( _( "Help file %s not found." ), GetChars( wxGetApp().GetHelpFileName() ) ); DisplayError( this, msg ); } @@ -379,7 +377,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) if( !helpFile ) { msg.Printf( _( "Help file %s could not be found." ), - GetChars( wxGetApp().m_HelpFileName ) ); + GetChars( wxGetApp().GetHelpFileName() ) ); DisplayError( this, msg ); } else @@ -395,7 +393,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event ) { - wxFileName fn = wxGetApp().m_EditorName; + wxFileName fn = wxGetApp().GetEditorName(); wxString wildcard( wxT( "*" ) ); #ifdef __WINDOWS__ @@ -411,11 +409,11 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event ) if( dlg.ShowModal() == wxID_CANCEL ) return; - wxASSERT( wxGetApp().m_EDA_CommonConfig ); + wxASSERT( wxGetApp().GetCommonSettings() ); - wxConfig* cfg = wxGetApp().m_EDA_CommonConfig; - wxGetApp().m_EditorName = dlg.GetPath(); - cfg->Write( wxT( "Editor" ), wxGetApp().m_EditorName ); + wxConfig* cfg = wxGetApp().GetCommonSettings(); + wxGetApp().SetEditorName( dlg.GetPath() ); + cfg->Write( wxT( "Editor" ), wxGetApp().GetEditorName() ); } diff --git a/common/drawframe.cpp b/common/drawframe.cpp index 11856f095c..fc71d3c5fd 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -829,9 +829,9 @@ void EDA_DRAW_FRAME::UpdateStatusBar() void EDA_DRAW_FRAME::LoadSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_BASE_FRAME::LoadSettings(); cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 ); @@ -851,9 +851,9 @@ void EDA_DRAW_FRAME::LoadSettings() void EDA_DRAW_FRAME::SaveSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_BASE_FRAME::SaveSettings(); cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape ); diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp index 3fdc1a0145..cdad0e7601 100644 --- a/common/drawpanel.cpp +++ b/common/drawpanel.cpp @@ -102,8 +102,8 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, m_mouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL; - if( wxGetApp().m_EDA_Config ) - wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true ); + if( wxGetApp().GetSettings() ) + wxGetApp().GetSettings()->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true ); m_AutoPAN_Request = false; m_Block_Enable = false; @@ -123,7 +123,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, EDA_DRAW_PANEL::~EDA_DRAW_PANEL() { - wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable ); + wxGetApp().GetSettings()->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable ); } diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp index 00bfa1d6f3..569eba2596 100644 --- a/common/eda_doc.cpp +++ b/common/eda_doc.cpp @@ -16,25 +16,17 @@ void EDA_APP::ReadPdfBrowserInfos() { - wxASSERT( m_EDA_CommonConfig != NULL ); + wxASSERT( m_commonSettings != NULL ); - m_PdfBrowserIsDefault = m_EDA_CommonConfig->Read( wxT( "PdfBrowserIsDefault" ), true ); - m_PdfBrowser = m_EDA_CommonConfig->Read( wxT( "PdfBrowserName" ), wxEmptyString ); - - if( m_PdfBrowser.IsEmpty() ) - m_PdfBrowserIsDefault = true; + m_PdfBrowser = m_commonSettings->Read( wxT( "PdfBrowserName" ), wxEmptyString ); } void EDA_APP::WritePdfBrowserInfos() { - wxASSERT( m_EDA_CommonConfig != NULL ); + wxASSERT( m_commonSettings != NULL ); - if( m_PdfBrowser.IsEmpty() ) - m_PdfBrowserIsDefault = true; - - m_EDA_CommonConfig->Write( wxT( "PdfBrowserIsDefault" ), m_PdfBrowserIsDefault ); - m_EDA_CommonConfig->Write( wxT( "PdfBrowserName" ), m_PdfBrowser ); + m_commonSettings->Write( wxT( "PdfBrowserName" ), m_PdfBrowser ); } diff --git a/common/edaappl.cpp b/common/edaappl.cpp index cd7e631f99..df2136d9cc 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -1,9 +1,34 @@ -/*** +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** * @file edaapl.cpp * - * @brief For the main application: init functions, and language selection - * (locale handling) - ***/ + * @brief For the main application: init functions, and language selection + * (locale handling) + */ #include "fctsys.h" #include "gr_basic.h" @@ -246,15 +271,13 @@ static struct LANGUAGE_DESCR s_Language_List[] = EDA_APP::EDA_APP() { - m_Checker = NULL; - m_HtmlCtrl = NULL; - m_EDA_Config = NULL; - m_Env_Defined = false; - m_LanguageId = wxLANGUAGE_DEFAULT; - m_PdfBrowserIsDefault = true; + m_Checker = NULL; + m_HtmlCtrl = NULL; + m_settings = NULL; + m_LanguageId = wxLANGUAGE_DEFAULT; m_Locale = NULL; - m_ProjectConfig = NULL; - m_EDA_CommonConfig = NULL; + m_projectSettings = NULL; + m_commonSettings = NULL; } @@ -263,13 +286,13 @@ EDA_APP::~EDA_APP() SaveSettings(); /* delete user datas */ - if( m_ProjectConfig ) - delete m_ProjectConfig; + if( m_projectSettings ) + delete m_projectSettings; - if( m_EDA_CommonConfig ) - delete m_EDA_CommonConfig; + if( m_commonSettings ) + delete m_commonSettings; - delete m_EDA_Config; + delete m_settings; if( m_Checker ) delete m_Checker; @@ -289,9 +312,9 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) * the environment variable KICAD (if exists) gives the kicad path: * something like set KICAD=d:\kicad */ - m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); + bool isDefined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv ); - if( m_Env_Defined ) // ensure m_KicadEnv ends by "/" + if( isDefined ) // ensure m_KicadEnv ends by "/" { m_KicadEnv.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); @@ -313,10 +336,10 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) SetVendorName( wxT( "KiCad" ) ); SetAppName( aName.Lower() ); SetTitle( aName ); - m_EDA_Config = new wxConfig(); - wxASSERT( m_EDA_Config != NULL ); - m_EDA_CommonConfig = new wxConfig( CommonConfigPath ); - wxASSERT( m_EDA_CommonConfig != NULL ); + m_settings = new wxConfig(); + wxASSERT( m_settings != NULL ); + m_commonSettings = new wxConfig( CommonConfigPath ); + wxASSERT( m_commonSettings != NULL ); /* Install some image handlers, mainly for help */ wxImage::AddHandler( new wxPNGHandler ); @@ -332,7 +355,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) // Internationalization: loading the kicad suitable Dictionary wxString languageSel; - m_EDA_CommonConfig->Read( languageCfgKey, &languageSel); + m_commonSettings->Read( languageCfgKey, &languageSel); m_LanguageId = wxLANGUAGE_DEFAULT; // Search for the current selection @@ -356,6 +379,15 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) } +void EDA_APP::SetHtmlHelpController( wxHtmlHelpController* aController ) +{ + if( m_HtmlCtrl ) + delete m_HtmlCtrl; + + m_HtmlCtrl = aController; +} + + void EDA_APP::InitOnLineHelp() { wxString fullfilename = FindKicadHelpPath(); @@ -369,7 +401,7 @@ void EDA_APP::InitOnLineHelp() m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_PRINT | wxHF_OPEN_FILES /*| wxHF_SEARCH */ ); - m_HtmlCtrl->UseConfig( m_EDA_CommonConfig ); + m_HtmlCtrl->UseConfig( m_commonSettings ); m_HtmlCtrl->SetTitleFormat( wxT( "KiCad Help" ) ); m_HtmlCtrl->AddBook( fullfilename ); } @@ -620,7 +652,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) { - wxASSERT( m_EDA_Config != NULL && m_EDA_CommonConfig != NULL ); + wxASSERT( m_settings != NULL && m_commonSettings != NULL ); wxString Line; @@ -628,7 +660,7 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) m_HelpSize.y = 400; wxString languageSel; - m_EDA_CommonConfig->Read( languageCfgKey, &languageSel ); + m_commonSettings->Read( languageCfgKey, &languageSel ); m_LanguageId = wxLANGUAGE_DEFAULT; // Search for the current selection @@ -641,21 +673,21 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) } } - m_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) ); + m_EditorName = m_commonSettings->Read( wxT( "Editor" ) ); - m_fileHistory.Load( *m_EDA_Config ); + m_fileHistory.Load( *m_settings ); - m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits ); + m_settings->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits ); if( aReopenLastUsedDirectory ) { - if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) && wxDirExists( Line ) ) + if( m_settings->Read( wxT( "WorkingDir" ), &Line ) && wxDirExists( Line ) ) { wxSetWorkingDirectory( Line ); } } - m_EDA_Config->Read( wxT( "BgColor" ), &g_DrawBgColor ); + m_settings->Read( wxT( "BgColor" ), &g_DrawBgColor ); /* Load per-user search paths from settings file */ @@ -664,8 +696,8 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) while( 1 ) { - upath = m_EDA_CommonConfig->Read( wxString::Format( wxT( "LibraryPath%d" ), i ), - wxT( "" ) ); + upath = m_commonSettings->Read( wxString::Format( wxT( "LibraryPath%d" ), i ), + wxT( "" ) ); if( upath.IsSameAs( wxT( "" ) ) ) break; @@ -678,13 +710,13 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) void EDA_APP::SaveSettings() { - wxASSERT( m_EDA_Config != NULL ); - m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits ); - m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() ); - m_EDA_Config->Write( wxT( "BgColor" ), g_DrawBgColor ); + wxASSERT( m_settings != NULL ); + m_settings->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits ); + m_settings->Write( wxT( "WorkingDir" ), wxGetCwd() ); + m_settings->Write( wxT( "BgColor" ), g_DrawBgColor ); /* Save the file history list */ - m_fileHistory.Save( *m_EDA_Config ); + m_fileHistory.Save( *m_settings ); } @@ -734,7 +766,7 @@ bool EDA_APP::SetLanguage( bool first_time ) } } - m_EDA_CommonConfig->Write( languageCfgKey, languageSel ); + m_commonSettings->Write( languageCfgKey, languageSel ); } // Test if floating point notation is working (bug in cross compilation, using wine) diff --git a/common/gestfich.cpp b/common/gestfich.cpp index b92e4251e0..3e6b272ea1 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file gestfich.cpp * @brief Functions for file management @@ -272,14 +297,14 @@ wxString FindKicadHelpPath() bool PathFound = false; /* find kicad/help/ */ - tmp = wxGetApp().m_BinDir; + tmp = wxGetApp().GetExecutablePath(); if( tmp.Last() == '/' ) tmp.RemoveLast(); FullPath = tmp.BeforeLast( '/' ); // cd .. FullPath += wxT( "/doc/help/" ); - LocaleString = wxGetApp().m_Locale->GetCanonicalName(); + LocaleString = wxGetApp().GetLocale()->GetCanonicalName(); wxString path_tmp = FullPath; #ifdef __WINDOWS__ @@ -292,9 +317,9 @@ wxString FindKicadHelpPath() } /* find kicad/help/ from environment variable KICAD */ - if( !PathFound && wxGetApp().m_Env_Defined ) + if( !PathFound && wxGetApp().IsKicadEnvVariableDefined() ) { - FullPath = wxGetApp().m_KicadEnv + wxT( "/doc/help/" ); + FullPath = wxGetApp().GetKicadEnvVariable() + wxT( "/doc/help/" ); if( wxDirExists( FullPath ) ) PathFound = true; @@ -352,7 +377,7 @@ wxString FindKicadFile( const wxString& shortname ) /* Test the presence of the file in the directory shortname of * the KiCad binary path. */ - FullFileName = wxGetApp().m_BinDir + shortname; + FullFileName = wxGetApp().GetExecutablePath() + shortname; if( wxFileExists( FullFileName ) ) return FullFileName; @@ -360,9 +385,9 @@ wxString FindKicadFile( const wxString& shortname ) /* Test the presence of the file in the directory shortname * defined by the environment variable KiCad. */ - if( wxGetApp().m_Env_Defined ) + if( wxGetApp().IsKicadEnvVariableDefined() ) { - FullFileName = wxGetApp().m_KicadEnv + shortname; + FullFileName = wxGetApp().GetKicadEnvVariable() + shortname; if( wxFileExists( FullFileName ) ) return FullFileName; @@ -416,22 +441,21 @@ wxString ReturnKicadDatasPath() bool PathFound = false; wxString data_path; - if( wxGetApp().m_Env_Defined ) // Path defined by the KICAD environment variable. - + if( wxGetApp().IsKicadEnvVariableDefined() ) // Path defined by the KICAD environment variable. { - data_path = wxGetApp().m_KicadEnv; + data_path = wxGetApp().GetKicadEnvVariable(); PathFound = true; } else // Path of executables. { - wxString tmp = wxGetApp().m_BinDir; + wxString tmp = wxGetApp().GetExecutablePath(); #ifdef __WINDOWS__ tmp.MakeLower(); #endif if( tmp.Contains( wxT( "kicad" ) ) ) { #ifdef __WINDOWS__ - tmp = wxGetApp().m_BinDir; + tmp = wxGetApp().GetExecutablePath(); #endif if( tmp.Last() == '/' ) tmp.RemoveLast(); @@ -523,7 +547,7 @@ wxString& EDA_APP::GetEditorName() if( !editorname.IsEmpty() ) { m_EditorName = editorname; - m_EDA_CommonConfig->Write( wxT( "Editor" ), m_EditorName ); + m_commonSettings->Write( wxT( "Editor" ), m_EditorName ); } return m_EditorName; @@ -539,10 +563,10 @@ bool OpenPDF( const wxString& file ) wxGetApp().ReadPdfBrowserInfos(); - if( !wxGetApp().m_PdfBrowserIsDefault ) // Run the preferred PDF Browser + if( !wxGetApp().UseSystemPdfBrowser() ) // Run the preferred PDF Browser { AddDelimiterString( filename ); - command = wxGetApp().m_PdfBrowser + wxT( " " ) + filename; + command = wxGetApp().GetPdfBrowserFileName() + wxT( " " ) + filename; } else { @@ -554,13 +578,15 @@ bool OpenPDF( const wxString& file ) success = filetype->GetOpenCommand( &command, params ); delete filetype; + #ifndef __WINDOWS__ - // Bug ? under linux wxWidgets returns acroread as PDF viewer, even + // Bug ? under linux wxWidgets returns acroread as PDF viewer, even if // it does not exist. if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround success = false; #endif + if( success && !command.IsEmpty() ) { success = ProcessExecute( command ); @@ -576,6 +602,7 @@ bool OpenPDF( const wxString& file ) { #ifndef __WINDOWS__ AddDelimiterString( filename ); + /* here is a list of PDF viewers candidates */ const static wxString tries[] = { diff --git a/common/projet_config.cpp b/common/projet_config.cpp index 60c57009e6..6d96a05eb0 100644 --- a/common/projet_config.cpp +++ b/common/projet_config.cpp @@ -30,10 +30,10 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, wxString defaultFileName; // Free old config file. - if( m_ProjectConfig ) + if( m_projectSettings ) { - delete m_ProjectConfig; - m_ProjectConfig = NULL; + delete m_projectSettings; + m_projectSettings = NULL; } /* Check the file name does not a KiCad project extension. @@ -56,9 +56,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, // Init local config filename if( ForceUseLocalConfig || fn.FileExists() ) { - m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString, - fn.GetFullPath(), wxEmptyString ); - m_ProjectConfig->DontCreateOnDemand(); + m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString, + fn.GetFullPath(), wxEmptyString ); + m_projectSettings->DontCreateOnDemand(); if( ForceUseLocalConfig ) return true; @@ -74,9 +74,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, int version = -1; int def_version = 0; - m_ProjectConfig->SetPath( GroupName ); - version = m_ProjectConfig->Read( wxT( "version" ), def_version ); - m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); + m_projectSettings->SetPath( GroupName ); + version = m_projectSettings->Read( wxT( "version" ), def_version ); + m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); if( version > 0 ) { @@ -84,7 +84,7 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, } else { - delete m_ProjectConfig; // Version incorrect + delete m_projectSettings; // Version incorrect } } @@ -102,9 +102,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, } // Create new project file using the default name. - m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString, - wxEmptyString, fn.GetFullPath() ); - m_ProjectConfig->DontCreateOnDemand(); + m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString, + wxEmptyString, fn.GetFullPath() ); + m_projectSettings->DontCreateOnDemand(); return false; } @@ -122,30 +122,30 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, /* Write time (especially to avoid bug wxFileConfig that writes the * wrong item if declaration [xx] in first line (If empty group) */ - m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); + m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); msg = DateAndTime(); - m_ProjectConfig->Write( wxT( "update" ), msg ); + m_projectSettings->Write( wxT( "update" ), msg ); msg = GetAppName(); - m_ProjectConfig->Write( wxT( "last_client" ), msg ); + m_projectSettings->Write( wxT( "last_client" ), msg ); /* Save parameters */ - m_ProjectConfig->DeleteGroup( GroupName ); // Erase all data - m_ProjectConfig->Flush(); + m_projectSettings->DeleteGroup( GroupName ); // Erase all data + m_projectSettings->Flush(); - m_ProjectConfig->SetPath( GroupName ); - m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION ); - m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); + m_projectSettings->SetPath( GroupName ); + m_projectSettings->Write( wxT( "version" ), CONFIG_VERSION ); + m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); for( ; List != NULL && *List != NULL; List++ ) { pt_cfg = *List; if( pt_cfg->m_Group ) - m_ProjectConfig->SetPath( pt_cfg->m_Group ); + m_projectSettings->SetPath( pt_cfg->m_Group ); else - m_ProjectConfig->SetPath( GroupName ); + m_projectSettings->SetPath( GroupName ); if( pt_cfg->m_Setup ) continue; @@ -153,17 +153,17 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data { if( pt_cfg->m_Ident ) - m_ProjectConfig->DeleteGroup( pt_cfg->m_Ident ); + m_projectSettings->DeleteGroup( pt_cfg->m_Ident ); } else { - pt_cfg->SaveParam( m_ProjectConfig ); + pt_cfg->SaveParam( m_projectSettings ); } } - m_ProjectConfig->SetPath( UNIX_STRING_DIR_SEP ); - delete m_ProjectConfig; - m_ProjectConfig = NULL; + m_projectSettings->SetPath( UNIX_STRING_DIR_SEP ); + delete m_projectSettings; + m_projectSettings = NULL; } @@ -176,25 +176,25 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, /* Write date ( surtout pour eviter bug de wxFileConfig * qui se trompe de rubrique si declaration [xx] en premiere ligne * (en fait si groupe vide) */ - m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); + m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); - m_ProjectConfig->Write( wxT( "update" ), DateAndTime() ); - m_ProjectConfig->Write( wxT( "last_client" ), GetAppName() ); + m_projectSettings->Write( wxT( "update" ), DateAndTime() ); + m_projectSettings->Write( wxT( "last_client" ), GetAppName() ); /* Save parameters */ - m_ProjectConfig->DeleteGroup( GroupName ); // Erase all data - m_ProjectConfig->Flush(); + m_projectSettings->DeleteGroup( GroupName ); // Erase all data + m_projectSettings->Flush(); - m_ProjectConfig->SetPath( GroupName ); - m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION ); - m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); + m_projectSettings->SetPath( GroupName ); + m_projectSettings->Write( wxT( "version" ), CONFIG_VERSION ); + m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); BOOST_FOREACH( const PARAM_CFG_BASE& param, params ) { if( param.m_Group ) - m_ProjectConfig->SetPath( param.m_Group ); + m_projectSettings->SetPath( param.m_Group ); else - m_ProjectConfig->SetPath( GroupName ); + m_projectSettings->SetPath( GroupName ); if( param.m_Setup ) continue; @@ -202,23 +202,23 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, if ( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data { if( param.m_Ident ) - m_ProjectConfig->DeleteGroup( param.m_Ident ); + m_projectSettings->DeleteGroup( param.m_Ident ); } else { - param.SaveParam( m_ProjectConfig ); + param.SaveParam( m_projectSettings ); } } - m_ProjectConfig->SetPath( UNIX_STRING_DIR_SEP ); - delete m_ProjectConfig; - m_ProjectConfig = NULL; + m_projectSettings->SetPath( UNIX_STRING_DIR_SEP ); + delete m_projectSettings; + m_projectSettings = NULL; } /** * Function SaveCurrentSetupValues - * Save the current setup values in m_EDA_Config + * Save the current setup values in m_settings * saved parameters are parameters that have the .m_Setup member set to true * @param aList = array of PARAM_CFG_BASE pointers */ @@ -226,7 +226,7 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList ) { PARAM_CFG_BASE* pt_cfg; - if( m_EDA_Config == NULL ) + if( m_settings == NULL ) return; for( ; *aList != NULL; aList++ ) @@ -238,11 +238,11 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList ) if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data { if( pt_cfg->m_Ident ) - m_EDA_Config->DeleteGroup( pt_cfg->m_Ident ); + m_settings->DeleteGroup( pt_cfg->m_Ident ); } else { - pt_cfg->SaveParam( m_EDA_Config ); + pt_cfg->SaveParam( m_settings ); } } } @@ -250,7 +250,7 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList ) void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List ) { - if( m_EDA_Config == NULL ) + if( m_settings == NULL ) return; BOOST_FOREACH( const PARAM_CFG_BASE& param, List ) @@ -261,10 +261,12 @@ void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List ) if ( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data { if( param.m_Ident ) - m_EDA_Config->DeleteGroup( param.m_Ident ); + m_settings->DeleteGroup( param.m_Ident ); } else - param.SaveParam( m_EDA_Config ); + { + param.SaveParam( m_settings ); + } } } @@ -279,8 +281,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ReCreatePrjConfig( local_config_filename, GroupName, false ); - m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); - timestamp = m_ProjectConfig->Read( wxT( "update" ) ); + m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); + timestamp = m_projectSettings->Read( wxT( "update" ) ); if( Load_Only_if_New && ( !timestamp.IsEmpty() ) && (timestamp == m_CurrentOptionFileDateAndTime) ) @@ -307,18 +309,18 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, pt_cfg = *List; if( pt_cfg->m_Group ) - m_ProjectConfig->SetPath( pt_cfg->m_Group ); + m_projectSettings->SetPath( pt_cfg->m_Group ); else - m_ProjectConfig->SetPath( GroupName ); + m_projectSettings->SetPath( GroupName ); if( pt_cfg->m_Setup ) continue; - pt_cfg->ReadParam( m_ProjectConfig ); + pt_cfg->ReadParam( m_projectSettings ); } - delete m_ProjectConfig; - m_ProjectConfig = NULL; + delete m_projectSettings; + m_projectSettings = NULL; return true; } @@ -333,8 +335,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ReCreatePrjConfig( local_config_filename, GroupName, false ); - m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); - timestamp = m_ProjectConfig->Read( wxT( "update" ) ); + m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR ); + timestamp = m_projectSettings->Read( wxT( "update" ) ); if( Load_Only_if_New && ( !timestamp.IsEmpty() ) && (timestamp == m_CurrentOptionFileDateAndTime) ) @@ -359,18 +361,18 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, BOOST_FOREACH( const PARAM_CFG_BASE& param, params ) { if( param.m_Group ) - m_ProjectConfig->SetPath( param.m_Group ); + m_projectSettings->SetPath( param.m_Group ); else - m_ProjectConfig->SetPath( GroupName ); + m_projectSettings->SetPath( GroupName ); if( param.m_Setup ) continue; - param.ReadParam( m_ProjectConfig ); + param.ReadParam( m_projectSettings ); } - delete m_ProjectConfig; - m_ProjectConfig = NULL; + delete m_projectSettings; + m_projectSettings = NULL; return true; } @@ -387,7 +389,7 @@ void EDA_APP::ReadCurrentSetupValues( PARAM_CFG_BASE** aList ) if( pt_cfg->m_Setup == false ) continue; - pt_cfg->ReadParam( m_EDA_Config ); + pt_cfg->ReadParam( m_settings ); } } @@ -399,7 +401,7 @@ void EDA_APP::ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List ) if( param.m_Setup == false ) continue; - param.ReadParam( m_EDA_Config ); + param.ReadParam( m_settings ); } } diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index be982cd4cf..fe9c178614 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -185,7 +185,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) : CVPCB_MAINFRAME::~CVPCB_MAINFRAME() { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); if( config ) { @@ -199,9 +199,9 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME() void CVPCB_MAINFRAME::LoadSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_BASE_FRAME::LoadSettings(); cfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true ); @@ -212,9 +212,9 @@ void CVPCB_MAINFRAME::LoadSettings() void CVPCB_MAINFRAME::SaveSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_BASE_FRAME::SaveSettings(); cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen ); @@ -278,10 +278,10 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) } // Close the help frame - if( wxGetApp().m_HtmlCtrl ) + if( wxGetApp().GetHtmlHelpController() ) { - if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active - wxGetApp().m_HtmlCtrl->GetFrame()->Close( true ); + if( wxGetApp().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active + wxGetApp().GetHtmlHelpController()->GetFrame()->Close( true ); } if( m_NetlistFileName.IsOk() ) diff --git a/cvpcb/dialogs/dialog_cvpcb_config.cpp b/cvpcb/dialogs/dialog_cvpcb_config.cpp index 576df736bd..fc4fb5e064 100644 --- a/cvpcb/dialogs/dialog_cvpcb_config.cpp +++ b/cvpcb/dialogs/dialog_cvpcb_config.cpp @@ -29,7 +29,7 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) : fn.SetExt( ProjectFileExtension ); m_Parent = parent; - m_Config = wxGetApp().m_EDA_CommonConfig; + m_Config = wxGetApp().GetCommonSettings(); Init( ); title = _( "Project file: " ) + fn.GetFullPath(); diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index 0c2582048d..baf26722e2 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -1,3 +1,27 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file cvpcb/menubar.cpp * @brief (Re)Create the menubar for CvPcb @@ -49,11 +73,11 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentMenu ) - wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); + wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu ); openRecentMenu = new wxMenu(); - wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); - wxGetApp().m_fileHistory.AddFilesToMenu(); + wxGetApp().GetFileHistory().UseMenu( openRecentMenu ); + wxGetApp().GetFileHistory().AddFilesToMenu(); AddMenuItem( filesMenu, openRecentMenu, -1, _( "Open &Recent" ), _( "Open a recent opened netlist document" ), diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp index 5562ba51aa..4e01c9d85e 100644 --- a/cvpcb/tool_cvpcb.cpp +++ b/cvpcb/tool_cvpcb.cpp @@ -39,7 +39,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); if( m_mainToolBar != NULL ) return; diff --git a/eeschema/dialogs/annotate_dialog.cpp b/eeschema/dialogs/annotate_dialog.cpp index 691fe2a19f..0d2c481717 100644 --- a/eeschema/dialogs/annotate_dialog.cpp +++ b/eeschema/dialogs/annotate_dialog.cpp @@ -54,7 +54,7 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ) void DIALOG_ANNOTATE::InitValues() /*********************************/ { - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); SetFocus(); // needed to close dialog by escape key if( m_Config ) { diff --git a/eeschema/dialogs/dialog_SVG_print.cpp b/eeschema/dialogs/dialog_SVG_print.cpp index 770d493ac3..d9269f0748 100644 --- a/eeschema/dialogs/dialog_SVG_print.cpp +++ b/eeschema/dialogs/dialog_SVG_print.cpp @@ -61,7 +61,7 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) : DIALOG_SVG_PRINT_base( parent ) { m_Parent = parent; - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); } diff --git a/eeschema/dialogs/dialog_build_BOM.cpp b/eeschema/dialogs/dialog_build_BOM.cpp index abf90c7e81..f5b8a657d8 100644 --- a/eeschema/dialogs/dialog_build_BOM.cpp +++ b/eeschema/dialogs/dialog_build_BOM.cpp @@ -111,7 +111,7 @@ static char s_ExportSeparator[] = ("\t;,."); DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( EDA_DRAW_FRAME* parent ) : DIALOG_BUILD_BOM_BASE( parent ) { - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); wxASSERT( m_Config != NULL ); m_Parent = parent; diff --git a/eeschema/dialogs/dialog_eeschema_config.cpp b/eeschema/dialogs/dialog_eeschema_config.cpp index 9cd0ea7dd2..f3749687bc 100644 --- a/eeschema/dialogs/dialog_eeschema_config.cpp +++ b/eeschema/dialogs/dialog_eeschema_config.cpp @@ -53,7 +53,7 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* aSchFrame, Init(); - msg = _( "from " ) + wxGetApp().m_CurrentOptionFile; + msg = _( "from " ) + wxGetApp().GetCurrentOptionFile(); SetTitle( msg ); if( GetSizer() ) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 467b3079eb..1b62863c4e 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -511,11 +511,11 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void ) void SCH_EDIT_FRAME::LoadSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); long tmp; - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_DRAW_FRAME::LoadSettings(); @@ -607,9 +607,9 @@ void SCH_EDIT_FRAME::LoadSettings() void SCH_EDIT_FRAME::SaveSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_DRAW_FRAME::SaveSettings(); diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 20cabd7dc2..3d2dc73f75 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -291,8 +291,8 @@ void LIB_EDIT_FRAME::LoadSettings() EDA_DRAW_FRAME::LoadSettings(); - wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); - cfg = wxGetApp().m_EDA_Config; + wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); + cfg = wxGetApp().GetSettings(); m_lastLibExportPath = cfg->Read( lastLibExportPathEntry, ::wxGetCwd() ); m_lastLibImportPath = cfg->Read( lastLibImportPathEntry, ::wxGetCwd() ); @@ -312,8 +312,8 @@ void LIB_EDIT_FRAME::SaveSettings() EDA_DRAW_FRAME::SaveSettings(); - wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); - cfg = wxGetApp().m_EDA_Config; + wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); + cfg = wxGetApp().GetSettings(); cfg->Write( lastLibExportPathEntry, m_lastLibExportPath ); cfg->Write( lastLibImportPathEntry, m_lastLibImportPath ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 0126a261bd..57bcddb279 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -86,11 +86,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentMenu ) - wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); + wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu ); openRecentMenu = new wxMenu(); - wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); - wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); + wxGetApp().GetFileHistory().UseMenu( openRecentMenu ); + wxGetApp().GetFileHistory().AddFilesToMenu( openRecentMenu ); AddMenuItem( fileMenu, openRecentMenu, wxID_ANY, _( "Open &Recent" ), _( "Open a recent opened schematic project" ), diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index 7516c3f64b..960eecec36 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file netlist_control.cpp * @brief Dialog box for creating netlists. @@ -58,8 +83,8 @@ wxString ReturnUserNetlistTypeName( bool first_item ) msg = CUSTOM_NETLIST_TITLE; msg << index + 1; - if( wxGetApp().m_EDA_Config ) - name = wxGetApp().m_EDA_Config->Read( msg ); + if( wxGetApp().GetSettings() ) + name = wxGetApp().GetSettings()->Read( msg ); return name; } @@ -332,7 +357,7 @@ void NETLIST_DIALOG::InstallCustomPages() msg = CUSTOM_NETLIST_COMMAND; msg << ii + 1; - wxString Command = wxGetApp().m_EDA_Config->Read( msg ); + wxString Command = wxGetApp().GetSettings()->Read( msg ); CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage, -1, _( "Netlist command:" ) ), 0, @@ -372,7 +397,7 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event ) wxString FullFileName, Mask, Path; Mask = wxT( "*" ); - Path = wxGetApp().m_BinDir; + Path = wxGetApp().GetExecutablePath(); FullFileName = EDA_FileSelector( _( "Plugin files:" ), Path, FullFileName, @@ -650,7 +675,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) { wxString msg, Command; - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); NetlistUpdateOpt(); diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 594f79d36f..3f30fe5b2e 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -513,8 +513,8 @@ void LIB_VIEW_FRAME::LoadSettings( ) EDA_DRAW_FRAME::LoadSettings(); - wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); - cfg = wxGetApp().m_EDA_Config; + wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); + cfg = wxGetApp().GetSettings(); m_LibListSize.x = 150; // default width of libs list m_CmpListSize.x = 150; // default width of component list @@ -537,8 +537,8 @@ void LIB_VIEW_FRAME::SaveSettings() EDA_DRAW_FRAME::SaveSettings(); - wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); - cfg = wxGetApp().m_EDA_Config; + wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); + cfg = wxGetApp().GetSettings(); if ( m_LibListSize.x ) cfg->Write( LIBLIST_WIDTH_KEY, m_LibListSize.x ); diff --git a/gerbview/dialogs/dialog_print_using_printer.cpp b/gerbview/dialogs/dialog_print_using_printer.cpp index 785fca0f98..a55a704374 100644 --- a/gerbview/dialogs/dialog_print_using_printer.cpp +++ b/gerbview/dialogs/dialog_print_using_printer.cpp @@ -110,7 +110,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent ) /*************************************************************************************/ { m_Parent = parent; - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); InitValues( ); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index fff4ba8b94..7e94b641be 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -200,7 +200,7 @@ double GERBVIEW_FRAME::BestZoom() void GERBVIEW_FRAME::LoadSettings() { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); if( config == NULL ) return; @@ -245,7 +245,7 @@ void GERBVIEW_FRAME::LoadSettings() void GERBVIEW_FRAME::SaveSettings() { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); if( config == NULL ) return; diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index c3d02bb160..7ab03a0108 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -82,11 +82,11 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void ) // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentGbrMenu ) - wxGetApp().m_fileHistory.RemoveMenu( openRecentGbrMenu ); + wxGetApp().GetFileHistory().RemoveMenu( openRecentGbrMenu ); openRecentGbrMenu = new wxMenu(); - wxGetApp().m_fileHistory.UseMenu( openRecentGbrMenu ); - wxGetApp().m_fileHistory.AddFilesToMenu(); + wxGetApp().GetFileHistory().UseMenu( openRecentGbrMenu ); + wxGetApp().GetFileHistory().AddFilesToMenu(); AddMenuItem( fileMenu, openRecentGbrMenu, wxID_ANY, _( "Open &Recent Gerber File" ), diff --git a/gerbview/select_layers_to_pcb.cpp b/gerbview/select_layers_to_pcb.cpp index 4bb3c49c26..d885ac9046 100644 --- a/gerbview/select_layers_to_pcb.cpp +++ b/gerbview/select_layers_to_pcb.cpp @@ -283,7 +283,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event ) */ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event ) { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); config->Write( wxT("BrdLayersCount"), m_itemsCount ); wxString key; @@ -296,7 +296,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event ) { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); config->Read( wxT("BrdLayersCount"), &m_exportBoardCopperLayersCount ); normalizeBrdLayersCount(); diff --git a/include/appl_wxstruct.h b/include/appl_wxstruct.h index 877f006e28..9a558f28ea 100644 --- a/include/appl_wxstruct.h +++ b/include/appl_wxstruct.h @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file appl_wxstruct.h * @brief Base class implementation for all KiCad applications. @@ -34,43 +59,55 @@ class wxHtmlHelpController; */ class EDA_APP : public wxApp { -public: - EDA_APP_T m_Id; /* Used mainly to handle default paths libs - * m_Id = APP_EESCHEMA_T, APP_PCBNEW_T ... */ - wxString m_Project; +protected: + /// Used mainly to handle default paths libs m_Id = APP_EESCHEMA_T, APP_PCBNEW_T ... + EDA_APP_T m_Id; + + /// Used to prevent multiple instances of an application from being run at the same time. wxSingleInstanceChecker* m_Checker; - wxPoint m_HelpPos; - wxSize m_HelpSize; - wxHtmlHelpController* m_HtmlCtrl; - wxConfig* m_EDA_Config; - wxConfig* m_EDA_CommonConfig; - wxFileConfig* m_ProjectConfig; + wxString m_Project; + + /// The application specific configuration settings. + wxConfig* m_settings; + + /// The configuration settings common to all KiCad applications. + wxConfig* m_commonSettings; + + /// The current project specific settings. + wxFileConfig* m_projectSettings; + + /// KiCad executable path. + wxString m_BinDir; + + /// The KICAD system environment variable. + wxString m_KicadEnv; + + /// The current locale. + wxLocale* m_Locale; + + /// The current language setting. + int m_LanguageId; + + /// The file name of the the program selected for browsing pdf files. + wxString m_PdfBrowser; + + wxPathList m_searchPaths; + wxFileHistory m_fileHistory; wxString m_HelpFileName; wxString m_EditorName; wxString m_CurrentOptionFile; wxString m_CurrentOptionFileDateAndTime; - - wxString m_BinDir; /* KiCad executable path.*/ - wxString m_KicadEnv; /* environment variable KICAD */ - bool m_Env_Defined; // true if environment KICAD is defined. - - wxLocale* m_Locale; // The current locale. - int m_LanguageId; // The current language setting. - wxString m_PdfBrowser; // Name of the selected browser, - // for browsing pdf datasheets - bool m_PdfBrowserIsDefault; // True if the pdf browser is the - // default (m_PdfBrowser not used) - wxPathList m_searchPaths; - wxFileHistory m_fileHistory; - -protected: + wxPoint m_HelpPos; + wxSize m_HelpSize; + wxHtmlHelpController* m_HtmlCtrl; wxString m_Title; wxPathList m_libSearchPaths; wxFileName m_projectFileName; wxString m_LastVisitedLibPath; -public: EDA_APP(); +public: + EDA_APP(); ~EDA_APP(); /** @@ -80,6 +117,40 @@ public: EDA_APP(); */ bool OnInit(); + wxHtmlHelpController* GetHtmlHelpController() { return m_HtmlCtrl; } + + void SetHtmlHelpController( wxHtmlHelpController* aController ); + + wxString GetHelpFileName() const { return m_HelpFileName; } + + void SetHelpFileName( const wxString& aFileName ) { m_HelpFileName = aFileName; } + + wxConfig* GetSettings() { return m_settings; } + + wxConfig* GetCommonSettings() { return m_commonSettings; } + + wxString GetEditorName() const { return m_EditorName; } + + void SetEditorName( const wxString& aFileName ) { m_EditorName = aFileName; } + + wxString GetCurrentOptionFile() const { return m_CurrentOptionFile; } + + bool IsKicadEnvVariableDefined() const { return !m_KicadEnv.IsEmpty(); } + + wxString GetKicadEnvVariable() const { return m_KicadEnv; } + + wxString GetExecutablePath() const { return m_BinDir; } + + wxLocale* GetLocale() { return m_Locale; } + + wxString GetPdfBrowserFileName() const { return m_PdfBrowser; } + + void SetPdfBrowserFileName( const wxString& aFileName ) { m_PdfBrowser = aFileName; } + + bool UseSystemPdfBrowser() const { return m_PdfBrowser.IsEmpty(); } + + wxFileHistory& GetFileHistory() { return m_fileHistory; } + /** * Function SetBinDir * finds the path to the executable and store it in EDA_APP::m_BinDir @@ -183,7 +254,7 @@ public: EDA_APP(); /** * Function SaveCurrentSetupValues - * Save the current setup values in m_EDA_Config + * Save the current setup values in m_settings * saved parameters are parameters that have the .m_Setup member set to * true * @param aList = array of PARAM_CFG_BASE pointers @@ -193,7 +264,7 @@ public: EDA_APP(); /** * Function ReadCurrentSetupValues - * Read the current setup values previously saved, from m_EDA_Config + * Read the current setup values previously saved, from m_settings * saved parameters are parameters that have the .m_Setup member set to * true * @param aList = array of PARAM_CFG_BASE pointers diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index c08230d5e2..b679e5b8a5 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -142,12 +142,12 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event ) SaveSettings(); // Close the help frame - if( wxGetApp().m_HtmlCtrl ) + if( wxGetApp().GetHtmlHelpController() ) { - if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active - wxGetApp().m_HtmlCtrl->GetFrame()->Close( true ); + if( wxGetApp().GetHtmlHelpController()->GetFrame() ) // returns NULL if no help frame active + wxGetApp().GetHtmlHelpController()->GetFrame()->Close( true ); - wxGetApp().m_HtmlCtrl = NULL; + wxGetApp().SetHtmlHelpController( NULL ); } m_LeftWin->Show( false ); @@ -258,9 +258,9 @@ void KICAD_MANAGER_FRAME::ClearMsg() void KICAD_MANAGER_FRAME::LoadSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_BASE_FRAME::LoadSettings(); cfg->Read( TreeFrameWidthEntry, &m_LeftWin_Width ); @@ -269,9 +269,9 @@ void KICAD_MANAGER_FRAME::LoadSettings() void KICAD_MANAGER_FRAME::SaveSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_BASE_FRAME::SaveSettings(); diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 36a935b10b..8ef95f60ac 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -121,11 +121,11 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentMenu ) - wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); + wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu ); openRecentMenu = new wxMenu(); - wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); - wxGetApp().m_fileHistory.AddFilesToMenu( ); + wxGetApp().GetFileHistory().UseMenu( openRecentMenu ); + wxGetApp().GetFileHistory().AddFilesToMenu( ); AddMenuItem( fileMenu, openRecentMenu, wxID_ANY, _( "Open &Recent" ), @@ -211,7 +211,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() SubMenuPdfBrowserChoice->Append( item ); SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER, - wxGetApp().m_PdfBrowserIsDefault ); + wxGetApp().UseSystemPdfBrowser() ); // Favourite item = new wxMenuItem( SubMenuPdfBrowserChoice, @@ -225,7 +225,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() SubMenuPdfBrowserChoice->Append( item ); SubMenuPdfBrowserChoice->AppendSeparator(); SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER, - !wxGetApp().m_PdfBrowserIsDefault ); + !wxGetApp().UseSystemPdfBrowser() ); // Append PDF Viewer submenu to preferences AddMenuItem( SubMenuPdfBrowserChoice, diff --git a/kicad/preferences.cpp b/kicad/preferences.cpp index fd09182ec7..bf8538ddda 100644 --- a/kicad/preferences.cpp +++ b/kicad/preferences.cpp @@ -1,6 +1,31 @@ -/*******************/ -/* preferences.cpp */ -/*******************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file preferences.cpp + */ #ifdef __GNUG__ #pragma implementation @@ -18,20 +43,19 @@ void KICAD_MANAGER_FRAME::OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event ) { - event.Check( wxGetApp().m_PdfBrowserIsDefault ); + event.Check( wxGetApp().UseSystemPdfBrowser() ); } void KICAD_MANAGER_FRAME::OnSelectDefaultPdfBrowser( wxCommandEvent& event ) { - wxGetApp().m_PdfBrowserIsDefault = true; wxGetApp().WritePdfBrowserInfos(); } void KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event ) { - event.Check( !wxGetApp().m_PdfBrowserIsDefault ); + event.Check( !wxGetApp().UseSystemPdfBrowser() ); } @@ -39,7 +63,7 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event ) { bool select = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME; - if( !wxGetApp().m_PdfBrowser && !select ) + if( !wxGetApp().GetPdfBrowserFileName() && !select ) { DisplayError( this, _( "You must choose a PDF viewer before using this option." ) ); @@ -54,7 +78,7 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event ) wildcard = _( "Executable files (" ) + wildcard + wxT( ")|" ) + wildcard; wxGetApp().ReadPdfBrowserInfos(); - wxFileName fn = wxGetApp().m_PdfBrowser; + wxFileName fn = wxGetApp().GetPdfBrowserFileName(); wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(), fn.GetFullName(), wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); @@ -62,11 +86,11 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event ) if( dlg.ShowModal() == wxID_CANCEL ) return; - wxGetApp().m_PdfBrowser = dlg.GetPath(); - wxGetApp().m_PdfBrowserIsDefault = wxGetApp().m_PdfBrowser.IsEmpty(); + wxGetApp().SetPdfBrowserFileName( dlg.GetPath() ); wxGetApp().WritePdfBrowserInfos(); } + void KICAD_MANAGER_FRAME::SetLanguage( wxCommandEvent& event ) { EDA_BASE_FRAME::SetLanguage( event ); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 21f26d67dd..b64eeb2e3b 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -522,9 +522,9 @@ void PCB_BASE_FRAME::unitsChangeRefresh() void PCB_BASE_FRAME::LoadSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_DRAW_FRAME::LoadSettings(); @@ -566,9 +566,9 @@ void PCB_BASE_FRAME::LoadSettings() void PCB_BASE_FRAME::SaveSettings() { - wxASSERT( wxGetApp().m_EDA_Config != NULL ); + wxASSERT( wxGetApp().GetSettings() != NULL ); - wxConfig* cfg = wxGetApp().m_EDA_Config; + wxConfig* cfg = wxGetApp().GetSettings(); EDA_DRAW_FRAME::SaveSettings(); cfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x ); diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index 5f0d129d6f..9ea68f7712 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -52,8 +52,8 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) : DIALOG_SVG_PRINT_base( parent ) { m_Parent = (PCB_BASE_FRAME*) parent; - m_Config = wxGetApp().m_EDA_Config; - initDialog( ); + m_Config = wxGetApp().GetSettings(); + initDialog(); GetSizer()->SetSizeHints( this ); Centre(); m_buttonBoard->SetDefault(); diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index c6d54676da..a574957e05 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -34,7 +34,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_EDIT_FRAME* parent, ZONE_SETTING* zo DIALOG_COPPER_ZONE_BASE( parent ) { m_Parent = parent; - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); m_Zone_Setting = zone_setting; m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort m_OnExitCode = ZONE_ABORT; diff --git a/pcbnew/dialogs/dialog_freeroute_exchange.cpp b/pcbnew/dialogs/dialog_freeroute_exchange.cpp index 2a6abd0499..72936ab88e 100644 --- a/pcbnew/dialogs/dialog_freeroute_exchange.cpp +++ b/pcbnew/dialogs/dialog_freeroute_exchange.cpp @@ -54,7 +54,8 @@ void DIALOG_FREEROUTE::MyInit() m_FreeRouteSetupChanged = false; wxString msg; - wxGetApp().m_EDA_Config->Read( FREEROUTE_URL_KEY, &msg ); + wxGetApp().GetSettings()->Read( FREEROUTE_URL_KEY, &msg ); + if( msg.IsEmpty() ) m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) ); else @@ -140,8 +141,8 @@ void DIALOG_FREEROUTE::OnOKButtonClick( wxCommandEvent& event ) { if( m_FreeRouteSetupChanged ) // Save new config { - wxGetApp().m_EDA_Config->Write( FREEROUTE_URL_KEY, - m_FreerouteURLName->GetValue() ); + wxGetApp().GetSettings()->Write( FREEROUTE_URL_KEY, + m_FreerouteURLName->GetValue() ); } EndModal(wxID_OK); diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 07dedfb0ba..69f9b3fbaf 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -100,7 +100,7 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL() void DIALOG_GENDRILL::initDialog() { SetFocus(); // Under wxGTK: mandatory to close dialog by the ESC key - wxConfig* Config = wxGetApp().m_EDA_Config; + wxConfig* Config = wxGetApp().GetSettings(); if( Config ) { @@ -234,7 +234,7 @@ void DIALOG_GENDRILL::UpdateConfig() { SetParams(); - wxConfig* Config = wxGetApp().m_EDA_Config; + wxConfig* Config = wxGetApp().GetSettings(); if( Config ) { diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp index 145f38f6f9..6cf8d4f56d 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp @@ -21,9 +21,7 @@ #include "dialog_pcbnew_config_libs_and_paths.h" -/*****************************************************************/ void PCB_EDIT_FRAME::InstallConfigFrame( ) -/*****************************************************************/ { DIALOG_PCBNEW_CONFIG_LIBS dialog( this ); dialog.ShowModal(); @@ -33,11 +31,11 @@ void PCB_EDIT_FRAME::InstallConfigFrame( ) DIALOG_PCBNEW_CONFIG_LIBS::DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME* parent ): DIALOG_PCBNEW_CONFIG_LIBS_FBP(parent) { - m_Config = wxGetApp().m_EDA_CommonConfig; + m_Config = wxGetApp().GetCommonSettings(); Init( ); - wxString title = _( "from " ) + wxGetApp().m_CurrentOptionFile; + wxString title = _( "from " ) + wxGetApp().GetCurrentOptionFile(); SetTitle( title ); m_sdbSizer1OK->SetDefault(); diff --git a/pcbnew/dialogs/dialog_print_for_modedit.cpp b/pcbnew/dialogs/dialog_print_for_modedit.cpp index 19c8ccc099..38602c898b 100644 --- a/pcbnew/dialogs/dialog_print_for_modedit.cpp +++ b/pcbnew/dialogs/dialog_print_for_modedit.cpp @@ -85,7 +85,7 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( EDA_DRAW_FRAME* parent ) : { m_Parent = parent; s_Parameters.m_ForceCentered = true; - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); InitValues(); m_buttonPrint->SetDefault(); diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index af5577953f..ccf6be3f37 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -120,7 +120,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent ) /*************************************************************************************/ { m_Parent = parent; - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); InitValues( ); diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 8e3c0bd23c..c7a5b005de 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1066,7 +1066,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: { - wxConfig* cfg = wxGetApp().m_EDA_CommonConfig; + wxConfig* cfg = wxGetApp().GetCommonSettings(); cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName ); GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() ); } diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 65155d5a5c..8429b4f4f1 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -51,7 +51,7 @@ public: DIALOG_EXPORT_3DFILE_BASE( parent ) { m_parent = parent; - m_config = wxGetApp().m_EDA_Config; + m_config = wxGetApp().GetSettings(); SetFocus(); m_config->Read( OPTKEY_OUTPUT_UNIT, &m_unitsOpt ); m_config->Read( OPTKEY_3DFILES_OPT, &m_3DFilesOpt ); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index b5879f5f89..3156972c2b 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -51,7 +51,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() bool Footprint_Is_GPCB_Format = false; wxString LastOpenedPathForLoading; - wxConfig* Config = wxGetApp().m_EDA_Config; + wxConfig* Config = wxGetApp().GetSettings(); if( Config ) Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading ); @@ -145,7 +145,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib ) wxFileName fn; FILE* file; wxString msg, path, title, wildcard; - wxConfig* Config = wxGetApp().m_EDA_Config; + wxConfig* Config = wxGetApp().GetSettings(); if( aModule == NULL ) return; diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 21161f0264..fd2e30e20a 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -78,11 +78,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentMenu ) - wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); + wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu ); openRecentMenu = new wxMenu(); - wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); - wxGetApp().m_fileHistory.AddFilesToMenu(); + wxGetApp().GetFileHistory().UseMenu( openRecentMenu ); + wxGetApp().GetFileHistory().AddFilesToMenu(); AddMenuItem( filesMenu, openRecentMenu, -1, _( "Open &Recent" ), _( "Open a recent opened board" ), diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 85b0f7b3b1..12bbe551d1 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -544,7 +544,7 @@ void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event ) void PCB_EDIT_FRAME::LoadSettings() { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); if( config == NULL ) return; @@ -572,7 +572,7 @@ void PCB_EDIT_FRAME::LoadSettings() void PCB_EDIT_FRAME::SaveSettings() { - wxConfig* config = wxGetApp().m_EDA_Config; + wxConfig* config = wxGetApp().GetSettings(); if( config == NULL ) return; diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 0f2daad8ec..c317c247a5 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -91,7 +91,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) : DIALOG_PLOT_BASE( parent ) { m_Parent = parent; - m_Config = wxGetApp().m_EDA_Config; + m_Config = wxGetApp().GetSettings(); Init_Dialog(); diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index f0290233c8..e5b44855c1 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -479,10 +479,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) zone->SetNetNameFromNetCode( ); } - wxGetApp().m_EDA_Config->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, - &g_Zone_Default_Setting.m_ThermalReliefGap ); - wxGetApp().m_EDA_Config->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, - &g_Zone_Default_Setting.m_ThermalReliefCopperBridge ); + wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, + &g_Zone_Default_Setting.m_ThermalReliefGap ); + wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, + &g_Zone_Default_Setting.m_ThermalReliefCopperBridge ); g_Zone_Default_Setting.m_CurrentZone_Layer = zone->GetLayer(); DIALOG_COPPER_ZONE* frame = new DIALOG_COPPER_ZONE( this, &g_Zone_Default_Setting ); diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index 54d71ae7a2..23ec0c6386 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -152,10 +152,10 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event ) break; } - if( wxGetApp().m_EDA_Config ) + if( wxGetApp().GetSettings() ) { - wxGetApp().m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, - (long) g_Zone_Default_Setting.m_Zone_HatchingStyle ); + wxGetApp().GetSettings()->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, + (long) g_Zone_Default_Setting.m_Zone_HatchingStyle ); } if( m_OrientEdgesOpt->GetSelection() == 0 )