Loading eeschema/block_libedit.cpp +21 −6 Original line number Diff line number Diff line Loading @@ -140,12 +140,12 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) case BLOCK_SAVE: /* Save */ case BLOCK_PASTE: case BLOCK_ROTATE: case BLOCK_MIRROR_X: case BLOCK_FLIP: break; case BLOCK_ROTATE: case BLOCK_MIRROR_X: case BLOCK_MIRROR_Y: if ( m_component ) ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate, Loading @@ -158,7 +158,13 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) if ( m_component ) { OnModify(); int block_cmd = GetScreen()->m_BlockLocate.m_Command; if( block_cmd == BLOCK_MIRROR_Y) m_component->MirrorSelectedItemsH( pt ); else if( block_cmd == BLOCK_MIRROR_X) m_component->MirrorSelectedItemsV( pt ); else if( block_cmd == BLOCK_ROTATE) m_component->RotateSelectedItems( pt ); } break; Loading Loading @@ -240,19 +246,28 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) GetScreen()->m_BlockLocate.ClearItemsList(); break; case BLOCK_MIRROR_Y: /* Invert by popup menu, from block move */ case BLOCK_ROTATE: // Invert by popup menu, from block move case BLOCK_MIRROR_X: // Invert by popup menu, from block move case BLOCK_MIRROR_Y: // Invert by popup menu, from block move if ( m_component ) SaveCopyInUndoList( m_component ); pt = GetScreen()->m_BlockLocate.Centre(); pt.y *= -1; if ( m_component ) { int block_cmd = GetScreen()->m_BlockLocate.m_Command; if( block_cmd == BLOCK_MIRROR_Y) m_component->MirrorSelectedItemsH( pt ); else if( block_cmd == BLOCK_MIRROR_X) m_component->MirrorSelectedItemsV( pt ); else if( block_cmd == BLOCK_ROTATE ) m_component->RotateSelectedItems( pt ); } break; case BLOCK_ZOOM: // Handled by HandleBlockEnd case BLOCK_DELETE: case BLOCK_SAVE: case BLOCK_ROTATE: case BLOCK_ABORT: default: break; Loading eeschema/class_libentry.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -1215,7 +1215,10 @@ bool LIB_COMPONENT::HasConversion() const void LIB_COMPONENT::ClearStatus() { BOOST_FOREACH( LIB_ITEM& item, drawings ) { item.m_Flags = 0; item.m_Selected = 0; } } Loading Loading @@ -1346,6 +1349,35 @@ void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& aCenter ) drawings.sort(); } void LIB_COMPONENT::MirrorSelectedItemsV( const wxPoint& aCenter ) { BOOST_FOREACH( LIB_ITEM& item, drawings ) { if( item.m_Selected == 0 ) continue; item.MirrorVertical( aCenter ); item.m_Flags = item.m_Selected = 0; } drawings.sort(); } void LIB_COMPONENT::RotateSelectedItems( const wxPoint& aCenter ) { BOOST_FOREACH( LIB_ITEM& item, drawings ) { if( item.m_Selected == 0 ) continue; item.Rotate( aCenter ); item.m_Flags = item.m_Selected = 0; } drawings.sort(); } LIB_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint ) Loading eeschema/class_libentry.h +14 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,20 @@ public: */ void MirrorSelectedItemsH( const wxPoint& aCenter ); /** * Vertically (Y axis) mirror selected draw items about a point. * * @param aCenter - Center point to mirror around. */ void MirrorSelectedItemsV( const wxPoint& aCenter ); /** * Rotate CCW selected draw items about a point. * * @param aCenter - Center point to mirror around. */ void RotateSelectedItems( const wxPoint& aCenter ); /** * Locate a draw object. * Loading eeschema/lib_arc.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,28 @@ void LIB_ARC::DoMirrorHorizontal( const wxPoint& aCenter ) EXCHG( m_ArcStart, m_ArcEnd ); } void LIB_ARC::DoMirrorVertical( const wxPoint& aCenter ) { m_Pos.y -= aCenter.y; m_Pos.y *= -1; m_Pos.y += aCenter.y; m_ArcStart.y -= aCenter.y; m_ArcStart.y *= -1; m_ArcStart.y += aCenter.y; m_ArcEnd.y -= aCenter.y; m_ArcEnd.y *= -1; m_ArcEnd.y += aCenter.y; EXCHG( m_ArcStart, m_ArcEnd ); } void LIB_ARC::DoRotate( const wxPoint& aCenter ) { RotatePoint( &m_Pos, aCenter, -900 ); RotatePoint( &m_ArcStart, aCenter, -900 ); RotatePoint( &m_ArcEnd, aCenter, -900 ); } void LIB_ARC::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, const TRANSFORM& aTransform ) Loading eeschema/lib_arc.h +2 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,8 @@ protected: virtual void DoMove( const wxPoint& aPosition ); virtual wxPoint DoGetPosition() const { return m_Pos; } virtual void DoMirrorHorizontal( const wxPoint& aCenter ); virtual void DoMirrorVertical( const wxPoint& aCenter ); virtual void DoRotate( const wxPoint& aCenter ); virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, const TRANSFORM& aTransform ); virtual int DoGetWidth() const { return m_Width; } Loading Loading
eeschema/block_libedit.cpp +21 −6 Original line number Diff line number Diff line Loading @@ -140,12 +140,12 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) case BLOCK_SAVE: /* Save */ case BLOCK_PASTE: case BLOCK_ROTATE: case BLOCK_MIRROR_X: case BLOCK_FLIP: break; case BLOCK_ROTATE: case BLOCK_MIRROR_X: case BLOCK_MIRROR_Y: if ( m_component ) ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate, Loading @@ -158,7 +158,13 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) if ( m_component ) { OnModify(); int block_cmd = GetScreen()->m_BlockLocate.m_Command; if( block_cmd == BLOCK_MIRROR_Y) m_component->MirrorSelectedItemsH( pt ); else if( block_cmd == BLOCK_MIRROR_X) m_component->MirrorSelectedItemsV( pt ); else if( block_cmd == BLOCK_ROTATE) m_component->RotateSelectedItems( pt ); } break; Loading Loading @@ -240,19 +246,28 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) GetScreen()->m_BlockLocate.ClearItemsList(); break; case BLOCK_MIRROR_Y: /* Invert by popup menu, from block move */ case BLOCK_ROTATE: // Invert by popup menu, from block move case BLOCK_MIRROR_X: // Invert by popup menu, from block move case BLOCK_MIRROR_Y: // Invert by popup menu, from block move if ( m_component ) SaveCopyInUndoList( m_component ); pt = GetScreen()->m_BlockLocate.Centre(); pt.y *= -1; if ( m_component ) { int block_cmd = GetScreen()->m_BlockLocate.m_Command; if( block_cmd == BLOCK_MIRROR_Y) m_component->MirrorSelectedItemsH( pt ); else if( block_cmd == BLOCK_MIRROR_X) m_component->MirrorSelectedItemsV( pt ); else if( block_cmd == BLOCK_ROTATE ) m_component->RotateSelectedItems( pt ); } break; case BLOCK_ZOOM: // Handled by HandleBlockEnd case BLOCK_DELETE: case BLOCK_SAVE: case BLOCK_ROTATE: case BLOCK_ABORT: default: break; Loading
eeschema/class_libentry.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -1215,7 +1215,10 @@ bool LIB_COMPONENT::HasConversion() const void LIB_COMPONENT::ClearStatus() { BOOST_FOREACH( LIB_ITEM& item, drawings ) { item.m_Flags = 0; item.m_Selected = 0; } } Loading Loading @@ -1346,6 +1349,35 @@ void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& aCenter ) drawings.sort(); } void LIB_COMPONENT::MirrorSelectedItemsV( const wxPoint& aCenter ) { BOOST_FOREACH( LIB_ITEM& item, drawings ) { if( item.m_Selected == 0 ) continue; item.MirrorVertical( aCenter ); item.m_Flags = item.m_Selected = 0; } drawings.sort(); } void LIB_COMPONENT::RotateSelectedItems( const wxPoint& aCenter ) { BOOST_FOREACH( LIB_ITEM& item, drawings ) { if( item.m_Selected == 0 ) continue; item.Rotate( aCenter ); item.m_Flags = item.m_Selected = 0; } drawings.sort(); } LIB_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint ) Loading
eeschema/class_libentry.h +14 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,20 @@ public: */ void MirrorSelectedItemsH( const wxPoint& aCenter ); /** * Vertically (Y axis) mirror selected draw items about a point. * * @param aCenter - Center point to mirror around. */ void MirrorSelectedItemsV( const wxPoint& aCenter ); /** * Rotate CCW selected draw items about a point. * * @param aCenter - Center point to mirror around. */ void RotateSelectedItems( const wxPoint& aCenter ); /** * Locate a draw object. * Loading
eeschema/lib_arc.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,28 @@ void LIB_ARC::DoMirrorHorizontal( const wxPoint& aCenter ) EXCHG( m_ArcStart, m_ArcEnd ); } void LIB_ARC::DoMirrorVertical( const wxPoint& aCenter ) { m_Pos.y -= aCenter.y; m_Pos.y *= -1; m_Pos.y += aCenter.y; m_ArcStart.y -= aCenter.y; m_ArcStart.y *= -1; m_ArcStart.y += aCenter.y; m_ArcEnd.y -= aCenter.y; m_ArcEnd.y *= -1; m_ArcEnd.y += aCenter.y; EXCHG( m_ArcStart, m_ArcEnd ); } void LIB_ARC::DoRotate( const wxPoint& aCenter ) { RotatePoint( &m_Pos, aCenter, -900 ); RotatePoint( &m_ArcStart, aCenter, -900 ); RotatePoint( &m_ArcEnd, aCenter, -900 ); } void LIB_ARC::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, const TRANSFORM& aTransform ) Loading
eeschema/lib_arc.h +2 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,8 @@ protected: virtual void DoMove( const wxPoint& aPosition ); virtual wxPoint DoGetPosition() const { return m_Pos; } virtual void DoMirrorHorizontal( const wxPoint& aCenter ); virtual void DoMirrorVertical( const wxPoint& aCenter ); virtual void DoRotate( const wxPoint& aCenter ); virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, const TRANSFORM& aTransform ); virtual int DoGetWidth() const { return m_Width; } Loading