diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d10e56173f..9c20ee77d8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,24 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with email address. +2009-Nov-04 UPDATE Jean-Pierre Charras +================================================================================ +++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 ================================================================================ ++pcbnew diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 94e4a682f4..0ea05fe4c2 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -9,22 +9,26 @@ class EDA_BoardDesignSettings { protected: - int m_CopperLayerCount; // Number of copper layers for this design + int m_CopperLayerCount; // Number of copper layers for this design public: - bool m_MicroViasAllowed; // true to allow micro vias - 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 - int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) - int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) - int m_PcbTextWidth; // current Pcb (not module) Text width - wxSize m_PcbTextSize; // current Pcb (not module) Text size - int m_TrackMinWidth; // track min value for width ((min copper size value - int m_ViasMinSize; // vias (not micro vias) min diameter - int m_ViasMinDrill; // vias (not micro vias) min drill diameter - int m_MicroViasMinSize; // micro vias (not vias) min diameter - int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter - int m_MaskMargin; // Solder mask margin - int m_LayerThickness; // Layer Thickness for 3D viewer + bool m_MicroViasAllowed; // true to allow micro vias + 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 + int m_DrawSegmentWidth; // current graphic line width (not EDGE layer) + int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only) + int m_PcbTextWidth; // current Pcb (not module) Text width + wxSize m_PcbTextSize; // current Pcb (not module) Text size + int m_TrackMinWidth; // track min value for width ((min copper size value + int m_ViasMinSize; // vias (not micro vias) min diameter + int m_ViasMinDrill; // vias (not micro vias) min drill diameter + int m_MicroViasMinSize; // micro vias (not vias) min diameter + int m_MicroViasMinDrill; // micro vias (not vias) min drill diameter + // Global mask margins: + int m_SolderMaskMargin; // Solder mask margin + int m_SolderPasteMargin; // Solder paste margin absolute value + double m_SolderPasteMarginRatio; // Solder pask margin ratio value of pad size + // The final margin is the sum of these 2 values + int m_LayerThickness; // Layer Thickness for 3D viewer protected: int m_EnabledLayers; // Bit-mask for layer enabling @@ -32,14 +36,15 @@ protected: int m_VisibleElements; // Bit-mask for element category visibility public: - // Color options for screen display of the Printed Board: - int m_LayerColor[32]; // Layer colors (tracks and graphic items) - int m_ViaColor[4]; // Via color (depending on is type) + // Color options for screen display of the Printed Board: + int m_LayerColor[32]; // Layer colors (tracks and graphic items) + + 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) - int m_RatsnestColor; // Ratsnest color + int m_RatsnestColor; // Ratsnest color public: @@ -50,7 +55,7 @@ public: * returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ - int GetVisibleLayers() const; + int GetVisibleLayers() const; /** * Function SetVisibleLayers @@ -69,10 +74,12 @@ public: { if( aLayerIndex < 0 || aLayerIndex >= 32 ) //@@IMB: Altough Pcbnew uses only 29, Gerbview uses all 32 layers return false; + // 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 * changes the visibility of a given layer @@ -91,6 +98,7 @@ public: return m_VisibleElements; } + /** * Function SetVisibleElements * changes the bit-mask of visible element categories @@ -101,6 +109,7 @@ public: m_VisibleElements = aMask; } + /** * Function IsElementVisible * tests whether a given element category is visible @@ -111,9 +120,10 @@ public: { if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE ) return false; - return (bool)( m_VisibleElements & 1 << aCategoryIndex ); + return (bool) ( m_VisibleElements & 1 << aCategoryIndex ); } + /** * Function SetElementVisibility * changes the visibility of an element category @@ -132,6 +142,7 @@ public: return m_EnabledLayers; } + /** * Function SetEnabledLayers * changes the bit-mask of enabled layers @@ -141,10 +152,12 @@ public: { // TODO; ensure consistency with m_CopperLayerCount m_EnabledLayers = aMask; + // A disabled layer cannot be visible m_VisibleLayers &= aMask; } + /** * Function IsLayerEnabled * tests whether a given layer is enabled @@ -153,9 +166,10 @@ public: */ inline bool IsLayerEnabled( int aLayerIndex ) { - return (bool)( m_EnabledLayers & 1 << aLayerIndex ); + return (bool) ( m_EnabledLayers & 1 << aLayerIndex ); } + /** * Function GetCopperLayerCount * @return int - the number of neabled copper layers @@ -165,6 +179,7 @@ public: return m_CopperLayerCount; } + /** * Function SetCopperLayerCount * do what its name says... @@ -175,4 +190,5 @@ public: #endif - // _BOARD_DESIGN_SETTING_H + +// _BOARD_DESIGN_SETTING_H diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index b5523e3170..e720f56112 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -287,9 +287,8 @@ public: 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_Standard_Layer( PLOTTER* plotter, int masque_layer, - int garde, bool trace_via, - GRTraceMode trace_mode ); + void Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask, + bool aPlotVia, GRTraceMode aPlotMode ); void Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode ); /** function PlotDrillMark @@ -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 * @param aPlotter = the PLOTTER * @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 ); diff --git a/kicad/kicad.h b/kicad/kicad.h index 6794586db2..946ec7188b 100644 --- a/kicad/kicad.h +++ b/kicad/kicad.h @@ -98,8 +98,6 @@ public: void OnCloseWindow( wxCloseEvent& Event ); void OnSize( wxSizeEvent& event ); - void OnPaint( wxPaintEvent& event ); - void ReDraw( wxDC* DC ); void OnSashDrag( wxSashEvent& event ); void OnLoadProject( wxCommandEvent& event ); void OnSaveProject( wxCommandEvent& event ); diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index ece003e896..eba5e33eac 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -109,7 +109,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, RecreateBaseHToolbar(); m_auimgr.SetManagedWindow(this); - + wxAuiPaneInfo horiz; horiz.Gripper(false); horiz.DockFixed(true); @@ -117,15 +117,15 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, horiz.Floatable(false); horiz.CloseButton(false); horiz.CaptionVisible(false); - + wxAuiPaneInfo vert(horiz); - + vert.TopDockable(false).BottomDockable(false); horiz.LeftDockable(false).RightDockable(false); - + m_auimgr.AddPane(m_HToolBar, wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top()); - + m_auimgr.AddPane(m_DialogWin, wxAuiPaneInfo(horiz).Name(wxT("m_DialogWin")).Center()); @@ -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 ) { Close( true ); diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index 14528b3bcf..cce5fc916c 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -35,35 +35,40 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() LIGHTGRAY }; - m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. - // SetCopperLayerCount() will adjust thist. - 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_EnabledLayers = ALL_LAYERS; // All layers enabled at first. + // SetCopperLayerCount() will adjust thist. + 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. - SetCopperLayerCount( 2 ); // Default design is a double sided board - 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_MicroViasAllowed = false; // true to allow micro vias - m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) - m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) - m_PcbTextWidth = 100; // current Pcb (not module) Text width - m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size - m_TrackMinWidth = 80; // track min value for width ((min copper size value - m_ViasMinSize = 350; // vias (not micro vias) min diameter - m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter - m_MicroViasMinSize = 200; // micro vias (not vias) min diameter - m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter - m_MaskMargin = 150; // Solder mask margin + SetCopperLayerCount( 2 ); // Default design is a double sided board + 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_MicroViasAllowed = false; // true to allow micro vias + m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer) + m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only) + m_PcbTextWidth = 100; // current Pcb (not module) Text width + m_PcbTextSize = wxSize( 500, 500 ); // current Pcb (not module) Text size + m_TrackMinWidth = 80; // track min value for width ((min copper size value + m_ViasMinSize = 350; // vias (not micro vias) min diameter + m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter + m_MicroViasMinSize = 200; // micro vias (not vias) min diameter + m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter + // 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: */ for( ii = 0; ii < 32; ii++ ) m_LayerColor[ii] = default_layer_color[ii]; // Layer colors (tracks and graphic items) - m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY; - m_ViaColor[VIA_MICROVIA] = CYAN; - m_ViaColor[VIA_BLIND_BURIED] = BROWN; - m_ViaColor[VIA_THROUGH] = WHITE; + m_ViaColor[VIA_NOT_DEFINED] = DARKGRAY; + m_ViaColor[VIA_MICROVIA] = CYAN; + m_ViaColor[VIA_BLIND_BURIED] = BROWN; + m_ViaColor[VIA_THROUGH] = WHITE; m_RatsnestColor = WHITE; // Ratsnest color } @@ -75,22 +80,25 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const return m_VisibleLayers; } + void EDA_BoardDesignSettings::SetVisibleLayers( int aMask ) { m_VisibleLayers = aMask & m_EnabledLayers & ALL_LAYERS; } + void EDA_BoardDesignSettings::SetLayerVisibility( int aLayerIndex, bool aNewState ) { // Altough Pcbnew uses only 29, Gerbview uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) return; - if( aNewState && IsLayerEnabled( aLayerIndex )) + if( aNewState && IsLayerEnabled( aLayerIndex ) ) m_VisibleLayers |= 1 << aLayerIndex; else m_VisibleLayers &= ~( 1 << aLayerIndex ); } + void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool aNewState ) { if( aElementCategory < 0 || aElementCategory > PAD_CMP_VISIBLE ) @@ -100,6 +108,8 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a else m_VisibleElements &= ~( 1 << aElementCategory ); } + + /** * Function SetCopperLayerCount * do what its name says... @@ -108,11 +118,12 @@ void EDA_BoardDesignSettings::SetElementVisibility( int aElementCategory, bool a void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount ) { m_CopperLayerCount = aNewLayerCount; + // ensure consistency with the m_EnabledLayers member m_EnabledLayers &= ~ALL_CU_LAYERS; m_EnabledLayers |= CUIVRE_LAYER; - if ( m_CopperLayerCount > 1 ) + if( m_CopperLayerCount > 1 ) m_EnabledLayers |= CMP_LAYER; - for( int ii = 1; ii < aNewLayerCount-1; ii++ ) + for( int ii = 1; ii < aNewLayerCount - 1; ii++ ) m_EnabledLayers |= 1 << ii; } diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index c48fb30b43..5602917713 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -36,8 +36,12 @@ MODULE::MODULE( BOARD* parent ) : flag = 0; m_CntRot90 = m_CntRot180 = 0; m_Surface = 0; - m_Link = 0; + m_Link = 0; 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 ); @@ -68,19 +72,20 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset GRSetDrawMode( DC, draw_mode ); - if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE )) + if( g_DesignSettings.IsElementVisible( ANCHOR_VISIBLE ) ) { 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, - 0, g_AnchorColor ); + 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 ); 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, - 0, g_AnchorColor ); + 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 ); } } + /*********************************/ void MODULE::Copy( MODULE* aModule ) /*********************************/ @@ -97,6 +102,9 @@ void MODULE::Copy( MODULE* aModule ) m_LastEdit_Time = aModule->m_LastEdit_Time; m_Path = aModule->m_Path; //is this correct behavior? 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 */ m_Reference->Copy( aModule->m_Reference ); @@ -119,14 +127,14 @@ void MODULE::Copy( MODULE* aModule ) switch( item->Type() ) { case TYPE_TEXTE_MODULE: - TEXTE_MODULE* textm; + TEXTE_MODULE * textm; textm = new TEXTE_MODULE( this ); textm->Copy( (TEXTE_MODULE*) item ); m_Drawings.PushBack( textm ); break; case TYPE_EDGE_MODULE: - EDGE_MODULE* edge; + EDGE_MODULE * edge; edge = new EDGE_MODULE( this ); edge->Copy( (EDGE_MODULE*) item ); m_Drawings.PushBack( edge ); @@ -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(); + // Ensure there is one (or more) item in m_3D_Drawings m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); // push a void item 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; 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 ); else { @@ -271,9 +280,9 @@ bool MODULE::Save( FILE* aFile ) const statusTxt[1] = '~'; fprintf( aFile, "Po %d %d %d %d %8.8lX %8.8lX %s\n", - m_Pos.x, m_Pos.y, - m_Orient, m_Layer, m_LastEdit_Time, - m_TimeStamp, statusTxt ); + m_Pos.x, m_Pos.y, + m_Orient, m_Layer, m_LastEdit_Time, + m_TimeStamp, statusTxt ); fprintf( aFile, "Li %s\n", CONV_TO_UTF8( m_LibRef ) ); @@ -290,6 +299,12 @@ bool MODULE::Save( FILE* aFile ) const fprintf( aFile, "Sc %8.8lX\n", m_TimeStamp ); fprintf( aFile, "AR %s\n", CONV_TO_UTF8( m_Path ) ); 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 if( m_Attributs != MOD_DEFAULT ) @@ -322,7 +337,7 @@ bool MODULE::Save( FILE* aFile ) const break; default: -#if defined (DEBUG) +#if defined(DEBUG) printf( "MODULE::Save() ignoring type %d\n", item->Type() ); #endif break; @@ -352,7 +367,7 @@ int MODULE::Write_3D_Descr( FILE* File ) const /* Sauvegarde de la description 3D du MODULE */ { - char buf[512]; + char buf[512]; for( S3D_MASTER* t3D = m_3D_Drawings; t3D; t3D = t3D->Next() ) { @@ -363,21 +378,21 @@ int MODULE::Write_3D_Descr( FILE* File ) const fprintf( File, "Na \"%s\"\n", CONV_TO_UTF8( t3D->m_Shape3DName ) ); sprintf( buf, "Sc %lf %lf %lf\n", - t3D->m_MatScale.x, - t3D->m_MatScale.y, - t3D->m_MatScale.z ); + t3D->m_MatScale.x, + t3D->m_MatScale.y, + t3D->m_MatScale.z ); fprintf( File, "%s", to_point( buf ) ); sprintf( buf, "Of %lf %lf %lf\n", - t3D->m_MatPosition.x, - t3D->m_MatPosition.y, - t3D->m_MatPosition.z ); + t3D->m_MatPosition.x, + t3D->m_MatPosition.y, + t3D->m_MatPosition.z ); fprintf( File, "%s", to_point( buf ) ); sprintf( buf, "Ro %lf %lf %lf\n", - t3D->m_MatRotation.x, - t3D->m_MatRotation.y, - t3D->m_MatRotation.z ); + t3D->m_MatRotation.x, + t3D->m_MatRotation.y, + t3D->m_MatRotation.z ); fprintf( File, "%s", to_point( buf ) ); fprintf( File, "$EndSHAPE3D\n" ); @@ -397,8 +412,8 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum ) * retourne 0 si OK */ { - char Line[1024]; - char* text = Line + 3; + char Line[1024]; + char* text = Line + 3; S3D_MASTER* t3D = m_3D_Drawings; @@ -430,23 +445,23 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum ) case 'S': // Scale sscanf( text, "%lf %lf %lf\n", - &t3D->m_MatScale.x, - &t3D->m_MatScale.y, - &t3D->m_MatScale.z ); + &t3D->m_MatScale.x, + &t3D->m_MatScale.y, + &t3D->m_MatScale.z ); break; case 'O': // Offset sscanf( text, "%lf %lf %lf\n", - &t3D->m_MatPosition.x, - &t3D->m_MatPosition.y, - &t3D->m_MatPosition.z ); + &t3D->m_MatPosition.x, + &t3D->m_MatPosition.y, + &t3D->m_MatPosition.z ); break; case 'R': // Rotation sscanf( text, "%lf %lf %lf\n", - &t3D->m_MatRotation.x, - &t3D->m_MatRotation.y, - &t3D->m_MatRotation.z ); + &t3D->m_MatRotation.x, + &t3D->m_MatRotation.y, + &t3D->m_MatRotation.z ); break; default: @@ -462,13 +477,13 @@ int MODULE::Read_3D_Descr( FILE* File, int* LineNum ) int MODULE::ReadDescr( FILE* File, int* LineNum ) /**************************************************/ -/* Lecture de la description d'un MODULE (format Ascii) - * la 1ere ligne de descr ($MODULE) est supposee etre deja lue - * retourne 0 si OK +/* Read a MODULE description + * The first description line ($MODULE) is already read + * @return 0 if no error */ { - char Line[256], BufLine[256], BufCar1[128], * PtLine; - int itmp1, itmp2; + char Line[256], BufLine[256], BufCar1[128], * PtLine; + int itmp1, itmp2; while( GetLine( File, Line, LineNum, sizeof(Line) - 1 ) != NULL ) { @@ -496,15 +511,16 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) 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] ) { case 'P': memset( BufCar1, 0, sizeof(BufCar1) ); sscanf( PtLine, "%d %d %d %d %lX %lX %s", - &m_Pos.x, &m_Pos.y, - &m_Orient, &m_Layer, - &m_LastEdit_Time, &m_TimeStamp, BufCar1 ); + &m_Pos.x, &m_Pos.y, + &m_Orient, &m_Layer, + &m_LastEdit_Time, &m_TimeStamp, BufCar1 ); m_ModuleStatus = 0; if( BufCar1[0] == 'F' ) @@ -513,7 +529,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) m_ModuleStatus |= MODULE_is_PLACED; break; - case 'L': /* Li = Lecture du nom librairie du module */ + case 'L': /* Li = read the library name of the footprint */ *BufLine = 0; sscanf( PtLine, " %s", BufLine ); m_LibRef = CONV_FROM_UTF8( BufLine ); @@ -524,7 +540,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) break; - case 'O': /* (Op)tions de placement auto */ + case 'O': /* (Op)tions for auto placement */ itmp1 = itmp2 = 0; sscanf( PtLine, " %X %X", &itmp1, &itmp2 ); @@ -544,7 +560,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) case 'A': if( Line[1] == 't' ) { - /* At = (At)tributs du module */ + /* At = (At)tributes of module */ if( strstr( PtLine, "SMD" ) ) m_Attributs |= MOD_CMS; if( strstr( PtLine, "VIRTUAL" ) ) @@ -559,7 +575,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) break; case 'T': /* Read a footprint text description (ref, value, or drawing */ - TEXTE_MODULE* textm; + TEXTE_MODULE * textm; sscanf( Line + 1, "%d", &itmp1 ); if( itmp1 == TEXT_is_REFERENCE ) textm = m_Reference; @@ -573,27 +589,35 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) textm->ReadDescr( Line, File, LineNum ); break; - case 'D': /* lecture du contour */ - EDGE_MODULE* edge; + case 'D': /* read a drawing item */ + EDGE_MODULE * edge; edge = new EDGE_MODULE( this ); m_Drawings.PushBack( edge ); edge->ReadDescr( Line, File, LineNum ); edge->SetDrawCoord(); break; - case 'C': /* Lecture de la doc */ + case 'C': /* read documentation data */ m_Doc = CONV_FROM_UTF8( StrPurge( PtLine ) ); break; - case 'K': /* Lecture de la liste des mots cle */ + case 'K': /* Read key words */ m_KeyWord = CONV_FROM_UTF8( StrPurge( PtLine ) ); 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: break; } } - /* Recalculate the bounding box */ Set_Rectangle_Encadrement(); return 0; @@ -613,9 +637,9 @@ void MODULE::Set_Rectangle_Encadrement() * en coord relatives / position ancre */ { - int width; - int cx, cy, uxf, uyf, rayon; - int xmax, ymax; + int width; + int cx, cy, uxf, uyf, rayon; + int xmax, ymax; /* Init des pointeurs */ @@ -689,9 +713,9 @@ void MODULE::SetRectangleExinscrit() * Met egalement a jour la surface (.m_Surface) du module. */ { - int width; - int cx, cy, uxf, uyf, rayon; - int xmax, ymax; + int width; + int cx, cy, uxf, uyf, rayon; + int xmax, ymax; m_RealBoundaryBox.m_Pos.x = xmax = m_Pos.x; m_RealBoundaryBox.m_Pos.y = ymax = m_Pos.y; @@ -763,10 +787,10 @@ EDA_Rect MODULE::GetBoundingBox() { // Calculate area without text fields: SetRectangleExinscrit(); - EDA_Rect area = m_RealBoundaryBox; + EDA_Rect area = m_RealBoundaryBox; // Calculate extended area including text field: - EDA_Rect text_area; + EDA_Rect text_area; text_area = m_Reference->GetBoundingBox(); area.Merge( text_area ); @@ -777,14 +801,14 @@ EDA_Rect MODULE::GetBoundingBox() { if( edge->Type() != TYPE_TEXTE_MODULE ) continue; - text_area = ((TEXTE_MODULE*)edge)->GetBoundingBox(); + text_area = ( (TEXTE_MODULE*) edge )->GetBoundingBox(); area.Merge( text_area ); } // 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) int biggest_clearance = GetBoard()->GetBiggestClearanceValue(); - area.Inflate(biggest_clearance); + area.Inflate( biggest_clearance ); return area; } @@ -793,9 +817,10 @@ EDA_Rect MODULE::GetBoundingBox() /*******************************************************/ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) /*******************************************************/ + /* Virtual function, from EDA_BaseStruct. * display module info on MsgPanel -*/ + */ { int nbpad; char bufcar[512], Line[512]; @@ -841,7 +866,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) msg.Printf( wxT( "%d" ), nbpad ); frame->AppendMsgPanel( _( "Pads" ), msg, BLUE ); - msg = wxT( ".." ); + msg = wxT( ".." ); if( IsLocked() ) msg[0] = 'L'; if( m_ModuleStatus & MODULE_is_PLACED ) @@ -856,7 +881,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) if( m_3D_Drawings != NULL ) msg = m_3D_Drawings->m_Shape3DName; else - msg = _("No 3D shape"); + msg = _( "No 3D shape" ); frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED ); wxString doc = _( "Doc: " ) + m_Doc; @@ -925,6 +950,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const if( buf == aPadName ) #endif + return pad; } @@ -941,7 +967,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, const KICAD_T* p = scanTypes; bool done = false; -#if 0 && defined (DEBUG) +#if 0 && defined(DEBUG) std::cout << GetClass().mb_str() << ' '; #endif @@ -970,7 +996,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, if( result == SEARCH_QUIT ) break; - // m_Drawings can hold TYPETEXTMODULE also, so fall thru + // m_Drawings can hold TYPETEXTMODULE also, so fall thru case TYPE_EDGE_MODULE: result = IterateForward( m_Drawings, inspector, testData, p ); @@ -1006,7 +1032,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, } -#if defined (DEBUG) +#if defined(DEBUG) /** * Function Show diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 049ff2e5d5..efc9e089c8 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -31,22 +31,22 @@ enum Mod_Attribut /* Attributs used for modules */ /* flags for autoplace and autoroute (.m_ModuleStatus member) */ -#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */ -#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */ -#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */ +#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */ +#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */ +#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */ class MODULE : public BOARD_ITEM { public: - wxPoint m_Pos; // Real coord on board - DLIST m_Pads; /* Pad list (linked list) */ - DLIST m_Drawings; /* Graphic items list (linked list) */ - DLIST m_3D_Drawings; /* First item of the 3D shapes (linked list)*/ - TEXTE_MODULE* m_Reference; // Component reference (U34, R18..) - 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_AlternateReference; /* Used when m_Reference cannot be used to - * identify the footprint ( after a full reannotation of the schematic */ + wxPoint m_Pos; // Real coord on board + DLIST m_Pads; /* Pad list (linked list) */ + DLIST m_Drawings; /* Graphic items list (linked list) */ + DLIST m_3D_Drawings; /* First item of the 3D shapes (linked list)*/ + TEXTE_MODULE* m_Reference; // Component reference (U34, R18..) + 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_AlternateReference; /* Used when m_Reference cannot be used to + * identify the footprint ( after a full reannotation of the schematic */ int m_Attributs; /* Flags(ORed bits) ( see Mod_Attribut ) */ int m_Orient; /* orientation in 0.1 degrees */ @@ -69,15 +69,24 @@ public: wxString m_Doc; // Module Description (info for users) 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: MODULE( BOARD* parent ); MODULE( MODULE* module ); ~MODULE(); - MODULE* Next() const { return (MODULE*) Pnext; } - MODULE* Back() const { return (MODULE*) Pback; } + MODULE* Next() const { return (MODULE*) Pnext; } + MODULE* Back() const { return (MODULE*) Pback; } - void Copy( MODULE* Module ); // Copy structure + void Copy( MODULE* Module ); // Copy structure /** @@ -85,7 +94,7 @@ public: * adds the given item to this MODULE and takes ownership of its memory. * @param aBoardItem The item to add to this board. * @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: * Function Set_Rectangle_Encadrement() * calculates the bounding box for orient 0 et origin = module anchor) */ - void Set_Rectangle_Encadrement(); + void Set_Rectangle_Encadrement(); /** function SetRectangleExinscrit() * Calculates the real bounding box accordint to theboard position, and real orientaion * and also calculates the area value (used in automatic placement) */ - void SetRectangleExinscrit(); + void SetRectangleExinscrit(); /** * Function GetBoundingBox @@ -121,14 +130,15 @@ public: // Moves - void SetPosition( const wxPoint& newpos ); - void SetOrientation( int newangle ); + void SetPosition( const wxPoint& newpos ); + void SetOrientation( int newangle ); + /** * Function Move * move 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 @@ -136,14 +146,14 @@ public: * @param const wxPoint& aRotCentre - the rotation point. * @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 * Flip this object, i.e. change the board side for this object * @param const wxPoint& aCentre - the rotation point. */ - virtual void Flip(const wxPoint& aCentre ); + virtual void Flip( const wxPoint& aCentre ); /** * Function IsLocked @@ -178,10 +188,10 @@ public: * @param aFile The FILE to write to. * @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 ReadDescr( FILE* File, int* LineNum = NULL ); + int Write_3D_Descr( FILE* File ) const; + int ReadDescr( FILE* File, int* LineNum = NULL ); /** * Function Read_GPCB_Descr @@ -190,10 +200,11 @@ public: * this is also the footprint name * @return bool - true if success reading else false. */ - bool Read_GPCB_Descr(const wxString & CmpFullFileName); - int Read_3D_Descr( FILE* File, int* LineNum = NULL ); + bool Read_GPCB_Descr( const wxString& CmpFullFileName ); + int Read_3D_Descr( FILE* File, int* LineNum = NULL ); /* drawing functions */ + /** Function Draw * Draw the text accordint to the footprint pos and orient * @param panel = draw panel, Used to know the clip box @@ -201,13 +212,16 @@ public: * @param offset = draw offset (usually wxPoint(0,0) * @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 DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC, - const wxPoint& offset, int draw_mode ); - void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, - const wxPoint& offset, int dim_ancre, int draw_mode ); + void Draw3D( Pcb3D_GLCanvas* glcanvas ); + void DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC, + const wxPoint& offset, int draw_mode ); + void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, + const wxPoint& offset, int dim_ancre, int draw_mode ); /** * Function DisplayInfo @@ -215,7 +229,7 @@ public: * about this object into the frame's message panel. * @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: * @param refPos A wxPoint to test * @return bool - true if a hit, else false */ - bool HitTest( const wxPoint& refPos ); + bool HitTest( const wxPoint& refPos ); /** @@ -233,7 +247,7 @@ public: * @param refArea : the given EDA_Rect * @return bool - true if a hit, else false */ - bool HitTest( EDA_Rect& refArea ); + bool HitTest( EDA_Rect& refArea ); /** * Function GetReference @@ -244,6 +258,7 @@ public: return m_Reference->m_Text; } + /** * Function GetValue * @return const wxString& - the value text. @@ -261,7 +276,7 @@ public: * @param * @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: } - #if defined (DEBUG) + #if defined(DEBUG) /** * Function Show diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 1a5fbea766..725baed273 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -10,6 +10,7 @@ #include "pcbnew.h" #include "trigo.h" #include "pcbnew_id.h" // ID_TRACK_BUTT +#include "class_board_design_settings.h" /*******************************/ @@ -18,22 +19,26 @@ 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_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) ) { m_Pos = ( (MODULE*) m_Parent )->GetPosition(); } - m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL PAD_TRAPEZOID - m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN - m_DrillShape = PAD_CIRCLE; // Drill shape = circle + m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL PAD_TRAPEZOID + m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN + 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 - SetSubRatsnest( 0 ); // used in ratsnest calculations + SetSubRatsnest( 0 ); // used in ratsnest calculations ComputeRayon(); } @@ -63,7 +68,7 @@ void D_PAD::ComputeRayon() case PAD_RECT: case PAD_TRAPEZOID: 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; } } @@ -161,9 +166,11 @@ void D_PAD::SetPadName( const wxString& name ) m_Padname[ii] = 0; } + /**************************************************/ -void D_PAD::SetNetname( const wxString & aNetname ) +void D_PAD::SetNetname( const wxString& aNetname ) /**************************************************/ + /** * Function SetNetname * @param const wxString : the new netname @@ -191,11 +198,14 @@ void D_PAD::Copy( D_PAD* source ) m_Offset = source->m_Offset; // Offset de la forme m_Size = source->m_Size; // Dimension ( pour orient 0 ) 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_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_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 ); SetSubNet( 0 ); @@ -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 ) /*************************************************/ @@ -231,11 +310,12 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) PtLine = Line + 3; - /* Pointe 1er code utile de la ligne */ + /* Decode the first code and read the corresponding data + */ switch( Line[0] ) { - case 'S': /* Ligne de description de forme et dims*/ - /* Lecture du nom pad */ + case 'S': // = Sh + /* Read pad name */ nn = 0; while( (*PtLine != '"') && *PtLine ) PtLine++; @@ -260,13 +340,13 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) PtLine++; nn = sscanf( PtLine, " %s %d %d %d %d %d", - BufCar, &m_Size.x, &m_Size.y, - &m_DeltaSize.x, &m_DeltaSize.y, - &m_Orient ); + BufCar, &m_Size.x, &m_Size.y, + &m_DeltaSize.x, &m_DeltaSize.y, + &m_Orient ); ll = 0xFF & BufCar[0]; - /* Mise a jour de la forme */ + /*Read pad shape */ m_PadShape = PAD_CIRCLE; switch( ll ) @@ -290,7 +370,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) case 'D': BufCar[0] = 0; 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_DrillShape = PAD_CIRCLE; @@ -306,11 +386,10 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) case 'A': nn = sscanf( PtLine, "%s %s %X", BufLine, BufCar, - &m_Masque_Layer ); + &m_Masque_Layer ); - /* Contenu de BufCar non encore utilise ( reserve pour evolutions - * ulterieures */ - /* Mise a jour de l'attribut */ + /* BufCar is not used now */ + /* update attributes */ m_Attribut = PAD_STANDARD; if( strncmp( BufLine, "SMD", 3 ) == 0 ) m_Attribut = PAD_SMD; @@ -320,14 +399,14 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) m_Attribut = PAD_HOLE_NOT_PLATED; break; - case 'N': /* Lecture du netname */ + case 'N': /* Read Netname */ int netcode; nn = sscanf( PtLine, "%d", &netcode ); SetNet( netcode ); - /* Lecture du netname */ + /* read Netname */ ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) ); - SetNetname(CONV_FROM_UTF8( StrPurge( BufLine ) )); + SetNetname( CONV_FROM_UTF8( StrPurge( BufLine ) ) ); break; case 'P': @@ -335,6 +414,15 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) m_Pos = m_Pos0; 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: DisplayError( NULL, wxT( "Err Pad: Id inconnu" ) ); return 1; @@ -352,14 +440,9 @@ bool D_PAD::Save( FILE* aFile ) const int cshape; const char* texttype; - if( GetState( DELETED ) ) - return true; - - bool rc = false; - // check the return values for first and last fprints() in this function if( fprintf( aFile, "$PAD\n" ) != sizeof("$PAD\n") - 1 ) - goto out; + return false; switch( m_PadShape ) { @@ -382,8 +465,8 @@ bool D_PAD::Save( FILE* aFile ) const } fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n", - m_Padname, cshape, m_Size.x, m_Size.y, - m_DeltaSize.x, m_DeltaSize.y, m_Orient ); + m_Padname, cshape, m_Size.x, m_Size.y, + m_DeltaSize.x, m_DeltaSize.y, m_Orient ); fprintf( aFile, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y ); if( m_DrillShape == PAD_OVAL ) @@ -418,13 +501,17 @@ bool D_PAD::Save( FILE* aFile ) const fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y ); + 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); + if( fprintf( aFile, "$EndPAD\n" ) != sizeof("$EndPAD\n") - 1 ) - goto out; + return false; - rc = true; - -out: - return rc; + return true; } @@ -551,7 +638,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) if( attribut > 3 ) attribut = 3; frame->AppendMsgPanel( Msg_Pad_Shape[m_PadShape], - Msg_Pad_Attribut[attribut], DARKGREEN ); + Msg_Pad_Attribut[attribut], DARKGREEN ); valeur_param( m_Size.x, Line ); frame->AppendMsgPanel( _( "H Size" ), Line, RED ); @@ -577,7 +664,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) int module_orient = module ? module->m_Orient : 0; if( module_orient ) 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 Line.Printf( wxT( "%3.1f" ), (float) m_Orient / 10 ); frame->AppendMsgPanel( _( "Orient" ), Line, BLUE ); @@ -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? static const char* ShowPadType( int aPadType ) diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index fd0cf84baa..78808b8f0e 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -9,8 +9,10 @@ class Pcb3D_GLCanvas; /* Default layers used for pads, accordint to the pad type. * this is default values only, they can be changed for a given pad */ + // 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: #define PAD_CONN_DEFAULT_LAYERS CMP_LAYER | SOLDERPASTE_LAYER_CMP | SOLDERMASK_LAYER_CMP @@ -19,7 +21,8 @@ class Pcb3D_GLCanvas; #define PAD_SMD_DEFAULT_LAYERS CMP_LAYER | SOLDERMASK_LAYER_CMP //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 */ @@ -74,8 +77,19 @@ public: int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN 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: - 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 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 */ int ReadDescr( FILE* File, int* LineNum = NULL ); @@ -222,11 +259,12 @@ public: * move 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; } + #if defined(DEBUG) /** diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 74344665a0..1889ed17f5 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -16,7 +16,7 @@ /*******************************************************************************************/ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, - const wxPoint& offset ) + const wxPoint& offset ) /*******************************************************************************************/ /** Draw a pad: @@ -36,7 +36,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, wxPoint coord[4]; int fillpad = 0; 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 ) return; @@ -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 - // 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( IsOnLayer( 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 // shows the pad size with the mask clearance switch( screen->m_Active_Layer ) { case SOLDERMASK_N_CU: 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; default: @@ -232,9 +238,9 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, { case PAD_CIRCLE: 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 - 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 ) { @@ -254,13 +260,13 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, { delta_cx = dx - dy; delta_cy = 0; - rotdx = m_Size.y; + rotdx = m_Size.y + (mask_margin.y*2); } else /* ellipse verticale */ { delta_cx = 0; delta_cy = dy - dx; - rotdx = m_Size.x; + rotdx = m_Size.x + (mask_margin.x*2); } RotatePoint( &delta_cx, &delta_cy, angle ); @@ -269,14 +275,14 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, GRFillCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy, ux0 - delta_cx, uy0 - delta_cy, - rotdx + mask_margin, color ); + rotdx, color ); } else { GRCSegm( &panel->m_ClipBox, DC, ux0 + delta_cx, uy0 + delta_cy, ux0 - delta_cx, uy0 - delta_cy, - rotdx + mask_margin, color ); + rotdx, color ); } /* Trace de la marge d'isolement */ @@ -297,17 +303,17 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ddx = (m_DeltaSize.x >> 1); ddy = (m_DeltaSize.y >> 1); /* demi dim dx et dy */ - coord[0].x = -dx - ddy - mask_margin; - coord[0].y = +dy + ddx + mask_margin; + coord[0].x = -dx - ddy - mask_margin.x; + coord[0].y = +dy + ddx + mask_margin.y; - coord[1].x = -dx + ddy - mask_margin; - coord[1].y = -dy - ddx - mask_margin; + coord[1].x = -dx + ddy - mask_margin.x; + coord[1].y = -dy - ddx - mask_margin.y; - coord[2].x = +dx - ddy + mask_margin; - coord[2].y = -dy + ddx - mask_margin; + coord[2].x = +dx - ddy + mask_margin.x; + coord[2].y = -dy + ddx - mask_margin.y; - coord[3].x = +dx + ddy + mask_margin; - coord[3].y = +dy - ddx + mask_margin; + coord[3].x = +dx + ddy + mask_margin.x; + coord[3].y = +dy - ddx + mask_margin.y; for( ii = 0; ii < 4; ii++ ) { @@ -320,8 +326,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, if( DisplayIsol ) { - dx += padClearance - mask_margin; - dy += padClearance - mask_margin; + dx += padClearance; + dy += padClearance; coord[0].x = -dx - ddy; coord[0].y = dy + ddx; diff --git a/pcbnew/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialog_edit_module_for_BoardEditor.cpp index 543ed3a892..4b5310569e 100644 --- a/pcbnew/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialog_edit_module_for_BoardEditor.cpp @@ -19,13 +19,13 @@ /**************************************************************************************/ 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 ) /**************************************************************************************/ { m_Parent = aParent; - m_DC = aDC; - m_CurrentModule = aModule; + m_DC = aDC; + m_CurrentModule = aModule; SetIcon( wxICON( icon_modedit ) ); // Give an icon @@ -37,6 +37,7 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( WinEDA_PcbFrame* aParent Centre(); } + DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() { for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ ) @@ -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 */ { - PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x, PCB_INTERNAL_UNIT ); - AddUnitSymbol( *XPositionStatic, g_UnitMetric ); + PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x, PCB_INTERNAL_UNIT ); + AddUnitSymbol( *XPositionStatic, g_UnitMetric ); - PutValueInLocalUnits( *m_ModPositionY, m_CurrentModule->GetPosition().y, PCB_INTERNAL_UNIT ); - AddUnitSymbol( *YPositionStatic, g_UnitMetric ); + PutValueInLocalUnits( *m_ModPositionY, m_CurrentModule->GetPosition().y, PCB_INTERNAL_UNIT ); + 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; - switch( m_CurrentModule->m_Orient ) - { - case 0: - m_OrientCtrl->SetSelection( 0 ); - break; + bool select = FALSE; + switch( m_CurrentModule->m_Orient ) + { + case 0: + m_OrientCtrl->SetSelection( 0 ); + break; - case 900: - case -2700: - m_OrientCtrl->SetSelection( 1 ); - break; + case 900: + case - 2700: + m_OrientCtrl->SetSelection( 1 ); + break; - case -900: - case 2700: - m_OrientCtrl->SetSelection( 2 ); - break; + case - 900: + case 2700: + m_OrientCtrl->SetSelection( 2 ); + break; - case -1800: - case 1800: - m_OrientCtrl->SetSelection( 3 ); - break; + case - 1800: + case 1800: + m_OrientCtrl->SetSelection( 3 ); + break; - default: - m_OrientCtrl->SetSelection( 4 ); - select = TRUE; - break; - } - wxString msg; - msg << m_CurrentModule->m_Orient; - m_OrientValue->SetValue( msg ); - m_OrientValue->Enable( select ); - } + default: + m_OrientCtrl->SetSelection( 4 ); + select = TRUE; + break; + } + 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 ); @@ -185,18 +200,18 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() { if( !draw3D->m_Shape3DName.IsEmpty() ) { - S3D_MASTER* draw3DCopy = new S3D_MASTER(NULL); + S3D_MASTER* draw3DCopy = new S3D_MASTER( NULL ); draw3DCopy->Copy( draw3D ); 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(); } - m_ReferenceCopy = new TEXTE_MODULE(NULL); - m_ValueCopy = new TEXTE_MODULE(NULL); - m_ReferenceCopy->Copy(m_CurrentModule->m_Reference); - m_ValueCopy->Copy(m_CurrentModule->m_Value); + m_ReferenceCopy = new TEXTE_MODULE( NULL ); + m_ValueCopy = new TEXTE_MODULE( NULL ); + m_ReferenceCopy->Copy( m_CurrentModule->m_Reference ); + m_ValueCopy->Copy( m_CurrentModule->m_Value ); m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text ); m_ValueCtrl->SetValue( m_ValueCopy->m_Text ); @@ -259,7 +274,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() /* 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 ) { @@ -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 * @param aIndexSelection = item index in m_Shapes3D_list */ void DIALOG_MODULE_BOARD_EDITOR::TransfertDisplayTo3DValues( int aIndexSelection ) { - if( aIndexSelection >= (int)m_Shapes3D_list.size() ) + if( aIndexSelection >= (int) m_Shapes3D_list.size() ) return; - S3D_MASTER * struct3DDest = m_Shapes3D_list[aIndexSelection]; + S3D_MASTER* struct3DDest = m_Shapes3D_list[aIndexSelection]; struct3DDest->m_MatScale = m_3D_Scale->GetValue(); struct3DDest->m_MatRotation = m_3D_Rotation->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 ) @@ -300,26 +317,28 @@ void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected(wxCommandEvent& event) m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetSelection(); 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() ) { - wxMessageBox(wxT("On3DShapeNameSelected() error")); + wxMessageBox( wxT( "On3DShapeNameSelected() error" ) ); m_LastSelected3DShapeIndex = -1; return; } Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] ); } + /***********************************************************/ -void DIALOG_MODULE_BOARD_EDITOR::Add3DShape(wxCommandEvent& event) +void DIALOG_MODULE_BOARD_EDITOR::Add3DShape( wxCommandEvent& event ) /***********************************************************/ { Browse3DLib( event ); } + /***********************************************************/ -void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape(wxCommandEvent& event) +void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event ) /***********************************************************/ { if( m_LastSelected3DShapeIndex >= 0 ) @@ -329,15 +348,15 @@ void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape(wxCommandEvent& event) if( ii < 0 ) return; - m_Shapes3D_list.erase(m_Shapes3D_list.begin() + ii ); - m_3D_ShapeNameListBox->Delete(ii); + m_Shapes3D_list.erase( m_Shapes3D_list.begin() + ii ); + m_3D_ShapeNameListBox->Delete( ii ); - if( m_3D_ShapeNameListBox->GetCount() == 0) + if( m_3D_ShapeNameListBox->GetCount() == 0 ) Transfert3DValuesToDisplay( NULL ); else { m_LastSelected3DShapeIndex = 0; - m_3D_ShapeNameListBox->SetSelection(m_LastSelected3DShapeIndex); + m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex ); Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] ); } } @@ -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 */ shortfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fullfilename ); - S3D_MASTER* new3DShape = new S3D_MASTER(NULL); + S3D_MASTER* new3DShape = new S3D_MASTER( NULL ); new3DShape->m_Shape3DName = shortfilename; m_Shapes3D_list.push_back( new3DShape ); m_3D_ShapeNameListBox->Append( shortfilename ); @@ -388,9 +407,8 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event ) TransfertDisplayTo3DValues( m_LastSelected3DShapeIndex ); 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] ); - } @@ -398,8 +416,9 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) /******************************************************************************/ { - bool change_layer = FALSE; + bool change_layer = FALSE; wxPoint modpos; + wxString msg; if( m_CurrentModule->m_Flags == 0 ) // this is a simple edition, we must create an undo entry m_Parent->SaveCopyInUndoList( m_CurrentModule, UR_CHANGED ); @@ -410,14 +429,27 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) 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 modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT ); modpos.y = ReturnValueFromTextCtrl( *m_ModPositionY, PCB_INTERNAL_UNIT ); - m_CurrentModule->SetPosition(modpos); + m_CurrentModule->SetPosition( modpos ); - // Set orienta tion - long orient = 0; - wxString msg = m_OrientValue->GetValue(); + // Set orientation + long orient = 0; + msg = m_OrientValue->GetValue(); msg.ToLong( &orient ); if( m_CurrentModule->m_Orient != 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 ) change_layer = TRUE; if( change_layer ) - m_CurrentModule->Flip(m_CurrentModule->m_Pos); + m_CurrentModule->Flip( m_CurrentModule->m_Pos ); if( m_AutoPlaceCtrl->GetSelection() == 1 ) m_CurrentModule->m_ModuleStatus |= MODULE_is_LOCKED; @@ -457,17 +489,17 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) m_CurrentModule->m_CntRot180 = m_CostRot180Ctrl->GetValue(); // Init Fields: - m_CurrentModule->m_Reference->Copy(m_ReferenceCopy ); - m_CurrentModule->m_Value->Copy(m_ValueCopy ); + m_CurrentModule->m_Reference->Copy( m_ReferenceCopy ); + m_CurrentModule->m_Value->Copy( m_ValueCopy ); /* Update 3D shape list */ - int ii = m_3D_ShapeNameListBox->GetSelection(); - if ( ii >= 0 ) + int ii = m_3D_ShapeNameListBox->GetSelection(); + if( ii >= 0 ) 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++ ) { - S3D_MASTER* draw3DCopy = m_Shapes3D_list[ii]; + S3D_MASTER* draw3DCopy = m_Shapes3D_list[ii]; if( draw3DCopy->m_Shape3DName.IsEmpty() ) continue; if( draw3D == NULL ) @@ -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; + 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->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; + 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->GetScreen()->m_Curseur = tmp; - m_ValueCtrl->SetValue(m_ValueCopy->m_Text); + m_ValueCtrl->SetValue( m_ValueCopy->m_Text ); } - diff --git a/pcbnew/dialog_edit_module_for_BoardEditor_base.cpp b/pcbnew/dialog_edit_module_for_BoardEditor_base.cpp index a42cab0dab..e931f0ab43 100644 --- a/pcbnew/dialog_edit_module_for_BoardEditor_base.cpp +++ b/pcbnew/dialog_edit_module_for_BoardEditor_base.cpp @@ -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_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") }; 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->SetSelection( 0 ); + m_AttributsCtrl->SetSelection( 1 ); m_PropRightSizer->Add( m_AttributsCtrl, 0, wxALL|wxEXPAND, 5 ); wxString m_AutoPlaceCtrlChoices[] = { _("Free"), _("Locked") }; @@ -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 ); 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->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 ); - 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->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 ); - 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 ); + 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_PanelProperties->SetSizer( m_PanelPropertiesBoxSizer ); diff --git a/pcbnew/dialog_edit_module_for_BoardEditor_base.fbp b/pcbnew/dialog_edit_module_for_BoardEditor_base.fbp index 49f2a1fe2a..4c349489b5 100644 --- a/pcbnew/dialog_edit_module_for_BoardEditor_base.fbp +++ b/pcbnew/dialog_edit_module_for_BoardEditor_base.fbp @@ -32,7 +32,7 @@ DIALOG_MODULE_BOARD_EDITOR_BASE - 422,583 + 474,583 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Module properties @@ -999,16 +999,6 @@ - - 5 - - 0 - - 20 - protected - 0 - - 5 wxALL|wxEXPAND @@ -1029,7 +1019,7 @@ m_AttributsCtrl protected - 0 + 1 wxRA_SPECIFY_COLS @@ -1126,25 +1116,307 @@ Auto Move and Place sbSizerAutoplace + wxHORIZONTAL + none + + + 5 + wxEXPAND + 1 + + + bSizerRotOpt + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Rotation 90 degree + + + m_staticText11 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + 10 + + 0 + + m_CostRot90Ctrl + protected + + + wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerMoveOpt + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Rotation 180 degree + + + m_staticText12 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + 10 + + 0 + + m_CostRot180Ctrl + protected + + + wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + wxID_ANY + Masks clearances local values: + + sbSizerLocalProperties wxVERTICAL none 5 - wxTOP|wxRIGHT|wxLEFT + wxALL|wxALIGN_RIGHT 0 1 - + ,90,92,-1,70,0 0 wxID_ANY - Rotation 90 degree + Set these values to 0 to use global values - m_staticText11 + m_staticTextInfo protected @@ -1182,197 +1454,491 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - 10 - - 0 + wxEXPAND + 1 + + 3 + wxBOTH + + + 0 - m_CostRot90Ctrl - protected - - - wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Rotation 180 degree - - - m_staticText12 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - 10 - - 0 - - m_CostRot180Ctrl - protected - - - wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + fgSizerClearances + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 0 + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Solder mask clearance: + + + m_MaskClearanceTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderMaskMarginCtrl + protected + + + + + This is the global clearance between pads and the solder mask This value can be superseded by a pad local value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Inch + + + m_SolderMaskMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Solder paste clearance: + + + m_staticTextSolderPaste + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderPasteMarginCtrl + protected + + + + + This is the global clearance between pads and the solder paste This value can be superseded by a pad local values. The final clearance value is the sum of this value and the clearance value ratio A negative value means a smaller mask size than pad size + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Inch + + + m_SolderPasteMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Solder mask ratio clearance: + + + m_staticTextRatio + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderPasteMarginRatioCtrl + protected + + + + + This is the global clearance ratio in per cent between pads and the solder paste A value of 10 means the clearance value is 10% of the pad size This value can be superseded by a pad local value. The final clearance value is the sum of this value and the clearance value A negative value means a smaller mask size than pad size + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + % + + + m_SolderPasteRatioMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialog_edit_module_for_BoardEditor_base.h b/pcbnew/dialog_edit_module_for_BoardEditor_base.h index 524638533d..166466c20f 100644 --- a/pcbnew/dialog_edit_module_for_BoardEditor_base.h +++ b/pcbnew/dialog_edit_module_for_BoardEditor_base.h @@ -66,13 +66,22 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog wxTextCtrl* m_ModPositionY; wxButton* m_buttonExchange; wxButton* m_buttonModuleEditor; - wxRadioBox* m_AttributsCtrl; wxRadioBox* m_AutoPlaceCtrl; wxStaticText* m_staticText11; wxSlider* m_CostRot90Ctrl; wxStaticText* m_staticText12; 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; wxStaticText* m_staticText3Dname; wxListBox* m_3D_ShapeNameListBox; @@ -99,7 +108,7 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog public: 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(); }; diff --git a/pcbnew/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialog_edit_module_for_Modedit.cpp index d4a2ff6779..b4abb99694 100644 --- a/pcbnew/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialog_edit_module_for_Modedit.cpp @@ -132,6 +132,21 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties() BoxSizer = new wxBoxSizer( wxVERTICAL ); m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ), BoxSizer, 2, 1 ); 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 ) m_CurrentModule->m_Reference->Copy(m_ReferenceCopy ); 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 */ int ii = m_3D_ShapeNameListBox->GetSelection(); if ( ii >= 0 ) diff --git a/pcbnew/dialog_edit_module_for_Modedit_base.cpp b/pcbnew/dialog_edit_module_for_Modedit_base.cpp index 20f013f915..5b647d0108 100644 --- a/pcbnew/dialog_edit_module_for_Modedit_base.cpp +++ b/pcbnew/dialog_edit_module_for_Modedit_base.cpp @@ -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 ); 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->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 ); - 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->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 ); - 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 ); + 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_PanelProperties->SetSizer( m_PanelPropertiesBoxSizer ); diff --git a/pcbnew/dialog_edit_module_for_Modedit_base.fbp b/pcbnew/dialog_edit_module_for_Modedit_base.fbp index 65893dd1f6..f8efb54651 100644 --- a/pcbnew/dialog_edit_module_for_Modedit_base.fbp +++ b/pcbnew/dialog_edit_module_for_Modedit_base.fbp @@ -32,7 +32,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE - 422,422 + 422,549 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Module properties @@ -706,25 +706,307 @@ Auto Move and Place sbSizerAutoplace + wxHORIZONTAL + none + + + 5 + wxEXPAND + 1 + + + bSizerRot90 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Rotation 90 degree + + + m_staticText11 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + 10 + + 0 + + m_CostRot90Ctrl + protected + + + wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerRot180 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Rotation 180 degree + + + m_staticText12 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + 10 + + 0 + + m_CostRot180Ctrl + protected + + + wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + wxID_ANY + Masks clearances local values: + + sbSizer8 wxVERTICAL none 5 - wxTOP|wxRIGHT|wxLEFT + wxALL|wxALIGN_RIGHT 0 1 - + ,90,92,-1,70,0 0 wxID_ANY - Rotation 90 degree + Set these values to 0 to use global values - m_staticText11 + m_staticTextInfo protected @@ -762,197 +1044,491 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - 10 - - 0 + wxEXPAND + 1 + + 3 + wxBOTH + + + 0 - m_CostRot90Ctrl - protected - - - wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Rotation 180 degree - - - m_staticText12 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - 10 - - 0 - - m_CostRot180Ctrl - protected - - - wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 0 + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Solder mask clearance: + + + m_MaskClearanceTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderMaskMarginCtrl + protected + + + + + This is the global clearance between pads and the solder mask This value can be superseded by a pad local value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + inch + + + m_SolderMaskMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Solder paste clearance: + + + m_staticTextSolderPaste + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderPasteMarginCtrl + protected + + + + + This is the global clearance between pads and the solder paste This value can be superseded by a pad local values. The final clearance value is the sum of this value and the clearance value ratio A negative value means a smaller mask size than pad size + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Inch + + + m_SolderPasteMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Solder mask ratio clearance: + + + m_staticTextRatio + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderPasteMarginRatioCtrl + protected + + + + + This is the global clearance ratio in per cent between pads and the solder paste A value of 10 means the clearance value is 10% of the pad size This value can be superseded by a pad local value. The final clearance value is the sum of this value and the clearance value A negative value means a smaller mask size than pad size + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + % + + + m_SolderPasteRatioMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialog_edit_module_for_Modedit_base.h b/pcbnew/dialog_edit_module_for_Modedit_base.h index 685d76de1e..b1f325243c 100644 --- a/pcbnew/dialog_edit_module_for_Modedit_base.h +++ b/pcbnew/dialog_edit_module_for_Modedit_base.h @@ -62,6 +62,16 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public wxDialog wxSlider* m_CostRot90Ctrl; wxStaticText* m_staticText12; 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; wxStaticText* m_staticText3Dname; wxListBox* m_3D_ShapeNameListBox; @@ -85,7 +95,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public wxDialog public: 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(); }; diff --git a/pcbnew/dialog_mask_clearance.cpp b/pcbnew/dialog_mask_clearance.cpp index 6faa59bba5..7137ef3ae8 100644 --- a/pcbnew/dialog_mask_clearance.cpp +++ b/pcbnew/dialog_mask_clearance.cpp @@ -1,4 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// + // Name: dialog_mask_clearance.cpp // Author: jean-pierre Charras // Modified by: @@ -34,10 +35,19 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() { SetFocus(); - AddUnitSymbol( *m_MaskClearanceTitle ); + m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); + m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UnitMetric ) ); 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() void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event ) /*******************************************************************/ { - g_DesignSettings.m_MaskMargin = - ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits ); + g_DesignSettings.m_SolderMaskMargin = + 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 ); } @@ -60,4 +80,3 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event ) { EndModal( 0 ); } - diff --git a/pcbnew/dialog_mask_clearance_base.cpp b/pcbnew/dialog_mask_clearance_base.cpp index bb7d8c2e21..5384e4207d 100644 --- a/pcbnew/dialog_mask_clearance_base.cpp +++ b/pcbnew/dialog_mask_clearance_base.cpp @@ -27,14 +27,58 @@ DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* pare wxStaticBoxSizer* sbMiddleRightSizer; 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 ); - sbMiddleRightSizer->Add( m_MaskClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + fgGridSolderMaskSizer->Add( m_MaskClearanceTitle, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_OptMaskMargin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_OptMaskMargin->SetToolTip( _("This is the clearance between pads and the mask") ); + 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.") ); - sbMiddleRightSizer->Add( m_OptMaskMargin, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + 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_SolderPasteRatioMarginUnits = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SolderPasteRatioMarginUnits->Wrap( -1 ); + fgGridSolderMaskSizer->Add( m_SolderPasteRatioMarginUnits, 0, wxALL, 5 ); + + sbMiddleRightSizer->Add( fgGridSolderMaskSizer, 1, wxEXPAND, 5 ); bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 ); diff --git a/pcbnew/dialog_mask_clearance_base.fbp b/pcbnew/dialog_mask_clearance_base.fbp index f9c5479b8a..27ed15f354 100644 --- a/pcbnew/dialog_mask_clearance_base.fbp +++ b/pcbnew/dialog_mask_clearance_base.fbp @@ -32,7 +32,7 @@ DIALOG_PADS_MASK_CLEARANCE_BASE - 256,117 + 358,237 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Pads Mask Clearance @@ -98,7 +98,7 @@ 5 - wxTOP|wxRIGHT|wxLEFT + wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT 0 @@ -108,10 +108,10 @@ 0 wxID_ANY - Pads Mask Clearance: + Note: - a positive value means a mask bigger than a pad - a negative value means a mask smaller than a pad - m_MaskClearanceTitle + m_staticTextInfo protected @@ -149,9 +149,9 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + wxEXPAND | wxALL 0 - + 1 @@ -160,16 +160,14 @@ 0 wxID_ANY - 0 - m_OptMaskMargin + m_staticline1 protected - + wxLI_HORIZONTAL - This is the clearance between pads and the mask - + @@ -195,13 +193,498 @@ - - - - + + 5 + wxEXPAND + 1 + + 3 + wxBOTH + + + 0 + + fgGridSolderMaskSizer + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + Solder mask clearance: + + + m_MaskClearanceTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderMaskMarginCtrl + protected + + + + + This is the global clearance between pads and the solder mask This value can be superseded by local values for a footprint or a pad. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + Inch + + + m_SolderMaskMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Solder paste clearance: + + + m_staticTextSolderPaste + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderPasteMarginCtrl + protected + + + + + This is the global clearance between pads and the solder paste This value can be superseded by local values for a footprint or a pad. The final clearance value is the sum of this value and the clearance value ratio + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + Inch + + + m_SolderPasteMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Solder mask ratio clearance: + + + m_staticTextRatio + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_SolderPasteMarginRatioCtrl + protected + + + + + This is the global clearance ratio in per cent between pads and the solder paste A value of 10 means the clearance value is 10% of the pad size This value can be superseded by local values for a footprint or a pad. The final clearance value is the sum of this value and the clearance value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + % + + + m_SolderPasteRatioMarginUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialog_mask_clearance_base.h b/pcbnew/dialog_mask_clearance_base.h index 9f5d669aa6..b789fd1ae8 100644 --- a/pcbnew/dialog_mask_clearance_base.h +++ b/pcbnew/dialog_mask_clearance_base.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -38,8 +39,17 @@ class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog protected: + wxStaticText* m_staticTextInfo; + wxStaticLine* m_staticline1; 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; wxButton* m_sdbButtonsSizerOK; wxButton* m_sdbButtonsSizerCancel; @@ -50,7 +60,7 @@ class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog 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(); }; diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 7e861f1e00..3ff5954ca7 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -556,9 +556,20 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) } if( stricmp( Line, "Pad2MaskClearance" ) == 0 ) { - g_DesignSettings.m_MaskMargin = atoi( data ); + g_DesignSettings.m_SolderMaskMargin = atoi( data ); 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 } @@ -658,7 +669,11 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) 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, "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", aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y ); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index f78b879018..e1330a9f9b 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -88,6 +88,9 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) 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 */ GetLine( file, Line, &NbLine ); if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) @@ -124,6 +127,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) module->ReadDescr( file, &NbLine ); fclose( file ); } + SetLocaleTo_Default( ); // revert to the current locale /* Insert footprint in list*/ GetBoard()->Add( module ); @@ -197,6 +201,9 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) 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 ) ); fputs( "$INDEX\n", file ); @@ -207,6 +214,8 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) fputs( "$EndLIBRARY\n", file ); fclose( file ); + SetLocaleTo_Default( ); // revert to the current locale + msg.Printf( _( "Module exported in file <%s>" ), GetChars( fn.GetFullPath() ) ); DisplayInfoMessage( this, msg ); } @@ -605,6 +614,9 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName, 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 */ fprintf( dest, ENTETE_LIBRAIRIE ); fprintf( dest, " %s\n$INDEX\n", DateAndTime( Line ) ); @@ -665,6 +677,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName, aModule->m_TimeStamp = tmp; fclose( dest ); fclose( lib_module ); + SetLocaleTo_Default( ); // revert to the current locale wxEndBusyCursor(); diff --git a/pcbnew/pcbnew_config.h b/pcbnew/pcbnew_config.h index 3c21cf6312..55656d490b 100644 --- a/pcbnew/pcbnew_config.h +++ b/pcbnew/pcbnew_config.h @@ -623,10 +623,10 @@ static PARAM_CFG_INT HPGLrecouvrementCfg static PARAM_CFG_INT VernisEpargneGardeCfg ( - wxT( "VEgarde" ), /* Keyword */ - &g_DesignSettings.m_MaskMargin, /* Parameter address */ - 100, /* Default value */ - 0, 0xFFFF /* Min and max values*/ + wxT( "VEgarde" ), /* Keyword */ + &g_DesignSettings.m_SolderMaskMargin, /* Parameter address */ + 100, /* Default value */ + 0, 10000 /* Min and max values*/ ); static PARAM_CFG_INT DrawSegmLargeurCfg diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index da4c4c3abe..ead3eca750 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -16,7 +16,7 @@ #include "class_board_design_settings.h" -/* Fonctions locales */ +/* Local functions */ static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer, GRTraceMode trace_mode ); static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, @@ -27,7 +27,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, 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; wxSize size; @@ -36,7 +37,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, TEXTE_MODULE* pt_texte; 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() ) { @@ -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 ); - /* Trace des MODULES : PADS */ + /* Plot pads (creates pads outlines, for pads on silkscreen layers) */ if( g_pcb_plot_options.PlotPadsOnSilkLayer || g_pcb_plot_options.Plot_Pads_All_Layers ) { @@ -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() ) { - /* Tst si layer OK */ + /* Seen if the pad is on this layer */ if( (pt_pad->m_Masque_Layer & masque_layer) == 0 /* Copper pads go on copper silk, component @@ -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() ) { - /* 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_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; unsigned textLayer = text->GetLayer(); @@ -175,7 +176,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, if( text->m_NoShow && !g_pcb_plot_options.Sel_Texte_Invisible ) trace_val = FALSE; - /* Trace effectif des textes */ + /* Plot text fields, if allowed */ if( trace_ref ) PlotTextModule( plotter, Module->m_Reference, trace_mode ); @@ -224,7 +225,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, 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() ) { if( ( ( 1 << seg->GetLayer() ) & masque_layer ) == 0 ) @@ -244,7 +245,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, wxPoint pos; int orient, thickness; - /* calcul des parametres du texte :*/ + /* calculate some text parameters :*/ size = pt_texte->m_Size; pos = pt_texte->m_Pos; @@ -337,11 +338,11 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer, PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode ); DrawTmp->m_Shape = S_SEGMENT; - /* Trace des 2 traits */ + radius = Mire->m_Size / 2; 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; dx2 = dx1; @@ -364,7 +365,7 @@ void PlotMirePcb( PLOTTER* plotter, MIREPCB* Mire, int masque_layer, void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int masque_layer, GRTraceMode trace_mode ) /**********************************************************************/ -/* Trace les contours des modules */ +/* Plot footprints graphic items (outlines) */ { 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, void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge, 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 thickness; /* thickness des segments */ @@ -467,7 +468,7 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge, void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, 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; wxPoint pos; @@ -478,7 +479,6 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, if( (g_TabOneLayerMask[pt_texte->GetLayer()] & masque_layer) == 0 ) return; - /* calcul des parametres du texte :*/ size = pt_texte->m_Size; pos = pt_texte->m_Pos; orient = pt_texte->m_Orient; @@ -521,7 +521,6 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer, void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone, GRTraceMode trace_mode ) /*********************************************************/ - /* Plot areas (given by .m_FilledPolysList member) in a zone */ { @@ -697,7 +696,7 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer, case LAYER_N_14: case LAYER_N_15: 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: 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, case SOLDERMASK_N_CU: case SOLDERMASK_N_CMP: Plot_Standard_Layer( plotter, layer_mask, - g_DesignSettings.m_MaskMargin, g_pcb_plot_options.DrawViaOnMaskLayer, trace_mode ); break; case SOLDERPASTE_N_CU: case SOLDERPASTE_N_CMP: - Plot_Standard_Layer( plotter, layer_mask, 0, false, trace_mode ); + Plot_Standard_Layer( plotter, layer_mask, false, trace_mode ); break; default: @@ -730,13 +728,10 @@ void WinEDA_BasePcbFrame::Plot_Layer( PLOTTER* plotter, int Layer, } -/*********************************************************************/ -void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, - int masque_layer, - int garde, - bool trace_via, - GRTraceMode trace_mode ) -/*********************************************************************/ +/******************************************************************************/ +void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask, + bool aPlotVia, GRTraceMode aPlotMode ) +/*******************************************************************************/ /* Trace en format HPGL. d'une couche cuivre ou masque * 1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) . @@ -753,19 +748,19 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, switch( item->Type() ) { case TYPE_DRAWSEGMENT: - PlotDrawSegment( plotter, (DRAWSEGMENT*) item, masque_layer, trace_mode ); + PlotDrawSegment( aPlotter, (DRAWSEGMENT*) item, aLayerMask, aPlotMode ); break; case TYPE_TEXTE: - PlotTextePcb( plotter, (TEXTE_PCB*) item, masque_layer, trace_mode ); + PlotTextePcb( aPlotter, (TEXTE_PCB*) item, aLayerMask, aPlotMode ); break; case TYPE_COTATION: - PlotCotation( plotter, (COTATION*) item, masque_layer, trace_mode ); + PlotCotation( aPlotter, (COTATION*) item, aLayerMask, aPlotMode ); break; case TYPE_MIRE: - PlotMirePcb( plotter, (MIREPCB*) item, masque_layer, trace_mode ); + PlotMirePcb( aPlotter, (MIREPCB*) item, aLayerMask, aPlotMode ); break; case TYPE_MARKER_PCB: @@ -786,8 +781,8 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, switch( item->Type() ) { case TYPE_EDGE_MODULE: - if( masque_layer & g_TabOneLayerMask[ item->GetLayer() ] ) - Plot_1_EdgeModule( plotter, (EDGE_MODULE*) item, trace_mode ); + if( aLayerMask & g_TabOneLayerMask[ item->GetLayer() ] ) + Plot_1_EdgeModule( aPlotter, (EDGE_MODULE*) item, aPlotMode ); break; default: @@ -802,14 +797,30 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() ) { wxPoint shape_pos; - if( (pad->m_Masque_Layer & masque_layer) == 0 ) + if( (pad->m_Masque_Layer & aLayerMask) == 0 ) continue; shape_pos = pad->ReturnShapePos(); 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; - size.y = pad->m_Size.y + 2 * garde; + case SOLDERPASTE_LAYER_CMP: + 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 : */ if( size.x <= 0 || size.y <= 0 ) @@ -818,30 +829,30 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, switch( pad->m_PadShape ) { case PAD_CIRCLE: - plotter->flash_pad_circle( pos, size.x, trace_mode ); + aPlotter->flash_pad_circle( pos, size.x, aPlotMode ); break; 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; case PAD_TRAPEZOID: { 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; case PAD_RECT: default: - plotter->flash_pad_rect( pos, size, pad->m_Orient, trace_mode ); + aPlotter->flash_pad_rect( pos, size, pad->m_Orient, aPlotMode ); break; } } } /* Plot vias : */ - if( trace_via ) + if( aPlotVia ) { for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() ) { @@ -850,25 +861,29 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* plotter, SEGVIA* Via = (SEGVIA*) track; - // vias not plotted if not on selected layer, but if layer - // == SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn, - // if they are on a external copper layer + // vias are not plotted if not on selected layer, but if layer + // is SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP,vias are drawn, + // if they are on an external copper layer int via_mask_layer = Via->ReturnMaskLayer(); if( via_mask_layer & CUIVRE_LAYER ) via_mask_layer |= SOLDERMASK_LAYER_CU; if( via_mask_layer & CMP_LAYER ) via_mask_layer |= SOLDERMASK_LAYER_CMP; - if( ( via_mask_layer & masque_layer) == 0 ) + if( ( via_mask_layer & aLayerMask) == 0 ) 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; - 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 : */ if( size.x <= 0 ) 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, if( track->Type() == TYPE_VIA ) continue; - if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) + if( (g_TabOneLayerMask[track->GetLayer()] & aLayerMask) == 0 ) continue; size.x = size.y = track->m_Width; pos = track->m_Start; 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() ) { wxPoint end; - if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) + if( (g_TabOneLayerMask[track->GetLayer()] & aLayerMask) == 0 ) continue; size.x = size.y = track->m_Width; pos = track->m_Start; end = track->m_End; - plotter->thick_segment( pos, end, size.x, trace_mode ); + aPlotter->thick_segment( pos, end, size.x, aPlotMode ); } /* Plot filled ares */ for( int ii = 0; ii < m_Pcb->GetAreaCount(); 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; - PlotFilledAreas( plotter, edge_zone, trace_mode ); + PlotFilledAreas( aPlotter, edge_zone, aPlotMode ); } } @@ -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 * @param aPlotter = the PLOTTER * @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, bool aSmallDrillShape )