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
......
...@@ -9,22 +9,26 @@ ...@@ -9,22 +9,26 @@
class EDA_BoardDesignSettings class EDA_BoardDesignSettings
{ {
protected: protected:
int m_CopperLayerCount; // Number of copper layers for this design int m_CopperLayerCount; // Number of copper layers for this design
public: public:
bool m_MicroViasAllowed; // true to allow micro vias bool m_MicroViasAllowed; // true to allow micro vias
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA) int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
int m_PcbTextWidth; // current Pcb (not module) Text width int m_PcbTextWidth; // current Pcb (not module) Text width
wxSize m_PcbTextSize; // current Pcb (not module) Text size wxSize m_PcbTextSize; // current Pcb (not module) Text size
int m_TrackMinWidth; // track min value for width ((min copper size value int m_TrackMinWidth; // track min value for width ((min copper size value
int m_ViasMinSize; // vias (not micro vias) min diameter int m_ViasMinSize; // vias (not micro vias) min diameter
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_LayerThickness; // Layer Thickness for 3D viewer 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
protected: protected:
int m_EnabledLayers; // Bit-mask for layer enabling int m_EnabledLayers; // Bit-mask for layer enabling
...@@ -32,14 +36,15 @@ protected: ...@@ -32,14 +36,15 @@ 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)
int m_ViaColor[4]; // Via color (depending on is type) int m_ViaColor[4]; // Via color (depending on is type)
// Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors) // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
int m_RatsnestColor; // Ratsnest color int m_RatsnestColor; // Ratsnest color
public: public:
...@@ -50,7 +55,7 @@ public: ...@@ -50,7 +55,7 @@ public:
* returns a bit-mask of all the layers that are visible * returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form. * @return int - the visible layers in bit-mapped form.
*/ */
int GetVisibleLayers() const; int GetVisibleLayers() const;
/** /**
* Function SetVisibleLayers * Function SetVisibleLayers
...@@ -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 );
......
...@@ -109,7 +109,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, ...@@ -109,7 +109,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
RecreateBaseHToolbar(); RecreateBaseHToolbar();
m_auimgr.SetManagedWindow(this); m_auimgr.SetManagedWindow(this);
wxAuiPaneInfo horiz; wxAuiPaneInfo horiz;
horiz.Gripper(false); horiz.Gripper(false);
horiz.DockFixed(true); horiz.DockFixed(true);
...@@ -117,15 +117,15 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, ...@@ -117,15 +117,15 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
horiz.Floatable(false); horiz.Floatable(false);
horiz.CloseButton(false); horiz.CloseButton(false);
horiz.CaptionVisible(false); horiz.CaptionVisible(false);
wxAuiPaneInfo vert(horiz); wxAuiPaneInfo vert(horiz);
vert.TopDockable(false).BottomDockable(false); vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false); horiz.LeftDockable(false).RightDockable(false);
m_auimgr.AddPane(m_HToolBar, m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top()); wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top());
m_auimgr.AddPane(m_DialogWin, m_auimgr.AddPane(m_DialogWin,
wxAuiPaneInfo(horiz).Name(wxT("m_DialogWin")).Center()); wxAuiPaneInfo(horiz).Name(wxT("m_DialogWin")).Center());
...@@ -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 );
......
...@@ -35,35 +35,40 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -35,35 +35,40 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
LIGHTGRAY LIGHTGRAY
}; };
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust thist. // SetCopperLayerCount() will adjust thist.
m_VisibleLayers = 0xffffffff; // IMB: All layers visible at first. TODO: Use a macro for the initial value. m_VisibleLayers = 0xffffffff; // IMB: All layers visible at first. TODO: Use a macro for the initial value.
m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value. m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value.
SetCopperLayerCount( 2 ); // Default design is a double sided board SetCopperLayerCount( 2 ); // Default design is a double sided board
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA) m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_MicroViasAllowed = false; // true to allow micro vias m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer)
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
m_PcbTextWidth = 100; // current Pcb (not module) Text width m_PcbTextWidth = 100; // current Pcb (not module) Text width
m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size
m_TrackMinWidth = 80; // track min value for width ((min copper size value m_TrackMinWidth = 80; // track min value for width ((min copper size value
m_ViasMinSize = 350; // vias (not micro vias) min diameter m_ViasMinSize = 350; // vias (not micro vias) min diameter
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++ )
m_LayerColor[ii] = default_layer_color[ii]; m_LayerColor[ii] = default_layer_color[ii];
// Layer colors (tracks and graphic items) // Layer colors (tracks and graphic items)
m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY; m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY;
m_ViaColor[VIA_MICROVIA] = CYAN; m_ViaColor[VIA_MICROVIA] = CYAN;
m_ViaColor[VIA_BLIND_BURIED] = BROWN; m_ViaColor[VIA_BLIND_BURIED] = BROWN;
m_ViaColor[VIA_THROUGH] = WHITE; m_ViaColor[VIA_THROUGH] = WHITE;
m_RatsnestColor = WHITE; // Ratsnest color m_RatsnestColor = WHITE; // Ratsnest color
} }
...@@ -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;
} }
...@@ -36,8 +36,12 @@ MODULE::MODULE( BOARD* parent ) : ...@@ -36,8 +36,12 @@ MODULE::MODULE( BOARD* parent ) :
flag = 0; flag = 0;
m_CntRot90 = m_CntRot180 = 0; m_CntRot90 = m_CntRot180 = 0;
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,19 +72,20 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -68,19 +72,20 @@ 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,
m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y, m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y,
0, g_AnchorColor ); 0, g_AnchorColor );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size, m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size,
m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size, m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size,
0, g_AnchorColor ); 0, g_AnchorColor );
} }
} }
/*********************************/ /*********************************/
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 );
...@@ -138,16 +146,17 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -138,16 +146,17 @@ 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
{ {
...@@ -271,9 +280,9 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -271,9 +280,9 @@ bool MODULE::Save( FILE* aFile ) const
statusTxt[1] = '~'; statusTxt[1] = '~';
fprintf( aFile, "Po %d %d %d %d %8.8lX %8.8lX %s\n", fprintf( aFile, "Po %d %d %d %d %8.8lX %8.8lX %s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Orient, m_Layer, m_LastEdit_Time, m_Orient, m_Layer, m_LastEdit_Time,
m_TimeStamp, statusTxt ); m_TimeStamp, statusTxt );
fprintf( aFile, "Li %s\n", CONV_TO_UTF8( m_LibRef ) ); fprintf( aFile, "Li %s\n", CONV_TO_UTF8( m_LibRef ) );
...@@ -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;
...@@ -352,7 +367,7 @@ int MODULE::Write_3D_Descr( FILE* File ) const ...@@ -352,7 +367,7 @@ int MODULE::Write_3D_Descr( FILE* File ) const
/* Sauvegarde de la description 3D du MODULE /* Sauvegarde de la description 3D du MODULE
*/ */
{ {
char buf[512]; char buf[512];
for( S3D_MASTER* t3D = m_3D_Drawings; t3D; t3D = t3D->Next() ) for( S3D_MASTER* t3D = m_3D_Drawings; t3D; t3D = t3D->Next() )
{ {
...@@ -363,21 +378,21 @@ int MODULE::Write_3D_Descr( FILE* File ) const ...@@ -363,21 +378,21 @@ int MODULE::Write_3D_Descr( FILE* File ) const
fprintf( File, "Na \"%s\"\n", CONV_TO_UTF8( t3D->m_Shape3DName ) ); fprintf( File, "Na \"%s\"\n", CONV_TO_UTF8( t3D->m_Shape3DName ) );
sprintf( buf, "Sc %lf %lf %lf\n", sprintf( buf, "Sc %lf %lf %lf\n",
t3D->m_MatScale.x, t3D->m_MatScale.x,
t3D->m_MatScale.y, t3D->m_MatScale.y,
t3D->m_MatScale.z ); t3D->m_MatScale.z );
fprintf( File, "%s", to_point( buf ) ); fprintf( File, "%s", to_point( buf ) );
sprintf( buf, "Of %lf %lf %lf\n", sprintf( buf, "Of %lf %lf %lf\n",
t3D->m_MatPosition.x, t3D->m_MatPosition.x,
t3D->m_MatPosition.y, t3D->m_MatPosition.y,
t3D->m_MatPosition.z ); t3D->m_MatPosition.z );
fprintf( File, "%s", to_point( buf ) ); fprintf( File, "%s", to_point( buf ) );
sprintf( buf, "Ro %lf %lf %lf\n", sprintf( buf, "Ro %lf %lf %lf\n",
t3D->m_MatRotation.x, t3D->m_MatRotation.x,
t3D->m_MatRotation.y, t3D->m_MatRotation.y,
t3D->m_MatRotation.z ); t3D->m_MatRotation.z );
fprintf( File, "%s", to_point( buf ) ); fprintf( File, "%s", to_point( buf ) );
fprintf( File, "$EndSHAPE3D\n" ); fprintf( File, "$EndSHAPE3D\n" );
...@@ -397,8 +412,8 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum ) ...@@ -397,8 +412,8 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum )
* retourne 0 si OK * retourne 0 si OK
*/ */
{ {
char Line[1024]; char Line[1024];
char* text = Line + 3; char* text = Line + 3;
S3D_MASTER* t3D = m_3D_Drawings; S3D_MASTER* t3D = m_3D_Drawings;
...@@ -430,23 +445,23 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum ) ...@@ -430,23 +445,23 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum )
case 'S': // Scale case 'S': // Scale
sscanf( text, "%lf %lf %lf\n", sscanf( text, "%lf %lf %lf\n",
&t3D->m_MatScale.x, &t3D->m_MatScale.x,
&t3D->m_MatScale.y, &t3D->m_MatScale.y,
&t3D->m_MatScale.z ); &t3D->m_MatScale.z );
break; break;
case 'O': // Offset case 'O': // Offset
sscanf( text, "%lf %lf %lf\n", sscanf( text, "%lf %lf %lf\n",
&t3D->m_MatPosition.x, &t3D->m_MatPosition.x,
&t3D->m_MatPosition.y, &t3D->m_MatPosition.y,
&t3D->m_MatPosition.z ); &t3D->m_MatPosition.z );
break; break;
case 'R': // Rotation case 'R': // Rotation
sscanf( text, "%lf %lf %lf\n", sscanf( text, "%lf %lf %lf\n",
&t3D->m_MatRotation.x, &t3D->m_MatRotation.x,
&t3D->m_MatRotation.y, &t3D->m_MatRotation.y,
&t3D->m_MatRotation.z ); &t3D->m_MatRotation.z );
break; break;
default: default:
...@@ -462,13 +477,13 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum ) ...@@ -462,13 +477,13 @@ 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;
int itmp1, itmp2; int itmp1, itmp2;
while( GetLine( File, Line, LineNum, sizeof(Line) - 1 ) != NULL ) while( GetLine( File, Line, LineNum, sizeof(Line) - 1 ) != NULL )
{ {
...@@ -496,15 +511,16 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) ...@@ -496,15 +511,16 @@ 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':
memset( BufCar1, 0, sizeof(BufCar1) ); memset( BufCar1, 0, sizeof(BufCar1) );
sscanf( PtLine, "%d %d %d %d %lX %lX %s", sscanf( PtLine, "%d %d %d %d %lX %lX %s",
&m_Pos.x, &m_Pos.y, &m_Pos.x, &m_Pos.y,
&m_Orient, &m_Layer, &m_Orient, &m_Layer,
&m_LastEdit_Time, &m_TimeStamp, BufCar1 ); &m_LastEdit_Time, &m_TimeStamp, BufCar1 );
m_ModuleStatus = 0; m_ModuleStatus = 0;
if( BufCar1[0] == 'F' ) if( BufCar1[0] == 'F' )
...@@ -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;
...@@ -613,9 +637,9 @@ void MODULE::Set_Rectangle_Encadrement() ...@@ -613,9 +637,9 @@ void MODULE::Set_Rectangle_Encadrement()
* en coord relatives / position ancre * en coord relatives / position ancre
*/ */
{ {
int width; int width;
int cx, cy, uxf, uyf, rayon; int cx, cy, uxf, uyf, rayon;
int xmax, ymax; int xmax, ymax;
/* Init des pointeurs */ /* Init des pointeurs */
...@@ -689,9 +713,9 @@ void MODULE::SetRectangleExinscrit() ...@@ -689,9 +713,9 @@ void MODULE::SetRectangleExinscrit()
* Met egalement a jour la surface (.m_Surface) du module. * Met egalement a jour la surface (.m_Surface) du module.
*/ */
{ {
int width; int width;
int cx, cy, uxf, uyf, rayon; int cx, cy, uxf, uyf, rayon;
int xmax, ymax; int xmax, ymax;
m_RealBoundaryBox.m_Pos.x = xmax = m_Pos.x; m_RealBoundaryBox.m_Pos.x = xmax = m_Pos.x;
m_RealBoundaryBox.m_Pos.y = ymax = m_Pos.y; m_RealBoundaryBox.m_Pos.y = ymax = m_Pos.y;
...@@ -763,10 +787,10 @@ EDA_Rect MODULE::GetBoundingBox() ...@@ -763,10 +787,10 @@ EDA_Rect MODULE::GetBoundingBox()
{ {
// Calculate area without text fields: // Calculate area without text fields:
SetRectangleExinscrit(); SetRectangleExinscrit();
EDA_Rect area = m_RealBoundaryBox; EDA_Rect area = m_RealBoundaryBox;
// Calculate extended area including text field: // Calculate extended area including text field:
EDA_Rect text_area; EDA_Rect text_area;
text_area = m_Reference->GetBoundingBox(); text_area = m_Reference->GetBoundingBox();
area.Merge( text_area ); area.Merge( text_area );
...@@ -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];
...@@ -841,7 +866,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -841,7 +866,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
msg.Printf( wxT( "%d" ), nbpad ); msg.Printf( wxT( "%d" ), nbpad );
frame->AppendMsgPanel( _( "Pads" ), msg, BLUE ); frame->AppendMsgPanel( _( "Pads" ), msg, BLUE );
msg = wxT( ".." ); msg = wxT( ".." );
if( IsLocked() ) if( IsLocked() )
msg[0] = 'L'; msg[0] = 'L';
if( m_ModuleStatus & MODULE_is_PLACED ) if( m_ModuleStatus & MODULE_is_PLACED )
...@@ -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
...@@ -970,7 +996,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -970,7 +996,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
if( result == SEARCH_QUIT ) if( result == SEARCH_QUIT )
break; break;
// m_Drawings can hold TYPETEXTMODULE also, so fall thru // m_Drawings can hold TYPETEXTMODULE also, so fall thru
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
result = IterateForward( m_Drawings, inspector, testData, p ); result = IterateForward( m_Drawings, inspector, testData, p );
...@@ -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
......
...@@ -31,22 +31,22 @@ enum Mod_Attribut /* Attributs used for modules */ ...@@ -31,22 +31,22 @@ enum Mod_Attribut /* Attributs used for modules */
/* flags for autoplace and autoroute (.m_ModuleStatus member) */ /* flags for autoplace and autoroute (.m_ModuleStatus member) */
#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */ #define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */ #define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */ #define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
class MODULE : public BOARD_ITEM class MODULE : public BOARD_ITEM
{ {
public: public:
wxPoint m_Pos; // Real coord on board wxPoint m_Pos; // Real coord on board
DLIST<D_PAD> m_Pads; /* Pad list (linked list) */ DLIST<D_PAD> m_Pads; /* Pad list (linked list) */
DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */ DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */
DLIST<S3D_MASTER> m_3D_Drawings; /* First item of the 3D shapes (linked list)*/ DLIST<S3D_MASTER> m_3D_Drawings; /* First item of the 3D shapes (linked list)*/
TEXTE_MODULE* m_Reference; // Component reference (U34, R18..) TEXTE_MODULE* m_Reference; // Component reference (U34, R18..)
TEXTE_MODULE* m_Value; // Component value (74LS00, 22K..) TEXTE_MODULE* m_Value; // Component value (74LS00, 22K..)
wxString m_LibRef; /* Name of the module in library (and the default value when loading amodule from the library) */ wxString m_LibRef; /* Name of the module in library (and the default value when loading amodule from the library) */
wxString m_AlternateReference; /* Used when m_Reference cannot be used to wxString m_AlternateReference; /* Used when m_Reference cannot be used to
* identify the footprint ( after a full reannotation of the schematic */ * identify the footprint ( after a full reannotation of the schematic */
int m_Attributs; /* Flags(ORed bits) ( see Mod_Attribut ) */ int m_Attributs; /* Flags(ORed bits) ( see Mod_Attribut ) */
int m_Orient; /* orientation in 0.1 degrees */ int m_Orient; /* orientation in 0.1 degrees */
...@@ -69,15 +69,24 @@ public: ...@@ -69,15 +69,24 @@ 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 );
~MODULE(); ~MODULE();
MODULE* Next() const { return (MODULE*) Pnext; } MODULE* Next() const { return (MODULE*) Pnext; }
MODULE* Back() const { return (MODULE*) Pback; } MODULE* Back() const { return (MODULE*) Pback; }
void Copy( MODULE* Module ); // Copy structure void Copy( MODULE* Module ); // Copy structure
/** /**
...@@ -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 );
*/ */
...@@ -93,13 +102,13 @@ public: ...@@ -93,13 +102,13 @@ public:
* Function Set_Rectangle_Encadrement() * Function Set_Rectangle_Encadrement()
* calculates the bounding box for orient 0 et origin = module anchor) * calculates the bounding box for orient 0 et origin = module anchor)
*/ */
void Set_Rectangle_Encadrement(); void Set_Rectangle_Encadrement();
/** function SetRectangleExinscrit() /** function SetRectangleExinscrit()
* Calculates the real bounding box accordint to theboard position, and real orientaion * Calculates the real bounding box accordint to theboard position, and real orientaion
* and also calculates the area value (used in automatic placement) * and also calculates the area value (used in automatic placement)
*/ */
void SetRectangleExinscrit(); void SetRectangleExinscrit();
/** /**
* Function GetBoundingBox * Function GetBoundingBox
...@@ -121,14 +130,15 @@ public: ...@@ -121,14 +130,15 @@ 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
...@@ -178,10 +188,10 @@ public: ...@@ -178,10 +188,10 @@ public:
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
int Write_3D_Descr( FILE* File ) const; int Write_3D_Descr( FILE* File ) const;
int ReadDescr( FILE* File, int* LineNum = NULL ); int ReadDescr( FILE* File, int* LineNum = NULL );
/** /**
* Function Read_GPCB_Descr * Function Read_GPCB_Descr
...@@ -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,13 +212,16 @@ public: ...@@ -201,13 +212,16 @@ 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,
const wxPoint& offset, int draw_mode ); const wxPoint& offset, int draw_mode );
void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int dim_ancre, int draw_mode ); const wxPoint& offset, int dim_ancre, int draw_mode );
/** /**
* Function DisplayInfo * Function DisplayInfo
...@@ -215,7 +229,7 @@ public: ...@@ -215,7 +229,7 @@ public:
* about this object into the frame's message panel. * about this object into the frame's message panel.
* @param frame A WinEDA_DrawFrame in which to print status information. * @param frame A WinEDA_DrawFrame in which to print status information.
*/ */
void DisplayInfo( WinEDA_DrawFrame* frame ); void DisplayInfo( WinEDA_DrawFrame* frame );
/** /**
...@@ -224,7 +238,7 @@ public: ...@@ -224,7 +238,7 @@ public:
* @param refPos A wxPoint to test * @param refPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool HitTest( const wxPoint& refPos ); bool HitTest( const wxPoint& refPos );
/** /**
...@@ -233,7 +247,7 @@ public: ...@@ -233,7 +247,7 @@ public:
* @param refArea : the given EDA_Rect * @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool HitTest( EDA_Rect& refArea ); bool HitTest( EDA_Rect& refArea );
/** /**
* Function GetReference * Function GetReference
...@@ -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.
...@@ -261,7 +276,7 @@ public: ...@@ -261,7 +276,7 @@ public:
* @param * @param
* @return D_PAD* - The first matching name is returned, or NULL if not found. * @return D_PAD* - The first matching name is returned, or NULL if not found.
*/ */
D_PAD* FindPadByName( const wxString& aPadName ) const; D_PAD* FindPadByName( const wxString& aPadName ) const;
/** /**
...@@ -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"
/*******************************/ /*******************************/
...@@ -18,22 +19,26 @@ ...@@ -18,22 +19,26 @@
D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD ) D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )
{ {
m_NumPadName = 0; m_NumPadName = 0;
m_Size.x = m_Size.y = 500; // give it a reasonnable size m_Size.x = m_Size.y = 500; // give it a reasonnable size
m_Orient = 0; // Pad rotation in 1/10 degrees m_Orient = 0; // Pad rotation in 1/10 degrees
if( m_Parent && (m_Parent->Type() == TYPE_MODULE) ) if( m_Parent && (m_Parent->Type() == TYPE_MODULE) )
{ {
m_Pos = ( (MODULE*) m_Parent )->GetPosition(); m_Pos = ( (MODULE*) m_Parent )->GetPosition();
} }
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
ComputeRayon(); ComputeRayon();
} }
...@@ -63,7 +68,7 @@ void D_PAD::ComputeRayon() ...@@ -63,7 +68,7 @@ void D_PAD::ComputeRayon()
case PAD_RECT: case PAD_RECT:
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
m_Rayon = (int) ( sqrt( (double) m_Size.y * m_Size.y m_Rayon = (int) ( sqrt( (double) m_Size.y * m_Size.y
+ (double) m_Size.x * m_Size.x ) / 2 ); + (double) m_Size.x * m_Size.x ) / 2 );
break; break;
} }
} }
...@@ -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
...@@ -191,11 +198,14 @@ void D_PAD::Copy( D_PAD* source ) ...@@ -191,11 +198,14 @@ void D_PAD::Copy( D_PAD* source )
m_Offset = source->m_Offset; // Offset de la forme m_Offset = source->m_Offset; // Offset de la forme
m_Size = source->m_Size; // Dimension ( pour orient 0 ) m_Size = source->m_Size; // Dimension ( pour orient 0 )
m_DeltaSize = source->m_DeltaSize; // delta sur formes rectangle -> trapezes m_DeltaSize = source->m_DeltaSize; // delta sur formes rectangle -> trapezes
m_Pos0 = source->m_Pos0; /* Coord relatives a l'ancre du pad en orientation 0 */ m_Pos0 = source->m_Pos0; /* Coord relatives a l'ancre du pad en orientation 0 */
m_Rayon = source->m_Rayon; // rayon du cercle exinscrit du pad m_Rayon = source->m_Rayon; // rayon du cercle exinscrit du pad
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++;
...@@ -260,13 +340,13 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -260,13 +340,13 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
PtLine++; PtLine++;
nn = sscanf( PtLine, " %s %d %d %d %d %d", nn = sscanf( PtLine, " %s %d %d %d %d %d",
BufCar, &m_Size.x, &m_Size.y, BufCar, &m_Size.x, &m_Size.y,
&m_DeltaSize.x, &m_DeltaSize.y, &m_DeltaSize.x, &m_DeltaSize.y,
&m_Orient ); &m_Orient );
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 )
...@@ -290,7 +370,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -290,7 +370,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
case 'D': case 'D':
BufCar[0] = 0; BufCar[0] = 0;
nn = sscanf( PtLine, "%d %d %d %s %d %d", &m_Drill.x, nn = sscanf( PtLine, "%d %d %d %s %d %d", &m_Drill.x,
&m_Offset.x, &m_Offset.y, BufCar, &dx, &dy ); &m_Offset.x, &m_Offset.y, BufCar, &dx, &dy );
m_Drill.y = m_Drill.x; m_Drill.y = m_Drill.x;
m_DrillShape = PAD_CIRCLE; m_DrillShape = PAD_CIRCLE;
...@@ -306,11 +386,10 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) ...@@ -306,11 +386,10 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
case 'A': case 'A':
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 )
{ {
...@@ -382,8 +465,8 @@ bool D_PAD::Save( FILE* aFile ) const ...@@ -382,8 +465,8 @@ bool D_PAD::Save( FILE* aFile ) const
} }
fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n", fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n",
m_Padname, cshape, m_Size.x, m_Size.y, m_Padname, cshape, m_Size.x, m_Size.y,
m_DeltaSize.x, m_DeltaSize.y, m_Orient ); m_DeltaSize.x, m_DeltaSize.y, m_Orient );
fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y ); fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y );
if( m_DrillShape == PAD_OVAL ) if( m_DrillShape == PAD_OVAL )
...@@ -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;
} }
...@@ -551,7 +638,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -551,7 +638,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
if( attribut > 3 ) if( attribut > 3 )
attribut = 3; attribut = 3;
frame->AppendMsgPanel( Msg_Pad_Shape[m_PadShape], frame->AppendMsgPanel( Msg_Pad_Shape[m_PadShape],
Msg_Pad_Attribut[attribut], DARKGREEN ); Msg_Pad_Attribut[attribut], DARKGREEN );
valeur_param( m_Size.x, Line ); valeur_param( m_Size.x, Line );
frame->AppendMsgPanel( _( "H Size" ), Line, RED ); frame->AppendMsgPanel( _( "H Size" ), Line, RED );
...@@ -577,7 +664,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -577,7 +664,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
int module_orient = module ? module->m_Orient : 0; int module_orient = module ? module->m_Orient : 0;
if( module_orient ) if( module_orient )
Line.Printf( wxT( "%3.1f(+%3.1f)" ), Line.Printf( wxT( "%3.1f(+%3.1f)" ),
(float) ( m_Orient - module_orient ) / 10, (float) module_orient / 10 ); (float) ( m_Orient - module_orient ) / 10, (float) module_orient / 10 );
else else
Line.Printf( wxT( "%3.1f" ), (float) m_Orient / 10 ); Line.Printf( wxT( "%3.1f" ), (float) m_Orient / 10 );
frame->AppendMsgPanel( _( "Orient" ), Line, BLUE ); frame->AppendMsgPanel( _( "Orient" ), Line, BLUE );
...@@ -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,8 +77,19 @@ public: ...@@ -74,8 +77,19 @@ 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
public: public:
...@@ -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)
/** /**
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/*******************************************************************************************/ /*******************************************************************************************/
void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
const wxPoint& offset ) const wxPoint& offset )
/*******************************************************************************************/ /*******************************************************************************************/
/** Draw a pad: /** Draw a pad:
...@@ -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;
......
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
/**************************************************************************************/ /**************************************************************************************/
DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( WinEDA_PcbFrame* aParent, DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( WinEDA_PcbFrame* aParent,
MODULE* aModule, wxDC* aDC ) : MODULE* aModule, wxDC* aDC ) :
DIALOG_MODULE_BOARD_EDITOR_BASE( aParent ) DIALOG_MODULE_BOARD_EDITOR_BASE( aParent )
/**************************************************************************************/ /**************************************************************************************/
{ {
m_Parent = aParent; m_Parent = aParent;
m_DC = aDC; m_DC = aDC;
m_CurrentModule = aModule; m_CurrentModule = aModule;
SetIcon( wxICON( icon_modedit ) ); // Give an icon SetIcon( wxICON( icon_modedit ) ); // Give an icon
...@@ -37,6 +37,7 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( WinEDA_PcbFrame* aParent ...@@ -37,6 +37,7 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( WinEDA_PcbFrame* aParent
Centre(); Centre();
} }
DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR()
{ {
for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ ) for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ )
...@@ -53,57 +54,71 @@ DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() ...@@ -53,57 +54,71 @@ DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR()
/***************************************************************************/ /***************************************************************************/
void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties( ) void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
/***************************************************************************/ /***************************************************************************/
/* creation du panel d'edition des proprietes du module /* creation du panel d'edition des proprietes du module
*/ */
{ {
PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x, PCB_INTERNAL_UNIT ); PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x, PCB_INTERNAL_UNIT );
AddUnitSymbol( *XPositionStatic, g_UnitMetric ); AddUnitSymbol( *XPositionStatic, g_UnitMetric );
PutValueInLocalUnits( *m_ModPositionY, m_CurrentModule->GetPosition().y, PCB_INTERNAL_UNIT ); PutValueInLocalUnits( *m_ModPositionY, m_CurrentModule->GetPosition().y, PCB_INTERNAL_UNIT );
AddUnitSymbol( *YPositionStatic, g_UnitMetric ); AddUnitSymbol( *YPositionStatic, g_UnitMetric );
m_LayerCtrl->SetSelection( (m_CurrentModule->GetLayer() == COPPER_LAYER_N) ? 1 : 0 ); m_LayerCtrl->SetSelection( (m_CurrentModule->GetLayer() == COPPER_LAYER_N) ? 1 : 0 );
bool select = FALSE; bool select = FALSE;
switch( m_CurrentModule->m_Orient ) switch( m_CurrentModule->m_Orient )
{ {
case 0: case 0:
m_OrientCtrl->SetSelection( 0 ); m_OrientCtrl->SetSelection( 0 );
break; break;
case 900: case 900:
case -2700: case - 2700:
m_OrientCtrl->SetSelection( 1 ); m_OrientCtrl->SetSelection( 1 );
break; break;
case -900: case - 900:
case 2700: case 2700:
m_OrientCtrl->SetSelection( 2 ); m_OrientCtrl->SetSelection( 2 );
break; break;
case -1800: case - 1800:
case 1800: case 1800:
m_OrientCtrl->SetSelection( 3 ); m_OrientCtrl->SetSelection( 3 );
break; break;
default: default:
m_OrientCtrl->SetSelection( 4 ); m_OrientCtrl->SetSelection( 4 );
select = TRUE; select = TRUE;
break; break;
} }
wxString msg;
msg << m_CurrentModule->m_Orient;
m_OrientValue->SetValue( msg );
m_OrientValue->Enable( select );
}
wxString msg;
msg << m_CurrentModule->m_Orient;
m_OrientValue->SetValue( msg );
m_OrientValue->Enable( select );
// Initialize dilaog relative to masks clearances
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) );
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 );
}
/**********************************************************************/ /**********************************************************************/
void DIALOG_MODULE_BOARD_EDITOR::OnCancelClick( wxCommandEvent& WXUNUSED (event) ) void DIALOG_MODULE_BOARD_EDITOR::OnCancelClick( wxCommandEvent& WXUNUSED( event ) )
/**********************************************************************/ /**********************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
...@@ -185,18 +200,18 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -185,18 +200,18 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
{ {
if( !draw3D->m_Shape3DName.IsEmpty() ) if( !draw3D->m_Shape3DName.IsEmpty() )
{ {
S3D_MASTER* draw3DCopy = new S3D_MASTER(NULL); S3D_MASTER* draw3DCopy = new S3D_MASTER( NULL );
draw3DCopy->Copy( draw3D ); draw3DCopy->Copy( draw3D );
m_Shapes3D_list.push_back( draw3DCopy ); m_Shapes3D_list.push_back( draw3DCopy );
m_3D_ShapeNameListBox->Append(draw3DCopy->m_Shape3DName); m_3D_ShapeNameListBox->Append( draw3DCopy->m_Shape3DName );
} }
draw3D = (S3D_MASTER*) draw3D->Next(); draw3D = (S3D_MASTER*) draw3D->Next();
} }
m_ReferenceCopy = new TEXTE_MODULE(NULL); m_ReferenceCopy = new TEXTE_MODULE( NULL );
m_ValueCopy = new TEXTE_MODULE(NULL); m_ValueCopy = new TEXTE_MODULE( NULL );
m_ReferenceCopy->Copy(m_CurrentModule->m_Reference); m_ReferenceCopy->Copy( m_CurrentModule->m_Reference );
m_ValueCopy->Copy(m_CurrentModule->m_Value); m_ValueCopy->Copy( m_CurrentModule->m_Value );
m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text ); m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text );
m_ValueCtrl->SetValue( m_ValueCopy->m_Text ); m_ValueCtrl->SetValue( m_ValueCopy->m_Text );
...@@ -259,7 +274,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -259,7 +274,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
/* Initialize 3D info displayed in dialog box from values in aStruct3DSource /* Initialize 3D info displayed in dialog box from values in aStruct3DSource
*/ */
void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource ) void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER* aStruct3DSource )
{ {
if( aStruct3DSource ) if( aStruct3DSource )
{ {
...@@ -277,22 +292,24 @@ void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruc ...@@ -277,22 +292,24 @@ void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruc
} }
} }
/** Copy 3D info displayed in dialog box to values in a item in m_Shapes3D_list /** Copy 3D info displayed in dialog box to values in a item in m_Shapes3D_list
* @param aIndexSelection = item index in m_Shapes3D_list * @param aIndexSelection = item index in m_Shapes3D_list
*/ */
void DIALOG_MODULE_BOARD_EDITOR::TransfertDisplayTo3DValues( int aIndexSelection ) void DIALOG_MODULE_BOARD_EDITOR::TransfertDisplayTo3DValues( int aIndexSelection )
{ {
if( aIndexSelection >= (int)m_Shapes3D_list.size() ) if( aIndexSelection >= (int) m_Shapes3D_list.size() )
return; return;
S3D_MASTER * struct3DDest = m_Shapes3D_list[aIndexSelection]; S3D_MASTER* struct3DDest = m_Shapes3D_list[aIndexSelection];
struct3DDest->m_MatScale = m_3D_Scale->GetValue(); struct3DDest->m_MatScale = m_3D_Scale->GetValue();
struct3DDest->m_MatRotation = m_3D_Rotation->GetValue(); struct3DDest->m_MatRotation = m_3D_Rotation->GetValue();
struct3DDest->m_MatPosition = m_3D_Offset->GetValue(); struct3DDest->m_MatPosition = m_3D_Offset->GetValue();
} }
/***********************************************************/ /***********************************************************/
void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected(wxCommandEvent& event) void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
{ {
if( m_LastSelected3DShapeIndex >= 0 ) if( m_LastSelected3DShapeIndex >= 0 )
...@@ -300,26 +317,28 @@ void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected(wxCommandEvent& event) ...@@ -300,26 +317,28 @@ void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetSelection(); m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetSelection();
if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when deleting an item in m_3D_ShapeNameListBox wxListBox if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when deleting an item in m_3D_ShapeNameListBox wxListBox
return; return;
if( m_LastSelected3DShapeIndex >= (int) m_Shapes3D_list.size() ) if( m_LastSelected3DShapeIndex >= (int) m_Shapes3D_list.size() )
{ {
wxMessageBox(wxT("On3DShapeNameSelected() error")); wxMessageBox( wxT( "On3DShapeNameSelected() error" ) );
m_LastSelected3DShapeIndex = -1; m_LastSelected3DShapeIndex = -1;
return; return;
} }
Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] ); Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] );
} }
/***********************************************************/ /***********************************************************/
void DIALOG_MODULE_BOARD_EDITOR::Add3DShape(wxCommandEvent& event) void DIALOG_MODULE_BOARD_EDITOR::Add3DShape( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
{ {
Browse3DLib( event ); Browse3DLib( event );
} }
/***********************************************************/ /***********************************************************/
void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape(wxCommandEvent& event) void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
{ {
if( m_LastSelected3DShapeIndex >= 0 ) if( m_LastSelected3DShapeIndex >= 0 )
...@@ -329,15 +348,15 @@ void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape(wxCommandEvent& event) ...@@ -329,15 +348,15 @@ void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape(wxCommandEvent& event)
if( ii < 0 ) if( ii < 0 )
return; return;
m_Shapes3D_list.erase(m_Shapes3D_list.begin() + ii ); m_Shapes3D_list.erase( m_Shapes3D_list.begin() + ii );
m_3D_ShapeNameListBox->Delete(ii); m_3D_ShapeNameListBox->Delete( ii );
if( m_3D_ShapeNameListBox->GetCount() == 0) if( m_3D_ShapeNameListBox->GetCount() == 0 )
Transfert3DValuesToDisplay( NULL ); Transfert3DValuesToDisplay( NULL );
else else
{ {
m_LastSelected3DShapeIndex = 0; m_LastSelected3DShapeIndex = 0;
m_3D_ShapeNameListBox->SetSelection(m_LastSelected3DShapeIndex); m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex );
Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] ); Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] );
} }
} }
...@@ -379,7 +398,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event ) ...@@ -379,7 +398,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
* because it preserve use of default libraries paths, when the path is a sub path of these default paths * because it preserve use of default libraries paths, when the path is a sub path of these default paths
*/ */
shortfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fullfilename ); shortfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fullfilename );
S3D_MASTER* new3DShape = new S3D_MASTER(NULL); S3D_MASTER* new3DShape = new S3D_MASTER( NULL );
new3DShape->m_Shape3DName = shortfilename; new3DShape->m_Shape3DName = shortfilename;
m_Shapes3D_list.push_back( new3DShape ); m_Shapes3D_list.push_back( new3DShape );
m_3D_ShapeNameListBox->Append( shortfilename ); m_3D_ShapeNameListBox->Append( shortfilename );
...@@ -388,9 +407,8 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event ) ...@@ -388,9 +407,8 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
TransfertDisplayTo3DValues( m_LastSelected3DShapeIndex ); TransfertDisplayTo3DValues( m_LastSelected3DShapeIndex );
m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetCount() - 1; m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetCount() - 1;
m_3D_ShapeNameListBox->SetSelection(m_LastSelected3DShapeIndex); m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex );
Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] ); Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] );
} }
...@@ -398,8 +416,9 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event ) ...@@ -398,8 +416,9 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
/******************************************************************************/ /******************************************************************************/
{ {
bool change_layer = FALSE; bool change_layer = FALSE;
wxPoint modpos; wxPoint modpos;
wxString msg;
if( m_CurrentModule->m_Flags == 0 ) // this is a simple edition, we must create an undo entry if( m_CurrentModule->m_Flags == 0 ) // this is a simple edition, we must create an undo entry
m_Parent->SaveCopyInUndoList( m_CurrentModule, UR_CHANGED ); m_Parent->SaveCopyInUndoList( m_CurrentModule, UR_CHANGED );
...@@ -410,14 +429,27 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -410,14 +429,27 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
} }
// 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;
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;
// Set Module Position // Set Module Position
modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT ); modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT );
modpos.y = ReturnValueFromTextCtrl( *m_ModPositionY, PCB_INTERNAL_UNIT ); modpos.y = ReturnValueFromTextCtrl( *m_ModPositionY, PCB_INTERNAL_UNIT );
m_CurrentModule->SetPosition(modpos); m_CurrentModule->SetPosition( modpos );
// Set orienta tion // Set orientation
long orient = 0; long orient = 0;
wxString msg = m_OrientValue->GetValue(); msg = m_OrientValue->GetValue();
msg.ToLong( &orient ); msg.ToLong( &orient );
if( m_CurrentModule->m_Orient != orient ) if( m_CurrentModule->m_Orient != orient )
m_CurrentModule->Rotate( m_CurrentModule->m_Pos, orient - m_CurrentModule->m_Orient ); m_CurrentModule->Rotate( m_CurrentModule->m_Pos, orient - m_CurrentModule->m_Orient );
...@@ -431,7 +463,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -431,7 +463,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
change_layer = TRUE; change_layer = TRUE;
if( change_layer ) if( change_layer )
m_CurrentModule->Flip(m_CurrentModule->m_Pos); m_CurrentModule->Flip( m_CurrentModule->m_Pos );
if( m_AutoPlaceCtrl->GetSelection() == 1 ) if( m_AutoPlaceCtrl->GetSelection() == 1 )
m_CurrentModule->m_ModuleStatus |= MODULE_is_LOCKED; m_CurrentModule->m_ModuleStatus |= MODULE_is_LOCKED;
...@@ -457,17 +489,17 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -457,17 +489,17 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_CntRot180 = m_CostRot180Ctrl->GetValue(); m_CurrentModule->m_CntRot180 = m_CostRot180Ctrl->GetValue();
// Init Fields: // Init Fields:
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 );
/* 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 )
TransfertDisplayTo3DValues( ii ); TransfertDisplayTo3DValues( ii );
S3D_MASTER* draw3D = m_CurrentModule->m_3D_Drawings; S3D_MASTER* draw3D = m_CurrentModule->m_3D_Drawings;
for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ ) for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ )
{ {
S3D_MASTER* draw3DCopy = m_Shapes3D_list[ii]; S3D_MASTER* draw3DCopy = m_Shapes3D_list[ii];
if( draw3DCopy->m_Shape3DName.IsEmpty() ) if( draw3DCopy->m_Shape3DName.IsEmpty() )
continue; continue;
if( draw3D == NULL ) if( draw3D == NULL )
...@@ -512,26 +544,28 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -512,26 +544,28 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
/***********************************************************************/ /***********************************************************************/
void DIALOG_MODULE_BOARD_EDITOR::OnEditReference(wxCommandEvent& event) void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event )
/***********************************************************************/ /***********************************************************************/
{ {
wxPoint tmp = m_Parent->GetScreen()->m_Curseur; wxPoint tmp = m_Parent->GetScreen()->m_Curseur;
m_Parent->GetScreen()->m_Curseur = m_ReferenceCopy->m_Pos; m_Parent->GetScreen()->m_Curseur = m_ReferenceCopy->m_Pos;
m_ReferenceCopy->SetParent(m_CurrentModule); m_ReferenceCopy->SetParent( m_CurrentModule );
m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp; m_Parent->GetScreen()->m_Curseur = tmp;
m_ReferenceCtrl->SetValue(m_ReferenceCopy->m_Text); m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text );
} }
/***********************************************************/ /***********************************************************/
void DIALOG_MODULE_BOARD_EDITOR::OnEditValue(wxCommandEvent& event) void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
{ {
wxPoint tmp = m_Parent->GetScreen()->m_Curseur; wxPoint tmp = m_Parent->GetScreen()->m_Curseur;
m_Parent->GetScreen()->m_Curseur = m_ValueCopy->m_Pos; m_Parent->GetScreen()->m_Curseur = m_ValueCopy->m_Pos;
m_ValueCopy->SetParent(m_CurrentModule); m_ValueCopy->SetParent( m_CurrentModule );
m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp; m_Parent->GetScreen()->m_Curseur = tmp;
m_ValueCtrl->SetValue(m_ValueCopy->m_Text); m_ValueCtrl->SetValue( m_ValueCopy->m_Text );
} }
...@@ -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 );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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 );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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 );
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_PADS_MASK_CLEARANCE_BASE</property> <property name="name">DIALOG_PADS_MASK_CLEARANCE_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">256,117</property> <property name="size">358,237</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Pads Mask Clearance</property> <property name="title">Pads Mask Clearance</property>
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="bg"></property> <property name="bg"></property>
...@@ -108,10 +108,10 @@ ...@@ -108,10 +108,10 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Pads Mask Clearance:</property> <property name="label">Note:&#x0A;- a positive value means a mask bigger than a pad&#x0A;- a negative value means a mask smaller than a pad&#x0A;</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_MaskClearanceTitle</property> <property name="name">m_staticTextInfo</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
...@@ -149,9 +149,9 @@ ...@@ -149,9 +149,9 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property> <property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxStaticLine" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
...@@ -160,16 +160,14 @@ ...@@ -160,16 +160,14 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_OptMaskMargin</property> <property name="name">m_staticline1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip">This is the clearance between pads and the mask</property> <property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -195,13 +193,498 @@ ...@@ -195,13 +193,498 @@
<event name="OnRightUp"></event> <event name="OnRightUp"></event>
<event name="OnSetFocus"></event> <event name="OnSetFocus"></event>
<event name="OnSize"></event> <event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgGridSolderMaskSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">2</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Solder mask clearance:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_MaskClearanceTitle</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_SolderMaskMarginCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">This is the global clearance between pads and the solder mask&#x0A;This value can be superseded by local values for a footprint or a pad.</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Inch</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SolderMaskMarginUnits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Solder paste clearance:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticTextSolderPaste</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_SolderPasteMarginCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">This is the global clearance between pads and the solder paste&#x0A;This value can be superseded by local values for a footprint or a pad.&#x0A;The final clearance value is the sum of this value and the clearance value ratio</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Inch</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SolderPasteMarginUnits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Solder mask ratio clearance:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticTextRatio</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_SolderPasteMarginRatioCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">This is the global clearance ratio in per cent between pads and the solder paste&#x0A;A value of 10 means the clearance value is 10% of the pad size&#x0A;This value can be superseded by local values for a footprint or a pad.&#x0A;The final clearance value is the sum of this value and the clearance value</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">%</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SolderPasteRatioMarginUnits</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>
......
...@@ -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();
......
...@@ -623,10 +623,10 @@ static PARAM_CFG_INT HPGLrecouvrementCfg ...@@ -623,10 +623,10 @@ 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
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
/* Fonctions locales */ /* Local functions */
static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer, static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
...@@ -27,7 +27,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -27,7 +27,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
int masque_layer, GRTraceMode trace_mode ) int masque_layer, GRTraceMode trace_mode )
/***********************************************************/ /***********************************************************/
/* Genere le trace des couches type serigraphie, en format HPGL ou GERBER*/ /* Creates the plot for silkscreen layers
*/
{ {
wxPoint pos, shape_pos; wxPoint pos, shape_pos;
wxSize size; wxSize size;
...@@ -36,7 +37,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -36,7 +37,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
TEXTE_MODULE* pt_texte; TEXTE_MODULE* pt_texte;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
/* Trace du contour du PCB et des Elements du type Drawings Pcb */ /* Plot edge layer and graphic items */
for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
...@@ -67,10 +68,10 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -67,10 +68,10 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
} }
} }
/* trace des contours des MODULES : */ /* Plot footprint outlines : */
Plot_Edges_Modules( plotter, m_Pcb, masque_layer, trace_mode ); Plot_Edges_Modules( plotter, m_Pcb, masque_layer, trace_mode );
/* Trace des MODULES : PADS */ /* Plot pads (creates pads outlines, for pads on silkscreen layers) */
if( g_pcb_plot_options.PlotPadsOnSilkLayer if( g_pcb_plot_options.PlotPadsOnSilkLayer
|| g_pcb_plot_options.Plot_Pads_All_Layers ) || g_pcb_plot_options.Plot_Pads_All_Layers )
{ {
...@@ -80,7 +81,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -80,7 +81,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
{ {
for( pt_pad = (D_PAD*) Module->m_Pads; pt_pad != NULL; pt_pad = pt_pad->Next() ) for( pt_pad = (D_PAD*) Module->m_Pads; pt_pad != NULL; pt_pad = pt_pad->Next() )
{ {
/* Tst si layer OK */ /* Seen if the pad is on this layer */
if( (pt_pad->m_Masque_Layer & masque_layer) == 0 if( (pt_pad->m_Masque_Layer & masque_layer) == 0
/* Copper pads go on copper silk, component /* Copper pads go on copper silk, component
...@@ -126,14 +127,14 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -126,14 +127,14 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
} }
} }
} }
} /* Fin Sequence de trace des Pads */ }
/* Trace Textes MODULES */ /* Plot footprints fields (ref, value ...) */
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() ) for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
{ {
/* Analyse des autorisations de trace pour les textes VALEUR et REF */ /* see if we want to plot VALUE and REF fields */
trace_val = g_pcb_plot_options.Sel_Texte_Valeur; trace_val = g_pcb_plot_options.Sel_Texte_Valeur;
trace_ref = g_pcb_plot_options.Sel_Texte_Reference; // les 2 autorisations de tracer sont donnees trace_ref = g_pcb_plot_options.Sel_Texte_Reference;
TEXTE_MODULE* text = Module->m_Reference; TEXTE_MODULE* text = Module->m_Reference;
unsigned textLayer = text->GetLayer(); unsigned textLayer = text->GetLayer();
...@@ -175,7 +176,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -175,7 +176,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible ) if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible )
trace_val = FALSE; trace_val = FALSE;
/* Trace effectif des textes */ /* Plot text fields, if allowed */
if( trace_ref ) if( trace_ref )
PlotTextModule( plotter, Module->m_Reference, trace_mode ); PlotTextModule( plotter, Module->m_Reference, trace_mode );
...@@ -224,7 +225,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, ...@@ -224,7 +225,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
PlotFilledAreas( plotter, edge_zone, trace_mode ); PlotFilledAreas( plotter, edge_zone, trace_mode );
} }
// Plot segments used to fill zone areas: // Plot segments used to fill zone areas (outdated, but here for old boards compatibility):
for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() ) for( SEGZONE* seg = m_Pcb->m_Zone; seg != NULL; seg = seg->Next() )
{ {
if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 ) if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 )
...@@ -244,7 +245,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, ...@@ -244,7 +245,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
wxPoint pos; wxPoint pos;
int orient, thickness; int orient, thickness;
/* calcul des parametres du texte :*/ /* calculate some text parameters :*/
size = pt_texte->m_Size; size = pt_texte->m_Size;
pos = pt_texte->m_Pos; pos = pt_texte->m_Pos;
...@@ -337,11 +338,11 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer, ...@@ -337,11 +338,11 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode ); PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Shape = S_SEGMENT; DrawTmp->m_Shape = S_SEGMENT;
/* Trace des 2 traits */
radius = Mire->m_Size / 2; radius = Mire->m_Size / 2;
dx1 = radius, dy1 = 0; dx2 = 0, dy2 = radius; dx1 = radius, dy1 = 0; dx2 = 0, dy2 = radius;
if( Mire->m_Shape ) /* Forme X */ if( Mire->m_Shape ) /* Shape X */
{ {
dx1 = dy1 = (radius * 7) / 5; dx1 = dy1 = (radius * 7) / 5;
dx2 = dx1; dx2 = dx1;
...@@ -364,7 +365,7 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer, ...@@ -364,7 +365,7 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer,
void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer, void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/**********************************************************************/ /**********************************************************************/
/* Trace les contours des modules */ /* Plot footprints graphic items (outlines) */
{ {
for( MODULE* module = pcb->m_Modules; module; module = module->Next() ) for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
{ {
...@@ -388,7 +389,7 @@ void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer, ...@@ -388,7 +389,7 @@ void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer,
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge, void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/**************************************************************/ /**************************************************************/
/* Trace les contours des modules */ /* Plot a graphic item (outline) relative to a footprint */
{ {
int type_trace; /* forme a tracer (segment, cercle) */ int type_trace; /* forme a tracer (segment, cercle) */
int thickness; /* thickness des segments */ int thickness; /* thickness des segments */
...@@ -467,7 +468,7 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge, ...@@ -467,7 +468,7 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/****************************************************************************/ /****************************************************************************/
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules */ /* Plot a PCB Text, i;e. a text found on a copper or technical layer */
{ {
int orient, thickness; int orient, thickness;
wxPoint pos; wxPoint pos;
...@@ -478,7 +479,6 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, ...@@ -478,7 +479,6 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 ) if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 )
return; return;
/* calcul des parametres du texte :*/
size = pt_texte->m_Size; size = pt_texte->m_Size;
pos = pt_texte->m_Pos; pos = pt_texte->m_Pos;
orient = pt_texte->m_Orient; orient = pt_texte->m_Orient;
...@@ -521,7 +521,6 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, ...@@ -521,7 +521,6 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone, void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode ) GRTraceMode trace_mode )
/*********************************************************/ /*********************************************************/
/* Plot areas (given by .m_FilledPolysList member) in a zone /* Plot areas (given by .m_FilledPolysList member) in a zone
*/ */
{ {
...@@ -697,7 +696,7 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer, ...@@ -697,7 +696,7 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
case LAYER_N_14: case LAYER_N_14:
case LAYER_N_15: case LAYER_N_15:
case LAST_COPPER_LAYER: case LAST_COPPER_LAYER:
Plot_Standard_Layer( plotter, layer_mask, 0, true, trace_mode ); Plot_Standard_Layer( plotter, layer_mask, true, trace_mode );
// Adding drill marks, if required and if the plotter is able to plot them: // Adding drill marks, if required and if the plotter is able to plot them:
if( g_pcb_plot_options.DrillShapeOpt != PCB_Plot_Options::NO_DRILL_SHAPE ) if( g_pcb_plot_options.DrillShapeOpt != PCB_Plot_Options::NO_DRILL_SHAPE )
...@@ -714,13 +713,12 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer, ...@@ -714,13 +713,12 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
case SOLDERMASK_N_CU: case SOLDERMASK_N_CU:
case SOLDERMASK_N_CMP: case SOLDERMASK_N_CMP:
Plot_Standard_Layer( plotter, layer_mask, Plot_Standard_Layer( plotter, layer_mask,
g_DesignSettings.m_MaskMargin,
g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode ); g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode );
break; break;
case SOLDERPASTE_N_CU: case SOLDERPASTE_N_CU:
case SOLDERPASTE_N_CMP: case SOLDERPASTE_N_CMP:
Plot_Standard_Layer( plotter, layer_mask, 0, false, trace_mode ); Plot_Standard_Layer( plotter, layer_mask, false, trace_mode );
break; break;
default: default:
...@@ -730,13 +728,10 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer, ...@@ -730,13 +728,10 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer,
} }
/*********************************************************************/ /******************************************************************************/
void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask,
int masque_layer, bool aPlotVia, GRTraceMode aPlotMode )
int garde, /*******************************************************************************/
bool trace_via,
GRTraceMode trace_mode )
/*********************************************************************/
/* Trace en format HPGL. d'une couche cuivre ou masque /* Trace en format HPGL. d'une couche cuivre ou masque
* 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) . * 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) .
...@@ -753,19 +748,19 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, ...@@ -753,19 +748,19 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
PlotDrawSegment( plotter, (DRAWSEGMENT*) item, masque_layer, trace_mode ); PlotDrawSegment( aPlotter, (DRAWSEGMENT*) item, aLayerMask, aPlotMode );
break; break;
case TYPE_TEXTE: case TYPE_TEXTE:
PlotTextePcb( plotter, (TEXTE_PCB*) item, masque_layer, trace_mode ); PlotTextePcb( aPlotter, (TEXTE_PCB*) item, aLayerMask, aPlotMode );
break; break;
case TYPE_COTATION: case TYPE_COTATION:
PlotCotation( plotter, (COTATION*) item, masque_layer, trace_mode ); PlotCotation( aPlotter, (COTATION*) item, aLayerMask, aPlotMode );
break; break;
case TYPE_MIRE: case TYPE_MIRE:
PlotMirePcb( plotter, (MIREPCB*) item, masque_layer, trace_mode ); PlotMirePcb( aPlotter, (MIREPCB*) item, aLayerMask, aPlotMode );
break; break;
case TYPE_MARKER_PCB: case TYPE_MARKER_PCB:
...@@ -786,8 +781,8 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, ...@@ -786,8 +781,8 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
if( masque_layer & g_TabOneLayerMask[ item->GetLayer() ] ) if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] )
Plot_1_EdgeModule( plotter, (EDGE_MODULE*) item, trace_mode ); Plot_1_EdgeModule( aPlotter, (EDGE_MODULE*) item, aPlotMode );
break; break;
default: default:
...@@ -802,14 +797,30 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, ...@@ -802,14 +797,30 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{ {
wxPoint shape_pos; wxPoint shape_pos;
if( (pad->m_Masque_Layer & masque_layer) == 0 ) if( (pad->m_Masque_Layer & aLayerMask) == 0 )
continue; continue;
shape_pos = pad->ReturnShapePos(); shape_pos = pad->ReturnShapePos();
pos = shape_pos; pos = shape_pos;
wxSize margin;
switch( aLayerMask & (SOLDERMASK_LAYER_CU|SOLDERMASK_LAYER_CMP|SOLDERPASTE_LAYER_CU|SOLDERPASTE_LAYER_CMP) )
{
case SOLDERMASK_LAYER_CMP:
case SOLDERMASK_LAYER_CU:
margin.x = margin.y = pad->GetSolderMaskMargin();
break;
size.x = pad->m_Size.x + 2 * garde; case SOLDERPASTE_LAYER_CMP:
size.y = pad->m_Size.y + 2 * garde; case SOLDERPASTE_LAYER_CU:
margin = pad->GetSolderPasteMargin();
break;
default:
break;
}
size.x = pad->m_Size.x + (2 * margin.x);
size.y = pad->m_Size.y + (2 * margin.y);
/* Don't draw a null size item : */ /* Don't draw a null size item : */
if( size.x <= 0 || size.y <= 0 ) if( size.x <= 0 || size.y <= 0 )
...@@ -818,30 +829,30 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, ...@@ -818,30 +829,30 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
switch( pad->m_PadShape ) switch( pad->m_PadShape )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
plotter->flash_pad_circle( pos, size.x, trace_mode ); aPlotter->flash_pad_circle( pos, size.x, aPlotMode );
break; break;
case PAD_OVAL: case PAD_OVAL:
plotter->flash_pad_oval( pos, size, pad->m_Orient, trace_mode ); aPlotter->flash_pad_oval( pos, size, pad->m_Orient, aPlotMode );
break; break;
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
{ {
wxSize delta = pad->m_DeltaSize; wxSize delta = pad->m_DeltaSize;
plotter->flash_pad_trapez( pos, size, delta, pad->m_Orient, trace_mode ); aPlotter->flash_pad_trapez( pos, size, delta, pad->m_Orient, aPlotMode );
} }
break; break;
case PAD_RECT: case PAD_RECT:
default: default:
plotter->flash_pad_rect( pos, size, pad->m_Orient, trace_mode ); aPlotter->flash_pad_rect( pos, size, pad->m_Orient, aPlotMode );
break; break;
} }
} }
} }
/* Plot vias : */ /* Plot vias : */
if( trace_via ) if( aPlotVia )
{ {
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() ) for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
{ {
...@@ -850,25 +861,29 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, ...@@ -850,25 +861,29 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
SEGVIA* Via = (SEGVIA*) track; SEGVIA* Via = (SEGVIA*) track;
// vias not plotted if not on selected layer, but if layer // vias are not plotted if not on selected layer, but if layer
// == SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn, // is SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP,vias are drawn,
// if they are on a external copper layer // if they are on an external copper layer
int via_mask_layer = Via->ReturnMaskLayer(); int via_mask_layer = Via->ReturnMaskLayer();
if( via_mask_layer & CUIVRE_LAYER ) if( via_mask_layer & CUIVRE_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CU; via_mask_layer |= SOLDERMASK_LAYER_CU;
if( via_mask_layer & CMP_LAYER ) if( via_mask_layer & CMP_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CMP; via_mask_layer |= SOLDERMASK_LAYER_CMP;
if( ( via_mask_layer & masque_layer) == 0 ) if( ( via_mask_layer & aLayerMask) == 0 )
continue; continue;
int via_margin = 0;
// If the current layer is a solder mask, use the global mask clearance for vias
if( (aLayerMask & (SOLDERMASK_LAYER_CU|SOLDERMASK_LAYER_CMP) ) )
via_margin = g_DesignSettings.m_SolderMaskMargin;
pos = Via->m_Start; pos = Via->m_Start;
size.x = size.y = Via->m_Width + 2 * garde; size.x = size.y = Via->m_Width + 2 * via_margin;
/* Don't draw a null size item : */ /* Don't draw a null size item : */
if( size.x <= 0 ) if( size.x <= 0 )
continue; continue;
plotter->flash_pad_circle( pos, size.x, trace_mode ); aPlotter->flash_pad_circle( pos, size.x, aPlotMode );
} }
} }
...@@ -880,38 +895,38 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, ...@@ -880,38 +895,38 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
if( track->Type() == TYPE_VIA ) if( track->Type() == TYPE_VIA )
continue; continue;
if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) if( (g_TabOneLayerMask[track->GetLayer()] & aLayerMask) == 0 )
continue; continue;
size.x = size.y = track->m_Width; size.x = size.y = track->m_Width;
pos = track->m_Start; pos = track->m_Start;
end = track->m_End; end = track->m_End;
plotter->thick_segment( pos, end, size.x, trace_mode ); aPlotter->thick_segment( pos, end, size.x, aPlotMode );
} }
/* Plot zones: */ /* Plot zones (outdated, for old boards compatibility): */
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() ) for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
{ {
wxPoint end; wxPoint end;
if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) if( (g_TabOneLayerMask[track->GetLayer()] & aLayerMask) == 0 )
continue; continue;
size.x = size.y = track->m_Width; size.x = size.y = track->m_Width;
pos = track->m_Start; pos = track->m_Start;
end = track->m_End; end = track->m_End;
plotter->thick_segment( pos, end, size.x, trace_mode ); aPlotter->thick_segment( pos, end, size.x, aPlotMode );
} }
/* Plot filled ares */ /* Plot filled ares */
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii ); ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
if( ( ( 1 << edge_zone->GetLayer() ) & masque_layer ) == 0 ) if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 )
continue; continue;
PlotFilledAreas( plotter, edge_zone, trace_mode ); PlotFilledAreas( aPlotter, edge_zone, aPlotMode );
} }
} }
...@@ -922,7 +937,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, ...@@ -922,7 +937,7 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter,
* 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 WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode, void WinEDA_BasePcbFrame::PlotDrillMark( PLOTTER* aPlotter, GRTraceMode aTraceMode,
bool aSmallDrillShape ) bool aSmallDrillShape )
......
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