Commit 0d6c62a9 authored by charras's avatar charras

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

parent af4e798b
......@@ -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
}
......
......@@ -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() );
......
......@@ -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 )
{
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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);
}
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment