kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #18702
[PATCH] Add zoom to DRC marker in GAL
Fixes a discrepancy between legacy and GAL described in this bug:
https://bugs.launchpad.net/kicad/+bug/1462810
Double clicking on a DRC error now zooms in to the marker. I choose a magic
number for the zoom level (90) that seemed pretty similar to the legacy
zoom level.
Thanks,
Jon Neal
diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp
index 4eafff3..c5f10d9 100644
--- a/pcbnew/dialogs/dialog_drc.cpp
+++ b/pcbnew/dialogs/dialog_drc.cpp
@@ -32,12 +32,15 @@
#include <wxPcbStruct.h>
#include <base_units.h>
#include <class_board_design_settings.h>
-
+#include <class_draw_panel_gal.h>
/* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
* and run DRC tests
*/
+// zoom level for focusing on a DRC error. Magic number, may need adjusted.
+const double DRC_MARKER_ZOOM = 90.0;
+
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) :
DIALOG_DRC_CONTROL_BASE( parent )
{
@@ -344,6 +347,8 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
*/
m_Parent->CursorGoto( item->GetPointA() );
+ m_Parent->GetGalCanvas()->GetView()->SetScale( DRC_MARKER_ZOOM );
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
// turn control over to m_Parent, hide this DIALOG_DRC_CONTROL window,
// no destruction so we can preserve listbox cursor
@@ -396,6 +401,9 @@ void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event )
if( item )
{
m_Parent->CursorGoto( pos );
+ m_Parent->GetGalCanvas()->GetView()->SetScale( DRC_MARKER_ZOOM );
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
+
Show( false );
}
}
@@ -486,6 +494,8 @@ void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
if( item )
{
m_Parent->CursorGoto( item->GetPointA() );
+ m_Parent->GetGalCanvas()->GetView()->SetScale( DRC_MARKER_ZOOM );
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
Show( false );
@@ -519,7 +529,11 @@ void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
// at the first of the two pads.
const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
if( item )
+ {
m_Parent->CursorGoto( item->GetPointA(), false );
+ m_Parent->GetGalCanvas()->GetView()->SetScale( DRC_MARKER_ZOOM );
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
+ }
}
event.Skip();
@@ -539,7 +553,11 @@ void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event )
// at the first of the two pads.
const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
if( item )
+ {
m_Parent->CursorGoto( item->GetPointA(), false );
+ m_Parent->GetGalCanvas()->GetView()->SetScale( DRC_MARKER_ZOOM );
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );
+ }
}
event.Skip();
Follow ups