Fix a minor compatibility issue in .pro file for new boards, between decimils and nanometers versions of Pcbnew.

This commit is contained in:
jean-pierre charras 2012-10-17 12:57:21 +02:00
parent 0e1e7f53b1
commit f03b9048fe
6 changed files with 187 additions and 63 deletions

View File

@ -463,6 +463,53 @@ void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
}
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit ) :
PARAM_CFG_INT( ident, ptparam, default_val, min, max, group )
{
m_Type = PARAM_INT_WITH_SCALE;
m_BIU_to_cfgunit = aBiu2cfgunit;
}
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool Insetup,
const wxChar* ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit ) :
PARAM_CFG_INT( Insetup, ident, ptparam, default_val, min, max, group )
{
m_Type = PARAM_INT_WITH_SCALE;
m_BIU_to_cfgunit = aBiu2cfgunit;
}
void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
double default_value = m_Default * m_BIU_to_cfgunit;
double dtmp = aConfig->Read( m_Ident, default_value );
int itmp = KiROUND( dtmp / m_BIU_to_cfgunit );
if( (itmp < m_Min) || (itmp > m_Max) )
itmp = m_Default;
*m_Pt_param = itmp;
}
void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param * m_BIU_to_cfgunit );
}
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam,
EDA_COLOR_T default_val,
const wxChar* group ) :

View File

