Loading CHANGELOG.txt +11 −4 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,17 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2009-Feb-7 Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++All: change grid size type from integer to double (using wxRealPoint insteed of wxSize) This is mandatory in Pcbnew to handle metric user grids without error (was unusable before, using integer grid size). A lot of footprints uses not metric grid. TODO: more refinements for user grid (mainly in read/wrire config). 2009-Feb-06 UPDATE Dick Hollenbeck <dick@softplc.com> 2009-Feb-06 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ ================================================================================ ++pcbnew ++pcbnew Loading @@ -20,10 +31,6 @@ email address. (near to to Wayne Stambaugh's changes: 15 values are not enought for pcbnew) (near to to Wayne Stambaugh's changes: 15 values are not enought for pcbnew) removed minor problems in zoom box selection (removed blank line). removed minor problems in zoom box selection (removed blank line). Added user grid selection in modedit and refinements when user grid is selected. Added user grid selection in modedit and refinements when user grid is selected. TODO: more refinements in user grid mode. new grid implementation does not used floats when user grid is selected to calculate coordinates. so it is unable to handle a metric grid. Todo: see what happened. ++eeschema: ++eeschema: Loading common/base_screen.cpp +18 −12 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_ZoomScalar = 10; m_ZoomScalar = 10; m_Zoom = 32 * m_ZoomScalar; m_Zoom = 32 * m_ZoomScalar; m_Grid = wxSize( 50, 50 ); /* Default grid size */ m_Grid = wxRealPoint( 50, 50 ); /* Default grid size */ m_UserGridIsON = FALSE; m_UserGridIsON = FALSE; m_Center = true; m_Center = true; m_CurrentSheetDesc = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4; Loading Loading @@ -170,6 +170,12 @@ void BASE_SCREEN::Scale( wxPoint& pt ) pt.y = Scale( pt.y ); pt.y = Scale( pt.y ); } } void BASE_SCREEN::Scale( wxRealPoint& pt ) { pt.x = Scale( pt.x ); pt.y = Scale( pt.y ); } void BASE_SCREEN::Scale( wxSize& sz ) void BASE_SCREEN::Scale( wxSize& sz ) { { Loading Loading @@ -303,14 +309,14 @@ void BASE_SCREEN::SetGridList( GridArray& gridlist ) /**********************************************/ /**********************************************/ void BASE_SCREEN::SetGrid( const wxSize& size ) void BASE_SCREEN::SetGrid( const wxRealPoint& size ) /**********************************************/ /**********************************************/ { { wxASSERT( !m_GridList.IsEmpty() ); wxASSERT( !m_GridList.IsEmpty() ); size_t i; size_t i; wxSize nearest_grid = m_GridList[0].m_Size; wxRealPoint nearest_grid = m_GridList[0].m_Size; for( i = 0; i < m_GridList.GetCount(); i++ ) for( i = 0; i < m_GridList.GetCount(); i++ ) { { if( m_GridList[i].m_Size == size ) if( m_GridList[i].m_Size == size ) Loading @@ -326,8 +332,8 @@ void BASE_SCREEN::SetGrid( const wxSize& size ) m_Grid = nearest_grid; m_Grid = nearest_grid; wxLogWarning( _( "Grid size( %d, %d ) not in grid list, falling back to " \ wxLogWarning( _( "Grid size( %f, %f ) not in grid list, falling back to " \ "grid size( %d, %d )." ), "grid size( %f, %f )." ), size.x, size.y, m_Grid.x, m_Grid.y ); size.x, size.y, m_Grid.x, m_Grid.y ); } } Loading @@ -350,7 +356,7 @@ void BASE_SCREEN::SetGrid( int id ) m_Grid = m_GridList[0].m_Size; m_Grid = m_GridList[0].m_Size; wxLogWarning( _( "Grid ID %d not in grid list, falling back to " \ wxLogWarning( _( "Grid ID %d not in grid list, falling back to " \ "grid size( %d, %d )." ), id, m_Grid.x, m_Grid.y ); "grid size( %f, %f )." ), id, m_Grid.x, m_Grid.y ); } } void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) Loading Loading @@ -381,7 +387,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) m_GridList.Add( grid ); m_GridList.Add( grid ); } } void BASE_SCREEN::AddGrid( const wxSize& size, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id ) { { GRID_TYPE grid; GRID_TYPE grid; Loading @@ -393,7 +399,7 @@ void BASE_SCREEN::AddGrid( const wxSize& size, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) { { double x, y; double x, y; wxSize new_size; wxRealPoint new_size; GRID_TYPE new_grid; GRID_TYPE new_grid; if( units == MILLIMETRE ) if( units == MILLIMETRE ) Loading @@ -412,8 +418,8 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) y = size.y; y = size.y; } } new_size = wxSize( (int) round( x * (double) GetInternalUnits() ), new_size = wxRealPoint( x * (double) GetInternalUnits(), (int) round( y * (double) GetInternalUnits() ) ); y * (double) GetInternalUnits() ); new_grid.m_Id = id; new_grid.m_Id = id; new_grid.m_Size = new_size; new_grid.m_Size = new_size; Loading @@ -421,7 +427,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) } } /*********************************/ /*********************************/ wxSize BASE_SCREEN::GetGrid() wxRealPoint BASE_SCREEN::GetGrid() /*********************************/ /*********************************/ { { return m_Grid; return m_Grid; Loading common/drawframe.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -262,9 +262,9 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) BASE_SCREEN* screen = GetBaseScreen(); BASE_SCREEN* screen = GetBaseScreen(); screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); wxSize current_grid = screen->GetGrid(); wxRealPoint current_grid = screen->GetGrid(); screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 ); screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 ); wxSize selected_grid = screen->GetGrid(); wxRealPoint selected_grid = screen->GetGrid(); if( selected_grid != current_grid ) if( selected_grid != current_grid ) Recadre_Trace( FALSE ); Recadre_Trace( FALSE ); Loading common/drawpanel.cpp +10 −17 Original line number Original line Diff line number Diff line Loading @@ -175,7 +175,7 @@ void WinEDA_DrawPanel::SetZoom( int zoom ) /************************************/ /************************************/ wxSize WinEDA_DrawPanel::GetGrid() wxRealPoint WinEDA_DrawPanel::GetGrid() /************************************/ /************************************/ { { return GetScreen()->GetGrid(); return GetScreen()->GetGrid(); Loading Loading @@ -685,11 +685,10 @@ 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; wxSize pas_grille_affichee; wxRealPoint pas_grille_affichee; bool drawgrid = FALSE; bool drawgrid = FALSE; wxSize size; wxSize size; wxPoint org; wxPoint org; double pasx, pasy; color = g_GridColor; color = g_GridColor; Loading @@ -702,32 +701,29 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) pas_grille_affichee = screen->GetGrid(); pas_grille_affichee = screen->GetGrid(); ii = screen->Scale( pas_grille_affichee.x ); double dgrid = screen->Scale( pas_grille_affichee.x ); if( ii < 5 ) if( dgrid < 5 ) { { pas_grille_affichee.x *= 2; pas_grille_affichee.x *= 2; ii *= 2; dgrid *= 2; } } if( ii < 5 ) if( dgrid < 5 ) drawgrid = FALSE; // The gris is small drawgrid = FALSE; // The gris is small ii = screen->Scale( pas_grille_affichee.y ); dgrid = screen->Scale( pas_grille_affichee.y ); if( ii < 5 ) if( ii < dgrid ) { { pas_grille_affichee.y *= 2; pas_grille_affichee.y *= 2; ii *= 2; dgrid *= 2; } } if( ii < 5 ) if( dgrid < 5 ) drawgrid = FALSE; // The gris is small drawgrid = FALSE; // The gris is small GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y ); GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj ); wxLogDebug( _T( "View start: %d, %d, scroll bar PPI: %d, %d" ), org.x, org.y, ii, jj ); org.x *= ii; org.x *= ii; org.y *= jj; org.y *= jj; screen->m_StartVisu = org; screen->m_StartVisu = org; wxLogDebug( _T( "Scroll bar drawing position: %d. %d" ), org.x, org.y ); screen->Unscale( org ); screen->Unscale( org ); org += screen->m_DrawOrg; org += screen->m_DrawOrg; Loading @@ -735,9 +731,6 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) size = GetClientSize(); size = GetClientSize(); screen->Unscale( size ); screen->Unscale( size ); pasx = screen->m_Grid.x * m_Parent->m_InternalUnits; pasy = screen->m_Grid.y * m_Parent->m_InternalUnits; if( drawgrid ) if( drawgrid ) { { m_Parent->PutOnGrid( &org ); m_Parent->PutOnGrid( &org ); Loading common/zoom.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -47,14 +47,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) * @param coord = coordinate to adjust * @param coord = coordinate to adjust */ */ { { wxSize grid_size = GetBaseScreen()->GetGrid(); wxRealPoint grid_size = GetBaseScreen()->GetGrid(); if( !GetBaseScreen()->m_UserGridIsON ) if( !GetBaseScreen()->m_UserGridIsON ) { { coord->x = ( (int) round( (double) coord->x / coord->x = ( (int) round( coord->x / (double) grid_size.x ) ) * grid_size.x; grid_size.x ) ) * grid_size.x; coord->y = ( (int) round( (double) coord->y / coord->y = ( (int) round( coord->y / (double) grid_size.y ) ) * grid_size.y; grid_size.y ) ) * grid_size.y; } } } } Loading Loading @@ -193,7 +193,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) size_t i; size_t i; int maxZoomIds; int maxZoomIds; int zoom; int zoom; wxSize grid; wxRealPoint grid; wxString msg; wxString msg; GRID_TYPE tmp; GRID_TYPE tmp; wxMenu* gridMenu; wxMenu* gridMenu; Loading Loading
CHANGELOG.txt +11 −4 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,17 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2009-Feb-7 Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++All: change grid size type from integer to double (using wxRealPoint insteed of wxSize) This is mandatory in Pcbnew to handle metric user grids without error (was unusable before, using integer grid size). A lot of footprints uses not metric grid. TODO: more refinements for user grid (mainly in read/wrire config). 2009-Feb-06 UPDATE Dick Hollenbeck <dick@softplc.com> 2009-Feb-06 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ ================================================================================ ++pcbnew ++pcbnew Loading @@ -20,10 +31,6 @@ email address. (near to to Wayne Stambaugh's changes: 15 values are not enought for pcbnew) (near to to Wayne Stambaugh's changes: 15 values are not enought for pcbnew) removed minor problems in zoom box selection (removed blank line). removed minor problems in zoom box selection (removed blank line). Added user grid selection in modedit and refinements when user grid is selected. Added user grid selection in modedit and refinements when user grid is selected. TODO: more refinements in user grid mode. new grid implementation does not used floats when user grid is selected to calculate coordinates. so it is unable to handle a metric grid. Todo: see what happened. ++eeschema: ++eeschema: Loading
common/base_screen.cpp +18 −12 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_ZoomScalar = 10; m_ZoomScalar = 10; m_Zoom = 32 * m_ZoomScalar; m_Zoom = 32 * m_ZoomScalar; m_Grid = wxSize( 50, 50 ); /* Default grid size */ m_Grid = wxRealPoint( 50, 50 ); /* Default grid size */ m_UserGridIsON = FALSE; m_UserGridIsON = FALSE; m_Center = true; m_Center = true; m_CurrentSheetDesc = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4; Loading Loading @@ -170,6 +170,12 @@ void BASE_SCREEN::Scale( wxPoint& pt ) pt.y = Scale( pt.y ); pt.y = Scale( pt.y ); } } void BASE_SCREEN::Scale( wxRealPoint& pt ) { pt.x = Scale( pt.x ); pt.y = Scale( pt.y ); } void BASE_SCREEN::Scale( wxSize& sz ) void BASE_SCREEN::Scale( wxSize& sz ) { { Loading Loading @@ -303,14 +309,14 @@ void BASE_SCREEN::SetGridList( GridArray& gridlist ) /**********************************************/ /**********************************************/ void BASE_SCREEN::SetGrid( const wxSize& size ) void BASE_SCREEN::SetGrid( const wxRealPoint& size ) /**********************************************/ /**********************************************/ { { wxASSERT( !m_GridList.IsEmpty() ); wxASSERT( !m_GridList.IsEmpty() ); size_t i; size_t i; wxSize nearest_grid = m_GridList[0].m_Size; wxRealPoint nearest_grid = m_GridList[0].m_Size; for( i = 0; i < m_GridList.GetCount(); i++ ) for( i = 0; i < m_GridList.GetCount(); i++ ) { { if( m_GridList[i].m_Size == size ) if( m_GridList[i].m_Size == size ) Loading @@ -326,8 +332,8 @@ void BASE_SCREEN::SetGrid( const wxSize& size ) m_Grid = nearest_grid; m_Grid = nearest_grid; wxLogWarning( _( "Grid size( %d, %d ) not in grid list, falling back to " \ wxLogWarning( _( "Grid size( %f, %f ) not in grid list, falling back to " \ "grid size( %d, %d )." ), "grid size( %f, %f )." ), size.x, size.y, m_Grid.x, m_Grid.y ); size.x, size.y, m_Grid.x, m_Grid.y ); } } Loading @@ -350,7 +356,7 @@ void BASE_SCREEN::SetGrid( int id ) m_Grid = m_GridList[0].m_Size; m_Grid = m_GridList[0].m_Size; wxLogWarning( _( "Grid ID %d not in grid list, falling back to " \ wxLogWarning( _( "Grid ID %d not in grid list, falling back to " \ "grid size( %d, %d )." ), id, m_Grid.x, m_Grid.y ); "grid size( %f, %f )." ), id, m_Grid.x, m_Grid.y ); } } void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) Loading Loading @@ -381,7 +387,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid ) m_GridList.Add( grid ); m_GridList.Add( grid ); } } void BASE_SCREEN::AddGrid( const wxSize& size, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id ) { { GRID_TYPE grid; GRID_TYPE grid; Loading @@ -393,7 +399,7 @@ void BASE_SCREEN::AddGrid( const wxSize& size, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) { { double x, y; double x, y; wxSize new_size; wxRealPoint new_size; GRID_TYPE new_grid; GRID_TYPE new_grid; if( units == MILLIMETRE ) if( units == MILLIMETRE ) Loading @@ -412,8 +418,8 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) y = size.y; y = size.y; } } new_size = wxSize( (int) round( x * (double) GetInternalUnits() ), new_size = wxRealPoint( x * (double) GetInternalUnits(), (int) round( y * (double) GetInternalUnits() ) ); y * (double) GetInternalUnits() ); new_grid.m_Id = id; new_grid.m_Id = id; new_grid.m_Size = new_size; new_grid.m_Size = new_size; Loading @@ -421,7 +427,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id ) } } /*********************************/ /*********************************/ wxSize BASE_SCREEN::GetGrid() wxRealPoint BASE_SCREEN::GetGrid() /*********************************/ /*********************************/ { { return m_Grid; return m_Grid; Loading
common/drawframe.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -262,9 +262,9 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) BASE_SCREEN* screen = GetBaseScreen(); BASE_SCREEN* screen = GetBaseScreen(); screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); wxSize current_grid = screen->GetGrid(); wxRealPoint current_grid = screen->GetGrid(); screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 ); screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 ); wxSize selected_grid = screen->GetGrid(); wxRealPoint selected_grid = screen->GetGrid(); if( selected_grid != current_grid ) if( selected_grid != current_grid ) Recadre_Trace( FALSE ); Recadre_Trace( FALSE ); Loading
common/drawpanel.cpp +10 −17 Original line number Original line Diff line number Diff line Loading @@ -175,7 +175,7 @@ void WinEDA_DrawPanel::SetZoom( int zoom ) /************************************/ /************************************/ wxSize WinEDA_DrawPanel::GetGrid() wxRealPoint WinEDA_DrawPanel::GetGrid() /************************************/ /************************************/ { { return GetScreen()->GetGrid(); return GetScreen()->GetGrid(); Loading Loading @@ -685,11 +685,10 @@ 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; wxSize pas_grille_affichee; wxRealPoint pas_grille_affichee; bool drawgrid = FALSE; bool drawgrid = FALSE; wxSize size; wxSize size; wxPoint org; wxPoint org; double pasx, pasy; color = g_GridColor; color = g_GridColor; Loading @@ -702,32 +701,29 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) pas_grille_affichee = screen->GetGrid(); pas_grille_affichee = screen->GetGrid(); ii = screen->Scale( pas_grille_affichee.x ); double dgrid = screen->Scale( pas_grille_affichee.x ); if( ii < 5 ) if( dgrid < 5 ) { { pas_grille_affichee.x *= 2; pas_grille_affichee.x *= 2; ii *= 2; dgrid *= 2; } } if( ii < 5 ) if( dgrid < 5 ) drawgrid = FALSE; // The gris is small drawgrid = FALSE; // The gris is small ii = screen->Scale( pas_grille_affichee.y ); dgrid = screen->Scale( pas_grille_affichee.y ); if( ii < 5 ) if( ii < dgrid ) { { pas_grille_affichee.y *= 2; pas_grille_affichee.y *= 2; ii *= 2; dgrid *= 2; } } if( ii < 5 ) if( dgrid < 5 ) drawgrid = FALSE; // The gris is small drawgrid = FALSE; // The gris is small GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y ); GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj ); wxLogDebug( _T( "View start: %d, %d, scroll bar PPI: %d, %d" ), org.x, org.y, ii, jj ); org.x *= ii; org.x *= ii; org.y *= jj; org.y *= jj; screen->m_StartVisu = org; screen->m_StartVisu = org; wxLogDebug( _T( "Scroll bar drawing position: %d. %d" ), org.x, org.y ); screen->Unscale( org ); screen->Unscale( org ); org += screen->m_DrawOrg; org += screen->m_DrawOrg; Loading @@ -735,9 +731,6 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) size = GetClientSize(); size = GetClientSize(); screen->Unscale( size ); screen->Unscale( size ); pasx = screen->m_Grid.x * m_Parent->m_InternalUnits; pasy = screen->m_Grid.y * m_Parent->m_InternalUnits; if( drawgrid ) if( drawgrid ) { { m_Parent->PutOnGrid( &org ); m_Parent->PutOnGrid( &org ); Loading
common/zoom.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -47,14 +47,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) * @param coord = coordinate to adjust * @param coord = coordinate to adjust */ */ { { wxSize grid_size = GetBaseScreen()->GetGrid(); wxRealPoint grid_size = GetBaseScreen()->GetGrid(); if( !GetBaseScreen()->m_UserGridIsON ) if( !GetBaseScreen()->m_UserGridIsON ) { { coord->x = ( (int) round( (double) coord->x / coord->x = ( (int) round( coord->x / (double) grid_size.x ) ) * grid_size.x; grid_size.x ) ) * grid_size.x; coord->y = ( (int) round( (double) coord->y / coord->y = ( (int) round( coord->y / (double) grid_size.y ) ) * grid_size.y; grid_size.y ) ) * grid_size.y; } } } } Loading Loading @@ -193,7 +193,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) size_t i; size_t i; int maxZoomIds; int maxZoomIds; int zoom; int zoom; wxSize grid; wxRealPoint grid; wxString msg; wxString msg; GRID_TYPE tmp; GRID_TYPE tmp; wxMenu* gridMenu; wxMenu* gridMenu; Loading