DRC markers can now be selected and deleted in GAL like other items.
Fixes: lp:1621190 * https://bugs.launchpad.net/kicad/+bug/1621190
This commit is contained in:
parent
cc3d79f932
commit
18a9f037d2
|
@ -149,3 +149,8 @@ void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
aCount = 1;
|
||||
aLayers[0] = ITEM_GAL_LAYER( DRC_VISIBLE );
|
||||
}
|
||||
|
||||
const EDA_RECT MARKER_PCB::GetBoundingBox() const
|
||||
{
|
||||
return EDA_RECT( m_Pos, wxSize( 1300000, 1300000 ) );
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@ public:
|
|||
return BOX2I( m_Pos, VECTOR2I( 1300000, 1300000 ) );
|
||||
}
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
|
104
pcbnew/drc.cpp
104
pcbnew/drc.cpp
|
@ -52,7 +52,7 @@
|
|||
|
||||
#include <dialog_drc.h>
|
||||
#include <wx/progdlg.h>
|
||||
|
||||
#include <board_commit.h>
|
||||
|
||||
void DRC::ShowDRCDialog( wxWindow* aParent )
|
||||
{
|
||||
|
@ -88,6 +88,12 @@ void DRC::ShowDRCDialog( wxWindow* aParent )
|
|||
}
|
||||
}
|
||||
|
||||
void DRC::addMarkerToPcb( MARKER_PCB *aMarker )
|
||||
{
|
||||
BOARD_COMMIT commit ( m_pcbEditorFrame );
|
||||
commit.Add( aMarker );
|
||||
commit.Push( _(""), false );
|
||||
}
|
||||
|
||||
void DRC::DestroyDRCDialog( int aReason )
|
||||
{
|
||||
|
@ -345,10 +351,8 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg )
|
|||
FmtVal( g.m_TrackClearance )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
ret = false;
|
||||
}
|
||||
#endif
|
||||
|
@ -361,10 +365,8 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg )
|
|||
FmtVal( g.m_TrackMinWidth )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
|
@ -376,10 +378,8 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg )
|
|||
FmtVal( g.m_ViasMinSize )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
|
@ -391,10 +391,8 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg )
|
|||
FmtVal( g.m_ViasMinDrill )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
|
@ -406,10 +404,8 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg )
|
|||
FmtVal( g.m_MicroViasMinSize )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
|
@ -421,10 +417,8 @@ bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg )
|
|||
FmtVal( g.m_MicroViasMinDrill )
|
||||
);
|
||||
|
||||
m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
|
@ -487,9 +481,8 @@ void DRC::testPad2Pad()
|
|||
if( !doPadToPadsDrc( pad, &sortedPads[i], listEnd, x_limit ) )
|
||||
{
|
||||
wxASSERT( m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb ( m_currentMarker );
|
||||
m_currentMarker = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -540,9 +533,8 @@ void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar )
|
|||
if( !doTrackDrc( segm, segm->Next(), true ) )
|
||||
{
|
||||
wxASSERT( m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb ( m_currentMarker );
|
||||
m_currentMarker = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,11 +605,9 @@ void DRC::testZones()
|
|||
|
||||
if( ( netcode < 0 ) || pads_in_net == 0 )
|
||||
{
|
||||
m_currentMarker = fillMarker( test_area,
|
||||
DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = NULL;
|
||||
addMarkerToPcb( fillMarker( test_area,
|
||||
DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -649,11 +639,9 @@ void DRC::testKeepoutAreas()
|
|||
if( area->Outline()->Distance( segm->GetStart(), segm->GetEnd(),
|
||||
segm->GetWidth() ) == 0 )
|
||||
{
|
||||
m_currentMarker = fillMarker( segm, NULL,
|
||||
DRCE_TRACK_INSIDE_KEEPOUT, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( segm, NULL,
|
||||
DRCE_TRACK_INSIDE_KEEPOUT, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
}
|
||||
}
|
||||
else if( segm->Type() == PCB_VIA_T )
|
||||
|
@ -666,11 +654,9 @@ void DRC::testKeepoutAreas()
|
|||
|
||||
if( area->Outline()->Distance( segm->GetPosition() ) < segm->GetWidth()/2 )
|
||||
{
|
||||
m_currentMarker = fillMarker( segm, NULL,
|
||||
DRCE_VIA_INSIDE_KEEPOUT, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = 0;
|
||||
addMarkerToPcb( fillMarker( segm, NULL,
|
||||
DRCE_VIA_INSIDE_KEEPOUT, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -726,12 +712,10 @@ void DRC::testTexts()
|
|||
|
||||
if( dist < min_dist )
|
||||
{
|
||||
m_currentMarker = fillMarker( track, text,
|
||||
DRCE_TRACK_INSIDE_TEXT,
|
||||
m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = NULL;
|
||||
addMarkerToPcb( fillMarker( track, text,
|
||||
DRCE_TRACK_INSIDE_TEXT,
|
||||
m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -746,11 +730,9 @@ void DRC::testTexts()
|
|||
|
||||
if( segtest.PointCloserThan( track->GetPosition(), min_dist ) )
|
||||
{
|
||||
m_currentMarker = fillMarker( track, text,
|
||||
DRCE_VIA_INSIDE_TEXT, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = NULL;
|
||||
addMarkerToPcb( fillMarker( track, text,
|
||||
DRCE_VIA_INSIDE_TEXT, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -796,11 +778,9 @@ void DRC::testTexts()
|
|||
if( !checkClearanceSegmToPad( pad, text->GetThickness(),
|
||||
pad->GetClearance(NULL) ) )
|
||||
{
|
||||
m_currentMarker = fillMarker( pad, text,
|
||||
DRCE_PAD_INSIDE_TEXT, m_currentMarker );
|
||||
m_pcb->Add( m_currentMarker );
|
||||
m_pcbEditorFrame->GetGalCanvas()->GetView()->Add( m_currentMarker );
|
||||
m_currentMarker = NULL;
|
||||
addMarkerToPcb( fillMarker( pad, text,
|
||||
DRCE_PAD_INSIDE_TEXT, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,6 +254,11 @@ private:
|
|||
*/
|
||||
MARKER_PCB* fillMarker( int aErrorCode, const wxString& aMessage, MARKER_PCB* fillMe );
|
||||
|
||||
/**
|
||||
* Function addMarkerToPcb
|
||||
* Adds a DRC marker to the PCB throught the COMMIT mechanism.
|
||||
*/
|
||||
void addMarkerToPcb( MARKER_PCB *aMarker );
|
||||
|
||||
//-----<categorical group tests>-----------------------------------------
|
||||
|
||||
|
|
|
@ -1108,7 +1108,16 @@ void PCB_PAINTER::draw( const MARKER_PCB* aMarker )
|
|||
|
||||
m_gal->Save();
|
||||
m_gal->Translate( aMarker->GetPosition() );
|
||||
m_gal->SetFillColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
|
||||
|
||||
if( aMarker->IsSelected() )
|
||||
{
|
||||
m_gal->SetFillColor( COLOR4D( 1.0, 0.5, 0.5, 1.0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gal->SetFillColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
|
||||
}
|
||||
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetIsStroke( false );
|
||||
m_gal->DrawPolygon( arrow, sizeof( arrow ) / sizeof( VECTOR2D ) );
|
||||
|
|
Loading…
Reference in New Issue