Bug (only in my last commit) fixed under Windows. Removed some warnings in compilation

This commit is contained in:
charras 2009-02-10 12:37:12 +00:00
parent af4e798b93
commit 0d6c62a9ef
7 changed files with 38 additions and 35 deletions

View File

@ -154,11 +154,8 @@ int BASE_SCREEN::Scale( int coord )
#ifdef WX_ZOOM #ifdef WX_ZOOM
return coord; return coord;
#else #else
if( !m_Zoom )
return 0;
if( !m_ZoomScalar || !m_Zoom ) if( !m_ZoomScalar || !m_Zoom )
return 0; return coord;
return wxRound( (double) ( coord * m_ZoomScalar ) / (double) m_Zoom ); return wxRound( (double) ( coord * m_ZoomScalar ) / (double) m_Zoom );
#endif #endif
@ -173,8 +170,15 @@ void BASE_SCREEN::Scale( wxPoint& pt )
void BASE_SCREEN::Scale( wxRealPoint& pt ) void BASE_SCREEN::Scale( wxRealPoint& pt )
{ {
pt.x = Scale( pt.x ); #ifdef WX_ZOOM
pt.y = Scale( pt.y ); // 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
} }

View File

@ -442,15 +442,16 @@ bool WinEDA_App::SetBinDir()
m_BinDir = argv[0]; m_BinDir = argv[0];
#endif /* __UNIX__ */ #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, /* Use unix notation for paths. I am not sure this is a good idea,
* but it simplify compatibility between Windows and Unices * but it simplify compatibility between Windows and Unices
* However it is a potential problem in path handling under Windows * However it is a potential problem in path handling under Windows
*/ */
m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); 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 pfn( wxT( "/posix/path/specification" ), wxT( "filename" ) );
wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) ); wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) );
wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() ); wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() );

View File

@ -51,10 +51,8 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
if( !GetBaseScreen()->m_UserGridIsON ) if( !GetBaseScreen()->m_UserGridIsON )
{ {
coord->x = ( (int) round( coord->x / coord->x = (int) round( ( coord->x / grid_size.x ) * grid_size.x );
grid_size.x ) ) * grid_size.x; coord->y = (int) round( ( coord->y / grid_size.y ) * grid_size.y );
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++ ) for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{ {
tmp = GetScreen()->m_GridList[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 ); ( (WinEDA_DrawFrame*)m_Parent )->m_InternalUnits );
if( tmp.m_Id == ID_POPUP_GRID_USER ) if( tmp.m_Id == ID_POPUP_GRID_USER )
{ {

View File

@ -234,25 +234,25 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: /* cursor moved up */
case WXK_UP: case WXK_UP:
Mouse.y -= delta.y; Mouse.y -= (int) round(delta.y);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD2: /* cursor moved down */ case WXK_NUMPAD2: /* cursor moved down */
case WXK_DOWN: case WXK_DOWN:
Mouse.y += delta.y; Mouse.y += (int) round(delta.y);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD4: /* cursor moved left */ case WXK_NUMPAD4: /* cursor moved left */
case WXK_LEFT: case WXK_LEFT:
Mouse.x -= delta.x; Mouse.x -= (int) round(delta.x);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD6: /* cursor moved right */ case WXK_NUMPAD6: /* cursor moved right */
case WXK_RIGHT: case WXK_RIGHT:
Mouse.x += delta.x; Mouse.x += (int) round(delta.x);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
} }

View File

@ -248,25 +248,25 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP: case WXK_UP:
MousePositionInPixels.y -= delta.y; MousePositionInPixels.y -= (int) round(delta.y);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN: case WXK_DOWN:
MousePositionInPixels.y += delta.y; MousePositionInPixels.y += (int) round(delta.y);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT: case WXK_LEFT:
MousePositionInPixels.x -= delta.x; MousePositionInPixels.x -= (int) round(delta.x);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT: case WXK_RIGHT:
MousePositionInPixels.x += delta.x; MousePositionInPixels.x += (int) round(delta.x);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
@ -342,25 +342,25 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP: case WXK_UP:
MousePositionInPixels.y -= delta.y; MousePositionInPixels.y -= (int) round(delta.y);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN: case WXK_DOWN:
MousePositionInPixels.y += delta.y; MousePositionInPixels.y += (int) round(delta.y);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT: case WXK_LEFT:
MousePositionInPixels.x -= delta.x; MousePositionInPixels.x -= (int) round(delta.x);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT: case WXK_RIGHT:
MousePositionInPixels.x += delta.x; MousePositionInPixels.x += (int) round(delta.x);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
@ -436,25 +436,25 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP: case WXK_UP:
MousePositionInPixels.y -= delta.y; MousePositionInPixels.y -= (int) round(delta.y);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN: case WXK_DOWN:
MousePositionInPixels.y += delta.y; MousePositionInPixels.y += (int) round(delta.y);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT: case WXK_LEFT:
MousePositionInPixels.x -= delta.x; MousePositionInPixels.x -= (int) round(delta.x);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT: case WXK_RIGHT:
MousePositionInPixels.x += delta.x; MousePositionInPixels.x += (int) round(delta.x);
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;

View File

@ -315,5 +315,5 @@ int WinEDA_GerberFrame::BestZoom()
jj = GetBoard()->m_BoundaryBox.GetHeight() / size.y; jj = GetBoard()->m_BoundaryBox.GetHeight() / size.y;
bestzoom = MAX( ii, jj ); bestzoom = MAX( ii, jj );
GetScreen()->m_Curseur = GetBoard()->m_BoundaryBox.Centre(); GetScreen()->m_Curseur = GetBoard()->m_BoundaryBox.Centre();
return bestzoom * GetScreen()->m_ZoomScalar; return (int) round(bestzoom * GetScreen()->m_ZoomScalar);
} }

View File

@ -530,25 +530,25 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{ {
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP: case WXK_UP:
Mouse.y -= delta.y; Mouse.y -= (int) round(delta.y);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN: case WXK_DOWN:
Mouse.y += delta.y; Mouse.y += (int) round(delta.y);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT: case WXK_LEFT:
Mouse.x -= delta.x; Mouse.x -= (int) round(delta.x);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT: case WXK_RIGHT:
Mouse.x += delta.x; Mouse.x += (int) round(delta.x);
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;