2011-11-07 19:04:24 +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, jp.charras at wanadoo.fr
|
2016-11-20 23:35:08 +00:00
|
|
|
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
2018-01-17 14:36:04 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-11-07 19:04:24 +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
|
|
|
|
*/
|
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
/**
|
2018-01-29 12:38:23 +00:00
|
|
|
* @file pcb_base_frame.h
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief Classes used in Pcbnew, CvPcb and GerbView.
|
2011-09-15 17:58:35 +00:00
|
|
|
*/
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2018-01-29 12:38:23 +00:00
|
|
|
#ifndef PCB_BASE_FRAME_H
|
|
|
|
#define PCB_BASE_FRAME_H
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
2015-02-21 00:41:10 +00:00
|
|
|
#include <boost/interprocess/exceptions.hpp>
|
2009-07-30 11:04:07 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <draw_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <base_struct.h>
|
2012-04-12 21:31:31 +00:00
|
|
|
#include <eda_text.h> // EDA_DRAW_MODE_T
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <richio.h>
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <pcb_screen.h>
|
2017-10-30 17:21:07 +00:00
|
|
|
#include <pcb_display_options.h>
|
2017-08-04 12:43:02 +00:00
|
|
|
#include <pcb_general_settings.h>
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
/* Forward declarations of classes. */
|
2009-07-30 11:04:07 +00:00
|
|
|
class BOARD;
|
2011-12-07 15:49:32 +00:00
|
|
|
class BOARD_CONNECTED_ITEM;
|
2009-07-30 11:04:07 +00:00
|
|
|
class MODULE;
|
|
|
|
class TRACK;
|
|
|
|
class D_PAD;
|
|
|
|
class TEXTE_MODULE;
|
2016-07-19 17:35:25 +00:00
|
|
|
class EDA_3D_VIEWER;
|
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 06:15:33 +00:00
|
|
|
class BOARD_DESIGN_SETTINGS;
|
2012-02-06 05:44:19 +00:00
|
|
|
class ZONE_SETTINGS;
|
2012-04-05 18:27:56 +00:00
|
|
|
class PCB_PLOT_PARAMS;
|
2013-05-20 14:49:20 +00:00
|
|
|
class FP_LIB_TABLE;
|
2016-11-20 23:35:08 +00:00
|
|
|
class LIB_ID;
|
2017-08-04 12:43:02 +00:00
|
|
|
class PCB_GENERAL_SETTINGS ;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
/**
|
|
|
|
* class PCB_BASE_FRAME
|
2011-09-30 18:15:37 +00:00
|
|
|
* basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
|
2011-09-26 20:32:56 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
class PCB_BASE_FRAME : public EDA_DRAW_FRAME
|
2009-07-30 11:04:07 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-10-30 17:21:07 +00:00
|
|
|
PCB_DISPLAY_OPTIONS m_DisplayOptions;
|
2011-09-15 17:58:35 +00:00
|
|
|
EDA_UNITS_T m_UserGridUnit;
|
|
|
|
wxRealPoint m_UserGridSize;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2014-03-21 17:00:11 +00:00
|
|
|
int m_FastGrid1; // 1st fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
|
|
|
|
int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
|
2011-09-09 11:02:03 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
protected:
|
++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
|
|
|
BOARD* m_Pcb;
|
|
|
|
GENERAL_COLLECTOR* m_Collector;
|
2017-08-04 12:43:02 +00:00
|
|
|
PCB_GENERAL_SETTINGS m_configSettings;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
/// Auxiliary tool bar typically shown below the main tool bar at the top of the
|
|
|
|
/// main window.
|
2013-05-20 14:49:20 +00:00
|
|
|
wxAuiToolBar* m_auxiliaryToolBar;
|
2011-12-16 13:32:23 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
void updateGridSelectBox();
|
|
|
|
void updateZoomSelectBox();
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void unitsChangeRefresh() override;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
/**
|
|
|
|
* Function loadFootprint
|
2013-05-20 14:49:20 +00:00
|
|
|
* attempts to load \a aFootprintId from the footprint library table.
|
2013-04-25 16:29:35 +00:00
|
|
|
*
|
2016-11-20 23:35:08 +00:00
|
|
|
* @param aFootprintId is the #LIB_ID of component footprint to load.
|
2013-05-20 14:49:20 +00:00
|
|
|
* @return the #MODULE if found or NULL if \a aFootprintId not found in any of the
|
2014-05-09 18:35:48 +00:00
|
|
|
* libraries in the table returned from #Prj().PcbFootprintLibs().
|
2013-04-25 16:29:35 +00:00
|
|
|
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
|
|
|
|
* occurs while reading footprint library files.
|
|
|
|
*/
|
2017-06-08 21:47:21 +00:00
|
|
|
MODULE* loadFootprint( const LIB_ID& aFootprintId );
|
2013-04-25 16:29:35 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
public:
|
2014-04-19 18:47:20 +00:00
|
|
|
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 );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
~PCB_BASE_FRAME();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2015-12-21 11:52:00 +00:00
|
|
|
/**
|
|
|
|
* @return a reference to the 3D viewer frame, when exists, or NULL
|
|
|
|
*/
|
2016-07-19 17:35:25 +00:00
|
|
|
EDA_3D_VIEWER* Get3DViewerFrame();
|
2015-12-21 11:52:00 +00:00
|
|
|
|
2013-11-22 19:47:10 +00:00
|
|
|
/**
|
|
|
|
* Function LoadFootprint
|
|
|
|
* attempts to load \a aFootprintId from the footprint library table.
|
|
|
|
*
|
2016-11-20 23:35:08 +00:00
|
|
|
* @param aFootprintId is the #LIB_ID of component footprint to load.
|
2013-11-22 19:47:10 +00:00
|
|
|
* @return the #MODULE if found or NULL if \a aFootprintId not found in any of the
|
2014-05-09 18:35:48 +00:00
|
|
|
* libraries in table returned from #Prj().PcbFootprintLibs().
|
2013-11-22 19:47:10 +00:00
|
|
|
*/
|
2016-11-20 23:35:08 +00:00
|
|
|
MODULE* LoadFootprint( const LIB_ID& aFootprintId );
|
2013-11-22 19:47:10 +00: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 06:15:33 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoardBoundingBox
|
|
|
|
* calculates the bounding box containing all board items (or board edge segments).
|
|
|
|
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
|
|
|
* @return EDA_RECT - the board's bounding box
|
|
|
|
*/
|
|
|
|
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
|
|
|
|
const PAGE_INFO& GetPageSettings() const override;
|
|
|
|
const wxSize GetPageSizeIU() const override;
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
const wxPoint& GetAuxOrigin() const override;
|
|
|
|
void SetAuxOrigin( const wxPoint& aPoint ) override;
|
2013-08-03 05:15:23 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
const wxPoint& GetGridOrigin() const override;
|
|
|
|
void SetGridOrigin( const wxPoint& aPoint ) override;
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
const TITLE_BLOCK& GetTitleBlock() const override;
|
|
|
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
|
2012-01-09 08:35:06 +00:00
|
|
|
|
2012-02-02 17:45:37 +00:00
|
|
|
/**
|
|
|
|
* Function GetDesignSettings
|
|
|
|
* returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
|
|
|
|
* Overloaded in FOOTPRINT_EDIT_FRAME.
|
|
|
|
*/
|
|
|
|
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
|
|
|
|
virtual void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
/**
|
|
|
|
* Function GetDisplayOptions
|
|
|
|
* returns the display options current in use
|
|
|
|
* Display options are relative to the way tracks, vias, outlines
|
|
|
|
* and other things are shown (for instance solid or sketch mode)
|
|
|
|
* Must be overloaded in frames which have display options
|
|
|
|
* (board editor and footprint editor)
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void* GetDisplayOptions() override { return &m_DisplayOptions; }
|
2015-01-10 10:27:49 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
const ZONE_SETTINGS& GetZoneSettings() const;
|
|
|
|
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
|
2012-02-02 17:45:37 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
/**
|
|
|
|
* Function GetPlotSettings
|
|
|
|
* returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
|
|
|
|
* Overloaded in FOOTPRINT_EDIT_FRAME.
|
|
|
|
*/
|
|
|
|
virtual const PCB_PLOT_PARAMS& GetPlotSettings() const;
|
|
|
|
virtual void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings );
|
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
/**
|
|
|
|
* Function SetBoard
|
|
|
|
* sets the m_Pcb member in such as way as to ensure deleting any previous
|
|
|
|
* BOARD.
|
|
|
|
* @param aBoard The BOARD to put into the frame.
|
|
|
|
*/
|
2013-11-25 15:50:03 +00:00
|
|
|
virtual void SetBoard( BOARD* aBoard );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2012-02-02 17:45:37 +00:00
|
|
|
BOARD* GetBoard() const
|
2009-07-30 11:04:07 +00:00
|
|
|
{
|
2012-02-02 17:45:37 +00:00
|
|
|
wxASSERT( m_Pcb );
|
2009-07-30 11:04:07 +00:00
|
|
|
return m_Pcb;
|
|
|
|
}
|
|
|
|
|
|
|
|
// General
|
2011-09-15 17:58:35 +00:00
|
|
|
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { }
|
|
|
|
virtual void ReCreateHToolbar() override = 0;
|
|
|
|
virtual void ReCreateVToolbar() override = 0;
|
|
|
|
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override = 0;
|
|
|
|
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override = 0;
|
|
|
|
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override = 0;
|
|
|
|
virtual void ReCreateMenuBar() override;
|
|
|
|
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg ) override;
|
|
|
|
virtual void UpdateStatusBar() override;
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
PCB_SCREEN* GetScreen() const override { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-11-07 19:04:24 +00:00
|
|
|
/**
|
|
|
|
* Function BestZoom
|
|
|
|
* @return the "best" zoom to show the entire board or footprint on the screen.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual double BestZoom() override;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2015-01-06 07:38:58 +00:00
|
|
|
/**
|
|
|
|
* Function GetZoomLevelIndicator
|
|
|
|
* returns a human readable value which can be displayed as zoom
|
|
|
|
* level indicator in dialogs.
|
|
|
|
* Virtual from the base class
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
const wxString GetZoomLevelIndicator() const override;
|
2015-01-06 07:38:58 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
virtual void Show3D_Frame( wxCommandEvent& event );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
// Read/write functions:
|
2011-01-14 17:43:30 +00:00
|
|
|
EDA_ITEM* ReadDrawSegmentDescr( LINE_READER* aReader );
|
2011-09-15 17:58:35 +00:00
|
|
|
int ReadListeSegmentDescr( LINE_READER* aReader,
|
|
|
|
TRACK* PtSegm,
|
|
|
|
int StructType,
|
|
|
|
int NumSegm );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
int ReadSetup( LINE_READER* aReader );
|
|
|
|
int ReadGeneralDescrPcb( LINE_READER* aReader );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function PcbGeneralLocateAndDisplay
|
|
|
|
* searches for an item under the mouse cursor.
|
|
|
|
* Items are searched first on the current working layer.
|
2009-11-23 20:18:47 +00:00
|
|
|
* If nothing found, an item will be searched without layer restriction.
|
|
|
|
* If more than one item is found meeting the current working layer
|
|
|
|
* criterion, then a popup menu is shown which allows the user to pick
|
|
|
|
* which item he/she is interested in. Once an item is chosen, then it
|
|
|
|
* is make the "current item" and the status window is updated to reflect
|
|
|
|
* this.
|
2009-07-30 11:04:07 +00:00
|
|
|
*
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aHotKeyCode The hotkey which relates to the caller and determines
|
|
|
|
* the type of search to be performed. If zero, then
|
|
|
|
* the mouse tools will be tested instead.
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void ProcessItemSelection( wxCommandEvent& event );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCurItem
|
|
|
|
* sets the currently selected item and displays it in the MsgPanel.
|
|
|
|
* If the given item is NULL then the MsgPanel is erased and there is no
|
|
|
|
* currently selected item. This function is intended to make the process
|
|
|
|
* of "selecting" an item more formal, and to indivisibly tie the operation
|
|
|
|
* of selecting an item to displaying it using BOARD_ITEM::Display_Infos().
|
|
|
|
* @param aItem The BOARD_ITEM to make the selected item or NULL if none.
|
2011-09-15 17:58:35 +00:00
|
|
|
* @param aDisplayInfo = true to display item info, false if not (default = true)
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo = true );
|
|
|
|
|
|
|
|
BOARD_ITEM* GetCurItem();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2015-07-03 18:58:12 +00:00
|
|
|
///> @copydoc EDA_DRAW_FRAME::UpdateMsgPanel()
|
2016-09-24 18:53:15 +00:00
|
|
|
void UpdateMsgPanel() override;
|
2015-07-03 18:58:12 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
/**
|
|
|
|
* Function GetCollectorsGuide
|
2009-11-23 20:18:47 +00:00
|
|
|
* @return GENERAL_COLLECTORS_GUIDE - that considers the global
|
|
|
|
*configuration options.
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
|
|
|
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
|
|
|
|
|
|
|
|
/**
|
2018-01-17 14:36:04 +00:00
|
|
|
* Useful to focus on a particular location, in find functions
|
2018-01-18 09:09:43 +00:00
|
|
|
* Move the graphic cursor (crosshair cursor) at a given coordinate and reframes
|
|
|
|
* the drawing if the requested point is out of view or if center on location is requested.
|
2012-05-28 20:01:51 +00:00
|
|
|
* @param aPos is the point to go to.
|
2018-01-17 14:36:04 +00:00
|
|
|
* @param aWarpMouseCursor is true if the pointer should be warped to the new position.
|
|
|
|
* @param aCenterView is true if the new cursor position should be centered on canvas.
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2018-01-17 14:36:04 +00:00
|
|
|
void FocusOnLocation( const wxPoint& aPos, bool aWarpMouseCursor = true,
|
|
|
|
bool aCenterView = false );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2013-11-27 06:04:04 +00:00
|
|
|
/**
|
|
|
|
* Function SelectLibrary
|
|
|
|
* puts up a dialog and allows the user to pick a library, for unspecified use.
|
|
|
|
*
|
|
|
|
* @param aNicknameExisting is the current choice to highlight
|
|
|
|
* @return wxString - the library or wxEmptyString on abort.
|
|
|
|
*/
|
|
|
|
wxString SelectLibrary( const wxString& aNicknameExisting );
|
|
|
|
|
2015-12-20 18:47:52 +00:00
|
|
|
/**
|
|
|
|
* Function GetFootprintFromBoardByReference
|
|
|
|
* @return a reference to the footprint found by its refence
|
|
|
|
* on the curent board. the reference is entered by the user from
|
|
|
|
* a dialog (by awxTextCtlr, or a list of available references)
|
|
|
|
*/
|
|
|
|
MODULE* GetFootprintFromBoardByReference();
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function OnModify
|
2010-02-19 13:23:58 +00:00
|
|
|
* Virtual
|
2010-05-01 12:46:33 +00:00
|
|
|
* Must be called after a change
|
2010-02-19 13:23:58 +00:00
|
|
|
* in order to set the "modify" flag of the current screen
|
|
|
|
* and update the date in frame reference
|
2010-05-01 12:46:33 +00:00
|
|
|
* do not forget to call this basic OnModify function to update info
|
|
|
|
* in derived OnModify functions
|
2010-02-19 13:23:58 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
virtual void OnModify();
|
2010-02-19 13:23:58 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
// Modules (footprints)
|
2015-01-28 10:00:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2015-01-28 10:00:48 +00:00
|
|
|
* Function CreateNewModule
|
|
|
|
* Creates a new module or footprint, at position 0,0
|
|
|
|
* The new module contains only 2 texts: a reference and a value:
|
|
|
|
* Reference = REF**
|
|
|
|
* Value = "VAL**" or Footprint name in lib
|
|
|
|
* Note: they are dummy texts, which will be replaced by the actual texts
|
|
|
|
* when the fooprint is placed on a board and a netlist is read
|
|
|
|
* @param aModuleName = name of the new footprint in library
|
|
|
|
* @return a reference to the new module
|
2010-07-20 18:11:34 +00:00
|
|
|
*/
|
2015-01-28 10:00:48 +00:00
|
|
|
MODULE* CreateNewModule( const wxString& aModuleName );
|
2010-12-28 11:24:42 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void Edit_Module( MODULE* module, wxDC* DC );
|
2013-05-05 07:17:48 +00:00
|
|
|
void Rotate_Module( wxDC* DC, MODULE* module, double angle, bool incremental );
|
2011-09-16 14:13:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function PlaceModule
|
|
|
|
* places \a aModule at the current cursor position and updates module coordinates
|
|
|
|
* with the new position.
|
|
|
|
*
|
|
|
|
* @param aModule A MODULE object point of the module to be placed.
|
|
|
|
* @param aDC A wxDC object point of the device context to draw \a aModule on
|
|
|
|
* or NULL if no display screen need updated.
|
|
|
|
* @param aDoNotRecreateRatsnest A bool true redraws the module rats nest.
|
|
|
|
*/
|
|
|
|
void PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreateRatsnest = false );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
|
|
|
// module texts
|
2011-09-15 17:58:35 +00:00
|
|
|
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
|
|
|
|
void DeleteTextModule( TEXTE_MODULE* Text );
|
|
|
|
void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
|
|
|
void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2011-01-09 11:17:28 +00:00
|
|
|
/**
|
|
|
|
* Function ResetTextSize
|
|
|
|
* resets given field text size and width to current settings in
|
|
|
|
* Preferences->Dimensions->Texts and Drawings.
|
|
|
|
* @param aItem is the item to be reset, either TEXTE_PCB or TEXTE_MODULE.
|
|
|
|
* @param aDC is the drawing context.
|
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC );
|
2011-01-09 11:17:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ResetModuleTextSizes
|
|
|
|
* resets text size and width of all module text fields of given field
|
|
|
|
* type to current settings in Preferences->Dimensions->Texts and Drawings.
|
2012-05-29 12:25:10 +00:00
|
|
|
* @param aFilter is a filter: footprint names must match this filter.
|
|
|
|
* an empty filter, or "*" do not filter anything.
|
|
|
|
* @param aRef = true to modify the reference of footprints.
|
|
|
|
* @param aValue = true to modify the value of footprints.
|
|
|
|
* @param aOthers = true to modify the other fields of footprints.
|
2011-01-09 11:17:28 +00:00
|
|
|
*/
|
2012-05-29 12:25:10 +00:00
|
|
|
void ResetModuleTextSizes( const wxString & aFilter, bool aRef,
|
|
|
|
bool aValue, bool aOthers );
|
2011-01-09 11:17:28 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void InstallPadOptionsFrame( D_PAD* pad );
|
|
|
|
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC );
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void AddPad( MODULE* Module, bool draw );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function DeletePad
|
2010-08-11 13:15:30 +00:00
|
|
|
* Delete the pad aPad.
|
|
|
|
* Refresh the modified screen area
|
|
|
|
* Refresh modified parameters of the parent module (bounding box, last date)
|
|
|
|
* @param aPad = the pad to delete
|
2011-08-26 17:01:17 +00:00
|
|
|
* @param aQuery = true to prompt for confirmation, false to delete silently
|
2010-08-11 13:15:30 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void DeletePad( D_PAD* aPad, bool aQuery = true );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/**
|
|
|
|
* Function StartMovePad
|
|
|
|
* Initialize a drag or move pad command
|
|
|
|
* @param aPad = the pad to move or drag
|
|
|
|
* @param aDC = the current device context
|
|
|
|
* @param aDragConnectedTracks = true to drag connected tracks,
|
|
|
|
* false to just move the pad
|
|
|
|
*/
|
|
|
|
void StartMovePad( D_PAD* aPad, wxDC* aDC, bool aDragConnectedTracks );
|
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
void RotatePad( D_PAD* Pad, wxDC* DC );
|
|
|
|
void PlacePad( D_PAD* Pad, wxDC* DC );
|
|
|
|
void Export_Pad_Settings( D_PAD* aPad );
|
|
|
|
void Import_Pad_Settings( D_PAD* aPad, bool aDraw );
|
2011-12-30 12:29:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GlobalChange_PadSettings
|
|
|
|
* Function to change pad caracteristics for the given footprint
|
|
|
|
* or all footprints which look like the given footprint
|
|
|
|
* @param aPad is the pattern. The given footprint is the parent of this pad
|
|
|
|
* @param aSameFootprints: if true, make changes on all identical footprints
|
|
|
|
* @param aPadShapeFilter: if true, make changes only on pads having the same shape as aPad
|
|
|
|
* @param aPadOrientFilter: if true, make changes only on pads having the same orientation as aPad
|
|
|
|
* @param aPadLayerFilter: if true, make changes only on pads having the same layers as aPad
|
|
|
|
* @param aRedraw: if true: redraws the footprint
|
|
|
|
* @param aSaveForUndo: if true: create an entry in the Undo/Redo list
|
|
|
|
* (usually: true in Schematic editor, false in Module editor)
|
|
|
|
*/
|
|
|
|
void GlobalChange_PadSettings( D_PAD* aPad,
|
2012-10-07 15:37:25 +00:00
|
|
|
bool aSameFootprints,
|
|
|
|
bool aPadShapeFilter,
|
|
|
|
bool aPadOrientFilter,
|
|
|
|
bool aPadLayerFilter,
|
|
|
|
bool aRedraw,
|
|
|
|
bool aSaveForUndo );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2013-05-08 20:47:23 +00:00
|
|
|
* Function SelectFootprint
|
2013-10-13 21:33:58 +00:00
|
|
|
* displays a list of modules found in all libraries or a given library
|
|
|
|
*
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aWindow = the current window ( parent window )
|
2013-10-13 21:33:58 +00:00
|
|
|
*
|
|
|
|
* @param aLibraryName = library to list (if aLibraryFullFilename is empty, then list all modules).
|
|
|
|
* This is a nickname for the FP_LIB_TABLE build.
|
|
|
|
*
|
|
|
|
* @param aMask = Display filter (wildcart)( Mask = wxEmptyString if not used )
|
|
|
|
*
|
2009-11-23 20:18:47 +00:00
|
|
|
* @param aKeyWord = keyword list, to display a filtered list of module
|
|
|
|
* having one (or more) of these keywords in their
|
|
|
|
* keyword list ( aKeyWord = wxEmptyString if not used )
|
2013-10-13 21:33:58 +00:00
|
|
|
*
|
2013-05-20 14:49:20 +00:00
|
|
|
* @param aTable is the #FP_LIB_TABLE to search.
|
2009-07-30 11:04:07 +00:00
|
|
|
*
|
2011-09-15 17:58:35 +00:00
|
|
|
* @return wxEmptyString if abort or fails, or the selected module name if Ok
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2013-05-08 20:47:23 +00:00
|
|
|
wxString SelectFootprint( EDA_DRAW_FRAME* aWindow,
|
2013-10-13 21:33:58 +00:00
|
|
|
const wxString& aLibraryName,
|
2013-05-08 20:47:23 +00:00
|
|
|
const wxString& aMask,
|
2013-05-20 14:49:20 +00:00
|
|
|
const wxString& aKeyWord,
|
|
|
|
FP_LIB_TABLE* aTable );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2012-02-09 20:33:38 +00:00
|
|
|
/**
|
2013-05-20 14:49:20 +00:00
|
|
|
* Function LoadModuleFromLibrary
|
2012-04-17 01:35:43 +00:00
|
|
|
* opens a dialog to select a footprint, and loads it into current board.
|
|
|
|
*
|
2012-02-09 20:33:38 +00:00
|
|
|
* @param aLibrary = the library name to use, or empty string to search
|
|
|
|
* in all loaded libraries
|
2013-05-20 14:49:20 +00:00
|
|
|
* @param aTable is the #FP_LIB_TABLE containing the avaiable footprint libraries.
|
2012-02-09 20:33:38 +00:00
|
|
|
* @param aUseFootprintViewer = true to show the option
|
|
|
|
* allowing the footprint selection by the footprint viewer
|
|
|
|
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
|
|
|
|
*/
|
2013-05-20 14:49:20 +00:00
|
|
|
MODULE* LoadModuleFromLibrary( const wxString& aLibrary,
|
|
|
|
FP_LIB_TABLE* aTable,
|
|
|
|
bool aUseFootprintViewer = true,
|
|
|
|
wxDC* aDC = NULL );
|
2012-02-09 20:33:38 +00:00
|
|
|
|
|
|
|
/**
|
2013-11-12 01:14:17 +00:00
|
|
|
* Function SelectFootprintFromLibBrowser
|
|
|
|
* launches the footprint viewer to select the name of a footprint to load.
|
|
|
|
*
|
|
|
|
* @return the selected footprint name or an empty string if no selection was made.
|
2012-02-09 20:33:38 +00:00
|
|
|
*/
|
2013-11-12 01:14:17 +00:00
|
|
|
wxString SelectFootprintFromLibBrowser();
|
2012-02-09 20:33:38 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
// ratsnest functions
|
2010-12-29 17:47:32 +00:00
|
|
|
/**
|
|
|
|
* Function Compile_Ratsnest
|
|
|
|
* Create the entire board ratsnest.
|
|
|
|
* Must be called after a board change (changes for
|
|
|
|
* pads, footprints or a read netlist ).
|
|
|
|
* @param aDC = the current device context (can be NULL)
|
|
|
|
* @param aDisplayStatus : if true, display the computation results
|
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus );
|
2010-12-29 17:47:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function build_ratsnest_module
|
|
|
|
* Build a ratsnest relative to one footprint. This is a simplified computation
|
|
|
|
* used only in move footprint. It is not optimal, but it is fast and sufficient
|
|
|
|
* to help a footprint placement
|
|
|
|
* It shows the connections from a pad to the nearest connected pad
|
2017-06-25 09:26:04 +00:00
|
|
|
* @param aMoveVector = move vector of the footprint being moved.
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aModule = module to consider.
|
|
|
|
*/
|
2017-06-25 09:26:04 +00:00
|
|
|
void build_ratsnest_module( MODULE *aModule, wxPoint aMoveVector );
|
2010-12-29 17:47:32 +00:00
|
|
|
|
2011-09-16 14:13:02 +00:00
|
|
|
/**
|
|
|
|
* Function TraceModuleRatsNest
|
|
|
|
* display the rats nest of a moving footprint, computed by
|
|
|
|
* build_ratsnest_module()
|
|
|
|
*/
|
|
|
|
void TraceModuleRatsNest( wxDC* aDC );
|
|
|
|
|
2011-11-06 16:16:19 +00:00
|
|
|
/**
|
|
|
|
* Function Build_Board_Ratsnest.
|
|
|
|
* Calculates the full ratsnest depending only on pads.
|
|
|
|
*/
|
|
|
|
void Build_Board_Ratsnest();
|
2010-12-29 17:47:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* function Displays the general ratsnest
|
|
|
|
* Only ratsnest with the status bit CH_VISIBLE is set are displayed
|
|
|
|
* @param aDC = the current device context (can be NULL)
|
|
|
|
* @param aNetcode if > 0, Display only the ratsnest relative to the
|
2011-09-15 17:58:35 +00:00
|
|
|
* corresponding net_code
|
|
|
|
*/
|
|
|
|
void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 );
|
|
|
|
|
2011-11-08 16:18:46 +00:00
|
|
|
/**
|
|
|
|
* Function TraceAirWiresToTargets
|
|
|
|
* This functions shows airwires to nearest connecting points (pads)
|
|
|
|
* from the current new track end during track creation
|
|
|
|
* Uses data prepared by BuildAirWiresTargetsList()
|
|
|
|
* @param aDC = the current device context
|
|
|
|
*/
|
2011-11-10 15:55:05 +00:00
|
|
|
void TraceAirWiresToTargets( wxDC* aDC );
|
2011-11-08 16:18:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function BuildAirWiresTargetsList
|
|
|
|
* Build a list of candidates that can be a coonection point
|
|
|
|
* when a track is started.
|
|
|
|
* This functions prepares data to show airwires to nearest connecting points (pads)
|
|
|
|
* from the current new track to candidates during track creation
|
|
|
|
* @param aItemRef = the item connected to the starting point of the new track (track or pad)
|
|
|
|
* @param aPosition = the position of the new track end (usually the mouse cursor on grid)
|
2017-06-25 09:26:04 +00:00
|
|
|
* @param aNet = the netcode of the track
|
2011-11-08 16:18:46 +00:00
|
|
|
*/
|
|
|
|
void BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef,
|
2017-03-22 13:51:07 +00:00
|
|
|
const wxPoint& aPosition,
|
2017-04-25 09:06:24 +00:00
|
|
|
int aNet );
|
2011-09-15 17:58:35 +00:00
|
|
|
|
2011-09-16 14:13:02 +00:00
|
|
|
/**
|
2011-11-08 16:18:46 +00:00
|
|
|
* Function TestForActiveLinksInRatsnest
|
|
|
|
* Explores the full rats nest list (which must exist) to determine
|
|
|
|
* the ACTIVE links in the full rats nest list
|
|
|
|
* When tracks exist between pads, a link can connect 2 pads already connected by a track
|
|
|
|
* and the link is said inactive.
|
|
|
|
* When a link connects 2 pads not already connected by a track, the link is said active.
|
|
|
|
* @param aNetCode = net code to test. If 0, test all nets
|
2011-09-16 14:13:02 +00:00
|
|
|
*/
|
2011-11-08 16:18:46 +00:00
|
|
|
void TestForActiveLinksInRatsnest( int aNetCode );
|
2011-09-15 17:58:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function TestConnections
|
|
|
|
* tests the connections relative to all nets.
|
|
|
|
* <p>
|
|
|
|
* This function update the status of the ratsnest ( flag CH_ACTIF = 0 if a connection
|
|
|
|
* is found, = 1 else) track segments are assumed to be sorted by net codes.
|
|
|
|
* This is the case because when a new track is added, it is inserted in the linked list
|
|
|
|
* according to its net code. and when nets are changed (when a new netlist is read)
|
|
|
|
* tracks are sorted before using this function.
|
|
|
|
* </p>
|
2010-12-29 17:47:32 +00:00
|
|
|
*/
|
2011-11-10 08:21:11 +00:00
|
|
|
void TestConnections();
|
2010-12-29 17:47:32 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
/**
|
|
|
|
* Function TestNetConnection
|
|
|
|
* tests the connections relative to \a aNetCode. Track segments are assumed to be
|
|
|
|
* sorted by net codes.
|
2011-11-10 08:21:11 +00:00
|
|
|
* @param aDC Current Device Context
|
2011-09-15 17:58:35 +00:00
|
|
|
* @param aNetCode The net code to test
|
|
|
|
*/
|
|
|
|
void TestNetConnection( wxDC* aDC, int aNetCode );
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
/**
|
|
|
|
* Function RecalculateAllTracksNetcode
|
|
|
|
* search connections between tracks and pads and propagate pad net codes to the track
|
|
|
|
* segments.
|
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
void ComputeLegacyConnections();
|
2009-08-29 10:20:48 +00:00
|
|
|
|
|
|
|
/* Functions relative to Undo/redo commands:
|
|
|
|
*/
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SaveCopyInUndoList (virtual pure)
|
2009-07-30 11:04:07 +00:00
|
|
|
* Creates a new entry in undo list of commands.
|
|
|
|
* add a picker to handle aItemToCopy
|
|
|
|
* @param aItemToCopy = the board item modified by the command to undo
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
2009-10-14 19:43:31 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation, for
|
|
|
|
* commands like move
|
2009-07-30 11:04:07 +00:00
|
|
|
*/
|
2009-10-14 19:43:31 +00:00
|
|
|
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SaveCopyInUndoList (virtual pure, overloaded).
|
2009-08-03 18:54:48 +00:00
|
|
|
* Creates a new entry in undo list of commands.
|
|
|
|
* add a list of pickers to handle a list of items
|
|
|
|
* @param aItemsList = the list of items modified by the command to undo
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
2009-10-14 19:43:31 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation,
|
|
|
|
* for commands like move
|
2009-08-03 18:54:48 +00:00
|
|
|
*/
|
2013-12-18 12:27:18 +00:00
|
|
|
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
|
2009-08-03 18:54:48 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2013-09-11 15:30:21 +00:00
|
|
|
/** Install the dialog box for layer selection
|
|
|
|
* @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
|
|
|
|
* @param aNotAllowedLayersMask = a layer mask for not allowed layers
|
|
|
|
* (= 0 to show all layers in use)
|
2013-09-25 19:09:57 +00:00
|
|
|
* @param aDlgPosition = position of dialog ( defualt = centered)
|
2013-09-11 15:30:21 +00:00
|
|
|
* @return the selected layer id
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID SelectLayer( PCB_LAYER_ID aDefaultLayer,
|
2014-06-29 18:09:32 +00:00
|
|
|
LSET aNotAllowedLayersMask = LSET(),
|
2014-06-24 16:17:18 +00:00
|
|
|
wxPoint aDlgPosition = wxDefaultPosition );
|
2013-09-11 15:30:21 +00:00
|
|
|
|
|
|
|
/* Display a list of two copper layers to choose a pair of copper layers
|
|
|
|
* the layer pair is used to fast switch between copper layers when placing vias
|
|
|
|
*/
|
|
|
|
void SelectCopperLayerPair();
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
virtual void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer );
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2014-07-09 09:50:27 +00:00
|
|
|
/**
|
|
|
|
* Function SetActiveLayer
|
|
|
|
* will change the currently active layer to \a aLayer.
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
virtual void SetActiveLayer( PCB_LAYER_ID aLayer )
|
2014-07-09 09:50:27 +00:00
|
|
|
{
|
2015-09-03 07:44:30 +00:00
|
|
|
GetScreen()->m_Active_Layer = aLayer;
|
2014-07-09 09:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetActiveLayer
|
|
|
|
* returns the active layer
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
virtual PCB_LAYER_ID GetActiveLayer() const
|
2014-07-09 09:50:27 +00:00
|
|
|
{
|
2015-09-03 07:44:30 +00:00
|
|
|
return GetScreen()->m_Active_Layer;
|
2014-07-09 09:50:27 +00:00
|
|
|
}
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void LoadSettings( wxConfigBase* aCfg ) override;
|
|
|
|
void SaveSettings( wxConfigBase* aCfg ) override;
|
2009-10-14 19:43:31 +00:00
|
|
|
|
2013-07-09 05:48:26 +00:00
|
|
|
bool InvokeDialogGrid();
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
void OnTogglePolarCoords( wxCommandEvent& aEvent );
|
|
|
|
void OnTogglePadDrawMode( wxCommandEvent& aEvent );
|
|
|
|
|
2018-01-17 07:58:44 +00:00
|
|
|
virtual void OnSwitchCanvas( wxCommandEvent& aEvent );
|
|
|
|
|
* 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
|
|
|
// User interface update event handlers.
|
2011-02-21 13:54:29 +00:00
|
|
|
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
|
|
|
|
2014-03-21 17:00:11 +00:00
|
|
|
/**
|
|
|
|
* Function SetFastGrid1()
|
|
|
|
*
|
|
|
|
* Switches grid settings to the 1st "fast" setting predefined by user.
|
|
|
|
*/
|
|
|
|
void SetFastGrid1();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetFastGrid2()
|
|
|
|
*
|
|
|
|
* Switches grid settings to the 1st "fast" setting predefined by user.
|
|
|
|
*/
|
|
|
|
void SetFastGrid2();
|
|
|
|
|
2015-05-12 09:05:36 +00:00
|
|
|
/**
|
|
|
|
* Virtual function SetNextGrid()
|
|
|
|
* changes the grid size settings to the next one available.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetNextGrid() override;
|
2015-05-12 09:05:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Virtual function SetPrevGrid()
|
|
|
|
* changes the grid size settings to the previous one available.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetPrevGrid() override;
|
2015-05-12 09:05:36 +00:00
|
|
|
|
2015-02-17 23:44:23 +00:00
|
|
|
void ClearSelection();
|
|
|
|
|
2015-08-07 17:15:36 +00:00
|
|
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void UseGalCanvas( bool aEnable ) override;
|
2015-08-07 17:15:36 +00:00
|
|
|
|
2017-01-14 13:43:45 +00:00
|
|
|
/**
|
|
|
|
* Update UI called when switches currently used canvas (default / Cairo / OpenGL).
|
|
|
|
*/
|
|
|
|
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
PCB_GENERAL_SETTINGS& Settings()
|
|
|
|
{
|
|
|
|
return m_configSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
const PCB_GENERAL_SETTINGS& CSettings() const
|
|
|
|
{
|
|
|
|
return m_configSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-07 17:15:47 +00:00
|
|
|
///> Key in KifaceSettings to store the canvas type.
|
2015-08-10 12:34:55 +00:00
|
|
|
static const wxChar CANVAS_TYPE_KEY[];
|
2015-08-07 17:15:47 +00:00
|
|
|
|
2009-07-30 11:04:07 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2018-01-29 12:38:23 +00:00
|
|
|
#endif // PCB_BASE_FRAME_H
|