2011-12-16 20:12:49 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
/**
|
|
|
|
* @file appl_wxstruct.h
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief Base class implementation for all KiCad applications.
|
2011-09-06 14:09:40 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef APPL_WXSTRUCT_H
|
|
|
|
#define APPL_WXSTRUCT_H
|
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
/* Use wxFileHistory for most recently used file handling. */
|
|
|
|
#include <wx/docview.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
#include <wx/config.h>
|
2009-04-05 20:49:15 +00:00
|
|
|
#include <wx/filename.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <param_config.h>
|
2012-08-02 07:47:30 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
enum EDA_APP_T {
|
|
|
|
APP_UNKNOWN_T,
|
|
|
|
APP_EESCHEMA_T,
|
|
|
|
APP_PCBNEW_T,
|
|
|
|
APP_CVPCB_T,
|
|
|
|
APP_GERBVIEW_T,
|
|
|
|
APP_KICAD_T
|
2009-04-12 14:39:54 +00:00
|
|
|
};
|
2009-01-17 20:31:19 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
class wxConfigBase;
|
|
|
|
class wxFileConfig;
|
2009-02-04 15:25:03 +00:00
|
|
|
class wxSingleInstanceChecker;
|
|
|
|
class wxHtmlHelpController;
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
/**
|
|
|
|
* Class EDA_APP
|
2011-09-30 18:15:37 +00:00
|
|
|
* is the base class representing all of KiCad applications.
|
2011-09-06 14:09:40 +00:00
|
|
|
*/
|
|
|
|
class EDA_APP : public wxApp
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-08-02 07:47:30 +00:00
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
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.
|
2007-08-14 19:24:48 +00:00
|
|
|
wxSingleInstanceChecker* m_Checker;
|
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
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;
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
/// 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;
|
2009-11-23 20:18:47 +00:00
|
|
|
|
|
|
|
wxPathList m_searchPaths;
|
|
|
|
wxFileHistory m_fileHistory;
|
2011-12-16 20:12:49 +00:00
|
|
|
wxString m_HelpFileName;
|
|
|
|
wxString m_EditorName;
|
|
|
|
wxString m_CurrentOptionFile;
|
|
|
|
wxString m_CurrentOptionFileDateAndTime;
|
|
|
|
wxPoint m_HelpPos;
|
|
|
|
wxSize m_HelpSize;
|
|
|
|
wxHtmlHelpController* m_HtmlCtrl;
|
2009-11-23 20:18:47 +00:00
|
|
|
wxString m_Title;
|
|
|
|
wxPathList m_libSearchPaths;
|
|
|
|
wxFileName m_projectFileName;
|
|
|
|
wxString m_LastVisitedLibPath;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
public:
|
|
|
|
EDA_APP();
|
2011-09-06 14:09:40 +00:00
|
|
|
~EDA_APP();
|
2010-12-21 12:41:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnInit
|
|
|
|
* this is the first executed function (like main() )
|
2011-08-29 19:50:05 +00:00
|
|
|
* @return true if the application can be started.
|
2010-12-21 12:41:17 +00:00
|
|
|
*/
|
2012-08-01 11:54:20 +00:00
|
|
|
bool OnInit(); // should this be virtual
|
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
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; }
|
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function SetBinDir
|
2011-09-06 14:09:40 +00:00
|
|
|
* finds the path to the executable and store it in EDA_APP::m_BinDir
|
2011-08-29 19:50:05 +00:00
|
|
|
*
|
|
|
|
* @return TODO
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
bool SetBinDir();
|
2011-08-29 19:50:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetDefaultSearchPaths
|
|
|
|
* sets search paths for libraries, modules, internationalization files, etc.
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void SetDefaultSearchPaths( void );
|
2009-04-12 14:39:54 +00:00
|
|
|
|
2010-12-21 12:41:17 +00:00
|
|
|
/**
|
|
|
|
* Function MacOpenFile
|
|
|
|
* Specific to MacOSX. Not used under Linux or Windows
|
|
|
|
* MacOSX: Needed for file association
|
|
|
|
* http://wiki.wxwidgets.org/WxMac-specific_topics
|
|
|
|
*/
|
2010-01-16 19:42:58 +00:00
|
|
|
virtual void MacOpenFile(const wxString &fileName);
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function InitEDA_Appl
|
2009-11-23 20:18:47 +00:00
|
|
|
* initialize some general parameters
|
2009-04-14 16:45:22 +00:00
|
|
|
* - Default paths (help, libs, bin)and configuration files names
|
2009-04-12 14:39:54 +00:00
|
|
|
* - Language and locale
|
|
|
|
* - fonts
|
|
|
|
* @param aName : used as paths in configuration files
|
|
|
|
* @param aId = flag : LIBRARY_TYPE_EESCHEMA or LIBRARY_TYPE_PCBNEW
|
2009-11-23 20:18:47 +00:00
|
|
|
* used to choose what default library path must be used
|
2009-04-12 14:39:54 +00:00
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void InitEDA_Appl( const wxString& aName, EDA_APP_T aId = APP_UNKNOWN_T );
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function SetLanguage
|
|
|
|
* sets the dictionary file name for internationalization.
|
|
|
|
* <p>
|
|
|
|
* The files are in kicad/internat/xx or kicad/internat/xx_XX and are named kicad.mo
|
|
|
|
* </p>
|
|
|
|
* @param first_time must be set to true the first time this funct is
|
|
|
|
* called, false otherwise
|
|
|
|
* @return true if the language can be set (i.e. if the locale is available)
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
bool SetLanguage( bool first_time = false );
|
2009-01-18 10:15:10 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function AddMenuLanguageList
|
2011-08-29 19:50:05 +00:00
|
|
|
* creates a menu list for language choice, and add it as submenu to \a MasterMenu.
|
2009-04-05 20:49:15 +00:00
|
|
|
*
|
2011-08-29 19:50:05 +00:00
|
|
|
* @param MasterMenu The main menu. The sub menu list will be accessible from the menu
|
|
|
|
* item with id ID_LANGUAGE_CHOICE
|
2009-01-18 10:15:10 +00:00
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void AddMenuLanguageList( wxMenu* MasterMenu );
|
2011-08-29 19:50:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLanguageIdentifier
|
|
|
|
* sets in .m_LanguageId member the wxWidgets language identifier Id from
|
2011-09-30 18:15:37 +00:00
|
|
|
* the KiCad menu id (internal menu identifier).
|
2011-08-29 19:50:05 +00:00
|
|
|
*
|
2011-09-30 18:15:37 +00:00
|
|
|
* @param menu_id The KiCad menuitem id (returned by Menu Event, when
|
2011-08-29 19:50:05 +00:00
|
|
|
* clicking on a menu item)
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void SetLanguageIdentifier( int menu_id );
|
2011-08-29 19:50:05 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
void SetLanguagePath( void );
|
2011-08-29 19:50:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function InitOnLineHelp
|
2011-09-30 18:15:37 +00:00
|
|
|
* initializes KiCad's online help.
|
2011-08-29 19:50:05 +00:00
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void InitOnLineHelp();
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSettings
|
2011-08-29 19:50:05 +00:00
|
|
|
* gets the application settings.
|
|
|
|
* @param aReopenLastUsedDirectory True to switch to last opened directory, false
|
|
|
|
* to use current CWD
|
2009-07-03 07:32:48 +00:00
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void GetSettings( bool aReopenLastUsedDirectory );
|
2009-07-03 07:32:48 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function SaveSettings
|
|
|
|
* saves the application settings.
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void SaveSettings();
|
2009-04-12 14:39:54 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
/**
|
|
|
|
* Function WriteProjectConfig
|
2011-11-08 16:37:25 +00:00
|
|
|
* Save the current "project" parameters
|
2011-09-06 14:09:40 +00:00
|
|
|
* saved parameters are parameters that have the .m_Setup member set to false
|
|
|
|
* saving file is the .pro file project
|
|
|
|
*/
|
|
|
|
void WriteProjectConfig( const wxString& local_config_filename,
|
|
|
|
const wxString& GroupName,
|
|
|
|
PARAM_CFG_BASE** List );
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
void WriteProjectConfig( const wxString& fileName,
|
|
|
|
const wxString& GroupName,
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
const PARAM_CFG_ARRAY& params );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function SaveCurrentSetupValues
|
2011-12-31 05:44:00 +00:00
|
|
|
* saves the current setup values in m_settings.
|
|
|
|
* Saved parameters are parameters that have the .m_Setup member set to
|
|
|
|
* true.
|
2009-03-28 20:02:34 +00:00
|
|
|
* @param aList = array of PARAM_CFG_BASE pointers
|
2009-04-12 14:39:54 +00:00
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void SaveCurrentSetupValues( PARAM_CFG_BASE** aList );
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
void SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List );
|
2009-03-28 20:02:34 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function ReadCurrentSetupValues
|
2011-12-31 05:44:00 +00:00
|
|
|
* reads the current setup values previously saved, from m_settings.
|
|
|
|
* Saved parameters are parameters that have the .m_Setup member set to
|
|
|
|
* true.
|
2009-03-28 20:02:34 +00:00
|
|
|
* @param aList = array of PARAM_CFG_BASE pointers
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
void ReadCurrentSetupValues( const PARAM_CFG_ARRAY& List );
|
2011-09-06 14:09:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ReadProjectConfig
|
2011-11-08 16:37:25 +00:00
|
|
|
* Read the current "project" parameters
|
2011-09-06 14:09:40 +00:00
|
|
|
* Parameters are parameters that have the .m_Setup member set to false
|
|
|
|
* read file is the .pro file project
|
|
|
|
*
|
|
|
|
* if Load_Only_if_New == true, this file is read only if it differs from
|
|
|
|
* the current config (different dates )
|
|
|
|
*
|
|
|
|
* @return true if read.
|
|
|
|
* Also set:
|
|
|
|
* wxGetApp().m_CurrentOptionFileDateAndTime
|
|
|
|
* wxGetApp().m_CurrentOptionFile
|
|
|
|
*/
|
|
|
|
bool ReadProjectConfig( const wxString& local_config_filename,
|
|
|
|
const wxString& GroupName,
|
|
|
|
PARAM_CFG_BASE** List,
|
|
|
|
bool Load_Only_if_New );
|
|
|
|
bool ReadProjectConfig( const wxString& local_config_filename,
|
|
|
|
const wxString& GroupName,
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
const PARAM_CFG_ARRAY& List,
|
2011-09-06 14:09:40 +00:00
|
|
|
bool Load_Only_if_New );
|
|
|
|
|
|
|
|
/**
|
2011-09-30 18:15:37 +00:00
|
|
|
* Creates or recreates the KiCad project file. (filename.pro)
|
2011-09-06 14:09:40 +00:00
|
|
|
* Initialize:
|
|
|
|
* G_Prj_Config
|
|
|
|
* G_Prj_Config_LocalFilename
|
|
|
|
* G_Prj_Default_Config_FullFilename
|
|
|
|
* Return:
|
|
|
|
* True if local config
|
|
|
|
* False if default config
|
|
|
|
*/
|
|
|
|
bool ReCreatePrjConfig( const wxString& local_config_filename,
|
|
|
|
const wxString& GroupName,
|
|
|
|
bool ForceUseLocalConfig );
|
|
|
|
|
2011-11-08 16:37:25 +00:00
|
|
|
/**
|
|
|
|
* Function ReadPdfBrowserInfos
|
|
|
|
* read the PDF browser choice from the common configuration.
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void ReadPdfBrowserInfos();
|
2011-11-08 16:37:25 +00:00
|
|
|
|
|
|
|
/* Function WritePdfBrowserInfos
|
|
|
|
* save the PDF browser choice to the common configuration.
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void WritePdfBrowserInfos();
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function FindFileInSearchPaths
|
|
|
|
* looks in search paths for \a filename.
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
wxString FindFileInSearchPaths( const wxString& filename,
|
|
|
|
const wxArrayString* subdirs = NULL );
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function GetHelpFile
|
|
|
|
* get the help file path.
|
2011-09-01 12:54:34 +00:00
|
|
|
* <p>
|
2011-09-30 18:15:37 +00:00
|
|
|
* Return the KiCad help file with path. The base paths defined in
|
2011-08-29 19:50:05 +00:00
|
|
|
* m_searchPaths are tested for a valid file. The path returned can
|
|
|
|
* be relative depending on the paths added to m_searchPaths. See the
|
|
|
|
* documentation for wxPathList for more information. If the help file
|
|
|
|
* for the current locale is not found, an attempt to find the English
|
|
|
|
* version of the help file is made.
|
|
|
|
* wxEmptyString is returned if help file not found.
|
|
|
|
* Help file is searched in directories in this order:
|
2011-09-01 12:54:34 +00:00
|
|
|
* help/\<canonical name\> like help/en_GB
|
|
|
|
* help/\<short name\> like help/en
|
2011-08-29 19:50:05 +00:00
|
|
|
* help/en
|
|
|
|
* </p>
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
wxString GetHelpFile( void );
|
|
|
|
|
|
|
|
wxString GetLibraryFile( const wxString& filename );
|
2011-08-29 19:50:05 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
/**
|
|
|
|
* Return the preferred editor name.
|
|
|
|
*/
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString& GetEditorName();
|
|
|
|
|
|
|
|
const wxString& GetTitle() { return m_Title; }
|
|
|
|
void SetTitle( const wxString& title ) { m_Title = title; }
|
|
|
|
|
|
|
|
wxPathList& GetLibraryPathList() { return m_libSearchPaths; }
|
2009-04-08 18:06:22 +00:00
|
|
|
wxString FindLibraryPath( const wxString& fileName );
|
2009-04-12 14:39:54 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function FindLibraryPath
|
2011-09-30 18:15:37 +00:00
|
|
|
* KiCad saves user defined library files that are not in the standard
|
2009-04-14 16:45:22 +00:00
|
|
|
* library search path list with the full file path. Calling the library
|
|
|
|
* search path list with a user library file will fail. This helper method
|
|
|
|
* solves that problem.
|
|
|
|
* @param fileName
|
|
|
|
* @return a wxEmptyString if library file is not found.
|
|
|
|
*/
|
2009-04-08 18:06:22 +00:00
|
|
|
wxString FindLibraryPath( const wxFileName& fileName )
|
|
|
|
{
|
|
|
|
return FindLibraryPath( fileName.GetFullPath() );
|
|
|
|
}
|
2009-04-12 14:39:54 +00:00
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function ReturnLastVisitedLibraryPath
|
|
|
|
* returns the last visited library directory, or (if void) the first
|
2009-04-14 16:45:22 +00:00
|
|
|
* path in lib path list ( but not the CWD )
|
2011-08-29 19:50:05 +00:00
|
|
|
*
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aSubPathToSearch = Preferred sub path to search in path list
|
2009-04-14 16:45:22 +00:00
|
|
|
*/
|
2011-08-29 19:50:05 +00:00
|
|
|
wxString ReturnLastVisitedLibraryPath( const wxString& aSubPathToSearch = wxEmptyString );
|
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
void SaveLastVisitedLibraryPath( const wxString& aPath );
|
2009-04-14 16:45:22 +00:00
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
/**
|
|
|
|
* Function ReturnFilenameWithRelativePathInLibPath
|
2009-11-23 20:18:47 +00:00
|
|
|
* @return a short filename (with extension) with only a relative path if
|
2011-08-29 19:50:05 +00:00
|
|
|
* this filename can be found in library paths
|
|
|
|
* @param aFullFilename The filename with path and extension.
|
2009-04-15 15:53:21 +00:00
|
|
|
*/
|
2011-08-29 19:50:05 +00:00
|
|
|
wxString ReturnFilenameWithRelativePathInLibPath( const wxString& aFullFilename );
|
2009-04-18 14:14:40 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function RemoveLibraryPath
|
2009-04-18 14:14:40 +00:00
|
|
|
* Removes the given path(s) from the library path list
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aPaths = path or path list to remove. paths must be separated by
|
|
|
|
* ";"
|
2009-04-18 14:14:40 +00:00
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void RemoveLibraryPath( const wxString& aPaths );
|
2009-04-18 14:14:40 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function InsertLibraryPath
|
2009-04-18 14:14:40 +00:00
|
|
|
* insert path(s) int lib paths list.
|
|
|
|
* @param aPaths = path or path list to add. paths must be separated by ";"
|
|
|
|
* @param aIndex = insertion point
|
2009-04-14 16:45:22 +00:00
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
void InsertLibraryPath( const wxString& aPaths, size_t aIndex );
|
2012-08-02 07:47:30 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
/*
|
2011-09-06 14:09:40 +00:00
|
|
|
* Use wxGetApp() to access EDA_APP. It is not necessary to keep copies
|
2008-12-05 16:03:05 +00:00
|
|
|
* of the application pointer all over the place or worse yet in a global
|
|
|
|
* variable.
|
|
|
|
*/
|
2011-09-06 14:09:40 +00:00
|
|
|
DECLARE_APP( EDA_APP )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#endif /* APPL_WXSTRUCT_H */
|