Created
June 17, 2015 22:20
-
-
Save reportingsjr/1bf2f115515fe4c8de70 to your computer and use it in GitHub Desktop.
kicad drc zoom patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp | |
index 4eafff3..30fab4b 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 magicZoomLevel = 90.0; | |
+ | |
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) : | |
DIALOG_DRC_CONTROL_BASE( parent ) | |
{ | |
@@ -344,7 +347,9 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event ) | |
*/ | |
m_Parent->CursorGoto( item->GetPointA() ); | |
- | |
+ m_Parent->GetGalCanvas()->GetView()->SetScale( magicZoomLevel ); | |
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA().x, | |
+ item->GetPointA().y ) ); | |
// turn control over to m_Parent, hide this DIALOG_DRC_CONTROL window, | |
// no destruction so we can preserve listbox cursor | |
Show( false ); | |
@@ -396,6 +401,9 @@ void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event ) | |
if( item ) | |
{ | |
m_Parent->CursorGoto( pos ); | |
+ m_Parent->GetGalCanvas()->GetView()->SetScale( magicZoomLevel ); | |
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA().x, | |
+ item->GetPointA().y ) ); | |
Show( false ); | |
} | |
} | |
@@ -486,7 +494,10 @@ void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event ) | |
if( item ) | |
{ | |
m_Parent->CursorGoto( item->GetPointA() ); | |
- | |
+ m_Parent->GetGalCanvas()->GetView()->SetScale( magicZoomLevel ); | |
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA().x, | |
+ item->GetPointA().y ) ); | |
+ | |
Show( false ); | |
// We do not want the clarification popup window. | |
@@ -519,7 +530,12 @@ 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( magicZoomLevel ); | |
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA().x, | |
+ item->GetPointA().y ) ); | |
+ } | |
} | |
event.Skip(); | |
@@ -539,7 +555,12 @@ 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( magicZoomLevel ); | |
+ m_Parent->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA().x, | |
+ item->GetPointA().y ) ); | |
+ } | |
} | |
event.Skip(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment