2012-01-14 19:50:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-18 09:13:17 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-05-25 07:05:35 +00:00
|
|
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-01-14 19:50:32 +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
|
|
|
/**
|
|
|
|
* @file class_module.h
|
|
|
|
* @brief Module description (excepted pads)
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#ifndef MODULE_H_
|
|
|
|
#define MODULE_H_
|
2011-08-01 15:29:27 +00:00
|
|
|
|
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
#include <list>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dlist.h>
|
|
|
|
#include <layers_id_colors_and_visibility.h> // ALL_LAYERS definition.
|
|
|
|
#include <class_board_item.h>
|
2016-05-13 15:31:54 +00:00
|
|
|
#include <board_item_container.h>
|
2018-02-22 10:10:48 +00:00
|
|
|
#include <collectors.h>
|
2016-11-20 23:35:08 +00:00
|
|
|
#include <lib_id.h>
|
2011-01-14 17:43:30 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_text_mod.h>
|
2012-02-24 23:23:46 +00:00
|
|
|
#include "zones.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2017-03-22 13:11:08 +00:00
|
|
|
#include <core/iterators.h>
|
|
|
|
|
2016-06-29 10:23:11 +00:00
|
|
|
#include <functional>
|
2013-09-08 18:31:21 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
class LINE_READER;
|
2011-09-17 15:31:21 +00:00
|
|
|
class EDA_3D_CANVAS;
|
2011-09-23 13:57:12 +00:00
|
|
|
class EDA_DRAW_PANEL;
|
|
|
|
class D_PAD;
|
|
|
|
class BOARD;
|
2013-01-12 17:32:24 +00:00
|
|
|
class MSG_PANEL_ITEM;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
namespace KIGFX {
|
|
|
|
class VIEW;
|
2017-11-02 20:41:29 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-04 07:19:04 +00:00
|
|
|
enum INCLUDE_NPTH_T
|
|
|
|
{
|
|
|
|
DO_NOT_INCLUDE_NPTH = false,
|
|
|
|
INCLUDE_NPTH = true
|
|
|
|
};
|
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
/**
|
|
|
|
* Enum MODULE_ATTR_T
|
|
|
|
* is the set of attributes allowed within a MODULE, using MODULE::SetAttributes()
|
|
|
|
* and MODULE::GetAttributes(). These are to be ORed together when calling
|
2012-04-05 18:27:56 +00:00
|
|
|
* MODULE::SetAttributes()
|
2011-12-12 08:37:05 +00:00
|
|
|
*/
|
|
|
|
enum MODULE_ATTR_T
|
2007-06-15 16:08:55 +00:00
|
|
|
{
|
2011-12-12 08:37:05 +00:00
|
|
|
MOD_DEFAULT = 0, ///< default
|
2013-03-13 18:53:58 +00:00
|
|
|
MOD_CMS = 1, ///< Set for modules listed in the automatic insertion list
|
2011-12-12 08:37:05 +00:00
|
|
|
///< (usually SMD footprints)
|
|
|
|
MOD_VIRTUAL = 2 ///< Virtual component: when created by copper shapes on
|
|
|
|
///< board (Like edge card connectors, mounting hole...)
|
2007-06-15 16:08:55 +00:00
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2017-10-27 14:25:20 +00:00
|
|
|
class MODULE_3D_SETTINGS
|
|
|
|
{
|
|
|
|
public:
|
2017-11-08 09:56:57 +00:00
|
|
|
MODULE_3D_SETTINGS() :
|
|
|
|
// Initialize with sensible values
|
|
|
|
m_Scale { 1, 1, 1 },
|
|
|
|
m_Rotation { 0, 0, 0 },
|
2018-03-28 17:14:04 +00:00
|
|
|
m_Offset { 0, 0, 0 },
|
|
|
|
m_Preview( true )
|
2017-11-08 09:56:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-10-27 14:25:20 +00:00
|
|
|
struct VECTOR3D
|
|
|
|
{
|
|
|
|
double x, y, z;
|
|
|
|
};
|
|
|
|
|
2017-11-14 09:53:59 +00:00
|
|
|
VECTOR3D m_Scale; ///< 3D model scaling factor (dimensionless)
|
|
|
|
VECTOR3D m_Rotation; ///< 3D model rotation (degrees)
|
|
|
|
VECTOR3D m_Offset; ///< 3D model offset (mm)
|
2017-10-27 14:25:20 +00:00
|
|
|
wxString m_Filename; ///< The 3D shape filename in 3D library
|
2018-03-28 17:14:04 +00:00
|
|
|
bool m_Preview; ///< Include module in 3D preview
|
2017-10-27 14:25:20 +00:00
|
|
|
};
|
2007-08-07 06:21:19 +00:00
|
|
|
|
2016-05-13 15:31:54 +00:00
|
|
|
class MODULE : public BOARD_ITEM_CONTAINER
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-08-06 02:02:39 +00:00
|
|
|
MODULE( BOARD* parent );
|
2012-01-14 19:50:32 +00:00
|
|
|
|
|
|
|
MODULE( const MODULE& aModule );
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~MODULE();
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2016-05-31 08:27:52 +00:00
|
|
|
MODULE& operator=( const MODULE& aOther );
|
|
|
|
|
2014-06-06 09:44:21 +00:00
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
2019-02-17 15:46:21 +00:00
|
|
|
return aItem && PCB_MODULE_T == aItem->Type();
|
2014-06-06 09:44:21 +00:00
|
|
|
}
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
MODULE* Next() const { return static_cast<MODULE*>( Pnext ); }
|
|
|
|
MODULE* Back() const { return static_cast<MODULE*>( Pback ); }
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2016-05-13 15:31:54 +00:00
|
|
|
///> @copydoc BOARD_ITEM_CONTAINER::Add()
|
2017-06-13 23:47:05 +00:00
|
|
|
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_INSERT ) override;
|
2014-07-09 12:22:29 +00:00
|
|
|
|
2016-05-13 15:31:54 +00:00
|
|
|
///> @copydoc BOARD_ITEM_CONTAINER::Remove()
|
2017-06-13 23:47:05 +00:00
|
|
|
void Remove( BOARD_ITEM* aItem ) override;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2015-02-18 09:13:17 +00:00
|
|
|
/**
|
|
|
|
* Function ClearAllNets
|
|
|
|
* Clear (i.e. force the ORPHANED dummy net info) the net info which
|
|
|
|
* depends on a given board for all pads of the footprint.
|
|
|
|
* This is needed when a footprint is copied between the fp editor and
|
|
|
|
* the board editor for instance, because net info become fully broken
|
|
|
|
*/
|
|
|
|
void ClearAllNets();
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
2011-09-07 19:41:04 +00:00
|
|
|
* Function CalculateBoundingBox
|
2011-09-01 21:39:38 +00:00
|
|
|
* calculates the bounding box in board coordinates.
|
2008-11-24 06:53:43 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
void CalculateBoundingBox();
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
/**
|
2013-11-24 17:48:14 +00:00
|
|
|
* Function GetFootprintRect()
|
2010-12-10 19:47:44 +00:00
|
|
|
* Returns the area of the module footprint excluding any text.
|
2011-09-01 21:39:38 +00:00
|
|
|
* @return EDA_RECT - The rectangle containing the footprint.
|
2010-12-10 19:47:44 +00:00
|
|
|
*/
|
2013-11-24 17:48:14 +00:00
|
|
|
EDA_RECT GetFootprintRect() const;
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2018-02-19 00:00:29 +00:00
|
|
|
/**
|
|
|
|
* Returns a bounding polygon for the shapes and pads in the module
|
|
|
|
* This operation is slower but more accurate than calculating a bounding box
|
|
|
|
*/
|
|
|
|
SHAPE_POLY_SET GetBoundingPoly() const;
|
|
|
|
|
2013-11-24 17:48:14 +00:00
|
|
|
// Virtual function
|
2016-09-24 18:53:15 +00:00
|
|
|
const EDA_RECT GetBoundingBox() const override;
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
DLIST<D_PAD>& PadsList() { return m_Pads; }
|
|
|
|
const DLIST<D_PAD>& PadsList() const { return m_Pads; }
|
|
|
|
|
|
|
|
DLIST<BOARD_ITEM>& GraphicalItemsList() { return m_Drawings; }
|
|
|
|
const DLIST<BOARD_ITEM>& GraphicalItemsList() const { return m_Drawings; }
|
2013-03-18 19:36:07 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
DLIST_ITERATOR_WRAPPER<D_PAD> Pads()
|
|
|
|
{
|
|
|
|
return DLIST_ITERATOR_WRAPPER<D_PAD>( m_Pads );
|
|
|
|
}
|
2013-03-18 19:36:07 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
DLIST_ITERATOR_WRAPPER<BOARD_ITEM> GraphicalItems()
|
|
|
|
{
|
|
|
|
return DLIST_ITERATOR_WRAPPER<BOARD_ITEM>( m_Drawings );
|
|
|
|
}
|
2017-03-22 13:11:08 +00:00
|
|
|
|
2017-10-27 14:25:20 +00:00
|
|
|
std::list<MODULE_3D_SETTINGS>& Models() { return m_3D_Drawings; }
|
|
|
|
const std::list<MODULE_3D_SETTINGS>& Models() const { return m_3D_Drawings; }
|
2013-03-18 19:36:07 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetPosition( const wxPoint& aPos ) override;
|
2017-04-25 09:06:24 +00:00
|
|
|
|
2017-12-18 17:24:25 +00:00
|
|
|
const wxPoint GetPosition() const override { return m_Pos; }
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2011-12-14 04:29:25 +00:00
|
|
|
void SetOrientation( double newangle );
|
2017-04-25 09:06:24 +00:00
|
|
|
|
|
|
|
void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); }
|
2011-12-14 04:29:25 +00:00
|
|
|
double GetOrientation() const { return m_Orient; }
|
2017-04-25 09:06:24 +00:00
|
|
|
double GetOrientationDegrees() const { return m_Orient / 10.0; }
|
|
|
|
double GetOrientationRadians() const { return m_Orient * M_PI / 1800; }
|
2011-11-29 17:25:30 +00:00
|
|
|
|
2016-11-20 23:35:08 +00:00
|
|
|
const LIB_ID& GetFPID() const { return m_fpid; }
|
|
|
|
void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
|
|
|
const wxString& GetDescription() const { return m_Doc; }
|
|
|
|
void SetDescription( const wxString& aDoc ) { m_Doc = aDoc; }
|
|
|
|
|
|
|
|
const wxString& GetKeywords() const { return m_KeyWord; }
|
|
|
|
void SetKeywords( const wxString& aKeywords ) { m_KeyWord = aKeywords; }
|
|
|
|
|
|
|
|
const wxString& GetPath() const { return m_Path; }
|
|
|
|
void SetPath( const wxString& aPath ) { m_Path = aPath; }
|
|
|
|
|
|
|
|
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
|
|
|
|
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
|
|
|
|
|
|
|
|
int GetLocalClearance() const { return m_LocalClearance; }
|
|
|
|
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
|
|
|
|
|
|
|
|
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
|
|
|
|
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
|
|
|
|
|
|
|
|
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
|
|
|
|
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
|
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; }
|
|
|
|
ZoneConnection GetZoneConnection() const { return m_ZoneConnection; }
|
|
|
|
|
2012-03-08 20:44:03 +00:00
|
|
|
void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
|
|
|
|
int GetThermalWidth() const { return m_ThermalWidth; }
|
|
|
|
|
|
|
|
void SetThermalGap( int aGap ) { m_ThermalGap = aGap; }
|
|
|
|
int GetThermalGap() const { return m_ThermalGap; }
|
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
int GetAttributes() const { return m_Attributs; }
|
|
|
|
void SetAttributes( int aAttributes ) { m_Attributs = aAttributes; }
|
|
|
|
|
2015-03-23 08:28:12 +00:00
|
|
|
void SetFlag( int aFlag ) { m_arflag = aFlag; }
|
|
|
|
void IncrementFlag() { m_arflag += 1; }
|
|
|
|
int GetFlag() const { return m_arflag; }
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2018-11-03 17:31:07 +00:00
|
|
|
// A bit of a hack until net ties are supported as first class citizens
|
|
|
|
bool IsNetTie() const { return GetKeywords().StartsWith( wxT( "net tie" ) ); }
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void Move( const wxPoint& aMoveVector ) override;
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void Flip( const wxPoint& aCentre ) override;
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2013-03-23 13:30:00 +00:00
|
|
|
/**
|
|
|
|
* Function MoveAnchorPosition
|
|
|
|
* Move the reference point of the footprint
|
|
|
|
* It looks like a move footprint:
|
|
|
|
* the footprints elements (pads, outlines, edges .. ) are moved
|
|
|
|
* However:
|
|
|
|
* - the footprint position is not modified.
|
|
|
|
* - the relative (local) coordinates of these items are modified
|
|
|
|
* (a move footprint does not change these local coordinates,
|
|
|
|
* but changes the footprint position)
|
|
|
|
*/
|
|
|
|
void MoveAnchorPosition( const wxPoint& aMoveVector );
|
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/**
|
|
|
|
* function IsFlipped
|
|
|
|
* @return true if the module is flipped, i.e. on the back side of the board
|
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
bool IsFlipped() const { return GetLayer() == B_Cu; }
|
2012-09-11 07:33:17 +00:00
|
|
|
|
2013-03-18 19:36:07 +00:00
|
|
|
// m_ModuleStatus bits:
|
|
|
|
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
|
|
|
|
#define MODULE_is_PLACED 0x02 ///< In autoplace: module automatically placed
|
|
|
|
#define MODULE_to_PLACE 0x04 ///< In autoplace: module waiting for autoplace
|
2015-02-17 23:58:14 +00:00
|
|
|
#define MODULE_PADS_LOCKED 0x08 ///< In autoplace: module waiting for autoplace
|
2013-03-18 19:36:07 +00:00
|
|
|
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool IsLocked() const override
|
2007-06-15 16:08:55 +00:00
|
|
|
{
|
2016-05-09 08:29:06 +00:00
|
|
|
return ( m_ModuleStatus & MODULE_is_LOCKED ) != 0;
|
2007-06-15 16:08:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLocked
|
|
|
|
* sets the MODULE_is_LOCKED bit in the m_ModuleStatus
|
2011-12-12 08:37:05 +00:00
|
|
|
* @param isLocked When true means turn on locked status, else unlock
|
2007-06-15 16:08:55 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetLocked( bool isLocked ) override
|
2007-06-15 16:08:55 +00:00
|
|
|
{
|
2011-12-12 08:37:05 +00:00
|
|
|
if( isLocked )
|
2007-06-15 16:08:55 +00:00
|
|
|
m_ModuleStatus |= MODULE_is_LOCKED;
|
|
|
|
else
|
|
|
|
m_ModuleStatus &= ~MODULE_is_LOCKED;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
bool IsPlaced() const { return m_ModuleStatus & MODULE_is_PLACED; }
|
2011-12-01 06:04:23 +00:00
|
|
|
void SetIsPlaced( bool isPlaced )
|
|
|
|
{
|
|
|
|
if( isPlaced )
|
|
|
|
m_ModuleStatus |= MODULE_is_PLACED;
|
|
|
|
else
|
|
|
|
m_ModuleStatus &= ~MODULE_is_PLACED;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
bool NeedsPlaced() const { return m_ModuleStatus & MODULE_to_PLACE; }
|
2013-03-13 18:53:58 +00:00
|
|
|
void SetNeedsPlaced( bool needsPlaced )
|
|
|
|
{
|
|
|
|
if( needsPlaced )
|
|
|
|
m_ModuleStatus |= MODULE_to_PLACE;
|
|
|
|
else
|
|
|
|
m_ModuleStatus &= ~MODULE_to_PLACE;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
bool PadsLocked() const { return m_ModuleStatus & MODULE_PADS_LOCKED; }
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2015-02-17 23:58:14 +00:00
|
|
|
void SetPadsLocked( bool aPadsLocked )
|
|
|
|
{
|
|
|
|
if( aPadsLocked )
|
|
|
|
m_ModuleStatus |= MODULE_PADS_LOCKED;
|
|
|
|
else
|
|
|
|
m_ModuleStatus &= ~MODULE_PADS_LOCKED;
|
|
|
|
}
|
|
|
|
|
2018-03-27 18:43:52 +00:00
|
|
|
void SetLastEditTime( timestamp_t aTime ) { m_LastEditTime = aTime; }
|
2017-04-25 09:06:24 +00:00
|
|
|
void SetLastEditTime() { m_LastEditTime = time( NULL ); }
|
2018-03-27 18:43:52 +00:00
|
|
|
timestamp_t GetLastEditTime() const { return m_LastEditTime; }
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-06-15 16:08:55 +00:00
|
|
|
/* drawing functions */
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
|
|
|
* draws the footprint to the \a aDC.
|
|
|
|
* @param aPanel = draw panel, Used to know the clip box
|
|
|
|
* @param aDC = Current Device Context
|
|
|
|
* @param aDrawMode = GR_OR, GR_XOR..
|
|
|
|
* @param aOffset = draw offset (usually wxPoint(0,0)
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* aPanel,
|
2017-04-25 09:06:24 +00:00
|
|
|
wxDC* aDC,
|
|
|
|
GR_DRAWMODE aDrawMode,
|
|
|
|
const wxPoint& aOffset = ZeroOffset ) override;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2015-01-19 08:23:10 +00:00
|
|
|
/**
|
|
|
|
* Function DrawOutlinesWhenMoving
|
|
|
|
* draws in XOR mode the footprint when moving it to the \a aDC.
|
|
|
|
* To speed up the drawing, only a simplified shape is drawn
|
|
|
|
* @param aPanel = draw panel, Used to know the clip box
|
|
|
|
* @param aDC = Current Device Context
|
|
|
|
* @param aMoveVector = the offset between the curr position and
|
|
|
|
* the draw position.
|
|
|
|
*/
|
|
|
|
void DrawOutlinesWhenMoving( EDA_DRAW_PANEL* aPanel,
|
2017-04-25 09:06:24 +00:00
|
|
|
wxDC* aDC, const wxPoint& aMoveVector );
|
2015-01-19 08:23:10 +00:00
|
|
|
|
2013-05-01 19:01:14 +00:00
|
|
|
/**
|
|
|
|
* function TransformPadsShapesWithClearanceToPolygon
|
|
|
|
* generate pads shapes on layer aLayer as polygons,
|
|
|
|
* and adds these polygons to aCornerBuffer
|
|
|
|
* Useful to generate a polygonal representation of a footprint
|
|
|
|
* in 3D view and plot functions, when a full polygonal approach is needed
|
2018-02-19 00:00:29 +00:00
|
|
|
* @param aLayer = the layer to consider, or UNDEFINED_LAYER to consider all
|
2013-05-01 19:01:14 +00:00
|
|
|
* @param aCornerBuffer = the buffer to store polygons
|
|
|
|
* @param aInflateValue = an additionnal size to add to pad shapes
|
|
|
|
* aInflateValue = 0 to have the exact pad size
|
|
|
|
* @param aCircleToSegmentsCount = number of segments to generate a circle
|
|
|
|
* @param aCorrectionFactor = the correction to apply to a circle radius
|
|
|
|
* to approximate a circle by the polygon.
|
|
|
|
* if aCorrectionFactor = 1.0, the polygon is inside the circle
|
|
|
|
* the radius of circle approximated by segments is
|
|
|
|
* initial radius * aCorrectionFactor
|
2015-03-23 08:28:12 +00:00
|
|
|
* @param aSkipNPTHPadsWihNoCopper = if true, do not add a NPTH pad shape,
|
|
|
|
* if the shape has same size and position as the hole. Usually, these
|
|
|
|
* pads are not drawn on copper layers, because there is actually no copper
|
|
|
|
* Due to diff between layers and holes, these pads must be skipped to be sure
|
|
|
|
* there is no copper left on the board (for instance when creating Gerber Files or 3D shapes)
|
|
|
|
* default = false
|
2013-05-01 19:01:14 +00:00
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
void TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
|
2017-04-25 09:06:24 +00:00
|
|
|
SHAPE_POLY_SET& aCornerBuffer,
|
|
|
|
int aInflateValue,
|
|
|
|
int aCircleToSegmentsCount,
|
|
|
|
double aCorrectionFactor,
|
|
|
|
bool aSkipNPTHPadsWihNoCopper = false ) const;
|
2013-05-01 19:01:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* function TransformGraphicShapesWithClearanceToPolygonSet
|
|
|
|
* generate shapes of graphic items (outlines) on layer aLayer as polygons,
|
|
|
|
* and adds these polygons to aCornerBuffer
|
|
|
|
* Useful to generate a polygonal representation of a footprint
|
|
|
|
* in 3D view and plot functions, when a full polygonal approach is needed
|
2018-02-19 00:00:29 +00:00
|
|
|
* @param aLayer = the layer to consider, or UNDEFINED_LAYER to consider all
|
2013-05-01 19:01:14 +00:00
|
|
|
* @param aCornerBuffer = the buffer to store polygons
|
|
|
|
* @param aInflateValue = a value to inflate shapes
|
|
|
|
* aInflateValue = 0 to have the exact shape size
|
|
|
|
* @param aCircleToSegmentsCount = number of segments to generate a circle
|
|
|
|
* @param aCorrectionFactor = the correction to apply to a circle radius
|
|
|
|
* to approximate a circle by the polygon.
|
|
|
|
* if aCorrectionFactor = 1.0, the polygon is inside the circle
|
|
|
|
* the radius of circle approximated by segments is
|
|
|
|
* initial radius * aCorrectionFactor
|
2015-08-11 11:56:02 +00:00
|
|
|
* @param aCircleToSegmentsCountForTexts = number of segments to generate
|
|
|
|
* a circle when building the texts polygonal shapes of the stroke font
|
|
|
|
* if 0, use the aCircleToSegmentsCount value
|
2013-05-01 19:01:14 +00:00
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
void TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
|
|
|
|
SHAPE_POLY_SET& aCornerBuffer,
|
|
|
|
int aInflateValue,
|
|
|
|
int aCircleToSegmentsCount,
|
|
|
|
double aCorrectionFactor,
|
2018-02-19 00:00:29 +00:00
|
|
|
int aCircleToSegmentsCountForTexts = 0,
|
|
|
|
bool aIncludeText = true ) const;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief TransformGraphicTextWithClearanceToPolygonSet
|
|
|
|
* This function is the same as TransformGraphicShapesWithClearanceToPolygonSet
|
|
|
|
* but only generate text
|
|
|
|
* @param aLayer
|
|
|
|
* @param aCornerBuffer
|
|
|
|
* @param aInflateValue
|
|
|
|
* @param aCircleToSegmentsCount
|
|
|
|
* @param aCorrectionFactor
|
|
|
|
* @param aCircleToSegmentsCountForTexts
|
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
void TransformGraphicTextWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
|
|
|
|
SHAPE_POLY_SET& aCornerBuffer,
|
|
|
|
int aInflateValue,
|
|
|
|
int aCircleToSegmentsCount,
|
|
|
|
double aCorrectionFactor,
|
|
|
|
int aCircleToSegmentsCountForTexts = 0 ) const;
|
2013-05-01 19:01:14 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
/**
|
|
|
|
* Function DrawEdgesOnly
|
|
|
|
* Draws the footprint edges only to the current Device Context
|
|
|
|
* @param panel = The active Draw Panel (used to know the clip box)
|
|
|
|
* @param DC = current Device Context
|
|
|
|
* @param offset = draw offset (usually wxPoint(0,0)
|
|
|
|
* @param draw_mode = GR_OR, GR_XOR, GR_AND
|
|
|
|
*/
|
2012-09-01 13:38:27 +00:00
|
|
|
void DrawEdgesOnly( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
|
2017-04-25 09:06:24 +00:00
|
|
|
GR_DRAWMODE draw_mode );
|
2011-09-15 17:58:35 +00:00
|
|
|
|
2016-05-31 09:11:17 +00:00
|
|
|
/**
|
|
|
|
* Function DrawAncre
|
|
|
|
* Draw the anchor cross (vertical)
|
|
|
|
* Must be done after the pads, because drawing the hole will erase overwrite
|
|
|
|
* every thing already drawn.
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC,
|
2017-04-25 09:06:24 +00:00
|
|
|
const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode );
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2016-05-31 09:11:17 +00:00
|
|
|
///> @copydoc EDA_ITEM::GetMsgPanelInfo
|
2018-04-10 10:52:12 +00:00
|
|
|
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool HitTest( const wxPoint& aPosition ) const override;
|
2007-08-08 03:50:44 +00:00
|
|
|
|
2018-02-19 00:00:29 +00:00
|
|
|
/**
|
|
|
|
* Tests if a point is inside the bounding polygon of the module
|
|
|
|
*
|
|
|
|
* The other hit test methods are just checking the bounding box, which
|
|
|
|
* can be quite inaccurate for rotated or oddly-shaped footprints.
|
|
|
|
*
|
|
|
|
* @param aPosition is the point to test
|
|
|
|
* @return true if aPosition is inside the bounding polygon
|
|
|
|
*/
|
|
|
|
bool HitTestAccurate( const wxPoint& aPosition ) const;
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
|
2008-01-06 12:43:57 +00:00
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
/**
|
2007-08-24 03:40:04 +00:00
|
|
|
* Function GetReference
|
2008-01-29 22:09:09 +00:00
|
|
|
* @return const wxString& - the reference designator text.
|
2007-08-24 03:40:04 +00:00
|
|
|
*/
|
2019-04-03 18:13:47 +00:00
|
|
|
const wxString GetReference() const
|
2007-08-24 03:40:04 +00:00
|
|
|
{
|
2014-09-10 15:18:42 +00:00
|
|
|
return m_Reference->GetText();
|
2007-08-24 03:40:04 +00:00
|
|
|
}
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2012-02-17 19:43:43 +00:00
|
|
|
/**
|
|
|
|
* Function SetReference
|
2012-03-17 14:39:27 +00:00
|
|
|
* @param aReference A reference to a wxString object containing the reference designator
|
|
|
|
* text.
|
2012-02-17 19:43:43 +00:00
|
|
|
*/
|
2012-03-17 14:39:27 +00:00
|
|
|
void SetReference( const wxString& aReference )
|
2012-02-17 19:43:43 +00:00
|
|
|
{
|
2014-09-10 15:18:42 +00:00
|
|
|
m_Reference->SetText( aReference );
|
2012-02-17 19:43:43 +00:00
|
|
|
}
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2018-07-24 18:41:08 +00:00
|
|
|
/**
|
|
|
|
* Function IncrementReference
|
|
|
|
* Bumps the current reference by aDelta.
|
|
|
|
*/
|
|
|
|
void IncrementReference( int aDelta );
|
|
|
|
|
2008-01-29 22:09:09 +00:00
|
|
|
/**
|
|
|
|
* Function GetValue
|
|
|
|
* @return const wxString& - the value text.
|
|
|
|
*/
|
2019-04-03 18:13:47 +00:00
|
|
|
const wxString GetValue() const
|
2008-01-29 22:09:09 +00:00
|
|
|
{
|
2014-09-10 15:18:42 +00:00
|
|
|
return m_Value->GetText();
|
2008-01-29 22:09:09 +00:00
|
|
|
}
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2012-02-17 19:43:43 +00:00
|
|
|
/**
|
|
|
|
* Function SetValue
|
2012-03-17 14:39:27 +00:00
|
|
|
* @param aValue A reference to a wxString object containing the value text.
|
2012-02-17 19:43:43 +00:00
|
|
|
*/
|
|
|
|
void SetValue( const wxString& aValue )
|
|
|
|
{
|
2014-09-10 15:18:42 +00:00
|
|
|
m_Value->SetText( aValue );
|
2012-02-17 19:43:43 +00:00
|
|
|
}
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2012-05-22 17:51:18 +00:00
|
|
|
/// read/write accessors:
|
|
|
|
TEXTE_MODULE& Value() { return *m_Value; }
|
|
|
|
TEXTE_MODULE& Reference() { return *m_Reference; }
|
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
/// The const versions to keep the compiler happy.
|
2017-04-25 09:06:24 +00:00
|
|
|
TEXTE_MODULE& Value() const { return *m_Value; }
|
|
|
|
TEXTE_MODULE& Reference() const { return *m_Reference; }
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
/**
|
|
|
|
* Function FindPadByName
|
|
|
|
* returns a D_PAD* with a matching name. Note that names may not be
|
|
|
|
* unique, depending on how the foot print was created.
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aPadName the pad name to find
|
2009-11-12 15:43:38 +00:00
|
|
|
* @return D_PAD* - The first matching name is returned, or NULL if not
|
|
|
|
* found.
|
2008-03-04 04:22:27 +00:00
|
|
|
*/
|
2011-09-15 17:58:35 +00:00
|
|
|
D_PAD* FindPadByName( const wxString& aPadName ) const;
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
/**
|
|
|
|
* Function GetPad
|
2013-04-25 16:29:35 +00:00
|
|
|
* get a pad at \a aPosition on \a aLayerMask in the footprint.
|
2011-09-15 17:58:35 +00:00
|
|
|
*
|
|
|
|
* @param aPosition A wxPoint object containing the position to hit test.
|
|
|
|
* @param aLayerMask A layer or layers to mask the hit test.
|
|
|
|
* @return A pointer to a D_PAD object if found otherwise NULL.
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
D_PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2017-04-22 20:07:29 +00:00
|
|
|
D_PAD* GetTopLeftPad();
|
|
|
|
|
2012-04-16 03:18:41 +00:00
|
|
|
/**
|
2015-11-11 20:16:39 +00:00
|
|
|
* GetPadCount
|
2012-04-16 03:18:41 +00:00
|
|
|
* returns the number of pads.
|
2013-06-07 13:17:52 +00:00
|
|
|
*
|
|
|
|
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
|
|
|
* non-plated through holes when false.
|
|
|
|
* @return the number of pads according to \a aIncludeNPTH.
|
2012-04-16 03:18:41 +00:00
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
|
2015-11-11 18:35:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GetUniquePadCount
|
|
|
|
* returns the number of unique pads.
|
2015-11-13 11:32:42 +00:00
|
|
|
* A complex pad can be built with many pads having the same pad name
|
|
|
|
* to create a complex shape or fragmented solder paste areas.
|
|
|
|
*
|
|
|
|
* GetUniquePadCount calculate the count of not blank pad names
|
2015-11-11 18:35:26 +00:00
|
|
|
*
|
|
|
|
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
|
|
|
* non-plated through holes when false.
|
|
|
|
* @return the number of unique pads according to \a aIncludeNPTH.
|
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
|
2012-04-16 03:18:41 +00:00
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
/**
|
|
|
|
* Function GetNextPadName
|
|
|
|
* returns the next available pad name in the module
|
|
|
|
*
|
|
|
|
* @param aFillSequenceGaps true if the numbering should "fill in" gaps in
|
|
|
|
* the sequence, else return the highest value + 1
|
|
|
|
* @return the next available pad name
|
|
|
|
*/
|
|
|
|
wxString GetNextPadName( bool aFillSequenceGaps ) const;
|
|
|
|
|
2018-09-13 21:29:52 +00:00
|
|
|
double GetArea( int aPadding = 0 ) const;
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2017-12-07 08:29:10 +00:00
|
|
|
timestamp_t GetLink() const { return m_Link; }
|
|
|
|
void SetLink( timestamp_t aLink ) { m_Link = aLink; }
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
int GetPlacementCost180() const { return m_CntRot180; }
|
2013-03-13 18:53:58 +00:00
|
|
|
void SetPlacementCost180( int aCost ) { m_CntRot180 = aCost; }
|
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
int GetPlacementCost90() const { return m_CntRot90; }
|
2013-03-13 18:53:58 +00:00
|
|
|
void SetPlacementCost90( int aCost ) { m_CntRot90 = aCost; }
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
/**
|
2016-05-11 08:17:34 +00:00
|
|
|
* Function Duplicate
|
|
|
|
* Duplicate a given item within the module, without adding to the board
|
2015-02-12 03:22:24 +00:00
|
|
|
* @return the new item, or NULL if the item could not be duplicated
|
|
|
|
*/
|
2016-05-11 08:17:34 +00:00
|
|
|
BOARD_ITEM* Duplicate( const BOARD_ITEM* aItem,
|
2017-04-25 09:06:24 +00:00
|
|
|
bool aIncrementPadNumbers,
|
|
|
|
bool aAddToModule = false );
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
/**
|
|
|
|
* Function Add3DModel
|
|
|
|
* adds \a a3DModel definition to the end of the 3D model list.
|
|
|
|
*
|
2017-10-27 14:25:20 +00:00
|
|
|
* @param a3DModel A pointer to a #MODULE_3D_SETTINGS to add to the list.
|
2012-06-09 17:00:13 +00:00
|
|
|
*/
|
2017-10-27 14:25:20 +00:00
|
|
|
void Add3DModel( MODULE_3D_SETTINGS* a3DModel );
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
wxString GetClass() const override
|
2007-08-07 06:21:19 +00:00
|
|
|
{
|
|
|
|
return wxT( "MODULE" );
|
|
|
|
}
|
|
|
|
|
2018-04-10 10:52:12 +00:00
|
|
|
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2017-02-20 12:20:39 +00:00
|
|
|
BITMAP_DEF GetMenuImage() const override;
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
EDA_ITEM* Clone() const override;
|
2012-03-17 14:39:27 +00:00
|
|
|
|
2013-12-18 12:39:11 +00:00
|
|
|
/**
|
|
|
|
* Function RunOnChildren
|
|
|
|
*
|
|
|
|
* Invokes a function on all BOARD_ITEMs that belong to the module (pads, drawings, texts).
|
|
|
|
* @param aFunction is the function to be invoked.
|
|
|
|
*/
|
2017-09-23 09:20:10 +00:00
|
|
|
void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction );
|
2013-12-18 12:39:11 +00:00
|
|
|
|
2018-03-08 01:40:50 +00:00
|
|
|
/**
|
|
|
|
* Returns a set of all layers that this module has drawings on
|
|
|
|
* similar to ViewGetLayers()
|
|
|
|
*
|
|
|
|
* @param aLayers is an array to store layer ids
|
|
|
|
* @param aCount is the number of layers stored in the array
|
|
|
|
* @param aIncludePads controls whether to also include pad layers
|
|
|
|
*/
|
|
|
|
void GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads = true ) const;
|
2013-12-02 13:35:05 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2016-12-05 22:54:41 +00:00
|
|
|
virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual const BOX2I ViewBBox() const override;
|
2014-11-13 16:32:59 +00:00
|
|
|
|
2013-04-25 16:29:35 +00:00
|
|
|
/**
|
|
|
|
* Function CopyNetlistSettings
|
|
|
|
* copies the netlist settings to \a aModule.
|
2015-10-22 16:50:27 +00:00
|
|
|
* Used to copy some footprint parameters when replacing a footprint by an other
|
|
|
|
* footprint when reading a netlist, or in exchange footprint dialog
|
2013-04-25 16:29:35 +00:00
|
|
|
*
|
|
|
|
* The netlist settings are all of the #MODULE settings not define by a #MODULE in
|
2015-10-22 16:50:27 +00:00
|
|
|
* a netlist. These setting include placement prms (position, orientation, side)
|
|
|
|
* and optionally local prms( clearances, zone connection type, etc).
|
2013-04-25 16:29:35 +00:00
|
|
|
* The reference designator, value, path, and physical geometry settings are not
|
|
|
|
* copied.
|
|
|
|
*
|
|
|
|
* @param aModule is the #MODULE to copy the settings to.
|
2015-10-22 16:50:27 +00:00
|
|
|
* @param aCopyLocalSettings = false to copy only module placement
|
|
|
|
* true to also copy local prms
|
2013-04-25 16:29:35 +00:00
|
|
|
*/
|
2015-10-22 16:50:27 +00:00
|
|
|
void CopyNetlistSettings( MODULE* aModule, bool aCopyLocalSettings );
|
2013-04-25 16:29:35 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
/**
|
|
|
|
* static function IsLibNameValid
|
|
|
|
* Test for validity of a name of a footprint to be used in a footprint library
|
|
|
|
* ( no spaces, dir separators ... )
|
|
|
|
* @param aName = the name in library to validate
|
|
|
|
* @return true if the given name is valid
|
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
static bool IsLibNameValid( const wxString& aName );
|
2012-12-10 11:18:42 +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
|
|
|
* static function StringLibNameInvalidChars
|
2012-12-10 11:18:42 +00:00
|
|
|
* Test for validity of the name in a library of the footprint
|
|
|
|
* ( no spaces, dir separators ... )
|
2012-12-18 13:54:44 +00:00
|
|
|
* @param aUserReadable = false to get the list of invalid chars
|
|
|
|
* true to get a readable form (i.e ' ' = 'space' '\\t'= 'tab')
|
2012-12-10 11:18:42 +00:00
|
|
|
* @return a constant std::string giving the list of invalid chars in lib name
|
|
|
|
*/
|
* 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
|
|
|
static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
|
2012-12-10 11:18:42 +00:00
|
|
|
|
2013-06-23 19:18:33 +00:00
|
|
|
/**
|
|
|
|
* Function SetInitialComments
|
|
|
|
* takes ownership of caller's heap allocated aInitialComments block. The comments
|
|
|
|
* are single line strings already containing the s-expression comments with
|
|
|
|
* optional leading whitespace and then a '#' character followed by optional
|
|
|
|
* single line text (text with no line endings, not even one).
|
|
|
|
* This block of single line comments will be output upfront of any generated
|
|
|
|
* s-expression text in the PCBIO::Format() function.
|
|
|
|
* <p>
|
|
|
|
* Note that a block of single line comments constitutes a multiline block of
|
|
|
|
* single line comments. That is, the block is made of consecutive single line
|
|
|
|
* comments.
|
|
|
|
* @param aInitialComments is a heap allocated wxArrayString or NULL, which the caller
|
|
|
|
* gives up ownership of over to this MODULE.
|
|
|
|
*/
|
|
|
|
void SetInitialComments( wxArrayString* aInitialComments )
|
|
|
|
{
|
|
|
|
delete m_initial_comments;
|
|
|
|
m_initial_comments = aInitialComments;
|
|
|
|
}
|
|
|
|
|
2015-02-18 16:53:46 +00:00
|
|
|
/**
|
2017-12-22 00:49:35 +00:00
|
|
|
* Function CoverageRatio
|
|
|
|
* Calculates the ratio of total area of the footprint pads and graphical items
|
|
|
|
* to the area of the footprint. Used by selection tool heuristics.
|
2015-02-17 23:58:14 +00:00
|
|
|
* @return the ratio
|
|
|
|
*/
|
2018-02-22 10:10:48 +00:00
|
|
|
double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
|
2015-02-17 23:58:14 +00:00
|
|
|
|
2013-06-23 19:18:33 +00:00
|
|
|
/// Return the initial comments block or NULL if none, without transfer of ownership.
|
2013-06-25 15:56:12 +00:00
|
|
|
const wxArrayString* GetInitialComments() const { return m_initial_comments; }
|
2013-06-23 19:18:33 +00:00
|
|
|
|
2017-03-16 17:09:33 +00:00
|
|
|
/** Used in DRC to test the courtyard area (a complex polygon)
|
|
|
|
* @return the courtyard polygon
|
|
|
|
*/
|
2017-03-19 15:38:30 +00:00
|
|
|
SHAPE_POLY_SET& GetPolyCourtyardFront() { return m_poly_courtyard_front; }
|
|
|
|
SHAPE_POLY_SET& GetPolyCourtyardBack() { return m_poly_courtyard_back; }
|
2017-03-16 17:09:33 +00:00
|
|
|
|
|
|
|
/** Used in DRC to build the courtyard area (a complex polygon)
|
|
|
|
* from graphic items put on the courtyard
|
2017-03-19 15:38:30 +00:00
|
|
|
* @return true if OK, or no courtyard defined,
|
|
|
|
* false only if the polygon cannot be built due to amalformed courtyard shape
|
2017-03-16 17:09:33 +00:00
|
|
|
* The polygon cannot be built if segments/arcs on courtyard layers
|
|
|
|
* cannot be grouped in a polygon.
|
|
|
|
*/
|
|
|
|
bool BuildPolyCourtyard();
|
|
|
|
|
2017-10-31 13:59:03 +00:00
|
|
|
virtual void SwapData( BOARD_ITEM* aImage ) override;
|
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
#if defined(DEBUG)
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
2007-08-06 02:02:39 +00:00
|
|
|
#endif
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2012-04-17 01:35:43 +00:00
|
|
|
private:
|
2017-04-25 09:06:24 +00:00
|
|
|
DLIST<D_PAD> m_Pads; ///< Linked list of pads.
|
2013-03-18 19:36:07 +00:00
|
|
|
DLIST<BOARD_ITEM> m_Drawings; ///< Linked list of graphical items.
|
2017-10-27 14:25:20 +00:00
|
|
|
std::list<MODULE_3D_SETTINGS> m_3D_Drawings; ///< Linked list of 3D models.
|
2017-04-25 09:06:24 +00:00
|
|
|
double m_Orient; ///< Orientation in tenths of a degree, 900=90.0 degrees.
|
|
|
|
wxPoint m_Pos; ///< Position of module on the board in internal units.
|
|
|
|
TEXTE_MODULE* m_Reference; ///< Component reference designator value (U34, R18..)
|
|
|
|
TEXTE_MODULE* m_Value; ///< Component value (74LS00, 22K..)
|
|
|
|
LIB_ID m_fpid; ///< The #LIB_ID of the MODULE.
|
|
|
|
int m_Attributs; ///< Flag bits ( see Mod_Attribut )
|
|
|
|
int m_ModuleStatus; ///< For autoplace: flags (LOCKED, AUTOPLACED)
|
|
|
|
EDA_RECT m_BoundaryBox; ///< Bounding box : coordinates on board, real orientation.
|
2013-03-13 18:53:58 +00:00
|
|
|
|
|
|
|
// The final margin is the sum of these 2 values
|
2017-04-25 09:06:24 +00:00
|
|
|
int m_ThermalWidth;
|
|
|
|
int m_ThermalGap;
|
|
|
|
wxString m_Doc; ///< File name and path for documentation file.
|
|
|
|
wxString m_KeyWord; ///< Search keywords to find module in library.
|
|
|
|
wxString m_Path;
|
|
|
|
ZoneConnection m_ZoneConnection;
|
2018-03-27 18:43:52 +00:00
|
|
|
timestamp_t m_LastEditTime;
|
2017-04-25 09:06:24 +00:00
|
|
|
int m_arflag; ///< Use to trace ratsnest and auto routing.
|
2018-06-22 13:05:11 +00:00
|
|
|
timestamp_t m_Link; ///< Temporary logical link used during editing
|
2017-04-25 09:06:24 +00:00
|
|
|
int m_CntRot90; ///< Horizontal automatic placement cost ( 0..10 ).
|
|
|
|
int m_CntRot180; ///< Vertical automatic placement cost ( 0..10 ).
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2012-04-17 01:35:43 +00:00
|
|
|
// Local tolerances. When zero, this means the corresponding netclass value
|
|
|
|
// is used. Usually theses local tolerances zero, in deference to the
|
|
|
|
// corresponding netclass values.
|
2017-04-25 09:06:24 +00:00
|
|
|
int m_LocalClearance;
|
|
|
|
int m_LocalSolderMaskMargin; ///< Solder mask margin
|
|
|
|
int m_LocalSolderPasteMargin; ///< Solder paste margin absolute value
|
|
|
|
double m_LocalSolderPasteMarginRatio; ///< Solder mask margin ratio
|
|
|
|
///< value of pad size
|
2013-06-23 19:18:33 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
wxArrayString* m_initial_comments; ///< leading s-expression comments in the module,
|
2013-06-23 19:18:33 +00:00
|
|
|
///< lazily allocated only if needed for speed
|
2017-03-16 17:09:33 +00:00
|
|
|
|
|
|
|
/// Used in DRC to test the courtyard area (a polygon which can be not basic
|
2017-03-19 15:38:30 +00:00
|
|
|
/// Note also a footprint can have courtyards on bot board sides
|
|
|
|
SHAPE_POLY_SET m_poly_courtyard_front;
|
|
|
|
SHAPE_POLY_SET m_poly_courtyard_back;
|
2012-04-17 01:35:43 +00:00
|
|
|
};
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#endif // MODULE_H_
|