diff --git a/include/pgm_base.h b/include/pgm_base.h index 0c6d6c3676..fae237ad5d 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -364,9 +364,7 @@ protected: }; -#if !defined(PGM_KICAD_H_) // PGM_KICAD has an alternate /// The global Program "get" accessor. extern PGM_BASE& Pgm(); -#endif #endif // PGM_BASE_H_ diff --git a/kicad/files-io.cpp b/kicad/files-io.cpp index 40f85b8ab4..1ec505c309 100644 --- a/kicad/files-io.cpp +++ b/kicad/files-io.cpp @@ -47,7 +47,7 @@ void KICAD_MANAGER_FRAME::OnFileHistory( wxCommandEvent& event ) { wxString fn = GetFileFromHistory( event.GetId(), - _( "KiCad project file" ), &Pgm().GetFileHistory() ); + _( "KiCad project file" ), &PgmTop().GetFileHistory() ); if( fn.size() ) { diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index 90ca2fbe7e..777d9ddaec 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -58,7 +58,14 @@ KIFACE_I& Kiface() static PGM_KICAD program; -PGM_KICAD& Pgm() + +PGM_BASE& Pgm() +{ + return program; +} + + +PGM_KICAD& PgmTop() { return program; } diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 938a9e02cb..a1d20dae34 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -119,7 +119,7 @@ KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME() wxConfigBase* KICAD_MANAGER_FRAME::config() { - wxConfigBase* ret = Pgm().PgmSettings(); + wxConfigBase* ret = PgmTop().PgmSettings(); wxASSERT( ret ); return ret; } @@ -181,13 +181,13 @@ void KICAD_MANAGER_FRAME::ReCreateTreePrj() const SEARCH_STACK& KICAD_MANAGER_FRAME::sys_search() { - return Pgm().SysSearch(); + return PgmTop().SysSearch(); } wxString KICAD_MANAGER_FRAME::help_name() { - return Pgm().GetHelpFileName(); + return PgmTop().GetHelpFileName(); } @@ -212,7 +212,7 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event ) { int px, py; - UpdateFileHistory( GetProjectFileName(), &Pgm().GetFileHistory() ); + UpdateFileHistory( GetProjectFileName(), &PgmTop().GetFileHistory() ); if( !IsIconized() ) // save main frame position and size { diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 8d7b72ecfe..1b17d2c737 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -201,7 +201,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() // Before deleting, remove the menus managed by m_fileHistory // (the file history will be updated when adding/removing files in history) if( openRecentMenu ) - Pgm().GetFileHistory().RemoveMenu( openRecentMenu ); + PgmTop().GetFileHistory().RemoveMenu( openRecentMenu ); // Delete all existing menus while( menuBar->GetMenuCount() ) @@ -220,8 +220,8 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() // File history openRecentMenu = new wxMenu(); - Pgm().GetFileHistory().UseMenu( openRecentMenu ); - Pgm().GetFileHistory().AddFilesToMenu( ); + PgmTop().GetFileHistory().UseMenu( openRecentMenu ); + PgmTop().GetFileHistory().AddFilesToMenu( ); AddMenuItem( fileMenu, openRecentMenu, wxID_ANY, _( "Open &Recent" ), diff --git a/kicad/pgm_kicad.h b/kicad/pgm_kicad.h index e7ff040eba..61990d9e9f 100644 --- a/kicad/pgm_kicad.h +++ b/kicad/pgm_kicad.h @@ -72,6 +72,7 @@ protected: }; -extern PGM_KICAD& Pgm(); +extern PGM_KICAD& PgmTop(); + #endif // PGM_KICAD_H_ diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index 5e1f3bc308..aec2ec597c 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -161,7 +161,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString& aPrjFullFileName, // Write settings to project file // was: wxGetApp().WriteProjectConfig( aPrjFullFileName, GeneralGroupName, s_KicadManagerParams ); - Prj().ConfigSave( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams ); + Prj().ConfigSave( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); // Ensure a "stub" for a schematic root sheet and a board exist. // It will avoid messages from the schematic editor or the board editor to create a new file @@ -324,7 +324,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) m_MessagesBox->Clear(); } - Prj().ConfigLoad( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams ); + Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename; @@ -336,7 +336,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) SetTitle( title ); if( !prj_filename.IsSameAs( nameless_prj ) ) - UpdateFileHistory( prj_filename, &Pgm().GetFileHistory() ); + UpdateFileHistory( prj_filename, &PgmTop().GetFileHistory() ); m_LeftWin->ReCreateTreePrj(); @@ -385,7 +385,7 @@ void KICAD_MANAGER_FRAME::OnSaveProject( wxCommandEvent& event ) // was: wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(), // GeneralGroupName, s_KicadManagerParams ); - Prj().ConfigSave( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams ); + Prj().ConfigSave( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); }