From 40ccdd5763c81f521c0e7713344c307f68b86abf Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Mon, 7 May 2012 16:47:25 -0500 Subject: [PATCH] Fix Pcbnew markers in nanometer build with proper scaling factor. Use double in Zoom() --- common/drawpanel.cpp | 4 ++-- common/zoom.cpp | 5 ++++- include/class_drawpanel.h | 5 +++-- pcbnew/class_marker_pcb.cpp | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp index ee3e828bdb..0d36fad4e5 100644 --- a/common/drawpanel.cpp +++ b/common/drawpanel.cpp @@ -207,13 +207,13 @@ void EDA_DRAW_PANEL::CrossHairOn( wxDC* DC ) } -int EDA_DRAW_PANEL::GetZoom() +double EDA_DRAW_PANEL::GetZoom() { return GetScreen()->GetZoom(); } -void EDA_DRAW_PANEL::SetZoom( int zoom ) +void EDA_DRAW_PANEL::SetZoom( double zoom ) { GetScreen()->SetZoom( zoom ); } diff --git a/common/zoom.cpp b/common/zoom.cpp index 3f11a9e854..572d197a07 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -60,8 +60,11 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) BASE_SCREEN* screen = GetScreen(); // Set the best zoom and get center point. - double bestzoom = BestZoom(); + // BestZoom() can compute an illegal zoom if the client window size + // is small, say because frame is not maximized. So use the clamping form + // of SetZoom(): + double bestzoom = BestZoom(); screen->SetScalingFactor( bestzoom ); if( screen->m_FirstRedraw ) diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index 4a45027d37..1911313e3c 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -243,8 +243,9 @@ public: void OnScrollWin( wxCommandEvent& event ); void OnScroll( wxScrollWinEvent& event ); - void SetZoom( int mode ); - int GetZoom(); + void SetZoom( double mode ); + double GetZoom(); + void SetGrid( const wxRealPoint& size ); wxRealPoint GetGrid(); diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index a6300f9943..bdc42ab9c4 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -15,7 +15,8 @@ #include -#define SCALING_FACTOR 30 // Adjust the actual size of markers, when using default shape +/// Adjust the actual size of markers, when using default shape +#define SCALING_FACTOR DMils2iu( 30 ) MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :