Loading common/base_screen.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) m_Zoom = 32 * m_ZoomScalar; m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */ m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50; m_UserGridIsON = FALSE; m_Center = true; m_CurrentSheetDesc = &g_Sheet_A4; m_IsPrinting = false; Loading common/drawpanel.cpp +34 −25 Original line number Diff line number Diff line Loading @@ -758,11 +758,13 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) */ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) { #define MIN_GRID_SIZE 10 // min grid size in pixels to allow drawing BASE_SCREEN* screen = GetScreen(); int ii, jj, xg, yg; wxRealPoint screen_grid_size; wxSize size; wxPoint org; wxRealPoint dgrid; /* The grid must be visible. this is possible only is grid value * and zoom value are sufficient Loading @@ -773,43 +775,50 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) size = GetClientSize(); #ifdef USE_WX_ZOOM if( DC->LogicalToDeviceXRel( wxRound( screen_grid_size.x ) ) < 5 || DC->LogicalToDeviceXRel( wxRound( screen_grid_size.y ) ) < 5 ) return; dgrid.x = DC->LogicalToDeviceXRel( wxRound( screen_grid_size.x ) ); dgrid.y = DC->LogicalToDeviceXRel( wxRound( screen_grid_size.y ) ); org = m_ClipBox.m_Pos; size = m_ClipBox.m_Size; #else wxRealPoint dgrid = screen_grid_size; dgrid = screen_grid_size; screen->Scale( dgrid ); // dgrid = grid size in pixels screen->Unscale( size ); screen->Unscale( org ); org += screen->m_DrawOrg; #endif // if the grid size is small ( < 5 pixels) do not display all points if( dgrid.x < 5 ) // if the grid size is small ( < MIN_GRID_SIZE pixels ) do not display all points bool double_size = false; if( dgrid.x < MIN_GRID_SIZE ) { screen_grid_size.x *= 2; double_size = true; dgrid.x *= 2; } if( dgrid.x < 5 ) return; // The grid is too small: do not show it if( dgrid.x < MIN_GRID_SIZE ) return; // The X grid is too small: do not show it if( dgrid.y < 5 ) if( dgrid.y < MIN_GRID_SIZE ) { screen_grid_size.y *= 2; double_size = true; dgrid.y *= 2; } if( dgrid.y < 5 ) return; // The grid is too small if( dgrid.y < MIN_GRID_SIZE ) return; // The Y grid is too small: do not show it screen->Unscale( size ); screen->Unscale( org ); org += screen->m_DrawOrg; #endif m_Parent->PutOnGrid( &org ); GRSetColorPen( DC, m_Parent->GetGridColor() ); int xpos, ypos; /* When we use an double_size grid, we must align grid ord on double grid */ int increment = double_size ? 2 : 1; if( double_size ) { wxRealPoint dblgrid = screen_grid_size * 2; m_Parent->PutOnGrid(&org, &dblgrid); } // Draw grid: the best algorithm depend on the platform. // under macOSX, the first method is better Loading @@ -824,14 +833,14 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) #if defined( __WXMAC__ ) && !defined( USE_WX_ZOOM ) // Use a pixel based draw to display grid // When is not used USE_WX_ZOOM for( ii = 0; ; ii++ ) for( ii = 0; ; ii += increment ) { xg = wxRound( ii * screen_grid_size.x ); if( xg > size.x ) break; xpos = org.x + xg; xpos = GRMapX( xpos ); for( jj = 0; ; jj++ ) for( jj = 0; ; jj += increment ) { yg = wxRound( jj * screen_grid_size.y ); if( yg > size.y ) Loading @@ -846,7 +855,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) // Use a pixel based draw to display grid // There is a lot of calls, so the cost is hight // and grid is slowly drawn on some platforms for( ii = 0; ; ii++ ) for( ii = 0; ; ii += increment ) { xg = wxRound( ii * screen_grid_size.x ); if( xg > size.x ) Loading @@ -857,7 +866,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) continue; if( xpos > m_ClipBox.GetEnd().x) // end of active area reached. break; for( jj = 0; ; jj++ ) for( jj = 0; ; jj += increment ) { yg = wxRound( jj * screen_grid_size.y ); if( yg > size.y ) Loading Loading @@ -890,7 +899,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) GRSetColorPen( &tmpDC, g_DrawBgColor ); tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background GRSetColorPen( &tmpDC, m_Parent->GetGridColor() ); for( jj = 0; ; jj++ ) // draw grid points for( jj = 0; ; jj += increment ) // draw grid points { yg = wxRound( jj * screen_grid_size.y ); ypos = screen->Scale( yg ); Loading @@ -900,7 +909,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) } ypos = GRMapY( org.y ); for( ii = 0; ; ii++ ) for( ii = 0; ; ii += increment ) { xg = wxRound( ii * screen_grid_size.x ); if( xg > size.x ) Loading Loading @@ -1107,7 +1116,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) * in order to avoid spurious block commands. */ static int MinDragEventCount; if( event.Leaving() /*|| event.Entering()*/ ) if( event.Leaving() ) { m_CanStartBlock = -1; } Loading common/zoom.cpp +12 −10 Original line number Diff line number Diff line Loading @@ -46,23 +46,25 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) /** Adjust the coordinate to the nearest grid value * @param coord = coordinate to adjust * @param aCoord = coordinate to adjust * @param aGridSize = pointer to a grid value. if NULL uses the current grid size */ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) void WinEDA_DrawFrame::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize ) { wxRealPoint grid_size = GetBaseScreen()->GetGridSize(); wxRealPoint grid_size; if( aGridSize ) grid_size = *aGridSize; else grid_size = GetBaseScreen()->GetGridSize(); if( !GetBaseScreen()->m_UserGridIsON ) // XXX UNUSED VARIABLE??? { const wxPoint& grid_origin = GetBaseScreen()->GetGridOrigin(); double offset = fmod(grid_origin.x, grid_size.x); int tmp = wxRound( (coord->x - offset) / grid_size.x ); coord->x = wxRound( tmp * grid_size.x + offset ); int tmp = wxRound( (aCoord->x - offset) / grid_size.x ); aCoord->x = wxRound( tmp * grid_size.x + offset ); offset = fmod(grid_origin.y, grid_size.y); tmp = wxRound( (coord->y - offset) / grid_size.y ); coord->y = wxRound ( tmp * grid_size.y + offset ); } tmp = wxRound( (aCoord->y - offset) / grid_size.y ); aCoord->y = wxRound ( tmp * grid_size.y + offset ); } Loading include/class_base_screen.h +0 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,6 @@ private: public: wxPoint m_GridOrigin; GridArray m_GridList; bool m_UserGridIsON; wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */ int m_Zoom; /* Current zoom coefficient. */ Loading include/wxstruct.h +7 −3 Original line number Diff line number Diff line Loading @@ -361,9 +361,13 @@ public: virtual void OnZoom( wxCommandEvent& event ); void OnGrid( int grid_type ); void Recadre_Trace( bool ToMouse ); void PutOnGrid( wxPoint* coord ); /* set the coordinate to * the nearest grid * coordinate */ /** Adjust the coordinate to the nearest grid value * @param aCoord = coordinate to adjust * @param aGridSize = pointer to a grid value. if NULL uses the current grid size */ void PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize = NULL ); void Zoom_Automatique( bool move_mouse_cursor ); /* Set the zoom level to show the area Rect */ Loading Loading
common/base_screen.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) m_Zoom = 32 * m_ZoomScalar; m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */ m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50; m_UserGridIsON = FALSE; m_Center = true; m_CurrentSheetDesc = &g_Sheet_A4; m_IsPrinting = false; Loading
common/drawpanel.cpp +34 −25 Original line number Diff line number Diff line Loading @@ -758,11 +758,13 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) */ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) { #define MIN_GRID_SIZE 10 // min grid size in pixels to allow drawing BASE_SCREEN* screen = GetScreen(); int ii, jj, xg, yg; wxRealPoint screen_grid_size; wxSize size; wxPoint org; wxRealPoint dgrid; /* The grid must be visible. this is possible only is grid value * and zoom value are sufficient Loading @@ -773,43 +775,50 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) size = GetClientSize(); #ifdef USE_WX_ZOOM if( DC->LogicalToDeviceXRel( wxRound( screen_grid_size.x ) ) < 5 || DC->LogicalToDeviceXRel( wxRound( screen_grid_size.y ) ) < 5 ) return; dgrid.x = DC->LogicalToDeviceXRel( wxRound( screen_grid_size.x ) ); dgrid.y = DC->LogicalToDeviceXRel( wxRound( screen_grid_size.y ) ); org = m_ClipBox.m_Pos; size = m_ClipBox.m_Size; #else wxRealPoint dgrid = screen_grid_size; dgrid = screen_grid_size; screen->Scale( dgrid ); // dgrid = grid size in pixels screen->Unscale( size ); screen->Unscale( org ); org += screen->m_DrawOrg; #endif // if the grid size is small ( < 5 pixels) do not display all points if( dgrid.x < 5 ) // if the grid size is small ( < MIN_GRID_SIZE pixels ) do not display all points bool double_size = false; if( dgrid.x < MIN_GRID_SIZE ) { screen_grid_size.x *= 2; double_size = true; dgrid.x *= 2; } if( dgrid.x < 5 ) return; // The grid is too small: do not show it if( dgrid.x < MIN_GRID_SIZE ) return; // The X grid is too small: do not show it if( dgrid.y < 5 ) if( dgrid.y < MIN_GRID_SIZE ) { screen_grid_size.y *= 2; double_size = true; dgrid.y *= 2; } if( dgrid.y < 5 ) return; // The grid is too small if( dgrid.y < MIN_GRID_SIZE ) return; // The Y grid is too small: do not show it screen->Unscale( size ); screen->Unscale( org ); org += screen->m_DrawOrg; #endif m_Parent->PutOnGrid( &org ); GRSetColorPen( DC, m_Parent->GetGridColor() ); int xpos, ypos; /* When we use an double_size grid, we must align grid ord on double grid */ int increment = double_size ? 2 : 1; if( double_size ) { wxRealPoint dblgrid = screen_grid_size * 2; m_Parent->PutOnGrid(&org, &dblgrid); } // Draw grid: the best algorithm depend on the platform. // under macOSX, the first method is better Loading @@ -824,14 +833,14 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) #if defined( __WXMAC__ ) && !defined( USE_WX_ZOOM ) // Use a pixel based draw to display grid // When is not used USE_WX_ZOOM for( ii = 0; ; ii++ ) for( ii = 0; ; ii += increment ) { xg = wxRound( ii * screen_grid_size.x ); if( xg > size.x ) break; xpos = org.x + xg; xpos = GRMapX( xpos ); for( jj = 0; ; jj++ ) for( jj = 0; ; jj += increment ) { yg = wxRound( jj * screen_grid_size.y ); if( yg > size.y ) Loading @@ -846,7 +855,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) // Use a pixel based draw to display grid // There is a lot of calls, so the cost is hight // and grid is slowly drawn on some platforms for( ii = 0; ; ii++ ) for( ii = 0; ; ii += increment ) { xg = wxRound( ii * screen_grid_size.x ); if( xg > size.x ) Loading @@ -857,7 +866,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) continue; if( xpos > m_ClipBox.GetEnd().x) // end of active area reached. break; for( jj = 0; ; jj++ ) for( jj = 0; ; jj += increment ) { yg = wxRound( jj * screen_grid_size.y ); if( yg > size.y ) Loading Loading @@ -890,7 +899,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) GRSetColorPen( &tmpDC, g_DrawBgColor ); tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background GRSetColorPen( &tmpDC, m_Parent->GetGridColor() ); for( jj = 0; ; jj++ ) // draw grid points for( jj = 0; ; jj += increment ) // draw grid points { yg = wxRound( jj * screen_grid_size.y ); ypos = screen->Scale( yg ); Loading @@ -900,7 +909,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) } ypos = GRMapY( org.y ); for( ii = 0; ; ii++ ) for( ii = 0; ; ii += increment ) { xg = wxRound( ii * screen_grid_size.x ); if( xg > size.x ) Loading Loading @@ -1107,7 +1116,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) * in order to avoid spurious block commands. */ static int MinDragEventCount; if( event.Leaving() /*|| event.Entering()*/ ) if( event.Leaving() ) { m_CanStartBlock = -1; } Loading
common/zoom.cpp +12 −10 Original line number Diff line number Diff line Loading @@ -46,23 +46,25 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) /** Adjust the coordinate to the nearest grid value * @param coord = coordinate to adjust * @param aCoord = coordinate to adjust * @param aGridSize = pointer to a grid value. if NULL uses the current grid size */ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) void WinEDA_DrawFrame::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize ) { wxRealPoint grid_size = GetBaseScreen()->GetGridSize(); wxRealPoint grid_size; if( aGridSize ) grid_size = *aGridSize; else grid_size = GetBaseScreen()->GetGridSize(); if( !GetBaseScreen()->m_UserGridIsON ) // XXX UNUSED VARIABLE??? { const wxPoint& grid_origin = GetBaseScreen()->GetGridOrigin(); double offset = fmod(grid_origin.x, grid_size.x); int tmp = wxRound( (coord->x - offset) / grid_size.x ); coord->x = wxRound( tmp * grid_size.x + offset ); int tmp = wxRound( (aCoord->x - offset) / grid_size.x ); aCoord->x = wxRound( tmp * grid_size.x + offset ); offset = fmod(grid_origin.y, grid_size.y); tmp = wxRound( (coord->y - offset) / grid_size.y ); coord->y = wxRound ( tmp * grid_size.y + offset ); } tmp = wxRound( (aCoord->y - offset) / grid_size.y ); aCoord->y = wxRound ( tmp * grid_size.y + offset ); } Loading
include/class_base_screen.h +0 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,6 @@ private: public: wxPoint m_GridOrigin; GridArray m_GridList; bool m_UserGridIsON; wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */ int m_Zoom; /* Current zoom coefficient. */ Loading
include/wxstruct.h +7 −3 Original line number Diff line number Diff line Loading @@ -361,9 +361,13 @@ public: virtual void OnZoom( wxCommandEvent& event ); void OnGrid( int grid_type ); void Recadre_Trace( bool ToMouse ); void PutOnGrid( wxPoint* coord ); /* set the coordinate to * the nearest grid * coordinate */ /** Adjust the coordinate to the nearest grid value * @param aCoord = coordinate to adjust * @param aGridSize = pointer to a grid value. if NULL uses the current grid size */ void PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize = NULL ); void Zoom_Automatique( bool move_mouse_cursor ); /* Set the zoom level to show the area Rect */ Loading