KiCad PCB EDA Suite
stackup_predefined_prms.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2009-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 
30 #include "board_stackup.h"
31 #include <convert_to_biu.h>
32 #include <core/arraydim.h>
33 #include <layer_ids.h>
34 #include <board_design_settings.h>
35 #include <i18n_utility.h> // _HKI definition
36 #include <macros.h>
38 
39 // A list of copper finish standard type names
40 // They are standard names in .gbdjob files, so avoid changing them or
41 // ensure they are compatible with .gbrjob file spec.
42 // These names are in fact usual copper finish names.
43 static wxString CopperFinishType[] =
44 {
45  NotSpecifiedPrm(), // Not specified, not in .gbrjob file
46  _HKI( "ENIG" ), // used in .gbrjob file
47  _HKI( "ENEPIG" ), // used in .gbrjob file
48  _HKI( "HAL SnPb" ), // used in .gbrjob file
49  _HKI( "HAL lead-free" ), // used in .gbrjob file
50  _HKI( "Hard gold" ), // used in .gbrjob file
51  _HKI( "Immersion tin" ), // used in .gbrjob file
52  _HKI( "Immersion nickel" ), // used in .gbrjob file
53  _HKI( "Immersion silver" ), // used in .gbrjob file
54  _HKI( "Immersion gold" ), // used in .gbrjob file
55  _HKI( "HT_OSP" ), // used in .gbrjob file
56  _HKI( "OSP" ), // used in .gbrjob file
57  _HKI( "None" ), // used in .gbrjob file
58  _HKI( "User defined" ) // keep this option at end
59 };
60 
61 
62 // A list of available colors for solder mask and silkscreen
63 // These names are used in .gbrjob file, so they are not fully free.
64 // Use only what is allowed in .gbrjob files.
65 // for other colors (user defined), the defined value is the
66 // html color syntax in .kicad_pcb files
67 // and R<integer>G<integer>B<integer> In gbrjob file.
69 {
70  { NotSpecifiedPrm(), wxColor( 80, 80, 80 ) }, // Not specified, not in .gbrjob file
71  { _HKI( "Green" ), wxColor( 60, 150, 80 ) }, // used in .gbrjob file
72  { _HKI( "Red" ), wxColor( 128, 0, 0 ) }, // used in .gbrjob file
73  { _HKI( "Blue" ), wxColor( 0, 0, 128 ) }, // used in .gbrjob file
74  { _HKI( "Black" ), wxColor( 20, 20, 20 ) }, // used in .gbrjob file
75  { _HKI( "White" ), wxColor( 200, 200, 200 ) }, // used in .gbrjob file
76  { _HKI( "Yellow" ), wxColor( 128, 128, 0 ) }, // used in .gbrjob file
77  { _HKI( "User defined" ), wxColor( 128, 128, 128 ) }//free. the name is a dummy name here
78 };
79 
80 
81 wxArrayString GetCopperFinishStandardList( bool aTranslate )
82 {
83  wxArrayString list;
84 
85  for( unsigned ii = 0; ii < arrayDim( CopperFinishType ); ii++ )
86  list.Add( aTranslate ? wxGetTranslation( CopperFinishType[ii] ) : CopperFinishType[ii] );
87 
88  return list;
89 }
90 
91 
93 {
94  return solderMaskColors;
95 }
96 
97 
99 {
100  return arrayDim( solderMaskColors );
101 }
102 
103 
105 {
106  // this is the last item in list
107  return GetColorStandardListCount() - 1;
108 }
int GetColorStandardListCount()
int GetColorUserDefinedListIdx()
This file contains miscellaneous commonly used macros and functions.
wxString NotSpecifiedPrm()
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
static wxString CopperFinishType[]
Some functions to handle hotkeys in KiCad.
wxArrayString GetCopperFinishStandardList(bool aTranslate)
const FAB_LAYER_COLOR * GetColorStandardList()
static FAB_LAYER_COLOR solderMaskColors[]
#define _HKI(x)