Commit b536b1cf authored by Marco Mattila's avatar Marco Mattila

Add module and pad local parameters for pad-zone connections (thermal, solid etc.) in pcbnew.

parent bcd66579
......@@ -68,6 +68,7 @@ MODULE::MODULE( BOARD* parent ) :
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_ZoneConnection = UNDEFINED_CONNECTION; // Use zone setting by default
m_Reference = new TEXTE_MODULE( this, TEXT_is_REFERENCE );
......@@ -101,6 +102,7 @@ MODULE::MODULE( const MODULE& aModule ) :
m_LocalSolderMaskMargin = aModule.m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aModule.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule.m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aModule.m_ZoneConnection;
// Copy reference and value.
m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
......@@ -216,6 +218,7 @@ void MODULE::Copy( MODULE* aModule )
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aModule->m_ZoneConnection;
// Copy reference and value.
m_Reference->Copy( aModule->m_Reference );
......
......@@ -38,7 +38,7 @@
#include <class_board_item.h>
#include <class_text_mod.h>
#include "zones.h"
class LINE_READER;
class EDA_3D_CANVAS;
......@@ -121,6 +121,8 @@ public:
///< value of pad size
// The final margin is the sum of these 2 values
ZoneConnection m_ZoneConnection;
public:
MODULE( BOARD* parent );
......@@ -193,6 +195,9 @@ public:
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; }
ZoneConnection GetZoneConnection() const { return m_ZoneConnection; }
int GetAttributes() const { return m_Attributs; }
void SetAttributes( int aAttributes ) { m_Attributs = aAttributes; }
......
......@@ -70,6 +70,7 @@ D_PAD::D_PAD( MODULE* parent ) :
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_ZoneConnection = UNDEFINED_CONNECTION; // Use parent setting by default
// set layers mask to default for a standard pad
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS;
......@@ -303,6 +304,7 @@ void D_PAD::Copy( D_PAD* source )
m_LocalSolderMaskMargin = source->m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = source->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = source->m_LocalSolderPasteMarginRatio;
m_ZoneConnection = source->m_ZoneConnection;
SetSubRatsnest( 0 );
SetSubNet( 0 );
......@@ -440,6 +442,17 @@ wxSize D_PAD::GetSolderPasteMargin()
}
ZoneConnection D_PAD::GetZoneConnection() const
{
MODULE* module = (MODULE*) GetParent();
if( m_ZoneConnection == UNDEFINED_CONNECTION && module )
return module->GetZoneConnection();
else
return m_ZoneConnection;
}
void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
{
MODULE* module;
......
......@@ -36,7 +36,7 @@
#include <pad_shapes.h>
#include <PolyLine.h>
#include <param_config.h> // PARAM_CFG_ARRAY
#include "zones.h"
class LINE_READER;
class EDA_3D_CANVAS;
......@@ -266,6 +266,9 @@ public:
*/
wxSize GetSolderPasteMargin();
void SetZoneConnection( ZoneConnection aType ) { m_ZoneConnection = aType; }
ZoneConnection GetZoneConnection() const;
/* Reading and writing data on files */
int ReadDescr( LINE_READER* aReader );
......@@ -530,6 +533,7 @@ private:
double m_LocalSolderPasteMarginRatio; ///< Local solder mask margin ratio value of pad size
///< The final margin is the sum of these 2 values
ZoneConnection m_ZoneConnection;
};
#endif // PAD_H_
......@@ -80,7 +80,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
m_priority = aZone.m_priority;
m_ArcToSegmentsCount = aZone.m_ArcToSegmentsCount;
m_PadOption = aZone.m_PadOption;
m_PadConnection = aZone.m_PadConnection;
m_ThermalReliefGap = aZone.m_ThermalReliefGap;
m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
m_FilledPolysList = aZone.m_FilledPolysList;
......@@ -856,7 +856,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
m_ZoneMinThickness = src->m_ZoneMinThickness;
m_FillMode = src->m_FillMode; // Filling mode (segments/polygons)
m_ArcToSegmentsCount = src->m_ArcToSegmentsCount;
m_PadOption = src->m_PadOption;
m_PadConnection = src->m_PadConnection;
m_ThermalReliefGap = src->m_ThermalReliefGap;
m_ThermalReliefCopperBridge = src->m_ThermalReliefCopperBridge;
m_Poly->m_HatchStyle = src->m_Poly->GetHatchStyle();
......@@ -882,6 +882,16 @@ bool ZONE_CONTAINER::SetNetNameFromNetCode( void )
}
ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const
{
if( aPad == NULL || aPad->GetZoneConnection() == UNDEFINED_CONNECTION )
return m_PadConnection;
else
return aPad->GetZoneConnection();
}
wxString ZONE_CONTAINER::GetSelectMenuText() const
{
wxString text;
......
......@@ -92,8 +92,6 @@ public:
//ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF)
int m_ArcToSegmentsCount;
int m_PadOption;
// thickness of the gap in thermal reliefs.
int m_ThermalReliefGap;
......@@ -128,6 +126,7 @@ private:
// the other zone priority, it will be created inside.
// if priorities are equal, a DRC erroc is set
unsigned m_priority;
ZoneConnection m_PadConnection;
public:
ZONE_CONTAINER( BOARD* parent );
......@@ -292,8 +291,8 @@ public:
int GetZoneClearance() const { return m_ZoneClearance; }
void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
int GetPadOption() const { return m_PadOption; }
void SetPadOption( int aPadOption ) { m_PadOption = aPadOption; }
ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const;
void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
int GetMinThickness() const { return m_ZoneMinThickness; }
void SetMinThickness( int aMinThickness ) { m_ZoneMinThickness = aMinThickness; }
......
......@@ -39,7 +39,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
m_ThermalReliefGap = 200; // tickness of the gap in thermal reliefs
m_ThermalReliefCopperBridge = 200; // tickness of the copper bridge in thermal reliefs
m_Zone_Pad_Options = THERMAL_PAD; // How pads are covered by copper in zone
m_PadConnection = THERMAL_PAD; // How pads are covered by copper in zone
m_Zone_45_Only = false;
......@@ -60,7 +60,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
m_ArcToSegmentsCount = aSource.m_ArcToSegmentsCount;
m_ThermalReliefGap = aSource.m_ThermalReliefGap;
m_ThermalReliefCopperBridge = aSource.m_ThermalReliefCopperBridge;
m_Zone_Pad_Options = aSource.m_PadOption;
m_PadConnection = aSource.GetPadConnection();
cornerSmoothingType = aSource.GetCornerSmoothingType();
cornerRadius = aSource.GetCornerRadius();
......@@ -77,7 +77,7 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
aTarget.m_ArcToSegmentsCount = m_ArcToSegmentsCount;
aTarget.m_ThermalReliefGap = m_ThermalReliefGap;
aTarget.m_ThermalReliefCopperBridge = m_ThermalReliefCopperBridge;
aTarget.m_PadOption = m_Zone_Pad_Options;
aTarget.SetPadConnection( m_PadConnection );
aTarget.SetCornerSmoothingType( cornerSmoothingType );
aTarget.SetCornerRadius( cornerRadius );
......
......@@ -6,6 +6,8 @@
#ifndef ZONE_SETTINGS_H_
#define ZONE_SETTINGS_H_
#include "zones.h"
class ZONE_CONTAINER;
......@@ -45,13 +47,13 @@ public:
long m_ThermalReliefGap; ///< thickness of the gap in thermal reliefs
long m_ThermalReliefCopperBridge; ///< thickness of the copper bridge in thermal reliefs
int m_Zone_Pad_Options; ///< How pads are covered by copper in zone
bool m_Zone_45_Only;
private:
int cornerSmoothingType; ///< Corner smoothing type
unsigned int cornerRadius; ///< Corner chamfer distance / fillet radius
ZoneConnection m_PadConnection;
public:
ZONE_SETTINGS();
......@@ -75,9 +77,9 @@ public:
*/
void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true ) const;
void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; };
void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; }
int GetCornerSmoothingType() const { return cornerSmoothingType; };
int GetCornerSmoothingType() const { return cornerSmoothingType; }
void SetCornerRadius( int aRadius )
{
......@@ -89,7 +91,11 @@ public:
cornerRadius = aRadius;
};
unsigned int GetCornerRadius() const { return cornerRadius; };
unsigned int GetCornerRadius() const { return cornerRadius; }
ZoneConnection GetPadConnection() const { return m_PadConnection; }
void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
};
......
......@@ -189,12 +189,13 @@ void DIALOG_COPPER_ZONE::initDialog()
m_Parent->GetInternalUnits() );
m_ZoneMinThicknessCtrl->SetValue( msg );
switch( m_settings.m_Zone_Pad_Options )
switch( m_settings.GetPadConnection() )
{
case PAD_NOT_IN_ZONE: // Pads are not covered
m_PadInZoneOpt->SetSelection( 2 );
break;
default:
case THERMAL_PAD: // Use thermal relief for pads
m_PadInZoneOpt->SetSelection( 1 );
break;
......@@ -204,7 +205,7 @@ void DIALOG_COPPER_ZONE::initDialog()
break;
}
if( m_settings.m_Zone_Pad_Options != THERMAL_PAD )
if( m_settings.GetPadConnection() != THERMAL_PAD )
{
m_AntipadSizeValue->Enable( false );
m_CopperWidthValue->Enable( false );
......@@ -345,17 +346,17 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
{
case 2:
// Pads are not covered
m_settings.m_Zone_Pad_Options = PAD_NOT_IN_ZONE;
m_settings.SetPadConnection( PAD_NOT_IN_ZONE );
break;
case 1:
// Use thermal relief for pads
m_settings.m_Zone_Pad_Options = THERMAL_PAD;
m_settings.SetPadConnection( THERMAL_PAD );
break;
case 0:
// pads are covered by copper
m_settings.m_Zone_Pad_Options = PAD_IN_ZONE;
m_settings.SetPadConnection( PAD_IN_ZONE );
break;
}
......
......@@ -132,6 +132,26 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
else
m_SolderPasteMarginRatioCtrl->SetValue( msg );
switch( m_CurrentModule->GetZoneConnection() )
{
default:
case UNDEFINED_CONNECTION:
m_ZoneConnectionChoice->SetSelection( 0 );
break;
case PAD_IN_ZONE:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case THERMAL_PAD:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case PAD_NOT_IN_ZONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
}
}
......@@ -482,6 +502,26 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
switch( m_ZoneConnectionChoice->GetSelection() )
{
default:
case 0:
m_CurrentModule->SetZoneConnection( UNDEFINED_CONNECTION );
break;
case 1:
m_CurrentModule->SetZoneConnection( PAD_IN_ZONE );
break;
case 2:
m_CurrentModule->SetZoneConnection( THERMAL_PAD );
break;
case 3:
m_CurrentModule->SetZoneConnection( PAD_NOT_IN_ZONE );
break;
}
// Set Module Position
modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT );
modpos.y = ReturnValueFromTextCtrl( *m_ModPositionY, PCB_INTERNAL_UNIT );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_edit_module_for_BoardEditor_base__
#define __dialog_edit_module_for_BoardEditor_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/slider.h>
#include <wx/statline.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_NOTEBOOK 1000
#define ID_LISTBOX_ORIENT_SELECT 1001
#define ID_MODULE_PROPERTIES_EXCHANGE 1002
#define ID_GOTO_MODULE_EDITOR 1003
#define ID_BROWSE_3D_LIB 1004
#define ID_ADD_3D_SHAPE 1005
#define ID_REMOVE_3D_SHAPE 1006
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MODULE_BOARD_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog
{
private:
wxBoxSizer* m_GeneralBoxSizer;
wxBoxSizer* m_PropRightSizer;
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelProperties;
wxTextCtrl* m_ReferenceCtrl;
wxButton* m_button4;
wxTextCtrl* m_ValueCtrl;
wxButton* m_button5;
wxRadioBox* m_LayerCtrl;
wxRadioBox* m_OrientCtrl;
wxStaticText* m_staticText4;
wxTextCtrl* m_OrientValue;
wxStaticText* XPositionStatic;
wxTextCtrl* m_ModPositionX;
wxStaticText* YPositionStatic;
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_staticTextNetClearance;
wxTextCtrl* m_NetClearanceValueCtrl;
wxStaticText* m_NetClearanceUnits;
wxStaticLine* m_staticline1;
wxStaticLine* m_staticline2;
wxStaticLine* m_staticline3;
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;
wxButton* m_buttonBrowse;
wxButton* m_buttonAdd;
wxButton* m_buttonRemove;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnEditReference( wxCommandEvent& event ){ event.Skip(); }
virtual void OnEditValue( wxCommandEvent& event ){ event.Skip(); }
virtual void ModuleOrientEvent( wxCommandEvent& event ){ event.Skip(); }
virtual void ExchangeModule( wxCommandEvent& event ){ event.Skip(); }
virtual void GotoModuleEditor( wxCommandEvent& event ){ event.Skip(); }
virtual void On3DShapeNameSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void Browse3DLib( wxCommandEvent& event ){ event.Skip(); }
virtual void Add3DShape( wxCommandEvent& event ){ event.Skip(); }
virtual void Remove3DShape( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
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( 474,607 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODULE_BOARD_EDITOR_BASE();
};
#endif //__dialog_edit_module_for_BoardEditor_base__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 24 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_MODULE_FOR_BOARDEDITOR_BASE_H__
#define __DIALOG_EDIT_MODULE_FOR_BOARDEDITOR_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/slider.h>
#include <wx/choice.h>
#include <wx/statline.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/listbox.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_NOTEBOOK 1000
#define ID_LISTBOX_ORIENT_SELECT 1001
#define ID_MODULE_PROPERTIES_EXCHANGE 1002
#define ID_GOTO_MODULE_EDITOR 1003
#define ID_BROWSE_3D_LIB 1004
#define ID_ADD_3D_SHAPE 1005
#define ID_REMOVE_3D_SHAPE 1006
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MODULE_BOARD_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_MODULE_BOARD_EDITOR_BASE : public wxDialog
{
private:
wxBoxSizer* m_GeneralBoxSizer;
wxBoxSizer* m_PropRightSizer;
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelProperties;
wxTextCtrl* m_ReferenceCtrl;
wxButton* m_button4;
wxTextCtrl* m_ValueCtrl;
wxButton* m_button5;
wxRadioBox* m_LayerCtrl;
wxRadioBox* m_OrientCtrl;
wxStaticText* m_staticText4;
wxTextCtrl* m_OrientValue;
wxStaticText* XPositionStatic;
wxTextCtrl* m_ModPositionX;
wxStaticText* YPositionStatic;
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_staticText16;
wxChoice* m_ZoneConnectionChoice;
wxStaticText* m_staticTextInfo;
wxStaticText* m_staticTextNetClearance;
wxTextCtrl* m_NetClearanceValueCtrl;
wxStaticText* m_NetClearanceUnits;
wxStaticLine* m_staticline1;
wxStaticLine* m_staticline2;
wxStaticLine* m_staticline3;
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;
wxButton* m_buttonBrowse;
wxButton* m_buttonAdd;
wxButton* m_buttonRemove;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
wxButton* m_sdbSizerStdButtonsOK;
wxButton* m_sdbSizerStdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnEditReference( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditValue( wxCommandEvent& event ) { event.Skip(); }
virtual void ModuleOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); }
virtual void GotoModuleEditor( wxCommandEvent& event ) { event.Skip(); }
virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void Browse3DLib( wxCommandEvent& event ) { event.Skip(); }
virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
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( 550,800 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODULE_BOARD_EDITOR_BASE();
};
#endif //__DIALOG_EDIT_MODULE_FOR_BOARDEDITOR_BASE_H__
......@@ -187,9 +187,7 @@ void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* Pad )
}
/***************************************/
void DIALOG_PAD_PROPERTIES::initValues()
/***************************************/
{
SetFocus(); // Required under wxGTK if we want to dismiss the dialog with the ESC key
......@@ -297,6 +295,26 @@ void DIALOG_PAD_PROPERTIES::initValues()
else
m_SolderPasteMarginRatioCtrl->SetValue( msg );
switch( m_dummyPad->GetZoneConnection() )
{
default:
case UNDEFINED_CONNECTION:
m_ZoneConnectionChoice->SetSelection( 0 );
break;
case PAD_IN_ZONE:
m_ZoneConnectionChoice->SetSelection( 1 );
break;
case THERMAL_PAD:
m_ZoneConnectionChoice->SetSelection( 2 );
break;
case PAD_NOT_IN_ZONE:
m_ZoneConnectionChoice->SetSelection( 3 );
break;
}
if( m_CurrentPad )
{
MODULE* module = m_CurrentPad->GetParent();
......@@ -413,9 +431,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
}
/*********************************************************************/
void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
/*********************************************************************/
{
switch( m_PadShape->GetSelection() )
{
......@@ -453,9 +469,7 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
}
/**********************************************************************/
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
/**********************************************************************/
{
if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
{
......@@ -484,9 +498,7 @@ void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
}
/*******************************************************************/
void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
/********************************************************************/
{
switch( m_PadOrient->GetSelection() )
{
......@@ -519,9 +531,7 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
}
/*****************************************************************/
void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
/*****************************************************************/
/* Adjust the better mask layer according to the selected pad type
*/
......@@ -549,9 +559,7 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
}
/****************************************************************/
void DIALOG_PAD_PROPERTIES::SetPadLayersList( long layer_mask )
/****************************************************************/
/** SetPadLayersList
* Update the CheckBoxes state in pad layers list,
......@@ -594,9 +602,7 @@ void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
}
/*************************************************************************/
void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
/*************************************************************************/
/* Updates the different parameters for the component being edited.
*/
......@@ -695,6 +701,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
m_CurrentPad->SetLocalSolderMaskMargin( m_Pad_Master.GetLocalSolderMaskMargin() );
m_CurrentPad->SetLocalSolderPasteMargin( m_Pad_Master.GetLocalSolderPasteMargin() );
m_CurrentPad->SetLocalSolderPasteMarginRatio( m_Pad_Master.GetLocalSolderPasteMarginRatio() );
m_CurrentPad->SetZoneConnection( m_Pad_Master.GetZoneConnection() );
module->CalculateBoundingBox();
m_CurrentPad->DisplayInfo( m_Parent );
......@@ -742,6 +749,26 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
switch( m_ZoneConnectionChoice->GetSelection() )
{
default:
case 0:
aPad->SetZoneConnection( UNDEFINED_CONNECTION );
break;
case 1:
aPad->SetZoneConnection( PAD_IN_ZONE );
break;
case 2:
aPad->SetZoneConnection( THERMAL_PAD );
break;
case 3:
aPad->SetZoneConnection( PAD_NOT_IN_ZONE );
break;
}
// Read pad position:
x = ReturnValueFromTextCtrl( *m_PadPosition_X_Ctrl, internalUnits );
y = ReturnValueFromTextCtrl( *m_PadPosition_Y_Ctrl, internalUnits );
......
This diff is collapsed.
......@@ -210,7 +210,6 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
int ret;
unsigned corners_count = m_Poly->corner.size();
int outline_hatch;
char padoption;
fprintf( aFile, "$CZONE_OUTLINE\n" );
......@@ -258,23 +257,24 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
}
// Save pad option and clearance
switch( m_PadOption )
int padConnection;
switch( m_PadConnection )
{
default:
case PAD_IN_ZONE:
padoption = 'I';
padConnection = 'I';
break;
case THERMAL_PAD:
padoption = 'T';
padConnection = 'T';
break;
case PAD_NOT_IN_ZONE:
padoption = 'X';
padConnection = 'X';
break;
}
ret = fprintf( aFile, "ZClearance %d %c\n", m_ZoneClearance, padoption );
ret = fprintf( aFile, "ZClearance %d %c\n", m_ZoneClearance, padConnection );
if( ret < 2 )
return false;
......@@ -719,6 +719,9 @@ bool D_PAD::Save( FILE* aFile ) const
if( GetLocalClearance() != 0 )
fprintf( aFile, ".LocalClearance %d\n", GetLocalClearance() );
if( m_ZoneConnection != UNDEFINED_CONNECTION )
fprintf( aFile, ".ZoneConnection %d\n", m_ZoneConnection );
if( fprintf( aFile, "$EndPAD\n" ) != sizeof("$EndPAD\n") - 1 )
return false;
......@@ -779,6 +782,9 @@ bool MODULE::Save( FILE* aFile ) const
if( m_LocalClearance != 0 )
fprintf( aFile, ".LocalClearance %d\n", GetLocalClearance() );
if( m_ZoneConnection != UNDEFINED_CONNECTION )
fprintf( aFile, ".ZoneConnection %d\n", m_ZoneConnection );
// attributes
if( m_Attributs != MOD_DEFAULT )
{
......@@ -1026,6 +1032,8 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
SetLocalSolderPasteMarginRatio( atoi( Line + 18 ) );
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
SetLocalClearance( atoi( Line + 16 ) );
else if( strnicmp( Line, ".ZoneConnection ", 16 ) == 0 )
m_ZoneConnection = (ZoneConnection)atoi( Line + 16 );
break;
default:
......@@ -1271,6 +1279,8 @@ int MODULE::ReadDescr( LINE_READER* aReader )
SetLocalSolderPasteMarginRatio( atof( Line + 18 ) );
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
SetLocalClearance( atoi( Line + 16 ) );
else if( strnicmp( Line, ".ZoneConnection ", 16 ) == 0 )
m_ZoneConnection = (ZoneConnection)atoi( Line + 16 );
break;
......@@ -1848,9 +1858,9 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
else if( strnicmp( Line, "ZClearance", 10 ) == 0 ) // Clearance and pad options info found
{
int clearance = 200;
char padoption;
char padConnection;
text = Line + 10;
ret = sscanf( text, "%d %1c", &clearance, &padoption );
ret = sscanf( text, "%d %1c", &clearance, &padConnection );
if( ret < 2 )
{
......@@ -1860,21 +1870,21 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
{
m_ZoneClearance = clearance;
switch( padoption )
switch( padConnection )
{
case 'i':
case 'I':
m_PadOption = PAD_IN_ZONE;
m_PadConnection = PAD_IN_ZONE;
break;
case 't':
case 'T':
m_PadOption = THERMAL_PAD;
m_PadConnection = THERMAL_PAD;
break;
case 'x':
case 'X':
m_PadOption = PAD_NOT_IN_ZONE;
m_PadConnection = PAD_NOT_IN_ZONE;
break;
}
}
......
......@@ -1018,6 +1018,12 @@ void KICAD_PLUGIN::loadMODULE()
module->SetLocalClearance( tmp );
}
else if( TESTLINE( ".ZoneConnection" ) )
{
int tmp = intParse( line + SZ( ".ZoneConnection" ) );
module->SetZoneConnection( (ZoneConnection)tmp );
}
else if( TESTLINE( "$EndMODULE" ) )
{
module->CalculateBoundingBox();
......@@ -1220,6 +1226,12 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
pad->SetLocalClearance( tmp );
}
else if( TESTLINE( ".ZoneConnection" ) )
{
int tmp = intParse( line + SZ( ".ZoneConnection" ) );
pad->SetZoneConnection( (ZoneConnection)tmp );
}
else if( TESTLINE( "$EndPAD" ) )
{
wxPoint padpos = pad->GetPosition();
......@@ -3177,6 +3189,9 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
if( me->GetLocalClearance() != 0 )
fprintf( m_fp, ".LocalClearance %s\n", fmtBIU( me->GetLocalClearance( ) ).c_str() );
if( me->GetZoneConnection() != UNDEFINED_CONNECTION )
fprintf( m_fp, ".ZoneConnection %d\n", me->GetZoneConnection() );
fprintf( m_fp, "$EndPAD\n" );
CHECK_WRITE_ERROR();
......@@ -3230,6 +3245,9 @@ void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
if( me->GetLocalClearance() != 0 )
fprintf( m_fp, ".LocalClearance %s\n", fmtBIU( me->GetLocalClearance( ) ).c_str() );
if( me->GetZoneConnection() != UNDEFINED_CONNECTION )
fprintf( m_fp, ".ZoneConnection %d\n", me->GetZoneConnection() );
// attributes
if( me->GetAttributes() != MOD_DEFAULT )
{
......
......@@ -21,7 +21,8 @@ enum ZONE_EDIT_T {
/// How pads are covered by copper in zone
enum {
enum ZoneConnection {
UNDEFINED_CONNECTION = -1,
PAD_NOT_IN_ZONE, ///< Pads are not covered
THERMAL_PAD, ///< Use thermal relief for pads
PAD_IN_ZONE ///< pads are covered by copper
......
......@@ -233,8 +233,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
int gap = zone_clearance;
if( (m_PadOption == PAD_NOT_IN_ZONE)
|| (GetNet() == 0) || pad->GetShape() == PAD_TRAPEZOID )
if( ( GetPadConnection( pad ) == PAD_NOT_IN_ZONE )
|| ( GetNet() == 0 ) || ( pad->GetShape() == PAD_TRAPEZOID ) )
// PAD_TRAPEZOID shapes are not in zones because they are used in microwave apps
// and i think it is good that shapes are not changed by thermal pads or others
......@@ -358,29 +358,29 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
}
// Remove thermal symbols
if( m_PadOption == THERMAL_PAD )
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{
if( !pad->IsOnLayer( GetLayer() ) )
continue;
if( GetPadConnection( pad ) != THERMAL_PAD )
continue;
if( pad->GetNet() != GetNet() )
continue;
item_boundingbox = pad->GetBoundingBox();
item_boundingbox.Inflate( m_ThermalReliefGap, m_ThermalReliefGap );
if( !pad->IsOnLayer( GetLayer() ) )
continue;
if( item_boundingbox.Intersects( zone_boundingbox ) )
{
CreateThermalReliefPadPolygon( cornerBufferPolysToSubstract,
*pad, m_ThermalReliefGap,
m_ThermalReliefCopperBridge,
m_ZoneMinThickness,
s_CircleToSegmentsCount,
s_Correction, s_thermalRot );
}
if( pad->GetNet() != GetNet() )
continue;
item_boundingbox = pad->GetBoundingBox();
item_boundingbox.Inflate( m_ThermalReliefGap, m_ThermalReliefGap );
if( item_boundingbox.Intersects( zone_boundingbox ) )
{
CreateThermalReliefPadPolygon( cornerBufferPolysToSubstract,
*pad, m_ThermalReliefGap,
m_ThermalReliefCopperBridge,
m_ZoneMinThickness,
s_CircleToSegmentsCount,
s_Correction, s_thermalRot );
}
}
}
......@@ -405,28 +405,25 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
// Now we remove all unused thermal stubs.
if( m_PadOption == THERMAL_PAD )
{
cornerBufferPolysToSubstract.clear();
cornerBufferPolysToSubstract.clear();
// Test thermal stubs connections and add polygons to remove unconnected stubs.
BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this,
s_Correction, s_thermalRot );
// Test thermal stubs connections and add polygons to remove unconnected stubs.
BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this,
s_Correction, s_thermalRot );
// remove copper areas
if( cornerBufferPolysToSubstract.size() )
{
KPolygonSet polyset_holes;
AddPolygonCornersToKPolygonList( cornerBufferPolysToSubstract, polyset_holes );
polyset_zone_solid_areas -= polyset_holes;
// remove copper areas
if( cornerBufferPolysToSubstract.size() )
{
KPolygonSet polyset_holes;
AddPolygonCornersToKPolygonList( cornerBufferPolysToSubstract, polyset_holes );
polyset_zone_solid_areas -= polyset_holes;
// put these areas in m_FilledPolysList
m_FilledPolysList.clear();
CopyPolygonsFromKPolygonListToFilledPolysList( this, polyset_zone_solid_areas );
// put these areas in m_FilledPolysList
m_FilledPolysList.clear();
CopyPolygonsFromKPolygonListToFilledPolysList( this, polyset_zone_solid_areas );
if( GetNet() > 0 )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
}
if( GetNet() > 0 )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
}
cornerBufferPolysToSubstract.clear();
......
......@@ -54,9 +54,13 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
{
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{
if( aZone->GetPadConnection( pad ) != THERMAL_PAD )
continue;
// check
if( !pad->IsOnLayer( aZone->GetLayer() ) )
continue;
if( pad->GetNet() != aZone->GetNet() )
continue;
......
......@@ -83,7 +83,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
if( m_ArcToSegmentsCount != aZoneToCompare.m_ArcToSegmentsCount )
return false;
if( m_PadOption != aZoneToCompare.m_PadOption )
if( m_PadConnection != aZoneToCompare.m_PadConnection )
return false;
if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment