KiCad PCB EDA Suite
Loading...
Searching...
No Matches
stackup_predefined_prms.h
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
29#ifndef STACKUP_PREDEFINED_PRMS_H
30#define STACKUP_PREDEFINED_PRMS_H
31
32
33#include <wx/string.h>
34#include <wx/arrstr.h>
35#include <wx/colour.h>
36
37#include <layer_ids.h>
38#include <i18n_utility.h> // For _HKI definition
39#include <gal/color4d.h>
40
42
43// Keyword used in file to identify the dielectric layer type
44#define KEY_CORE wxT( "core" )
45#define KEY_PREPREG wxT( "prepreg" )
46
47#define KEY_COPPER wxT( "copper" )
48
49// key string used for not specified parameters
50// Can be translated in dialogs, and is also a keyword outside dialogs
51wxString inline NotSpecifiedPrm()
52{
53 return _HKI( "Not specified" );
54}
55
61bool IsPrmSpecified( const wxString& aPrmValue );
62
63#define DEFAULT_SOLDERMASK_OPACITY 0.83
64
65// A reasonable Epsilon R value for solder mask dielectric
66#define DEFAULT_EPSILON_R_SOLDERMASK 3.3
67
68// A default Epsilon R value for silkscreen dielectric
69#define DEFAULT_EPSILON_R_SILKSCREEN 1.0
70
71// A minor struct to handle color in gerber job file and dialog
73{
74public:
76 {}
77
78 FAB_LAYER_COLOR( const wxString& aColorName, const wxColor& aColor ) :
79 m_colorName( aColorName ),
80 m_color( aColor )
81 {}
82
83 const wxString& GetName() const
84 {
85 return m_colorName;
86 }
87
89 {
90 if( aItemType == BS_ITEM_TYPE_SOLDERMASK )
92 else
93 return m_color.WithAlpha( 1.0 );
94 }
95
101 const wxString GetColorAsString() const;
102
103private:
104 wxString m_colorName; // the name (in job file) of the color
105 // User values are the HTML encoded "#rrggbbaa"
106 // RGB hexa value.
108};
109
110
115wxArrayString GetStandardCopperFinishes( bool aTranslate );
116
120const std::vector<FAB_LAYER_COLOR>& GetStandardColors( BOARD_STACKUP_ITEM_TYPE aType );
121
126
128{
129 return GetStandardColors( aType )[GetColorUserDefinedListIdx( aType )].GetColor( aType );
130}
131
133{
134 return GetStandardColors( aType )[ aIdx ].GetColor( aType );
135}
136
137inline const wxString& GetStandardColorName( BOARD_STACKUP_ITEM_TYPE aType, int aIdx )
138{
139 return GetStandardColors( aType )[ aIdx ].GetName();
140}
141
142inline bool IsCustomColorIdx( BOARD_STACKUP_ITEM_TYPE aType, int aIdx )
143{
144 return aIdx == GetColorUserDefinedListIdx( aType );
145}
146
151bool IsColorNameNormalized( const wxString& aName );
152
153
154#endif // #ifndef STACKUP_PREDEFINED_PRMS_H
BOARD_STACKUP_ITEM_TYPE
Definition: board_stackup.h:43
@ BS_ITEM_TYPE_SOLDERMASK
Definition: board_stackup.h:49
FAB_LAYER_COLOR(const wxString &aColorName, const wxColor &aColor)
const wxString GetColorAsString() const
const wxString & GetName() const
KIGFX::COLOR4D GetColor(BOARD_STACKUP_ITEM_TYPE aItemType) const
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition: color4d.h:311
#define _HKI(x)
Some functions to handle hotkeys in KiCad.
bool IsCustomColorIdx(BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
KIGFX::COLOR4D GetStandardColor(BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
#define DEFAULT_SOLDERMASK_OPACITY
wxString NotSpecifiedPrm()
bool IsPrmSpecified(const wxString &aPrmValue)
const wxString & GetStandardColorName(BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
const std::vector< FAB_LAYER_COLOR > & GetStandardColors(BOARD_STACKUP_ITEM_TYPE aType)
int GetColorUserDefinedListIdx(BOARD_STACKUP_ITEM_TYPE aType)
bool IsColorNameNormalized(const wxString &aName)
KIGFX::COLOR4D GetDefaultUserColor(BOARD_STACKUP_ITEM_TYPE aType)
wxArrayString GetStandardCopperFinishes(bool aTranslate)