Commit a3f48bf2 authored by charras's avatar charras

pcbnew Added: control of masks clearance. See changelog for more info

parent 1a4d2389
...@@ -4,6 +4,24 @@ KiCad ChangeLog 2009 ...@@ -4,6 +4,24 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-Nov-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
Added: control of masks clearance
- Solder mask clearance can be now defined at footprint and pad level
- Solder paste clearance can be now defined as a global value
and also at footprint and pad level.
The clearance is defined by a constant value and a value proportional to the pad size.
The final value is the sum of the 2 partial values
Note: this is a work in progress:
currently, the pad dialog is not finished and does not
have an option to enter the mask values
Planned:
option to define a net clearance at pad level and footprint level,
as an alternate value to the Netclasses values.
this option could be useful to create fiducials, and for very small footprints.
2009-Nov-1 UPDATE Dick Hollenbeck <dick@softplc.com> 2009-Nov-1 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++pcbnew ++pcbnew
......
...@@ -23,7 +23,11 @@ public: ...@@ -23,7 +23,11 @@ public:
int m_ViasMinDrill; // vias (not micro vias) min drill diameter int m_ViasMinDrill; // vias (not micro vias) min drill diameter
int m_MicroViasMinSize; // micro vias (not vias) min diameter int m_MicroViasMinSize; // micro vias (not vias) min diameter
int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter
int m_MaskMargin; // Solder mask margin // Global mask margins:
int m_SolderMaskMargin; // Solder mask margin
int m_SolderPasteMargin; // Solder paste margin absolute value
double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values
int m_LayerThickness; // Layer Thickness for 3D viewer int m_LayerThickness; // Layer Thickness for 3D viewer
protected: protected:
...@@ -32,6 +36,7 @@ protected: ...@@ -32,6 +36,7 @@ protected:
int m_VisibleElements; // Bit-mask for element category visibility int m_VisibleElements; // Bit-mask for element category visibility
public: public:
// Color options for screen display of the Printed Board: // Color options for screen display of the Printed Board:
int m_LayerColor[32]; // Layer colors (tracks and graphic items) int m_LayerColor[32]; // Layer colors (tracks and graphic items)
...@@ -69,10 +74,12 @@ public: ...@@ -69,10 +74,12 @@ public:
{ {
if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers
return false; return false;
// If a layer is disabled, it is automatically invisible // If a layer is disabled, it is automatically invisible
return (bool)( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex ); return (bool) ( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex );
} }
/** /**
* Function SetLayerVisibility * Function SetLayerVisibility
* changes the visibility of a given layer * changes the visibility of a given layer
...@@ -91,6 +98,7 @@ public: ...@@ -91,6 +98,7 @@ public:
return m_VisibleElements; return m_VisibleElements;
} }
/** /**
* Function SetVisibleElements * Function SetVisibleElements
* changes the bit-mask of visible element categories * changes the bit-mask of visible element categories
...@@ -101,6 +109,7 @@ public: ...@@ -101,6 +109,7 @@ public:
m_VisibleElements = aMask; m_VisibleElements = aMask;
} }
/** /**
* Function IsElementVisible * Function IsElementVisible
* tests whether a given element category is visible * tests whether a given element category is visible
...@@ -111,9 +120,10 @@ public: ...@@ -111,9 +120,10 @@ public:
{ {
if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE ) if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE )
return false; return false;
return (bool)( m_VisibleElements & 1 << aCategoryIndex ); return (bool) ( m_VisibleElements & 1 << aCategoryIndex );
} }
/** /**
* Function SetElementVisibility * Function SetElementVisibility
* changes the visibility of an element category * changes the visibility of an element category
...@@ -132,6 +142,7 @@ public: ...@@ -132,6 +142,7 @@ public:
return m_EnabledLayers; return m_EnabledLayers;
} }
/** /**
* Function SetEnabledLayers * Function SetEnabledLayers
* changes the bit-mask of enabled layers * changes the bit-mask of enabled layers
...@@ -141,10 +152,12 @@ public: ...@@ -141,10 +152,12 @@ public:
{ {
// TODO; ensure consistency with m_CopperLayerCount // TODO; ensure consistency with m_CopperLayerCount
m_EnabledLayers = aMask; m_EnabledLayers = aMask;
// A disabled layer cannot be visible // A disabled layer cannot be visible
m_VisibleLayers &= aMask; m_VisibleLayers &= aMask;
} }
/** /**
* Function IsLayerEnabled * Function IsLayerEnabled
* tests whether a given layer is enabled * tests whether a given layer is enabled
...@@ -153,9 +166,10 @@ public: ...@@ -153,9 +166,10 @@ public:
*/ */
inline bool IsLayerEnabled( int aLayerIndex ) inline bool IsLayerEnabled( int aLayerIndex )
{ {
return (bool)( m_EnabledLayers & 1 << aLayerIndex ); return (bool) ( m_EnabledLayers & 1 << aLayerIndex );
} }
/** /**
* Function GetCopperLayerCount * Function GetCopperLayerCount
* @return int - the number of neabled copper layers * @return int - the number of neabled copper layers
...@@ -165,6 +179,7 @@ public: ...@@ -165,6 +179,7 @@ public:
return m_CopperLayerCount; return m_CopperLayerCount;
} }
/** /**
* Function SetCopperLayerCount * Function SetCopperLayerCount
* do what its name says... * do what its name says...
...@@ -175,4 +190,5 @@ public: ...@@ -175,4 +190,5 @@ public:
#endif #endif
// _BOARD_DESIGN_SETTING_H
// _BOARD_DESIGN_SETTING_H
...@@ -287,9 +287,8 @@ public: ...@@ -287,9 +287,8 @@ public:
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void Genere_DXF( const wxString& FullFileName, int Layer, GRTraceMode trace_mode ); void Genere_DXF( const wxString& FullFileName, int Layer, GRTraceMode trace_mode );
void Plot_Layer( PLOTTER* plotter, int Layer, GRTraceMode trace_mode ); void Plot_Layer( PLOTTER* plotter, int Layer, GRTraceMode trace_mode );
void Plot_Standard_Layer( PLOTTER* plotter, int masque_layer, void Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask,
int garde, bool trace_via, bool aPlotVia, GRTraceMode aPlotMode );
GRTraceMode trace_mode );
void Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode ); void Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode );
/** function PlotDrillMark /** function PlotDrillMark
...@@ -298,7 +297,7 @@ public: ...@@ -298,7 +297,7 @@ public:
* redraw the drill mark on a pad or via, as a negative (i.e. white) shape in FILLED plot mode * redraw the drill mark on a pad or via, as a negative (i.e. white) shape in FILLED plot mode
* @param aPlotter = the PLOTTER * @param aPlotter = the PLOTTER
* @param aTraceMode = the mode of plot (FILLED, SKETCH) * @param aTraceMode = the mode of plot (FILLED, SKETCH)
* @param aSmallDrillShape = true to plot a smalle drill shape, false to plot the actual drill shape * @param aSmallDrillShape = true to plot a small drill shape, false to plot the actual drill shape
*/ */
void PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, bool aSmallDrillShape ); void PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, bool aSmallDrillShape );
......
...@@ -98,8 +98,6 @@ public: ...@@ -98,8 +98,6 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void OnPaint( wxPaintEvent& event );
void ReDraw( wxDC* DC );
void OnSashDrag( wxSashEvent& event ); void OnSashDrag( wxSashEvent& event );
void OnLoadProject( wxCommandEvent& event ); void OnLoadProject( wxCommandEvent& event );
void OnSaveProject( wxCommandEvent& event ); void OnSaveProject( wxCommandEvent& event );
......
...@@ -281,21 +281,6 @@ void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -281,21 +281,6 @@ void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event )
} }
/**********************************************************/
void WinEDA_MainFrame::OnPaint( wxPaintEvent& event )
/**********************************************************/
{
event.Skip();
}
/*******************************************/
void WinEDA_MainFrame::ReDraw( wxDC* DC )
/*******************************************/
{
}
void WinEDA_MainFrame::OnExit( wxCommandEvent& event ) void WinEDA_MainFrame::OnExit( wxCommandEvent& event )
{ {
Close( true ); Close( true );
......
...@@ -53,7 +53,12 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -53,7 +53,12 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter
m_MaskMargin = 150; // Solder mask margin // Global mask margins:
m_SolderMaskMargin = 150; // 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
/* Color options for screen display of the Printed Board: */ /* Color options for screen display of the Printed Board: */
for( ii = 0; ii < 32; ii++ ) for( ii = 0; ii < 32; ii++ )
...@@ -75,22 +80,25 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const ...@@ -75,22 +80,25 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const
return m_VisibleLayers; return m_VisibleLayers;
} }
void EDA_BoardDesignSettings::SetVisibleLayers( int aMask ) void EDA_BoardDesignSettings::SetVisibleLayers( int aMask )
{ {
m_VisibleLayers = aMask & m_EnabledLayers & ALL_LAYERS; m_VisibleLayers = aMask & m_EnabledLayers & ALL_LAYERS;
} }
void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState ) void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState )
{ {
// Altough Pcbnew uses only 29, Gerbview uses all 32 layers // Altough Pcbnew uses only 29, Gerbview uses all 32 layers
if( aLayerIndex < 0 || aLayerIndex >= 32 ) if( aLayerIndex < 0 || aLayerIndex >= 32 )
return; return;
if( aNewState && IsLayerEnabled( aLayerIndex )) if( aNewState && IsLayerEnabled( aLayerIndex ) )
m_VisibleLayers |= 1 << aLayerIndex; m_VisibleLayers |= 1 << aLayerIndex;
else else
m_VisibleLayers &= ~( 1 << aLayerIndex ); m_VisibleLayers &= ~( 1 << aLayerIndex );
} }
void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState )
{ {
if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE ) if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE )
...@@ -100,6 +108,8 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a ...@@ -100,6 +108,8 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a
else else
m_VisibleElements &= ~( 1 << aElementCategory ); m_VisibleElements &= ~( 1 << aElementCategory );
} }
/** /**
* Function SetCopperLayerCount * Function SetCopperLayerCount
* do what its name says... * do what its name says...
...@@ -108,11 +118,12 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a ...@@ -108,11 +118,12 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a
void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount ) void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount )
{ {
m_CopperLayerCount = aNewLayerCount; m_CopperLayerCount = aNewLayerCount;
// ensure consistency with the m_EnabledLayers member // ensure consistency with the m_EnabledLayers member
m_EnabledLayers &= ~ALL_CU_LAYERS; m_EnabledLayers &= ~ALL_CU_LAYERS;
m_EnabledLayers |= CUIVRE_LAYER; m_EnabledLayers |= CUIVRE_LAYER;
if ( m_CopperLayerCount > 1 ) if( m_CopperLayerCount > 1 )
m_EnabledLayers |= CMP_LAYER; m_EnabledLayers |= CMP_LAYER;
for( int ii = 1; ii < aNewLayerCount-1; ii++ ) for( int ii = 1; ii < aNewLayerCount - 1; ii++ )
m_EnabledLayers |= 1 << ii; m_EnabledLayers |= 1 << ii;
} }
...@@ -38,6 +38,10 @@ MODULE::MODULE( BOARD* parent ) : ...@@ -38,6 +38,10 @@ MODULE::MODULE( BOARD* parent ) :
m_Surface = 0; m_Surface = 0;
m_Link = 0; m_Link = 0;
m_LastEdit_Time = time( NULL ); m_LastEdit_Time = time( NULL );
m_LocalClearance = 0;
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_Reference = new TEXTE_MODULE( this, TEXT_is_REFERENCE ); m_Reference = new TEXTE_MODULE( this, TEXT_is_REFERENCE );
...@@ -68,7 +72,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -68,7 +72,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE )) if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) )
{ {
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y, m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y,
...@@ -81,6 +85,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -81,6 +85,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
} }
} }
/*********************************/ /*********************************/
void MODULE::Copy( MODULE* aModule ) void MODULE::Copy( MODULE* aModule )
/*********************************/ /*********************************/
...@@ -97,6 +102,9 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -97,6 +102,9 @@ void MODULE::Copy( MODULE* aModule )
m_LastEdit_Time = aModule->m_LastEdit_Time; m_LastEdit_Time = aModule->m_LastEdit_Time;
m_Path = aModule->m_Path; //is this correct behavior? m_Path = aModule->m_Path; //is this correct behavior?
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetTimeStamp();
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio;
/* Copy des structures auxiliaires: Reference et value */ /* Copy des structures auxiliaires: Reference et value */
m_Reference->Copy( aModule->m_Reference ); m_Reference->Copy( aModule->m_Reference );
...@@ -119,14 +127,14 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -119,14 +127,14 @@ void MODULE::Copy( MODULE* aModule )
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
TEXTE_MODULE* textm; TEXTE_MODULE * textm;
textm = new TEXTE_MODULE( this ); textm = new TEXTE_MODULE( this );
textm->Copy( (TEXTE_MODULE*) item ); textm->Copy( (TEXTE_MODULE*) item );
m_Drawings.PushBack( textm ); m_Drawings.PushBack( textm );
break; break;
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
EDGE_MODULE* edge; EDGE_MODULE * edge;
edge = new EDGE_MODULE( this ); edge = new EDGE_MODULE( this );
edge->Copy( (EDGE_MODULE*) item ); edge->Copy( (EDGE_MODULE*) item );
m_Drawings.PushBack( edge ); m_Drawings.PushBack( edge );
...@@ -140,14 +148,15 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -140,14 +148,15 @@ void MODULE::Copy( MODULE* aModule )
/* Copy auxiliary data: 3D_Drawings info */ /* Copy auxiliary data: 3D_Drawings info */
m_3D_Drawings.DeleteAll(); m_3D_Drawings.DeleteAll();
// Ensure there is one (or more) item in m_3D_Drawings // Ensure there is one (or more) item in m_3D_Drawings
m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item
for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() ) for( S3D_MASTER* item = aModule->m_3D_Drawings; item; item = item->Next() )
{ {
if ( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes. if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
continue; continue;
S3D_MASTER* t3d = m_3D_Drawings; S3D_MASTER* t3d = m_3D_Drawings;
if ( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can exist, but is empty : use it. if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can exist, but is empty : use it.
t3d->Copy( item ); t3d->Copy( item );
else else
{ {
...@@ -290,6 +299,12 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -290,6 +299,12 @@ bool MODULE::Save( FILE* aFile ) const
fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp ); fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp );
fprintf( aFile, "AR %s\n", CONV_TO_UTF8( m_Path ) ); fprintf( aFile, "AR %s\n", CONV_TO_UTF8( m_Path ) );
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 ); fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
if( m_LocalSolderMaskMargin != 0 )
fprintf( aFile, ".SolderMask %d\n",m_LocalSolderMaskMargin );
if( m_LocalSolderPasteMargin != 0 )
fprintf( aFile, ".SolderPaste %d\n",m_LocalSolderPasteMargin);
if( m_LocalSolderPasteMarginRatio != 0)
fprintf( aFile, ".SolderPasteRatio %g\n",m_LocalSolderPasteMarginRatio);
// attributes // attributes
if( m_Attributs != MOD_DEFAULT ) if( m_Attributs != MOD_DEFAULT )
...@@ -322,7 +337,7 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -322,7 +337,7 @@ bool MODULE::Save( FILE* aFile ) const
break; break;
default: default:
#if defined (DEBUG) #if defined(DEBUG)
printf( "MODULE::Save() ignoring type %d\n", item->Type() ); printf( "MODULE::Save() ignoring type %d\n", item->Type() );
#endif #endif
break; break;
...@@ -462,9 +477,9 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum ) ...@@ -462,9 +477,9 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum )
int MODULE::ReadDescr( FILE* File, int* LineNum ) int MODULE::ReadDescr( FILE* File, int* LineNum )
/**************************************************/ /**************************************************/
/* Lecture de la description d'un MODULE (format Ascii) /* Read a MODULE description
* la 1ere ligne de descr ($MODULE) est supposee etre deja lue * The first description line ($MODULE) is already read
* retourne 0 si OK * @return 0 if no error
*/ */
{ {
char Line[256], BufLine[256], BufCar1[128], * PtLine; char Line[256], BufLine[256], BufCar1[128], * PtLine;
...@@ -496,7 +511,8 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -496,7 +511,8 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
PtLine = Line + 3; PtLine = Line + 3;
/* Pointe 1er code utile de la ligne */ /* Decode the first code of the current line and read the correspondint data
*/
switch( Line[0] ) switch( Line[0] )
{ {
case 'P': case 'P':
...@@ -513,7 +529,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -513,7 +529,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
m_ModuleStatus |= MODULE_is_PLACED; m_ModuleStatus |= MODULE_is_PLACED;
break; break;
case 'L': /* Li = Lecture du nom librairie du module */ case 'L': /* Li = read the library name of the footprint */
*BufLine = 0; *BufLine = 0;
sscanf( PtLine, " %s", BufLine ); sscanf( PtLine, " %s", BufLine );
m_LibRef = CONV_FROM_UTF8( BufLine ); m_LibRef = CONV_FROM_UTF8( BufLine );
...@@ -524,7 +540,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -524,7 +540,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
break; break;
case 'O': /* (Op)tions de placement auto */ case 'O': /* (Op)tions for auto placement */
itmp1 = itmp2 = 0; itmp1 = itmp2 = 0;
sscanf( PtLine, " %X %X", &itmp1, &itmp2 ); sscanf( PtLine, " %X %X", &itmp1, &itmp2 );
...@@ -544,7 +560,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -544,7 +560,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
case 'A': case 'A':
if( Line[1] == 't' ) if( Line[1] == 't' )
{ {
/* At = (At)tributs du module */ /* At = (At)tributes of module */
if( strstr( PtLine, "SMD" ) ) if( strstr( PtLine, "SMD" ) )
m_Attributs |= MOD_CMS; m_Attributs |= MOD_CMS;
if( strstr( PtLine, "VIRTUAL" ) ) if( strstr( PtLine, "VIRTUAL" ) )
...@@ -559,7 +575,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -559,7 +575,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
break; break;
case 'T': /* Read a footprint text description (ref, value, or drawing */ case 'T': /* Read a footprint text description (ref, value, or drawing */
TEXTE_MODULE* textm; TEXTE_MODULE * textm;
sscanf( Line + 1, "%d", &itmp1 ); sscanf( Line + 1, "%d", &itmp1 );
if( itmp1 == TEXT_is_REFERENCE ) if( itmp1 == TEXT_is_REFERENCE )
textm = m_Reference; textm = m_Reference;
...@@ -573,27 +589,35 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -573,27 +589,35 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
textm->ReadDescr( Line, File, LineNum ); textm->ReadDescr( Line, File, LineNum );
break; break;
case 'D': /* lecture du contour */ case 'D': /* read a drawing item */
EDGE_MODULE* edge; EDGE_MODULE * edge;
edge = new EDGE_MODULE( this ); edge = new EDGE_MODULE( this );
m_Drawings.PushBack( edge ); m_Drawings.PushBack( edge );
edge->ReadDescr( Line, File, LineNum ); edge->ReadDescr( Line, File, LineNum );
edge->SetDrawCoord(); edge->SetDrawCoord();
break; break;
case 'C': /* Lecture de la doc */ case 'C': /* read documentation data */
m_Doc = CONV_FROM_UTF8( StrPurge( PtLine ) ); m_Doc = CONV_FROM_UTF8( StrPurge( PtLine ) );
break; break;
case 'K': /* Lecture de la liste des mots cle */ case 'K': /* Read key words */
m_KeyWord = CONV_FROM_UTF8( StrPurge( PtLine ) ); m_KeyWord = CONV_FROM_UTF8( StrPurge( PtLine ) );
break; break;
case '.': /* Read specific data */
if( strnicmp(Line, ".SolderMask ", 12 ) == 0 )
m_LocalSolderMaskMargin = atoi(Line+12);
else if( strnicmp(Line, ".SolderPaste ", 13) == 0 )
m_LocalSolderPasteMargin = atoi(Line+13);
else if( strnicmp(Line, ".SolderPasteRatio ", 18) == 0 )
m_LocalSolderPasteMarginRatio = atof(Line+18);
break;
default: default:
break; break;
} }
} }
/* Recalculate the bounding box */ /* Recalculate the bounding box */
Set_Rectangle_Encadrement(); Set_Rectangle_Encadrement();
return 0; return 0;
...@@ -777,14 +801,14 @@ EDA_Rect MODULE::GetBoundingBox() ...@@ -777,14 +801,14 @@ EDA_Rect MODULE::GetBoundingBox()
{ {
if( edge->Type() != TYPE_TEXTE_MODULE ) if( edge->Type() != TYPE_TEXTE_MODULE )
continue; continue;
text_area = ((TEXTE_MODULE*)edge)->GetBoundingBox(); text_area = ( (TEXTE_MODULE*) edge )->GetBoundingBox();
area.Merge( text_area ); area.Merge( text_area );
} }
// Add the Clearence shape size: (shape around the pads when the clearence is shown // Add the Clearence shape size: (shape around the pads when the clearence is shown
// Not optimized, but the draw cost is small (perhaps smaller than optimization) // Not optimized, but the draw cost is small (perhaps smaller than optimization)
int biggest_clearance = GetBoard()->GetBiggestClearanceValue(); int biggest_clearance = GetBoard()->GetBiggestClearanceValue();
area.Inflate(biggest_clearance); area.Inflate( biggest_clearance );
return area; return area;
} }
...@@ -793,9 +817,10 @@ EDA_Rect MODULE::GetBoundingBox() ...@@ -793,9 +817,10 @@ EDA_Rect MODULE::GetBoundingBox()
/*******************************************************/ /*******************************************************/
void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
/*******************************************************/ /*******************************************************/
/* Virtual function, from EDA_BaseStruct. /* Virtual function, from EDA_BaseStruct.
* display module info on MsgPanel * display module info on MsgPanel
*/ */
{ {
int nbpad; int nbpad;
char bufcar[512], Line[512]; char bufcar[512], Line[512];
...@@ -856,7 +881,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -856,7 +881,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
if( m_3D_Drawings != NULL ) if( m_3D_Drawings != NULL )
msg = m_3D_Drawings->m_Shape3DName; msg = m_3D_Drawings->m_Shape3DName;
else else
msg = _("No 3D shape"); msg = _( "No 3D shape" );
frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED ); frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED );
wxString doc = _( "Doc: " ) + m_Doc; wxString doc = _( "Doc: " ) + m_Doc;
...@@ -925,6 +950,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const ...@@ -925,6 +950,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
if( buf == aPadName ) if( buf == aPadName )
#endif #endif
return pad; return pad;
} }
...@@ -941,7 +967,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -941,7 +967,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T* p = scanTypes; const KICAD_T* p = scanTypes;
bool done = false; bool done = false;
#if 0 && defined (DEBUG) #if 0 && defined(DEBUG)
std::cout << GetClass().mb_str() << ' '; std::cout << GetClass().mb_str() << ' ';
#endif #endif
...@@ -1006,7 +1032,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1006,7 +1032,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
} }
#if defined (DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -69,6 +69,15 @@ public: ...@@ -69,6 +69,15 @@ public:
wxString m_Doc; // Module Description (info for users) wxString m_Doc; // Module Description (info for users)
wxString m_KeyWord; // Keywords to select the module in lib wxString m_KeyWord; // Keywords to select the module in lib
// Local clearance. When null, the netclasses values are used. Usually the local clearance is null
int m_LocalClearance;
// Local mask margins: when NULL, the global design values are used
int m_LocalSolderMaskMargin; // Local solder mask margin
int m_LocalSolderPasteMargin; // Local solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; // Local solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values
public: public:
MODULE( BOARD* parent ); MODULE( BOARD* parent );
MODULE( MODULE* module ); MODULE( MODULE* module );
...@@ -85,7 +94,7 @@ public: ...@@ -85,7 +94,7 @@ public:
* adds the given item to this MODULE and takes ownership of its memory. * adds the given item to this MODULE and takes ownership of its memory.
* @param aBoardItem The item to add to this board. * @param aBoardItem The item to add to this board.
* @param doInsert If true, then insert, else append * @param doInsert If true, then insert, else append
void Add( BOARD_ITEM* aBoardItem, bool doInsert = true ); * void Add( BOARD_ITEM* aBoardItem, bool doInsert = true );
*/ */
...@@ -123,12 +132,13 @@ public: ...@@ -123,12 +132,13 @@ public:
// Moves // Moves
void SetPosition( const wxPoint& newpos ); void SetPosition( const wxPoint& newpos );
void SetOrientation( int newangle ); void SetOrientation( int newangle );
/** /**
* Function Move * Function Move
* move this object. * move this object.
* @param const wxPoint& aMoveVector - the move vector for this object. * @param const wxPoint& aMoveVector - the move vector for this object.
*/ */
virtual void Move(const wxPoint& aMoveVector); virtual void Move( const wxPoint& aMoveVector );
/** /**
* Function Rotate * Function Rotate
...@@ -136,14 +146,14 @@ public: ...@@ -136,14 +146,14 @@ public:
* @param const wxPoint& aRotCentre - the rotation point. * @param const wxPoint& aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate(const wxPoint& aRotCentre, int aAngle); virtual void Rotate( const wxPoint& aRotCentre, int aAngle );
/** /**
* Function Flip * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* @param const wxPoint& aCentre - the rotation point. * @param const wxPoint& aCentre - the rotation point.
*/ */
virtual void Flip(const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
/** /**
* Function IsLocked * Function IsLocked
...@@ -190,10 +200,11 @@ public: ...@@ -190,10 +200,11 @@ public:
* this is also the footprint name * this is also the footprint name
* @return bool - true if success reading else false. * @return bool - true if success reading else false.
*/ */
bool Read_GPCB_Descr(const wxString & CmpFullFileName); bool Read_GPCB_Descr( const wxString& CmpFullFileName );
int Read_3D_Descr( FILE* File, int* LineNum = NULL ); int Read_3D_Descr( FILE* File, int* LineNum = NULL );
/* drawing functions */ /* drawing functions */
/** Function Draw /** Function Draw
* Draw the text accordint to the footprint pos and orient * Draw the text accordint to the footprint pos and orient
* @param panel = draw panel, Used to know the clip box * @param panel = draw panel, Used to know the clip box
...@@ -201,7 +212,10 @@ public: ...@@ -201,7 +212,10 @@ public:
* @param offset = draw offset (usually wxPoint(0,0) * @param offset = draw offset (usually wxPoint(0,0)
* @param aDrawMode = GR_OR, GR_XOR.. * @param aDrawMode = GR_OR, GR_XOR..
*/ */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset ); void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
int aDrawMode,
const wxPoint& offset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas ); void Draw3D( Pcb3D_GLCanvas* glcanvas );
void DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC, void DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC,
...@@ -244,6 +258,7 @@ public: ...@@ -244,6 +258,7 @@ public:
return m_Reference->m_Text; return m_Reference->m_Text;
} }
/** /**
* Function GetValue * Function GetValue
* @return const wxString& - the value text. * @return const wxString& - the value text.
...@@ -292,7 +307,7 @@ public: ...@@ -292,7 +307,7 @@ public:
} }
#if defined (DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "trigo.h" #include "trigo.h"
#include "pcbnew_id.h" // ID_TRACK_BUTT #include "pcbnew_id.h" // ID_TRACK_BUTT
#include "class_board_design_settings.h"
/*******************************/ /*******************************/
...@@ -31,6 +32,10 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD ) ...@@ -31,6 +32,10 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )
m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL PAD_TRAPEZOID m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL PAD_TRAPEZOID
m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN
m_DrillShape = PAD_CIRCLE; // Drill shape = circle m_DrillShape = PAD_CIRCLE; // Drill shape = circle
m_LocalClearance = 0;
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_Masque_Layer = PAD_STANDARD_DEFAULT_LAYERS; // set layers mask to default for a standard pad m_Masque_Layer = PAD_STANDARD_DEFAULT_LAYERS; // set layers mask to default for a standard pad
SetSubRatsnest( 0 ); // used in ratsnest calculations SetSubRatsnest( 0 ); // used in ratsnest calculations
...@@ -161,9 +166,11 @@ void D_PAD::SetPadName( const wxString& name ) ...@@ -161,9 +166,11 @@ void D_PAD::SetPadName( const wxString& name )
m_Padname[ii] = 0; m_Padname[ii] = 0;
} }
/**************************************************/ /**************************************************/
void D_PAD::SetNetname( const wxString & aNetname ) void D_PAD::SetNetname( const wxString& aNetname )
/**************************************************/ /**************************************************/
/** /**
* Function SetNetname * Function SetNetname
* @param const wxString : the new netname * @param const wxString : the new netname
...@@ -196,6 +203,9 @@ void D_PAD::Copy( D_PAD* source ) ...@@ -196,6 +203,9 @@ void D_PAD::Copy( D_PAD* source )
m_PadShape = source->m_PadShape; // forme CERCLE, PAD_RECT PAD_OVAL PAD_TRAPEZOID ou libre m_PadShape = source->m_PadShape; // forme CERCLE, PAD_RECT PAD_OVAL PAD_TRAPEZOID ou libre
m_Attribut = source->m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, Bit 7 = STACK m_Attribut = source->m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, Bit 7 = STACK
m_Orient = source->m_Orient; // en 1/10 degres m_Orient = source->m_Orient; // en 1/10 degres
m_LocalSolderMaskMargin = source->m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = source->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = source->m_LocalSolderPasteMarginRatio;
SetSubRatsnest( 0 ); SetSubRatsnest( 0 );
SetSubNet( 0 ); SetSubNet( 0 );
...@@ -204,6 +214,75 @@ void D_PAD::Copy( D_PAD* source ) ...@@ -204,6 +214,75 @@ void D_PAD::Copy( D_PAD* source )
} }
// Mask margins handling:
/** Function GetSolderMaskMargin
* @return the margin for the solder mask layer
* usually > 0 (mask shape bigger than pad
* value is
* 1 - the local value
* 2 - if null, the parent footprint value
* 1 - if null, the global value
*/
int D_PAD::GetSolderMaskMargin()
{
int margin = m_LocalSolderMaskMargin;
if ( margin == 0 )
{
if( GetParent() && ((MODULE*)GetParent())->m_LocalSolderMaskMargin )
margin = ((MODULE*)GetParent())->m_LocalSolderMaskMargin;
}
if ( margin == 0 )
margin = g_DesignSettings.m_SolderMaskMargin;
// ensure mask have a size alwyas >= 0
if( margin < 0 )
{
int minsize = - MIN( m_Size.x, m_Size.y) / 2;
if (margin < minsize )
minsize = minsize;
}
return margin;
}
/** Function GetSolderPasteMargin
* @return the margin for the solder mask layer
* usually < 0 (mask shape smaller than pad
* value is
* 1 - the local value
* 2 - if null, the parent footprint value
* 1 - if null, the global value
*/
wxSize D_PAD::GetSolderPasteMargin()
{
int margin = m_LocalSolderPasteMargin;
if( margin == 0 && GetParent() )
margin = ((MODULE*)GetParent())->m_LocalSolderPasteMargin;
if( margin == 0 && GetParent() )
margin = g_DesignSettings.m_SolderPasteMargin;
double mratio = m_LocalSolderPasteMarginRatio;
if( mratio == 0.0 && GetParent() )
mratio = ((MODULE*)GetParent())->m_LocalSolderPasteMarginRatio;
if( mratio == 0.0 )
mratio = g_DesignSettings.m_SolderPasteMarginRatio;
wxSize pad_margin;
pad_margin.x = margin + wxRound(m_Size.x * mratio);
pad_margin.y = margin + wxRound(m_Size.y * mratio);
// ensure mask have a size alwyas >= 0
if (pad_margin.x < -m_Size.x/2 )
pad_margin.x = -m_Size.x/2;
if (pad_margin.y < -m_Size.y/2 )
pad_margin.y = -m_Size.y/2;
return pad_margin;
}
/*************************************************/ /*************************************************/
int D_PAD::ReadDescr( FILE* File, int* LineNum ) int D_PAD::ReadDescr( FILE* File, int* LineNum )
/*************************************************/ /*************************************************/
...@@ -231,11 +310,12 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -231,11 +310,12 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
PtLine = Line + 3; PtLine = Line + 3;
/* Pointe 1er code utile de la ligne */ /* Decode the first code and read the corresponding data
*/
switch( Line[0] ) switch( Line[0] )
{ {
case 'S': /* Ligne de description de forme et dims*/ case 'S': // = Sh
/* Lecture du nom pad */ /* Read pad name */
nn = 0; nn = 0;
while( (*PtLine != '"') && *PtLine ) while( (*PtLine != '"') && *PtLine )
PtLine++; PtLine++;
...@@ -266,7 +346,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -266,7 +346,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
ll = 0xFF & BufCar[0]; ll = 0xFF & BufCar[0];
/* Mise a jour de la forme */ /*Read pad shape */
m_PadShape = PAD_CIRCLE; m_PadShape = PAD_CIRCLE;
switch( ll ) switch( ll )
...@@ -308,9 +388,8 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -308,9 +388,8 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
nn = sscanf( PtLine, "%s %s %X", BufLine, BufCar, nn = sscanf( PtLine, "%s %s %X", BufLine, BufCar,
&m_Masque_Layer ); &m_Masque_Layer );
/* Contenu de BufCar non encore utilise ( reserve pour evolutions /* BufCar is not used now */
* ulterieures */ /* update attributes */
/* Mise a jour de l'attribut */
m_Attribut = PAD_STANDARD; m_Attribut = PAD_STANDARD;
if( strncmp( BufLine, "SMD", 3 ) == 0 ) if( strncmp( BufLine, "SMD", 3 ) == 0 )
m_Attribut = PAD_SMD; m_Attribut = PAD_SMD;
...@@ -320,14 +399,14 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -320,14 +399,14 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
m_Attribut = PAD_HOLE_NOT_PLATED; m_Attribut = PAD_HOLE_NOT_PLATED;
break; break;
case 'N': /* Lecture du netname */ case 'N': /* Read Netname */
int netcode; int netcode;
nn = sscanf( PtLine, "%d", &netcode ); nn = sscanf( PtLine, "%d", &netcode );
SetNet( netcode ); SetNet( netcode );
/* Lecture du netname */ /* read Netname */
ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) ); ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) );
SetNetname(CONV_FROM_UTF8( StrPurge( BufLine ) )); SetNetname( CONV_FROM_UTF8( StrPurge( BufLine ) ) );
break; break;
case 'P': case 'P':
...@@ -335,6 +414,15 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -335,6 +414,15 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
m_Pos = m_Pos0; m_Pos = m_Pos0;
break; break;
case '.': /* Read specific data */
if( strnicmp(Line, ".SolderMask ", 12 ) == 0 )
m_LocalSolderMaskMargin = atoi(Line+12);
else if( strnicmp(Line, ".SolderPaste ", 13) == 0 )
m_LocalSolderPasteMargin = atoi(Line+13);
else if( strnicmp(Line, ".SolderPasteRatio ", 18 ) == 0 )
m_LocalSolderPasteMarginRatio = atoi(Line+18);
break;
default: default:
DisplayError( NULL, wxT( "Err Pad: Id inconnu" ) ); DisplayError( NULL, wxT( "Err Pad: Id inconnu" ) );
return 1; return 1;
...@@ -352,14 +440,9 @@ bool D_PAD::Save( FILE* aFile ) const ...@@ -352,14 +440,9 @@ bool D_PAD::Save( FILE* aFile ) const
int cshape; int cshape;
const char* texttype; const char* texttype;
if( GetState( DELETED ) )
return true;
bool rc = false;
// check the return values for first and last fprints() in this function // check the return values for first and last fprints() in this function
if( fprintf( aFile, "$PAD\n" ) != sizeof("$PAD\n") - 1 ) if( fprintf( aFile, "$PAD\n" ) != sizeof("$PAD\n") - 1 )
goto out; return false;
switch( m_PadShape ) switch( m_PadShape )
{ {
...@@ -418,13 +501,17 @@ bool D_PAD::Save( FILE* aFile ) const ...@@ -418,13 +501,17 @@ bool D_PAD::Save( FILE* aFile ) const
fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y ); fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y );
if( fprintf( aFile, "$EndPAD\n" ) != sizeof("$EndPAD\n") - 1 ) if( m_LocalSolderMaskMargin != 0 )
goto out; fprintf( aFile, ".SolderMask %d\n",m_LocalSolderMaskMargin );
if( m_LocalSolderPasteMargin != 0 )
fprintf( aFile, ".SolderPaste %d\n",m_LocalSolderPasteMargin);
if( m_LocalSolderPasteMarginRatio != 0)
fprintf( aFile, ".SolderPasteRatio %g\n",m_LocalSolderPasteMarginRatio);
rc = true; if( fprintf( aFile, "$EndPAD\n" ) != sizeof("$EndPAD\n") - 1 )
return false;
out: return true;
return rc;
} }
...@@ -674,7 +761,7 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp ) ...@@ -674,7 +761,7 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
} }
#if defined (DEBUG) #if defined(DEBUG)
// @todo: could this be useable elsewhere also? // @todo: could this be useable elsewhere also?
static const char* ShowPadType( int aPadType ) static const char* ShowPadType( int aPadType )
......
...@@ -9,8 +9,10 @@ class Pcb3D_GLCanvas; ...@@ -9,8 +9,10 @@ class Pcb3D_GLCanvas;
/* Default layers used for pads, accordint to the pad type. /* Default layers used for pads, accordint to the pad type.
* this is default values only, they can be changed for a given pad * this is default values only, they can be changed for a given pad
*/ */
// PAD_STANDARD: // PAD_STANDARD:
#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP #define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | \
SOLDERMASK_LAYER_CMP
// PAD_CONN: // PAD_CONN:
#define PAD_CONN_DEFAULT_LAYERS CMP_LAYER | SOLDERPASTE_LAYER_CMP | SOLDERMASK_LAYER_CMP #define PAD_CONN_DEFAULT_LAYERS CMP_LAYER | SOLDERPASTE_LAYER_CMP | SOLDERMASK_LAYER_CMP
...@@ -19,7 +21,8 @@ class Pcb3D_GLCanvas; ...@@ -19,7 +21,8 @@ class Pcb3D_GLCanvas;
#define PAD_SMD_DEFAULT_LAYERS CMP_LAYER | SOLDERMASK_LAYER_CMP #define PAD_SMD_DEFAULT_LAYERS CMP_LAYER | SOLDERMASK_LAYER_CMP
//PAD_HOLE_NOT_PLATED: //PAD_HOLE_NOT_PLATED:
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS CUIVRE_LAYER | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP #define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS CUIVRE_LAYER | SILKSCREEN_LAYER_CMP | \
SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP
/* Definition type Structure d'un pad */ /* Definition type Structure d'un pad */
...@@ -74,6 +77,17 @@ public: ...@@ -74,6 +77,17 @@ public:
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN
int m_Orient; // in 1/10 degrees int m_Orient; // in 1/10 degrees
// Local clearance. When null, the module default value is used.
// when the module default value is null, the netclass value is used
// Usually the local clearance is null
int m_LocalClearance;
// Local mask margins: when NULL, the parent footprint design values are used
int m_LocalSolderMaskMargin; // Local solder mask margin
int m_LocalSolderPasteMargin; // Local solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; // Local solder pask margin ratio value of pad size
// The final margin is the sum of these 2 values
private: private:
int m_SubRatsnest; // variable used in rats nest computations int m_SubRatsnest; // variable used in rats nest computations
// handle subnet (block) number in ratsnet connection // handle subnet (block) number in ratsnet connection
...@@ -129,6 +143,29 @@ public: ...@@ -129,6 +143,29 @@ public:
} }
// Mask margins handling:
/** Function GetSolderMaskMargin
* @return the margin for the solder mask layer
* usually > 0 (mask shape bigger than pad
* value is
* 1 - the local value
* 2 - if null, the parent footprint value
* 1 - if null, the global value
*/
int GetSolderMaskMargin();
/** Function GetSolderPasteMargin
* @return the margin for the solder mask layer
* usually < 0 (mask shape smaller than pad
* because the margin can be dependant on the pad size, the margin has a x and a y value
* value is
* 1 - the local value
* 2 - if null, the parent footprint value
* 1 - if null, the global value
*/
wxSize GetSolderPasteMargin();
/* Reading and writing data on files */ /* Reading and writing data on files */
int ReadDescr( FILE* File, int* LineNum = NULL ); int ReadDescr( FILE* File, int* LineNum = NULL );
...@@ -222,11 +259,12 @@ public: ...@@ -222,11 +259,12 @@ public:
* move this object. * move this object.
* @param const wxPoint& aMoveVector - the move vector for this object. * @param const wxPoint& aMoveVector - the move vector for this object.
*/ */
virtual void Move(const wxPoint& aMoveVector) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -36,7 +36,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -36,7 +36,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
wxPoint coord[4]; wxPoint coord[4];
int fillpad = 0; int fillpad = 0;
wxPoint shape_pos; wxPoint shape_pos;
int mask_margin = 0; // margin (clearance) used for some non copper layers wxSize mask_margin; // margin (clearance) used for some non copper layers
if( m_Flags & DO_NOT_DRAW ) if( m_Flags & DO_NOT_DRAW )
return; return;
...@@ -166,19 +166,25 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -166,19 +166,25 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
} }
// if Contrast mode is ON and a technical layer active, show pads on this layer // if Contrast mode is ON and a technical layer active, show pads on this layer
// so we can see pads on paste or solder layer // so we can see pads on paste or solder layer and the size of the mask
if( DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer > LAST_COPPER_LAYER ) if( DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer > LAST_COPPER_LAYER )
{ {
if( IsOnLayer( screen->m_Active_Layer ) ) if( IsOnLayer( screen->m_Active_Layer ) )
{ {
color = g_DesignSettings.m_LayerColor[screen->m_Active_Layer]; color = g_DesignSettings.m_LayerColor[screen->m_Active_Layer];
// In hight contrast mode, and if the active layer is the mask layer // In hight contrast mode, and if the active layer is the mask layer
// shows the pad size with the mask clearance // shows the pad size with the mask clearance
switch( screen->m_Active_Layer ) switch( screen->m_Active_Layer )
{ {
case SOLDERMASK_N_CU: case SOLDERMASK_N_CU:
case SOLDERMASK_N_CMP: case SOLDERMASK_N_CMP:
mask_margin = g_DesignSettings.m_MaskMargin; mask_margin.x = mask_margin.y = GetSolderMaskMargin();
break;
case SOLDERPASTE_N_CU:
case SOLDERPASTE_N_CMP:
mask_margin = GetSolderPasteMargin();
break; break;
default: default:
...@@ -232,9 +238,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -232,9 +238,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
if( fillpad ) if( fillpad )
GRFilledCircle( &panel->m_ClipBox, DC, xc, yc, dx + mask_margin, 0, color, color ); GRFilledCircle( &panel->m_ClipBox, DC, xc, yc, dx + mask_margin.x, 0, color, color );
else else
GRCircle( &panel->m_ClipBox, DC, xc, yc, dx + mask_margin, 0, color ); GRCircle( &panel->m_ClipBox, DC, xc, yc, dx + mask_margin.x, 0, color );
if( DisplayIsol ) if( DisplayIsol )
{ {
...@@ -254,13 +260,13 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -254,13 +260,13 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
{ {
delta_cx = dx - dy; delta_cx = dx - dy;
delta_cy = 0; delta_cy = 0;
rotdx = m_Size.y; rotdx = m_Size.y + (mask_margin.y*2);
} }
else /* ellipse verticale */ else /* ellipse verticale */
{ {
delta_cx = 0; delta_cx = 0;
delta_cy = dy - dx; delta_cy = dy - dx;
rotdx = m_Size.x; rotdx = m_Size.x + (mask_margin.x*2);
} }
RotatePoint( &delta_cx, &delta_cy, angle ); RotatePoint( &delta_cx, &delta_cy, angle );
...@@ -269,14 +275,14 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -269,14 +275,14 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
GRFillCSegm( &panel->m_ClipBox, DC, GRFillCSegm( &panel->m_ClipBox, DC,
ux0 + delta_cx, uy0 + delta_cy, ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy, ux0 - delta_cx, uy0 - delta_cy,
rotdx + mask_margin, color ); rotdx, color );
} }
else else
{ {
GRCSegm( &panel->m_ClipBox, DC, GRCSegm( &panel->m_ClipBox, DC,
ux0 + delta_cx, uy0 + delta_cy, ux0 + delta_cx, uy0 + delta_cy,
ux0 - delta_cx, uy0 - delta_cy, ux0 - delta_cx, uy0 - delta_cy,
rotdx + mask_margin, color ); rotdx, color );
} }
/* Trace de la marge d'isolement */ /* Trace de la marge d'isolement */
...@@ -297,17 +303,17 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -297,17 +303,17 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
ddx = (m_DeltaSize.x >> 1); ddx = (m_DeltaSize.x >> 1);
ddy = (m_DeltaSize.y >> 1); /* demi dim dx et dy */ ddy = (m_DeltaSize.y >> 1); /* demi dim dx et dy */
coord[0].x = -dx - ddy - mask_margin; coord[0].x = -dx - ddy - mask_margin.x;
coord[0].y = +dy + ddx + mask_margin; coord[0].y = +dy + ddx + mask_margin.y;
coord[1].x = -dx + ddy - mask_margin; coord[1].x = -dx + ddy - mask_margin.x;
coord[1].y = -dy - ddx - mask_margin; coord[1].y = -dy - ddx - mask_margin.y;
coord[2].x = +dx - ddy + mask_margin; coord[2].x = +dx - ddy + mask_margin.x;
coord[2].y = -dy + ddx - mask_margin; coord[2].y = -dy + ddx - mask_margin.y;
coord[3].x = +dx + ddy + mask_margin; coord[3].x = +dx + ddy + mask_margin.x;
coord[3].y = +dy - ddx + mask_margin; coord[3].y = +dy - ddx + mask_margin.y;
for( ii = 0; ii < 4; ii++ ) for( ii = 0; ii < 4; ii++ )
{ {
...@@ -320,8 +326,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -320,8 +326,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( DisplayIsol ) if( DisplayIsol )
{ {
dx += padClearance - mask_margin; dx += padClearance;
dy += padClearance - mask_margin; dy += padClearance;
coord[0].x = -dx - ddy; coord[0].x = -dx - ddy;
coord[0].y = dy + ddx; coord[0].y = dy + ddx;
......
...@@ -98,13 +98,10 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare ...@@ -98,13 +98,10 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_buttonModuleEditor = new wxButton( m_PanelProperties, ID_GOTO_MODULE_EDITOR, _("Module Editor"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonModuleEditor = new wxButton( m_PanelProperties, ID_GOTO_MODULE_EDITOR, _("Module Editor"), wxDefaultPosition, wxDefaultSize, 0 );
m_PropRightSizer->Add( m_buttonModuleEditor, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); m_PropRightSizer->Add( m_buttonModuleEditor, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_PropRightSizer->Add( 0, 20, 0, 0, 5 );
wxString m_AttributsCtrlChoices[] = { _("Normal"), _("Normal+Insert"), _("Virtual") }; wxString m_AttributsCtrlChoices[] = { _("Normal"), _("Normal+Insert"), _("Virtual") };
int m_AttributsCtrlNChoices = sizeof( m_AttributsCtrlChoices ) / sizeof( wxString ); int m_AttributsCtrlNChoices = sizeof( m_AttributsCtrlChoices ) / sizeof( wxString );
m_AttributsCtrl = new wxRadioBox( m_PanelProperties, wxID_ANY, _("Attributs:"), wxDefaultPosition, wxDefaultSize, m_AttributsCtrlNChoices, m_AttributsCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_AttributsCtrl = new wxRadioBox( m_PanelProperties, wxID_ANY, _("Attributs:"), wxDefaultPosition, wxDefaultSize, m_AttributsCtrlNChoices, m_AttributsCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_AttributsCtrl->SetSelection( 0 ); m_AttributsCtrl->SetSelection( 1 );
m_PropRightSizer->Add( m_AttributsCtrl, 0, wxALL|wxEXPAND, 5 ); m_PropRightSizer->Add( m_AttributsCtrl, 0, wxALL|wxEXPAND, 5 );
wxString m_AutoPlaceCtrlChoices[] = { _("Free"), _("Locked") }; wxString m_AutoPlaceCtrlChoices[] = { _("Free"), _("Locked") };
...@@ -114,24 +111,91 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare ...@@ -114,24 +111,91 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_PropRightSizer->Add( m_AutoPlaceCtrl, 0, wxALL|wxEXPAND, 5 ); m_PropRightSizer->Add( m_AutoPlaceCtrl, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerAutoplace; wxStaticBoxSizer* sbSizerAutoplace;
sbSizerAutoplace = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Auto Move and Place") ), wxVERTICAL ); sbSizerAutoplace = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Auto Move and Place") ), wxHORIZONTAL );
wxBoxSizer* bSizerRotOpt;
bSizerRotOpt = new wxBoxSizer( wxVERTICAL );
m_staticText11 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 90 degree"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText11 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 90 degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 ); m_staticText11->Wrap( -1 );
sbSizerAutoplace->Add( m_staticText11, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerRotOpt->Add( m_staticText11, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CostRot90Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS ); m_CostRot90Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
sbSizerAutoplace->Add( m_CostRot90Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerRotOpt->Add( m_CostRot90Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerAutoplace->Add( bSizerRotOpt, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerMoveOpt;
bSizerMoveOpt = new wxBoxSizer( wxVERTICAL );
m_staticText12 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 180 degree"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText12 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 180 degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 ); m_staticText12->Wrap( -1 );
sbSizerAutoplace->Add( m_staticText12, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerMoveOpt->Add( m_staticText12, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CostRot180Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS ); m_CostRot180Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
sbSizerAutoplace->Add( m_CostRot180Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerMoveOpt->Add( m_CostRot180Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerAutoplace->Add( bSizerMoveOpt, 1, wxEXPAND, 5 );
m_PropRightSizer->Add( sbSizerAutoplace, 1, wxEXPAND, 5 ); m_PropRightSizer->Add( sbSizerAutoplace, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerLocalProperties;
sbSizerLocalProperties = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Masks clearances local values:") ), wxVERTICAL );
m_staticTextInfo = new wxStaticText( m_PanelProperties, wxID_ANY, _("Set these values to 0 to use global values"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
m_staticTextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
sbSizerLocalProperties->Add( m_staticTextInfo, 0, wxALL|wxALIGN_RIGHT, 5 );
wxFlexGridSizer* fgSizerClearances;
fgSizerClearances = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerClearances->SetFlexibleDirection( wxBOTH );
fgSizerClearances->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_MaskClearanceTitle = new wxStaticText( m_PanelProperties, wxID_ANY, _("Solder mask clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskClearanceTitle->Wrap( -1 );
fgSizerClearances->Add( m_MaskClearanceTitle, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_SolderMaskMarginCtrl = new wxTextCtrl( m_PanelProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginCtrl->SetToolTip( _("This is the global clearance between pads and the solder mask\nThis value can be superseded by a pad local value.") );
fgSizerClearances->Add( m_SolderMaskMarginCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_SolderMaskMarginUnits = new wxStaticText( m_PanelProperties, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginUnits->Wrap( -1 );
fgSizerClearances->Add( m_SolderMaskMarginUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextSolderPaste = new wxStaticText( m_PanelProperties, wxID_ANY, _("Solder paste clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSolderPaste->Wrap( -1 );
fgSizerClearances->Add( m_staticTextSolderPaste, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_SolderPasteMarginCtrl = new wxTextCtrl( m_PanelProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginCtrl->SetToolTip( _("This is the global clearance between pads and the solder paste\nThis value can be superseded by a pad local values.\nThe final clearance value is the sum of this value and the clearance value ratio\nA negative value means a smaller mask size than pad size") );
fgSizerClearances->Add( m_SolderPasteMarginCtrl, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SolderPasteMarginUnits = new wxStaticText( m_PanelProperties, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginUnits->Wrap( -1 );
fgSizerClearances->Add( m_SolderPasteMarginUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextRatio = new wxStaticText( m_PanelProperties, wxID_ANY, _("Solder mask ratio clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRatio->Wrap( -1 );
fgSizerClearances->Add( m_staticTextRatio, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_SolderPasteMarginRatioCtrl = new wxTextCtrl( m_PanelProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginRatioCtrl->SetToolTip( _("This is the global clearance ratio in per cent between pads and the solder paste\nA value of 10 means the clearance value is 10% of the pad size\nThis value can be superseded by a pad local value.\nThe final clearance value is the sum of this value and the clearance value\nA negative value means a smaller mask size than pad size") );
fgSizerClearances->Add( m_SolderPasteMarginRatioCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_SolderPasteRatioMarginUnits = new wxStaticText( m_PanelProperties, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteRatioMarginUnits->Wrap( -1 );
fgSizerClearances->Add( m_SolderPasteRatioMarginUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbSizerLocalProperties->Add( fgSizerClearances, 1, wxEXPAND, 5 );
m_PropRightSizer->Add( sbSizerLocalProperties, 0, wxEXPAND, 5 );
m_PanelPropertiesBoxSizer->Add( m_PropRightSizer, 0, 0, 5 ); m_PanelPropertiesBoxSizer->Add( m_PropRightSizer, 0, 0, 5 );
m_PanelProperties->SetSizer( m_PanelPropertiesBoxSizer ); m_PanelProperties->SetSizer( m_PanelPropertiesBoxSizer );
......
...@@ -66,13 +66,22 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog ...@@ -66,13 +66,22 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog
wxTextCtrl* m_ModPositionY; wxTextCtrl* m_ModPositionY;
wxButton* m_buttonExchange; wxButton* m_buttonExchange;
wxButton* m_buttonModuleEditor; wxButton* m_buttonModuleEditor;
wxRadioBox* m_AttributsCtrl; wxRadioBox* m_AttributsCtrl;
wxRadioBox* m_AutoPlaceCtrl; wxRadioBox* m_AutoPlaceCtrl;
wxStaticText* m_staticText11; wxStaticText* m_staticText11;
wxSlider* m_CostRot90Ctrl; wxSlider* m_CostRot90Ctrl;
wxStaticText* m_staticText12; wxStaticText* m_staticText12;
wxSlider* m_CostRot180Ctrl; wxSlider* m_CostRot180Ctrl;
wxStaticText* m_staticTextInfo;
wxStaticText* m_MaskClearanceTitle;
wxTextCtrl* m_SolderMaskMarginCtrl;
wxStaticText* m_SolderMaskMarginUnits;
wxStaticText* m_staticTextSolderPaste;
wxTextCtrl* m_SolderPasteMarginCtrl;
wxStaticText* m_SolderPasteMarginUnits;
wxStaticText* m_staticTextRatio;
wxTextCtrl* m_SolderPasteMarginRatioCtrl;
wxStaticText* m_SolderPasteRatioMarginUnits;
wxPanel* m_Panel3D; wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname; wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox; wxListBox* m_3D_ShapeNameListBox;
...@@ -99,7 +108,7 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog ...@@ -99,7 +108,7 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog
public: public:
wxStaticBoxSizer* m_Sizer3DValues; wxStaticBoxSizer* m_Sizer3DValues;
DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Module properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 422,583 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Module properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 474,583 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODULE_BOARD_EDITOR_BASE(); ~DIALOG_MODULE_BOARD_EDITOR_BASE();
}; };
......
...@@ -132,6 +132,21 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties() ...@@ -132,6 +132,21 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
BoxSizer = new wxBoxSizer( wxVERTICAL ); BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ), BoxSizer, 2, 1 ); m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ), BoxSizer, 2, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 ); m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
// Initialize dialog relative to masks clearances
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) );
wxString msg;
int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
m_CurrentModule->m_LocalSolderMaskMargin,
Internal_Unit );
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_CurrentModule->m_LocalSolderPasteMargin,
Internal_Unit );
msg.Printf( wxT( "%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
m_SolderPasteMarginRatioCtrl->SetValue( msg );
} }
...@@ -315,6 +330,19 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -315,6 +330,19 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_Reference->Copy(m_ReferenceCopy ); m_CurrentModule->m_Reference->Copy(m_ReferenceCopy );
m_CurrentModule->m_Value->Copy(m_ValueCopy ); m_CurrentModule->m_Value->Copy(m_ValueCopy );
// Initialize masks clearances
m_CurrentModule->m_LocalSolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
m_CurrentModule->m_LocalSolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
double dtmp;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 )
dtmp = -50;
m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100;
/* Update 3D shape list */ /* Update 3D shape list */
int ii = m_3D_ShapeNameListBox->GetSelection(); int ii = m_3D_ShapeNameListBox->GetSelection();
if ( ii >= 0 ) if ( ii >= 0 )
......
...@@ -82,24 +82,91 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa ...@@ -82,24 +82,91 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
m_PropRightSizer->Add( m_AutoPlaceCtrl, 0, wxALL|wxEXPAND, 5 ); m_PropRightSizer->Add( m_AutoPlaceCtrl, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerAutoplace; wxStaticBoxSizer* sbSizerAutoplace;
sbSizerAutoplace = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Auto Move and Place") ), wxVERTICAL ); sbSizerAutoplace = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Auto Move and Place") ), wxHORIZONTAL );
wxBoxSizer* bSizerRot90;
bSizerRot90 = new wxBoxSizer( wxVERTICAL );
m_staticText11 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 90 degree"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText11 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 90 degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 ); m_staticText11->Wrap( -1 );
sbSizerAutoplace->Add( m_staticText11, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerRot90->Add( m_staticText11, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CostRot90Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS ); m_CostRot90Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
sbSizerAutoplace->Add( m_CostRot90Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerRot90->Add( m_CostRot90Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerAutoplace->Add( bSizerRot90, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRot180;
bSizerRot180 = new wxBoxSizer( wxVERTICAL );
m_staticText12 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 180 degree"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText12 = new wxStaticText( m_PanelProperties, wxID_ANY, _("Rotation 180 degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 ); m_staticText12->Wrap( -1 );
sbSizerAutoplace->Add( m_staticText12, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerRot180->Add( m_staticText12, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CostRot180Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS ); m_CostRot180Ctrl = new wxSlider( m_PanelProperties, wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
sbSizerAutoplace->Add( m_CostRot180Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerRot180->Add( m_CostRot180Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerAutoplace->Add( bSizerRot180, 1, wxEXPAND, 5 );
m_PropRightSizer->Add( sbSizerAutoplace, 1, wxEXPAND, 5 ); m_PropRightSizer->Add( sbSizerAutoplace, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer8;
sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Masks clearances local values:") ), wxVERTICAL );
m_staticTextInfo = new wxStaticText( m_PanelProperties, wxID_ANY, _("Set these values to 0 to use global values"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
m_staticTextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
sbSizer8->Add( m_staticTextInfo, 0, wxALL|wxALIGN_RIGHT, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_MaskClearanceTitle = new wxStaticText( m_PanelProperties, wxID_ANY, _("Solder mask clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskClearanceTitle->Wrap( -1 );
fgSizer1->Add( m_MaskClearanceTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_SolderMaskMarginCtrl = new wxTextCtrl( m_PanelProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginCtrl->SetToolTip( _("This is the global clearance between pads and the solder mask\nThis value can be superseded by a pad local value.") );
fgSizer1->Add( m_SolderMaskMarginCtrl, 0, wxALL, 5 );
m_SolderMaskMarginUnits = new wxStaticText( m_PanelProperties, wxID_ANY, _("inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginUnits->Wrap( -1 );
fgSizer1->Add( m_SolderMaskMarginUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextSolderPaste = new wxStaticText( m_PanelProperties, wxID_ANY, _("Solder paste clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSolderPaste->Wrap( -1 );
fgSizer1->Add( m_staticTextSolderPaste, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_SolderPasteMarginCtrl = new wxTextCtrl( m_PanelProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginCtrl->SetToolTip( _("This is the global clearance between pads and the solder paste\nThis value can be superseded by a pad local values.\nThe final clearance value is the sum of this value and the clearance value ratio\nA negative value means a smaller mask size than pad size") );
fgSizer1->Add( m_SolderPasteMarginCtrl, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SolderPasteMarginUnits = new wxStaticText( m_PanelProperties, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginUnits->Wrap( -1 );
fgSizer1->Add( m_SolderPasteMarginUnits, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextRatio = new wxStaticText( m_PanelProperties, wxID_ANY, _("Solder mask ratio clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRatio->Wrap( -1 );
fgSizer1->Add( m_staticTextRatio, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_SolderPasteMarginRatioCtrl = new wxTextCtrl( m_PanelProperties, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginRatioCtrl->SetToolTip( _("This is the global clearance ratio in per cent between pads and the solder paste\nA value of 10 means the clearance value is 10% of the pad size\nThis value can be superseded by a pad local value.\nThe final clearance value is the sum of this value and the clearance value\nA negative value means a smaller mask size than pad size") );
fgSizer1->Add( m_SolderPasteMarginRatioCtrl, 0, wxALL, 5 );
m_SolderPasteRatioMarginUnits = new wxStaticText( m_PanelProperties, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteRatioMarginUnits->Wrap( -1 );
fgSizer1->Add( m_SolderPasteRatioMarginUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer8->Add( fgSizer1, 1, wxEXPAND, 5 );
m_PropRightSizer->Add( sbSizer8, 1, wxEXPAND, 5 );
m_PanelPropertiesBoxSizer->Add( m_PropRightSizer, 0, 0, 5 ); m_PanelPropertiesBoxSizer->Add( m_PropRightSizer, 0, 0, 5 );
m_PanelProperties->SetSizer( m_PanelPropertiesBoxSizer ); m_PanelProperties->SetSizer( m_PanelPropertiesBoxSizer );
......
...@@ -62,6 +62,16 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public wxDialog ...@@ -62,6 +62,16 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public wxDialog
wxSlider* m_CostRot90Ctrl; wxSlider* m_CostRot90Ctrl;
wxStaticText* m_staticText12; wxStaticText* m_staticText12;
wxSlider* m_CostRot180Ctrl; wxSlider* m_CostRot180Ctrl;
wxStaticText* m_staticTextInfo;
wxStaticText* m_MaskClearanceTitle;
wxTextCtrl* m_SolderMaskMarginCtrl;
wxStaticText* m_SolderMaskMarginUnits;
wxStaticText* m_staticTextSolderPaste;
wxTextCtrl* m_SolderPasteMarginCtrl;
wxStaticText* m_SolderPasteMarginUnits;
wxStaticText* m_staticTextRatio;
wxTextCtrl* m_SolderPasteMarginRatioCtrl;
wxStaticText* m_SolderPasteRatioMarginUnits;
wxPanel* m_Panel3D; wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname; wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox; wxListBox* m_3D_ShapeNameListBox;
...@@ -85,7 +95,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public wxDialog ...@@ -85,7 +95,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public wxDialog
public: public:
wxStaticBoxSizer* m_Sizer3DValues; wxStaticBoxSizer* m_Sizer3DValues;
DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Module properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 422,422 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Module properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 422,549 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODULE_MODULE_EDITOR_BASE(); ~DIALOG_MODULE_MODULE_EDITOR_BASE();
}; };
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_mask_clearance.cpp // Name: dialog_mask_clearance.cpp
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by:
...@@ -34,10 +35,19 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -34,10 +35,19 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
{ {
SetFocus(); SetFocus();
AddUnitSymbol( *m_MaskClearanceTitle ); m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) );
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit ); PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
g_DesignSettings.m_SolderMaskMargin,
Internal_Unit );
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
g_DesignSettings.m_SolderPasteMargin,
Internal_Unit );
wxString msg;
msg.Printf( wxT( "%f" ), g_DesignSettings.m_SolderPasteMarginRatio * 100.0 );
m_SolderPasteMarginRatioCtrl->SetValue( msg );
} }
...@@ -45,8 +55,18 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() ...@@ -45,8 +55,18 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event ) void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/ /*******************************************************************/
{ {
g_DesignSettings.m_MaskMargin = g_DesignSettings.m_SolderMaskMargin =
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
g_DesignSettings.m_SolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
double dtmp;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 )
dtmp = -50;
g_DesignSettings.m_SolderPasteMarginRatio = dtmp / 100;
EndModal( 1 ); EndModal( 1 );
} }
...@@ -60,4 +80,3 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event ) ...@@ -60,4 +80,3 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event )
{ {
EndModal( 0 ); EndModal( 0 );
} }
...@@ -27,14 +27,58 @@ DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* pare ...@@ -27,14 +27,58 @@ DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* pare
wxStaticBoxSizer* sbMiddleRightSizer; wxStaticBoxSizer* sbMiddleRightSizer;
sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL ); sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL );
m_MaskClearanceTitle = new wxStaticText( this, wxID_ANY, _("Pads Mask Clearance:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Note:\n- a positive value means a mask bigger than a pad\n- a negative value means a mask smaller than a pad\n"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
sbMiddleRightSizer->Add( m_staticTextInfo, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sbMiddleRightSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxFlexGridSizer* fgGridSolderMaskSizer;
fgGridSolderMaskSizer = new wxFlexGridSizer( 2, 3, 0, 0 );
fgGridSolderMaskSizer->SetFlexibleDirection( wxBOTH );
fgGridSolderMaskSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_MaskClearanceTitle = new wxStaticText( this, wxID_ANY, _("Solder mask clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskClearanceTitle->Wrap( -1 ); m_MaskClearanceTitle->Wrap( -1 );
sbMiddleRightSizer->Add( m_MaskClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); fgGridSolderMaskSizer->Add( m_MaskClearanceTitle, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_SolderMaskMarginCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginCtrl->SetToolTip( _("This is the global clearance between pads and the solder mask\nThis value can be superseded by local values for a footprint or a pad.") );
fgGridSolderMaskSizer->Add( m_SolderMaskMarginCtrl, 0, wxEXPAND|wxALL, 5 );
m_SolderMaskMarginUnits = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_SolderMaskMarginUnits, 0, wxALL, 5 );
m_staticTextSolderPaste = new wxStaticText( this, wxID_ANY, _("Solder paste clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSolderPaste->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_staticTextSolderPaste, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_SolderPasteMarginCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginCtrl->SetToolTip( _("This is the global clearance between pads and the solder paste\nThis value can be superseded by local values for a footprint or a pad.\nThe final clearance value is the sum of this value and the clearance value ratio") );
fgGridSolderMaskSizer->Add( m_SolderPasteMarginCtrl, 0, wxALL, 5 );
m_SolderPasteMarginUnits = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_SolderPasteMarginUnits, 0, wxALL, 5 );
m_staticTextRatio = new wxStaticText( this, wxID_ANY, _("Solder mask ratio clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRatio->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_staticTextRatio, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_SolderPasteMarginRatioCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginRatioCtrl->SetToolTip( _("This is the global clearance ratio in per cent between pads and the solder paste\nA value of 10 means the clearance value is 10% of the pad size\nThis value can be superseded by local values for a footprint or a pad.\nThe final clearance value is the sum of this value and the clearance value") );
fgGridSolderMaskSizer->Add( m_SolderPasteMarginRatioCtrl, 0, wxALL, 5 );
m_OptMaskMargin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_SolderPasteRatioMarginUnits = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptMaskMargin->SetToolTip( _("This is the clearance between pads and the mask") ); m_SolderPasteRatioMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_SolderPasteRatioMarginUnits, 0, wxALL, 5 );
sbMiddleRightSizer->Add( m_OptMaskMargin, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); sbMiddleRightSizer->Add( fgGridSolderMaskSizer, 1, wxEXPAND, 5 );
bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 ); bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 );
......
This diff is collapsed.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/statline.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
...@@ -38,8 +39,17 @@ class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog ...@@ -38,8 +39,17 @@ class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog
protected: protected:
wxStaticText* m_staticTextInfo;
wxStaticLine* m_staticline1;
wxStaticText* m_MaskClearanceTitle; wxStaticText* m_MaskClearanceTitle;
wxTextCtrl* m_OptMaskMargin; wxTextCtrl* m_SolderMaskMarginCtrl;
wxStaticText* m_SolderMaskMarginUnits;
wxStaticText* m_staticTextSolderPaste;
wxTextCtrl* m_SolderPasteMarginCtrl;
wxStaticText* m_SolderPasteMarginUnits;
wxStaticText* m_staticTextRatio;
wxTextCtrl* m_SolderPasteMarginRatioCtrl;
wxStaticText* m_SolderPasteRatioMarginUnits;
wxStdDialogButtonSizer* m_sdbButtonsSizer; wxStdDialogButtonSizer* m_sdbButtonsSizer;
wxButton* m_sdbButtonsSizerOK; wxButton* m_sdbButtonsSizerOK;
wxButton* m_sdbButtonsSizerCancel; wxButton* m_sdbButtonsSizerCancel;
...@@ -50,7 +60,7 @@ class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog ...@@ -50,7 +60,7 @@ class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog
public: public:
DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pads Mask Clearance"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 256,117 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pads Mask Clearance"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 358,237 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PADS_MASK_CLEARANCE_BASE(); ~DIALOG_PADS_MASK_CLEARANCE_BASE();
}; };
......
...@@ -556,9 +556,20 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -556,9 +556,20 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
} }
if( stricmp( Line, "Pad2MaskClearance" ) == 0 ) if( stricmp( Line, "Pad2MaskClearance" ) == 0 )
{ {
g_DesignSettings.m_MaskMargin = atoi( data ); g_DesignSettings.m_SolderMaskMargin = atoi( data );
continue; continue;
} }
if( stricmp( Line, "Pad2PasteClearance" ) == 0 )
{
g_DesignSettings.m_SolderPasteMargin = atoi( data );
continue;
}
if( stricmp( Line, "Pad2PasteClearanceRatio" ) == 0 )
{
g_DesignSettings.m_SolderPasteMarginRatio = atof( data );
continue;
}
#endif #endif
} }
...@@ -658,7 +669,11 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) ...@@ -658,7 +669,11 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "TextModWidth %d\n", ModuleTextWidth ); fprintf( aFile, "TextModWidth %d\n", ModuleTextWidth );
fprintf( aFile, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y ); fprintf( aFile, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x ); fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
fprintf( aFile, "Pad2MaskClearance %d\n", g_DesignSettings.m_MaskMargin ); fprintf( aFile, "Pad2MaskClearance %d\n", g_DesignSettings.m_SolderMaskMargin );
if( g_DesignSettings.m_SolderPasteMargin != 0)
fprintf( aFile, "Pad2PasteClearance %d\n", g_DesignSettings.m_SolderPasteMargin );
if( g_DesignSettings.m_SolderPasteMarginRatio != 0 )
fprintf( aFile, "Pad2PasteClearanceRatio %g\n", g_DesignSettings.m_SolderPasteMarginRatio );
fprintf( aFile, "AuxiliaryAxisOrg %d %d\n", fprintf( aFile, "AuxiliaryAxisOrg %d %d\n",
aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y ); aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y );
......
...@@ -88,6 +88,9 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) ...@@ -88,6 +88,9 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
Config->Write( EXPORT_IMPORT_LASTPATH_KEY, LastOpenedPathForLoading ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, LastOpenedPathForLoading );
} }
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard( );
/* Read header and test file type */ /* Read header and test file type */
GetLine( file, Line, &NbLine ); GetLine( file, Line, &NbLine );
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
...@@ -124,6 +127,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) ...@@ -124,6 +127,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
module->ReadDescr( file, &NbLine ); module->ReadDescr( file, &NbLine );
fclose( file ); fclose( file );
} }
SetLocaleTo_Default( ); // revert to the current locale
/* Insert footprint in list*/ /* Insert footprint in list*/
GetBoard()->Add( module ); GetBoard()->Add( module );
...@@ -197,6 +201,9 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) ...@@ -197,6 +201,9 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
Config->Write( EXPORT_IMPORT_LASTPATH_KEY, fn.GetPath() ); Config->Write( EXPORT_IMPORT_LASTPATH_KEY, fn.GetPath() );
} }
// Switch the locale to standard C (needed to read floating point numbers like 1.3)
SetLocaleTo_C_standard();
fprintf( file, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) ); fprintf( file, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( Line ) );
fputs( "$INDEX\n", file ); fputs( "$INDEX\n", file );
...@@ -207,6 +214,8 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) ...@@ -207,6 +214,8 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
fputs( "$EndLIBRARY\n", file ); fputs( "$EndLIBRARY\n", file );
fclose( file ); fclose( file );
SetLocaleTo_Default( ); // revert to the current locale
msg.Printf( _( "Module exported in file <%s>" ), GetChars( fn.GetFullPath() ) ); msg.Printf( _( "Module exported in file <%s>" ), GetChars( fn.GetFullPath() ) );
DisplayInfoMessage( this, msg ); DisplayInfoMessage( this, msg );
} }
...@@ -605,6 +614,9 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName, ...@@ -605,6 +614,9 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
wxBeginBusyCursor(); wxBeginBusyCursor();
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard( );
/* Create the library header with a new date */ /* Create the library header with a new date */
fprintf( dest, ENTETE_LIBRAIRIE ); fprintf( dest, ENTETE_LIBRAIRIE );
fprintf( dest, " %s\n$INDEX\n", DateAndTime( Line ) ); fprintf( dest, " %s\n$INDEX\n", DateAndTime( Line ) );
...@@ -665,6 +677,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName, ...@@ -665,6 +677,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
aModule->m_TimeStamp = tmp; aModule->m_TimeStamp = tmp;
fclose( dest ); fclose( lib_module ); fclose( dest ); fclose( lib_module );
SetLocaleTo_Default( ); // revert to the current locale
wxEndBusyCursor(); wxEndBusyCursor();
......
...@@ -624,9 +624,9 @@ static PARAM_CFG_INT HPGLrecouvrementCfg ...@@ -624,9 +624,9 @@ static PARAM_CFG_INT HPGLrecouvrementCfg
static PARAM_CFG_INT VernisEpargneGardeCfg static PARAM_CFG_INT VernisEpargneGardeCfg
( (
wxT( "VEgarde" ), /* Keyword */ wxT( "VEgarde" ), /* Keyword */
&g_DesignSettings.m_MaskMargin, /* Parameter address */ &g_DesignSettings.m_SolderMaskMargin, /* Parameter address */
100, /* Default value */ 100, /* Default value */
0, 0xFFFF /* Min and max values*/ 0, 10000 /* Min and max values*/
); );
static PARAM_CFG_INT DrawSegmLargeurCfg static PARAM_CFG_INT DrawSegmLargeurCfg
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment