KiCad PCB EDA Suite
stackup_predefined_prms.h File Reference
#include <wx/string.h>
#include <wx/arrstr.h>
#include <wx/colour.h>
#include <layer_ids.h>
#include <i18n_utility.h>
#include <gal/color4d.h>
#include <board_stackup_manager/board_stackup.h>

Go to the source code of this file.

Classes

class  FAB_LAYER_COLOR
 

Macros

#define KEY_CORE   wxT( "core" )
 
#define KEY_PREPREG   wxT( "prepreg" )
 
#define KEY_COPPER   wxT( "copper" )
 
#define DEFAULT_SOLDERMASK_OPACITY   0.83
 
#define DEFAULT_EPSILON_R_SOLDERMASK   3.3
 
#define DEFAULT_EPSILON_R_SILKSCREEN   1.0
 

Functions

wxString NotSpecifiedPrm ()
 
bool IsPrmSpecified (const wxString &aPrmValue)
 
wxArrayString GetStandardCopperFinishes (bool aTranslate)
 
const std::vector< FAB_LAYER_COLOR > & GetStandardColors (BOARD_STACKUP_ITEM_TYPE aType)
 
int GetColorUserDefinedListIdx (BOARD_STACKUP_ITEM_TYPE aType)
 
KIGFX::COLOR4D GetDefaultUserColor (BOARD_STACKUP_ITEM_TYPE aType)
 
