Commit f7b41273 authored by dickelbeck's avatar dickelbeck

drc re-work now done

parent e6aa9435
......@@ -13,9 +13,11 @@ email address.
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
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
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>
......
......@@ -44,6 +44,8 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1:
return wxString( _("Pad near pad") );
case DRCE_VIA_HOLE_BIGGER:
return wxString( _("Via hole > diameter"));
default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
......
......@@ -337,6 +337,11 @@ BEGIN_EVENT_TABLE( DrcDialog, wxDialog )
EVT_LISTBOX( ID_CLEARANCE_LIST, DrcDialog::OnMarkerSelectionEvent)
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()
/*!
......@@ -411,7 +416,7 @@ void DrcDialog::CreateControls()
SetFont( *g_DialogFont );
////@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;
......@@ -518,13 +523,13 @@ void DrcDialog::CreateControls()
m_ClearanceListBox = new DRCLISTBOX( m_Notebook, ID_CLEARANCE_LIST, wxDefaultPosition, wxSize(100, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
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_UnconnectedListBox = new DRCLISTBOX( m_Notebook, ID_UNCONNECTED_LIST, wxDefaultPosition, wxSize(100, 100), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
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"));
......@@ -634,6 +639,9 @@ void DrcDialog::OnStartdrcClick( wxCommandEvent& event )
// run all the tests, with no UI at this time.
m_tester->RunTests();
m_Notebook->ChangeSelection(0); // display the 1at tab "... Markers ..."
// Generate the report
if( !reportName.IsEmpty() )
{
......@@ -708,6 +716,8 @@ void DrcDialog::OnListUnconnectedClick( wxCommandEvent& event )
m_tester->ListUnconnectedPads();
m_Notebook->ChangeSelection(1); // display the 2nd tab "Unconnected..."
// Generate the report
if( !reportName.IsEmpty() )
{
......@@ -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
*/
void DrcDialog::OnRightUpUnconnected( wxMouseEvent& event )
{
// @todo: add popup menu support to go to either of the items listed in the DRC_ITEM.
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 )
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();
// 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;
#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
*/
......@@ -152,6 +158,7 @@ public:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
////@end DrcDialog event handler declarations
////@begin DrcDialog member function declarations
......@@ -171,6 +178,8 @@ public:
void DelDRCMarkers();
void RedrawDrawPanel();
void OnPopupMenu( wxCommandEvent& event );
////@begin DrcDialog member variables
......
......@@ -1502,7 +1502,7 @@
<string name="proxy-Tab icon">""</string>
<bool name="proxy-Create in situ">1</bool>
<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-Foreground colour">""</string>
<string name="proxy-Font">""</string>
......@@ -1576,7 +1576,7 @@
<string name="proxy-Tab icon">""</string>
<bool name="proxy-Create in situ">1</bool>
<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-Foreground colour">""</string>
<string name="proxy-Font">""</string>
......
......@@ -320,43 +320,53 @@ void DRC::testZones()
MARKER* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER* fillMe )
{
wxString textA = aTrack->MenuText( m_pcb );
wxString textB = aItem->MenuText( m_pcb );
wxString textB;
wxPoint position;
if( aItem->Type() == TYPEPAD )
position = aItem->GetPosition();
else if( aItem->Type() == TYPEVIA )
position = aItem->GetPosition();
wxPoint posB;
else if( aItem->Type() == TYPETRACK )
if( aItem ) // aItem might be NULL
{
TRACK* track = (TRACK*) aItem;
wxPoint endPos = track->m_End;
textB = aItem->MenuText( m_pcb );
posB = aItem->GetPosition();
if( aItem->Type() == TYPEPAD )
position = aItem->GetPosition();
// either of aItem's start or end will be used for the marker position
// first assume start, then switch at end if needed. decision made on
// distance from end of aTrack.
position = track->m_Start;
double dToEnd = hypot( endPos.x - aTrack->m_End.x,
endPos.y - aTrack->m_End.y );
double dToStart = hypot( position.x - aTrack->m_End.x,
position.y - aTrack->m_End.y );
if( dToEnd < dToStart )
position = endPos;
else if( aItem->Type() == TYPEVIA )
position = aItem->GetPosition();
else if( aItem->Type() == TYPETRACK )
{
TRACK* track = (TRACK*) aItem;
wxPoint endPos = track->m_End;
// either of aItem's start or end will be used for the marker position
// first assume start, then switch at end if needed. decision made on
// distance from end of aTrack.
position = track->m_Start;
double dToEnd = hypot( endPos.x - aTrack->m_End.x,
endPos.y - aTrack->m_End.y );
double dToStart = hypot( position.x - aTrack->m_End.x,
position.y - aTrack->m_End.y );
if( dToEnd < dToStart )
position = endPos;
}
}
else
position = aTrack->GetPosition();
if( fillMe )
fillMe->SetData( aErrorCode, position,
textA, aTrack->GetPosition(),
textB, aItem->GetPosition() );
textB, posB );
else
fillMe = new MARKER( aErrorCode, position,
textA, aTrack->GetPosition(),
textB, aItem->GetPosition() );
textB, posB );
return fillMe;
}
......@@ -402,6 +412,26 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart )
net_code_ref = aRefSeg->GetNet();
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
// in tenths of degrees and its length
......
......@@ -53,6 +53,7 @@
#define DRCE_ENDS_PROBLEM4 17 ///< 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_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