Libedit: add block rotate and block mirror horizontally

This commit is contained in:
jean-pierre charras 2011-05-20 20:29:35 +02:00
parent 9214f5849e
commit f81c237d43
23 changed files with 294 additions and 12 deletions

View File

@ -140,12 +140,12 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save */
case BLOCK_PASTE: case BLOCK_PASTE:
case BLOCK_ROTATE:
case BLOCK_MIRROR_X:
case BLOCK_FLIP: case BLOCK_FLIP:
break; break;
case BLOCK_ROTATE:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
if ( m_component ) if ( m_component )
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate, ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
@ -158,7 +158,13 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if ( m_component ) if ( m_component )
{ {
OnModify(); OnModify();
int block_cmd = GetScreen()->m_BlockLocate.m_Command;
if( block_cmd == BLOCK_MIRROR_Y)
m_component->MirrorSelectedItemsH( pt ); 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; break;
@ -240,19 +246,28 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; 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 ) if ( m_component )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre(); pt = GetScreen()->m_BlockLocate.Centre();
pt.y *= -1; pt.y *= -1;
if ( m_component ) if ( m_component )
{
int block_cmd = GetScreen()->m_BlockLocate.m_Command;
if( block_cmd == BLOCK_MIRROR_Y)
m_component->MirrorSelectedItemsH( pt ); 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; break;
case BLOCK_ZOOM: // Handled by HandleBlockEnd case BLOCK_ZOOM: // Handled by HandleBlockEnd
case BLOCK_DELETE: case BLOCK_DELETE:
case BLOCK_SAVE: case BLOCK_SAVE:
case BLOCK_ROTATE:
case BLOCK_ABORT: case BLOCK_ABORT:
default: default:
break; break;

View File

@ -1215,7 +1215,10 @@ bool LIB_COMPONENT::HasConversion() const
void LIB_COMPONENT::ClearStatus() void LIB_COMPONENT::ClearStatus()
{ {
BOOST_FOREACH( LIB_ITEM& item, drawings ) BOOST_FOREACH( LIB_ITEM& item, drawings )
{
item.m_Flags = 0; item.m_Flags = 0;
item.m_Selected = 0;
}
} }
@ -1346,6 +1349,35 @@ void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& aCenter )
drawings.sort(); 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, LIB_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert,
KICAD_T aType, const wxPoint& aPoint ) KICAD_T aType, const wxPoint& aPoint )

View File

@ -512,6 +512,20 @@ public:
*/ */
void MirrorSelectedItemsH( const wxPoint& aCenter ); 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. * Locate a draw object.
* *

View File

@ -277,6 +277,28 @@ void LIB_ARC::DoMirrorHorizontal( const wxPoint& aCenter )
EXCHG( m_ArcStart, m_ArcEnd ); 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, void LIB_ARC::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -141,6 +141,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ); virtual void DoMove( const wxPoint& aPosition );
virtual wxPoint DoGetPosition() const { return m_Pos; } virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter ); 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, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; } virtual int DoGetWidth() const { return m_Width; }

View File

@ -190,6 +190,42 @@ void LIB_BEZIER::DoMirrorHorizontal( const wxPoint& aCenter )
} }
} }
void LIB_BEZIER::DoMirrorVertical( const wxPoint& aCenter )
{
size_t i, imax = m_PolyPoints.size();
for( i = 0; i < imax; i++ )
{
m_PolyPoints[i].y -= aCenter.y;
m_PolyPoints[i].y *= -1;
m_PolyPoints[i].y += aCenter.y;
}
imax = m_BezierPoints.size();
for( i = 0; i < imax; i++ )
{
m_BezierPoints[i].y -= aCenter.y;
m_BezierPoints[i].y *= -1;
m_BezierPoints[i].y += aCenter.y;
}
}
void LIB_BEZIER::DoRotate( const wxPoint& aCenter )
{
size_t i, imax = m_PolyPoints.size();
for( i = 0; i < imax; i++ )
{
RotatePoint( &m_PolyPoints[i], aCenter, -900 );
}
imax = m_BezierPoints.size();
for( i = 0; i < imax; i++ )
{
RotatePoint( &m_BezierPoints[i], aCenter, -900 );
}
}
void LIB_BEZIER::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void LIB_BEZIER::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -93,6 +93,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ); virtual void DoMove( const wxPoint& aPosition );
virtual wxPoint DoGetPosition() const { return m_PolyPoints[0]; } virtual wxPoint DoGetPosition() const { return m_PolyPoints[0]; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter ); 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, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; } virtual int DoGetWidth() const { return m_Width; }

View File

