2011-11-07 14:04:24 -05:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-17 15:36:04 +01:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2021-07-26 13:28:37 -04:00
|
|
|
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@gmail.com>
|
2023-11-11 15:29:34 +00:00
|
|
|
* Copyright (C) 2023 CERN
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2011-11-07 14:04:24 -05:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2018-01-29 13:38:23 +01:00
|
|
|
#ifndef PCB_BASE_FRAME_H
|
|
|
|
#define PCB_BASE_FRAME_H
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2023-11-09 18:40:47 +00:00
|
|
|
#include <eda_units.h>
|
2020-09-25 00:31:56 -07:00
|
|
|
#include <eda_draw_frame.h>
|
|
|
|
#include <lib_id.h>
|
2017-10-30 18:21:07 +01:00
|
|
|
#include <pcb_display_options.h>
|
2019-06-13 18:28:55 +01:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2020-07-04 21:59:29 -04:00
|
|
|
#include <pcb_origin_transforms.h>
|
2020-09-25 00:31:56 -07:00
|
|
|
#include <pcb_screen.h>
|
|
|
|
#include <vector>
|
|
|
|
|
2023-05-31 13:37:58 -07:00
|
|
|
#include <wx/datetime.h>
|
|
|
|
#include <wx/timer.h>
|
2017-08-04 14:43:02 +02:00
|
|
|
|
2011-09-26 16:32:56 -04:00
|
|
|
/* Forward declarations of classes. */
|
2020-01-12 20:44:19 -05:00
|
|
|
class APP_SETTINGS_BASE;
|
2009-07-30 11:04:07 +00:00
|
|
|
class BOARD;
|
2011-12-07 16:49:32 +01:00
|
|
|
class BOARD_CONNECTED_ITEM;
|
2020-01-12 20:44:19 -05:00
|
|
|
class COLOR_SETTINGS;
|
2024-04-27 22:57:24 +03:00
|
|
|
class EDA_ITEM;
|
2020-11-13 15:15:52 +00:00
|
|
|
class FOOTPRINT;
|
2020-11-12 22:30:02 +00:00
|
|
|
class PAD;
|
2021-06-19 18:28:45 +01:00
|
|
|
class EDA_3D_VIEWER_FRAME;
|
2009-07-30 11:04:07 +00:00
|
|
|
class GENERAL_COLLECTOR;
|
|
|
|
class GENERAL_COLLECTORS_GUIDE;
|
++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 00:15:33 -06:00
|
|
|
class BOARD_DESIGN_SETTINGS;
|
2024-07-08 22:00:53 -07:00
|
|
|
class LSET;
|
2012-02-05 23:44:19 -06:00
|
|
|
class ZONE_SETTINGS;
|
2012-04-05 13:27:56 -05:00
|
|
|
class PCB_PLOT_PARAMS;
|
2013-05-20 10:49:20 -04:00
|
|
|
class FP_LIB_TABLE;
|
2022-07-24 16:49:46 +01:00
|
|
|
class PCB_VIEWERS_SETTINGS_BASE;
|
2020-01-12 20:44:19 -05:00
|
|
|
class PCBNEW_SETTINGS;
|
2020-05-05 21:43:37 -04:00
|
|
|
class FOOTPRINT_EDITOR_SETTINGS;
|
2020-05-22 19:27:05 +01:00
|
|
|
struct MAGNETIC_SETTINGS;
|
2021-10-25 14:18:48 +02:00
|
|
|
class NL_PCBNEW_PLUGIN;
|
2021-11-25 11:19:03 -05:00
|
|
|
class PROGRESS_REPORTER;
|
2025-02-20 02:53:15 +00:00
|
|
|
class PCB_LAYER_BOX_SELECTOR;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2024-05-06 04:39:25 +03:00
|
|
|
#ifdef wxHAS_INOTIFY
|
|
|
|
#define wxFileSystemWatcher wxInotifyFileSystemWatcher
|
|
|
|
#elif defined( wxHAS_KQUEUE ) && defined( wxHAVE_FSEVENTS_FILE_NOTIFICATIONS )
|
|
|
|
#define wxFileSystemWatcher wxFsEventsFileSystemWatcher
|
|
|
|
#elif defined( wxHAS_KQUEUE )
|
|
|
|
#define wxFileSystemWatcher wxKqueueFileSystemWatcher
|
|
|
|
#elif defined( __WINDOWS__ )
|
|
|
|
#define wxFileSystemWatcher wxMSWFileSystemWatcher
|
|
|
|
#else
|
|
|
|
#define wxFileSystemWatcher wxPollingFileSystemWatcher
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class wxFileSystemWatcher;
|
|
|
|
class wxFileSystemWatcherEvent;
|
|
|
|
|
2023-03-13 12:03:48 -04:00
|
|
|
wxDECLARE_EVENT( EDA_EVT_BOARD_CHANGED, wxCommandEvent );
|
2020-04-13 10:27:47 +09:00
|
|
|
|
2011-09-26 16:32:56 -04:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
|
2011-09-26 16:32:56 -04:00
|
|
|
*/
|
2011-03-01 14:26:17 -05:00
|
|
|
class PCB_BASE_FRAME : public EDA_DRAW_FRAME
|
2009-07-30 11:04:07 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-04-19 13:47:20 -05:00
|
|
|
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
2020-12-19 18:29:10 -05:00
|
|
|
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
|
|
|
long aStyle, const wxString& aFrameName );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-03-01 14:26:17 -05:00
|
|
|
~PCB_BASE_FRAME();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2015-12-21 12:52:00 +01:00
|
|
|
/**
|
2019-06-04 11:28:05 +01:00
|
|
|
* @return a reference to the child 3D viewer frame, when exists, or NULL
|
2015-12-21 12:52:00 +01:00
|
|
|
*/
|
2021-06-19 18:28:45 +01:00
|
|
|
EDA_3D_VIEWER_FRAME* Get3DViewerFrame();
|
2015-12-21 12:52:00 +01:00
|
|
|
|
2018-05-10 12:49:20 +02:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Update the 3D view, if the viewer is opened by this frame.
|
|
|
|
*
|
2021-04-08 22:09:06 -04:00
|
|
|
* @param aMarkDirty alerts the 3D view that data is stale (it may not refresh instantly)
|
|
|
|
* @param aRefresh will tell the 3D view to refresh immediately
|
2022-08-31 00:28:18 +01:00
|
|
|
* @param aTitle is the new title of the 3D frame, or nullptr to do not change the frame title
|
2018-05-10 12:49:20 +02:00
|
|
|
*/
|
2022-08-31 00:28:18 +01:00
|
|
|
virtual void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr );
|
2020-09-02 17:54:57 +01:00
|
|
|
|
2013-11-22 20:47:10 +01:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Attempt to load \a aFootprintId from the footprint library table.
|
2013-11-22 20:47:10 +01:00
|
|
|
*
|
2016-11-20 18:35:08 -05:00
|
|
|
* @param aFootprintId is the #LIB_ID of component footprint to load.
|
2020-11-13 15:15:52 +00:00
|
|
|
* @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the
|
2014-05-09 13:35:48 -05:00
|
|
|
* libraries in table returned from #Prj().PcbFootprintLibs().
|
2013-11-22 20:47:10 +01:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* LoadFootprint( const LIB_ID& aFootprintId );
|
2013-11-22 20:47:10 +01:00
|
|
|
|
++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 00:15:33 -06:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Calculate the bounding box containing all board items (or board edge segments).
|
|
|
|
*
|
++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 00:15:33 -06:00
|
|
|
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
2020-12-19 18:29:10 -05:00
|
|
|
* @return the board's bounding box.
|
++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 00:15:33 -06:00
|
|
|
*/
|
2022-08-31 00:28:18 +01:00
|
|
|
BOX2I GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
|
++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 00:15:33 -06:00
|
|
|
|
2024-04-27 22:57:24 +03:00
|
|
|
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
|
2019-04-14 00:53:33 +01:00
|
|
|
|
2016-09-24 14:53:15 -04:00
|
|
|
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
|
|
|
|
const PAGE_INFO& GetPageSettings() const override;
|
2023-02-18 22:40:07 -05:00
|
|
|
const VECTOR2I GetPageSizeIU() const override;
|
2011-12-22 15:57:50 -06:00
|
|
|
|
2021-12-29 16:30:11 -05:00
|
|
|
const VECTOR2I& GetGridOrigin() const override;
|
|
|
|
void SetGridOrigin( const VECTOR2I& aPoint ) override;
|
2011-12-30 23:44:00 -06:00
|
|
|
|
2021-12-29 16:30:11 -05:00
|
|
|
const VECTOR2I& GetAuxOrigin() const;
|
2020-07-04 21:59:29 -04:00
|
|
|
|
2021-12-29 16:30:11 -05:00
|
|
|
const VECTOR2I GetUserOrigin() const;
|
2020-07-04 21:59:29 -04:00
|
|
|
|
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Return a reference to the default #ORIGIN_TRANSFORMS object.
|
2020-07-04 21:59:29 -04:00
|
|
|
*/
|
|
|
|
ORIGIN_TRANSFORMS& GetOriginTransforms() override;
|
|
|
|
|
2023-11-09 18:40:47 +00:00
|
|
|
wxString MessageTextFromCoord( int aValue, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType ) const
|
|
|
|
{
|
|
|
|
return MessageTextFromValue( m_originTransforms.ToDisplay( aValue, aCoordType ) );
|
|
|
|
}
|
|
|
|
|
2016-09-24 14:53:15 -04:00
|
|
|
const TITLE_BLOCK& GetTitleBlock() const override;
|
|
|
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
|
2012-01-09 02:35:06 -06:00
|
|
|
|
2012-02-02 11:45:37 -06:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Return the BOARD_DESIGN_SETTINGS for the open project.
|
2012-02-02 11:45:37 -06:00
|
|
|
*/
|
|
|
|
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
|
2012-02-05 23:44:19 -06:00
|
|
|
|
2020-01-12 20:44:19 -05:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Helper to retrieve the current color settings.
|
2020-01-12 20:44:19 -05:00
|
|
|
*/
|
2021-09-07 21:34:10 +01:00
|
|
|
virtual COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override
|
2020-05-05 21:45:48 -04:00
|
|
|
{
|
2025-01-10 20:30:25 -05:00
|
|
|
wxFAIL_MSG( wxT( "Color settings requested for a PCB_BASE_FRAME that does not "
|
|
|
|
"override!" ) );
|
2020-05-05 21:45:48 -04:00
|
|
|
return nullptr;
|
|
|
|
}
|
2020-01-12 20:44:19 -05:00
|
|
|
|
2021-07-26 13:28:37 -04:00
|
|
|
void SetDrawBgColor( const COLOR4D& aColor ) override;
|
2018-08-11 17:04:46 +01:00
|
|
|
|
2015-01-10 11:27:49 +01:00
|
|
|
/**
|
2020-06-12 11:58:56 +01:00
|
|
|
* Display options control the way tracks, vias, outlines and other things are shown
|
2020-12-19 18:29:10 -05:00
|
|
|
* (for instance solid or sketch mode).
|
2015-01-10 11:27:49 +01:00
|
|
|
*/
|
2020-09-30 23:02:05 +01:00
|
|
|
const PCB_DISPLAY_OPTIONS& GetDisplayOptions() const { return m_displayOptions; }
|
2021-03-14 11:29:24 -04:00
|
|
|
|
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Update the current display options.
|
|
|
|
*
|
|
|
|
* @param aOptions is the options struct to apply.
|
|
|
|
* @param aRefresh will refresh the view after updating.
|
2021-03-14 11:29:24 -04:00
|
|
|
*/
|
|
|
|
void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh = true );
|
2015-01-10 11:27:49 +01:00
|
|
|
|
2012-04-05 13:27:56 -05:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Return the #PCB_PLOT_PARAMS for the BOARD owned by this frame.
|
2012-04-05 13:27:56 -05:00
|
|
|
*/
|
|
|
|
virtual const PCB_PLOT_PARAMS& GetPlotSettings() const;
|
|
|
|
virtual void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings );
|
|
|
|
|
2023-05-31 13:37:58 -07:00
|
|
|
/**
|
|
|
|
* Reload the footprint from the library.
|
2025-01-10 20:30:25 -05:00
|
|
|
*
|
2023-05-31 13:37:58 -07:00
|
|
|
* @param aFootprint is the footprint to reload.
|
|
|
|
*/
|
|
|
|
virtual void ReloadFootprint( FOOTPRINT* aFootprint )
|
|
|
|
{
|
2025-01-10 20:30:25 -05:00
|
|
|
wxFAIL_MSG( wxT( "Attempted to reload a footprint for PCB_BASE_FRAME that does not "
|
|
|
|
"override!" ) );
|
2023-05-31 13:37:58 -07:00
|
|
|
}
|
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Set the #m_Pcb member in such as way as to ensure deleting any previous #BOARD.
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2021-11-25 11:19:03 -05:00
|
|
|
virtual void SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2012-02-02 11:45:37 -06:00
|
|
|
BOARD* GetBoard() const
|
2009-07-30 11:04:07 +00:00
|
|
|
{
|
2020-09-30 23:02:05 +01:00
|
|
|
wxASSERT( m_pcb );
|
|
|
|
return m_pcb;
|
2009-07-30 11:04:07 +00:00
|
|
|
}
|
|
|
|
|
2020-05-22 19:27:05 +01:00
|
|
|
/**
|
|
|
|
* @return the primary data model.
|
|
|
|
*/
|
|
|
|
virtual BOARD_ITEM_CONTAINER* GetModel() const = 0;
|
|
|
|
|
2025-05-19 21:36:46 +01:00
|
|
|
EDA_ITEM* ResolveItem( const KIID& aId, bool aAllowNullptrReturn = false ) const override;
|
2020-04-24 14:36:10 +01:00
|
|
|
|
2025-03-31 14:33:39 -04:00
|
|
|
void FocusOnItem( EDA_ITEM* aItem ) override;
|
2021-09-25 15:31:19 +01:00
|
|
|
void FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
|
2022-04-08 11:37:27 +01:00
|
|
|
void FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
|
2020-02-24 17:18:23 +00:00
|
|
|
|
2021-08-12 17:58:30 +01:00
|
|
|
void HideSolderMask();
|
|
|
|
void ShowSolderMask();
|
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
// General
|
2018-02-03 22:55:13 +00:00
|
|
|
virtual void ShowChangedLanguage() override;
|
2016-09-24 14:53:15 -04:00
|
|
|
virtual void UpdateStatusBar() override;
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2016-09-25 19:06:49 +02:00
|
|
|
PCB_SCREEN* GetScreen() const override { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2018-05-10 12:49:20 +02:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Show the 3D view frame.
|
2020-12-19 18:29:10 -05:00
|
|
|
*
|
|
|
|
* If it does not exist, it is created. If it exists, it is brought to the foreground.
|
2018-05-10 12:49:20 +02:00
|
|
|
*/
|
2021-06-19 18:28:45 +01:00
|
|
|
EDA_3D_VIEWER_FRAME* CreateAndShow3D_Frame();
|
2018-05-10 12:49:20 +02:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* @return global configuration options.
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
|
|
|
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
|
|
|
|
|
2013-11-27 00:04:04 -06:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Put up a dialog and allows the user to pick a library, for unspecified use.
|
2013-11-27 00:04:04 -06:00
|
|
|
*
|
2020-12-19 18:29:10 -05:00
|
|
|
* @param aNicknameExisting is the current choice to highlight.
|
|
|
|
* @return the library or wxEmptyString on abort.
|
2013-11-27 00:04:04 -06:00
|
|
|
*/
|
|
|
|
wxString SelectLibrary( const wxString& aNicknameExisting );
|
|
|
|
|
2010-11-12 09:17:10 -06:00
|
|
|
/**
|
2022-10-10 14:03:10 +01:00
|
|
|
* Must be called after a change in order to set the "modify" flag and update other data
|
|
|
|
* structures and GUI elements.
|
2010-02-19 13:23:58 +00:00
|
|
|
*/
|
2022-10-10 14:03:10 +01:00
|
|
|
void OnModify() override;
|
2010-02-19 13:23:58 +00:00
|
|
|
|
2010-11-12 09:17:10 -06:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Create a new footprint at position 0,0.
|
2020-12-19 18:29:10 -05:00
|
|
|
*
|
2020-11-08 21:29:04 +00:00
|
|
|
* The new footprint contains only 2 texts: a reference and a value:
|
2015-01-28 11:00:48 +01:00
|
|
|
* Reference = REF**
|
|
|
|
* Value = "VAL**" or Footprint name in lib
|
2020-12-19 18:29:10 -05:00
|
|
|
*
|
2025-01-10 20:30:25 -05:00
|
|
|
* @note They are dummy texts which will be replaced by the actual texts when the
|
2020-12-19 18:29:10 -05:00
|
|
|
* footprint is placed on a board and a netlist is read.
|
|
|
|
*
|
|
|
|
* @param aFootprintName is the name of the new footprint in library.
|
2023-09-06 12:49:14 +01:00
|
|
|
* @param aLibName optional, if specified is the library for the new footprint
|
2010-07-20 20:11:34 +02:00
|
|
|
*/
|
2024-05-31 10:17:17 +01:00
|
|
|
FOOTPRINT* CreateNewFootprint( wxString aFootprintName, const wxString& aLibName );
|
2010-12-28 12:24:42 +01:00
|
|
|
|
2011-09-16 10:13:02 -04:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Place \a aFootprint at the current cursor position and updates footprint coordinates
|
2011-09-16 10:13:02 -04:00
|
|
|
* with the new position.
|
|
|
|
*
|
2020-11-13 11:17:15 +00:00
|
|
|
* @param aRecreateRatsnest A bool true redraws the footprint ratsnest.
|
2011-09-16 10:13:02 -04:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
void PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest = true );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
void ShowPadPropertiesDialog( PAD* aPad );
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2012-02-09 21:33:38 +01:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Open a dialog to select a footprint.
|
2012-04-16 20:35:43 -05:00
|
|
|
*
|
2020-12-19 18:29:10 -05:00
|
|
|
* @param aPreslect if valid, the #LIB_ID to select (otherwise the global history is used).
|
2018-04-02 22:31:45 +01:00
|
|
|
*/
|
2023-09-26 18:31:45 +01:00
|
|
|
FOOTPRINT* SelectFootprintFromLibrary( LIB_ID aPreselect = LIB_ID() );
|
2018-04-02 22:31:45 +01:00
|
|
|
|
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Add the given footprint to the board.
|
|
|
|
*
|
|
|
|
* @param aDC is the current Device Context, to draw the new footprint (can be NULL ).
|
2012-02-09 21:33:38 +01:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
virtual void AddFootprintToBoard( FOOTPRINT* aFootprint );
|
2012-02-09 21:33:38 +01:00
|
|
|
|
2010-12-29 18:47:32 +01:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Create the entire board ratsnest.
|
|
|
|
*
|
|
|
|
* This must be called after a board change (changes for pads, footprints or a read
|
|
|
|
* netlist ).
|
|
|
|
*
|
|
|
|
* @param aDisplayStatus if true, display the computation results.
|
2010-12-29 18:47:32 +01:00
|
|
|
*/
|
2019-05-30 16:11:17 +01:00
|
|
|
void Compile_Ratsnest( bool aDisplayStatus );
|
2010-12-29 18:47:32 +01:00
|
|
|
|
2010-11-12 09:17:10 -06:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* Create a new entry in undo list of commands.
|
|
|
|
*
|
|
|
|
* @param aItemToCopy is the board item modified by the command to undo.
|
|
|
|
* @param aTypeCommand is the command type (see enum #UNDO_REDO).
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2023-09-27 16:36:49 +01:00
|
|
|
virtual void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand ) {};
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 09:17:10 -06:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Create a new entry in undo list of commands.
|
2020-12-19 18:29:10 -05:00
|
|
|
*
|
|
|
|
* @param aItemsList is the list of items modified by the command to undo.
|
|
|
|
* @param aTypeCommand is the command type (see enum #UNDO_REDO)
|
2009-08-03 18:54:48 +00:00
|
|
|
*/
|
2021-07-26 13:28:37 -04:00
|
|
|
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
2023-09-27 16:36:49 +01:00
|
|
|
UNDO_REDO aTypeCommand ) {};
|
2009-08-03 18:54:48 +00:00
|
|
|
|
2022-02-25 13:05:25 +00:00
|
|
|
/**
|
|
|
|
* As SaveCopyInUndoList, but appends the changes to the last undo item on the stack.
|
|
|
|
*/
|
|
|
|
virtual void AppendCopyToUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
2023-09-27 16:36:49 +01:00
|
|
|
UNDO_REDO aTypeCommand ) {};
|
2022-02-25 13:05:25 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2020-12-19 18:29:10 -05:00
|
|
|
/**
|
2021-02-17 20:47:28 +01:00
|
|
|
* Show the dialog box for a layer selection.
|
2020-12-19 18:29:10 -05:00
|
|
|
*
|
2021-02-17 20:47:28 +01:00
|
|
|
* @param aDefaultLayer is the default layer to select. Use UNDEFINED_LAYER if no selection
|
2020-12-19 18:29:10 -05:00
|
|
|
* is desired.
|
|
|
|
* @param aNotAllowedLayersMask is a layer mask for not allowed layers. Use 0 to show all
|
|
|
|
* layers in use.
|
|
|
|
* @param aDlgPosition is the position of dialog (default is centered).
|
|
|
|
* @return the selected layer id.
|
2013-09-11 17:30:21 +02:00
|
|
|
*/
|
2025-03-23 20:33:22 +00:00
|
|
|
PCB_LAYER_ID SelectOneLayer( PCB_LAYER_ID aDefaultLayer,
|
|
|
|
const LSET& aNotAllowedLayersMask = LSET(),
|
2023-09-27 16:36:49 +01:00
|
|
|
wxPoint aDlgPosition = wxDefaultPosition );
|
2013-09-11 17:30:21 +02:00
|
|
|
|
2021-12-09 10:14:11 -08:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Change the active layer in the frame.
|
2021-12-09 10:14:11 -08:00
|
|
|
*
|
2025-01-10 20:30:25 -05:00
|
|
|
* @param aLayer New layer to make active.
|
2021-12-09 10:14:11 -08:00
|
|
|
*/
|
|
|
|
virtual void SwitchLayer( PCB_LAYER_ID aLayer );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2021-06-17 12:21:06 +01:00
|
|
|
virtual void SetActiveLayer( PCB_LAYER_ID aLayer ) { GetScreen()->m_Active_Layer = aLayer; }
|
|
|
|
virtual PCB_LAYER_ID GetActiveLayer() const { return GetScreen()->m_Active_Layer; }
|
2014-07-09 11:50:27 +02:00
|
|
|
|
2020-12-14 13:33:51 +00:00
|
|
|
SEVERITY GetSeverity( int aErrorCode ) const override;
|
2020-06-17 13:46:50 +01:00
|
|
|
|
2020-07-11 13:40:23 -04:00
|
|
|
virtual void OnDisplayOptionsChanged() {}
|
|
|
|
|
2020-01-12 20:44:19 -05:00
|
|
|
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
|
|
|
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
|
|
|
|
2020-12-23 23:18:02 +00:00
|
|
|
PCBNEW_SETTINGS* GetPcbNewSettings() const;
|
2020-05-05 21:43:37 -04:00
|
|
|
|
2020-12-23 23:18:02 +00:00
|
|
|
FOOTPRINT_EDITOR_SETTINGS* GetFootprintEditorSettings() const;
|
2009-10-14 19:43:31 +00:00
|
|
|
|
2022-07-24 16:49:46 +01:00
|
|
|
virtual PCB_VIEWERS_SETTINGS_BASE* GetViewerSettingsBase() const;
|
|
|
|
|
2020-05-22 19:27:05 +01:00
|
|
|
virtual MAGNETIC_SETTINGS* GetMagneticItemsSettings();
|
2018-09-25 20:23:54 +01:00
|
|
|
|
2025-02-01 20:00:40 +00:00
|
|
|
void CommonSettingsChanged( int aFlags ) override;
|
2011-02-21 08:54:29 -05:00
|
|
|
|
2019-06-13 18:28:55 +01:00
|
|
|
PCB_DRAW_PANEL_GAL* GetCanvas() const override;
|
|
|
|
|
2019-05-30 13:25:08 +01:00
|
|
|
virtual void ActivateGalCanvas() override;
|
2017-01-14 14:43:45 +01:00
|
|
|
|
2023-03-13 13:59:01 -04:00
|
|
|
/**
|
|
|
|
* Add \a aListener to post #EDA_EVT_BOARD_CHANGED command events to.
|
|
|
|
*
|
2025-01-10 20:30:25 -05:00
|
|
|
* @warning The caller is responsible for removing any listeners that are no long valid.
|
2023-03-13 13:59:01 -04:00
|
|
|
*
|
|
|
|
* @note This only gets called when the board editor is in stand alone mode. Changing
|
|
|
|
* projects in the project manager closes the board editor when a new project is
|
|
|
|
* loaded.
|
|
|
|
*/
|
2023-03-13 12:03:48 -04:00
|
|
|
void AddBoardChangeListener( wxEvtHandler* aListener );
|
|
|
|
|
2023-03-13 13:59:01 -04:00
|
|
|
/**
|
|
|
|
* Remove \a aListener to from the board changed listener list.
|
|
|
|
*/
|
2023-03-13 12:03:48 -04:00
|
|
|
void RemoveBoardChangeListener( wxEvtHandler* aListener );
|
|
|
|
|
2023-05-31 13:37:58 -07:00
|
|
|
/**
|
|
|
|
* Handler for FP change events. Responds to the filesystem watcher set in #setFPWatcher.
|
|
|
|
*/
|
|
|
|
void OnFPChange( wxFileSystemWatcherEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler for the filesystem watcher debounce timer.
|
|
|
|
*/
|
|
|
|
void OnFpChangeDebounceTimer( wxTimerEvent& aEvent );
|
|
|
|
|
2020-12-19 18:29:10 -05:00
|
|
|
protected:
|
2021-06-17 12:21:06 +01:00
|
|
|
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
2020-12-19 18:29:10 -05:00
|
|
|
|
2021-10-25 14:18:48 +02:00
|
|
|
void handleActivateEvent( wxActivateEvent& aEvent ) override;
|
|
|
|
|
2022-03-31 19:03:41 +00:00
|
|
|
void handleIconizeEvent( wxIconizeEvent& aEvent ) override;
|
|
|
|
|
2022-12-16 16:37:32 -05:00
|
|
|
virtual void doReCreateMenuBar() override;
|
|
|
|
|
2020-12-19 18:29:10 -05:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Attempt to load \a aFootprintId from the footprint library table.
|
2020-12-19 18:29:10 -05:00
|
|
|
*
|
|
|
|
* @param aFootprintId is the #LIB_ID of component footprint to load.
|
|
|
|
* @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the
|
|
|
|
* libraries in the table returned from #Prj().PcbFootprintLibs().
|
|
|
|
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
|
|
|
|
* occurs while reading footprint library files.
|
|
|
|
*/
|
|
|
|
FOOTPRINT* loadFootprint( const LIB_ID& aFootprintId );
|
|
|
|
|
2021-06-17 12:21:06 +01:00
|
|
|
virtual void unitsChangeRefresh() override;
|
|
|
|
|
2022-11-30 12:18:58 +00:00
|
|
|
void rebuildConnectivity();
|
|
|
|
|
2023-05-31 13:37:58 -07:00
|
|
|
/**
|
2025-01-10 20:30:25 -05:00
|
|
|
* Create or removes a watcher on the specified footprint.
|
|
|
|
*
|
2023-05-31 13:37:58 -07:00
|
|
|
* @param aFootprint If nullptr, the watcher is removed. Otherwise, set a change watcher
|
|
|
|
*/
|
|
|
|
void setFPWatcher( FOOTPRINT* aFootprint );
|
|
|
|
|
2021-06-17 12:21:06 +01:00
|
|
|
protected:
|
2020-12-19 18:29:10 -05:00
|
|
|
BOARD* m_pcb;
|
|
|
|
PCB_DISPLAY_OPTIONS m_displayOptions;
|
|
|
|
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
2021-10-25 14:18:48 +02:00
|
|
|
|
|
|
|
private:
|
2025-07-13 16:39:50 +01:00
|
|
|
std::unique_ptr<NL_PCBNEW_PLUGIN> m_spaceMouse;
|
2023-03-13 12:03:48 -04:00
|
|
|
|
2025-07-13 16:39:50 +01:00
|
|
|
std::unique_ptr<wxFileSystemWatcher> m_watcher;
|
|
|
|
wxFileName m_watcherFileName;
|
|
|
|
wxDateTime m_watcherLastModified;
|
|
|
|
wxTimer m_watcherDebounceTimer;
|
|
|
|
bool m_inFpChangeTimerEvent;
|
2023-05-31 13:37:58 -07:00
|
|
|
|
2023-03-13 12:03:48 -04:00
|
|
|
std::vector<wxEvtHandler*> m_boardChangeListeners;
|
2009-07-30 11:04:07 +00:00
|
|
|
};
|
|
|
|
|
2018-01-29 13:38:23 +01:00
|
|
|
#endif // PCB_BASE_FRAME_H
|