Commit f00696e8 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: fix bug 804780.

All: use double instead of int to store zoom values.
parent bcfac4b4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -222,9 +222,9 @@ void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos,
}


int WinEDA3D_DrawFrame::BestZoom()
double WinEDA3D_DrawFrame::BestZoom()
{
    return 1;
    return 1.0;
}


+1 −1
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ public:
    void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
    void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
    void OnKeyEvent( wxKeyEvent& event );
    int  BestZoom();
    double BestZoom();
    void RedrawActiveWindow( wxDC* DC, bool EraseBg );
    void Process_Special_Functions( wxCommandEvent& event );
    void Process_Zoom( wxCommandEvent& event );
+8 −12
Original line number Diff line number Diff line
@@ -24,8 +24,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
    m_FirstRedraw      = TRUE;
    m_ScreenNumber     = 1;
    m_NumberOfScreen   = 1;  /* Hierarchy: Root: ScreenNumber = 1 */
    m_ZoomScalar       = 10;
    m_Zoom             = 32 * m_ZoomScalar;
     m_Zoom            = 32.0;
    m_Grid.m_Size      = wxRealPoint( 50, 50 );   /* Default grid size */
    m_Grid.m_Id        = ID_POPUP_GRID_LEVEL_50;
    m_Center           = true;
@@ -106,7 +105,7 @@ void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
 */
double BASE_SCREEN::GetScalingFactor() const
{
    double scale = (double) m_ZoomScalar / (double) GetZoom();
    double scale = 1.0 / GetZoom();
    return scale;
}

@@ -118,7 +117,7 @@ double BASE_SCREEN::GetScalingFactor() const
 */
void BASE_SCREEN::SetScalingFactor(double aScale )
{
    int zoom = static_cast<int>( ceil(aScale * m_ZoomScalar) );
    double zoom = aScale;

    // Limit zoom to max and min allowed values:
    if (zoom < m_ZoomList[0])
@@ -132,7 +131,7 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
    SetZoom( zoom );
}

void BASE_SCREEN::SetZoomList( const wxArrayInt& zoomlist )
void BASE_SCREEN::SetZoomList( const wxArrayDouble& zoomlist )
{
    if( !m_ZoomList.IsEmpty() )
        m_ZoomList.Empty();
@@ -145,9 +144,9 @@ bool BASE_SCREEN::SetFirstZoom()
{
    if( m_ZoomList.IsEmpty() )
    {
        if( m_Zoom != m_ZoomScalar )
        if( m_Zoom != 1.0 )
        {
            m_Zoom = m_ZoomScalar;
            m_Zoom = 1.0;
            return true;
        }
    }
@@ -161,22 +160,19 @@ bool BASE_SCREEN::SetFirstZoom()
}


int BASE_SCREEN::GetZoom() const
double BASE_SCREEN::GetZoom() const
{
    return m_Zoom;
}


bool BASE_SCREEN::SetZoom( int coeff )
bool BASE_SCREEN::SetZoom( double coeff )
{
    if( coeff == m_Zoom )
        return false;

    m_Zoom = coeff;

    if( m_Zoom < 1 )
        m_Zoom = 1;

    return true;
}

+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
#endif

#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-07-03)"
#define KICAD_BUILD_VERSION "(2011-07-04)"
#endif


+2 −5
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )


/* Return the current zoom level */
int EDA_DRAW_FRAME::GetZoom( void )
double EDA_DRAW_FRAME::GetZoom( void )
{
    return GetScreen()->GetZoom();
}
@@ -658,10 +658,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
        return;

    /* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
    if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 )
        Line.Printf( wxT( "Z %d" ), screen->GetZoom() / screen->m_ZoomScalar );
    else
        Line.Printf( wxT( "Z %.1f" ), (float)screen->GetZoom() / screen->m_ZoomScalar );
    Line.Printf( wxT( "Z %g" ), screen->GetZoom() );

    SetStatusText( Line, 1 );

Loading