@ -162,6 +162,18 @@ void LIB_CIRCLE::DoMirrorHorizontal( const wxPoint& aCenter )
m_Pos.x += aCenter.x; m_Pos.x += aCenter.x;
} }
void LIB_CIRCLE::DoMirrorVertical( const wxPoint& aCenter )
{
m_Pos.y -= aCenter.y;
m_Pos.y *= -1;
m_Pos.y += aCenter.y;
}
void LIB_CIRCLE::DoRotate( const wxPoint& aCenter )
{
RotatePoint( &m_Pos, aCenter, -900 );
}
void LIB_CIRCLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void LIB_CIRCLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -109,6 +109,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ); virtual void DoMove( const wxPoint& aPosition );
virtual wxPoint DoGetPosition() const { return m_Pos; } virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter ); 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, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; } virtual int DoGetWidth() const { return m_Width; }

View File

@ -299,6 +299,26 @@ public:
DoMirrorHorizontal( aCenter ); DoMirrorHorizontal( aCenter );
} }
/**
* Mirror the draw object along the MirrorVertical (Y) axis about a point.
*
* @param aCenter - Point to mirror around.
*/
void MirrorVertical( const wxPoint& aCenter )
{
DoMirrorVertical( aCenter );
}
/**
* Rotate about a point.
*
* @param aCenter - Point to mirror around.
*/
void Rotate( const wxPoint& aCenter )
{
DoRotate( aCenter );
}
/** /**
* Rotate the draw item. * Rotate the draw item.
*/ */
@ -377,6 +397,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ) = 0; virtual void DoMove( const wxPoint& aPosition ) = 0;
virtual wxPoint DoGetPosition() const = 0; virtual wxPoint DoGetPosition() const = 0;
virtual void DoMirrorHorizontal( const wxPoint& aCenter ) = 0; virtual void DoMirrorHorizontal( const wxPoint& aCenter ) = 0;
virtual void DoMirrorVertical( const wxPoint& aCenter ) = 0;
virtual void DoRotate( const wxPoint& aCenter ) = 0;
virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) = 0; const TRANSFORM& aTransform ) = 0;
virtual int DoGetWidth() const = 0; virtual int DoGetWidth() const = 0;

View File

@ -476,6 +476,18 @@ void LIB_FIELD::DoMirrorHorizontal( const wxPoint& center )
m_Pos.x += center.x; m_Pos.x += center.x;
} }
void LIB_FIELD::DoMirrorVertical( const wxPoint& center )
{
m_Pos.y -= center.y;
m_Pos.y *= -1;
m_Pos.y += center.y;
}
void LIB_FIELD::DoRotate( const wxPoint& center )
{
RotatePoint( &m_Pos, center, -900 );
}
void LIB_FIELD::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_FIELD::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -245,6 +245,8 @@ protected:
virtual void DoMove( const wxPoint& newPosition ); virtual void DoMove( const wxPoint& newPosition );
virtual wxPoint DoGetPosition( void ) const { return m_Pos; } virtual wxPoint DoGetPosition( void ) const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoMirrorVertical( const wxPoint& aCenter );
virtual void DoRotate( const wxPoint& aCenter );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth( void ) const { return m_Thickness; } virtual int DoGetWidth( void ) const { return m_Thickness; }

View File

@ -1673,6 +1673,41 @@ void LIB_PIN::DoMirrorHorizontal( const wxPoint& center )
m_orientation = PIN_RIGHT; m_orientation = PIN_RIGHT;
} }
void LIB_PIN::DoMirrorVertical( const wxPoint& center )
{
m_position.y -= center.y;
m_position.y *= -1;
m_position.y += center.y;
if( m_orientation == PIN_UP )
m_orientation = PIN_DOWN;
else if( m_orientation == PIN_DOWN )
m_orientation = PIN_UP;
}
void LIB_PIN::DoRotate( const wxPoint& center )
{
RotatePoint( &m_position, center, -900 );
switch( m_orientation )
{
case PIN_RIGHT:
m_orientation = PIN_UP;
break;
case PIN_UP:
m_orientation = PIN_LEFT;
break;
case PIN_LEFT:
m_orientation = PIN_DOWN;
break;
case PIN_DOWN:
m_orientation = PIN_RIGHT;
break;
}
}
void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -472,6 +472,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ); virtual void DoMove( const wxPoint& aPosition );
virtual wxPoint DoGetPosition() const { return m_position; } virtual wxPoint DoGetPosition() const { return m_position; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter ); 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, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_width; } virtual int DoGetWidth() const { return m_width; }

View File

