Commit 182d3d4d authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix bug 796218. Fix minor compil warning.

parent 67517778
...@@ -146,7 +146,7 @@ found in the default search paths." ), ...@@ -146,7 +146,7 @@ found in the default search paths." ),
size_t filtercount = component.m_FootprintFilter.GetCount(); size_t filtercount = component.m_FootprintFilter.GetCount();
found = ( 0 == filtercount ); // if no entries, do not filter found = ( 0 == filtercount ); // if no entries, do not filter
for( int jj = 0; jj < filtercount && !found; jj++ ) for( size_t jj = 0; jj < filtercount && !found; jj++ )
{ {
found = module->m_Module.Matches( component.m_FootprintFilter[jj] ); found = module->m_Module.Matches( component.m_FootprintFilter[jj] );
} }
......
...@@ -283,19 +283,19 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -283,19 +283,19 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
} }
/* Correct a bend is 90 and changes by 2 elbows at 45 /* Add a track segment between 2 tracks segments if these 2 segments
* This only works on horizontal or vertical segments. * make a 90 deg angle, in order to have 45 deg track segments
* Its only works on horizontal or vertical segments.
* *
* Input: pointer to the segment that we have drawn * Input: pointer to the current segment being created
* Assume that the preceding segment is one that has been * Assume that the previous segment is the one that has been
* previously drawn * previously created
* Returns: * Returns:
* 1 if ok * true if ok
* 0 if not * false if not
*/ */
bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC ) bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
{ {
int pas_45;
int dx0, dy0, dx1, dy1; int dx0, dy0, dx1, dy1;
if( g_CurrentTrackList.GetCount() < 2 ) if( g_CurrentTrackList.GetCount() < 2 )
...@@ -304,18 +304,15 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC ) ...@@ -304,18 +304,15 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
TRACK* curTrack = g_CurrentTrackSegment; TRACK* curTrack = g_CurrentTrackSegment;
TRACK* prevTrack = curTrack->Back(); TRACK* prevTrack = curTrack->Back();
// Test whether there has 2 consecutive segments to be connected. // Test if we have 2 consecutive track segments ( not via ) to connect.
if( curTrack->Type() != TYPE_TRACK || prevTrack->Type() != TYPE_TRACK ) if( curTrack->Type() != TYPE_TRACK || prevTrack->Type() != TYPE_TRACK )
{ {
return false; return false;
} }
pas_45 = (int) GetScreen()->GetGridSize().x / 2; int pas_45 = wxRound( GetScreen()->GetGridSize().x / 2 );
if( pas_45 < curTrack->m_Width ) if( pas_45 < curTrack->m_Width )
pas_45 = (int) GetScreen()->GetGridSize().x; pas_45 = curTrack->m_Width;
while( pas_45 < curTrack->m_Width )
pas_45 *= 2;
// Test if the segments are horizontal or vertical. // Test if the segments are horizontal or vertical.
dx0 = prevTrack->m_End.x - prevTrack->m_Start.x; dx0 = prevTrack->m_End.x - prevTrack->m_Start.x;
...@@ -337,7 +334,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC ) ...@@ -337,7 +334,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
newTrack->m_Start = prevTrack->m_End; newTrack->m_Start = prevTrack->m_End;
newTrack->m_End = curTrack->m_Start; newTrack->m_End = curTrack->m_Start;
if( dx0 == 0 ) // Segment precedent Vertical if( dx0 == 0 ) // Previous segment is Vertical
{ {
if( dy1 != 0 ) // 2 segments are not 90 degrees. if( dy1 != 0 ) // 2 segments are not 90 degrees.
{ {
...@@ -346,7 +343,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC ) ...@@ -346,7 +343,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
} }
/* Calculate coordinates the connection point. /* Calculate coordinates the connection point.
* The new segment connects the 1st segment Vertical and the 2nd * The new segment connects the 1st vertical segment and the 2nd
* horizontal segment. * horizontal segment.
*/ */
if( dy0 > 0 ) if( dy0 > 0 )
...@@ -372,7 +369,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC ) ...@@ -372,7 +369,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
return true; return true;
} }
if( dy0 == 0 ) // Segment precedent horizontal if( dy0 == 0 ) // Previous segment is horizontal
{ {
if( dx1 != 0 ) // 2 segments are not 90 degrees if( dx1 != 0 ) // 2 segments are not 90 degrees
{ {
...@@ -381,7 +378,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC ) ...@@ -381,7 +378,7 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
} }
/* Calculate the coordinates of the point of connection: /* Calculate the coordinates of the point of connection:
* A new segment has been established, connecting segment 1 * A new segment has been created, connecting segment 1
* (horizontal) and segment 2 (vertical) * (horizontal) and segment 2 (vertical)
*/ */
if( dx0 > 0 ) if( dx0 > 0 )
......
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