KIGFX::COLOR4D GetStandardColor (BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
 
const wxString & GetStandardColorName (BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
 
bool IsCustomColorIdx (BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
 
bool IsColorNameNormalized (const wxString &aName)
 

Macro Definition Documentation

◆ DEFAULT_EPSILON_R_SILKSCREEN

#define DEFAULT_EPSILON_R_SILKSCREEN   1.0

Definition at line 69 of file stackup_predefined_prms.h.

◆ DEFAULT_EPSILON_R_SOLDERMASK

#define DEFAULT_EPSILON_R_SOLDERMASK   3.3

Definition at line 66 of file stackup_predefined_prms.h.

◆ DEFAULT_SOLDERMASK_OPACITY

#define DEFAULT_SOLDERMASK_OPACITY   0.83

Definition at line 63 of file stackup_predefined_prms.h.

◆ KEY_COPPER

#define KEY_COPPER   wxT( "copper" )

Definition at line 47 of file stackup_predefined_prms.h.

◆ KEY_CORE

#define KEY_CORE   wxT( "core" )

Definition at line 44 of file stackup_predefined_prms.h.

◆ KEY_PREPREG

#define KEY_PREPREG   wxT( "prepreg" )

Definition at line 45 of file stackup_predefined_prms.h.

Function Documentation

◆ GetColorUserDefinedListIdx()

int GetColorUserDefinedListIdx ( BOARD_STACKUP_ITEM_TYPE  aType)
Returns
the index of the user defined color in ColorStandardList

Definition at line 110 of file stackup_predefined_prms.cpp.

111{
112 // this is the last item in list
113 return GetStandardColors( aType ).size() - 1;
114}
const std::vector< FAB_LAYER_COLOR > & GetStandardColors(BOARD_STACKUP_ITEM_TYPE aType)

References GetStandardColors().

Referenced by PANEL_SETUP_BOARD_STACKUP::createRowData(), GetDefaultUserColor(), IsCustomColorIdx(), and PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard().

◆ GetDefaultUserColor()

KIGFX::COLOR4D GetDefaultUserColor ( BOARD_STACKUP_ITEM_TYPE  aType)
inline

Definition at line 127 of file stackup_predefined_prms.h.

128{
129 return GetStandardColors( aType )[GetColorUserDefinedListIdx( aType )].GetColor( aType );
130}
const std::vector< FAB_LAYER_COLOR > & GetStandardColors(BOARD_STACKUP_ITEM_TYPE aType)
int GetColorUserDefinedListIdx(BOARD_STACKUP_ITEM_TYPE aType)

References GetColorUserDefinedListIdx(), and GetStandardColors().

Referenced by PANEL_SETUP_BOARD_STACKUP::createRowData(), and PANEL_SETUP_BOARD_STACKUP::onColorSelected().

◆ GetStandardColor()

KIGFX::COLOR4D GetStandardColor ( BOARD_STACKUP_ITEM_TYPE  aType,
int  aIdx 
)
inline

Definition at line 132 of file stackup_predefined_prms.h.

133{
134 return GetStandardColors( aType )[ aIdx ].GetColor( aType );
135}

References GetStandardColors().

Referenced by PANEL_SETUP_BOARD_STACKUP::createColorBox(), and PANEL_SETUP_BOARD_STACKUP::GetSelectedColor().

◆ GetStandardColorName()

◆ GetStandardColors()

const std::vector< FAB_LAYER_COLOR > & GetStandardColors ( BOARD_STACKUP_ITEM_TYPE  aType)
Returns
a list of standard FAB_LAYER_COLOR items for silkscreen and solder mask.

Definition at line 98 of file stackup_predefined_prms.cpp.

99{
100 switch( aType )
101 {
105 default: return dummy;
106 }
107}
@ BS_ITEM_TYPE_SILKSCREEN
Definition: board_stackup.h:49
@ BS_ITEM_TYPE_DIELECTRIC
Definition: board_stackup.h:44
@ BS_ITEM_TYPE_SOLDERMASK
Definition: board_stackup.h:47
std::vector< FAB_LAYER_COLOR > dummy
static std::vector< FAB_LAYER_COLOR > dielectricColors
static std::vector< FAB_LAYER_COLOR > gbrjobColors

References BS_ITEM_TYPE_DIELECTRIC, BS_ITEM_TYPE_SILKSCREEN, BS_ITEM_TYPE_SOLDERMASK, dielectricColors, dummy, and gbrjobColors.

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PANEL_SETUP_BOARD_STACKUP::createColorBox(), PANEL_SETUP_BOARD_STACKUP::createRowData(), GetColorUserDefinedListIdx(), GetDefaultUserColor(), GetStandardColor(), GetStandardColorName(), PANEL_SETUP_BOARD_STACKUP::onMaterialChange(), and PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard().

◆ GetStandardCopperFinishes()

wxArrayString GetStandardCopperFinishes ( bool  aTranslate)
Returns
a wxArray of standard copper finish names.
Parameters
aTranslate= false for the initial names, true for translated names

Definition at line 87 of file stackup_predefined_prms.cpp.

88{
89 wxArrayString list;
90
91 for( unsigned ii = 0; ii < arrayDim( copperFinishType ); ii++ )
92 list.Add( aTranslate ? wxGetTranslation( copperFinishType[ii] ) : copperFinishType[ii] );
93
94 return list;
95}
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
static wxString copperFinishType[]

References arrayDim(), and copperFinishType.

Referenced by PANEL_SETUP_BOARD_FINISH::PANEL_SETUP_BOARD_FINISH(), PANEL_SETUP_BOARD_FINISH::synchronizeWithBoard(), and PANEL_SETUP_BOARD_FINISH::TransferDataFromWindow().

◆ IsColorNameNormalized()

bool IsColorNameNormalized ( const wxString &  aName)
Returns
true if aName is a color name acceptable in gerber job files
Parameters
aNameis a color name like red, blue... (case insensitive)

Definition at line 117 of file stackup_predefined_prms.cpp.

118{
119 static std::vector<wxString> list =
120 {
121 wxT( "Green" ), wxT( "Red" ), wxT( "Blue" ),
122 wxT( "Black" ), wxT( "White" ), wxT( "Yellow" )
123 };
124
125 for( wxString& candidate : list )
126 {
127 if( candidate.CmpNoCase( aName ) == 0 )
128 return true;
129 }
130
131 return false;
132}

Referenced by FAB_LAYER_COLOR::GetColorAsString().

◆ IsCustomColorIdx()

◆ IsPrmSpecified()

bool IsPrmSpecified ( const wxString &  aPrmValue)
Returns
true if the param value is specified: not empty not NotSpecifiedPrm() value or its translation

Definition at line 769 of file board_stackup.cpp.

770{
771 // return true if the param value is specified:
772
773 if( !aPrmValue.IsEmpty()
774 && ( aPrmValue.CmpNoCase( NotSpecifiedPrm() ) != 0 )
775 && aPrmValue != wxGetTranslation( NotSpecifiedPrm() ) )
776 return true;
777
778 return false;
779}
wxString NotSpecifiedPrm()

References NotSpecifiedPrm().

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PANEL_SETUP_BOARD_STACKUP::addMaterialChooser(), BOARD_STACKUP::FormatBoardStackup(), BOARD_STACKUP_ITEM::HasMaterialValue(), PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard(), and PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup().

◆ NotSpecifiedPrm()