Eeschema: bug fix: incorrect behavior when changing(for a multiple parts per package component) the selected part (component not deselected)

Fix a minor compil warning in lib_polyline.cpp
This commit is contained in:
jean-pierre charras 2011-04-11 13:45:16 +02:00
commit d5c985866f
3 changed files with 45 additions and 43 deletions

View File

@ -56,8 +56,8 @@ else (KICAD_STABLE_VERSION )
message( "Build testing (unstable) version of Kicad" )
else (KICAD_TESTING_VERSION )
message( "Please set to ON one option of KICAD_TESTING_VERSION or KICAD_STABLE_VERSION" )
message( "When calling cmake add option -DKICAD_STABLE_VERSION" )
message( "or add option -DKICAD_TESTING_VERSION " )
message( "When calling cmake add option -DKICAD_STABLE_VERSION=ON" )
message( "or add option -DKICAD_TESTING_VERSION=ON" )
message( FATAL_ERROR "one option of KICAD_TESTING_VERSION or KICAD_STABLE_VERSION must be defined" )
endif(KICAD_TESTING_VERSION )
endif(KICAD_STABLE_VERSION )

View File

@ -377,7 +377,8 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
/* Update the unit number. */
component->SetUnitSelection( GetSheet(), unit );
component->SetUnit( unit );
component->SetFlags( flags ); // Restore m_Flag modified by SetUnit();
component->ClearFlags();
component->SetFlags( flags ); // Restore m_Flag modified by SetUnit()
/* Redraw the component in the new position. */
if( flags )

View File

@ -207,7 +207,6 @@ void LIB_POLYLINE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill
pos = aTransform.TransformCoordinate( pos ) + aOffset;
Poly[i * 2] = pos.x;
Poly[i * 2 + 1] = pos.y;
}
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
@ -431,8 +430,7 @@ void LIB_POLYLINE::BeginEdit( int aEditMode, const wxPoint aPosition )
wxPoint prevPoint = startPoint;
// Find the right index of the point to be dragged
BOOST_FOREACH( wxPoint point, m_PolyPoints )
{
BOOST_FOREACH( wxPoint point, m_PolyPoints ) {
int distancePoint = (aPosition - point).x * (aPosition - point).x +
(aPosition - point).y * (aPosition - point).y;
@ -443,6 +441,7 @@ void LIB_POLYLINE::BeginEdit( int aEditMode, const wxPoint aPosition )
m_ModifyIndex = index;
distanceMin = distancePoint;
}
// check middle of an edge
wxPoint offset = ( aPosition + aPosition - point - prevPoint );
distancePoint = ( offset.x * offset.x + offset.y * offset.y ) / 4 + 1;
@ -492,17 +491,19 @@ void LIB_POLYLINE::EndEdit( const wxPoint& aPosition, bool aAbort )
{
wxCHECK_RET( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Bad call to EndEdit(). LIB_POLYLINE is not being edited." ) );
// do not include last point twice
if( m_Flags == IS_NEW && 2 < m_PolyPoints.size() )
{
if( m_PolyPoints[ m_PolyPoints.size() - 2 ] == m_PolyPoints.back() )
m_PolyPoints.pop_back();
}
if( m_Flags == IS_RESIZED ) {
if( m_PolyPoints.size() > 2 // do not delete last two points... keep it alive
&& ( m_ModifyIndex > 0
&& m_PolyPoints[ m_ModifyIndex ] == m_PolyPoints[ m_ModifyIndex - 1 ]
|| m_ModifyIndex < (int)m_PolyPoints.size() - 1
if( (m_Flags == IS_RESIZED) && (m_PolyPoints.size() > 2) ) // do not delete last two points... keep it alive
{
if( ( m_ModifyIndex > 0 && m_PolyPoints[ m_ModifyIndex ] ==
m_PolyPoints[ m_ModifyIndex - 1 ] )
||
( m_ModifyIndex < (int) m_PolyPoints.size() - 1
&& m_PolyPoints[ m_ModifyIndex ] == m_PolyPoints[ m_ModifyIndex + 1 ] ) )
{
m_PolyPoints.erase( m_PolyPoints.begin() + m_ModifyIndex ); // delete a point on this