Commit 92064f1d authored by stambaughw's avatar stambaughw
Browse files

Fix save last grid size and other minor updates.

* Create single event handler for grid size events.
* Fix all frame windows to use new grid size event handler.
* Use offset relative to ID instead of ComboBox index to save last grid size.
* Move last grid size load/save setting into WinEDA_DrawFrame.
* Add equality and assignment operators the GRID_TYPE.
* Add current grid helper methods to BASE_SCREEN.
* Add GetPins helper to LIB_COMPONENT to replace GetNextPin where applicable.
* Add AppendMsgPanel helper to WinEDA_DrawFrame.
* Improve rounding for display of coordinates when millimeter units are selected.
parent 9250eb4e
Loading
Loading
Loading
Loading
+31 −17
Original line number Original line Diff line number Diff line
@@ -34,7 +34,8 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
    m_NumberOfScreen   = 1;  /* Hierarchy: Root: ScreenNumber = 1 */
    m_NumberOfScreen   = 1;  /* Hierarchy: Root: ScreenNumber = 1 */
    m_ZoomScalar       = 10;
    m_ZoomScalar       = 10;
    m_Zoom             = 32 * m_ZoomScalar;
    m_Zoom             = 32 * m_ZoomScalar;
    m_Grid             = wxRealPoint( 50, 50 );   /* Default grid size */
    m_Grid.m_Size      = wxRealPoint( 50, 50 );   /* Default grid size */
    m_Grid.m_Id        = ID_POPUP_GRID_LEVEL_50;
    m_UserGridIsON     = FALSE;
    m_UserGridIsON     = FALSE;
    m_Center           = true;
    m_Center           = true;
    m_CurrentSheetDesc = &g_Sheet_A4;
    m_CurrentSheetDesc = &g_Sheet_A4;
@@ -357,25 +358,26 @@ void BASE_SCREEN::SetGrid( const wxRealPoint& size )


    size_t i;
    size_t i;


    wxRealPoint nearest_grid = m_GridList[0].m_Size;
    GRID_TYPE nearest_grid = m_GridList[0];

    for( i = 0; i < m_GridList.GetCount(); i++ )
    for( i = 0; i < m_GridList.GetCount(); i++ )
    {
    {
        if( m_GridList[i].m_Size == size )
        if( m_GridList[i].m_Size == size )
        {
        {
            m_Grid = m_GridList[i].m_Size;
            m_Grid = m_GridList[i];
            return;
            return;
        }
        }


        // keep trace of the nearest grill size, if the exact size is not found
        // keep trace of the nearest grill size, if the exact size is not found
        if ( size.x < m_GridList[i].m_Size.x )
        if ( size.x < m_GridList[i].m_Size.x )
            nearest_grid = m_GridList[i].m_Size;
            nearest_grid = m_GridList[i];
    }
    }


    m_Grid = nearest_grid;
    m_Grid = nearest_grid;


    wxLogWarning( wxT( "Grid size( %f, %f ) not in grid list, falling back " ) \
    wxLogWarning( wxT( "Grid size( %f, %f ) not in grid list, falling back " ) \
                  wxT( "to grid size( %f, %f )." ),
                  wxT( "to grid size( %f, %f )." ),
                  size.x, size.y, m_Grid.x, m_Grid.y );
                  size.x, size.y, m_Grid.m_Size.x, m_Grid.m_Size.y );
}
}


/* Set grid size from command ID. */
/* Set grid size from command ID. */
@@ -389,15 +391,16 @@ void BASE_SCREEN::SetGrid( int id )
    {
    {
        if( m_GridList[i].m_Id == id )
        if( m_GridList[i].m_Id == id )
        {
        {
            m_Grid = m_GridList[i].m_Size;
            m_Grid = m_GridList[i];
            return;
            return;
        }
        }
    }
    }


    m_Grid = m_GridList[0].m_Size;
    m_Grid = m_GridList[0];


    wxLogWarning( wxT( "Grid ID %d not in grid list, falling back to " ) \
    wxLogWarning( wxT( "Grid ID %d not in grid list, falling back to " ) \
                  wxT( "grid size( %g, %g )." ), id, m_Grid.x, m_Grid.y );
                  wxT( "grid size( %g, %g )." ), id, m_Grid.m_Size.x,
                  m_Grid.m_Size.y );
}
}