@ -17,6 +17,7 @@
/** Type of parameter in the configuration file */
enum paramcfg_id {
PARAM_INT,
PARAM_INT_WITH_SCALE,
PARAM_SETCOLOR,
PARAM_DOUBLE,
PARAM_BOOL,
@ -92,6 +93,36 @@ public:
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
/**
* Configuration parameter - Integer Class
* with unit conversion.
* Mainly used to store an integer value in millimeters (or inches)
* and retrieve it in internal units
* the stored value is a floating number
*/
class PARAM_CFG_INT_WITH_SCALE : public PARAM_CFG_INT
{
public:
double m_BIU_to_cfgunit; ///< the factor to convert the saved value in internal value
public:
PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL,
double aBiu2cfgunit = 1.0);
PARAM_CFG_INT_WITH_SCALE( bool Insetup, const wxChar* ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL,
double aBiu2cfgunit = 1.0 );
virtual void ReadParam( wxConfigBase* aConfig ) const;
virtual void SaveParam( wxConfigBase* aConfig ) const;
};
/**
* Configuration parameter - SetColor Class

View File

@ -11,8 +11,20 @@
#include <class_board_design_settings.h>
#include <class_track.h>
#include <convert_from_iu.h>
#define DEFAULT_BOARD_THICKNESS_DMILS 620
// Board thickness, mainly for 3D view:
#define DEFAULT_BOARD_THICKNESS_MM 1.6
// Default values for some board items
#define DEFAULT_TEXT_PCB_SIZE Millimeter2iu( 1.5 )
#define DEFAULT_TEXT_PCB_THICKNESS Millimeter2iu( 0.3 )
#define DEFAULT_PCB_EDGE_THICKNESS Millimeter2iu( 0.15 )
#define DEFAULT_GRAPHIC_THICKNESS Millimeter2iu( 0.2 )
#define DEFAULT_TEXT_MODULE_SIZE Millimeter2iu( 1.5 )
#define DEFAULT_GR_MODULE_THICKNESS Millimeter2iu( 0.15 )
#define DEFAULT_SOLDERMASK_CLEARANCE Millimeter2iu( 0.1 )
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
@ -36,13 +48,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = DMils2iu( 100 ); // current graphic line width (not EDGE layer)
m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer)
m_EdgeSegmentWidth = DMils2iu( 100 ); // current graphic line width (EDGE layer only)
m_PcbTextWidth = DMils2iu( 100 ); // current Pcb (not module) Text width
m_EdgeSegmentWidth = DEFAULT_PCB_EDGE_THICKNESS; // current graphic line width (EDGE layer only)
m_PcbTextWidth = DEFAULT_TEXT_PCB_THICKNESS; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( DMils2iu( 500 ), DMils2iu( 500 ) );
// current Pcb (not module) Text size
m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE,
DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size
m_TrackMinWidth = DMils2iu( 100 ); // track min value for width ((min copper size value
m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter
@ -51,57 +63,80 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_MicroViasMinDrill = DMils2iu( 50 ); // micro vias (not vias) min drill diameter
// Global mask margins:
m_SolderMaskMargin = DMils2iu( 150 ); // Solder mask margin
m_SolderMaskMargin = DEFAULT_SOLDERMASK_CLEARANCE; // Solder mask margin
m_SolderPasteMargin = 0; // Solder paste margin absolute value
m_SolderPasteMarginRatio = 0.0; // Solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values
// Usually < 0 because the mask is smaller than pad
m_ModuleTextSize = wxSize( DMils2iu( 500 ), DMils2iu( 500 ) );
m_ModuleTextWidth = DMils2iu( 100 );
m_ModuleSegmentWidth = DMils2iu( 100 );
m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE,
DEFAULT_TEXT_MODULE_SIZE );
m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS;
m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS;
// Layer thickness for 3D viewer
m_boardThickness = DMils2iu( DEFAULT_BOARD_THICKNESS_DMILS );
m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM );
}
// Add parameters to save in project config.
// values are saved in mm
void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
{
m_Pad_Master.AppendConfigs( aResult );
aResult->push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ), &m_boardThickness,
DMils2iu( DEFAULT_BOARD_THICKNESS_DMILS ), 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeV" ),
&m_PcbTextSize.y,
DEFAULT_TEXT_PCB_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ), &m_PcbTextSize.y,
DMils2iu( 600 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeH" ),
&m_PcbTextSize.x,
DEFAULT_TEXT_PCB_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbH" ), &m_PcbTextSize.x,
DMils2iu( 600 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextThickness" ),
&m_PcbTextWidth,
DEFAULT_TEXT_PCB_THICKNESS,
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModV" ), &m_ModuleTextSize.y,
DMils2iu( 500 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeV" ),
&m_ModuleTextSize.y,
DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModH" ), &m_ModuleTextSize.x,
DMils2iu( 500 ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeH" ),
&m_ModuleTextSize.x,
DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModW" ), &m_ModuleTextWidth,
DMils2iu( 100 ), 1, TEXTS_MAX_WIDTH ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeThickness" ),
&m_ModuleTextWidth,
DEFAULT_GR_MODULE_THICKNESS, 1, TEXTS_MAX_WIDTH,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "VEgarde" ), &m_SolderMaskMargin,
DMils2iu( 100 ), 0, DMils2iu( 10000 ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ),
&m_SolderMaskMargin,
DEFAULT_SOLDERMASK_CLEARANCE, 0, Millimeter2iu( 1.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "DrawLar" ), &m_DrawSegmentWidth,
DMils2iu( 120 ), 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "DrawSegmentWidth" ),
&m_DrawSegmentWidth,
DEFAULT_GRAPHIC_THICKNESS,
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "EdgeLar" ), &m_EdgeSegmentWidth,
DMils2iu( 120 ), 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BoardOutlineThickness" ),
&m_EdgeSegmentWidth,
DEFAULT_PCB_EDGE_THICKNESS,
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtLar" ), &m_PcbTextWidth,
DMils2iu( 120 ), 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &m_ModuleSegmentWidth,
DMils2iu( 120 ), 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleOutlineThickness" ),
&m_ModuleSegmentWidth,
DEFAULT_GR_MODULE_THICKNESS,
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
}

View File

@ -45,6 +45,7 @@
#include <class_board.h>
#include <class_module.h>
#include <polygon_test_point_inside.h>
#include <convert_from_iu.h>
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
@ -165,14 +166,23 @@ void D_PAD::Flip( int aTranslationY )
void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult )
{
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &m_Drill.x,
320, 0, 0x7FFF ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrill" ),
&m_Drill.x,
Millimeter2iu( 0.6 ),
Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &m_Size.x,
550, 0, 0x7FFF ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeH" ),
&m_Size.x,
Millimeter2iu( 1.4 ),
Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &m_Size.y,
550, 0, 0x7FFF ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeV" ),
&m_Size.y,
Millimeter2iu( 1.4 ),
Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ),
NULL, MM_PER_IU ) );
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -1,22 +1,23 @@
<html>
<head>
<title>Raspberry Pi - Expansion Board</title>
</head>
<body>
<h1>Raspberry Pi</h1>
<h2>Expansion Board</h2>
This project template is the basis of an expansion board for the
<a href="http://www.raspberrypi.org/" target="blank">Raspberry Pi $25 ARM
board.</a>
<br><br>
This base project includes a PCB edge defined as the same size as the
Raspberry-Pi PCB with the connectors placed correctly to align the two boards.
All IO present on the Raspberry-Pi board is connected to the project through the
0.1" expansion headers.
<br><br>
The board outline looks like the following:
<br><br>
(c)2012 Brian Sidebotham<br>
(c)2012 Kicad Developers<br>
</body>
</html>
<html>
<head>
<title>Raspberry Pi - Expansion Board</title>
</head>
<body>
<h1>Raspberry Pi</h1>
<h2>Expansion Board</h2>
This project template is the basis of an expansion board for the
<a href="http://www.raspberrypi.org/" target="blank">Raspberry Pi $25 ARM
board.</a>
<br><br>
This base project includes a PCB edge defined as the same size as the
Raspberry-Pi PCB with the connectors placed correctly to align the two boards.
All IO present on the Raspberry-Pi board is connected to the project through the
0.1" expansion headers.
<br><br>
The board outline looks like the following:
<P><IMG SRC="brd.png" NAME="brd" ALIGN=LEFT WIDTH=680 HEIGHT=378 BORDER=0><BR><BR>(c)2012
<br><br>
(c)2012 Brian Sidebotham<br>
(c)2012 Kicad Developers<br>
</body>
</html>