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

This commit is contained in:
charras 2009-02-11 15:49:28 +00:00
parent 37d2057bee
commit c6f68578b3
6 changed files with 33 additions and 31 deletions

View File

@ -685,7 +685,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
int Color = BLUE; int Color = BLUE;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
int ii, jj, xg, yg, color; int ii, jj, xg, yg, color;
wxRealPoint pas_grille_affichee; wxRealPoint screen_grid_size;
bool drawgrid = FALSE; bool drawgrid = FALSE;
wxSize size; wxSize size;
wxPoint org; wxPoint org;
@ -699,25 +699,26 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
*/ */
drawgrid = m_Parent->m_Draw_Grid; drawgrid = m_Parent->m_Draw_Grid;
pas_grille_affichee = screen->GetGrid(); screen_grid_size = screen->GetGrid();
double dgrid = screen->Scale( pas_grille_affichee.x ); wxRealPoint dgrid = screen_grid_size;
if( dgrid < 5 ) 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; screen_grid_size.x *= 2;
dgrid *= 2; dgrid.x *= 2;
} }
if( dgrid < 5 ) if( dgrid.x < 5 )
drawgrid = FALSE; // The gris is small drawgrid = FALSE; // The gris is too small: do not show it
dgrid = screen->Scale( pas_grille_affichee.y ); if( dgrid.y < 5 )
if( ii < dgrid )
{ {
pas_grille_affichee.y *= 2; screen_grid_size.y *= 2;
dgrid *= 2; dgrid.y *= 2;
} }
if( dgrid < 5 ) if( dgrid.y < 5 )
drawgrid = FALSE; // The gris is small drawgrid = FALSE; // The gris is too small
GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj );
@ -738,12 +739,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GRSetColorPen( DC, color ); GRSetColorPen( DC, color );
for( ii = 0; ; ii++ ) for( ii = 0; ; ii++ )
{ {
xg = ii * pas_grille_affichee.x; xg = (int) round(ii * screen_grid_size.x);
int xpos = org.x + xg; int xpos = org.x + xg;
for( jj = 0; ; jj++ ) 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 ); GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
if( yg > size.y ) if( yg > size.y )
break; break;

View File

@ -51,10 +51,11 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
if( !GetBaseScreen()->m_UserGridIsON ) if( !GetBaseScreen()->m_UserGridIsON )
{ {
coord->x = ( (int) round( coord->x / int tmp = (int) round( coord->x / grid_size.x );
grid_size.x ) ) * grid_size.x; coord->x = (int) round( tmp * grid_size.x );
coord->y = ( (int) round( coord->y /
grid_size.y ) ) * grid_size.y; tmp = (int) round( coord->y / grid_size.y );
coord->y = (int) round ( tmp * grid_size.y );
} }
} }

View File

@ -74,25 +74,25 @@ void WinEDA_GerberFrame::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;

View File

@ -432,25 +432,25 @@ void WinEDA_ModuleEditFrame::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;

View File

@ -310,7 +310,7 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{ {
double value = To_User_Unit( g_UnitMetric, 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 ); PCB_INTERNAL_UNIT );
if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER ) if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER )
{ {

View File

@ -621,7 +621,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
{ {
GRID_TYPE grid = GetScreen()->m_GridList[i]; GRID_TYPE grid = GetScreen()->m_GridList[i];
double value = To_User_Unit( g_UnitMetric, double value = To_User_Unit( g_UnitMetric,
grid.m_Size.x, (int)grid.m_Size.x,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
if( grid.m_Id != ID_POPUP_GRID_USER ) if( grid.m_Id != ID_POPUP_GRID_USER )
{ {