kicad/pcbnew/pcb_edit_frame.h

1204 lines
42 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 1992-2019 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 3 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, see <http://www.gnu.org/licenses/>.
*/
2008-01-01 11:58:14 +00:00
2012-10-15 22:30:01 +00:00
#ifndef WXPCB_STRUCT_H_
#define WXPCB_STRUCT_H_
2008-01-01 11:58:14 +00:00
#include <unordered_map>
#include <map>
#include "pcb_base_edit_frame.h"
#include "config_params.h"
2018-01-31 08:23:20 +00:00
#include "undo_redo_container.h"
#include "zones.h"
2008-01-01 11:58:14 +00:00
/* Forward declarations of classes. */
class ACTION_PLUGIN;
2008-01-01 11:58:14 +00:00
class PCB_SCREEN;
class BOARD;
class BOARD_COMMIT;
2016-05-13 15:31:54 +00:00
class BOARD_ITEM_CONTAINER;
2008-01-01 11:58:14 +00:00
class TEXTE_PCB;
class MODULE;
class TRACK;
class VIA;
2008-01-01 11:58:14 +00:00
class D_PAD;
class TEXTE_MODULE;
class PCB_TARGET;
class DIMENSION;
2008-01-01 11:58:14 +00:00
class EDGE_MODULE;
class DRC;
class DIALOG_PLOT;
2008-01-01 11:58:14 +00:00
class ZONE_CONTAINER;
class DRAWSEGMENT;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
2010-01-24 02:05:07 +00:00
class PCB_LAYER_WIDGET;
class MARKER_PCB;
class BOARD_ITEM;
class PCB_LAYER_BOX_SELECTOR;
class NETLIST;
class REPORTER;
struct PARSE_ERROR;
class IO_ERROR;
class FP_LIB_TABLE;
class BOARD_NETLIST_UPDATER;
2008-01-01 11:58:14 +00:00
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
/**
* Enum to signify the result of editing tracks and vias
*/
enum TRACK_ACTION_RESULT
{
TRACK_ACTION_DRC_ERROR = -1,//!< TRACK_ACTION_DRC_ERROR - Track not changed to to DRC
TRACK_ACTION_SUCCESS, //!< TRACK_ACTION_SUCCESS - Track changed successfully
TRACK_ACTION_NONE //!< TRACK_ACTION_NONE - Nothing to change
};
2009-07-30 11:04:07 +00:00
/**
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* Class PCB_EDIT_FRAME
* is the main frame for Pcbnew.
*
* See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
2009-11-23 20:18:47 +00:00
*/
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
2008-01-01 11:58:14 +00:00
{
friend struct PCB::IFACE;
2010-01-24 02:05:07 +00:00
friend class PCB_LAYER_WIDGET;
/// The auxiliary right vertical tool bar used to access the microwave tools.
wxAuiToolBar* m_microWaveToolBar;
2010-01-21 07:41:30 +00:00
protected:
2010-01-24 02:05:07 +00:00
PCB_LAYER_WIDGET* m_Layers;
DRC* m_drc; ///< the DRC controller, see drc.cpp
2010-01-24 02:05:07 +00:00
PARAM_CFG_ARRAY m_configParams; ///< List of Pcbnew configuration settings.
wxString m_lastNetListRead; ///< Last net list read with relative path.
// The Tool Framework initalization
void setupTools();
wxString createBackupFile( const wxString& aFileName );
/**
* switches currently used canvas (Cairo / OpenGL).
* It also reinit the layers manager that slightly changes with canvases
*/
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
/**
* Function RebuildActionPluginMenus
* Fill action menu with all registered action plugins
*/
void RebuildActionPluginMenus();
/**
* Function AddActionPluginTools
* Append action plugin buttons to main toolbar
*/
void AddActionPluginTools();
/**
* Function RunActionPlugin
* Executes action plugin's Run() method and updates undo buffer
* @param aActionPlugin action plugin
*/
void RunActionPlugin( ACTION_PLUGIN* aActionPlugin );
/**
* Function OnActionPluginMenu
* Launched by the menu when an action is called
* @param aEvent sent by wx
*/
void OnActionPluginMenu( wxCommandEvent& aEvent);
/**
* Function OnActionPluginButton
* Launched by the button when an action is called
* @param aEvent sent by wx
*/
void OnActionPluginButton( wxCommandEvent& aEvent );
/**
* Function OnActionPluginRefresh
* Refresh plugin list (reload Python plugins)
* @param aEvent sent by wx
*/
void OnActionPluginRefresh( wxCommandEvent& aEvent)
{
PythonPluginsReload();
}
#endif
/** Has meaning only if KICAD_SCRIPTING_WXPYTHON option is
* not defined
* @return the frame name identifier for the python console frame
*/
static const wxChar * pythonConsoleNameId()
{
return wxT( "PythonConsole" );
}
/**
* @return a pointer to the python console frame, or NULL if not exist
*/
static wxWindow * findPythonConsole()
{
return FindWindowByName( pythonConsoleNameId() );
}
/**
* Updates the state of the GUI after a new board is loaded or created
*/
void onBoardLoaded();
2010-01-24 02:05:07 +00:00
/**
2012-02-06 05:44:19 +00:00
* Function syncLayerWidgetLayer
* updates the currently layer "selection" within the PCB_LAYER_WIDGET.
* The currently selected layer is defined by the return value of GetActiveLayer().
2010-01-24 02:05:07 +00:00
* <p>
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
* </p>
2010-01-24 02:05:07 +00:00
*/
2012-02-06 05:44:19 +00:00
void syncLayerWidgetLayer();
/**
* Function syncRenderStates
* updates the "Render" checkboxes in the layer widget according
* to current toggle values determined by IsElementVisible(), and is helpful
* immediately after loading a BOARD which may have state information in it.
*/
void syncRenderStates();
2010-01-24 02:05:07 +00:00
/**
* Function syncLayerVisibilities
* updates each "Layer" checkbox in the layer widget according
* to each layer's current visibility determined by IsLayerVisible(), and is
* helpful immediately after loading a BOARD which may have state information in it.
*/
void syncLayerVisibilities();
/**
* Function doAutoSave
* performs auto save when the board has been modified and not saved within the
* auto save interval.
*
* @return true if the auto save was successful.
*/
2016-09-24 18:53:15 +00:00
virtual bool doAutoSave() override;
/**
* Function isautoSaveRequired
* returns true if the board has been modified.
*/
2016-09-24 18:53:15 +00:00
virtual bool isAutoSaveRequired() const override;
/**
* Function moveExact
* Move the selected item exactly
*/
void moveExact();
/**
* Load the given filename but sets the path to the current project path.
* @param full filepath of file to be imported.
* @param aFileType PCB_FILE_T value for filetype
*/
bool importFile( const wxString& aFileName, int aFileType );
/**
* Use the existing edge_cut line thicknesses to infer the edge clearace.
*/
int inferLegacyEdgeClearance( BOARD* aBoard );
/**
* Rematch orphaned zones and vias to schematic nets.
*/
bool fixEagleNets( const std::unordered_map<wxString, wxString>& aRemap );
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
// protected so that PCB::IFACE::CreateWindow() is the only factory.
PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
2008-01-01 11:58:14 +00:00
public:
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
wxChoice* m_SelTrackWidthBox; // a choice box to display and select current track width
wxChoice* m_SelViaSizeBox; // a choice box to display and select current via diameter
2009-11-23 20:18:47 +00:00
bool m_show_microwave_tools;
bool m_show_layer_manager_tools;
bool m_ZoneFillsDirty; // Board has been modified since last zone fill.
2013-11-25 15:50:03 +00:00
virtual ~PCB_EDIT_FRAME();
2008-01-01 11:58:14 +00:00
/**
* Function loadFootprints
* loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
*
* @param aNetlist is the netlist of components to load the footprints into.
* @param aReporter is the #REPORTER object to report to.
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
* occurs while reading footprint library files.
*/
void LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter );
void OnQuit( wxCommandEvent& event );
/**
* Reload the Python plugins if they are newer than
* the already loaded, and load new plugins if any
* Do nothing if KICAD_SCRIPTING is not defined
*/
void PythonPluginsReload();
/**
* Update the layer manager and other widgets from the board setup
* (layer and items visibility, colors ...)
*/
void UpdateUserInterface();
/**
* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
* @param cmdline = received command from socket
*/
2016-09-24 18:53:15 +00:00
virtual void ExecuteRemoteCommand( const char* cmdline ) override;
2016-09-24 18:53:15 +00:00
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
2010-11-12 15:17:10 +00:00
/**
* Function ToPlotter
* Open a dialog frame to create plot and drill files relative to the current board.
*/
void ToPlotter( wxCommandEvent& event );
2010-11-12 15:17:10 +00:00
/**
* Function ToPrinter
* Install the print dialog.
*/
void ToPrinter( wxCommandEvent& event );
/**
* Function SVG_Print
* Shows the Export to SVG file dialog.
*/
void ExportSVG( wxCommandEvent& event );
2010-11-17 21:47:27 +00:00
// User interface update command event handlers.
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
bool LayerManagerShown();
bool MicrowaveToolbarShown();
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent );
void OnLayerColorChange( wxCommandEvent& aEvent );
void OnConfigurePaths( wxCommandEvent& aEvent );
void OnUpdatePCBFromSch( wxCommandEvent& event );
void OnRunEeschema( wxCommandEvent& event );
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit = true );
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit = true );
2016-01-22 12:30:44 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function IsGridVisible() , virtual
2010-02-01 21:23:27 +00:00
* @return true if the grid must be shown
*/
2016-09-24 18:53:15 +00:00
virtual bool IsGridVisible() const override;
2010-02-01 21:23:27 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function SetGridVisibility() , virtual
2010-02-01 21:23:27 +00:00
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visibility in configuration.
2010-02-01 21:23:27 +00:00
* @param aVisible = true if the grid must be shown
*/
2016-09-24 18:53:15 +00:00
virtual void SetGridVisibility( bool aVisible ) override;
2010-02-01 21:23:27 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function GetGridColor() , virtual
2010-02-01 21:23:27 +00:00
* @return the color of the grid
*/
virtual COLOR4D GetGridColor() override;
2010-02-01 21:23:27 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function SetGridColor() , virtual
2010-02-01 21:23:27 +00:00
* @param aColor = the new color of the grid
*/
virtual void SetGridColor( COLOR4D aColor ) override;
2008-01-01 11:58:14 +00:00
// Configurations:
void Process_Config( wxCommandEvent& event );
2009-11-23 20:18:47 +00:00
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
/**
* Function SetActionPluginSettings
* Set a set of plugins that have visible buttons on toolbar
* Plugins are identified by their module path
*/
void SetActionPluginSettings( const std::vector< std::pair<wxString, wxString> >& aPluginsWithButtons );
/**
* Function GetActionPluginSettings
* Get a set of plugins that have visible buttons on toolbar
*/
std::vector< std::pair<wxString, wxString> > GetActionPluginSettings();
/**
* Function GetActionPluginButtonVisible
* Returns true if button visibility action plugin setting was set to true
* or it is unset and plugin defaults to true.
*/
bool GetActionPluginButtonVisible( const wxString& aPluginPath, bool aPluginDefault );
/**
* Function GetOrderedActionPlugins
* Returns ordered list of plugins in sequence in which they should appear on toolbar or in settings
*/
std::vector<ACTION_PLUGIN*> GetOrderedActionPlugins();
#endif
/**
* Function GetProjectFileParameters
++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
* returns a project file parameter list for Pcbnew.
* <p>
++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
* Populate a project file parameter array specific to Pcbnew.
* Creating the parameter list at run time has the advantage of being able
* to define local variables. The old method of statically building the array
* at compile time requiring global variable definitions by design.
* </p>
++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
* @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so
* don't keep it around past that event.
*/
++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
PARAM_CFG_ARRAY GetProjectFileParameters();
/**
* Function SaveProjectSettings
* saves changes to the project settings to the project (.pro) file.
* @param aAskForSave = true to open a dialog before saving the settings
*/
2016-09-24 18:53:15 +00:00
void SaveProjectSettings( bool aAskForSave ) override;
/**
* Load the current project's file configuration settings which are pertinent
* to this PCB_EDIT_FRAME instance.
*
* @return always returns true.
*/
bool LoadProjectSettings();
/**
* Function GetConfigurationSettings
* returns the Pcbnew applications settings 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
* This replaces the old statically defined list that had the project
* file settings and the application settings mixed together. This
* was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
++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
* settings that are scattered throughout the Pcbnew source code. If you need
* to define a configuration setting that needs to be loaded at run time,
* this is the place to define it.
*
* @return - Reference to the list of applications settings.
*/
PARAM_CFG_ARRAY& GetConfigurationSettings();
2016-09-24 18:53:15 +00:00
void LoadSettings( wxConfigBase* aCfg ) override;
2016-09-24 18:53:15 +00:00
void SaveSettings( wxConfigBase* aCfg ) override;
2015-07-02 14:11:15 +00:00
wxConfigBase* GetSettings() { return config(); };
/**
* Get the last net list read with the net list dialog box.
* @return - Absolute path and file name of the last net list file successfully read.
*/
wxString GetLastNetListRead();
/**
* Set the last net list successfully read by the net list dialog box.
*
* Note: the file path is converted to a path relative to the project file path. If
* the path cannot be made relative, than m_lastNetListRead is set to and empty
* string. This could happen when the net list file is on a different drive than
* the project file. The advantage of relative paths is that is more likely to
* work when opening the same project from both Windows and Linux.
*
* @param aNetListFile - The last net list file with full path successfully read.
*/
void SetLastNetListRead( const wxString& aNetListFile );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
2016-09-24 18:53:15 +00:00
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
2016-09-24 18:53:15 +00:00
void OnCloseWindow( wxCloseEvent& Event ) override;
void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
/**
* Function OnEditTextAndGraphics
* Dialog for editing properties of text and graphic items, selected by type, layer,
* and/or parent footprint.
*/
void OnEditTextAndGraphics( wxCommandEvent& event );
/**
* Function OnEditTracksAndVias
* Dialog for editing the properties of tracks and vias, selected by net, netclass,
* and/or layer.
*/
void OnEditTracksAndVias( wxCommandEvent& event );
2016-09-24 18:53:15 +00:00
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
void ReCreateHToolbar() override;
void ReCreateAuxiliaryToolbar() override;
void ReCreateVToolbar() override;
void ReCreateMicrowaveVToolbar();
void ReCreateOptToolbar() override;
2016-09-24 18:53:15 +00:00
void ReCreateMenuBar() override;
/**
* Re create the layer Box by clearing the old list, and building
* le new one, from the new layers names and cole layers
* @param aForceResizeToolbar = true to resize the parent toolbar
* false if not needed (mainly in parent toolbar creation,
* or when the layers names are not modified)
*/
void ReCreateLayerBox( bool aForceResizeToolbar = true );
2008-04-29 13:35:26 +00:00
/**
* Function SetCurrentNetClass
* Must be called after a netclass selection (or after a netclass parameter change
* calls BOARD_DESIGN_SETTINGS::SetCurrentNetClass() and update trace width and via size
* combo boxes on main toolbar
* Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
* and some others parameters (netclass name ....)
* @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified
*/
bool SetCurrentNetClass( const wxString& aNetClassName );
/**
* Function OnModify
* must be called after a board change to set the modified flag.
* <p>
* Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
* to update auxiliary information.
* </p>
*/
2016-09-24 18:53:15 +00:00
virtual void OnModify() override;
/**
* Function SetActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
virtual void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
PCB_LAYER_WIDGET* GetLayerManager() { return m_Layers; }
/**
* Update the UI to reflect changes to the current layer's transparency.
*/
void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
2010-01-21 20:53:01 +00:00
/**
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
* @param aElement is from the enum by the same name
* @return bool - true if the element is visible.
* @see enum GAL_LAYER_ID
*/
bool IsElementVisible( GAL_LAYER_ID aElement ) const;
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aElement is from the enum by the same name
* @param aNewState The new visibility state of the element category
* @see enum PCB_LAYER_ID
*/
void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
/**
* Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE
*/
void SetVisibleAlls();
/**
2010-01-21 20:53:01 +00:00
* Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon
* loading a new BOARD.
*/
void ReFillLayerWidget();
2010-01-21 20:53:01 +00:00
/**
* Function Show3D_Frame
* displays the 3D view of current printed circuit board.
*/
2016-09-24 18:53:15 +00:00
void Show3D_Frame( wxCommandEvent& event ) override;
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void UseGalCanvas() override;
2013-11-25 15:50:03 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function ShowBoardSetupDialog
*/
void ShowBoardSetupDialog( wxCommandEvent& event );
void DoShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString,
const wxString& aInitialParentPage = wxEmptyString );
/* toolbars update UI functions: */
2009-11-23 20:18:47 +00:00
void PrepareLayerIndicator();
void OnSelectOptionToolbar( wxCommandEvent& event );
2016-12-02 17:59:48 +00:00
void OnFlipPcbView( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
2009-11-23 20:18:47 +00:00
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
2012-02-06 05:44:19 +00:00
/**
* Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file
* See DoGenFootprintsPositionFile for options and file format
*/
void GenFootprintsPositionFile( wxCommandEvent& event );
/**
* Function DoGenFootprintsPositionFile
* Creates an ascii footprint position file
* @param aFullFileName = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @param aForceSmdItems = true to force all footprints with smd pads in list
* = false to put only footprints with option "INSERT" in list
* @param aSide = 0 to list footprints on BACK side,
* 1 to list footprints on FRONT side
* 2 to list footprints on both sides
* @param aFormatCSV = true to use a comma separated file (CSV) format; defautl = false
* @return the number of footprints found on aSide side,
* or -1 if the file could not be created
*/
int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM,
bool aForceSmdItems, int aSide, bool aFormatCSV = false );
/**
* Function GenFootprintsReport
* Calls DoGenFootprintsReport to create a footprint reprot file
* See DoGenFootprintsReport for file format
*/
void GenFootprintsReport( wxCommandEvent& event );
/**
* Function DoGenFootprintsReport
* Creates an ascii footprint report file giving some infos on footprints
* and board outlines
* @param aFullFilename = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @return true if OK, false if error
*/
bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
2009-11-23 20:18:47 +00:00
void InstallDrillFrame( wxCommandEvent& event );
void GenD356File( wxCommandEvent& event );
2009-11-23 20:18:47 +00:00
void OnFileHistory( wxCommandEvent& event );
/**
* Function Files_io
* @param event is the command event handler.
* do nothing else than call Files_io_from_id with the
* wxCommandEvent id
*/
2009-11-23 20:18:47 +00:00
void Files_io( wxCommandEvent& event );
/**
* Function Files_io_from_id
* Read and write board files
* @param aId is an event ID ciming from file command events:
* ID_LOAD_FILE
* ID_MENU_READ_BOARD_BACKUP_FILE
* ID_MENU_RECOVER_BOARD_AUTOSAVE
* ID_APPEND_FILE
* ID_NEW_BOARD
* ID_SAVE_BOARD
* ID_COPY_BOARD_AS
* ID_SAVE_BOARD_AS
* Files_io_from_id prepare parameters and calls the specialized function
*/
2018-08-11 20:46:03 +00:00
bool Files_io_from_id( int aId );
2010-11-12 15:17:10 +00:00
/**
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* Function OpenProjectFiles (was LoadOnePcbFile)
* loads a KiCad board (.kicad_pcb) from \a aFileName.
*
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* @param aFileSet - hold the BOARD file to load, a vector of one element.
*
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
* @param aCtl - KICTL_ bits, one to indicate that an append of the board file
* aFileName to the currently loaded file is desired.
* @see #KIWAY_PLAYER for bit defines.
*
* @return bool - false if file load fails, otherwise true.
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
bool aForceFileDialog = false );
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
*/
2016-09-24 18:53:15 +00:00
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
2010-01-21 07:41:30 +00:00
/**
* Function AppendBoardFile
* appends a board file onto the current one, creating God knows what.
* the main purpose is only to allow panelizing boards.
2010-01-21 07:41:30 +00:00
*/
bool AppendBoardFile( const wxString& aFullFileName, int aCtl );
2010-01-21 07:41:30 +00:00
/**
* Function SavePcbFile
* writes the board data structures to \a a aFileName
* Creates backup when requested and update flags (modified and saved flgs)
*
* @param aFileName The file name to write or wxEmptyString to prompt user for
* file name.
* @param aCreateBackupFile Creates a back of \a aFileName if true. Helper
* definitions #CREATE_BACKUP_FILE and #NO_BACKUP_FILE
* are defined for improved code readability.
* @return True if file was saved successfully.
*/
bool SavePcbFile( const wxString& aFileName, bool aCreateBackupFile = CREATE_BACKUP_FILE );
/**
* Function SavePcbCopy
* writes the board data structures to \a a aFileName
* but unlike SavePcbFile, does not make anything else
* (no backup, borad fliename change, no flag changes ...)
* Used under a project mgr to save under a new name the current board
*
* When not under a project mgr, the full SavePcbFile is used.
* @param aFileName The file name to write.
* @return True if file was saved successfully.
*/
bool SavePcbCopy( const wxString& aFileName );
2009-08-06 15:42:09 +00:00
// BOARD handling
2009-11-23 20:18:47 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function Clear_Pcb
2009-08-06 15:42:09 +00:00
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to initialize silently
2009-08-06 15:42:09 +00:00
*/
2009-11-23 20:18:47 +00:00
bool Clear_Pcb( bool aQuery );
///> @copydoc PCB_BASE_FRAME::SetBoard()
2016-09-24 18:53:15 +00:00
void SetBoard( BOARD* aBoard ) override;
2013-11-25 15:50:03 +00:00
2016-05-13 15:31:54 +00:00
///> @copydoc PCB_BASE_EDIT_FRAME::GetModel()
BOARD_ITEM_CONTAINER* GetModel() const override;
///> @copydoc PCB_BASE_FRAME::SetPageSettings()
2016-09-24 18:53:15 +00:00
void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
/**
* Function GetDrcController
2009-09-10 13:04:04 +00:00
* @return the DRC controller
*/
2009-11-23 20:18:47 +00:00
DRC* GetDrcController() { return m_drc; }
2009-08-06 15:42:09 +00:00
/**
* Function RecreateBOMFileFromBoard
* Recreates a .cmp file from the current loaded board
* this is the same as created by CvPcb.
* can be used if this file is lost
*/
void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );
/**
* Function ArchiveModulesOnBoard
* Save modules in a library:
* @param aStoreInNewLib:
* true : save modules in a existing lib. Existing footprints will be kept
* or updated.
* This lib should be in fp lib table, and is type is .pretty
* false: save modules in a new lib. It it is an existing lib,
* previous footprints will be removed
*
* @param aLibName:
* optional library name to create, stops dialog call.
* must be called with aStoreInNewLib as true
*/
void ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName = wxEmptyString,
wxString* aLibPath = NULL );
/**
* Function RecreateBOMFileFromBoard
* Creates a BOM file from the current loaded board
*/
void RecreateBOMFileFromBoard( wxCommandEvent& aEvent );
/**
* Function ExportToGenCAD
* creates a file in GenCAD 1.4 format from the current board.
*/
void ExportToGenCAD( wxCommandEvent& event );
2008-03-04 04:22:27 +00:00
/**
* Function OnExportVRML
* will export the current BOARD to a VRML file.
*/
void OnExportVRML( wxCommandEvent& event );
/**
* Function ExportVRML_File
* Creates the file(s) exporting current BOARD to a VRML file.
*
* @note When copying 3D shapes files, the new filename is build from the full path
* name, changing the separators by underscore. This is needed because files
* with the same shortname can exist in different directories
* @note ExportVRML_File generates coordinates in board units (BIU) inside the file.
* @todo Use mm inside the file. A general scale transform is applied to the whole
* file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML
* unit in meters.
* @note For 3D models built by a 3D modeler, the unit is 0,1 inches. A specific scale
* is applied to 3D models to convert them to internal units.
*
* @param aFullFileName = the full filename of the file to create
* @param aMMtoWRMLunit = the VRML scaling factor:
* 1.0 to export in mm. 0.001 for meters
* @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir
* @param aUseRelativePaths set to true to use relative paths instead of absolute paths
* in the board VRML file URLs.
* @param aUsePlainPCB set to true to export a board with no copper or silkskreen;
* this is useful for generating a VRML file which can be
* converted to a STEP model.
* @param a3D_Subdir = sub directory where 3D shapes files are copied. This is only used
* when aExport3DFiles == true
* @param aXRef = X value of PCB (0,0) reference point
* @param aYRef = Y value of PCB (0,0) reference point
* @return true if Ok.
*/
bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
2019-05-27 16:16:54 +00:00
bool aExport3DFiles, bool aUseRelativePaths, bool aUsePlainPCB,
const wxString & a3D_Subdir, double aXRef, double aYRef );
/**
* Function OnExportIDF3
* will export the current BOARD to a IDFv3 board and lib files.
*/
void OnExportIDF3( wxCommandEvent& event );
/**
* Function OnExportHyperlynx
* will export the current BOARD to a Hyperlynx HYP file.
*/
void OnExportHyperlynx( wxCommandEvent& event );
/**
* Function Export_IDF3
* Creates an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file.
*
* @param aPcb = a pointer to the board to be exported to IDF
* @param aFullFileName = the full filename of the export file
* @param aUseThou = set to true if the desired IDF unit is thou (mil)
* @param aXRef = the board Reference Point in mm, X value
* @param aYRef = the board Reference Point in mm, Y value
* @return true if OK
*/
bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
bool aUseThou, double aXRef, double aYRef );
/**
* Function OnExportSTEP
* Exports the current BOARD to a STEP assembly.
*/
void OnExportSTEP( wxCommandEvent& event );
2008-01-21 22:16:45 +00:00
/**
* Function ExporttoSPECCTRA
* Ask for a filename and call ExportSpecctraFile to export the current BOARD
* to a specctra dsn file.
*/
void ExportToSpecctra( wxCommandEvent& event );
/**
* Function ExportSpecctraFile
* will export the current BOARD to a specctra dsn file.
2008-01-21 22:16:45 +00:00
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
* @return true if OK
2008-01-21 22:16:45 +00:00
*/
bool ExportSpecctraFile( const wxString& aFullFilename );
2008-01-01 11:58:14 +00:00
2008-02-06 22:32:15 +00:00
/**
* Function ImportSpecctraSession
2008-03-04 04:22:27 +00:00
* will import a specctra *.ses file and use it to relocate MODULEs and
2008-02-06 22:32:15 +00:00
* to replace all vias and tracks in an existing and loaded BOARD.
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
void ImportSpecctraSession( wxCommandEvent& event );
2008-02-06 22:32:15 +00:00
/**
* Function ImportSpecctraSession
* will import a specctra *.ses file and use it to relocate MODULEs and
* to replace all vias and tracks in an existing and loaded BOARD.
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
bool ImportSpecctraSession( const wxString& aFullFilename );
2008-02-06 22:32:15 +00:00
/**
* Function ImportSpecctraDesign
2008-03-04 04:22:27 +00:00
* will import a specctra *.dsn file and use it to replace an entire BOARD.
2009-11-23 20:18:47 +00:00
* The new board will not have any graphics, only components, tracks and
* vias.
2008-02-06 22:32:15 +00:00
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
void ImportSpecctraDesign( wxCommandEvent& event );
2008-03-04 04:22:27 +00:00
/**
* Function ListAndSelectModuleName
* builds and shows a list of existing modules on board that the user can select.
* @return a pointer to the selected module or NULL.
*/
MODULE* ListAndSelectModuleName();
2010-11-12 15:17:10 +00:00
/**
* Function ListNetsAndSelect
* called by a command event
* displays the sorted list of nets in a dialog frame
2009-11-23 20:18:47 +00:00
* If a net is selected, it is highlighted
*/
void ListNetsAndSelect( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
// Graphic Segments type DRAWSEGMENT
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
2008-01-01 11:58:14 +00:00
// Footprint editing (see also PCB_BASE_FRAME)
void InstallFootprintPropertiesDialog( MODULE* Module );
int InstallExchangeModuleFrame( MODULE* aModule, bool updateMode, bool selectedMode );
2009-08-06 07:11:04 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function Exchange_Module
2009-08-06 07:11:04 +00:00
* Replaces OldModule by NewModule, using OldModule settings:
* position, orientation, pad netnames ...)
* OldModule is deleted or put in undo list.
* @param aSrc = footprint to replace
* @param aDest = footprint to put
* @param aCommit = commit that should store the changes
2009-08-06 07:11:04 +00:00
*/
void Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& aCommit,
bool deleteExtraTexts = true,
bool resetTextLayers = true, bool resetTextEffects = true );
2008-01-01 11:58:14 +00:00
// loading modules: see PCB_BASE_FRAME
2008-01-01 11:58:14 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param aDC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void OnEditItemRequest( BOARD_ITEM* aItem ) override;
2008-01-01 11:58:14 +00:00
/**
* Function IsMicroViaAcceptable
* return true if a microvia can be placed on the board.
* <p>
* A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
* </p>
*/
bool IsMicroViaAcceptable();
2010-11-12 15:17:10 +00:00
/**
* Function Edit_TrackSegm_Width
2009-08-08 06:07:08 +00:00
* Modify one track segment width or one via diameter (using DRC control).
* @param aTrackItem = the track segment or via to modify
*/
void Edit_TrackSegm_Width( TRACK* aTrackItem );
void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) override;
2010-11-12 15:17:10 +00:00
/**
* Function SetTrackSegmentWidth
2009-08-08 06:07:08 +00:00
* Modify one track segment width or one via diameter (using DRC control).
* Basic routine used by other routines when editing tracks or vias.
* Note that casting this to boolean will allow you to determine whether any action
* happened.
2009-08-08 06:07:08 +00:00
* @param aTrackItem = the track segment or via to modify
2009-11-23 20:18:47 +00:00
* @param aItemsListPicker = the list picker to use for an undo command
* (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use
* current designSettings value
* @return 0 if items successfully changed,
* -1 if there was a DRC error,
* 1 if items were changed successfully
2009-08-08 06:07:08 +00:00
*/
int SetTrackSegmentWidth( TRACK* aTrackItem,
2009-11-23 20:18:47 +00:00
PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue );
2009-08-08 06:07:08 +00:00
2008-01-01 11:58:14 +00:00
// zone handling
2010-11-12 15:17:10 +00:00
/**
* Function Fill_Zone
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param aZone = zone to fill
*/
void Fill_Zone( ZONE_CONTAINER* aZone );
2010-11-12 15:17:10 +00:00
/**
* Function Fill_All_Zones
*/
void Fill_All_Zones();
/**
* Function Check_All_Zones
* Checks for out-of-date fills and fills them if requested by the user.
* @param aActiveWindow
*/
void Check_All_Zones( wxWindow* aActiveWindow );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
void Edit_Zone_Params( ZONE_CONTAINER* zone_container );
2010-11-12 15:17:10 +00:00
/**
* Function Delete_Zone
2009-11-23 20:18:47 +00:00
* Remove the zone which include the segment aZone, or the zone which have
* the given time stamp. A zone is a group of segments which have the
* same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param zone_container = zone to modify
* the member .m_CornerSelection is used to find the outline to remove.
* if the outline is the main outline, all the zone is removed
* otherwise, the hole is deleted
*/
void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
// Target handling
void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
void ShowTargetOptionsDialog( PCB_TARGET* aTarget );
2008-01-01 11:58:14 +00:00
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension );
2008-01-01 11:58:14 +00:00
// netlist handling:
void InstallNetlistFrame();
2008-01-01 11:58:14 +00:00
/**
* Function FetchNetlistFromSchematic
* @param aNetlist a NETLIST owned by the caller. This function fills it in.
* @return true if a netlist was fetched.
*/
enum FETCH_NETLIST_MODE { NO_ANNOTATION, QUIET_ANNOTATION, ANNOTATION_DIALOG };
bool FetchNetlistFromSchematic( NETLIST& aNetlist, FETCH_NETLIST_MODE aMode );
/**
* Function UpdatePCBFromNetlist
* @param aNetlist
*/
void UpdatePCBFromNetlist( NETLIST& aNetlist );
/**
* Function DoUpdatePCBFromNetlist
* An automated version of UpdatePCBFromNetlist which skips the UI dialog.
* @param aNetlist
* @param aUseTimestamps
*/
void DoUpdatePCBFromNetlist( NETLIST& aNetlist, bool aUseTimestamps );
2010-11-12 15:17:10 +00:00
/**
* Reads a netlist from a file into a NETLIST object.
*
* @param aFilename is the netlist to load
* @param aNetlist is the object to populate with data
* @param aReporter is a #REPORTER object to display messages
* @return true if the netlist was read successfully
*/
bool ReadNetlistFromFile( const wxString &aFilename,
NETLIST& aNetlist,
REPORTER& aReporter );
/**
* Called after netlist is updated
* @param aUpdater is the updater object that was run
* @param aRunDragCommand is set to true if the drag command was invoked by this call
*/
void OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aRunDragCommand );
2010-11-12 15:17:10 +00:00
/**
* Function RemoveMisConnectedTracks
* finds all track segments which are mis-connected (to more than one net).
* When such a bad segment is found, it is flagged to be removed.
* All tracks having at least one flagged segment are removed.
* @return true if any change is made
*/
bool RemoveMisConnectedTracks();
2008-01-01 11:58:14 +00:00
// Autoplacement:
void OnPlaceOrRouteFootprints( wxCommandEvent& event );
#if defined( KICAD_SCRIPTING_WXPYTHON )
/**
* Function ScriptingConsoleEnableDisable
* enables or disabled the scripting console
*/
void ScriptingConsoleEnableDisable( wxCommandEvent& aEvent );
void OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent );
#endif
void LockModule( MODULE* aModule, bool aLocked );
/**
* Function SpreadFootprints
* Footprints (after loaded by reading a netlist for instance) are moved
* to be in a small free area (outside the current board) without overlapping.
* @param aFootprints: a list of footprints to be spread out.
* @param aMoveFootprintsOutsideBoardOnly: true to move only
* footprints outside the board outlines
* (they are outside if the position of a footprint anchor is outside
* the board outlines bounding box). It imply the board outlines exist
* @param aCheckForBoardEdges: true to try to place footprints outside of
* board edges, if aSpreadAreaPosition is incorrectly chosen.
* @param aSpreadAreaPosition the position of the upper left corner of the
* area used to spread footprints
* @param aPrepareUndoCommand = true (defualt) to commit a undo command for the
* spread footprints, false to do just the spread command
* (no undo specific to this move command)
*/
void SpreadFootprints( std::vector<MODULE*>* aFootprints,
bool aMoveFootprintsOutsideBoardOnly,
bool aCheckForBoardEdges,
wxPoint aSpreadAreaPosition,
bool aPrepareUndoCommand = true );
2008-01-01 11:58:14 +00:00
/**
* Function Clean_Pcb
* Clean up the board (remove redundant vias, not connected tracks
* and merges collinear track segments)
* Install the cleanup dialog frame to know what should be cleaned
* and run the cleanup function
*/
void Clean_Pcb();
2008-01-01 11:58:14 +00:00
/**
* Function SendMessageToEESCHEMA
* sends a message to the schematic editor so that it may move its cursor
* to a part with the same reference as the objectToSync
* @param objectToSync The object whose reference is used to synchronize Eeschema.
2008-01-01 11:58:14 +00:00
*/
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
2008-01-01 11:58:14 +00:00
/**
* Sends a net name to eeschema for highlighting
*
* @param aNetName is the name of a net, or empty string to clear highlight
*/
void SendCrossProbeNetName( const wxString& aNetName );
/**
* Function CreateMuWaveBaseFootprint
* create a basic footprint for micro wave applications.
* @param aValue = the text value
* @param aTextSize = the size of ref and value texts ( <= 0 to use board default values )
* @param aPadCount = number of pads
* Pads settings are:
* PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.
*/
MODULE* CreateMuWaveBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount );
/**
* Create_MuWaveComponent
* creates a module "GAP" or "STUB" used in micro wave designs.
* This module has 2 pads:
* PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.
* the "gap" is isolation created between this 2 pads
*/
MODULE* Create_MuWaveComponent( int shape_type );
MODULE* Create_MuWavePolygonShape();
2016-09-24 18:53:15 +00:00
void ShowChangedLanguage() override;
/**
* Function UpdateTitle
* sets the main window title bar text.
* <p>
* If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
* application name appended with no file. Otherwise, the title is set to the full path
* and file name and read only is appended to the title if the user does not have write
* access to the file.
* </p>
*/
void UpdateTitle();
/**
* Allows Pcbnew to install its preferences panel into the preferences dialog.
*/
void InstallPreferences( PAGED_DIALOG* aParent ) override;
/**
* Called after the preferences dialog is run.
*/
void CommonSettingsChanged() override;
void SyncMenusAndToolbars() override;
2008-01-01 11:58:14 +00:00
DECLARE_EVENT_TABLE()
};
2012-10-15 22:30:01 +00:00
#endif // WXPCB_STRUCT_H_