2019-06-23 11:20:22 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2021-08-23 18:58:18 +00:00
|
|
|
* Copyright (C) 2009-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-06-23 11:20:22 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file stackup_predefined_prms.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef STACKUP_PREDEFINED_PRMS_H
|
|
|
|
#define STACKUP_PREDEFINED_PRMS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <wx/string.h>
|
2020-10-01 13:39:34 +00:00
|
|
|
#include <wx/arrstr.h>
|
|
|
|
#include <wx/colour.h>
|
|
|
|
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2019-09-27 15:12:24 +00:00
|
|
|
#include <i18n_utility.h> // For _HKI definition
|
2021-08-23 18:58:18 +00:00
|
|
|
#include <gal/color4d.h>
|
|
|
|
|
|
|
|
#include <board_stackup_manager/board_stackup.h>
|
2019-06-23 11:20:22 +00:00
|
|
|
|
|
|
|
// Keyword used in file to identify the dielectric layer type
|
2022-02-04 22:44:59 +00:00
|
|
|
#define KEY_CORE wxT( "core" )
|
|
|
|
#define KEY_PREPREG wxT( "prepreg" )
|
2019-06-23 11:20:22 +00:00
|
|
|
|
2022-02-04 22:44:59 +00:00
|
|
|
#define KEY_COPPER wxT( "copper" )
|
2019-09-06 18:59:13 +00:00
|
|
|
|
2019-06-23 11:20:22 +00:00
|
|
|
// key string used for not specified parameters
|
2021-08-23 18:58:18 +00:00
|
|
|
// Can be translated in dialogs, and is also a keyword outside dialogs
|
2019-09-27 15:12:24 +00:00
|
|
|
wxString inline NotSpecifiedPrm()
|
|
|
|
{
|
|
|
|
return _HKI( "Not specified" );
|
|
|
|
}
|
2019-06-23 11:20:22 +00:00
|
|
|
|
2019-09-27 15:12:24 +00:00
|
|
|
/**
|
|
|
|
* @return true if the param value is specified:
|
|
|
|
* not empty
|
|
|
|
* not NotSpecifiedPrm() value or its translation
|
|
|
|
*/
|
|
|
|
bool IsPrmSpecified( const wxString& aPrmValue );
|
2019-09-09 14:45:21 +00:00
|
|
|
|
2021-08-23 18:58:18 +00:00
|
|
|
#define DEFAULT_SOLDERMASK_OPACITY 0.83
|
|
|
|
|
2019-09-24 12:33:28 +00:00
|
|
|
// A reasonable Epsilon R value for solder mask dielectric
|
|
|
|
#define DEFAULT_EPSILON_R_SOLDERMASK 3.3
|
|
|
|
|
|
|
|
// A default Epsilon R value for silkscreen dielectric
|
|
|
|
#define DEFAULT_EPSILON_R_SILKSCREEN 1.0
|
|
|
|
|
2019-06-23 11:20:22 +00:00
|
|
|
// A minor struct to handle color in gerber job file and dialog
|
2021-08-23 18:58:18 +00:00
|
|
|
class FAB_LAYER_COLOR
|
2019-06-23 11:20:22 +00:00
|
|
|
{
|
2021-08-23 18:58:18 +00:00
|
|
|
public:
|
|
|
|
FAB_LAYER_COLOR()
|
|
|
|
{}
|
2019-07-27 19:09:43 +00:00
|
|
|
|
2021-08-23 18:58:18 +00:00
|
|
|
FAB_LAYER_COLOR( const wxString& aColorName, const wxColor& aColor ) :
|
|
|
|
m_colorName( aColorName ),
|
|
|
|
m_color( aColor )
|
2019-07-27 19:09:43 +00:00
|
|
|
{}
|
2021-08-23 18:58:18 +00:00
|
|
|
|
|
|
|
const wxString& GetName() const
|
|
|
|
{
|
|
|
|
return m_colorName;
|
|
|
|
}
|
|
|
|
|
2021-08-16 18:57:15 +00:00
|
|
|
KIGFX::COLOR4D GetColor( BOARD_STACKUP_ITEM_TYPE aItemType ) const
|
2021-08-23 18:58:18 +00:00
|
|
|
{
|
|
|
|
if( aItemType == BS_ITEM_TYPE_SOLDERMASK )
|
2021-08-16 18:57:15 +00:00
|
|
|
return m_color.WithAlpha( DEFAULT_SOLDERMASK_OPACITY );
|
2021-08-23 18:58:18 +00:00
|
|
|
else
|
2021-08-16 18:57:15 +00:00
|
|
|
return m_color.WithAlpha( 1.0 );
|
2021-08-23 18:58:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxString m_colorName; // the name (in job file) of the color
|
|
|
|
// User values are the HTML coding #rrggbbaa hexadecimal value.
|
|
|
|
KIGFX::COLOR4D m_color;
|
2019-06-23 11:20:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return a wxArray of standard copper finish names.
|
|
|
|
* @param aTranslate = false for the initial names, true for translated names
|
|
|
|
*/
|
2021-08-16 18:57:15 +00:00
|
|
|
wxArrayString GetStandardCopperFinishes( bool aTranslate );
|
2019-06-23 11:20:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return a list of standard FAB_LAYER_COLOR items for silkscreen and solder mask.
|
|
|
|
*/
|
2021-08-16 18:57:15 +00:00
|
|
|
const FAB_LAYER_COLOR* GetStandardColors( BOARD_STACKUP_ITEM_TYPE aType );
|
2019-06-23 11:20:22 +00:00
|
|
|
|
2019-07-27 19:09:43 +00:00
|
|
|
/**
|
|
|
|
* @return the count of colors in ColorStandardList
|
|
|
|
*/
|
2021-08-16 18:57:15 +00:00
|
|
|
int GetStandardColorCount( BOARD_STACKUP_ITEM_TYPE aType );
|
2019-07-27 19:09:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the index of the user defined color in ColorStandardList
|
|
|
|
*/
|
2021-08-16 18:57:15 +00:00
|
|
|
int GetColorUserDefinedListIdx( BOARD_STACKUP_ITEM_TYPE aType );
|
2019-07-27 19:09:43 +00:00
|
|
|
|
2021-08-16 18:57:15 +00:00
|
|
|
inline KIGFX::COLOR4D GetDefaultUserColor( BOARD_STACKUP_ITEM_TYPE aType )
|
2021-08-23 18:58:18 +00:00
|
|
|
{
|
2021-08-16 18:57:15 +00:00
|
|
|
return GetStandardColors( aType )[GetColorUserDefinedListIdx( aType )].GetColor( aType );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline KIGFX::COLOR4D GetStandardColor( BOARD_STACKUP_ITEM_TYPE aType, int aIdx )
|
|
|
|
{
|
|
|
|
return GetStandardColors( aType )[ aIdx ].GetColor( aType );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const wxString& GetStandardColorName( BOARD_STACKUP_ITEM_TYPE aType, int aIdx )
|
|
|
|
{
|
|
|
|
return GetStandardColors( aType )[ aIdx ].GetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool IsCustomColorIdx( BOARD_STACKUP_ITEM_TYPE aType, int aIdx )
|
|
|
|
{
|
|
|
|
return aIdx == GetColorUserDefinedListIdx( aType );
|
2021-08-23 18:58:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-23 11:20:22 +00:00
|
|
|
#endif // #ifndef STACKUP_PREDEFINED_PRMS_H
|