Commit c6f68578 authored by charras's avatar charras

Removed some warnings in compilation. A small bug fixed when drawing grids on screen.

parent 37d2057b
......@@ -685,7 +685,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
int Color = BLUE;
BASE_SCREEN* screen = GetScreen();
int ii, jj, xg, yg, color;
wxRealPoint pas_grille_affichee;
wxRealPoint screen_grid_size;
bool drawgrid = FALSE;
wxSize size;
wxPoint org;
......@@ -699,25 +699,26 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
*/
drawgrid = m_Parent->m_Draw_Grid;
pas_grille_affichee = screen->GetGrid();
double dgrid = screen->Scale( pas_grille_affichee.x );
if( dgrid < 5 )
screen_grid_size = screen->GetGrid();
wxRealPoint dgrid = screen_grid_size;
screen->Scale( dgrid ); // dgrid = grid size in pixels
// if the grid size is sall ( < 5 pixels) do not display all points
if( dgrid.x < 5 )
{
pas_grille_affichee.x *= 2;
dgrid *= 2;
screen_grid_size.x *= 2;
dgrid.x *= 2;
}
if( dgrid < 5 )
drawgrid = FALSE; // The gris is small
if( dgrid.x < 5 )
drawgrid = FALSE; // The gris is too small: do not show it
dgrid = screen->Scale( pas_grille_affichee.y );
if( ii < dgrid )
if( dgrid.y < 5 )
{
pas_grille_affichee.y *= 2;
dgrid *= 2;
screen_grid_size.y *= 2;
dgrid.y *= 2;
}
if( dgrid < 5 )
drawgrid = FALSE; // The gris is small
if( dgrid.y < 5 )
drawgrid = FALSE; // The gris is too small
GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj );
......@@ -738,12 +739,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GRSetColorPen( DC, color );
for( ii = 0; ; ii++ )
{
xg = ii * pas_grille_affichee.x;
xg = (int) round(ii * screen_grid_size.x);
int xpos = org.x + xg;
for( jj = 0; ; jj++ )
{
yg = jj * pas_grille_affichee.y;
yg = (int) round(jj * screen_grid_size.y);
GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
if( yg > size.y )
break;
......
......@@ -51,10 +51,11 @@ 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;
int tmp = (int) round( coord->x / grid_size.x );
coord->x = (int) round( tmp * grid_size.x );
tmp = (int) round( coord->y / grid_size.y );
coord->y = (int) round ( tmp * grid_size.y );
}
}
......
......@@ -74,25 +74,25 @@ void WinEDA_GerberFrame::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;
......
......@@ -432,25 +432,25 @@ void WinEDA_ModuleEditFrame::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;
......
......@@ -310,7 +310,7 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
double value = To_User_Unit( g_UnitMetric,
GetScreen()->m_GridList[i].m_Size.x,
(int)GetScreen()->m_GridList[i].m_Size.x,
PCB_INTERNAL_UNIT );
if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER )
{
......
......@@ -621,7 +621,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
{
GRID_TYPE grid = GetScreen()->m_GridList[i];
double value = To_User_Unit( g_UnitMetric,
grid.m_Size.x,
(int)grid.m_Size.x,
PCB_INTERNAL_UNIT );
if( grid.m_Id != ID_POPUP_GRID_USER )
{
......
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