void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
@@ -406,8 +409,8 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )


    for( i = 0; i < m_GridList.GetCount(); i++ )
    for( i = 0; i < m_GridList.GetCount(); i++ )
    {
    {
        if( m_GridList[i].m_Size == grid.m_Size &&
        if( m_GridList[i].m_Size == grid.m_Size
               grid.m_Id != ID_POPUP_GRID_USER)
            && grid.m_Id != ID_POPUP_GRID_USER )
        {
        {
            wxLogDebug( wxT( "Discarding duplicate grid size( %g, %g )." ),
            wxLogDebug( wxT( "Discarding duplicate grid size( %g, %g )." ),
                        grid.m_Size.x, grid.m_Size.y );
                        grid.m_Size.x, grid.m_Size.y );
@@ -446,13 +449,13 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )


    if( units == MILLIMETRE )
    if( units == MILLIMETRE )
    {
    {
        x = size.x / 25.4;
        x = size.x / 25.4000508001016;
        y = size.y / 25.4;
        y = size.y / 25.4000508001016;
    }
    }
    else if( units == CENTIMETRE )
    else if( units == CENTIMETRE )
    {
    {
        x = size.x / 2.54;
        x = size.x / 2.54000508001016;
        y = size.y / 2.54;
        y = size.y / 2.54000508001016;
    }
    }
    else
    else
    {
    {
@@ -468,14 +471,25 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )
    AddGrid( new_grid );
    AddGrid( new_grid );
}
}


/*********************************/

wxRealPoint BASE_SCREEN::GetGrid()
GRID_TYPE BASE_SCREEN::GetGrid()
/*********************************/
{
{
    return m_Grid;
    return m_Grid;
}
}




wxRealPoint BASE_SCREEN::GetGridSize()
{
    return m_Grid.m_Size;
}


int BASE_SCREEN::GetGridId()
{
    return m_Grid.m_Id;
}


/*****************************************/
/*****************************************/
void BASE_SCREEN::ClearUndoRedoList()
void BASE_SCREEN::ClearUndoRedoList()
/*****************************************/
/*****************************************/
+2 −2
Original line number Original line Diff line number Diff line
@@ -423,7 +423,7 @@ double To_User_Unit( bool is_metric, double val, int internal_unit_value )
    double value;
    double value;


    if( is_metric )
    if( is_metric )
        value = val * 25.4 / internal_unit_value;
        value = val * 25.4000508001016 / internal_unit_value;
    else
    else
        value = val / internal_unit_value;
        value = val / internal_unit_value;


@@ -441,7 +441,7 @@ int From_User_Unit( bool is_metric, double val, int internal_unit_value )
    double value;
    double value;


    if( is_metric )
    if( is_metric )
        value = val * internal_unit_value / 25.4;
        value = val * internal_unit_value / 25.4000508001016;
    else
    else
        value = val * internal_unit_value;
        value = val * internal_unit_value;


+131 −35
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@
/* Configuration entry names. */
/* Configuration entry names. */
static const wxString CursorShapeEntry( wxT( "CuShape" ) );
static const wxString CursorShapeEntry( wxT( "CuShape" ) );
static const wxString ShowGridEntry( wxT( "ShGrid" ) );
static const wxString ShowGridEntry( wxT( "ShGrid" ) );
static const wxString LastGridSizeId( wxT( "_LastGridSize" ) );




BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
@@ -32,6 +33,8 @@ BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
    EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
    EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
    EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
    EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
                    WinEDA_DrawFrame::OnZoom )
                    WinEDA_DrawFrame::OnZoom )
    EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
                    WinEDA_DrawFrame::OnSelectGrid )
END_EVENT_TABLE()
END_EVENT_TABLE()




@@ -67,6 +70,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
    m_Draw_Auxiliary_Axis = FALSE;  // TRUE pour avoir les axes auxiliares dessines
    m_Draw_Auxiliary_Axis = FALSE;  // TRUE pour avoir les axes auxiliares dessines
    m_UnitType            = INTERNAL_UNIT_TYPE;    // Internal unit = inch
    m_UnitType            = INTERNAL_UNIT_TYPE;    // Internal unit = inch
    m_CursorShape         = 0;
    m_CursorShape         = 0;
    m_LastGridSizeId      = 0;


    // Internal units per inch: = 1000 for schema, = 10000 for PCB
    // Internal units per inch: = 1000 for schema, = 10000 for PCB
    m_InternalUnits       = EESCHEMA_INTERNAL_UNIT;
    m_InternalUnits       = EESCHEMA_INTERNAL_UNIT;
