Commit f7b41273 authored by dickelbeck's avatar dickelbeck

drc re-work now done

parent e6aa9435
...@@ -13,9 +13,11 @@ email address. ...@@ -13,9 +13,11 @@ email address.
for some reason after repositioning the cursor. That is not intended, but for some reason after repositioning the cursor. That is not intended, but
after several attempts to work around it, I realized it is not so bad to after several attempts to work around it, I realized it is not so bad to
have this happen. have this happen.
* Added right click popup menus to the list boxes. User must first select
the item he wants to go to, as the right click does not change the selection.
* Added WinEDA_BasePcbFrame::CursorGoto( const wxPoint& ) by factoring it * Added WinEDA_BasePcbFrame::CursorGoto( const wxPoint& ) by factoring it
out of pcbnew/find.cpp out of pcbnew/find.cpp
Almost done now, its ready for folks to start using it and testing it. Done now, its ready for folks to start using it and testing it.
2007-Dec-02 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Dec-02 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
......
...@@ -44,6 +44,8 @@ wxString DRC_ITEM::GetErrorText() const ...@@ -44,6 +44,8 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _("Tracks crossing") ); return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1: case DRCE_PAD_NEAR_PAD1:
return wxString( _("Pad near pad") ); return wxString( _("Pad near pad") );
case DRCE_VIA_HOLE_BIGGER:
return wxString( _("Via hole > diameter"));
default: default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") ); return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
......
...@@ -337,6 +337,11 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog ) ...@@ -337,6 +337,11 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog )
EVT_LISTBOX( ID_CLEARANCE_LIST, DrcDialog::OnMarkerSelectionEvent) EVT_LISTBOX( ID_CLEARANCE_LIST, DrcDialog::OnMarkerSelectionEvent)
EVT_LISTBOX( ID_UNCONNECTED_LIST, DrcDialog::OnUnconnectedSelectionEvent) EVT_LISTBOX( ID_UNCONNECTED_LIST, DrcDialog::OnUnconnectedSelectionEvent)
EVT_MENU( ID_POPUP_UNCONNECTED_A, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_UNCONNECTED_B, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_MARKERS_A, DrcDialog::OnPopupMenu )
EVT_MENU( ID_POPUP_MARKERS_B, DrcDialog::OnPopupMenu )
END_EVENT_TABLE() END_EVENT_TABLE()
/*! /*!
...@@ -411,7 +416,7 @@ void DrcDialog::CreateControls() ...@@ -411,7 +416,7 @@ void DrcDialog::CreateControls()
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
////@begin DrcDialog content construction ////@begin DrcDialog content construction
// Generated by DialogBlocks, Sun 02 Dec 2007 22:18:27 CST (unregistered) // Generated by DialogBlocks, Tue 04 Dec 2007 13:38:44 CST (unregistered)
DrcDialog* itemDialog1 = this; DrcDialog* itemDialog1 = this;
...@@ -518,13 +523,13 @@ void DrcDialog::CreateControls() ...@@ -518,13 +523,13 @@ void DrcDialog::CreateControls()
m_ClearanceListBox = new DRCLISTBOX( m_Notebook, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); m_ClearanceListBox = new DRCLISTBOX( m_Notebook, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
if (DrcDialog::ShowToolTips()) if (DrcDialog::ShowToolTips())
m_ClearanceListBox->SetToolTip(_("MARKERs on the PCB, double click on any MARKER to go there in PCB")); m_ClearanceListBox->SetToolTip(_("MARKERs, double click any to go there in PCB, right click for popup menu"));
m_Notebook->AddPage(m_ClearanceListBox, _("Distance Problem Markers")); m_Notebook->AddPage(m_ClearanceListBox, _("Distance Problem Markers"));
m_UnconnectedListBox = new DRCLISTBOX( m_Notebook, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); m_UnconnectedListBox = new DRCLISTBOX( m_Notebook, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
if (DrcDialog::ShowToolTips()) if (DrcDialog::ShowToolTips())
m_UnconnectedListBox->SetToolTip(_("Pad to pad, pad to track, and track to track clearance problems")); m_UnconnectedListBox->SetToolTip(_("A list of unconnected pads, right click for popup menu"));
m_Notebook->AddPage(m_UnconnectedListBox, _("Unconnected")); m_Notebook->AddPage(m_UnconnectedListBox, _("Unconnected"));
...@@ -634,6 +639,9 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event ) ...@@ -634,6 +639,9 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
// run all the tests, with no UI at this time. // run all the tests, with no UI at this time.
m_tester->RunTests(); m_tester->RunTests();
m_Notebook->ChangeSelection(0); // display the 1at tab "... Markers ..."
// Generate the report // Generate the report
if( !reportName.IsEmpty() ) if( !reportName.IsEmpty() )
{ {
...@@ -708,6 +716,8 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event ) ...@@ -708,6 +716,8 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
m_tester->ListUnconnectedPads(); m_tester->ListUnconnectedPads();
m_Notebook->ChangeSelection(1); // display the 2nd tab "Unconnected..."
// Generate the report // Generate the report
if( !reportName.IsEmpty() ) if( !reportName.IsEmpty() )
{ {
...@@ -874,14 +884,76 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event ) ...@@ -874,14 +884,76 @@ void DrcDialog::OnLeftDClickClearance( wxMouseEvent& event )
} }
void DrcDialog::OnPopupMenu( wxCommandEvent& event )
{
int source = event.GetId();
printf( "source=%d\n", source );
const DRC_ITEM* item = 0;
wxPoint pos;
int selection;
switch( source )
{
case ID_POPUP_UNCONNECTED_A:
selection = m_UnconnectedListBox->GetSelection();
item = m_UnconnectedListBox->GetItem( selection );
pos = item->GetPointA();
break;
case ID_POPUP_UNCONNECTED_B:
selection = m_UnconnectedListBox->GetSelection();
item = m_UnconnectedListBox->GetItem( selection );
pos = item->GetPointB();
break;
case ID_POPUP_MARKERS_A:
selection = m_ClearanceListBox->GetSelection();
item = m_ClearanceListBox->GetItem( selection );
pos = item->GetPointA();
break;
case ID_POPUP_MARKERS_B:
selection = m_ClearanceListBox->GetSelection();
item = m_ClearanceListBox->GetItem( selection );
pos = item->GetPointB();
break;
}
if( item )
{
m_Parent->CursorGoto( pos );
Hide();
}
}
/*! /*!
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST * wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
*/ */
void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event ) void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
{ {
// @todo: add popup menu support to go to either of the items listed in the DRC_ITEM.
event.Skip(); event.Skip();
// popup menu to go to either of the items listed in the DRC_ITEM.
int selection = m_UnconnectedListBox->GetSelection();
if( selection != wxNOT_FOUND )
{
wxMenu menu;
wxMenuItem* mItem;
const DRC_ITEM* dItem = m_UnconnectedListBox->GetItem( selection );
mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_A, dItem->GetTextA() );
menu.Append( mItem );
mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_B, dItem->GetTextB() );
menu.Append( mItem );
PopupMenu( &menu );
}
} }
...@@ -891,9 +963,26 @@ void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event ) ...@@ -891,9 +963,26 @@ void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
void DrcDialog::OnRightUpClearance( wxMouseEvent& event ) void DrcDialog::OnRightUpClearance( wxMouseEvent& event )
{ {
// @todo: add popup menu support to go to either of the items listed in the DRC_ITEM.
// that way a user can get to either pad.
event.Skip(); event.Skip();
// popup menu to go to either of the items listed in the DRC_ITEM.
int selection = m_ClearanceListBox->GetSelection();
if( selection != wxNOT_FOUND )
{
wxMenu menu;
wxMenuItem* mItem;
const DRC_ITEM* dItem = m_ClearanceListBox->GetItem( selection );
mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_A, dItem->GetTextA() );
menu.Append( mItem );
mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_B, dItem->GetTextB() );
menu.Append( mItem );
PopupMenu( &menu );
}
} }
......
...@@ -68,6 +68,12 @@ class wxStdDialogButtonSizer; ...@@ -68,6 +68,12 @@ class wxStdDialogButtonSizer;
#define ID_DRCLISTCTRL 14000 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX #define ID_DRCLISTCTRL 14000 // outside @end control identifiers since DialogBlocks knows not DRCLISTBOX
#define ID_POPUP_UNCONNECTED_A 14001
#define ID_POPUP_UNCONNECTED_B 14002
#define ID_POPUP_MARKERS_A 14003
#define ID_POPUP_MARKERS_B 14004
/*! /*!
* Compatibility * Compatibility
*/ */
...@@ -152,6 +158,7 @@ public: ...@@ -152,6 +158,7 @@ public:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
////@end DrcDialog event handler declarations ////@end DrcDialog event handler declarations
////@begin DrcDialog member function declarations ////@begin DrcDialog member function declarations
...@@ -172,6 +179,8 @@ public: ...@@ -172,6 +179,8 @@ public:
void DelDRCMarkers(); void DelDRCMarkers();
void RedrawDrawPanel(); void RedrawDrawPanel();
void OnPopupMenu( wxCommandEvent& event );
////@begin DrcDialog member variables ////@begin DrcDialog member variables
wxBoxSizer* m_MainSizer; wxBoxSizer* m_MainSizer;
......
...@@ -1502,7 +1502,7 @@ ...@@ -1502,7 +1502,7 @@
<string name="proxy-Tab icon">""</string> <string name="proxy-Tab icon">""</string>
<bool name="proxy-Create in situ">1</bool> <bool name="proxy-Create in situ">1</bool>
<string name="proxy-Help text">""</string> <string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">"MARKERs on the PCB, double click on any MARKER to go there in PCB"</string> <string name="proxy-Tooltip text">"MARKERs, double click any to go there in PCB, right click for popup menu"</string>
<string name="proxy-Background colour">""</string> <string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string> <string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string> <string name="proxy-Font">""</string>
...@@ -1576,7 +1576,7 @@ ...@@ -1576,7 +1576,7 @@
<string name="proxy-Tab icon">""</string> <string name="proxy-Tab icon">""</string>
<bool name="proxy-Create in situ">1</bool> <bool name="proxy-Create in situ">1</bool>
<string name="proxy-Help text">""</string> <string name="proxy-Help text">""</string>
<string name="proxy-Tooltip text">"Pad to pad, pad to track, and track to track clearance problems"</string> <string name="proxy-Tooltip text">"A list of unconnected pads, right click for popup menu"</string>
<string name="proxy-Background colour">""</string> <string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string> <string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string> <string name="proxy-Font">""</string>
......
...@@ -320,9 +320,15 @@ void DRC::testZones() ...@@ -320,9 +320,15 @@ void DRC::testZones()
MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER* fillMe ) MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER* fillMe )
{ {
wxString textA = aTrack->MenuText( m_pcb ); wxString textA = aTrack->MenuText( m_pcb );
wxString textB = aItem->MenuText( m_pcb ); wxString textB;
wxPoint position; wxPoint position;
wxPoint posB;
if( aItem ) // aItem might be NULL
{
textB = aItem->MenuText( m_pcb );
posB = aItem->GetPosition();
if( aItem->Type() == TYPEPAD ) if( aItem->Type() == TYPEPAD )
position = aItem->GetPosition(); position = aItem->GetPosition();
...@@ -348,15 +354,19 @@ MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKE ...@@ -348,15 +354,19 @@ MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKE
if( dToEnd < dToStart ) if( dToEnd < dToStart )
position = endPos; position = endPos;
} }
}
else
position = aTrack->GetPosition();
if( fillMe ) if( fillMe )
fillMe->SetData( aErrorCode, position, fillMe->SetData( aErrorCode, position,
textA, aTrack->GetPosition(), textA, aTrack->GetPosition(),
textB, aItem->GetPosition() ); textB, posB );
else else
fillMe = new MARKER( aErrorCode, position, fillMe = new MARKER( aErrorCode, position,
textA, aTrack->GetPosition(), textA, aTrack->GetPosition(),
textB, aItem->GetPosition() ); textB, posB );
return fillMe; return fillMe;
} }
...@@ -403,6 +413,26 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart ) ...@@ -403,6 +413,26 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
m_segmAngle = 0; m_segmAngle = 0;
// @todo: is this necessary?
/**************************************************************/
/* Phase 0 : test if via's hole is bigger than its diameter : */
/**************************************************************/
if( aRefSeg->Type() == TYPEVIA )
{
// This test seems necessary since the dialog box that displays the
// desired via hole size and width does not enforce a hole size smaller
// than the via's diameter.
if( aRefSeg->m_Drill > aRefSeg->m_Width )
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_VIA_HOLE_BIGGER, m_currentMarker );
return false;
}
}
// for a non horizontal or vertical segment Compute the segment angle // for a non horizontal or vertical segment Compute the segment angle
// in tenths of degrees and its length // in tenths of degrees and its length
if( dx || dy ) if( dx || dy )
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#define DRCE_ENDS_PROBLEM4 17 ///< track ends are too close #define DRCE_ENDS_PROBLEM4 17 ///< track ends are too close
#define DRCE_ENDS_PROBLEM5 18 ///< track ends are too close #define DRCE_ENDS_PROBLEM5 18 ///< track ends are too close
#define DRCE_PAD_NEAR_PAD1 19 ///< pad too close to pad #define DRCE_PAD_NEAR_PAD1 19 ///< pad too close to pad
#define DRCE_VIA_HOLE_BIGGER 20 ///< via's hole is bigger than its diameter
/** /**
......
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