Commit fe6733b7 authored by jean-pierre charras's avatar jean-pierre charras

Preparing work on trapezoidal pad DRC: cleaning code. some comments and...

Preparing work on trapezoidal pad DRC: cleaning code. some comments and translations added in drc.cpp. uncrustify drc.cpp
parent 0ebe9878
......@@ -20,6 +20,8 @@ Subdirectories
--------------
3d-viewer - Sourcecode of 3D viewer
bitmaps - Menu and program icons
bitmap2component - Sourcecode of a small application to create a footprint or a component from a B&W bitmap
this component or footprint has just graphic items that show the bitmap
CMakeModules - Modules for the CMAKE build tool
common - Sourcecode of the common library (common functions shared across whole suite)
cvpcb - Sourcecode of CvPCB, tool to link components with footprints sourcecode
......
......@@ -655,7 +655,6 @@ public:
void ListNetsAndSelect( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event );
void Install_Test_DRC_Frame( wxDC* DC );
// Handling texts on the board
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
......
......@@ -232,8 +232,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_PadShapeSizeY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeOffsetX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeOffsetY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeDeltaX_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeDeltaY_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_PadShapeDelta_Unit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_NetClearanceUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
// Display current pad masks clearances units
......@@ -254,8 +253,16 @@ void DIALOG_PAD_PROPERTIES::initValues()
PutValueInLocalUnits( *m_ShapeOffset_X_Ctrl, m_dummyPad->m_Offset.x, internalUnits );
PutValueInLocalUnits( *m_ShapeOffset_Y_Ctrl, m_dummyPad->m_Offset.y, internalUnits );
PutValueInLocalUnits( *m_ShapeDelta_X_Ctrl, m_dummyPad->m_DeltaSize.x, internalUnits );
PutValueInLocalUnits( *m_ShapeDelta_Y_Ctrl, m_dummyPad->m_DeltaSize.y, internalUnits );
if( m_dummyPad->m_DeltaSize.x )
{
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->m_DeltaSize.x, internalUnits );
m_radioBtnDeltaXdir->SetValue(true);
}
else
{
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->m_DeltaSize.y, internalUnits );
m_radioBtnDeltaYdir->SetValue(true);
}
PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_dummyPad->m_LocalClearance, internalUnits );
PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
......@@ -391,26 +398,30 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
switch( m_PadShape->GetSelection() )
{
case 0: //CIRCLE:
m_ShapeDelta_X_Ctrl->Enable( false );
m_ShapeDelta_Y_Ctrl->Enable( false );
m_ShapeDelta_Ctrl->Enable( false );
m_radioBtnDeltaXdir->Enable( false );
m_radioBtnDeltaYdir->Enable( false );
m_ShapeSize_Y_Ctrl->Enable( false );
break;
case 1: //OVALE:
m_ShapeDelta_X_Ctrl->Enable( false );
m_ShapeDelta_Y_Ctrl->Enable( false );
m_ShapeDelta_Ctrl->Enable( false );
m_radioBtnDeltaXdir->Enable( false );
m_radioBtnDeltaYdir->Enable( false );
m_ShapeSize_Y_Ctrl->Enable( true );
break;
case 2: // PAD_RECT:
m_ShapeDelta_X_Ctrl->Enable( false );
m_ShapeDelta_Y_Ctrl->Enable( false );
m_ShapeDelta_Ctrl->Enable( false );
m_radioBtnDeltaXdir->Enable( false );
m_radioBtnDeltaYdir->Enable( false );
m_ShapeSize_Y_Ctrl->Enable( true );
break;
case 3: //TRAPEZE:
m_ShapeDelta_X_Ctrl->Enable( true );
m_ShapeDelta_Y_Ctrl->Enable( true );
m_ShapeDelta_Ctrl->Enable( true );
m_radioBtnDeltaXdir->Enable( true );
m_radioBtnDeltaYdir->Enable( true );
m_ShapeSize_Y_Ctrl->Enable( true );
break;
}
......@@ -704,11 +715,15 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
// Read pad shape delta size:
// m_DeltaSize.x or m_DeltaSize.y must be NULL. for a trapezoid.
aPad->m_DeltaSize.x = ReturnValueFromTextCtrl( *m_ShapeDelta_X_Ctrl, internalUnits );
aPad->m_DeltaSize.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Y_Ctrl, internalUnits );
wxSize delta;
if( m_radioBtnDeltaXdir->GetValue() )
delta.x = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits );
else
delta.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits );
aPad->m_DeltaSize = delta;
// Test bad values (be sure delta values are not to large)
// rememver DeltaSize.x is the Y size variation
// remember DeltaSize.x is the Y size variation
bool error = false;
if( (aPad->m_DeltaSize.x < 0) && (aPad->m_DeltaSize.x <= -aPad->m_Size.y) )
{
......@@ -848,12 +863,6 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
DisplayError( this, _( "Too large value for pad delta size" ) );
return false;
}
if( aPad->m_DeltaSize.x && aPad->m_DeltaSize.y )
{
DisplayError( this, _( "Incorrect value for pad delta size: X or Y value must be NULL" ) );
return false;
}
}
return true;
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -150,27 +150,36 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_PadShapeOffsetY_Unit->Wrap( -1 );
fgSizerGeometry->Add( m_PadShapeOffsetY_Unit, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText21 = new wxStaticText( this, wxID_ANY, _("Shape delta X"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText21 = new wxStaticText( this, wxID_ANY, _("Shape Delta Dim"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText21->Wrap( -1 );
fgSizerGeometry->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT, 5 );
m_ShapeDelta_X_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGeometry->Add( m_ShapeDelta_X_Ctrl, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShapeDelta_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGeometry->Add( m_ShapeDelta_Ctrl, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadShapeDeltaX_Unit = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_PadShapeDeltaX_Unit->Wrap( -1 );
fgSizerGeometry->Add( m_PadShapeDeltaX_Unit, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_PadShapeDelta_Unit = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_PadShapeDelta_Unit->Wrap( -1 );
fgSizerGeometry->Add( m_PadShapeDelta_Unit, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText23 = new wxStaticText( this, wxID_ANY, _("Shape delta Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText23 = new wxStaticText( this, wxID_ANY, _("Trap. Direction"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText23->Wrap( -1 );
fgSizerGeometry->Add( m_staticText23, 0, wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_ShapeDelta_Y_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGeometry->Add( m_ShapeDelta_Y_Ctrl, 0, wxALL, 5 );
wxBoxSizer* bSizerbdir;
bSizerbdir = new wxBoxSizer( wxHORIZONTAL );
m_PadShapeDeltaY_Unit = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_PadShapeDeltaY_Unit->Wrap( -1 );
fgSizerGeometry->Add( m_PadShapeDeltaY_Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_radioBtnDeltaXdir = new wxRadioButton( this, wxID_DDIRX, _(">"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_radioBtnDeltaXdir->SetValue( true );
bSizerbdir->Add( m_radioBtnDeltaXdir, 0, wxALL, 5 );
m_radioBtnDeltaYdir = new wxRadioButton( this, wxID_DDIRY, _("^"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerbdir->Add( m_radioBtnDeltaYdir, 0, wxALL, 5 );
fgSizerGeometry->Add( bSizerbdir, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticTextDDirInfo = new wxStaticText( this, wxID_ANY, _("Rot 0"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDDirInfo->Wrap( -1 );
fgSizerGeometry->Add( m_staticTextDDirInfo, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
sbSizer2->Add( fgSizerGeometry, 1, wxEXPAND, 5 );
......@@ -354,58 +363,45 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_LayersSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers:") ), wxVERTICAL );
m_PadLayerCmp = new wxCheckBox( this, wxID_ANY, _("Component layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerCmp, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerCu = new wxCheckBox( this, wxID_ANY, _("Copper layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerCu, 0, wxALL, 5 );
m_LayersSizer->Add( 0, 8, 1, wxEXPAND, 5 );
m_PadLayerAdhCmp = new wxCheckBox( this, wxID_ANY, _("Adhesive Cmp"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerAdhCmp, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerAdhCu = new wxCheckBox( this, wxID_ANY, _("Adhesive Copper"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerAdhCu, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerPateCmp = new wxCheckBox( this, wxID_ANY, _("Solder paste Cmp"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerPateCmp, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerPateCu = new wxCheckBox( this, wxID_ANY, _("Solder paste Copper"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerPateCu, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerSilkCmp = new wxCheckBox( this, wxID_ANY, _("Silkscreen Cmp"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerSilkCmp, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerSilkCu = new wxCheckBox( this, wxID_ANY, _("Silkscreen Copper"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerSilkCu, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerMaskCmp = new wxCheckBox( this, wxID_ANY, _("Solder mask Cmp"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerMaskCmp, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerMaskCu = new wxCheckBox( this, wxID_ANY, _("Solder mask Copper"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerMaskCu, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerDraft = new wxCheckBox( this, wxID_ANY, _("Draft layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerDraft, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerECO1 = new wxCheckBox( this, wxID_ANY, _("E.C.O.1 layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerECO1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLayerECO2 = new wxCheckBox( this, wxID_ANY, _("E.C.O.2 layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayersSizer->Add( m_PadLayerECO2, 0, wxALL, 5 );
m_RightBoxSizer->Add( m_LayersSizer, 0, 0, 5 );
......@@ -436,8 +432,9 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_ShapeSize_Y_Ctrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeOffset_X_Ctrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeOffset_Y_Ctrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeDelta_X_Ctrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeDelta_Y_Ctrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeDelta_Ctrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_radioBtnDeltaXdir->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_radioBtnDeltaYdir->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_PadShape->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPadShapeSelection ), NULL, this );
m_DrillShapeCtrl->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnDrillShapeSelected ), NULL, this );
m_PadOrient->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::PadOrientEvent ), NULL, this );
......@@ -473,8 +470,9 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
m_ShapeSize_Y_Ctrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeOffset_X_Ctrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeOffset_Y_Ctrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeDelta_X_Ctrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeDelta_Y_Ctrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_ShapeDelta_Ctrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_radioBtnDeltaXdir->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_radioBtnDeltaYdir->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_PadShape->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPadShapeSelection ), NULL, this );
m_DrillShapeCtrl->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnDrillShapeSelected ), NULL, this );
m_PadOrient->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::PadOrientEvent ), NULL, this );
......@@ -497,4 +495,5 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
m_PadLayerECO2->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayer ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::PadPropertiesAccept ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -18,6 +18,7 @@
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
......@@ -41,6 +42,8 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog
wxID_DIALOG_EDIT_PAD = 1000,
wxID_PADNUMCTRL,
wxID_PADNETNAMECTRL,
wxID_DDIRX,
wxID_DDIRY,
ID_LISTBOX_SHAPE_PAD,
ID_RADIOBOX_DRILL_SHAPE,
ID_LISTBOX_ORIENT_PAD,
......@@ -82,11 +85,12 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog
wxTextCtrl* m_ShapeOffset_Y_Ctrl;
wxStaticText* m_PadShapeOffsetY_Unit;
wxStaticText* m_staticText21;
wxTextCtrl* m_ShapeDelta_X_Ctrl;
wxStaticText* m_PadShapeDeltaX_Unit;
wxTextCtrl* m_ShapeDelta_Ctrl;
wxStaticText* m_PadShapeDelta_Unit;
wxStaticText* m_staticText23;
wxTextCtrl* m_ShapeDelta_Y_Ctrl;
wxStaticText* m_PadShapeDeltaY_Unit;
wxRadioButton* m_radioBtnDeltaXdir;
wxRadioButton* m_radioBtnDeltaYdir;
wxStaticText* m_staticTextDDirInfo;
wxBoxSizer* m_DrillShapeBoxSizer;
wxRadioBox* m_PadShape;
wxRadioBox* m_DrillShapeCtrl;
......@@ -135,18 +139,19 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnValuesChanged( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPadShapeSelection( wxCommandEvent& event ){ event.Skip(); }
virtual void OnDrillShapeSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void PadOrientEvent( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPaintShowPanel( wxPaintEvent& event ){ event.Skip(); }
virtual void PadTypeSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void OnSetLayer( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void PadPropertiesAccept( wxCommandEvent& event ){ event.Skip(); }
virtual void OnValuesChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPadShapeSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDrillShapeSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void PadOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
virtual void PadTypeSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetLayer( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void PadPropertiesAccept( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 733,486 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER );
~DIALOG_PAD_PROPERTIES_BASE();
......
......@@ -46,14 +46,6 @@
#include "dialog_drc.h"
/******************************************************/
void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC )
/******************************************************/
{
m_drc->ShowDialog();
}
void DRC::ShowDialog()
{
if( !m_ui )
......@@ -63,11 +55,14 @@ void DRC::ShowDialog()
// copy data retained in this DRC object into the m_ui DrcPanel:
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, m_pcb->GetBoardDesignSettings()->m_TrackMinWidth,
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl,
m_pcb->GetBoardDesignSettings()->m_TrackMinWidth,
m_mainWindow->m_InternalUnits );;
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, m_pcb->GetBoardDesignSettings()->m_ViasMinSize,
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_ViasMinSize,
m_mainWindow->m_InternalUnits );;
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize,
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl,
m_pcb->GetBoardDesignSettings()->m_MicroViasMinSize,
m_mainWindow->m_InternalUnits );;
m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile );
......@@ -87,8 +82,8 @@ void DRC::DestroyDialog( int aReason )
if( aReason == wxID_OK )
{
// if user clicked OK, save his choices in this DRC object.
m_doCreateRptFile = m_ui->m_CreateRptCtrl->GetValue();
m_rptFilename = m_ui->m_RptFilenameCtrl->GetValue();
m_doCreateRptFile = m_ui->m_CreateRptCtrl->GetValue();
m_rptFilename = m_ui->m_RptFilenameCtrl->GetValue();
}
m_ui->Destroy();
......@@ -191,14 +186,14 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int CornerIndex )
* will actually run all the tests specified with a previous call to
* SetSettings()
*/
void DRC::RunTests( wxTextCtrl * aMessages )
void DRC::RunTests( wxTextCtrl* aMessages )
{
// Ensure ratsnest is up to date:
if( (m_pcb->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
if( aMessages )
{
aMessages->AppendText( _("Compile ratsnest...\n") );
aMessages->AppendText( _( "Compile ratsnest...\n" ) );
wxSafeYield();
}
......@@ -214,7 +209,7 @@ void DRC::RunTests( wxTextCtrl * aMessages )
// class (a NET) will cause its items such as tracks, vias, and pads
// to also fail. So quit after *all* netclass errors have been reported.
if( aMessages )
aMessages->AppendText( _("Aborting\n") );
aMessages->AppendText( _( "Aborting\n" ) );
// update the m_ui listboxes
updatePointers();
......@@ -227,7 +222,7 @@ void DRC::RunTests( wxTextCtrl * aMessages )
{
if( aMessages )
{
aMessages->AppendText( _("Pad clearances...\n") );
aMessages->AppendText( _( "Pad clearances...\n" ) );
wxSafeYield();
}
......@@ -237,7 +232,7 @@ void DRC::RunTests( wxTextCtrl * aMessages )
// test track and via clearances to other tracks, pads, and vias
if( aMessages )
{
aMessages->AppendText( _("Track clearances...\n") );
aMessages->AppendText( _( "Track clearances...\n" ) );
wxSafeYield();
}
......@@ -247,15 +242,15 @@ void DRC::RunTests( wxTextCtrl * aMessages )
// this is a good caution, because filled areas can be outdated.
if( aMessages )
{
aMessages->AppendText( _("Fill zones...\n") );
aMessages->AppendText( _( "Fill zones...\n" ) );
wxSafeYield();
}
m_mainWindow->Fill_All_Zones( false );
// test zone clearances to other zones, pads, tracks, and vias
if( aMessages && m_doZonesTest)
if( aMessages && m_doZonesTest )
{
aMessages->AppendText( _("Test zones...\n") );
aMessages->AppendText( _( "Test zones...\n" ) );
wxSafeYield();
}
......@@ -266,7 +261,7 @@ void DRC::RunTests( wxTextCtrl * aMessages )
{
if( aMessages )
{
aMessages->AppendText( _("Unconnected pads...\n") );
aMessages->AppendText( _( "Unconnected pads...\n" ) );
wxSafeYield();
}
......@@ -280,7 +275,7 @@ void DRC::RunTests( wxTextCtrl * aMessages )
{
// no newline on this one because it is last, don't want the window
// to unnecessarily scroll.
aMessages->AppendText( _("Finished") );
aMessages->AppendText( _( "Finished" ) );
}
}
......@@ -317,16 +312,16 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
const BOARD_DESIGN_SETTINGS& g = *m_pcb->GetBoardDesignSettings();
#define FmtVal( x ) GetChars( ReturnStringFromValue( g_UserUnit, x, PCB_INTERNAL_UNIT ) )
#define FmtVal( x ) GetChars( ReturnStringFromValue( g_UserUnit, x, PCB_INTERNAL_UNIT ) )
#if 0 // set to 1 when (if...) BOARD_DESIGN_SETTINGS has a m_MinClearance value
if( nc->GetClearance() < g.m_MinClearance )
{
msg.Printf( _("NETCLASS: '%s' has Clearance:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetClearance() ),
FmtVal( g.m_TrackClearance )
);
msg.Printf( _( "NETCLASS: '%s' has Clearance:%s which is less than global:%s" ),
GetChars( nc->GetName() ),
FmtVal( nc->GetClearance() ),
FmtVal( g.m_TrackClearance )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
......@@ -337,11 +332,11 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
if( nc->GetTrackWidth() < g.m_TrackMinWidth )
{
msg.Printf( _("NETCLASS: '%s' has TrackWidth:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetTrackWidth() ),
FmtVal( g.m_TrackMinWidth )
);
msg.Printf( _( "NETCLASS: '%s' has TrackWidth:%s which is less than global:%s" ),
GetChars( nc->GetName() ),
FmtVal( nc->GetTrackWidth() ),
FmtVal( g.m_TrackMinWidth )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
......@@ -351,11 +346,11 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
if( nc->GetViaDiameter() < g.m_ViasMinSize )
{
msg.Printf( _("NETCLASS: '%s' has Via Dia:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetViaDiameter() ),
FmtVal( g.m_ViasMinSize )
);
msg.Printf( _( "NETCLASS: '%s' has Via Dia:%s which is less than global:%s" ),
GetChars( nc->GetName() ),
FmtVal( nc->GetViaDiameter() ),
FmtVal( g.m_ViasMinSize )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
......@@ -365,11 +360,11 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
if( nc->GetViaDrill() < g.m_ViasMinDrill )
{
msg.Printf( _("NETCLASS: '%s' has Via Drill:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetViaDrill() ),
FmtVal( g.m_ViasMinDrill )
);
msg.Printf( _( "NETCLASS: '%s' has Via Drill:%s which is less than global:%s" ),
GetChars( nc->GetName() ),
FmtVal( nc->GetViaDrill() ),
FmtVal( g.m_ViasMinDrill )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
......@@ -379,11 +374,11 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
if( nc->GetuViaDiameter() < g.m_MicroViasMinSize )
{
msg.Printf( _("NETCLASS: '%s' has uVia Dia:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDiameter() ),
FmtVal( g.m_MicroViasMinSize )
);
msg.Printf( _( "NETCLASS: '%s' has uVia Dia:%s which is less than global:%s" ),
GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDiameter() ),
FmtVal( g.m_MicroViasMinSize )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
......@@ -393,11 +388,11 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
if( nc->GetuViaDrill() < g.m_MicroViasMinDrill )
{
msg.Printf( _("NETCLASS: '%s' has uVia Drill:%s which is less than global:%s"),
GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDrill() ),
FmtVal( g.m_MicroViasMinDrill )
);
msg.Printf( _( "NETCLASS: '%s' has uVia Drill:%s which is less than global:%s" ),
GetChars( nc->GetName() ),
FmtVal( nc->GetuViaDrill() ),
FmtVal( g.m_MicroViasMinDrill )
);
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
m_pcb->Add( m_currentMarker );
......@@ -411,7 +406,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )
bool DRC::testNetClasses()
{
bool ret = true;
bool ret = true;
NETCLASSES& netclasses = m_pcb->m_NetClasses;
......@@ -472,8 +467,8 @@ void DRC::testPad2Pad()
{
D_PAD* pad = sortedPads[i];
int x_limit = max_size + pad->GetClearance() +
pad->m_Rayon + pad->GetPosition().x;
int x_limit = max_size + pad->GetClearance() +
pad->m_Rayon + pad->GetPosition().x;
if( !doPadToPadsDrc( pad, &sortedPads[i], listEnd, x_limit ) )
{
......@@ -622,11 +617,11 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M
{
if( aItem )
fillMe = new MARKER_PCB( aErrorCode, position,
textA, aTrack->GetPosition(),
textB, posB );
textA, aTrack->GetPosition(),
textB, posB );
else
fillMe = new MARKER_PCB( aErrorCode, position,
textA, aTrack->GetPosition() );
textA, aTrack->GetPosition() );
}
return fillMe;
......@@ -666,9 +661,9 @@ MARKER_PCB* DRC::fillMarker( ZONE_CONTAINER* aArea, int aErrorCode, MARKER_PCB*
MARKER_PCB* DRC::fillMarker( const ZONE_CONTAINER* aArea,
const wxPoint& aPos,
int aErrorCode,
MARKER_PCB* fillMe )
const wxPoint& aPos,
int aErrorCode,
MARKER_PCB* fillMe )
{
wxString textA = aArea->MenuText( m_pcb );
......@@ -685,7 +680,7 @@ MARKER_PCB* DRC::fillMarker( const ZONE_CONTAINER* aArea,
MARKER_PCB* DRC::fillMarker( int aErrorCode, const wxString& aMessage, MARKER_PCB* fillMe )
{
wxPoint posA; // not displayed
wxPoint posA; // not displayed
if( fillMe )
fillMe->SetData( aErrorCode, posA, aMessage, posA );
......@@ -702,18 +697,18 @@ MARKER_PCB* DRC::fillMarker( int aErrorCode, const wxString& aMessage, MARKER_PC
bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/***********************************************************************/
{
TRACK* track;
int dx, dy; // utilise pour calcul des dim x et dim y des segments
int layerMask;
int net_code_ref;
wxPoint shape_pos;
TRACK* track;
int dx, dy; // utilise pour calcul des dim x et dim y des segments
int layerMask;
int net_code_ref;
wxPoint shape_pos;
NETCLASS* netclass = aRefSeg->GetNetClass();
NETCLASS* netclass = aRefSeg->GetNetClass();
// Origine sur le PCB des axes du repere centre sur
// l'origine du segment de reference
int org_X = aRefSeg->m_Start.x;
int org_Y = aRefSeg->m_Start.y;
int org_X = aRefSeg->m_Start.x;
int org_Y = aRefSeg->m_Start.y;
m_finx = dx = aRefSeg->m_End.x - org_X;
m_finy = dy = aRefSeg->m_End.y - org_Y;
......@@ -771,7 +766,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// test:
if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 )
err = false;
if( layer1 == (m_pcb->GetBoardDesignSettings()->GetCopperLayerCount() - 2 ) && layer2 == LAYER_N_FRONT )
if( layer1 == (m_pcb->GetBoardDesignSettings()->GetCopperLayerCount() - 2 )
&& layer2 == LAYER_N_FRONT )
err = false;
if( err )
{
......@@ -812,7 +808,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
D_PAD pseudo_pad( (MODULE*) NULL ); // construct this once outside following loop
// Compute the min distance to pads
int refsegm_half_width = aRefSeg->m_Width >> 1;
int refsegm_half_width = aRefSeg->m_Width >> 1;
if( testPads )
{
......@@ -841,7 +837,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
m_spotcx = pseudo_pad.GetPosition().x - org_X;
m_spotcy = pseudo_pad.GetPosition().y - org_Y;
if( !checkClearanceSegmToPad( &pseudo_pad, refsegm_half_width, netclass->GetClearance() ))
if( !checkClearanceSegmToPad( &pseudo_pad, refsegm_half_width,
netclass->GetClearance() ) )
{
m_currentMarker = fillMarker( aRefSeg, pad,
DRCE_TRACK_NEAR_THROUGH_HOLE, m_currentMarker );
......@@ -897,7 +894,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// the minimum distance = clearance plus half the reference track
// width plus half the other track's width
int w_dist = aRefSeg->GetClearance( track );
w_dist += (aRefSeg->m_Width + track->m_Width)/2;
w_dist += (aRefSeg->m_Width + track->m_Width) / 2;
// If the reference segment is a via, we test it here
if( aRefSeg->Type() == TYPE_VIA )
......@@ -1135,7 +1132,6 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
dummypad.m_Masque_Layer = ALL_CU_LAYERS;
for( LISTE_PAD* pad_list = aStart; pad_list<aEnd; ++pad_list )
{
D_PAD* pad = *pad_list;
......@@ -1169,7 +1165,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
*/
if( pad->m_Drill.x ) // pad under testing has a hole, test this hole against pad reference
{
dummypad.SetPosition( pad->GetPosition() );
dummypad.SetPosition( pad->GetPosition() );
dummypad.m_Size = pad->m_Drill;
dummypad.m_PadShape = pad->m_DrillShape == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE;
dummypad.m_Orient = pad->m_Orient;
......@@ -1184,7 +1180,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
if( aRefPad->m_Drill.x ) // pad reference has a hole
{
dummypad.SetPosition( aRefPad->GetPosition() );
dummypad.SetPosition( aRefPad->GetPosition() );
dummypad.m_Size = aRefPad->m_Drill;
dummypad.m_PadShape = aRefPad->m_DrillShape == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE;
dummypad.m_Orient = aRefPad->m_Orient;
......@@ -1233,8 +1229,9 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, LISTE_PAD* aStart, LISTE_PAD* aEnd,
wxPoint rotate( wxPoint p, int angle )
{
wxPoint n;
double theta = M_PI * (double) angle / 1800.0;
n.x = wxRound( (double ) p.x * cos( theta ) - (double) p.y * sin( theta ) );
double theta = M_PI * (double) angle / 1800.0;
n.x = wxRound( (double) p.x * cos( theta ) - (double) p.y * sin( theta ) );
n.y = wxRound( p.x * sin( theta ) + p.y * cos( theta ) );
return n;
}
......@@ -1253,7 +1250,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
rel_pos = aPad->ReturnShapePos();
shape_pos = aRefPad->ReturnShapePos();
// rel_pos is pad position relative to the aRefPad position
// rel_pos is the aPad position relative to the aRefPad position
rel_pos -= shape_pos;
dist = (int) hypot( rel_pos.x, rel_pos.y );
......@@ -1264,8 +1261,8 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
if( (dist - aRefPad->m_Rayon - aPad->m_Rayon) >= dist_min )
goto exit;
/* Ici les pads sont proches et les cercles exinxcrits sont trop proches
* Selon les formes relatives il peut y avoir ou non erreur */
/* Here, pads are near and DRC depend on the pad shapes
* We must compare distance using a fine shape analysis */
bool swap_pads;
swap_pads = false;
......@@ -1280,6 +1277,11 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
rel_pos = -rel_pos;
}
/* Because pad exchange, aRefPad shape is PAD_CIRCLE or PAD_OVAL,
* if one of the 2 pads was a PAD_CIRCLE or PAD_OVAL.
* Therefore, if aRefPad is a PAD_RECT or a PAD_TRAPEZOID,
* the other pad is also a PAD_RECT or a PAD_TRAPEZOID
*/
switch( aRefPad->m_PadShape )
{
case PAD_CIRCLE: // aRefPad is like a track segment with a null lenght
......@@ -1296,16 +1298,21 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
case PAD_RECT:
RotatePoint( &rel_pos.x, &rel_pos.y, aRefPad->m_Orient );
pad_angle = aRefPad->m_Orient + aPad->m_Orient; // pad_angle = pad orient relative to the aRefPad orient
// pad_angle = pad orient relative to the aRefPad orient
pad_angle = aRefPad->m_Orient + aPad->m_Orient;
NORMALIZE_ANGLE_POS( pad_angle );
if( aPad->m_PadShape == PAD_RECT )
{
wxSize size = aPad->m_Size;
// The trivial case is if both rects are rotated by multiple of 90°
if( ((aRefPad->m_Orient == 0) || (aRefPad->m_Orient == 900) || (aRefPad->m_Orient == 1800)
|| (aRefPad->m_Orient == 2700)) &&
((aPad->m_Orient == 0) || (aPad->m_Orient == 900) || (aPad->m_Orient == 1800)
|| (aPad->m_Orient == 2700)) )
// The trivial case is if both rects are rotated by multiple of 90 deg
// Most of time this is the case, and the test is fast
if( ( (aRefPad->m_Orient == 0) || (aRefPad->m_Orient == 900)
|| (aRefPad->m_Orient == 1800)
|| (aRefPad->m_Orient == 2700) )
&& ( (aPad->m_Orient == 0) || (aPad->m_Orient == 900) || (aPad->m_Orient == 1800)
|| (aPad->m_Orient == 2700) ) )
{
if( (pad_angle == 900) || (pad_angle == 2700) )
{
......@@ -1324,7 +1331,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
if( ( rel_pos.y - ( (size.y + aRefPad->m_Size.y) / 2 ) ) >= dist_min )
diag = true;
}
else // Any other orient
else // al least on pad has any other orient. Test is more tricky
{
/* Use TestForIntersectionOfStraightLineSegments() for all 4 edges (segments).*/
......@@ -1332,81 +1339,109 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
* This case is not covered by the following check if one pad is
* completely contained in the other (because edges don't intersect)!
*/
if( ( (dist < aPad->m_Size.x) && (dist < aPad->m_Size.y) )||
( (dist < aRefPad->m_Size.x) && (dist < aRefPad->m_Size.y) )){
if( ( (dist < aPad->m_Size.x) && (dist < aPad->m_Size.y) )
|| ( (dist < aRefPad->m_Size.x) && (dist < aRefPad->m_Size.y) ) )
{
diag = false;
}
// Vectors from center to corner
wxPoint aPad_c2c = wxPoint(aPad->m_Size.x/2, aPad->m_Size.y/2);
wxPoint aRefPad_c2c = wxPoint(aRefPad->m_Size.x/2, aRefPad->m_Size.y/2);
wxPoint aPad_c2c = wxPoint( aPad->m_Size.x / 2, aPad->m_Size.y / 2 );
wxPoint aRefPad_c2c = wxPoint( aRefPad->m_Size.x / 2, aRefPad->m_Size.y / 2 );
for( int i = 0; i<4; i++ ) // for all edges in aPad
{
wxPoint p11 = aPad->ReturnShapePos() + rotate( aPad_c2c, aPad->m_Orient );
for (int i=0; i<4; i++){ // for all edges in aPad
wxPoint p11 = aPad->ReturnShapePos() + rotate(aPad_c2c, aPad->m_Orient);
// flip the center-to-corner vector
if(i%2 == 0){
if( i % 2 == 0 )
{
aPad_c2c.x = -aPad_c2c.x;
}else{
}
else
{
aPad_c2c.y = -aPad_c2c.y;
}
wxPoint p12 = aPad->ReturnShapePos() + rotate(aPad_c2c, aPad->m_Orient);
wxPoint p12 = aPad->ReturnShapePos() + rotate( aPad_c2c, aPad->m_Orient );
for( int j = 0; j<4; j++ ) // for all edges in aRefPad
{
wxPoint p21 = aRefPad->ReturnShapePos() + rotate( aRefPad_c2c,
aRefPad->m_Orient );
for (int j=0; j<4; j++){// for all edges in aRefPad
wxPoint p21 = aRefPad->ReturnShapePos() + rotate(aRefPad_c2c, aRefPad->m_Orient);
// flip the center-to-corner vector
if(j%2 == 0){
if( j % 2 == 0 )
{
aRefPad_c2c.x = -aRefPad_c2c.x;
}else{
}
else
{
aRefPad_c2c.y = -aRefPad_c2c.y;
}
wxPoint p22 = aRefPad->ReturnShapePos() + rotate(aRefPad_c2c, aRefPad->m_Orient);
int x,y;
double d;
int intersect = TestForIntersectionOfStraightLineSegments( p11.x, p11.y, p12.x, p12.y,
p21.x, p21.y, p22.x, p22.y,
&x, &y, &d);
;
wxPoint p22 = aRefPad->ReturnShapePos() + rotate( aRefPad_c2c,
aRefPad->m_Orient );
int x, y;
double d;
int intersect = TestForIntersectionOfStraightLineSegments( p11.x,
p11.y,
p12.x,
p12.y,
p21.x,
p21.y,
p22.x,
p22.y,
&x,
&y,
&d );
;
if( intersect || (d< dist_min) )
{
diag=false;
diag = false;
}
}
}
}
}else{
// TODO: Pad -> other shape!
}
else
{
// TODO: Pad -> other shape! (PAD_TRAPEZOID)
}
break;
case PAD_OVAL: /* an oval pad is like a track segment */
{
/* Create and test a track segment with same dimensions */
/* Create a track segment with same dimensions as the oval aRefPad
* and use checkClearanceSegmToPad function to test aPad to aRefPad clearance
*/
int segm_width;
m_segmAngle = aRefPad->m_Orient; // Segment orient.
if( aRefPad->m_Size.y < aRefPad->m_Size.x ) /* We suppose the pad is an horizontal oval */
m_segmAngle = aRefPad->m_Orient; // Segment orient.
if( aRefPad->m_Size.y < aRefPad->m_Size.x ) // Build an horizontal equiv segment
{
segm_width = aRefPad->m_Size.y;
m_segmLength = aRefPad->m_Size.x - aRefPad->m_Size.y;
}
else // it was a vertical oval, change to a rotated horizontal one
else // Vertical oval: build an horizontal equiv segment and rotate 90.0 deg
{
segm_width = aRefPad->m_Size.x;
m_segmLength = aRefPad->m_Size.y - aRefPad->m_Size.x;
m_segmAngle += 900;
}
/* the start point must be 0,0 and currently rel_pos is relative the center of pad coordinate */
int sx = -m_segmLength / 2, sy = 0; // Start point coordinate of the horizontal equivalent segment
/* the start point must be 0,0 and currently rel_pos
* is relative the center of pad coordinate */
wxPoint segstart;
segstart.x = -m_segmLength / 2; // Start point coordinate of the horizontal equivalent segment
RotatePoint( &sx, &sy, m_segmAngle ); // True start point coordinate of the equivalent segment
RotatePoint( &segstart, m_segmAngle ); // True start point coordinate of the equivalent segment
m_spotcx = rel_pos.x - sx;
m_spotcy = rel_pos.y - sy; // pad position / segment origin
m_finx = - 2 * sx;
m_finy = - 2 * sy; // end of segment coordinate
diag = checkClearanceSegmToPad( aPad, segm_width / 2, dist_min );
// move pad position relative to the segment origin
m_spotcx = rel_pos.x - segstart.x;
m_spotcy = rel_pos.y - segstart.y;
// Calculate segment end
m_finx = -2 * segstart.x;
m_finy = -2 * segstart.y; // end of segment coordinate
diag = checkClearanceSegmToPad( aPad, segm_width / 2, dist_min );
break;
}
......@@ -1576,6 +1611,9 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMi
}
break;
case PAD_TRAPEZOID: //TODO
break;
}
}
return true;
......
......@@ -17,6 +17,8 @@
#include "autorout.h"
#include "protos.h"
#include "dialog_drc.h"
#include "kicad_device_context.h"
#include "dialog_global_edit_tracks_and_vias.h"
......@@ -213,7 +215,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_DRC_CONTROL:
Install_Test_DRC_Frame( &dc );
m_drc->ShowDialog();;
break;
case ID_GET_NETLIST:
......
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