Loading change_log.txt +26 −9 Original line number Diff line number Diff line Loading @@ -5,6 +5,24 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2008-Mar-10 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ +pcbnew * Improved some comments on new functions. * Changed void ConvertPcbUnitsToPixelsUnits( EDA_Rect& aRect ); to void ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect ); which I prefer because it is clearer to the human reader of the calling context that the passed argument is to be modified. References as function arguments are fine, but if they are to be modified, passing by pointer gives human reader a clearer picture when looking at the calling context. * TRACK::GetBoundingBox() now (1) rounds up the radius, and (2) returns a bounding box which is [pos,dim) in nature, [inclusive, exclusive). * Changed from "new wxDCClip()" to use an automatic wxDCClip() variable in drawpanel.cpp * Removed a printf() from "release" build of drawpanel.cpp 2008-Mar-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +pcbnew Loading @@ -15,7 +33,6 @@ email address. Dirty rectangle calculation debugged. WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( EDA_Rect& aRect ) can be used to convert a bouding box to a clip box (see example in deltrack.cpp) +eeschema: restored: missing lines in schedit.cpp (problems in a lot of commands) Loading include/drawpanel_wxstruct.h +28 −25 Original line number Diff line number Diff line Loading @@ -96,20 +96,23 @@ public: wxPoint CursorRealPosition( const wxPoint& ScreenPos ); wxPoint CursorScreenPosition(); /** Function ConvertPcbUnitsToPixelsUnits * Convert pos and size of the given EDA_Rect to pos and size in pixels, * relative to the current draw area (origin 0,0 is the left top visible corner draw area) * according to the current scrool and zoom * @param aRect = the given rect /** * Function ConvertPcbUnitsToPixelsUnits * converts pos and size of the given EDA_Rect to pos and size in pixels, * relative to the current draw area (origin 0,0 is the left top visible * corner of draw area) according to the current scroll and zoom. * @param aRect = the rectangle to convert */ void ConvertPcbUnitsToPixelsUnits( EDA_Rect & aRect); /** Function ConvertPcbUnitsToPixelsUnits * Convert a given wxPoint position (in internal units) to the pos in pixels, * relative to the current draw area (origin 0,0 is the left top visible corner draw area) * according to the current scrool and zoom * @param aPosition = the given position void ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect ); /** * Function ConvertPcbUnitsToPixelsUnits * converts a given wxPoint position (in internal units) to units of pixels, * relative to the current draw area (origin 0,0 is the left top visible * corner of draw area) according to the current scroll and zoom. * @param aPosition = the position to convert */ void ConvertPcbUnitsToPixelsUnits( wxPoint & aPosition); void ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition ); wxPoint GetScreenCenterRealPosition( void ); void MouseToCursorSchema(); Loading pcbnew/class_track.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -207,7 +207,8 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) EDA_Rect TRACK::GetBoundingBox() const { int radius = m_Width/2; // end of track is round, this is its radius // end of track is round, this is its radius, rounded up int radius = ( m_Width+1 )/2; int ymax = MAX( m_Start.y, m_End.y ); int xmax = MAX( m_Start.x, m_End.x ); Loading @@ -221,7 +222,8 @@ EDA_Rect TRACK::GetBoundingBox() const ymin -= radius; xmin -= radius; return EDA_Rect( wxPoint( xmin, ymin ), wxSize( xmax-xmin, ymax-ymin ) ); // return a rectangle which is [pos,dim) in nature. therefore the +1 return EDA_Rect( wxPoint( xmin, ymin ), wxSize( xmax-xmin+1, ymax-ymin+1 ) ); } Loading pcbnew/controle.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -375,13 +375,13 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, if( !doCheckNet || !currTrack || currTrack->GetNet() == via->GetNet() ) { *curpos = via->m_Start; D(printf("via hit\n");) // D(printf("via hit\n");) return true; } } else { D( printf( "skipping self\n" ); ) // D( printf( "skipping self\n" ); ) } } Loading @@ -393,7 +393,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, if( !track || track->Type() != TYPETRACK ) return false; D( printf( "Project\n" ); ) // D( printf( "Project\n" ); ) return Project( curpos, on_grid, track ); } Loading Loading @@ -431,7 +431,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, if( Join( curpos, track->m_Start, track->m_End, currTrack->m_Start, currTrack->m_End ) ) { D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );) // D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );) return true; } Loading @@ -453,14 +453,14 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, { if( distStart <= currTrack->m_Width/2 ) { D(printf("nearest end is start\n");) // D(printf("nearest end is start\n");) *curpos = track->m_Start; return true; } if( distEnd <= currTrack->m_Width/2 ) { D(printf("nearest end is end\n");) // D(printf("nearest end is end\n");) *curpos = track->m_End; return true; } Loading pcbnew/deltrack.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -130,15 +130,16 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track ) EDA_Rect dirty = Track->GetBoundingBox(); // Convert the rect coordinates and size in pixels (make a draw clip box): DrawPanel->ConvertPcbUnitsToPixelsUnits( dirty ); DrawPanel->ConvertPcbUnitsToPixelsUnits( &dirty ); /* now that TRACK::GetBoundingBox() returns a [,) type of rectangle, and rounds up the track radius, let's see if this is really needed. // Ensure the last line and column are in the dirty rectangle after truncatures dirty.m_Size.x += 1; dirty.m_Size.y += 1; */ // pass wxRect() via EDA_Rect::operator wxRect() overload wxRect dirtyR = dirty; DrawPanel->RefreshRect( dirtyR, TRUE ); DrawPanel->RefreshRect( dirty, TRUE ); #endif Loading Loading
change_log.txt +26 −9 Original line number Diff line number Diff line Loading @@ -5,6 +5,24 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2008-Mar-10 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ +pcbnew * Improved some comments on new functions. * Changed void ConvertPcbUnitsToPixelsUnits( EDA_Rect& aRect ); to void ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect ); which I prefer because it is clearer to the human reader of the calling context that the passed argument is to be modified. References as function arguments are fine, but if they are to be modified, passing by pointer gives human reader a clearer picture when looking at the calling context. * TRACK::GetBoundingBox() now (1) rounds up the radius, and (2) returns a bounding box which is [pos,dim) in nature, [inclusive, exclusive). * Changed from "new wxDCClip()" to use an automatic wxDCClip() variable in drawpanel.cpp * Removed a printf() from "release" build of drawpanel.cpp 2008-Mar-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +pcbnew Loading @@ -15,7 +33,6 @@ email address. Dirty rectangle calculation debugged. WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( EDA_Rect& aRect ) can be used to convert a bouding box to a clip box (see example in deltrack.cpp) +eeschema: restored: missing lines in schedit.cpp (problems in a lot of commands) Loading
include/drawpanel_wxstruct.h +28 −25 Original line number Diff line number Diff line Loading @@ -96,20 +96,23 @@ public: wxPoint CursorRealPosition( const wxPoint& ScreenPos ); wxPoint CursorScreenPosition(); /** Function ConvertPcbUnitsToPixelsUnits * Convert pos and size of the given EDA_Rect to pos and size in pixels, * relative to the current draw area (origin 0,0 is the left top visible corner draw area) * according to the current scrool and zoom * @param aRect = the given rect /** * Function ConvertPcbUnitsToPixelsUnits * converts pos and size of the given EDA_Rect to pos and size in pixels, * relative to the current draw area (origin 0,0 is the left top visible * corner of draw area) according to the current scroll and zoom. * @param aRect = the rectangle to convert */ void ConvertPcbUnitsToPixelsUnits( EDA_Rect & aRect); /** Function ConvertPcbUnitsToPixelsUnits * Convert a given wxPoint position (in internal units) to the pos in pixels, * relative to the current draw area (origin 0,0 is the left top visible corner draw area) * according to the current scrool and zoom * @param aPosition = the given position void ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect ); /** * Function ConvertPcbUnitsToPixelsUnits * converts a given wxPoint position (in internal units) to units of pixels, * relative to the current draw area (origin 0,0 is the left top visible * corner of draw area) according to the current scroll and zoom. * @param aPosition = the position to convert */ void ConvertPcbUnitsToPixelsUnits( wxPoint & aPosition); void ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition ); wxPoint GetScreenCenterRealPosition( void ); void MouseToCursorSchema(); Loading
pcbnew/class_track.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -207,7 +207,8 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) EDA_Rect TRACK::GetBoundingBox() const { int radius = m_Width/2; // end of track is round, this is its radius // end of track is round, this is its radius, rounded up int radius = ( m_Width+1 )/2; int ymax = MAX( m_Start.y, m_End.y ); int xmax = MAX( m_Start.x, m_End.x ); Loading @@ -221,7 +222,8 @@ EDA_Rect TRACK::GetBoundingBox() const ymin -= radius; xmin -= radius; return EDA_Rect( wxPoint( xmin, ymin ), wxSize( xmax-xmin, ymax-ymin ) ); // return a rectangle which is [pos,dim) in nature. therefore the +1 return EDA_Rect( wxPoint( xmin, ymin ), wxSize( xmax-xmin+1, ymax-ymin+1 ) ); } Loading
pcbnew/controle.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -375,13 +375,13 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, if( !doCheckNet || !currTrack || currTrack->GetNet() == via->GetNet() ) { *curpos = via->m_Start; D(printf("via hit\n");) // D(printf("via hit\n");) return true; } } else { D( printf( "skipping self\n" ); ) // D( printf( "skipping self\n" ); ) } } Loading @@ -393,7 +393,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, if( !track || track->Type() != TYPETRACK ) return false; D( printf( "Project\n" ); ) // D( printf( "Project\n" ); ) return Project( curpos, on_grid, track ); } Loading Loading @@ -431,7 +431,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, if( Join( curpos, track->m_Start, track->m_End, currTrack->m_Start, currTrack->m_End ) ) { D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );) // D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );) return true; } Loading @@ -453,14 +453,14 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, { if( distStart <= currTrack->m_Width/2 ) { D(printf("nearest end is start\n");) // D(printf("nearest end is start\n");) *curpos = track->m_Start; return true; } if( distEnd <= currTrack->m_Width/2 ) { D(printf("nearest end is end\n");) // D(printf("nearest end is end\n");) *curpos = track->m_End; return true; } Loading
pcbnew/deltrack.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -130,15 +130,16 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track ) EDA_Rect dirty = Track->GetBoundingBox(); // Convert the rect coordinates and size in pixels (make a draw clip box): DrawPanel->ConvertPcbUnitsToPixelsUnits( dirty ); DrawPanel->ConvertPcbUnitsToPixelsUnits( &dirty ); /* now that TRACK::GetBoundingBox() returns a [,) type of rectangle, and rounds up the track radius, let's see if this is really needed. // Ensure the last line and column are in the dirty rectangle after truncatures dirty.m_Size.x += 1; dirty.m_Size.y += 1; */ // pass wxRect() via EDA_Rect::operator wxRect() overload wxRect dirtyR = dirty; DrawPanel->RefreshRect( dirtyR, TRUE ); DrawPanel->RefreshRect( dirty, TRUE ); #endif Loading