@@ -191,23 +195,65 @@ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event )
}
}




/********************************************************/
void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
/********************************************************/
// Virtual function
// Virtual function
void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
{
    int* clientData;
    int  id = ID_POPUP_GRID_LEVEL_100;

    if( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED )
    {
    {
        if( m_SelGridBox == NULL )
        if( m_SelGridBox == NULL )
        return;                        // Should not occurs
            return;

        /*
         * Don't use wxCommandEvent::GetClientData() here.  It always
         * returns NULL in GTK.  This solution is not as elegant but
         * it works.
         */
        int index = m_SelGridBox->GetSelection();
        wxASSERT( index != wxNOT_FOUND );
        clientData = (int*) m_SelGridBox->GetClientData( index );

        if( clientData != NULL )
            id = *clientData;
    }
    else
    {
        id = event.GetId();

        /* Update the grid select combobox if the grid size was changed
         * by menu event.
         */
        if( m_SelGridBox != NULL )
        {
            for( size_t i = 0; i < m_SelGridBox->GetCount(); i++ )
            {
                clientData = (int*) m_SelGridBox->GetClientData( i );

                if( clientData && id == *clientData )
                {
                    m_SelGridBox->SetSelection( i );
                    break;
                }
            }
        }
    }


    BASE_SCREEN* screen = GetBaseScreen();
    BASE_SCREEN* screen = GetBaseScreen();


    screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
    if( screen->GetGridId() == id )
    wxRealPoint current_grid = screen->GetGrid();
        return;
    screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 );
    wxRealPoint selected_grid = screen->GetGrid();


    if( selected_grid != current_grid )
    /*
        Recadre_Trace( FALSE );
     * This allows for saving non-sequential command ID offsets used that
     * may be used in the grid size combobox.  Do not use the selection
     * index returned by GetSelection().
     */
    m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
    screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
    screen->SetGrid( event.GetId() );
    Refresh();
}
}




@@ -652,30 +698,43 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
    }
    }
}
}


/* used in UpdateStatusBar() when coordinates are in mm
/**
 * try to approximate a coordinate (in 0.001 mm) to an easy to read number
 * Round to the nearest precision.
 *
 * Try to approximate a coordinate using a given precision to prevent
 * rounding errors when converting from inches to mm.
 *
 * ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
 * ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
 */
 */
double Round_To_0(double x)
double RoundTo0( double x, double precision )
{
{
    long long ix = wxRound(x * 1000); // ix is in 0.001 mm
    assert( precision != 0 );
    if ( x < 0 ) NEGATE(ix);

    long long ix = wxRound( x * precision );
    if ( x < 0.0 )
        NEGATE( ix );

    int remainder = ix % 10;   // remainder is in precision mm


    int remainder = ix%10;  // remainder is in 0.001 mm
    if ( remainder <= 2 )
    if ( remainder <= 2 )
        ix -= remainder;       // truncate to the near number
        ix -= remainder;       // truncate to the near number
    else if (remainder >= 8 )
    else if (remainder >= 8 )
        ix += 10 - remainder;  // round to near number
        ix += 10 - remainder;  // round to near number


    if ( x < 0 ) NEGATE(ix);
    if ( x < 0 )
    return (double)ix/1000.0;
        NEGATE( ix );

    return (double) ix / precision;
}
}


/** Function UpdateStatusBar()
/**
 * Function UpdateStatusBar()
 * Displays in the bottom of the main window a stust:
 * Displays in the bottom of the main window a stust:
 *  - Absolute Cursor coordinates
 *  - Absolute Cursor coordinates
 *  - Relative Cursor coordinates (relative to the last coordinate stored when actiavte the space bar)
 *  - Relative Cursor coordinates (relative to the last coordinate stored
 * ( in this status is also displayed the zoom level, but this is not made by this function)
 *     when actiavte the space bar)
 * ( in this status is also displayed the zoom level, but this is not made
 *   by this function )
 */
 */
