void LIB_CIRCLE::EndEdit( const wxPoint& aPosition, bool aAbort ) { wxCHECK_RET( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Bad call to EndEdit(). LIB_CIRCLE is not being edited." ) ); SetEraseLastDrawItem( false ); m_Flags = 0; }
void LIB_RECTANGLE::EndEdit( const wxPoint& aPosition, bool aAbort ) { wxCHECK_RET( ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Bad call to EndEdit(). LIB_RECTANGLE is not being edited." ) ); m_Flags = 0; m_isHeightLocked = false; m_isWidthLocked = false; SetEraseLastDrawItem( false ); }
void LIB_TEXT::EndEdit( const wxPoint& aPosition, bool aAbort ) { wxCHECK_RET( ( m_Flags & ( IS_NEW | IS_MOVED ) ) != 0, wxT( "Bad call to EndEdit(). Text is not being edited." ) ); m_Flags = 0; m_rotate = false; m_updateText = false; SetEraseLastDrawItem( false ); }
void LIB_CIRCLE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Invalid edit mode for LIB_CIRCLE object." ) ); if( aEditMode == IS_NEW ) { m_Pos = m_initialPos = aPosition; } else if( aEditMode == IS_MOVED ) { m_initialPos = m_Pos; m_initialCursorPos = aPosition; SetEraseLastDrawItem(); } else if( aEditMode == IS_RESIZED ) { SetEraseLastDrawItem(); } m_Flags = aEditMode; }
void LIB_CIRCLE::calcEdit( const wxPoint& aPosition ) { if( m_Flags == IS_NEW || m_Flags == IS_RESIZED ) { if( m_Flags == IS_NEW ) SetEraseLastDrawItem(); m_Radius = KiROUND( GetLineLength( m_Pos, aPosition ) ); } else { Move( m_initialPos + aPosition - m_initialCursorPos ); } }
void LIB_RECTANGLE::BeginEdit( int aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Invalid edit mode for LIB_RECTANGLE object." ) ); if( aEditMode == IS_NEW ) { m_Pos = m_End = aPosition; } else if( aEditMode == IS_RESIZED ) { m_isStartPointSelected = abs( m_Pos.x - aPosition.x ) < MINIMUM_SELECTION_DISTANCE || abs( m_Pos.y - aPosition.y ) < MINIMUM_SELECTION_DISTANCE; if( m_isStartPointSelected ) { m_isWidthLocked = abs( m_Pos.x - aPosition.x ) >= MINIMUM_SELECTION_DISTANCE; m_isHeightLocked = abs( m_Pos.y - aPosition.y ) >= MINIMUM_SELECTION_DISTANCE; } else { m_isWidthLocked = abs( m_End.x - aPosition.x ) >= MINIMUM_SELECTION_DISTANCE; m_isHeightLocked = abs( m_End.y - aPosition.y ) >= MINIMUM_SELECTION_DISTANCE; } SetEraseLastDrawItem(); } else if( aEditMode == IS_MOVED ) { m_initialPos = m_Pos; m_initialCursorPos = aPosition; SetEraseLastDrawItem(); } m_Flags = aEditMode; }
void LIB_CIRCLE::calcEdit( const wxPoint& aPosition ) { if( m_Flags == IS_NEW || m_Flags == IS_RESIZED ) { if( m_Flags == IS_NEW ) SetEraseLastDrawItem(); int dx = m_Pos.x - aPosition.x; int dy = m_Pos.y - aPosition.y; m_Radius = wxRound( sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ) ); } else { Move( m_initialPos + aPosition - m_initialCursorPos ); } }
void LIB_TEXT::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0, wxT( "Invalid edit mode for LIB_TEXT object." ) ); if( aEditMode == IS_MOVED ) { m_initialPos = GetTextPos(); m_initialCursorPos = aPosition; SetEraseLastDrawItem(); } else { SetTextPos( aPosition ); } m_Flags = aEditMode; }
void LIB_RECTANGLE::calcEdit( const wxPoint& aPosition ) { if( m_Flags == IS_NEW ) { m_End = aPosition; SetEraseLastDrawItem(); } else if( m_Flags == IS_RESIZED ) { if( m_isHeightLocked ) { if( m_isStartPointSelected ) m_Pos.x = aPosition.x; else m_End.x = aPosition.x; } else if( m_isWidthLocked ) { if( m_isStartPointSelected ) m_Pos.y = aPosition.y; else m_End.y = aPosition.y; } else { if( m_isStartPointSelected ) m_Pos = aPosition; else m_End = aPosition; } } else if( m_Flags == IS_MOVED ) { Move( m_initialPos + aPosition - m_initialCursorPos ); } }
void LIB_TEXT::calcEdit( const wxPoint& aPosition ) { if( m_rotate ) { SetTextAngle( GetTextAngle() == TEXT_ANGLE_VERT ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT ); m_rotate = false; } if( m_updateText ) { std::swap( m_Text, m_savedText ); m_updateText = false; } if( m_Flags == IS_NEW ) { SetEraseLastDrawItem(); SetTextPos( aPosition ); } else if( m_Flags == IS_MOVED ) { Move( m_initialPos + aPosition - m_initialCursorPos ); } }
void LIB_TEXT::calcEdit( const wxPoint& aPosition ) { if( m_rotate ) { m_Orient = ( m_Orient == TEXT_ORIENT_VERT ) ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT; m_rotate = false; } if( m_updateText ) { EXCHG( m_Text, m_savedText ); m_updateText = false; } if( m_Flags == IS_NEW ) { SetEraseLastDrawItem(); m_Pos = aPosition; } else if( m_Flags == IS_MOVED ) { Move( m_initialPos + aPosition - m_initialCursorPos ); } }