Commit 035b5102 authored by charras's avatar charras
Browse files

In popup menu: display grid both in mm and inches

parent 25720516
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,12 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.




2010-Feb-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
Eeschema, libedit: fixed add/remove alias functions, broken
All: added in popup menus hotkeys info for zoom commands


2010-Feb-14 UPDATE Jerry Jacobs <xor.gate.engineering[at]gmail[dot]com>
2010-Feb-14 UPDATE Jerry Jacobs <xor.gate.engineering[at]gmail[dot]com>
================================================================================
================================================================================
++ KiCad
++ KiCad
+12 −13
Original line number Original line Diff line number Diff line
@@ -177,14 +177,9 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
 */
 */
void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
{
{
    size_t      i;
    int         maxZoomIds;
    int         maxZoomIds;
    int         zoom;
    int         zoom;
    wxRealPoint grid;
    wxString    msg;
    wxString    msg;
    GRID_TYPE   tmp;
    wxMenu*     gridMenu;
    double      gridValue;
    BASE_SCREEN * screen = DrawPanel->GetScreen();
    BASE_SCREEN * screen = DrawPanel->GetScreen();


    msg = AddHotkeyName( _( "Center" ), m_HotkeysZoomAndGridList, HK_ZOOM_CENTER );
    msg = AddHotkeyName( _( "Center" ), m_HotkeysZoomAndGridList, HK_ZOOM_CENTER );
@@ -210,7 +205,7 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
                 maxZoomIds : screen->m_ZoomList.GetCount();
                 maxZoomIds : screen->m_ZoomList.GetCount();


    /* Populate zoom submenu. */
    /* Populate zoom submenu. */
    for( i = 0; i < (size_t) maxZoomIds; i++ )
    for( int i = 0; i < maxZoomIds; i++ )
    {
    {
        if( ( screen->m_ZoomList[i] % screen->m_ZoomScalar ) == 0 )
        if( ( screen->m_ZoomList[i] % screen->m_ZoomScalar ) == 0 )
            msg.Printf( wxT( "%u" ),
            msg.Printf( wxT( "%u" ),
@@ -229,17 +224,20 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
    /* Create grid submenu as required. */
    /* Create grid submenu as required. */
    if( !screen->m_GridList.IsEmpty() )
    if( !screen->m_GridList.IsEmpty() )
    {
    {
        gridMenu = new wxMenu;
        wxMenu* gridMenu = new wxMenu;
        ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu,
        ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu,
                                   ID_POPUP_GRID_SELECT, _( "Grid Select" ),
                                   ID_POPUP_GRID_SELECT, _( "Grid Select" ),
                                   grid_select_xpm );
                                   grid_select_xpm );


        grid = screen->GetGridSize();
        GRID_TYPE   tmp;
        wxRealPoint grid = screen->GetGridSize();


        for( i = 0; i < screen->m_GridList.GetCount(); i++ )
        for( unsigned i = 0; i < screen->m_GridList.GetCount(); i++ )
        {
        {
            tmp = screen->m_GridList[i];
            tmp = screen->m_GridList[i];
            gridValue = To_User_Unit( g_UnitMetric, tmp.m_Size.x,
            double gridValueInch = To_User_Unit( 0, tmp.m_Size.x,
                                      m_InternalUnits );
            double gridValue_mm = To_User_Unit( 1, tmp.m_Size.x,
                                      m_InternalUnits );
                                      m_InternalUnits );


            if( tmp.m_Id == ID_POPUP_GRID_USER )
            if( tmp.m_Id == ID_POPUP_GRID_USER )
@@ -249,10 +247,11 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
            else
            else
            {
            {
                if( g_UnitMetric == 0 )     // inches
                if( g_UnitMetric == 0 )     // inches
                    msg.Printf( wxT( "%.1f mils" ), gridValue * 1000 );
                    msg.Printf( wxT( "%.1f mils\t(%.3f mm)" ),
                                gridValueInch * 1000, gridValue_mm );
                else
                else
                    msg.Printf( wxT( "%.3f mm" ), gridValue );
                    msg.Printf( wxT( "%.3f mm\t(%.1f mils)" ),
                msg = _( "Grid: " ) + msg;
                                gridValue_mm, gridValueInch * 1000 );
            }
            }
            gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );
            gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );
            if( grid == tmp.m_Size )
            if( grid == tmp.m_Size )
−266 B (218 KiB)

File changed.

No diff preview for this file type.

+794 −777

File changed.

Preview size limit exceeded, changes collapsed.