void WinEDA_DrawFrame::UpdateStatusBar()
void WinEDA_DrawFrame::UpdateStatusBar()
{
{
@@ -690,21 +749,31 @@ void WinEDA_DrawFrame::UpdateStatusBar()
    if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 )
    if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 )
        Line.Printf( wxT( "Z %d" ), screen->GetZoom() / screen->m_ZoomScalar );
        Line.Printf( wxT( "Z %d" ), screen->GetZoom() / screen->m_ZoomScalar );
    else
    else
        Line.Printf( wxT( "Z %.1f" ), (float)screen->GetZoom() / screen->m_ZoomScalar );
        Line.Printf( wxT( "Z %.1f" ),
                     (float)screen->GetZoom() / screen->m_ZoomScalar );
    SetStatusText( Line, 1 );
    SetStatusText( Line, 1 );


    /* Display absolute coordinates:  */
    /* Display absolute coordinates:  */
    double dXpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.x, m_InternalUnits );
    double dXpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
    double dYpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.y, m_InternalUnits );
                                 m_InternalUnits );
    /* When using mm the conversion from 1/10000 inch to mm can give some non easy to read numbers,
    double dYpos = To_User_Unit( g_UnitMetric, screen->m_Curseur.y,
     * like 1.999 or 2.001 that be better if displayed 2.000, so small diffs are filtered here.
                                 m_InternalUnits );
    /*
     * Converting from inches to mm can give some coordinates due to
     * float point precision rounding errors, like 1.999 or 2.001 so
     * round to the nearest drawing precision required by the application.
    */
    */
    if ( g_UnitMetric )
    if ( g_UnitMetric )
    {
    {
        dXpos = Round_To_0(dXpos);
        dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) );
        dYpos = Round_To_0(dYpos);
        dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) );
    }
    }
    Line.Printf( g_UnitMetric ? wxT( "X %.3f  Y %.3f" ) : wxT( "X %.4f  Y %.4f" ), dXpos, dYpos );
    if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT )
        Line.Printf( g_UnitMetric ? wxT( "X %.2f  Y %.2f" ) :
                     wxT( "X %.3f  Y %.3f" ), dXpos, dYpos );
    else
        Line.Printf( g_UnitMetric ? wxT( "X %.3f  Y %.3f" ) :
                     wxT( "X %.4f  Y %.4f" ), dXpos, dYpos );
    SetStatusText( Line, 2 );
    SetStatusText( Line, 2 );


    /* Display relative coordinates:  */
    /* Display relative coordinates:  */
@@ -714,10 +783,15 @@ void WinEDA_DrawFrame::UpdateStatusBar()
    dYpos = To_User_Unit( g_UnitMetric, dy, m_InternalUnits );
    dYpos = To_User_Unit( g_UnitMetric, dy, m_InternalUnits );
    if ( g_UnitMetric )
    if ( g_UnitMetric )
    {
    {
        dXpos = Round_To_0(dXpos);
        dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) );
        dYpos = Round_To_0(dYpos);
        dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) );
    }
    }
    Line.Printf( g_UnitMetric ? wxT( "x %.3f  y %.3f" ) : wxT( "x %.4f  y %.4f" ), dXpos, dYpos );
    if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT )
        Line.Printf( g_UnitMetric ? wxT( "X %.2f  Y %.2f" ) :
                     wxT( "X %.3f  Y %.3f" ), dXpos, dYpos );
    else
        Line.Printf( g_UnitMetric ? wxT( "x %.3f  y %.3f" ) :
                     wxT( "x %.4f  y %.4f" ), dXpos, dYpos );


    SetStatusText( Line, 3 );
    SetStatusText( Line, 3 );
}
}
@@ -737,6 +811,7 @@ void WinEDA_DrawFrame::LoadSettings()
    WinEDA_BasicFrame::LoadSettings();
    WinEDA_BasicFrame::LoadSettings();
    cfg->Read( m_FrameName + CursorShapeEntry, &m_CursorShape, ( long )0 );
    cfg->Read( m_FrameName + CursorShapeEntry, &m_CursorShape, ( long )0 );
    cfg->Read( m_FrameName + ShowGridEntry, &m_Draw_Grid, true );
    cfg->Read( m_FrameName + ShowGridEntry, &m_Draw_Grid, true );
    cfg->Read( m_FrameName + LastGridSizeId, &m_LastGridSizeId, 0L );
}
}




@@ -755,4 +830,25 @@ void WinEDA_DrawFrame::SaveSettings()
    WinEDA_BasicFrame::SaveSettings();
    WinEDA_BasicFrame::SaveSettings();
    cfg->Write( m_FrameName + CursorShapeEntry, m_CursorShape );
    cfg->Write( m_FrameName + CursorShapeEntry, m_CursorShape );
    cfg->Write( m_FrameName + ShowGridEntry, m_Draw_Grid );
    cfg->Write( m_FrameName + ShowGridEntry, m_Draw_Grid );
    cfg->Write( m_FrameName + LastGridSizeId, ( long ) m_LastGridSizeId );
}


void WinEDA_DrawFrame::AppendMsgPanel( const wxString& textUpper,
                                       const wxString& textLower,
                                       int color, int pad )
{
    if( MsgPanel == NULL )
        return;

    MsgPanel->AppendMessage( textUpper, textLower, color, pad );
}


void WinEDA_DrawFrame::ClearMsgPanel( void )
{
    if( MsgPanel == NULL )
        return;

    MsgPanel->EraseMsgBox();
}
}
+3 −6
Original line number Original line Diff line number Diff line
@@ -38,9 +38,6 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
    EVT_ERASE_BACKGROUND( WinEDA_DrawPanel::OnEraseBackground )
    EVT_ERASE_BACKGROUND( WinEDA_DrawPanel::OnEraseBackground )
    EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
    EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
    EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
    EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )

    EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
                    WinEDA_DrawPanel::OnPopupGridSelect )
    EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
    EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
END_EVENT_TABLE()
END_EVENT_TABLE()


@@ -186,7 +183,7 @@ void WinEDA_DrawPanel::SetZoom( int zoom )
wxRealPoint WinEDA_DrawPanel::GetGrid()
wxRealPoint WinEDA_DrawPanel::GetGrid()
/************************************/
/************************************/
{
{
    return GetScreen()->GetGrid();
    return GetScreen()->GetGridSize();
}
}




@@ -763,7 +760,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
     */
     */
    drawgrid = m_Parent->m_Draw_Grid;
    drawgrid = m_Parent->m_Draw_Grid;


    screen_grid_size = screen->GetGrid();
    screen_grid_size = screen->GetGridSize();


    wxRealPoint  dgrid = screen_grid_size;
    wxRealPoint  dgrid = screen_grid_size;
    screen->Scale( dgrid );     // dgrid = grid size in pixels
    screen->Scale( dgrid );     // dgrid = grid size in pixels
@@ -797,7 +794,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
    screen->Unscale( size );
    screen->Unscale( size );


#ifdef WX_ZOOM
#ifdef WX_ZOOM
    screen_grid_size = screen->GetGrid();
    screen_grid_size = screen->GetGridSize();


    if( DC->LogicalToDeviceXRel( (int) screen_grid_size.x ) < 5
    if( DC->LogicalToDeviceXRel( (int) screen_grid_size.x ) < 5
        || DC->LogicalToDeviceYRel( (int) screen_grid_size.y ) < 5 )
        || DC->LogicalToDeviceYRel( (int) screen_grid_size.y ) < 5 )
+8 −11
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
* @param coord = coordinate to adjust
* @param coord = coordinate to adjust
*/
*/
{
{
    wxRealPoint grid_size = GetBaseScreen()->GetGrid();
    wxRealPoint grid_size = GetBaseScreen()->GetGridSize();


    if( !GetBaseScreen()->m_UserGridIsON )
    if( !GetBaseScreen()->m_UserGridIsON )
    {
    {
@@ -183,11 +183,6 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
    UpdateStatusBar();
    UpdateStatusBar();
}
}


void WinEDA_DrawPanel::OnPopupGridSelect( wxCommandEvent& event )
{
    GetScreen()->SetGrid( event.GetId() );
    Refresh();
}


/*************************************************************/
/*************************************************************/
void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
@@ -229,9 +224,11 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
    for( i = 0; i < (size_t) maxZoomIds; i++ )
    for( i = 0; i < (size_t) maxZoomIds; i++ )
    {
    {
        if ( ( GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar ) == 0 )
        if ( ( GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar ) == 0 )
            msg.Printf( wxT( "%u" ), GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar);
            msg.Printf( wxT( "%u" ),
                        GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );
        else
        else
            msg.Printf(wxT("%.1f"),(float)GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );
            msg.Printf( wxT( "%.1f" ),
                        (float) GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );


        zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
        zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
                             wxEmptyString, wxITEM_CHECK );
                             wxEmptyString, wxITEM_CHECK );
@@ -247,7 +244,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
                                   ID_POPUP_GRID_SELECT, _( "Grid Select" ),
                                   ID_POPUP_GRID_SELECT, _( "Grid Select" ),
                                   grid_select_xpm );
                                   grid_select_xpm );


        grid = GetScreen()->GetGrid();
        grid = GetScreen()->GetGridSize();


        for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
        for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
        {
        {
Loading