From 0d6c62a9ef16d07d60c8cc1d2970507149d7ffc9 Mon Sep 17 00:00:00 2001 From: charras Date: Tue, 10 Feb 2009 12:37:12 +0000 Subject: [PATCH] Bug (only in my last commit) fixed under Windows. Removed some warnings in compilation --- common/base_screen.cpp | 16 ++++++++++------ common/edaappl.cpp | 7 ++++--- common/zoom.cpp | 8 +++----- cvpcb/displayframe.cpp | 8 ++++---- eeschema/controle.cpp | 24 ++++++++++++------------ gerbview/gerberframe.cpp | 2 +- pcbnew/controle.cpp | 8 ++++---- 7 files changed, 38 insertions(+), 35 deletions(-) diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 7bc6ffcbd6..c60dadce28 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -154,11 +154,8 @@ int BASE_SCREEN::Scale( int coord ) #ifdef WX_ZOOM return coord; #else - if( !m_Zoom ) - return 0; - if( !m_ZoomScalar || !m_Zoom ) - return 0; + return coord; return wxRound( (double) ( coord * m_ZoomScalar ) / (double) m_Zoom ); #endif @@ -173,8 +170,15 @@ void BASE_SCREEN::Scale( wxPoint& pt ) void BASE_SCREEN::Scale( wxRealPoint& pt ) { - pt.x = Scale( pt.x ); - pt.y = Scale( pt.y ); +#ifdef WX_ZOOM + // No change +#else + if( !m_ZoomScalar || !m_Zoom ) + return; + + pt.x = pt.x * m_ZoomScalar / (double) m_Zoom; + pt.y = pt.y * m_ZoomScalar / (double) m_Zoom; +#endif } diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 546d60a2e3..357b43e543 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -442,15 +442,16 @@ bool WinEDA_App::SetBinDir() m_BinDir = argv[0]; #endif /* __UNIX__ */ - while( m_BinDir.Last() != DIR_SEP ) - m_BinDir.RemoveLast(); - /* Use unix notation for paths. I am not sure this is a good idea, * but it simplify compatibility between Windows and Unices * However it is a potential problem in path handling under Windows */ m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); + // Remove filename form command line: + while( m_BinDir.Last() != '/' ) + m_BinDir.RemoveLast(); + wxFileName pfn( wxT( "/posix/path/specification" ), wxT( "filename" ) ); wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) ); wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() ); diff --git a/common/zoom.cpp b/common/zoom.cpp index 89b881c9d4..c21e2806d7 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -51,10 +51,8 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) if( !GetBaseScreen()->m_UserGridIsON ) { - coord->x = ( (int) round( coord->x / - grid_size.x ) ) * grid_size.x; - coord->y = ( (int) round( coord->y / - grid_size.y ) ) * grid_size.y; + coord->x = (int) round( ( coord->x / grid_size.x ) * grid_size.x ); + coord->y = (int) round( ( coord->y / grid_size.y ) * grid_size.y ); } } @@ -246,7 +244,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) { tmp = GetScreen()->m_GridList[i]; - gridValue = To_User_Unit( g_UnitMetric, tmp.m_Size.x, + gridValue = To_User_Unit( g_UnitMetric, (int) round(tmp.m_Size.x), ( (WinEDA_DrawFrame*)m_Parent )->m_InternalUnits ); if( tmp.m_Id == ID_POPUP_GRID_USER ) { diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index f94000b5bc..9fd2d2d5d1 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -234,25 +234,25 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) case WXK_NUMPAD8: /* cursor moved up */ case WXK_UP: - Mouse.y -= delta.y; + Mouse.y -= (int) round(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD2: /* cursor moved down */ case WXK_DOWN: - Mouse.y += delta.y; + Mouse.y += (int) round(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD4: /* cursor moved left */ case WXK_LEFT: - Mouse.x -= delta.x; + Mouse.x -= (int) round(delta.x); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD6: /* cursor moved right */ case WXK_RIGHT: - Mouse.x += delta.x; + Mouse.x += (int) round(delta.x); DrawPanel->MouseTo( Mouse ); break; } diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 1b4f0020ec..205eaa4069 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -248,25 +248,25 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_UP: - MousePositionInPixels.y -= delta.y; + MousePositionInPixels.y -= (int) round(delta.y); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_DOWN: - MousePositionInPixels.y += delta.y; + MousePositionInPixels.y += (int) round(delta.y); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_LEFT: - MousePositionInPixels.x -= delta.x; + MousePositionInPixels.x -= (int) round(delta.x); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_RIGHT: - MousePositionInPixels.x += delta.x; + MousePositionInPixels.x += (int) round(delta.x); DrawPanel->MouseTo( MousePositionInPixels ); break; @@ -342,25 +342,25 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_UP: - MousePositionInPixels.y -= delta.y; + MousePositionInPixels.y -= (int) round(delta.y); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_DOWN: - MousePositionInPixels.y += delta.y; + MousePositionInPixels.y += (int) round(delta.y); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_LEFT: - MousePositionInPixels.x -= delta.x; + MousePositionInPixels.x -= (int) round(delta.x); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_RIGHT: - MousePositionInPixels.x += delta.x; + MousePositionInPixels.x += (int) round(delta.x); DrawPanel->MouseTo( MousePositionInPixels ); break; @@ -436,25 +436,25 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_UP: - MousePositionInPixels.y -= delta.y; + MousePositionInPixels.y -= (int) round(delta.y); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_DOWN: - MousePositionInPixels.y += delta.y; + MousePositionInPixels.y += (int) round(delta.y); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_LEFT: - MousePositionInPixels.x -= delta.x; + MousePositionInPixels.x -= (int) round(delta.x); DrawPanel->MouseTo( MousePositionInPixels ); break; case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_RIGHT: - MousePositionInPixels.x += delta.x; + MousePositionInPixels.x += (int) round(delta.x); DrawPanel->MouseTo( MousePositionInPixels ); break; diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index 877c6355e3..8d1d917b04 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -315,5 +315,5 @@ int WinEDA_GerberFrame::BestZoom() jj = GetBoard()->m_BoundaryBox.GetHeight() / size.y; bestzoom = MAX( ii, jj ); GetScreen()->m_Curseur = GetBoard()->m_BoundaryBox.Centre(); - return bestzoom * GetScreen()->m_ZoomScalar; + return (int) round(bestzoom * GetScreen()->m_ZoomScalar); } diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index cf3aedd33e..9c3fbb7c13 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -530,25 +530,25 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) { case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_UP: - Mouse.y -= delta.y; + Mouse.y -= (int) round(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_DOWN: - Mouse.y += delta.y; + Mouse.y += (int) round(delta.y); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_LEFT: - Mouse.x -= delta.x; + Mouse.x -= (int) round(delta.x); DrawPanel->MouseTo( Mouse ); break; case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_RIGHT: - Mouse.x += delta.x; + Mouse.x += (int) round(delta.x); DrawPanel->MouseTo( Mouse ); break;