2014-10-22 15:51:34 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-01-30 18:42:46 +00:00
|
|
|
* Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-02-02 20:57:12 +00:00
|
|
|
* Copyright (C) 1992-2015 KiCad Developers, see CHANGELOG.txt for contributors.
|
2014-10-22 15:51:34 +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
|
|
|
|
*/
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2012-02-06 07:14:51 +00:00
|
|
|
#ifndef BOARD_DESIGN_SETTINGS_H_
|
|
|
|
#define BOARD_DESIGN_SETTINGS_H_
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
#include <class_pad.h>
|
2014-04-25 06:00:04 +00:00
|
|
|
#include <class_track.h>
|
2018-01-30 14:34:09 +00:00
|
|
|
#include <netclass.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <config_params.h>
|
2010-01-21 07:41:30 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
#define DEFAULT_SILK_LINE_WIDTH 0.12
|
|
|
|
#define DEFAULT_COPPER_LINE_WIDTH 0.20
|
2018-08-24 20:08:30 +00:00
|
|
|
#define DEFAULT_EDGE_WIDTH 0.05
|
|
|
|
#define DEFAULT_COURTYARD_WIDTH 0.05
|
2018-04-28 15:22:25 +00:00
|
|
|
#define DEFAULT_LINE_WIDTH 0.10
|
|
|
|
|
|
|
|
#define DEFAULT_SILK_TEXT_SIZE 1.0
|
|
|
|
#define DEFAULT_COPPER_TEXT_SIZE 1.5
|
|
|
|
#define DEFAULT_TEXT_SIZE 1.0
|
|
|
|
|
|
|
|
#define DEFAULT_SILK_TEXT_WIDTH 0.15
|
|
|
|
#define DEFAULT_COPPER_TEXT_WIDTH 0.30
|
|
|
|
#define DEFAULT_TEXT_WIDTH 0.15
|
2015-03-02 15:59:03 +00:00
|
|
|
|
|
|
|
// Board thickness, mainly for 3D view:
|
2018-04-28 15:22:25 +00:00
|
|
|
#define DEFAULT_BOARD_THICKNESS_MM 1.6
|
2015-03-02 15:59:03 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
#define DEFAULT_PCB_EDGE_THICKNESS 0.15
|
2015-03-02 15:59:03 +00:00
|
|
|
|
2018-09-08 13:33:07 +00:00
|
|
|
#define DEFAULT_SOLDERMASK_CLEARANCE 0.051 // soldermask to pad clearance
|
|
|
|
#define DEFAULT_SOLDERMASK_MIN_WIDTH 0.25 // soldermask minimum dam size
|
2018-04-28 15:22:25 +00:00
|
|
|
#define DEFAULT_SOLDERPASTE_CLEARANCE 0.0
|
|
|
|
#define DEFAULT_SOLDERPASTE_RATIO 0.0
|
2015-03-02 15:59:03 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
#define DEFAULT_CUSTOMTRACKWIDTH 0.2
|
|
|
|
#define DEFAULT_CUSTOMDPAIRWIDTH 0.125
|
|
|
|
#define DEFAULT_CUSTOMDPAIRGAP 0.18
|
|
|
|
#define DEFAULT_CUSTOMDPAIRVIAGAP 0.18
|
|
|
|
|
|
|
|
#define DEFAULT_TRACKMINWIDTH 0.2 // track width min value
|
|
|
|
#define DEFAULT_VIASMINSIZE 0.4 // vias (not micro vias) min diameter
|
|
|
|
#define DEFAULT_VIASMINDRILL 0.3 // vias (not micro vias) min drill diameter
|
|
|
|
#define DEFAULT_MICROVIASMINSIZE 0.2 // micro vias (not vias) min diameter
|
|
|
|
#define DEFAULT_MICROVIASMINDRILL 0.1 // micro vias (not vias) min drill diameter
|
|
|
|
#define DEFAULT_HOLETOHOLEMIN 0.25 // separation between drilled hole edges
|
2015-03-02 15:59:03 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
/**
|
|
|
|
* Struct VIA_DIMENSION
|
|
|
|
* is a small helper container to handle a stock of specific vias each with
|
|
|
|
* unique diameter and drill sizes in the BOARD class.
|
|
|
|
*/
|
|
|
|
struct VIA_DIMENSION
|
|
|
|
{
|
|
|
|
int m_Diameter; // <= 0 means use Netclass via diameter
|
|
|
|
int m_Drill; // <= 0 means use Netclass via drill
|
|
|
|
|
|
|
|
VIA_DIMENSION()
|
|
|
|
{
|
|
|
|
m_Diameter = 0;
|
|
|
|
m_Drill = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VIA_DIMENSION( int aDiameter, int aDrill )
|
|
|
|
{
|
|
|
|
m_Diameter = aDiameter;
|
|
|
|
m_Drill = aDrill;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==( const VIA_DIMENSION& aOther ) const
|
|
|
|
{
|
|
|
|
return ( m_Diameter == aOther.m_Diameter ) && ( m_Drill == aOther.m_Drill );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator<( const VIA_DIMENSION& aOther ) const
|
|
|
|
{
|
|
|
|
if( m_Diameter != aOther.m_Diameter )
|
|
|
|
return m_Diameter < aOther.m_Diameter;
|
|
|
|
|
|
|
|
return m_Drill < aOther.m_Drill;
|
|
|
|
}
|
|
|
|
};
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
/**
|
|
|
|
* Struct DIFF_PAIR_DIMENSION
|
|
|
|
* is a small helper container to handle a stock of specific differential pairs each with
|
|
|
|
* unique track width, gap and via gap.
|
|
|
|
*/
|
|
|
|
struct DIFF_PAIR_DIMENSION
|
|
|
|
{
|
|
|
|
int m_Width; // <= 0 means use Netclass differential pair width
|
|
|
|
int m_Gap; // <= 0 means use Netclass differential pair gap
|
|
|
|
int m_ViaGap; // <= 0 means use Netclass differential pair via gap
|
|
|
|
|
|
|
|
DIFF_PAIR_DIMENSION()
|
|
|
|
{
|
|
|
|
m_Width = 0;
|
|
|
|
m_Gap = 0;
|
|
|
|
m_ViaGap = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DIFF_PAIR_DIMENSION( int aWidth, int aGap, int aViaGap )
|
|
|
|
{
|
|
|
|
m_Width = aWidth;
|
|
|
|
m_Gap = aGap;
|
|
|
|
m_ViaGap = aViaGap;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==( const DIFF_PAIR_DIMENSION& aOther ) const
|
|
|
|
{
|
|
|
|
return ( m_Width == aOther.m_Width )
|
|
|
|
&& ( m_Gap == aOther.m_Gap )
|
|
|
|
&& ( m_ViaGap == aOther.m_ViaGap );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator<( const DIFF_PAIR_DIMENSION& aOther ) const
|
|
|
|
{
|
|
|
|
if( m_Width != aOther.m_Width )
|
|
|
|
return m_Width < aOther.m_Width;
|
|
|
|
|
|
|
|
if( m_Gap != aOther.m_Gap )
|
|
|
|
return m_Gap < aOther.m_Gap;
|
|
|
|
|
|
|
|
return m_ViaGap < aOther.m_ViaGap;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LAYER_CLASS_SILK = 0,
|
|
|
|
LAYER_CLASS_COPPER,
|
|
|
|
LAYER_CLASS_EDGES,
|
2018-08-24 20:08:30 +00:00
|
|
|
LAYER_CLASS_COURTYARD,
|
2018-04-28 15:22:25 +00:00
|
|
|
LAYER_CLASS_OTHERS,
|
|
|
|
|
|
|
|
LAYER_CLASS_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Class BOARD_DESIGN_SETTINGS
|
|
|
|
* contains design settings for a BOARD object.
|
|
|
|
*/
|
2010-01-31 20:01:46 +00:00
|
|
|
class BOARD_DESIGN_SETTINGS
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-04-28 15:22:25 +00:00
|
|
|
// Note: the first value in each dimensions list is the current netclass value
|
|
|
|
std::vector<int> m_TrackWidthList;
|
|
|
|
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
|
|
|
|
std::vector<DIFF_PAIR_DIMENSION> m_DiffPairDimensionsList;
|
2014-05-13 09:22:51 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
// List of netclasses. There is always the default netclass.
|
2014-05-13 09:22:51 +00:00
|
|
|
NETCLASSES m_NetClasses;
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
bool m_MicroViasAllowed; ///< true to allow micro vias
|
|
|
|
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
|
|
|
|
VIATYPE_T m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
|
|
|
|
|
|
|
|
bool m_RequireCourtyards; ///< require courtyard definitions in footprints
|
|
|
|
bool m_ProhibitOverlappingCourtyards; ///< check for overlapping courtyards in DRC
|
|
|
|
|
|
|
|
// if true, when creating a new track starting on an existing track, use this track width
|
|
|
|
bool m_UseConnectedTrackWidth;
|
|
|
|
int m_TrackMinWidth; ///< track min value for width ((min copper size value
|
|
|
|
int m_ViasMinSize; ///< vias (not micro vias) min diameter
|
|
|
|
int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
|
|
|
|
int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
|
|
|
|
int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// Global mask margins:
|
2018-04-28 15:22:25 +00:00
|
|
|
int m_SolderMaskMargin; ///< Solder mask margin
|
|
|
|
int m_SolderMaskMinWidth; ///< Solder mask min width
|
2012-11-05 20:20:34 +00:00
|
|
|
// 2 areas near than m_SolderMaskMinWidth
|
|
|
|
// are merged
|
2018-04-28 15:22:25 +00:00
|
|
|
int m_SolderPasteMargin; ///< Solder paste margin absolute value
|
|
|
|
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
|
2012-02-02 07:23:00 +00:00
|
|
|
///< The final margin is the sum of these 2 values
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
int m_HoleToHoleMin; ///< Min width of peninsula between two drilled holes
|
|
|
|
|
|
|
|
// Arrays of default values for the various layer classes.
|
|
|
|
int m_LineThickness[ LAYER_CLASS_COUNT ];
|
|
|
|
wxSize m_TextSize[ LAYER_CLASS_COUNT ];
|
|
|
|
int m_TextThickness[ LAYER_CLASS_COUNT ];
|
|
|
|
bool m_TextItalic[ LAYER_CLASS_COUNT ];
|
|
|
|
bool m_TextUpright[ LAYER_CLASS_COUNT ];
|
|
|
|
|
2018-06-22 13:05:11 +00:00
|
|
|
// Variables used in footprint editing (default value in item/footprint creation)
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
wxString m_RefDefaultText; ///< Default ref text on fp creation
|
2015-01-30 18:42:46 +00:00
|
|
|
// if empty, use footprint name as default
|
2018-04-28 15:22:25 +00:00
|
|
|
bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation
|
|
|
|
int m_RefDefaultlayer; ///< Default ref text layer on fp creation
|
2017-03-13 03:19:33 +00:00
|
|
|
// should be a PCB_LAYER_ID, but use an int
|
2015-01-30 18:42:46 +00:00
|
|
|
// to save this param in config
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
wxString m_ValueDefaultText; ///< Default value text on fp creation
|
2015-01-30 18:42:46 +00:00
|
|
|
// if empty, use footprint name as default
|
2018-04-28 15:22:25 +00:00
|
|
|
bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation
|
|
|
|
int m_ValueDefaultlayer; ///< Default value text layer on fp creation
|
2017-03-13 03:19:33 +00:00
|
|
|
// should be a PCB_LAYER_ID, but use an int
|
2015-01-30 18:42:46 +00:00
|
|
|
// to save this param in config
|
|
|
|
|
|
|
|
// Miscellaneous
|
2018-04-28 15:22:25 +00:00
|
|
|
wxPoint m_AuxOrigin; ///< origin for plot exports
|
|
|
|
wxPoint m_GridOrigin; ///< origin for grid offsets
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
D_PAD m_Pad_Master; ///< A dummy pad to store all default parameters
|
2015-01-30 18:42:46 +00:00
|
|
|
// when importing values or create a new pad
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2015-01-30 18:42:46 +00:00
|
|
|
private:
|
2018-04-28 15:22:25 +00:00
|
|
|
// Indicies into the trackWidth, viaSizes and diffPairDimensions lists.
|
|
|
|
// The 0 index is always the current netclass value(s)
|
|
|
|
unsigned m_trackWidthIndex;
|
|
|
|
unsigned m_viaSizeIndex;
|
|
|
|
unsigned m_diffPairIndex;
|
|
|
|
|
|
|
|
// Custom values for track/via sizes (specified via dialog instead of netclass or lists)
|
|
|
|
bool m_useCustomTrackVia;
|
|
|
|
int m_customTrackWidth;
|
2015-01-30 18:42:46 +00:00
|
|
|
VIA_DIMENSION m_customViaSize;
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
// Custom values for differential pairs (specified via dialog instead of netclass/lists)
|
|
|
|
bool m_useCustomDiffPair;
|
|
|
|
DIFF_PAIR_DIMENSION m_customDiffPair;
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
int m_copperLayerCount; ///< Number of copper layers for this design
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
LSET m_enabledLayers; ///< Bit-mask for layer enabling
|
|
|
|
LSET m_visibleLayers; ///< Bit-mask for layer visibility
|
|
|
|
|
|
|
|
int m_visibleElements; ///< Bit-mask for element category visibility
|
|
|
|
int m_boardThickness; ///< Board thickness for 3D viewer
|
2015-01-30 18:42:46 +00:00
|
|
|
|
|
|
|
/// Current net class name used to display netclass info.
|
|
|
|
/// This is also the last used netclass after starting a track.
|
2018-04-28 15:22:25 +00:00
|
|
|
wxString m_currentNetClassName;
|
2015-01-30 18:42:46 +00:00
|
|
|
|
|
|
|
public:
|
2010-01-31 20:01:46 +00:00
|
|
|
BOARD_DESIGN_SETTINGS();
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
/**
|
2014-05-15 08:51:08 +00:00
|
|
|
* Function GetDefault
|
|
|
|
* @return the default netclass.
|
2014-05-13 09:22:51 +00:00
|
|
|
*/
|
2014-05-20 09:29:37 +00:00
|
|
|
inline NETCLASSPTR GetDefault() const
|
2014-05-15 08:51:08 +00:00
|
|
|
{
|
|
|
|
return m_NetClasses.GetDefault();
|
|
|
|
}
|
2014-05-13 09:22:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCurrentNetClassName
|
|
|
|
* @return the current net class name.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline const wxString& GetCurrentNetClassName() const
|
2014-05-15 08:51:08 +00:00
|
|
|
{
|
|
|
|
return m_currentNetClassName;
|
|
|
|
}
|
2014-05-13 09:22:51 +00:00
|
|
|
|
2014-06-03 14:09:27 +00:00
|
|
|
/**
|
|
|
|
* Function UseNetClassTrack
|
|
|
|
* returns true if netclass values should be used to obtain appropriate track width.
|
|
|
|
*/
|
|
|
|
inline bool UseNetClassTrack() const
|
|
|
|
{
|
|
|
|
return ( m_trackWidthIndex == 0 && !m_useCustomTrackVia );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function UseNetClassVia
|
|
|
|
* returns true if netclass values should be used to obtain appropriate via size.
|
|
|
|
*/
|
|
|
|
inline bool UseNetClassVia() const
|
|
|
|
{
|
|
|
|
return ( m_viaSizeIndex == 0 && !m_useCustomTrackVia );
|
|
|
|
}
|
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
/**
|
|
|
|
* Function SetCurrentNetClass
|
|
|
|
* Must be called after a netclass selection (or after a netclass parameter change
|
|
|
|
* Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
|
|
|
|
* and some others parameters (netclass name ....)
|
|
|
|
* @param aNetClassName = the new netclass name
|
|
|
|
* @return true if lists of tracks and vias sizes are modified
|
|
|
|
*/
|
|
|
|
bool SetCurrentNetClass( const wxString& aNetClassName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetBiggestClearanceValue
|
|
|
|
* @return the biggest clearance value found in NetClasses list
|
|
|
|
*/
|
|
|
|
int GetBiggestClearanceValue();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetSmallestClearanceValue
|
|
|
|
* @return the smallest clearance value found in NetClasses list
|
|
|
|
*/
|
|
|
|
int GetSmallestClearanceValue();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCurrentMicroViaSize
|
|
|
|
* @return the current micro via size,
|
|
|
|
* that is the current netclass value
|
|
|
|
*/
|
|
|
|
int GetCurrentMicroViaSize();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCurrentMicroViaDrill
|
|
|
|
* @return the current micro via drill,
|
|
|
|
* that is the current netclass value
|
|
|
|
*/
|
|
|
|
int GetCurrentMicroViaDrill();
|
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
/**
|
|
|
|
* Function GetTrackWidthIndex
|
|
|
|
* @return the current track width list index.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
|
2014-05-13 09:22:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetTrackWidthIndex
|
|
|
|
* sets the current track width list index to \a aIndex.
|
|
|
|
*
|
|
|
|
* @param aIndex is the track width list index.
|
|
|
|
*/
|
|
|
|
void SetTrackWidthIndex( unsigned aIndex );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCurrentTrackWidth
|
|
|
|
* @return the current track width, according to the selected options
|
|
|
|
* ( using the default netclass value or a preset/custom value )
|
|
|
|
* the default netclass is always in m_TrackWidthList[0]
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetCurrentTrackWidth() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
return m_useCustomTrackVia ? m_customTrackWidth : m_TrackWidthList[m_trackWidthIndex];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCustomTrackWidth
|
|
|
|
* Sets custom width for track (i.e. not available in netclasses or preset list). To have
|
|
|
|
* it returned with GetCurrentTrackWidth() you need to enable custom track & via sizes
|
|
|
|
* (UseCustomTrackViaSize()).
|
|
|
|
* @param aWidth is the new track width.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline void SetCustomTrackWidth( int aWidth )
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
m_customTrackWidth = aWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCustomTrackWidth
|
|
|
|
* @return Current custom width for a track.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetCustomTrackWidth() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
return m_customTrackWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetViaSizeIndex
|
|
|
|
* @return the current via size list index.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline unsigned GetViaSizeIndex() const
|
|
|
|
{
|
|
|
|
return m_viaSizeIndex;
|
|
|
|
}
|
2014-05-13 09:22:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetViaSizeIndex
|
|
|
|
* sets the current via size list index to \a aIndex.
|
|
|
|
*
|
|
|
|
* @param aIndex is the via size list index.
|
|
|
|
*/
|
|
|
|
void SetViaSizeIndex( unsigned aIndex );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCurrentViaSize
|
|
|
|
* @return the current via size, according to the selected options
|
|
|
|
* ( using the default netclass value or a preset/custom value )
|
|
|
|
* the default netclass is always in m_TrackWidthList[0]
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetCurrentViaSize() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
if( m_useCustomTrackVia )
|
|
|
|
return m_customViaSize.m_Diameter;
|
|
|
|
else
|
|
|
|
return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCustomViaSize
|
|
|
|
* Sets custom size for via diameter (i.e. not available in netclasses or preset list). To have
|
|
|
|
* it returned with GetCurrentViaSize() you need to enable custom track & via sizes
|
|
|
|
* (UseCustomTrackViaSize()).
|
|
|
|
* @param aSize is the new drill diameter.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline void SetCustomViaSize( int aSize )
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
m_customViaSize.m_Diameter = aSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCustomViaSize
|
|
|
|
* @return Current custom size for the via diameter.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetCustomViaSize() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
return m_customViaSize.m_Diameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCurrentViaDrill
|
|
|
|
* @return the current via size, according to the selected options
|
|
|
|
* ( using the default netclass value or a preset/custom value )
|
|
|
|
* the default netclass is always in m_TrackWidthList[0]
|
|
|
|
*/
|
|
|
|
int GetCurrentViaDrill() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCustomViaDrill
|
|
|
|
* Sets custom size for via drill (i.e. not available in netclasses or preset list). To have
|
|
|
|
* it returned with GetCurrentViaDrill() you need to enable custom track & via sizes
|
|
|
|
* (UseCustomTrackViaSize()).
|
|
|
|
* @param aDrill is the new drill size.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline void SetCustomViaDrill( int aDrill )
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
m_customViaSize.m_Drill = aDrill;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCustomViaDrill
|
|
|
|
* @return Current custom size for the via drill.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetCustomViaDrill() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
return m_customViaSize.m_Drill;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function UseCustomTrackViaSize
|
|
|
|
* Enables/disables custom track/via size settings. If enabled, values set with
|
|
|
|
* SetCustomTrackWidth()/SetCustomViaSize()/SetCustomViaDrill() are used for newly created
|
|
|
|
* tracks and vias.
|
|
|
|
* @param aEnabled decides if custom settings should be used for new tracks/vias.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline void UseCustomTrackViaSize( bool aEnabled )
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
m_useCustomTrackVia = aEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function UseCustomTrackViaSize
|
|
|
|
* @return True if custom sizes of tracks & vias are enabled, false otherwise.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline bool UseCustomTrackViaSize() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
return m_useCustomTrackVia;
|
|
|
|
}
|
|
|
|
|
2018-04-14 14:58:01 +00:00
|
|
|
/**
|
2018-04-28 15:22:25 +00:00
|
|
|
* Function GetDiffPairIndex
|
|
|
|
* @return the current diff pair dimension list index.
|
|
|
|
*/
|
|
|
|
inline unsigned GetDiffPairIndex() const { return m_diffPairIndex; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetDiffPairIndex
|
|
|
|
* @param aIndex is the diff pair dimensions list index to set.
|
|
|
|
*/
|
|
|
|
void SetDiffPairIndex( unsigned aIndex );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCustomDiffPairWidth
|
|
|
|
* Sets custom track width for differential pairs (i.e. not available in netclasses or
|
|
|
|
* preset list).
|
|
|
|
* @param aDrill is the new track wdith.
|
|
|
|
*/
|
|
|
|
inline void SetCustomDiffPairWidth( int aWidth )
|
|
|
|
{
|
|
|
|
m_customDiffPair.m_Width = aWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCustomDiffPairWidth
|
|
|
|
* @return Current custom track width for differential pairs.
|
2018-04-14 14:58:01 +00:00
|
|
|
*/
|
2018-04-28 15:22:25 +00:00
|
|
|
inline int GetCustomDiffPairWidth()
|
|
|
|
{
|
|
|
|
return m_customDiffPair.m_Width;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCustomDiffPairGap
|
|
|
|
* Sets custom gap for differential pairs (i.e. not available in netclasses or preset
|
|
|
|
* list).
|
|
|
|
* @param aGap is the new gap.
|
|
|
|
*/
|
|
|
|
inline void SetCustomDiffPairGap( int aGap )
|
|
|
|
{
|
|
|
|
m_customDiffPair.m_Gap = aGap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCustomDiffPairGap
|
|
|
|
* @return Current custom gap width for differential pairs.
|
|
|
|
*/
|
|
|
|
inline int GetCustomDiffPairGap()
|
|
|
|
{
|
|
|
|
return m_customDiffPair.m_Gap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCustomDiffPairViaGap
|
|
|
|
* Sets custom via gap for differential pairs (i.e. not available in netclasses or
|
|
|
|
* preset list).
|
|
|
|
* @param aGap is the new gap. Specify 0 to use the DiffPairGap for vias as well.
|
|
|
|
*/
|
|
|
|
inline void SetCustomDiffPairViaGap( int aGap )
|
|
|
|
{
|
|
|
|
m_customDiffPair.m_ViaGap = aGap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCustomDiffPairViaGap
|
|
|
|
* @return Current custom via gap width for differential pairs.
|
|
|
|
*/
|
|
|
|
inline int GetCustomDiffPairViaGap()
|
|
|
|
{
|
|
|
|
return m_customDiffPair.m_ViaGap > 0 ? m_customDiffPair.m_ViaGap : m_customDiffPair.m_Gap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function UseCustomDiffPairDimensions
|
|
|
|
* Enables/disables custom differential pair dimensions.
|
|
|
|
* @param aEnabled decides if custom settings should be used for new differential pairs.
|
|
|
|
*/
|
|
|
|
inline void UseCustomDiffPairDimensions( bool aEnabled )
|
|
|
|
{
|
|
|
|
m_useCustomDiffPair = aEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function UseCustomDiffPairDimensions
|
|
|
|
* @return True if custom sizes of diff pairs are enabled, false otherwise.
|
|
|
|
*/
|
|
|
|
inline bool UseCustomDiffPairDimensions() const
|
|
|
|
{
|
|
|
|
return m_useCustomDiffPair;
|
|
|
|
}
|
2018-04-14 14:58:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetMinHoleSeparation
|
|
|
|
* @param aValue The minimum distance between the edges of two holes or 0 to disable
|
|
|
|
* hole-to-hole separation checking.
|
|
|
|
*/
|
|
|
|
void SetMinHoleSeparation( int aDistance );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetRequireCourtyardDefinitions
|
|
|
|
* @param aRequire Set to true to generate DRC violations from missing courtyards.
|
|
|
|
*/
|
|
|
|
void SetRequireCourtyardDefinitions( bool aRequire );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetProhibitOverlappingCourtyards
|
2018-04-28 15:22:25 +00:00
|
|
|
* @param aProhibit Set to true to generate DRC violations from overlapping courtyards.
|
2018-04-14 14:58:01 +00:00
|
|
|
*/
|
2018-04-28 15:22:25 +00:00
|
|
|
void SetProhibitOverlappingCourtyards( bool aProhibit );
|
2018-04-14 14:58:01 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
/**
|
|
|
|
* Function GetVisibleLayers
|
|
|
|
* returns a bit-mask of all the layers that are visible
|
|
|
|
* @return int - the visible layers in bit-mapped form.
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
inline LSET GetVisibleLayers() const
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
|
|
|
return m_visibleLayers;
|
|
|
|
}
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2010-01-27 20:07:50 +00:00
|
|
|
/**
|
|
|
|
* Function SetVisibleAlls
|
2012-02-06 05:44:19 +00:00
|
|
|
* Set the bit-mask of all visible elements categories,
|
|
|
|
* including enabled layers
|
2010-01-27 20:07:50 +00:00
|
|
|
*/
|
2012-02-06 05:44:19 +00:00
|
|
|
void SetVisibleAlls();
|
2010-01-27 20:07:50 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
/**
|
|
|
|
* Function SetVisibleLayers
|
|
|
|
* changes the bit-mask of visible layers
|
|
|
|
* @param aMask = The new bit-mask of visible layers
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
inline void SetVisibleLayers( LSET aMask )
|
2014-05-13 09:22:51 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
m_visibleLayers = aMask & m_enabledLayers;
|
2014-05-13 09:22:51 +00:00
|
|
|
}
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsLayerVisible
|
|
|
|
* tests whether a given layer is visible
|
2014-06-24 16:17:18 +00:00
|
|
|
* @param aLayerId = The layer to be tested
|
2009-10-28 11:48:47 +00:00
|
|
|
* @return bool - true if the layer is visible.
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
inline bool IsLayerVisible( PCB_LAYER_ID aLayerId ) const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
// If a layer is disabled, it is automatically invisible
|
2014-06-24 16:17:18 +00:00
|
|
|
return (m_visibleLayers & m_enabledLayers)[aLayerId];
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLayerVisibility
|
|
|
|
* changes the visibility of a given layer
|
2014-06-24 16:17:18 +00:00
|
|
|
* @param aLayerId = The layer to be changed
|
2009-10-28 11:48:47 +00:00
|
|
|
* @param aNewState = The new visibility state of the layer
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
void SetLayerVisibility( PCB_LAYER_ID aLayerId, bool aNewState );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetVisibleElements
|
|
|
|
* returns a bit-mask of all the element categories that are visible
|
|
|
|
* @return int - the visible element categories in bit-mapped form.
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetVisibleElements() const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2014-05-13 09:22:51 +00:00
|
|
|
return m_visibleElements;
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetVisibleElements
|
|
|
|
* changes the bit-mask of visible element categories
|
|
|
|
* @param aMask = The new bit-mask of visible element categories
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline void SetVisibleElements( int aMask )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2014-05-13 09:22:51 +00:00
|
|
|
m_visibleElements = aMask;
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsElementVisible
|
2010-01-21 20:53:01 +00:00
|
|
|
* tests whether a given element category is visible. Keep this as an
|
|
|
|
* inline function.
|
2014-02-03 12:08:01 +00:00
|
|
|
* @param aElementCategory is from the enum by the same name
|
2009-10-28 11:48:47 +00:00
|
|
|
* @return bool - true if the element is visible.
|
2017-03-13 03:19:33 +00:00
|
|
|
* @see enum GAL_LAYER_ID
|
2009-10-28 11:48:47 +00:00
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
inline bool IsElementVisible( GAL_LAYER_ID aElementCategory ) const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
return ( m_visibleElements & ( 1 << GAL_LAYER_INDEX( aElementCategory ) ) );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetElementVisibility
|
|
|
|
* changes the visibility of an element category
|
2014-02-03 12:08:01 +00:00
|
|
|
* @param aElementCategory is from the enum by the same name
|
2009-10-28 11:48:47 +00:00
|
|
|
* @param aNewState = The new visibility state of the element category
|
2017-03-13 03:19:33 +00:00
|
|
|
* @see enum GAL_LAYER_ID
|
2009-10-28 11:48:47 +00:00
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
void SetElementVisibility( GAL_LAYER_ID aElementCategory, bool aNewState );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetEnabledLayers
|
|
|
|
* returns a bit-mask of all the layers that are enabled
|
|
|
|
* @return int - the enabled layers in bit-mapped form.
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
inline LSET GetEnabledLayers() const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2014-05-13 09:22:51 +00:00
|
|
|
return m_enabledLayers;
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetEnabledLayers
|
|
|
|
* changes the bit-mask of enabled layers
|
|
|
|
* @param aMask = The new bit-mask of enabled layers
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
void SetEnabledLayers( LSET aMask );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsLayerEnabled
|
|
|
|
* tests whether a given layer is enabled
|
2014-06-24 16:17:18 +00:00
|
|
|
* @param aLayerId = The layer to be tested
|
2009-10-28 11:48:47 +00:00
|
|
|
* @return bool - true if the layer is enabled
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
inline bool IsLayerEnabled( PCB_LAYER_ID aLayerId ) const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
return m_enabledLayers[aLayerId];
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCopperLayerCount
|
|
|
|
* @return int - the number of neabled copper layers
|
|
|
|
*/
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetCopperLayerCount() const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2014-05-13 09:22:51 +00:00
|
|
|
return m_copperLayerCount;
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCopperLayerCount
|
|
|
|
* do what its name says...
|
|
|
|
* @param aNewLayerCount = The new number of enabled copper layers
|
|
|
|
*/
|
|
|
|
void SetCopperLayerCount( int aNewLayerCount );
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function AppendConfigs
|
|
|
|
* appends to @a aResult the configuration setting accessors which will later
|
|
|
|
* allow reading or writing of configuration file information directly into
|
|
|
|
* this object.
|
|
|
|
*/
|
2018-04-28 15:22:25 +00:00
|
|
|
void AppendConfigs( BOARD* aBoard, PARAM_CFG_ARRAY* aResult );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2014-06-03 14:09:27 +00:00
|
|
|
inline int GetBoardThickness() const { return m_boardThickness; }
|
|
|
|
inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
/**
|
|
|
|
* Function GetLineThickness
|
|
|
|
* Returns the default graphic segment thickness from the layer class for the given layer.
|
|
|
|
*/
|
|
|
|
int GetLineThickness( PCB_LAYER_ID aLayer ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetTextSize
|
|
|
|
* Returns the default text size from the layer class for the given layer.
|
|
|
|
*/
|
|
|
|
wxSize GetTextSize( PCB_LAYER_ID aLayer ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetTextThickness
|
|
|
|
* Returns the default text thickness from the layer class for the given layer.
|
|
|
|
*/
|
|
|
|
int GetTextThickness( PCB_LAYER_ID aLayer ) const;
|
|
|
|
|
|
|
|
bool GetTextItalic( PCB_LAYER_ID aLayer ) const;
|
|
|
|
bool GetTextUpright( PCB_LAYER_ID aLayer ) const;
|
|
|
|
|
|
|
|
int GetLayerClass( PCB_LAYER_ID aLayer ) const;
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
private:
|
2014-05-13 09:22:51 +00:00
|
|
|
void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
|
2017-06-08 21:47:21 +00:00
|
|
|
int aControlBits ) const;
|
2009-10-28 11:48:47 +00:00
|
|
|
};
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2012-02-06 07:14:51 +00:00
|
|
|
#endif // BOARD_DESIGN_SETTINGS_H_
|