Commit 0e27f45f authored by Wayne Stambaugh's avatar Wayne Stambaugh

Encapsulate EDA_APP class.

parent d4635805
...@@ -113,7 +113,7 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -113,7 +113,7 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
void EDA_3D_FRAME::GetSettings() void EDA_3D_FRAME::GetSettings()
{ {
wxString text; wxString text;
wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
if( config ) if( config )
{ {
...@@ -140,7 +140,7 @@ void EDA_3D_FRAME::GetSettings() ...@@ -140,7 +140,7 @@ void EDA_3D_FRAME::GetSettings()
void EDA_3D_FRAME::SaveSettings() void EDA_3D_FRAME::SaveSettings()
{ {
wxString text; wxString text;
wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by application wxConfig* Config = wxGetApp().GetSettings(); // Current config used by application
if( !Config ) if( !Config )
return; return;
......
...@@ -100,10 +100,8 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, ...@@ -100,10 +100,8 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
EDA_BASE_FRAME::~EDA_BASE_FRAME() EDA_BASE_FRAME::~EDA_BASE_FRAME()
{ {
if( wxGetApp().m_HtmlCtrl ) if( wxGetApp().GetHtmlHelpController() )
delete wxGetApp().m_HtmlCtrl; wxGetApp().SetHtmlHelpController( NULL );
wxGetApp().m_HtmlCtrl = NULL;
delete m_autoSaveTimer; delete m_autoSaveTimer;
...@@ -174,7 +172,7 @@ void EDA_BASE_FRAME::LoadSettings() ...@@ -174,7 +172,7 @@ void EDA_BASE_FRAME::LoadSettings()
int Ypos_min; int Ypos_min;
wxConfig* config; wxConfig* config;
config = wxGetApp().m_EDA_Config; config = wxGetApp().GetSettings();
int maximized = 0; int maximized = 0;
...@@ -219,7 +217,7 @@ void EDA_BASE_FRAME::SaveSettings() ...@@ -219,7 +217,7 @@ void EDA_BASE_FRAME::SaveSettings()
wxString text; wxString text;
wxConfig* config; wxConfig* config;
config = wxGetApp().m_EDA_Config; config = wxGetApp().GetSettings();
if( ( config == NULL ) || IsIconized() ) if( ( config == NULL ) || IsIconized() )
return; return;
...@@ -275,7 +273,7 @@ void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, ...@@ -275,7 +273,7 @@ void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
wxFileHistory * fileHistory = aFileHistory; wxFileHistory * fileHistory = aFileHistory;
if( fileHistory == NULL ) if( fileHistory == NULL )
fileHistory = & wxGetApp().m_fileHistory; fileHistory = & wxGetApp().GetFileHistory();
fileHistory->AddFileToHistory( FullFileName ); fileHistory->AddFileToHistory( FullFileName );
} }
...@@ -289,7 +287,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type, ...@@ -289,7 +287,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
wxFileHistory * fileHistory = aFileHistory; wxFileHistory * fileHistory = aFileHistory;
if( fileHistory == NULL ) if( fileHistory == NULL )
fileHistory = & wxGetApp().m_fileHistory; fileHistory = & wxGetApp().GetFileHistory();
int baseId = fileHistory->GetBaseId(); int baseId = fileHistory->GetBaseId();
...@@ -321,28 +319,28 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -321,28 +319,28 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
/* We have to get document for beginners, /* We have to get document for beginners,
* or the the full specific doc * or the the full specific doc
* if event id is wxID_INDEX, we want the document for beginners. * 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 * The document for beginners is the same for all KiCad utilities
*/ */
if( event.GetId() == wxID_INDEX ) if( event.GetId() == wxID_INDEX )
{ {
// Temporary change the help filename // 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" // 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(); wxString helpFile = wxGetApp().GetHelpFile();
if( !helpFile ) if( !helpFile )
{ // Try to find "Getting_Started_in_KiCad.pdf" { // 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(); helpFile = wxGetApp().GetHelpFile();
} }
if( !helpFile ) if( !helpFile )
{ {
msg.Printf( _( "Help file %s could not be found." ), msg.Printf( _( "Help file %s could not be found." ),
GetChars( wxGetApp().m_HelpFileName ) ); GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
} }
else else
...@@ -350,26 +348,26 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -350,26 +348,26 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
GetAssociatedDocument( this, helpFile ); GetAssociatedDocument( this, helpFile );
} }
wxGetApp().m_HelpFileName = tmp; wxGetApp().SetHelpFileName( tmp );
return; return;
} }
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
if( wxGetApp().m_HtmlCtrl == NULL ) if( wxGetApp().GetHtmlHelpController() == NULL )
{ {
wxGetApp().InitOnLineHelp(); wxGetApp().InitOnLineHelp();
} }
if( wxGetApp().m_HtmlCtrl ) if( wxGetApp().GetHtmlHelpController() )
{ {
wxGetApp().m_HtmlCtrl->DisplayContents(); wxGetApp().GetHtmlHelpController()->DisplayContents();
wxGetApp().m_HtmlCtrl->Display( wxGetApp().m_HelpFileName ); wxGetApp().GetHtmlHelpController()->Display( wxGetApp().GetHelpFileName() );
} }
else 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 ); DisplayError( this, msg );
} }
...@@ -379,7 +377,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -379,7 +377,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
if( !helpFile ) if( !helpFile )
{ {
msg.Printf( _( "Help file %s could not be found." ), msg.Printf( _( "Help file %s could not be found." ),
GetChars( wxGetApp().m_HelpFileName ) ); GetChars( wxGetApp().GetHelpFileName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
} }
else else
...@@ -395,7 +393,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event ) ...@@ -395,7 +393,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event ) void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
{ {
wxFileName fn = wxGetApp().m_EditorName; wxFileName fn = wxGetApp().GetEditorName();
wxString wildcard( wxT( "*" ) ); wxString wildcard( wxT( "*" ) );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -411,11 +409,11 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event ) ...@@ -411,11 +409,11 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
wxASSERT( wxGetApp().m_EDA_CommonConfig ); wxASSERT( wxGetApp().GetCommonSettings() );
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig; wxConfig* cfg = wxGetApp().GetCommonSettings();
wxGetApp().m_EditorName = dlg.GetPath(); wxGetApp().SetEditorName( dlg.GetPath() );
cfg->Write( wxT( "Editor" ), wxGetApp().m_EditorName ); cfg->Write( wxT( "Editor" ), wxGetApp().GetEditorName() );
} }
......
...@@ -829,9 +829,9 @@ void EDA_DRAW_FRAME::UpdateStatusBar() ...@@ -829,9 +829,9 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
void EDA_DRAW_FRAME::LoadSettings() 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(); EDA_BASE_FRAME::LoadSettings();
cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 ); cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 );
...@@ -851,9 +851,9 @@ void EDA_DRAW_FRAME::LoadSettings() ...@@ -851,9 +851,9 @@ void EDA_DRAW_FRAME::LoadSettings()
void EDA_DRAW_FRAME::SaveSettings() 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(); EDA_BASE_FRAME::SaveSettings();
cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape ); cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_cursorShape );
......
...@@ -102,8 +102,8 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -102,8 +102,8 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_mouseCaptureCallback = NULL; m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL;
if( wxGetApp().m_EDA_Config ) if( wxGetApp().GetSettings() )
wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true ); wxGetApp().GetSettings()->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true );
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
m_Block_Enable = false; m_Block_Enable = false;
...@@ -123,7 +123,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -123,7 +123,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
EDA_DRAW_PANEL::~EDA_DRAW_PANEL() EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
{ {
wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable ); wxGetApp().GetSettings()->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable );
} }
......
...@@ -16,25 +16,17 @@ ...@@ -16,25 +16,17 @@
void EDA_APP::ReadPdfBrowserInfos() 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_commonSettings->Read( wxT( "PdfBrowserName" ), wxEmptyString );
m_PdfBrowser = m_EDA_CommonConfig->Read( wxT( "PdfBrowserName" ), wxEmptyString );
if( m_PdfBrowser.IsEmpty() )
m_PdfBrowserIsDefault = true;
} }
void EDA_APP::WritePdfBrowserInfos() 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_commonSettings->Write( wxT( "PdfBrowserName" ), m_PdfBrowser );
m_EDA_CommonConfig->Write( wxT( "PdfBrowserName" ), m_PdfBrowser );
} }
......
/*** /*
* 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 <stambaughw@verizon.net>
* 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 * @file edaapl.cpp
* *
* @brief For the main application: init functions, and language selection * @brief For the main application: init functions, and language selection
* (locale handling) * (locale handling)
***/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -246,15 +271,13 @@ static struct LANGUAGE_DESCR s_Language_List[] = ...@@ -246,15 +271,13 @@ static struct LANGUAGE_DESCR s_Language_List[] =
EDA_APP::EDA_APP() EDA_APP::EDA_APP()
{ {
m_Checker = NULL; m_Checker = NULL;
m_HtmlCtrl = NULL; m_HtmlCtrl = NULL;
m_EDA_Config = NULL; m_settings = NULL;
m_Env_Defined = false; m_LanguageId = wxLANGUAGE_DEFAULT;
m_LanguageId = wxLANGUAGE_DEFAULT;
m_PdfBrowserIsDefault = true;
m_Locale = NULL; m_Locale = NULL;
m_ProjectConfig = NULL; m_projectSettings = NULL;
m_EDA_CommonConfig = NULL; m_commonSettings = NULL;
} }
...@@ -263,13 +286,13 @@ EDA_APP::~EDA_APP() ...@@ -263,13 +286,13 @@ EDA_APP::~EDA_APP()
SaveSettings(); SaveSettings();
/* delete user datas */ /* delete user datas */
if( m_ProjectConfig ) if( m_projectSettings )
delete m_ProjectConfig; delete m_projectSettings;
if( m_EDA_CommonConfig ) if( m_commonSettings )
delete m_EDA_CommonConfig; delete m_commonSettings;
delete m_EDA_Config; delete m_settings;
if( m_Checker ) if( m_Checker )
delete m_Checker; delete m_Checker;
...@@ -289,9 +312,9 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) ...@@ -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: * the environment variable KICAD (if exists) gives the kicad path:
* something like set KICAD=d:\kicad * 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 ); 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 ) ...@@ -313,10 +336,10 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
SetVendorName( wxT( "KiCad" ) ); SetVendorName( wxT( "KiCad" ) );
SetAppName( aName.Lower() ); SetAppName( aName.Lower() );
SetTitle( aName ); SetTitle( aName );
m_EDA_Config = new wxConfig(); m_settings = new wxConfig();
wxASSERT( m_EDA_Config != NULL ); wxASSERT( m_settings != NULL );
m_EDA_CommonConfig = new wxConfig( CommonConfigPath ); m_commonSettings = new wxConfig( CommonConfigPath );
wxASSERT( m_EDA_CommonConfig != NULL ); wxASSERT( m_commonSettings != NULL );
/* Install some image handlers, mainly for help */ /* Install some image handlers, mainly for help */
wxImage::AddHandler( new wxPNGHandler ); wxImage::AddHandler( new wxPNGHandler );
...@@ -332,7 +355,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) ...@@ -332,7 +355,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
// Internationalization: loading the kicad suitable Dictionary // Internationalization: loading the kicad suitable Dictionary
wxString languageSel; wxString languageSel;
m_EDA_CommonConfig->Read( languageCfgKey, &languageSel); m_commonSettings->Read( languageCfgKey, &languageSel);
m_LanguageId = wxLANGUAGE_DEFAULT; m_LanguageId = wxLANGUAGE_DEFAULT;
// Search for the current selection // Search for the current selection
...@@ -356,6 +379,15 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) ...@@ -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() void EDA_APP::InitOnLineHelp()
{ {
wxString fullfilename = FindKicadHelpPath(); wxString fullfilename = FindKicadHelpPath();
...@@ -369,7 +401,7 @@ void EDA_APP::InitOnLineHelp() ...@@ -369,7 +401,7 @@ void EDA_APP::InitOnLineHelp()
m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS | m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS |
wxHF_PRINT | wxHF_OPEN_FILES wxHF_PRINT | wxHF_OPEN_FILES
/*| wxHF_SEARCH */ ); /*| wxHF_SEARCH */ );
m_HtmlCtrl->UseConfig( m_EDA_CommonConfig ); m_HtmlCtrl->UseConfig( m_commonSettings );
m_HtmlCtrl->SetTitleFormat( wxT( "KiCad Help" ) ); m_HtmlCtrl->SetTitleFormat( wxT( "KiCad Help" ) );
m_HtmlCtrl->AddBook( fullfilename ); m_HtmlCtrl->AddBook( fullfilename );
} }
...@@ -620,7 +652,7 @@ void EDA_APP::SetDefaultSearchPaths( void ) ...@@ -620,7 +652,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
{ {
wxASSERT( m_EDA_Config != NULL && m_EDA_CommonConfig != NULL ); wxASSERT( m_settings != NULL && m_commonSettings != NULL );
wxString Line; wxString Line;
...@@ -628,7 +660,7 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) ...@@ -628,7 +660,7 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
m_HelpSize.y = 400; m_HelpSize.y = 400;
wxString languageSel; wxString languageSel;
m_EDA_CommonConfig->Read( languageCfgKey, &languageSel ); m_commonSettings->Read( languageCfgKey, &languageSel );
m_LanguageId = wxLANGUAGE_DEFAULT; m_LanguageId = wxLANGUAGE_DEFAULT;
// Search for the current selection // Search for the current selection
...@@ -641,21 +673,21 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) ...@@ -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( aReopenLastUsedDirectory )
{ {
if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) && wxDirExists( Line ) ) if( m_settings->Read( wxT( "WorkingDir" ), &Line ) && wxDirExists( Line ) )
{ {
wxSetWorkingDirectory( 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 */ /* Load per-user search paths from settings file */
...@@ -664,8 +696,8 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) ...@@ -664,8 +696,8 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
while( 1 ) while( 1 )
{ {
upath = m_EDA_CommonConfig->Read( wxString::Format( wxT( "LibraryPath%d" ), i ), upath = m_commonSettings->Read( wxString::Format( wxT( "LibraryPath%d" ), i ),
wxT( "" ) ); wxT( "" ) );
if( upath.IsSameAs( wxT( "" ) ) ) if( upath.IsSameAs( wxT( "" ) ) )
break; break;
...@@ -678,13 +710,13 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) ...@@ -678,13 +710,13 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
void EDA_APP::SaveSettings() void EDA_APP::SaveSettings()
{ {
wxASSERT( m_EDA_Config != NULL ); wxASSERT( m_settings != NULL );
m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits ); m_settings->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits );
m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() ); m_settings->Write( wxT( "WorkingDir" ), wxGetCwd() );
m_EDA_Config->Write( wxT( "BgColor" ), g_DrawBgColor ); m_settings->Write( wxT( "BgColor" ), g_DrawBgColor );
/* Save the file history list */ /* 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 ) ...@@ -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) // Test if floating point notation is working (bug in cross compilation, using wine)
......
/*
* 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 <stambaughw@verizon.net>
* 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 * @file gestfich.cpp
* @brief Functions for file management * @brief Functions for file management
...@@ -272,14 +297,14 @@ wxString FindKicadHelpPath() ...@@ -272,14 +297,14 @@ wxString FindKicadHelpPath()
bool PathFound = false; bool PathFound = false;
/* find kicad/help/ */ /* find kicad/help/ */
tmp = wxGetApp().m_BinDir; tmp = wxGetApp().GetExecutablePath();
if( tmp.Last() == '/' ) if( tmp.Last() == '/' )
tmp.RemoveLast(); tmp.RemoveLast();
FullPath = tmp.BeforeLast( '/' ); // cd .. FullPath = tmp.BeforeLast( '/' ); // cd ..
FullPath += wxT( "/doc/help/" ); FullPath += wxT( "/doc/help/" );
LocaleString = wxGetApp().m_Locale->GetCanonicalName(); LocaleString = wxGetApp().GetLocale()->GetCanonicalName();
wxString path_tmp = FullPath; wxString path_tmp = FullPath;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -292,9 +317,9 @@ wxString FindKicadHelpPath() ...@@ -292,9 +317,9 @@ wxString FindKicadHelpPath()
} }
/* find kicad/help/ from environment variable KICAD */ /* 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 ) ) if( wxDirExists( FullPath ) )
PathFound = true; PathFound = true;
...@@ -352,7 +377,7 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -352,7 +377,7 @@ wxString FindKicadFile( const wxString& shortname )
/* Test the presence of the file in the directory shortname of /* Test the presence of the file in the directory shortname of
* the KiCad binary path. * the KiCad binary path.
*/ */
FullFileName = wxGetApp().m_BinDir + shortname; FullFileName = wxGetApp().GetExecutablePath() + shortname;
if( wxFileExists( FullFileName ) ) if( wxFileExists( FullFileName ) )
return FullFileName; return FullFileName;
...@@ -360,9 +385,9 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -360,9 +385,9 @@ wxString FindKicadFile( const wxString& shortname )
/* Test the presence of the file in the directory shortname /* Test the presence of the file in the directory shortname
* defined by the environment variable KiCad. * 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 ) ) if( wxFileExists( FullFileName ) )
return FullFileName; return FullFileName;
...@@ -416,22 +441,21 @@ wxString ReturnKicadDatasPath() ...@@ -416,22 +441,21 @@ wxString ReturnKicadDatasPath()
bool PathFound = false; bool PathFound = false;
wxString data_path; 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; PathFound = true;
} }
else // Path of executables. else // Path of executables.
{ {
wxString tmp = wxGetApp().m_BinDir; wxString tmp = wxGetApp().GetExecutablePath();
#ifdef __WINDOWS__ #ifdef __WINDOWS__
tmp.MakeLower(); tmp.MakeLower();
#endif #endif
if( tmp.Contains( wxT( "kicad" ) ) ) if( tmp.Contains( wxT( "kicad" ) ) )
{ {
#ifdef __WINDOWS__ #ifdef __WINDOWS__
tmp = wxGetApp().m_BinDir; tmp = wxGetApp().GetExecutablePath();
#endif #endif
if( tmp.Last() == '/' ) if( tmp.Last() == '/' )
tmp.RemoveLast(); tmp.RemoveLast();
...@@ -523,7 +547,7 @@ wxString& EDA_APP::GetEditorName() ...@@ -523,7 +547,7 @@ wxString& EDA_APP::GetEditorName()
if( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
{ {
m_EditorName = editorname; m_EditorName = editorname;
m_EDA_CommonConfig->Write( wxT( "Editor" ), m_EditorName ); m_commonSettings->Write( wxT( "Editor" ), m_EditorName );
} }
return m_EditorName; return m_EditorName;
...@@ -539,10 +563,10 @@ bool OpenPDF( const wxString& file ) ...@@ -539,10 +563,10 @@ bool OpenPDF( const wxString& file )
wxGetApp().ReadPdfBrowserInfos(); wxGetApp().ReadPdfBrowserInfos();
if( !wxGetApp().m_PdfBrowserIsDefault ) // Run the preferred PDF Browser if( !wxGetApp().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
{ {
AddDelimiterString( filename ); AddDelimiterString( filename );
command = wxGetApp().m_PdfBrowser + wxT( " " ) + filename; command = wxGetApp().GetPdfBrowserFileName() + wxT( " " ) + filename;
} }
else else
{ {
...@@ -554,13 +578,15 @@ bool OpenPDF( const wxString& file ) ...@@ -554,13 +578,15 @@ bool OpenPDF( const wxString& file )
success = filetype->GetOpenCommand( &command, params ); success = filetype->GetOpenCommand( &command, params );
delete filetype; delete filetype;
#ifndef __WINDOWS__ #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. // it does not exist.
if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround
success = false; success = false;
#endif #endif
if( success && !command.IsEmpty() ) if( success && !command.IsEmpty() )
{ {
success = ProcessExecute( command ); success = ProcessExecute( command );
...@@ -576,6 +602,7 @@ bool OpenPDF( const wxString& file ) ...@@ -576,6 +602,7 @@ bool OpenPDF( const wxString& file )
{ {
#ifndef __WINDOWS__ #ifndef __WINDOWS__
AddDelimiterString( filename ); AddDelimiterString( filename );
/* here is a list of PDF viewers candidates */ /* here is a list of PDF viewers candidates */
const static wxString tries[] = const static wxString tries[] =
{ {
......
...@@ -30,10 +30,10 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, ...@@ -30,10 +30,10 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
wxString defaultFileName; wxString defaultFileName;
// Free old config file. // Free old config file.
if( m_ProjectConfig ) if( m_projectSettings )
{ {
delete m_ProjectConfig; delete m_projectSettings;
m_ProjectConfig = NULL; m_projectSettings = NULL;
} }
/* Check the file name does not a KiCad project extension. /* Check the file name does not a KiCad project extension.
...@@ -56,9 +56,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, ...@@ -56,9 +56,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
// Init local config filename // Init local config filename
if( ForceUseLocalConfig || fn.FileExists() ) if( ForceUseLocalConfig || fn.FileExists() )
{ {
m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString, m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString,
fn.GetFullPath(), wxEmptyString ); fn.GetFullPath(), wxEmptyString );
m_ProjectConfig->DontCreateOnDemand(); m_projectSettings->DontCreateOnDemand();
if( ForceUseLocalConfig ) if( ForceUseLocalConfig )
return true; return true;
...@@ -74,9 +74,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, ...@@ -74,9 +74,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
int version = -1; int version = -1;
int def_version = 0; int def_version = 0;
m_ProjectConfig->SetPath( GroupName ); m_projectSettings->SetPath( GroupName );
version = m_ProjectConfig->Read( wxT( "version" ), def_version ); version = m_projectSettings->Read( wxT( "version" ), def_version );
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
if( version > 0 ) if( version > 0 )
{ {
...@@ -84,7 +84,7 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, ...@@ -84,7 +84,7 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
} }
else else
{ {
delete m_ProjectConfig; // Version incorrect delete m_projectSettings; // Version incorrect
} }
} }
...@@ -102,9 +102,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName, ...@@ -102,9 +102,9 @@ bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
} }
// Create new project file using the default name. // Create new project file using the default name.
m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString, m_projectSettings = new wxFileConfig( wxEmptyString, wxEmptyString,
wxEmptyString, fn.GetFullPath() ); wxEmptyString, fn.GetFullPath() );
m_ProjectConfig->DontCreateOnDemand(); m_projectSettings->DontCreateOnDemand();
return false; return false;
} }
...@@ -122,30 +122,30 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, ...@@ -122,30 +122,30 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
/* Write time (especially to avoid bug wxFileConfig that writes the /* Write time (especially to avoid bug wxFileConfig that writes the
* wrong item if declaration [xx] in first line (If empty group) * 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(); msg = DateAndTime();
m_ProjectConfig->Write( wxT( "update" ), msg ); m_projectSettings->Write( wxT( "update" ), msg );
msg = GetAppName(); msg = GetAppName();
m_ProjectConfig->Write( wxT( "last_client" ), msg ); m_projectSettings->Write( wxT( "last_client" ), msg );
/* Save parameters */ /* Save parameters */
m_ProjectConfig->DeleteGroup( GroupName ); // Erase all data m_projectSettings->DeleteGroup( GroupName ); // Erase all data
m_ProjectConfig->Flush(); m_projectSettings->Flush();
m_ProjectConfig->SetPath( GroupName ); m_projectSettings->SetPath( GroupName );
m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION ); m_projectSettings->Write( wxT( "version" ), CONFIG_VERSION );
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
for( ; List != NULL && *List != NULL; List++ ) for( ; List != NULL && *List != NULL; List++ )
{ {
pt_cfg = *List; pt_cfg = *List;
if( pt_cfg->m_Group ) if( pt_cfg->m_Group )
m_ProjectConfig->SetPath( pt_cfg->m_Group ); m_projectSettings->SetPath( pt_cfg->m_Group );
else else
m_ProjectConfig->SetPath( GroupName ); m_projectSettings->SetPath( GroupName );
if( pt_cfg->m_Setup ) if( pt_cfg->m_Setup )
continue; continue;
...@@ -153,17 +153,17 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, ...@@ -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_Type == PARAM_COMMAND_ERASE ) // Erase all data
{ {
if( pt_cfg->m_Ident ) if( pt_cfg->m_Ident )
m_ProjectConfig->DeleteGroup( pt_cfg->m_Ident ); m_projectSettings->DeleteGroup( pt_cfg->m_Ident );
} }
else else
{ {
pt_cfg->SaveParam( m_ProjectConfig ); pt_cfg->SaveParam( m_projectSettings );
} }
} }
m_ProjectConfig->SetPath( UNIX_STRING_DIR_SEP ); m_projectSettings->SetPath( UNIX_STRING_DIR_SEP );
delete m_ProjectConfig; delete m_projectSettings;
m_ProjectConfig = NULL; m_projectSettings = NULL;
} }
...@@ -176,25 +176,25 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, ...@@ -176,25 +176,25 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
/* Write date ( surtout pour eviter bug de wxFileConfig /* Write date ( surtout pour eviter bug de wxFileConfig
* qui se trompe de rubrique si declaration [xx] en premiere ligne * qui se trompe de rubrique si declaration [xx] en premiere ligne
* (en fait si groupe vide) */ * (en fait si groupe vide) */
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
m_ProjectConfig->Write( wxT( "update" ), DateAndTime() ); m_projectSettings->Write( wxT( "update" ), DateAndTime() );
m_ProjectConfig->Write( wxT( "last_client" ), GetAppName() ); m_projectSettings->Write( wxT( "last_client" ), GetAppName() );
/* Save parameters */ /* Save parameters */
m_ProjectConfig->DeleteGroup( GroupName ); // Erase all data m_projectSettings->DeleteGroup( GroupName ); // Erase all data
m_ProjectConfig->Flush(); m_projectSettings->Flush();
m_ProjectConfig->SetPath( GroupName ); m_projectSettings->SetPath( GroupName );
m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION ); m_projectSettings->Write( wxT( "version" ), CONFIG_VERSION );
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
BOOST_FOREACH( const PARAM_CFG_BASE& param, params ) BOOST_FOREACH( const PARAM_CFG_BASE& param, params )
{ {
if( param.m_Group ) if( param.m_Group )
m_ProjectConfig->SetPath( param.m_Group ); m_projectSettings->SetPath( param.m_Group );
else else
m_ProjectConfig->SetPath( GroupName ); m_projectSettings->SetPath( GroupName );
if( param.m_Setup ) if( param.m_Setup )
continue; continue;
...@@ -202,23 +202,23 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, ...@@ -202,23 +202,23 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
if ( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data if ( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{ {
if( param.m_Ident ) if( param.m_Ident )
m_ProjectConfig->DeleteGroup( param.m_Ident ); m_projectSettings->DeleteGroup( param.m_Ident );
} }
else else
{ {
param.SaveParam( m_ProjectConfig ); param.SaveParam( m_projectSettings );
} }
} }
m_ProjectConfig->SetPath( UNIX_STRING_DIR_SEP ); m_projectSettings->SetPath( UNIX_STRING_DIR_SEP );
delete m_ProjectConfig; delete m_projectSettings;
m_ProjectConfig = NULL; m_projectSettings = NULL;
} }
/** /**
* Function SaveCurrentSetupValues * 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 * saved parameters are parameters that have the .m_Setup member set to true
* @param aList = array of PARAM_CFG_BASE pointers * @param aList = array of PARAM_CFG_BASE pointers
*/ */
...@@ -226,7 +226,7 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList ) ...@@ -226,7 +226,7 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
{ {
PARAM_CFG_BASE* pt_cfg; PARAM_CFG_BASE* pt_cfg;
if( m_EDA_Config == NULL ) if( m_settings == NULL )
return; return;
for( ; *aList != NULL; aList++ ) for( ; *aList != NULL; aList++ )
...@@ -238,11 +238,11 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** 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_Type == PARAM_COMMAND_ERASE ) // Erase all data
{ {
if( pt_cfg->m_Ident ) if( pt_cfg->m_Ident )
m_EDA_Config->DeleteGroup( pt_cfg->m_Ident ); m_settings->DeleteGroup( pt_cfg->m_Ident );
} }
else else
{ {
pt_cfg->SaveParam( m_EDA_Config ); pt_cfg->SaveParam( m_settings );
} }
} }
} }
...@@ -250,7 +250,7 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList ) ...@@ -250,7 +250,7 @@ void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List ) void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List )
{ {
if( m_EDA_Config == NULL ) if( m_settings == NULL )
return; return;
BOOST_FOREACH( const PARAM_CFG_BASE& param, List ) BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
...@@ -261,10 +261,12 @@ void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& 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_Type == PARAM_COMMAND_ERASE ) // Erase all data
{ {
if( param.m_Ident ) if( param.m_Ident )
m_EDA_Config->DeleteGroup( param.m_Ident ); m_settings->DeleteGroup( param.m_Ident );
} }
else else
param.SaveParam( m_EDA_Config ); {
param.SaveParam( m_settings );
}
} }
} }
...@@ -279,8 +281,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ...@@ -279,8 +281,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
ReCreatePrjConfig( local_config_filename, GroupName, false ); ReCreatePrjConfig( local_config_filename, GroupName, false );
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
timestamp = m_ProjectConfig->Read( wxT( "update" ) ); timestamp = m_projectSettings->Read( wxT( "update" ) );
if( Load_Only_if_New && ( !timestamp.IsEmpty() ) if( Load_Only_if_New && ( !timestamp.IsEmpty() )
&& (timestamp == m_CurrentOptionFileDateAndTime) ) && (timestamp == m_CurrentOptionFileDateAndTime) )
...@@ -307,18 +309,18 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ...@@ -307,18 +309,18 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
pt_cfg = *List; pt_cfg = *List;
if( pt_cfg->m_Group ) if( pt_cfg->m_Group )
m_ProjectConfig->SetPath( pt_cfg->m_Group ); m_projectSettings->SetPath( pt_cfg->m_Group );
else else
m_ProjectConfig->SetPath( GroupName ); m_projectSettings->SetPath( GroupName );
if( pt_cfg->m_Setup ) if( pt_cfg->m_Setup )
continue; continue;
pt_cfg->ReadParam( m_ProjectConfig ); pt_cfg->ReadParam( m_projectSettings );
} }
delete m_ProjectConfig; delete m_projectSettings;
m_ProjectConfig = NULL; m_projectSettings = NULL;
return true; return true;
} }
...@@ -333,8 +335,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ...@@ -333,8 +335,8 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
ReCreatePrjConfig( local_config_filename, GroupName, false ); ReCreatePrjConfig( local_config_filename, GroupName, false );
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR ); m_projectSettings->SetPath( wxCONFIG_PATH_SEPARATOR );
timestamp = m_ProjectConfig->Read( wxT( "update" ) ); timestamp = m_projectSettings->Read( wxT( "update" ) );
if( Load_Only_if_New && ( !timestamp.IsEmpty() ) if( Load_Only_if_New && ( !timestamp.IsEmpty() )
&& (timestamp == m_CurrentOptionFileDateAndTime) ) && (timestamp == m_CurrentOptionFileDateAndTime) )
...@@ -359,18 +361,18 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename, ...@@ -359,18 +361,18 @@ bool EDA_APP::ReadProjectConfig( const wxString& local_config_filename,
BOOST_FOREACH( const PARAM_CFG_BASE& param, params ) BOOST_FOREACH( const PARAM_CFG_BASE& param, params )
{ {
if( param.m_Group ) if( param.m_Group )
m_ProjectConfig->SetPath( param.m_Group ); m_projectSettings->SetPath( param.m_Group );
else else
m_ProjectConfig->SetPath( GroupName ); m_projectSettings->SetPath( GroupName );
if( param.m_Setup ) if( param.m_Setup )
continue; continue;
param.ReadParam( m_ProjectConfig ); param.ReadParam( m_projectSettings );
} }
delete m_ProjectConfig; delete m_projectSettings;
m_ProjectConfig = NULL; m_projectSettings = NULL;
return true; return true;
} }
...@@ -387,7 +389,7 @@ void EDA_APP::ReadCurrentSetupValues( PARAM_CFG_BASE** aList ) ...@@ -387,7 +389,7 @@ void EDA_APP::ReadCurrentSetupValues( PARAM_CFG_BASE** aList )
if( pt_cfg->m_Setup == false ) if( pt_cfg->m_Setup == false )
continue; 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 ) ...@@ -399,7 +401,7 @@ void EDA_APP::ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List )
if( param.m_Setup == false ) if( param.m_Setup == false )
continue; continue;
param.ReadParam( m_EDA_Config ); param.ReadParam( m_settings );
} }
} }
......
...@@ -185,7 +185,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) : ...@@ -185,7 +185,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
CVPCB_MAINFRAME::~CVPCB_MAINFRAME() CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().GetSettings();
if( config ) if( config )
{ {
...@@ -199,9 +199,9 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME() ...@@ -199,9 +199,9 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
void CVPCB_MAINFRAME::LoadSettings() 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(); EDA_BASE_FRAME::LoadSettings();
cfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true ); cfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
...@@ -212,9 +212,9 @@ void CVPCB_MAINFRAME::LoadSettings() ...@@ -212,9 +212,9 @@ void CVPCB_MAINFRAME::LoadSettings()
void CVPCB_MAINFRAME::SaveSettings() 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(); EDA_BASE_FRAME::SaveSettings();
cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen ); cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
...@@ -278,10 +278,10 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -278,10 +278,10 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
} }
// Close the help frame // Close the help frame
if( wxGetApp().m_HtmlCtrl ) if( wxGetApp().GetHtmlHelpController() )
{ {
if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active if( wxGetApp().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
wxGetApp().m_HtmlCtrl->GetFrame()->Close( true ); wxGetApp().GetHtmlHelpController()->GetFrame()->Close( true );
} }
if( m_NetlistFileName.IsOk() ) if( m_NetlistFileName.IsOk() )
......
...@@ -29,7 +29,7 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) : ...@@ -29,7 +29,7 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) :
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
m_Parent = parent; m_Parent = parent;
m_Config = wxGetApp().m_EDA_CommonConfig; m_Config = wxGetApp().GetCommonSettings();
Init( ); Init( );
title = _( "Project file: " ) + fn.GetFullPath(); title = _( "Project file: " ) + fn.GetFullPath();
......
/*
* 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 * @file cvpcb/menubar.cpp
* @brief (Re)Create the menubar for CvPcb * @brief (Re)Create the menubar for CvPcb
...@@ -49,11 +73,11 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() ...@@ -49,11 +73,11 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Add this menu to list menu managed by m_fileHistory // Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history // (the file history will be updated when adding/removing files in history
if( openRecentMenu ) if( openRecentMenu )
wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu );
openRecentMenu = new wxMenu(); openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().GetFileHistory().UseMenu( openRecentMenu );
wxGetApp().m_fileHistory.AddFilesToMenu(); wxGetApp().GetFileHistory().AddFilesToMenu();
AddMenuItem( filesMenu, openRecentMenu, -1, AddMenuItem( filesMenu, openRecentMenu, -1,
_( "Open &Recent" ), _( "Open &Recent" ),
_( "Open a recent opened netlist document" ), _( "Open a recent opened netlist document" ),
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
void CVPCB_MAINFRAME::ReCreateHToolbar() void CVPCB_MAINFRAME::ReCreateHToolbar()
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().GetSettings();
if( m_mainToolBar != NULL ) if( m_mainToolBar != NULL )
return; return;
......
...@@ -54,7 +54,7 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ) ...@@ -54,7 +54,7 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
void DIALOG_ANNOTATE::InitValues() void DIALOG_ANNOTATE::InitValues()
/*********************************/ /*********************************/
{ {
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
SetFocus(); // needed to close dialog by escape key SetFocus(); // needed to close dialog by escape key
if( m_Config ) if( m_Config )
{ {
......
...@@ -61,7 +61,7 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) : ...@@ -61,7 +61,7 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) :
DIALOG_SVG_PRINT_base( parent ) DIALOG_SVG_PRINT_base( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
} }
......
...@@ -111,7 +111,7 @@ static char s_ExportSeparator[] = ("\t;,."); ...@@ -111,7 +111,7 @@ static char s_ExportSeparator[] = ("\t;,.");
DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( EDA_DRAW_FRAME* parent ) : DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( EDA_DRAW_FRAME* parent ) :
DIALOG_BUILD_BOM_BASE( parent ) DIALOG_BUILD_BOM_BASE( parent )
{ {
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
wxASSERT( m_Config != NULL ); wxASSERT( m_Config != NULL );
m_Parent = parent; m_Parent = parent;
......
...@@ -53,7 +53,7 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* aSchFrame, ...@@ -53,7 +53,7 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* aSchFrame,
Init(); Init();
msg = _( "from " ) + wxGetApp().m_CurrentOptionFile; msg = _( "from " ) + wxGetApp().GetCurrentOptionFile();
SetTitle( msg ); SetTitle( msg );
if( GetSizer() ) if( GetSizer() )
......
...@@ -511,11 +511,11 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void ) ...@@ -511,11 +511,11 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
void SCH_EDIT_FRAME::LoadSettings() void SCH_EDIT_FRAME::LoadSettings()
{ {
wxASSERT( wxGetApp().m_EDA_Config != NULL ); wxASSERT( wxGetApp().GetSettings() != NULL );
long tmp; long tmp;
wxConfig* cfg = wxGetApp().m_EDA_Config; wxConfig* cfg = wxGetApp().GetSettings();
EDA_DRAW_FRAME::LoadSettings(); EDA_DRAW_FRAME::LoadSettings();
...@@ -607,9 +607,9 @@ void SCH_EDIT_FRAME::LoadSettings() ...@@ -607,9 +607,9 @@ void SCH_EDIT_FRAME::LoadSettings()
void SCH_EDIT_FRAME::SaveSettings() 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(); EDA_DRAW_FRAME::SaveSettings();
......
...@@ -291,8 +291,8 @@ void LIB_EDIT_FRAME::LoadSettings() ...@@ -291,8 +291,8 @@ void LIB_EDIT_FRAME::LoadSettings()
EDA_DRAW_FRAME::LoadSettings(); EDA_DRAW_FRAME::LoadSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().m_EDA_Config; cfg = wxGetApp().GetSettings();
m_lastLibExportPath = cfg->Read( lastLibExportPathEntry, ::wxGetCwd() ); m_lastLibExportPath = cfg->Read( lastLibExportPathEntry, ::wxGetCwd() );
m_lastLibImportPath = cfg->Read( lastLibImportPathEntry, ::wxGetCwd() ); m_lastLibImportPath = cfg->Read( lastLibImportPathEntry, ::wxGetCwd() );
...@@ -312,8 +312,8 @@ void LIB_EDIT_FRAME::SaveSettings() ...@@ -312,8 +312,8 @@ void LIB_EDIT_FRAME::SaveSettings()
EDA_DRAW_FRAME::SaveSettings(); EDA_DRAW_FRAME::SaveSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().m_EDA_Config; cfg = wxGetApp().GetSettings();
cfg->Write( lastLibExportPathEntry, m_lastLibExportPath ); cfg->Write( lastLibExportPathEntry, m_lastLibExportPath );
cfg->Write( lastLibImportPathEntry, m_lastLibImportPath ); cfg->Write( lastLibImportPathEntry, m_lastLibImportPath );
......
...@@ -86,11 +86,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() ...@@ -86,11 +86,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Add this menu to list menu managed by m_fileHistory // Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history // (the file history will be updated when adding/removing files in history
if( openRecentMenu ) if( openRecentMenu )
wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu );
openRecentMenu = new wxMenu(); openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().GetFileHistory().UseMenu( openRecentMenu );
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); wxGetApp().GetFileHistory().AddFilesToMenu( openRecentMenu );
AddMenuItem( fileMenu, openRecentMenu, AddMenuItem( fileMenu, openRecentMenu,
wxID_ANY, _( "Open &Recent" ), wxID_ANY, _( "Open &Recent" ),
_( "Open a recent opened schematic project" ), _( "Open a recent opened schematic project" ),
......
/*
* 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 <stambaughw@verizon.net>
* 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 * @file netlist_control.cpp
* @brief Dialog box for creating netlists. * @brief Dialog box for creating netlists.
...@@ -58,8 +83,8 @@ wxString ReturnUserNetlistTypeName( bool first_item ) ...@@ -58,8 +83,8 @@ wxString ReturnUserNetlistTypeName( bool first_item )
msg = CUSTOM_NETLIST_TITLE; msg = CUSTOM_NETLIST_TITLE;
msg << index + 1; msg << index + 1;
if( wxGetApp().m_EDA_Config ) if( wxGetApp().GetSettings() )
name = wxGetApp().m_EDA_Config->Read( msg ); name = wxGetApp().GetSettings()->Read( msg );
return name; return name;
} }
...@@ -332,7 +357,7 @@ void NETLIST_DIALOG::InstallCustomPages() ...@@ -332,7 +357,7 @@ void NETLIST_DIALOG::InstallCustomPages()
msg = CUSTOM_NETLIST_COMMAND; msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; msg << ii + 1;
wxString Command = wxGetApp().m_EDA_Config->Read( msg ); wxString Command = wxGetApp().GetSettings()->Read( msg );
CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage, CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
-1, _( "Netlist command:" ) ), 0, -1, _( "Netlist command:" ) ), 0,
...@@ -372,7 +397,7 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event ) ...@@ -372,7 +397,7 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
wxString FullFileName, Mask, Path; wxString FullFileName, Mask, Path;
Mask = wxT( "*" ); Mask = wxT( "*" );
Path = wxGetApp().m_BinDir; Path = wxGetApp().GetExecutablePath();
FullFileName = EDA_FileSelector( _( "Plugin files:" ), FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path, Path,
FullFileName, FullFileName,
...@@ -650,7 +675,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) ...@@ -650,7 +675,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
{ {
wxString msg, Command; wxString msg, Command;
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().GetSettings();
NetlistUpdateOpt(); NetlistUpdateOpt();
......
...@@ -513,8 +513,8 @@ void LIB_VIEW_FRAME::LoadSettings( ) ...@@ -513,8 +513,8 @@ void LIB_VIEW_FRAME::LoadSettings( )
EDA_DRAW_FRAME::LoadSettings(); EDA_DRAW_FRAME::LoadSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().m_EDA_Config; cfg = wxGetApp().GetSettings();
m_LibListSize.x = 150; // default width of libs list m_LibListSize.x = 150; // default width of libs list
m_CmpListSize.x = 150; // default width of component list m_CmpListSize.x = 150; // default width of component list
...@@ -537,8 +537,8 @@ void LIB_VIEW_FRAME::SaveSettings() ...@@ -537,8 +537,8 @@ void LIB_VIEW_FRAME::SaveSettings()
EDA_DRAW_FRAME::SaveSettings(); EDA_DRAW_FRAME::SaveSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().m_EDA_Config; cfg = wxGetApp().GetSettings();
if ( m_LibListSize.x ) if ( m_LibListSize.x )
cfg->Write( LIBLIST_WIDTH_KEY, m_LibListSize.x ); cfg->Write( LIBLIST_WIDTH_KEY, m_LibListSize.x );
......
...@@ -110,7 +110,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent ) ...@@ -110,7 +110,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent )
/*************************************************************************************/ /*************************************************************************************/
{ {
m_Parent = parent; m_Parent = parent;
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
InitValues( ); InitValues( );
......
...@@ -200,7 +200,7 @@ double GERBVIEW_FRAME::BestZoom() ...@@ -200,7 +200,7 @@ double GERBVIEW_FRAME::BestZoom()
void GERBVIEW_FRAME::LoadSettings() void GERBVIEW_FRAME::LoadSettings()
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().GetSettings();
if( config == NULL ) if( config == NULL )
return; return;
...@@ -245,7 +245,7 @@ void GERBVIEW_FRAME::LoadSettings() ...@@ -245,7 +245,7 @@ void GERBVIEW_FRAME::LoadSettings()
void GERBVIEW_FRAME::SaveSettings() void GERBVIEW_FRAME::SaveSettings()
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().GetSettings();
if( config == NULL ) if( config == NULL )
return; return;
......
...@@ -82,11 +82,11 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void ) ...@@ -82,11 +82,11 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void )
// Add this menu to list menu managed by m_fileHistory // Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history // (the file history will be updated when adding/removing files in history
if( openRecentGbrMenu ) if( openRecentGbrMenu )
wxGetApp().m_fileHistory.RemoveMenu( openRecentGbrMenu ); wxGetApp().GetFileHistory().RemoveMenu( openRecentGbrMenu );
openRecentGbrMenu = new wxMenu(); openRecentGbrMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentGbrMenu ); wxGetApp().GetFileHistory().UseMenu( openRecentGbrMenu );
wxGetApp().m_fileHistory.AddFilesToMenu(); wxGetApp().GetFileHistory().AddFilesToMenu();
AddMenuItem( fileMenu, openRecentGbrMenu, AddMenuItem( fileMenu, openRecentGbrMenu,
wxID_ANY, wxID_ANY,
_( "Open &Recent Gerber File" ), _( "Open &Recent Gerber File" ),
......
...@@ -283,7 +283,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event ) ...@@ -283,7 +283,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
*/ */
void LAYERS_MAP_DIALOG::OnStoreSetup( 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 ); config->Write( wxT("BrdLayersCount"), m_itemsCount );
wxString key; wxString key;
...@@ -296,7 +296,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event ) ...@@ -296,7 +296,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
void LAYERS_MAP_DIALOG::OnGetSetup( 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 ); config->Read( wxT("BrdLayersCount"), &m_exportBoardCopperLayersCount );
normalizeBrdLayersCount(); normalizeBrdLayersCount();
......
/*
* 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 <stambaughw@verizon.net>
* 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 * @file appl_wxstruct.h
* @brief Base class implementation for all KiCad applications. * @brief Base class implementation for all KiCad applications.
...@@ -34,43 +59,55 @@ class wxHtmlHelpController; ...@@ -34,43 +59,55 @@ class wxHtmlHelpController;
*/ */
class EDA_APP : public wxApp class EDA_APP : public wxApp
{ {
public: protected:
EDA_APP_T m_Id; /* Used mainly to handle default paths libs /// Used mainly to handle default paths libs m_Id = APP_EESCHEMA_T, APP_PCBNEW_T ...
* m_Id = APP_EESCHEMA_T, APP_PCBNEW_T ... */ EDA_APP_T m_Id;
wxString m_Project;
/// Used to prevent multiple instances of an application from being run at the same time.
wxSingleInstanceChecker* m_Checker; wxSingleInstanceChecker* m_Checker;
wxPoint m_HelpPos; wxString m_Project;
wxSize m_HelpSize;
wxHtmlHelpController* m_HtmlCtrl; /// The application specific configuration settings.
wxConfig* m_EDA_Config; wxConfig* m_settings;
wxConfig* m_EDA_CommonConfig;
wxFileConfig* m_ProjectConfig; /// The configuration settings common to all KiCad applications.
wxString m_HelpFileName; wxConfig* m_commonSettings;
wxString m_EditorName;
wxString m_CurrentOptionFile; /// The current project specific settings.
wxString m_CurrentOptionFileDateAndTime; wxFileConfig* m_projectSettings;
/// KiCad executable path.
wxString m_BinDir;
wxString m_BinDir; /* KiCad executable path.*/ /// The KICAD system environment variable.
wxString m_KicadEnv; /* environment variable KICAD */ wxString m_KicadEnv;
bool m_Env_Defined; // true if environment KICAD is defined.
/// 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;
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; wxPathList m_searchPaths;
wxFileHistory m_fileHistory; wxFileHistory m_fileHistory;
wxString m_HelpFileName;
protected: wxString m_EditorName;
wxString m_CurrentOptionFile;
wxString m_CurrentOptionFileDateAndTime;
wxPoint m_HelpPos;
wxSize m_HelpSize;
wxHtmlHelpController* m_HtmlCtrl;
wxString m_Title; wxString m_Title;
wxPathList m_libSearchPaths; wxPathList m_libSearchPaths;
wxFileName m_projectFileName; wxFileName m_projectFileName;
wxString m_LastVisitedLibPath; wxString m_LastVisitedLibPath;
public: EDA_APP(); public:
EDA_APP();
~EDA_APP(); ~EDA_APP();
/** /**
...@@ -80,6 +117,40 @@ public: EDA_APP(); ...@@ -80,6 +117,40 @@ public: EDA_APP();
*/ */
bool OnInit(); 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 * Function SetBinDir
* finds the path to the executable and store it in EDA_APP::m_BinDir * finds the path to the executable and store it in EDA_APP::m_BinDir
...@@ -183,7 +254,7 @@ public: EDA_APP(); ...@@ -183,7 +254,7 @@ public: EDA_APP();
/** /**
* Function SaveCurrentSetupValues * 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 * saved parameters are parameters that have the .m_Setup member set to
* true * true
* @param aList = array of PARAM_CFG_BASE pointers * @param aList = array of PARAM_CFG_BASE pointers
...@@ -193,7 +264,7 @@ public: EDA_APP(); ...@@ -193,7 +264,7 @@ public: EDA_APP();
/** /**
* Function ReadCurrentSetupValues * 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 * saved parameters are parameters that have the .m_Setup member set to
* true * true
* @param aList = array of PARAM_CFG_BASE pointers * @param aList = array of PARAM_CFG_BASE pointers
......
...@@ -142,12 +142,12 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -142,12 +142,12 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
SaveSettings(); SaveSettings();
// Close the help frame // Close the help frame
if( wxGetApp().m_HtmlCtrl ) if( wxGetApp().GetHtmlHelpController() )
{ {
if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active if( wxGetApp().GetHtmlHelpController()->GetFrame() ) // returns NULL if no help frame active
wxGetApp().m_HtmlCtrl->GetFrame()->Close( true ); wxGetApp().GetHtmlHelpController()->GetFrame()->Close( true );
wxGetApp().m_HtmlCtrl = NULL; wxGetApp().SetHtmlHelpController( NULL );
} }
m_LeftWin->Show( false ); m_LeftWin->Show( false );
...@@ -258,9 +258,9 @@ void KICAD_MANAGER_FRAME::ClearMsg() ...@@ -258,9 +258,9 @@ void KICAD_MANAGER_FRAME::ClearMsg()
void KICAD_MANAGER_FRAME::LoadSettings() 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(); EDA_BASE_FRAME::LoadSettings();
cfg->Read( TreeFrameWidthEntry, &m_LeftWin_Width ); cfg->Read( TreeFrameWidthEntry, &m_LeftWin_Width );
...@@ -269,9 +269,9 @@ void KICAD_MANAGER_FRAME::LoadSettings() ...@@ -269,9 +269,9 @@ void KICAD_MANAGER_FRAME::LoadSettings()
void KICAD_MANAGER_FRAME::SaveSettings() 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(); EDA_BASE_FRAME::SaveSettings();
......
...@@ -121,11 +121,11 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() ...@@ -121,11 +121,11 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
// Add this menu to list menu managed by m_fileHistory // Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history // (the file history will be updated when adding/removing files in history
if( openRecentMenu ) if( openRecentMenu )
wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu );
openRecentMenu = new wxMenu(); openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().GetFileHistory().UseMenu( openRecentMenu );
wxGetApp().m_fileHistory.AddFilesToMenu( ); wxGetApp().GetFileHistory().AddFilesToMenu( );
AddMenuItem( fileMenu, openRecentMenu, AddMenuItem( fileMenu, openRecentMenu,
wxID_ANY, wxID_ANY,
_( "Open &Recent" ), _( "Open &Recent" ),
...@@ -211,7 +211,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() ...@@ -211,7 +211,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
SubMenuPdfBrowserChoice->Append( item ); SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER, SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
wxGetApp().m_PdfBrowserIsDefault ); wxGetApp().UseSystemPdfBrowser() );
// Favourite // Favourite
item = new wxMenuItem( SubMenuPdfBrowserChoice, item = new wxMenuItem( SubMenuPdfBrowserChoice,
...@@ -225,7 +225,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() ...@@ -225,7 +225,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
SubMenuPdfBrowserChoice->Append( item ); SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->AppendSeparator(); SubMenuPdfBrowserChoice->AppendSeparator();
SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER, SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!wxGetApp().m_PdfBrowserIsDefault ); !wxGetApp().UseSystemPdfBrowser() );
// Append PDF Viewer submenu to preferences // Append PDF Viewer submenu to preferences
AddMenuItem( SubMenuPdfBrowserChoice, AddMenuItem( SubMenuPdfBrowserChoice,
......
/*******************/ /*
/* 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 <stambaughw@verizon.net>
* 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__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -18,20 +43,19 @@ ...@@ -18,20 +43,19 @@
void KICAD_MANAGER_FRAME::OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event ) void KICAD_MANAGER_FRAME::OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event )
{ {
event.Check( wxGetApp().m_PdfBrowserIsDefault ); event.Check( wxGetApp().UseSystemPdfBrowser() );
} }
void KICAD_MANAGER_FRAME::OnSelectDefaultPdfBrowser( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnSelectDefaultPdfBrowser( wxCommandEvent& event )
{ {
wxGetApp().m_PdfBrowserIsDefault = true;
wxGetApp().WritePdfBrowserInfos(); wxGetApp().WritePdfBrowserInfos();
} }
void KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event ) 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 ) ...@@ -39,7 +63,7 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
{ {
bool select = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME; bool select = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME;
if( !wxGetApp().m_PdfBrowser && !select ) if( !wxGetApp().GetPdfBrowserFileName() && !select )
{ {
DisplayError( this, DisplayError( this,
_( "You must choose a PDF viewer before using this option." ) ); _( "You must choose a PDF viewer before using this option." ) );
...@@ -54,7 +78,7 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event ) ...@@ -54,7 +78,7 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
wildcard = _( "Executable files (" ) + wildcard + wxT( ")|" ) + wildcard; wildcard = _( "Executable files (" ) + wildcard + wxT( ")|" ) + wildcard;
wxGetApp().ReadPdfBrowserInfos(); wxGetApp().ReadPdfBrowserInfos();
wxFileName fn = wxGetApp().m_PdfBrowser; wxFileName fn = wxGetApp().GetPdfBrowserFileName();
wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(), wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(),
fn.GetFullName(), wildcard, fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
...@@ -62,11 +86,11 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event ) ...@@ -62,11 +86,11 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
wxGetApp().m_PdfBrowser = dlg.GetPath(); wxGetApp().SetPdfBrowserFileName( dlg.GetPath() );
wxGetApp().m_PdfBrowserIsDefault = wxGetApp().m_PdfBrowser.IsEmpty();
wxGetApp().WritePdfBrowserInfos(); wxGetApp().WritePdfBrowserInfos();
} }
void KICAD_MANAGER_FRAME::SetLanguage( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::SetLanguage( wxCommandEvent& event )
{ {
EDA_BASE_FRAME::SetLanguage( event ); EDA_BASE_FRAME::SetLanguage( event );
......
...@@ -522,9 +522,9 @@ void PCB_BASE_FRAME::unitsChangeRefresh() ...@@ -522,9 +522,9 @@ void PCB_BASE_FRAME::unitsChangeRefresh()
void PCB_BASE_FRAME::LoadSettings() 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(); EDA_DRAW_FRAME::LoadSettings();
...@@ -566,9 +566,9 @@ void PCB_BASE_FRAME::LoadSettings() ...@@ -566,9 +566,9 @@ void PCB_BASE_FRAME::LoadSettings()
void PCB_BASE_FRAME::SaveSettings() 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(); EDA_DRAW_FRAME::SaveSettings();
cfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x ); cfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x );
......
...@@ -52,8 +52,8 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) : ...@@ -52,8 +52,8 @@ DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) :
DIALOG_SVG_PRINT_base( parent ) DIALOG_SVG_PRINT_base( parent )
{ {
m_Parent = (PCB_BASE_FRAME*) parent; m_Parent = (PCB_BASE_FRAME*) parent;
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
initDialog( ); initDialog();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();
m_buttonBoard->SetDefault(); m_buttonBoard->SetDefault();
......
...@@ -34,7 +34,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_EDIT_FRAME* parent, ZONE_SETTING* zo ...@@ -34,7 +34,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_EDIT_FRAME* parent, ZONE_SETTING* zo
DIALOG_COPPER_ZONE_BASE( parent ) DIALOG_COPPER_ZONE_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
m_Zone_Setting = zone_setting; m_Zone_Setting = zone_setting;
m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
m_OnExitCode = ZONE_ABORT; m_OnExitCode = ZONE_ABORT;
......
...@@ -54,7 +54,8 @@ void DIALOG_FREEROUTE::MyInit() ...@@ -54,7 +54,8 @@ void DIALOG_FREEROUTE::MyInit()
m_FreeRouteSetupChanged = false; m_FreeRouteSetupChanged = false;
wxString msg; wxString msg;
wxGetApp().m_EDA_Config->Read( FREEROUTE_URL_KEY, &msg ); wxGetApp().GetSettings()->Read( FREEROUTE_URL_KEY, &msg );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) ); m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) );
else else
...@@ -140,8 +141,8 @@ void DIALOG_FREEROUTE::OnOKButtonClick( wxCommandEvent& event ) ...@@ -140,8 +141,8 @@ void DIALOG_FREEROUTE::OnOKButtonClick( wxCommandEvent& event )
{ {
if( m_FreeRouteSetupChanged ) // Save new config if( m_FreeRouteSetupChanged ) // Save new config
{ {
wxGetApp().m_EDA_Config->Write( FREEROUTE_URL_KEY, wxGetApp().GetSettings()->Write( FREEROUTE_URL_KEY,
m_FreerouteURLName->GetValue() ); m_FreerouteURLName->GetValue() );
} }
EndModal(wxID_OK); EndModal(wxID_OK);
......
...@@ -100,7 +100,7 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL() ...@@ -100,7 +100,7 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL()
void DIALOG_GENDRILL::initDialog() void DIALOG_GENDRILL::initDialog()
{ {
SetFocus(); // Under wxGTK: mandatory to close dialog by the ESC key SetFocus(); // Under wxGTK: mandatory to close dialog by the ESC key
wxConfig* Config = wxGetApp().m_EDA_Config; wxConfig* Config = wxGetApp().GetSettings();
if( Config ) if( Config )
{ {
...@@ -234,7 +234,7 @@ void DIALOG_GENDRILL::UpdateConfig() ...@@ -234,7 +234,7 @@ void DIALOG_GENDRILL::UpdateConfig()
{ {
SetParams(); SetParams();
wxConfig* Config = wxGetApp().m_EDA_Config; wxConfig* Config = wxGetApp().GetSettings();
if( Config ) if( Config )
{ {
......
...@@ -21,9 +21,7 @@ ...@@ -21,9 +21,7 @@
#include "dialog_pcbnew_config_libs_and_paths.h" #include "dialog_pcbnew_config_libs_and_paths.h"
/*****************************************************************/
void PCB_EDIT_FRAME::InstallConfigFrame( ) void PCB_EDIT_FRAME::InstallConfigFrame( )
/*****************************************************************/
{ {
DIALOG_PCBNEW_CONFIG_LIBS dialog( this ); DIALOG_PCBNEW_CONFIG_LIBS dialog( this );
dialog.ShowModal(); dialog.ShowModal();
...@@ -33,11 +31,11 @@ void PCB_EDIT_FRAME::InstallConfigFrame( ) ...@@ -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::DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME* parent ):
DIALOG_PCBNEW_CONFIG_LIBS_FBP(parent) DIALOG_PCBNEW_CONFIG_LIBS_FBP(parent)
{ {
m_Config = wxGetApp().m_EDA_CommonConfig; m_Config = wxGetApp().GetCommonSettings();
Init( ); Init( );
wxString title = _( "from " ) + wxGetApp().m_CurrentOptionFile; wxString title = _( "from " ) + wxGetApp().GetCurrentOptionFile();
SetTitle( title ); SetTitle( title );
m_sdbSizer1OK->SetDefault(); m_sdbSizer1OK->SetDefault();
......
...@@ -85,7 +85,7 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( EDA_DRAW_FRAME* parent ) : ...@@ -85,7 +85,7 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( EDA_DRAW_FRAME* parent ) :
{ {
m_Parent = parent; m_Parent = parent;
s_Parameters.m_ForceCentered = true; s_Parameters.m_ForceCentered = true;
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
InitValues(); InitValues();
m_buttonPrint->SetDefault(); m_buttonPrint->SetDefault();
......
...@@ -120,7 +120,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent ) ...@@ -120,7 +120,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
/*************************************************************************************/ /*************************************************************************************/
{ {
m_Parent = parent; m_Parent = parent;
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
InitValues( ); InitValues( );
......
...@@ -1066,7 +1066,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1066,7 +1066,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: 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 ); cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() ); GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() );
} }
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
DIALOG_EXPORT_3DFILE_BASE( parent ) DIALOG_EXPORT_3DFILE_BASE( parent )
{ {
m_parent = parent; m_parent = parent;
m_config = wxGetApp().m_EDA_Config; m_config = wxGetApp().GetSettings();
SetFocus(); SetFocus();
m_config->Read( OPTKEY_OUTPUT_UNIT, &m_unitsOpt ); m_config->Read( OPTKEY_OUTPUT_UNIT, &m_unitsOpt );
m_config->Read( OPTKEY_3DFILES_OPT, &m_3DFilesOpt ); m_config->Read( OPTKEY_3DFILES_OPT, &m_3DFilesOpt );
......
...@@ -51,7 +51,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() ...@@ -51,7 +51,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
bool Footprint_Is_GPCB_Format = false; bool Footprint_Is_GPCB_Format = false;
wxString LastOpenedPathForLoading; wxString LastOpenedPathForLoading;
wxConfig* Config = wxGetApp().m_EDA_Config; wxConfig* Config = wxGetApp().GetSettings();
if( Config ) if( Config )
Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading ); Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading );
...@@ -145,7 +145,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib ) ...@@ -145,7 +145,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule, bool aCreateSysLib )
wxFileName fn; wxFileName fn;
FILE* file; FILE* file;
wxString msg, path, title, wildcard; wxString msg, path, title, wildcard;
wxConfig* Config = wxGetApp().m_EDA_Config; wxConfig* Config = wxGetApp().GetSettings();
if( aModule == NULL ) if( aModule == NULL )
return; return;
......
...@@ -78,11 +78,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -78,11 +78,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
// Add this menu to list menu managed by m_fileHistory // Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history // (the file history will be updated when adding/removing files in history
if( openRecentMenu ) if( openRecentMenu )
wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu ); wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu );
openRecentMenu = new wxMenu(); openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.UseMenu( openRecentMenu ); wxGetApp().GetFileHistory().UseMenu( openRecentMenu );
wxGetApp().m_fileHistory.AddFilesToMenu(); wxGetApp().GetFileHistory().AddFilesToMenu();
AddMenuItem( filesMenu, openRecentMenu, AddMenuItem( filesMenu, openRecentMenu,
-1, _( "Open &Recent" ), -1, _( "Open &Recent" ),
_( "Open a recent opened board" ), _( "Open a recent opened board" ),
......
...@@ -544,7 +544,7 @@ void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event ) ...@@ -544,7 +544,7 @@ void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event )
void PCB_EDIT_FRAME::LoadSettings() void PCB_EDIT_FRAME::LoadSettings()
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().GetSettings();
if( config == NULL ) if( config == NULL )
return; return;
...@@ -572,7 +572,7 @@ void PCB_EDIT_FRAME::LoadSettings() ...@@ -572,7 +572,7 @@ void PCB_EDIT_FRAME::LoadSettings()
void PCB_EDIT_FRAME::SaveSettings() void PCB_EDIT_FRAME::SaveSettings()
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().GetSettings();
if( config == NULL ) if( config == NULL )
return; return;
......
...@@ -91,7 +91,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) : ...@@ -91,7 +91,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) :
DIALOG_PLOT_BASE( parent ) DIALOG_PLOT_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_Config = wxGetApp().m_EDA_Config; m_Config = wxGetApp().GetSettings();
Init_Dialog(); Init_Dialog();
......
...@@ -479,10 +479,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -479,10 +479,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
zone->SetNetNameFromNetCode( ); zone->SetNetNameFromNetCode( );
} }
wxGetApp().m_EDA_Config->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
&g_Zone_Default_Setting.m_ThermalReliefGap ); &g_Zone_Default_Setting.m_ThermalReliefGap );
wxGetApp().m_EDA_Config->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
&g_Zone_Default_Setting.m_ThermalReliefCopperBridge ); &g_Zone_Default_Setting.m_ThermalReliefCopperBridge );
g_Zone_Default_Setting.m_CurrentZone_Layer = zone->GetLayer(); g_Zone_Default_Setting.m_CurrentZone_Layer = zone->GetLayer();
DIALOG_COPPER_ZONE* frame = new DIALOG_COPPER_ZONE( this, &g_Zone_Default_Setting ); DIALOG_COPPER_ZONE* frame = new DIALOG_COPPER_ZONE( this, &g_Zone_Default_Setting );
......
...@@ -152,10 +152,10 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event ) ...@@ -152,10 +152,10 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
break; break;
} }
if( wxGetApp().m_EDA_Config ) if( wxGetApp().GetSettings() )
{ {
wxGetApp().m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, wxGetApp().GetSettings()->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) g_Zone_Default_Setting.m_Zone_HatchingStyle ); (long) g_Zone_Default_Setting.m_Zone_HatchingStyle );
} }
if( m_OrientEdgesOpt->GetSelection() == 0 ) if( m_OrientEdgesOpt->GetSelection() == 0 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment