Commit b700f7c2 authored by jean-pierre charras's avatar jean-pierre charras

fix bug 692240: a subtle bug in LIB_COMPONENT::LocateDrawItem() that destroys...

fix bug 692240: a subtle bug in LIB_COMPONENT::LocateDrawItem() that destroys DefaultTransform matrix.
parent 263e5c24
...@@ -1361,27 +1361,12 @@ LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert, KICAD_T a ...@@ -1361,27 +1361,12 @@ LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert, KICAD_T a
* we temporary copy aTransMat in DefaultTransformMatrix * we temporary copy aTransMat in DefaultTransformMatrix
*/ */
LIB_DRAW_ITEM* item; LIB_DRAW_ITEM* item;
TRANSFORM transform; TRANSFORM transform = DefaultTransform;
for ( int ii = 0; ii < 2; ii++ )
{
for ( int jj = 0; jj < 2; jj++ )
{
transform = DefaultTransform;
DefaultTransform = aTransform;
}
}
item = LocateDrawItem( aUnit, aConvert, aType, aPoint ); item = LocateDrawItem( aUnit, aConvert, aType, aPoint );
//Restore matrix //Restore matrix
for ( int ii = 0; ii < 2; ii++ )
{
for ( int jj = 0; jj < 2; jj++ )
{
DefaultTransform = transform; DefaultTransform = transform;
}
}
return item; return item;
} }
......
...@@ -685,40 +685,41 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet ) ...@@ -685,40 +685,41 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
void SCH_COMPONENT::SetOrientation( int aOrientation ) void SCH_COMPONENT::SetOrientation( int aOrientation )
{ {
TRANSFORM temp = TRANSFORM(); TRANSFORM temp = TRANSFORM();
bool Transform = false; bool Transform = false;
switch( aOrientation ) switch( aOrientation )
{ {
case CMP_ORIENT_0: case CMP_ORIENT_0:
case CMP_NORMAL: /* Position Initiale */ case CMP_NORMAL: // default transform matrix
m_transform.x1 = 1; m_transform.x1 = 1;
m_transform.y2 = -1; m_transform.y2 = -1;
m_transform.x2 = m_transform.y1 = 0; m_transform.x2 = m_transform.y1 = 0;
break; break;
case CMP_ROTATE_CLOCKWISE: /* Rotate + */ case CMP_ROTATE_CLOCKWISE: // Rotate + (incremental rotation)
temp.x1 = temp.y2 = 0; temp.x1 = temp.y2 = 0;
temp.y1 = 1; temp.y1 = 1;
temp.x2 = -1; temp.x2 = -1;
Transform = true; Transform = true;
break; break;
case CMP_ROTATE_COUNTERCLOCKWISE: /* Rotate - */ case CMP_ROTATE_COUNTERCLOCKWISE: // Rotate - (incremental rotation)
temp.x1 = temp.y2 = 0; temp.x1 = temp.y2 = 0;
temp.y1 = -1; temp.y1 = -1;
temp.x2 = 1; temp.x2 = 1;
Transform = true; Transform = true;
break; break;
case CMP_MIRROR_Y: /* MirrorY */ case CMP_MIRROR_Y: // Mirror Y (incremental rotation)
temp.x1 = -1; temp.x1 = -1;
temp.y2 = 1; temp.y2 = 1;
temp.y1 = temp.x2 = 0; temp.y1 = temp.x2 = 0;
Transform = true; Transform = true;
break; break;
case CMP_MIRROR_X: /* MirrorX */ case CMP_MIRROR_X: // Mirror X (incremental rotation)
temp.x1 = 1; temp.x1 = 1;
temp.y2 = -1; temp.y2 = -1;
temp.y1 = temp.x2 = 0; temp.y1 = temp.x2 = 0;
...@@ -790,14 +791,14 @@ void SCH_COMPONENT::SetOrientation( int aOrientation ) ...@@ -790,14 +791,14 @@ void SCH_COMPONENT::SetOrientation( int aOrientation )
if( Transform ) if( Transform )
{ {
/* The new matrix transform is the old matrix transform modified by the /* The new matrix transform is the old matrix transform modified by the
* requested transformation, which is the TempMat transform (rot, * requested transformation, which is the temp transform (rot,
* mirror ..) in order to have (in term of matrix transform): * mirror ..) in order to have (in term of matrix transform):
* transform coord = new_m_transform * coord * transform coord = new_m_transform * coord
* where transform coord is the coord modified by new_m_transform from * where transform coord is the coord modified by new_m_transform from
* the initial value coord. * the initial value coord.
* new_m_transform is computed (from old_m_transform and TempMat) to * new_m_transform is computed (from old_m_transform and temp) to
* have: * have:
* transform coord = old_m_transform * coord * TempMat * transform coord = old_m_transform * temp
*/ */
TRANSFORM newTransform; TRANSFORM newTransform;
......
...@@ -381,7 +381,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -381,7 +381,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_IMPORT_GLABEL: case ID_POPUP_IMPORT_GLABEL:
if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_SHEET_T ) if( screen->GetCurItem() && screen->GetCurItem()->Type() == SCH_SHEET_T )
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ) ); screen->SetCurItem( Import_PinSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ) );
break; break;
case ID_POPUP_SCH_CLEANUP_SHEET: case ID_POPUP_SCH_CLEANUP_SHEET:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment