pcbnew: work on undo/redo in progress

This commit is contained in:
charras 2009-08-01 19:58:01 +00:00
parent 41c80dd95b
commit 61550f1ab7
1 changed files with 22 additions and 2 deletions

View File

@ -999,9 +999,9 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
*/ */
void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle ) void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle )
{ {
wxPoint pos;
for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ ) for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ )
{ {
wxPoint pos;
pos.x = m_Poly->corner[ii].x; pos.x = m_Poly->corner[ii].x;
pos.y = m_Poly->corner[ii].y; pos.y = m_Poly->corner[ii].y;
RotatePoint( &pos, centre, angle ); RotatePoint( &pos, centre, angle );
@ -1010,6 +1010,17 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle )
} }
m_Poly->Hatch(); m_Poly->Hatch();
/* rotate filled areas: */
for( unsigned ic = 0; ic < m_FilledPolysList.size(); ic++ )
{
CPolyPt* corner = &m_FilledPolysList[ic];
pos.x = corner->x;
pos.y = corner->y;
RotatePoint( &pos, centre, angle );
corner->x = pos.x;
corner->y = pos.y;
}
} }
/** /**
@ -1034,11 +1045,20 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ ) for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ )
{ {
m_Poly->corner[ii].y -= mirror_ref.y; m_Poly->corner[ii].y -= mirror_ref.y;
m_Poly->corner[ii].y = -m_Poly->corner[ii].y; NEGATE(m_Poly->corner[ii].y);
m_Poly->corner[ii].y += mirror_ref.y; m_Poly->corner[ii].y += mirror_ref.y;
} }
m_Poly->Hatch(); m_Poly->Hatch();
/* mirror filled areas: */
for( unsigned ic = 0; ic < m_FilledPolysList.size(); ic++ )
{
CPolyPt* corner = &m_FilledPolysList[ic];
corner->y -= mirror_ref.y;
NEGATE(corner->y);
corner->y += mirror_ref.y;
}
} }