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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
24
25#ifndef STACKUP_PREDEFINED_PRMS_H
26#define STACKUP_PREDEFINED_PRMS_H
27
28
29#include <wx/string.h>
30#include <wx/arrstr.h>
31#include <wx/colour.h>
32
33#include <layer_ids.h>
34#include <i18n_utility.h> // For _HKI definition
35#include <gal/color4d.h>
36
38
39// Keyword used in file to identify the dielectric layer type
40#define KEY_CORE wxT( "core" )
41#define KEY_PREPREG wxT( "prepreg" )
42
43#define KEY_COPPER wxT( "copper" )
44
45// key string used for not specified parameters
46// Can be translated in dialogs, and is also a keyword outside dialogs
47wxString inline NotSpecifiedPrm()
48{
49 return _HKI( "Not specified" );
50}
51
57bool IsPrmSpecified( const wxString& aPrmValue );
58
59#define DEFAULT_SOLDERMASK_OPACITY 0.83
60
61// A reasonable Epsilon R value for solder mask dielectric
62#define DEFAULT_EPSILON_R_SOLDERMASK 3.3
63
64// A default Epsilon R value for silkscreen dielectric
65#define DEFAULT_EPSILON_R_SILKSCREEN 1.0
66
67// A minor struct to handle color in gerber job file and dialog
69{
70public:
73
74 FAB_LAYER_COLOR( const wxString& aColorName, const wxColor& aColor ) :
75 m_colorName( aColorName ),
76 m_color( aColor )
77 {}
78
79 const wxString& GetName() const
80 {
81 return m_colorName;
82 }
83
85 {
86 if( aItemType == BS_ITEM_TYPE_SOLDERMASK )
87 return m_color.WithAlpha( DEFAULT_SOLDERMASK_OPACITY );
88 else
89 return m_color.WithAlpha( 1.0 );
90 }
91
97 const wxString GetColorAsString() const;
98
99private:
100 wxString m_colorName; // the name (in job file) of the color
101 // User values are the HTML encoded "#rrggbbaa"
102 // RGB hexa value.
104};
105
106
111wxArrayString GetStandardCopperFinishes( bool aTranslate );
112
116const std::vector<FAB_LAYER_COLOR>& GetStandardColors( BOARD_STACKUP_ITEM_TYPE aType );
117
122
124{
125 return GetStandardColors( aType )[GetColorUserDefinedListIdx( aType )].GetColor( aType );
126}
127
129{
130 return GetStandardColors( aType )[ aIdx ].GetColor( aType );
131}
132
133inline const wxString& GetStandardColorName( BOARD_STACKUP_ITEM_TYPE aType, int aIdx )
134{
135 return GetStandardColors( aType )[ aIdx ].GetName();
136}
137
138inline bool IsCustomColorIdx( BOARD_STACKUP_ITEM_TYPE aType, int aIdx )
139{
140 return aIdx == GetColorUserDefinedListIdx( aType );
141}
142
147bool IsColorNameNormalized( const wxString& aName );
148
149
150#endif // #ifndef STACKUP_PREDEFINED_PRMS_H
BOARD_STACKUP_ITEM_TYPE
@ BS_ITEM_TYPE_SOLDERMASK
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:101
Some functions to handle hotkeys in KiCad.
#define _HKI(x)
Definition page_info.cpp:40
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)