@ -177,6 +177,28 @@ void LIB_POLYLINE::DoMirrorHorizontal( const wxPoint& aCenter )
} }
} }
void LIB_POLYLINE::DoMirrorVertical( const wxPoint& aCenter )
{
size_t i, imax = m_PolyPoints.size();
for( i = 0; i < imax; i++ )
{
m_PolyPoints[i].y -= aCenter.y;
m_PolyPoints[i].y *= -1;
m_PolyPoints[i].y += aCenter.y;
}
}
void LIB_POLYLINE::DoRotate( const wxPoint& aCenter )
{
size_t i, imax = m_PolyPoints.size();
for( i = 0; i < imax; i++ )
{
RotatePoint( &m_PolyPoints[i], aCenter, -900 );
}
}
void LIB_POLYLINE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void LIB_POLYLINE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -126,6 +126,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ); virtual void DoMove( const wxPoint& aPosition );
virtual wxPoint DoGetPosition() const { return m_PolyPoints[0]; } virtual wxPoint DoGetPosition() const { return m_PolyPoints[0]; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter ); 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, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; } virtual int DoGetWidth() const { return m_Width; }

View File

@ -132,6 +132,22 @@ void LIB_RECTANGLE::DoMirrorHorizontal( const wxPoint& aCenter )
m_End.x += aCenter.x; m_End.x += aCenter.x;
} }
void LIB_RECTANGLE::DoMirrorVertical( const wxPoint& aCenter )
{
m_Pos.y -= aCenter.y;
m_Pos.y *= -1;
m_Pos.y += aCenter.y;
m_End.y -= aCenter.y;
m_End.y *= -1;
m_End.y += aCenter.y;
}
void LIB_RECTANGLE::DoRotate( const wxPoint& aCenter )
{
RotatePoint( &m_Pos, aCenter, -900 );
RotatePoint( &m_End, aCenter, -900 );
}
void LIB_RECTANGLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void LIB_RECTANGLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -116,6 +116,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ); virtual void DoMove( const wxPoint& aPosition );
virtual wxPoint DoGetPosition() const { return m_Pos; } virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter ); 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, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Width; } virtual int DoGetWidth() const { return m_Width; }

View File

@ -1,5 +1,5 @@
/***************************/ /***************************/
/* class_BodyItem_Text.cpp */ /* lib_text.cpp */
/***************************/ /***************************/
/** /**
@ -264,6 +264,19 @@ void LIB_TEXT::DoMirrorHorizontal( const wxPoint& center )
m_Pos.x += center.x; m_Pos.x += center.x;
} }
void LIB_TEXT::DoMirrorVertical( const wxPoint& center )
{
m_Pos.y -= center.y;
m_Pos.y *= -1;
m_Pos.y += center.y;
}
void LIB_TEXT::DoRotate( const wxPoint& center )
{
RotatePoint( &m_Pos, center, -900 );
m_Orient = m_Orient ? 0 : 900;
}
void LIB_TEXT::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_TEXT::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )

View File

@ -141,6 +141,8 @@ protected:
virtual void DoMove( const wxPoint& aPosition ); virtual void DoMove( const wxPoint& aPosition );
virtual wxPoint DoGetPosition() const { return m_Pos; } virtual wxPoint DoGetPosition() const { return m_Pos; }
virtual void DoMirrorHorizontal( const wxPoint& aCenter ); 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, virtual void DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int DoGetWidth() const { return m_Thickness; } virtual int DoGetWidth() const { return m_Thickness; }

View File

@ -299,6 +299,8 @@ void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame )
ADD_MENUITEM( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ), green_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ), green_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_H_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_H_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_V_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_pos_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm );
} }
} }

View File

@ -19,17 +19,14 @@ void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int unused_flag )
CopyItem = new LIB_COMPONENT( *( (LIB_COMPONENT*) ItemToCopy ) ); CopyItem = new LIB_COMPONENT( *( (LIB_COMPONENT*) ItemToCopy ) );
if( CopyItem == NULL ) // Clear current flags (which can be temporary set by a current edit command).
return; CopyItem->ClearStatus();
lastcmd = new PICKED_ITEMS_LIST(); lastcmd = new PICKED_ITEMS_LIST();
ITEM_PICKER wrapper( CopyItem, UR_LIBEDIT ); ITEM_PICKER wrapper( CopyItem, UR_LIBEDIT );
lastcmd->PushItem(wrapper); lastcmd->PushItem(wrapper);
GetScreen()->PushCommandToUndoList( lastcmd ); GetScreen()->PushCommandToUndoList( lastcmd );
// Clear current flags (which can be temporary set by a current edit command).
CopyItem->ClearStatus();
// Clear redo list, because after new save there is no redo to do. // Clear redo list, because after new save there is no redo to do.
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList ); GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
} }

View File

@ -626,7 +626,9 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
case ID_POPUP_SELECT_ITEMS_BLOCK: case ID_POPUP_SELECT_ITEMS_BLOCK:
case ID_POPUP_MIRROR_X_BLOCK:
case ID_POPUP_MIRROR_Y_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT: case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
break; break;
@ -806,6 +808,20 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_MIRROR_X_BLOCK:
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X;
DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc );
break;
case ID_POPUP_ROTATE_BLOCK:
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc );
break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();