2011-10-15 13:25:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-17 14:36:04 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2011-10-15 13:25:57 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
2020-02-20 12:11:04 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-15 13:25:57 +00: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
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* 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
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
|
|
|
#include <dialog_helpers.h>
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <pcb_base_frame.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
2018-09-25 19:23:54 +00:00
|
|
|
#include <pgm_base.h>
|
2019-05-28 23:23:58 +00:00
|
|
|
#include <3d_viewer/eda_3d_viewer.h> // To include VIEWER3D_FRAMENAME
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
2020-05-06 01:45:48 +00:00
|
|
|
#include <footprint_editor_settings.h>
|
* 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
|
|
|
#include <fp_lib_table.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <class_board.h>
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_drawsegment.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <collectors.h>
|
2014-07-09 08:57:32 +00:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2013-03-28 16:30:09 +00:00
|
|
|
#include <math/vector2d.h>
|
2013-05-01 17:32:36 +00:00
|
|
|
#include <trigo.h>
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
#include <pcb_painter.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/settings_manager.h>
|
|
|
|
#include <pcbnew_settings.h>
|
2013-08-02 14:53:50 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tool/tool_dispatcher.h>
|
2018-07-22 23:53:05 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2020-06-12 10:58:56 +00:00
|
|
|
#include <tool/grid_menu.h>
|
2020-06-17 12:46:50 +00:00
|
|
|
#include "cleanup_item.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2020-04-13 01:27:47 +00:00
|
|
|
wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2014-04-19 18:47:20 +00:00
|
|
|
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
* 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
|
|
|
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
|
|
|
long aStyle, const wxString & aFrameName ) :
|
2017-09-10 14:21:56 +00:00
|
|
|
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
2020-01-13 01:44:19 +00:00
|
|
|
m_Pcb( nullptr )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2020-01-13 01:44:19 +00:00
|
|
|
m_Settings = static_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_BASE_FRAME::~PCB_BASE_FRAME()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-01-11 12:19:46 +00:00
|
|
|
// Ensure m_canvasType is up to date, to save it in config
|
2019-06-13 17:28:55 +00:00
|
|
|
m_canvasType = GetCanvas()->GetBackend();
|
2019-01-11 12:19:46 +00:00
|
|
|
|
2014-07-09 12:01:06 +00:00
|
|
|
delete m_Pcb;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
EDA_3D_VIEWER* PCB_BASE_FRAME::Get3DViewerFrame()
|
2015-12-21 11:52:00 +00:00
|
|
|
{
|
2019-06-05 19:37:24 +00:00
|
|
|
return dynamic_cast<EDA_3D_VIEWER*>( FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) ) );
|
2015-12-21 11:52:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-02 14:34:19 +00:00
|
|
|
void PCB_BASE_FRAME::Update3DView( bool aForceReload, const wxString* aTitle )
|
2018-05-10 10:49:20 +00:00
|
|
|
{
|
|
|
|
EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
|
|
|
|
|
2019-06-04 10:28:05 +00:00
|
|
|
if( draw3DFrame )
|
|
|
|
{
|
|
|
|
if( aTitle )
|
|
|
|
draw3DFrame->SetTitle( *aTitle );
|
2018-05-10 10:49:20 +00:00
|
|
|
|
2019-06-04 10:28:05 +00:00
|
|
|
draw3DFrame->NewDisplay( aForceReload );
|
|
|
|
}
|
2018-05-10 10:49:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-09 18:35:48 +00:00
|
|
|
FP_LIB_TABLE* PROJECT::PcbFootprintLibs()
|
* 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
|
|
|
{
|
2014-05-09 18:35:48 +00:00
|
|
|
// This is a lazy loading function, it loads the project specific table when
|
|
|
|
// that table is asked for, not before.
|
|
|
|
|
|
|
|
FP_LIB_TABLE* tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL );
|
|
|
|
|
|
|
|
// its gotta be NULL or a FP_LIB_TABLE, or a bug.
|
2018-09-15 11:05:54 +00:00
|
|
|
wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
|
* 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
|
|
|
|
|
|
|
if( !tbl )
|
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
|
|
|
|
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
|
|
|
// stack this way, all using the same global fallback table.
|
* 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
|
|
|
tbl = new FP_LIB_TABLE( &GFootprintTable );
|
2014-03-21 01:24:35 +00:00
|
|
|
|
2014-05-09 18:35:48 +00:00
|
|
|
SetElem( ELEM_FPTBL, tbl );
|
|
|
|
|
|
|
|
wxString projectFpLibTableFileName = FootprintLibTblName();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
tbl->Load( projectFpLibTableFileName );
|
|
|
|
}
|
|
|
|
catch( const IO_ERROR& ioe )
|
|
|
|
{
|
2019-05-28 23:23:58 +00:00
|
|
|
DisplayErrorMessage( nullptr, _( "Error loading project footprint libraries" ),
|
2017-07-20 14:06:41 +00:00
|
|
|
ioe.What() );
|
2014-05-09 18:35:48 +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
|
|
|
}
|
|
|
|
|
|
|
|
return tbl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
2008-03-04 04:22:27 +00:00
|
|
|
{
|
2014-07-09 08:57:32 +00:00
|
|
|
if( m_Pcb != aBoard )
|
|
|
|
{
|
|
|
|
delete m_Pcb;
|
|
|
|
m_Pcb = aBoard;
|
2020-04-13 01:27:47 +00:00
|
|
|
|
|
|
|
wxCommandEvent e( BOARD_CHANGED );
|
|
|
|
ProcessEventLocally( e );
|
2014-07-09 08:57:32 +00:00
|
|
|
}
|
2008-03-04 04:22:27 +00:00
|
|
|
}
|
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2018-09-25 14:23:38 +00:00
|
|
|
void PCB_BASE_FRAME::AddModuleToBoard( MODULE* module )
|
|
|
|
{
|
|
|
|
if( module )
|
|
|
|
{
|
2019-12-28 00:55:11 +00:00
|
|
|
GetBoard()->Add( module, ADD_MODE::APPEND );
|
2018-09-25 14:23:38 +00:00
|
|
|
|
|
|
|
module->SetFlags( IS_NEW );
|
2019-09-05 15:24:51 +00:00
|
|
|
module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
|
2018-09-25 14:23:38 +00:00
|
|
|
|
2019-09-05 15:24:51 +00:00
|
|
|
// Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
|
|
|
|
// built from a board)
|
2018-09-25 14:23:38 +00:00
|
|
|
if( module->IsFlipped() )
|
2020-01-13 01:44:19 +00:00
|
|
|
module->Flip( module->GetPosition(), m_Settings->m_FlipLeftRight );
|
2018-09-25 14:23:38 +00:00
|
|
|
|
2019-09-05 15:24:51 +00:00
|
|
|
// Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
|
|
|
|
// it might be stored in another orientation if the lib is an archive built from a board)
|
2018-09-25 14:23:38 +00:00
|
|
|
module->SetOrientation( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-24 13:36:10 +00:00
|
|
|
EDA_ITEM* PCB_BASE_FRAME::GetItem( const KIID& aId )
|
|
|
|
{
|
|
|
|
return GetBoard()->GetItem( aId );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-24 17:18:23 +00:00
|
|
|
void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
static KIID lastBrightenedItemID( niluuid );
|
|
|
|
|
|
|
|
BOARD_ITEM* lastItem = GetBoard()->GetItem( lastBrightenedItemID );
|
|
|
|
|
|
|
|
if( lastItem && lastItem != aItem )
|
|
|
|
{
|
|
|
|
lastItem->ClearBrightened();
|
|
|
|
|
|
|
|
if( lastItem->Type() == PCB_MODULE_T )
|
|
|
|
{
|
|
|
|
static_cast<MODULE*>( lastItem )->RunOnChildren( [&] ( BOARD_ITEM* child )
|
|
|
|
{
|
|
|
|
child->ClearBrightened();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
GetCanvas()->GetView()->Update( lastItem );
|
|
|
|
lastBrightenedItemID = niluuid;
|
|
|
|
GetCanvas()->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aItem )
|
|
|
|
{
|
|
|
|
aItem->SetBrightened();
|
|
|
|
|
|
|
|
if( aItem->Type() == PCB_MODULE_T )
|
|
|
|
{
|
|
|
|
static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM* child )
|
|
|
|
{
|
|
|
|
child->SetBrightened();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
GetCanvas()->GetView()->Update( aItem );
|
|
|
|
lastBrightenedItemID = aItem->m_Uuid;
|
2020-04-27 16:22:42 +00:00
|
|
|
FocusOnLocation( aItem->GetFocusPosition() );
|
2020-02-24 17:18:23 +00:00
|
|
|
GetCanvas()->Refresh();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetPageSettings( aPageSettings );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
|
|
|
if( GetScreen() )
|
|
|
|
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
|
2011-12-22 21:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const PAGE_INFO& PCB_BASE_FRAME::GetPageSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetPageSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// this function is only needed because EDA_DRAW_FRAME is not compiled
|
|
|
|
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
|
|
|
|
// into an application specific source file.
|
|
|
|
return m_Pcb->GetPageSettings().GetSizeIU();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
2020-07-01 12:28:10 +00:00
|
|
|
return m_Pcb->GetDesignSettings().m_GridOrigin;
|
2013-08-03 05:15:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
2020-07-01 12:28:10 +00:00
|
|
|
m_Pcb->GetDesignSettings().m_GridOrigin = aPoint;
|
2011-12-22 21:57:50 +00:00
|
|
|
}
|
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
const TITLE_BLOCK& PCB_BASE_FRAME::GetTitleBlock() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetTitleBlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetTitleBlock( aTitleBlock );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-02 17:45:37 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& PCB_BASE_FRAME::GetDesignSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetDesignSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
void PCB_BASE_FRAME::SetDrawBgColor( COLOR4D aColor )
|
|
|
|
{
|
|
|
|
m_drawBgColor= aColor;
|
|
|
|
m_auimgr.Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
const ZONE_SETTINGS& PCB_BASE_FRAME::GetZoneSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
2020-05-31 21:42:04 +00:00
|
|
|
return m_Pcb->GetDesignSettings().GetDefaultZoneSettings();
|
2012-02-06 05:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetZoneSettings( const ZONE_SETTINGS& aSettings )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
2020-05-31 21:42:04 +00:00
|
|
|
m_Pcb->GetDesignSettings().SetDefaultZoneSettings( aSettings );
|
2012-02-06 05:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
const PCB_PLOT_PARAMS& PCB_BASE_FRAME::GetPlotSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetPlotOptions();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetPlotOptions( aSettings );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
++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
|
|
|
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
|
2017-02-23 04:31:26 +00:00
|
|
|
EDA_RECT area = aBoardEdgesOnly ? m_Pcb->GetBoardEdgesBoundingBox() : m_Pcb->GetBoundingBox();
|
++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
|
|
|
|
|
|
|
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
|
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
wxSize pageSize = GetPageSizeIU();
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_showBorderAndTitleBlock )
|
++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
|
|
|
{
|
|
|
|
area.SetOrigin( 0, 0 );
|
2011-12-22 21:57:50 +00:00
|
|
|
area.SetEnd( pageSize.x, pageSize.y );
|
++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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
|
|
|
|
area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
|
++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 area;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 16:16:48 +00:00
|
|
|
// Virtual function
|
2018-09-25 19:23:54 +00:00
|
|
|
void PCB_BASE_FRAME::ReCreateMenuBar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-03 22:55:13 +00:00
|
|
|
void PCB_BASE_FRAME::ShowChangedLanguage()
|
|
|
|
{
|
|
|
|
// call my base class
|
|
|
|
EDA_DRAW_FRAME::ShowChangedLanguage();
|
|
|
|
|
|
|
|
// tooltips in toolbars
|
2019-07-20 15:52:30 +00:00
|
|
|
RecreateToolbars();
|
2018-02-03 22:55:13 +00:00
|
|
|
|
|
|
|
// status bar
|
|
|
|
UpdateMsgPanel();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-02 14:34:19 +00:00
|
|
|
EDA_3D_VIEWER* PCB_BASE_FRAME::CreateAndShow3D_Frame()
|
2018-05-10 10:49:20 +00:00
|
|
|
{
|
|
|
|
EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
|
|
|
|
|
|
|
|
if( !draw3DFrame )
|
|
|
|
draw3DFrame = new EDA_3D_VIEWER( &Kiway(), this, _( "3D Viewer" ) );
|
|
|
|
|
2019-05-28 23:23:58 +00:00
|
|
|
// Raising the window does not show the window on Windows if iconized. This should work
|
|
|
|
// on any platform.
|
2018-05-10 10:49:20 +00:00
|
|
|
if( draw3DFrame->IsIconized() )
|
|
|
|
draw3DFrame->Iconize( false );
|
|
|
|
|
|
|
|
draw3DFrame->Raise();
|
2019-06-02 14:34:19 +00:00
|
|
|
draw3DFrame->Show( true );
|
2018-05-10 10:49:20 +00:00
|
|
|
|
|
|
|
// Raising the window does not set the focus on Linux. This should work on any platform.
|
|
|
|
if( wxWindow::FindFocus() != draw3DFrame )
|
|
|
|
draw3DFrame->SetFocus();
|
|
|
|
|
2019-06-02 14:34:19 +00:00
|
|
|
return draw3DFrame;
|
2018-05-10 10:49:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
// Note: virtual, overridden in PCB_EDIT_FRAME;
|
2017-03-13 03:19:33 +00:00
|
|
|
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
|
2007-06-15 12:04:24 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID preslayer = GetActiveLayer();
|
2019-11-07 14:23:09 +00:00
|
|
|
auto& displ_opts = GetDisplayOptions();
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Check if the specified layer matches the present layer
|
|
|
|
if( layer == preslayer )
|
2007-09-05 04:48:47 +00:00
|
|
|
return;
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2019-05-28 23:23:58 +00:00
|
|
|
// Copper layers cannot be selected unconditionally; how many of those layers are
|
|
|
|
// currently enabled needs to be checked.
|
2013-04-09 16:00:46 +00:00
|
|
|
if( IsCopperLayer( layer ) )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
2019-05-28 23:23:58 +00:00
|
|
|
// If only one copper layer is enabled, the only such layer that can be selected to
|
|
|
|
// is the "Copper" layer (so the selection of any other copper layer is disregarded).
|
2010-01-31 20:01:46 +00:00
|
|
|
if( m_Pcb->GetCopperLayerCount() < 2 )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( layer != B_Cu )
|
2007-10-10 21:35:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-05-28 23:23:58 +00:00
|
|
|
// If more than one copper layer is enabled, the "Copper" and "Component" layers
|
|
|
|
// can be selected, but the total number of copper layers determines which internal
|
2007-10-10 21:35:41 +00:00
|
|
|
// layers are also capable of being selected.
|
|
|
|
else
|
|
|
|
{
|
2019-05-28 23:23:58 +00:00
|
|
|
if( layer != B_Cu && layer != F_Cu && layer >= ( m_Pcb->GetCopperLayerCount() - 1 ) )
|
2007-10-10 21:35:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 23:23:58 +00:00
|
|
|
// Is yet more checking required? E.g. when the layer to be selected is a non-copper
|
|
|
|
// layer, or when switching between a copper layer and a non-copper layer, or vice-versa?
|
2007-10-10 21:35:41 +00:00
|
|
|
// ...
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2019-08-28 04:27:39 +00:00
|
|
|
SetActiveLayer( layer );
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2019-11-07 14:23:09 +00:00
|
|
|
if( displ_opts.m_ContrastModeDisplay )
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->Refresh();
|
2007-06-15 12:04:24 +00:00
|
|
|
}
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
|
2007-09-05 04:48:47 +00:00
|
|
|
{
|
2018-11-17 00:34:12 +00:00
|
|
|
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->GetVisibleLayers(), GetActiveLayer(),
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->GetView() );
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
// account for the globals
|
2017-03-13 03:19:33 +00:00
|
|
|
guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_INVISIBLE ) );
|
|
|
|
guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_BK ) );
|
|
|
|
guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_TEXT_FR ) );
|
|
|
|
guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( LAYER_MOD_BK ) );
|
|
|
|
guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( LAYER_MOD_FR ) );
|
|
|
|
guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( LAYER_PAD_BK ) );
|
|
|
|
guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
|
2018-11-11 20:06:23 +00:00
|
|
|
guide.SetIgnoreThroughHolePads( ! m_Pcb->IsElementVisible( LAYER_PADS_TH ) );
|
2017-03-13 03:19:33 +00:00
|
|
|
guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
|
|
|
|
guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
|
2018-01-18 02:12:51 +00:00
|
|
|
guide.SetIgnoreThroughVias( ! m_Pcb->IsElementVisible( LAYER_VIA_THROUGH ) );
|
|
|
|
guide.SetIgnoreBlindBuriedVias( ! m_Pcb->IsElementVisible( LAYER_VIA_BBLIND ) );
|
|
|
|
guide.SetIgnoreMicroVias( ! m_Pcb->IsElementVisible( LAYER_VIA_MICROVIA ) );
|
2018-02-22 06:53:16 +00:00
|
|
|
guide.SetIgnoreTracks( ! m_Pcb->IsElementVisible( LAYER_TRACKS ) );
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
return guide;
|
|
|
|
}
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2019-05-24 13:55:33 +00:00
|
|
|
/*
|
|
|
|
* Display the grid status.
|
|
|
|
*/
|
|
|
|
void PCB_BASE_FRAME::DisplayGridMsg()
|
|
|
|
{
|
|
|
|
wxString line;
|
|
|
|
wxString gridformatter;
|
|
|
|
|
|
|
|
switch( m_userUnits )
|
|
|
|
{
|
2020-06-12 10:58:56 +00:00
|
|
|
case EDA_UNITS::INCHES: gridformatter = "grid X %.6f Y %.6f"; break;
|
|
|
|
case EDA_UNITS::MILLIMETRES: gridformatter = "grid X %.6f Y %.6f"; break;
|
|
|
|
default: gridformatter = "grid X %f Y %f"; break;
|
2019-05-24 13:55:33 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
double grid_x = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x );
|
|
|
|
double grid_y = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().y );
|
2019-05-24 13:55:33 +00:00
|
|
|
line.Printf( gridformatter, grid_x, grid_y );
|
|
|
|
|
|
|
|
SetStatusText( line, 4 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-31 10:05:16 +00:00
|
|
|
/*
|
|
|
|
* Update the status bar information.
|
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::UpdateStatusBar()
|
2008-12-19 13:51:48 +00:00
|
|
|
{
|
2019-06-13 13:34:38 +00:00
|
|
|
EDA_DRAW_FRAME::UpdateStatusBar();
|
|
|
|
|
|
|
|
BASE_SCREEN* screen = GetScreen();
|
2012-04-13 18:51:24 +00:00
|
|
|
|
|
|
|
if( !screen )
|
|
|
|
return;
|
2011-02-05 02:21:11 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
wxString line;
|
2019-06-13 17:28:55 +00:00
|
|
|
VECTOR2D cursorPos = GetCanvas()->GetViewControls()->GetCursorPosition();
|
2015-01-06 07:38:58 +00:00
|
|
|
|
2019-05-17 11:52:38 +00:00
|
|
|
if( GetShowPolarCoords() ) // display polar coordinates
|
2012-04-13 18:51:24 +00:00
|
|
|
{
|
2019-06-13 13:34:38 +00:00
|
|
|
double dx = cursorPos.x - screen->m_LocalOrigin.x;
|
|
|
|
double dy = cursorPos.y - screen->m_LocalOrigin.y;
|
|
|
|
double theta = RAD2DEG( atan2( -dy, dx ) );
|
|
|
|
double ro = hypot( dx, dy );
|
2010-07-12 14:07:09 +00:00
|
|
|
wxString formatter;
|
2019-06-13 13:34:38 +00:00
|
|
|
|
2018-06-14 08:26:11 +00:00
|
|
|
switch( GetUserUnits() )
|
2010-07-12 14:07:09 +00:00
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
case EDA_UNITS::INCHES:
|
|
|
|
formatter = wxT( "r %.6f theta %.1f" );
|
|
|
|
break;
|
|
|
|
case EDA_UNITS::MILLIMETRES:
|
|
|
|
formatter = wxT( "r %.6f theta %.1f" );
|
|
|
|
break;
|
|
|
|
case EDA_UNITS::UNSCALED:
|
|
|
|
formatter = wxT( "r %f theta %f" );
|
|
|
|
break;
|
2019-06-29 16:46:25 +00:00
|
|
|
default: wxASSERT( false ); break;
|
2010-07-12 14:07:09 +00:00
|
|
|
}
|
|
|
|
|
2018-06-14 08:26:11 +00:00
|
|
|
line.Printf( formatter, To_User_Unit( GetUserUnits(), ro ), theta );
|
2009-04-09 18:16:16 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
SetStatusText( line, 3 );
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// Display absolute coordinates:
|
2019-06-13 13:34:38 +00:00
|
|
|
double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x );
|
|
|
|
double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// The following sadly is an if Eeschema/if Pcbnew
|
|
|
|
wxString absformatter;
|
2019-06-13 13:34:38 +00:00
|
|
|
wxString locformatter;
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2018-06-14 08:26:11 +00:00
|
|
|
switch( GetUserUnits() )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
case EDA_UNITS::INCHES:
|
2019-02-14 09:55:57 +00:00
|
|
|
absformatter = "X %.6f Y %.6f";
|
|
|
|
locformatter = "dx %.6f dy %.6f dist %.4f";
|
2012-05-06 23:32:01 +00:00
|
|
|
break;
|
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
case EDA_UNITS::MILLIMETRES:
|
2019-02-14 09:55:57 +00:00
|
|
|
absformatter = "X %.6f Y %.6f";
|
|
|
|
locformatter = "dx %.6f dy %.6f dist %.3f";
|
2012-05-06 23:32:01 +00:00
|
|
|
break;
|
2012-05-04 17:44:42 +00:00
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
case EDA_UNITS::UNSCALED:
|
2019-02-14 09:55:57 +00:00
|
|
|
absformatter = "X %f Y %f";
|
|
|
|
locformatter = "dx %f dy %f dist %f";
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
2015-02-19 15:03:45 +00:00
|
|
|
|
2019-06-29 16:46:25 +00:00
|
|
|
default:
|
2015-02-19 15:03:45 +00:00
|
|
|
wxASSERT( false );
|
|
|
|
break;
|
2012-04-13 18:51:24 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
line.Printf( absformatter, dXpos, dYpos );
|
|
|
|
SetStatusText( line, 2 );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2019-05-17 11:52:38 +00:00
|
|
|
if( !GetShowPolarCoords() ) // display relative cartesian coordinates
|
2012-04-13 18:51:24 +00:00
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
// Display relative coordinates:
|
2019-06-13 13:34:38 +00:00
|
|
|
dXpos = To_User_Unit( GetUserUnits(), cursorPos.x - screen->m_LocalOrigin.x );
|
|
|
|
dYpos = To_User_Unit( GetUserUnits(), cursorPos.y - screen->m_LocalOrigin.y );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// We already decided the formatter above
|
2013-05-01 17:32:36 +00:00
|
|
|
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
|
2012-05-04 17:44:42 +00:00
|
|
|
SetStatusText( line, 3 );
|
|
|
|
}
|
2019-05-24 13:55:33 +00:00
|
|
|
|
|
|
|
DisplayGridMsg();
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::unitsChangeRefresh()
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
|
|
|
|
|
2020-05-22 18:27:05 +00:00
|
|
|
// Notify all tools the units have changed
|
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->RunAction( PCB_ACTIONS::updateUnits, true );
|
|
|
|
|
2018-11-23 23:33:02 +00:00
|
|
|
UpdateGridSelectBox();
|
2011-03-01 19:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
2009-04-05 20:49:15 +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
|
|
|
EDA_DRAW_FRAME::LoadSettings( aCfg );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
if( aCfg->m_Window.grid.sizes.empty() )
|
|
|
|
{
|
|
|
|
aCfg->m_Window.grid.sizes = { "1000 mil",
|
|
|
|
"500 mil",
|
|
|
|
"250 mil",
|
|
|
|
"200 mil",
|
|
|
|
"100 mil",
|
|
|
|
"50 mil",
|
|
|
|
"25 mil",
|
|
|
|
"20 mil",
|
|
|
|
"10 mil",
|
|
|
|
"5 mil",
|
|
|
|
"2 mil",
|
|
|
|
"1 mil",
|
|
|
|
"5.0 mm",
|
|
|
|
"2.5 mm",
|
|
|
|
"1.0 mm",
|
|
|
|
"0.5 mm",
|
|
|
|
"0.25 mm",
|
|
|
|
"0.2 mm",
|
|
|
|
"0.1 mm",
|
|
|
|
"0.05 mm",
|
|
|
|
"0.025 mm",
|
|
|
|
"0.01 mm" };
|
|
|
|
}
|
2015-03-03 14:53:47 +00:00
|
|
|
|
2020-06-13 21:09:02 +00:00
|
|
|
if( aCfg->m_Window.zoom_factors.empty() )
|
|
|
|
{
|
|
|
|
aCfg->m_Window.zoom_factors = { 0.035,
|
|
|
|
0.05,
|
|
|
|
0.08,
|
|
|
|
0.13,
|
|
|
|
0.22,
|
|
|
|
0.35,
|
|
|
|
0.6,
|
|
|
|
1.0,
|
|
|
|
1.5,
|
|
|
|
2.2,
|
|
|
|
3.5,
|
|
|
|
5.0,
|
|
|
|
8.0,
|
|
|
|
13.0,
|
|
|
|
20.0,
|
|
|
|
35.0,
|
|
|
|
50.0,
|
|
|
|
80.0,
|
|
|
|
130.0,
|
|
|
|
220.0,
|
|
|
|
300.0 };
|
|
|
|
}
|
|
|
|
|
|
|
|
for( double& factor : aCfg->m_Window.zoom_factors )
|
|
|
|
factor = std::min( factor, MAX_ZOOM_FACTOR );
|
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
// Some, but not all derived classes have a PCBNEW_SETTINGS.
|
|
|
|
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
2018-02-24 11:24:00 +00:00
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
if( cfg )
|
|
|
|
{
|
|
|
|
m_DisplayOptions = cfg->m_Display;
|
|
|
|
m_PolarCoords = cfg->m_PolarCoords;
|
|
|
|
}
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
2018-02-24 11:24:00 +00:00
|
|
|
|
2011-04-02 16:14:07 +00:00
|
|
|
|
2020-06-17 12:46:50 +00:00
|
|
|
int PCB_BASE_FRAME::GetSeverity( int aErrorCode ) const
|
|
|
|
{
|
|
|
|
if( aErrorCode >= CLEANUP_FIRST )
|
|
|
|
return RPT_SEVERITY_ACTION;
|
|
|
|
|
|
|
|
BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
|
|
|
|
|
|
|
|
return bds.m_DRCSeverities[ aErrorCode ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void PCB_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::SaveSettings( aCfg );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
// Some, but not all derived classes have a PCBNEW_SETTINGS.
|
|
|
|
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
if( cfg )
|
|
|
|
{
|
|
|
|
cfg->m_Display = m_DisplayOptions;
|
|
|
|
cfg->m_PolarCoords = m_PolarCoords;
|
|
|
|
}
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2015-03-03 14:53:47 +00:00
|
|
|
|
2020-05-06 01:43:37 +00:00
|
|
|
PCBNEW_SETTINGS* PCB_BASE_FRAME::GetPcbNewSettings()
|
2020-01-13 01:44:19 +00:00
|
|
|
{
|
|
|
|
return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
2010-02-19 13:23:58 +00:00
|
|
|
|
|
|
|
|
2020-05-06 01:43:37 +00:00
|
|
|
FOOTPRINT_EDITOR_SETTINGS* PCB_BASE_FRAME::GetFootprintEditorSettings()
|
|
|
|
{
|
|
|
|
return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
|
|
|
}
|
|
|
|
|
2020-05-22 18:27:05 +00:00
|
|
|
MAGNETIC_SETTINGS* PCB_BASE_FRAME::GetMagneticItemsSettings()
|
|
|
|
{
|
|
|
|
wxCHECK( m_Settings, nullptr );
|
|
|
|
return &m_Settings->m_MagneticItems;
|
|
|
|
}
|
|
|
|
|
2020-05-06 01:43:37 +00:00
|
|
|
|
2019-06-24 09:22:49 +00:00
|
|
|
void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
|
2018-09-25 19:23:54 +00:00
|
|
|
{
|
2019-06-24 09:22:49 +00:00
|
|
|
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
|
2018-09-25 19:23:54 +00:00
|
|
|
|
2019-07-20 15:52:30 +00:00
|
|
|
RecreateToolbars();
|
2018-09-25 19:23:54 +00:00
|
|
|
|
2019-06-04 10:28:05 +00:00
|
|
|
// The 3D viewer isn't in the Kiway, so send its update manually
|
2018-09-25 19:23:54 +00:00
|
|
|
EDA_3D_VIEWER* viewer = Get3DViewerFrame();
|
|
|
|
|
|
|
|
if( viewer )
|
2019-06-24 09:22:49 +00:00
|
|
|
viewer->CommonSettingsChanged( aEnvVarsChanged );
|
2018-09-25 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
void PCB_BASE_FRAME::OnModify()
|
2010-02-19 13:23:58 +00:00
|
|
|
{
|
2011-10-15 13:25:57 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
GetScreen()->SetSave();
|
2015-07-03 18:58:12 +00:00
|
|
|
|
2019-05-27 16:16:54 +00:00
|
|
|
UpdateStatusBar();
|
|
|
|
UpdateMsgPanel();
|
2010-02-19 13:23:58 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
PCB_DRAW_PANEL_GAL* PCB_BASE_FRAME::GetCanvas() const
|
|
|
|
{
|
|
|
|
return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-30 12:25:08 +00:00
|
|
|
void PCB_BASE_FRAME::ActivateGalCanvas()
|
2015-08-07 17:15:36 +00:00
|
|
|
{
|
2019-05-30 12:25:08 +00:00
|
|
|
EDA_DRAW_FRAME::ActivateGalCanvas();
|
2015-08-07 17:15:36 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
|
2015-08-07 17:15:36 +00:00
|
|
|
|
|
|
|
if( m_toolManager )
|
2019-05-28 23:23:58 +00:00
|
|
|
{
|
2019-06-13 17:28:55 +00:00
|
|
|
m_toolManager->SetEnvironment( m_Pcb, GetCanvas()->GetView(),
|
2020-06-12 10:58:56 +00:00
|
|
|
GetCanvas()->GetViewControls(), config(), this );
|
2019-05-28 23:23:58 +00:00
|
|
|
}
|
2015-08-07 17:15:36 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
2017-06-13 09:25:05 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
// Transfer latest current display options from legacy to GAL canvas:
|
2019-06-13 17:28:55 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( canvas->GetView()->GetPainter() );
|
2019-05-28 13:51:47 +00:00
|
|
|
auto settings = painter->GetSettings();
|
2019-11-07 14:23:09 +00:00
|
|
|
auto displ_opts = GetDisplayOptions();
|
2019-05-28 13:51:47 +00:00
|
|
|
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
|
2020-05-16 17:15:43 +00:00
|
|
|
settings->LoadColors( GetColorSettings() );
|
2015-08-07 17:15:36 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
canvas->GetView()->RecacheAllItems();
|
|
|
|
canvas->SetEventDispatcher( m_toolDispatcher );
|
|
|
|
canvas->StartDrawing();
|
2015-08-07 17:15:36 +00:00
|
|
|
}
|
2015-08-07 17:15:47 +00:00
|
|
|
|