diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 2f0492aa71..4a499d59a3 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -1604,6 +1604,12 @@ void SCH_SYMBOL::SetOrientation( int aOrientation ) SetOrientation( SYM_MIRROR_Y ); break; + case ( SYM_ORIENT_0 + SYM_MIRROR_X + SYM_MIRROR_Y ): + SetOrientation( SYM_ORIENT_0 ); + SetOrientation( SYM_MIRROR_X ); + SetOrientation( SYM_MIRROR_Y ); + break; + case ( SYM_ORIENT_90 + SYM_MIRROR_X ): SetOrientation( SYM_ORIENT_90 ); SetOrientation( SYM_MIRROR_X ); @@ -1614,6 +1620,12 @@ void SCH_SYMBOL::SetOrientation( int aOrientation ) SetOrientation( SYM_MIRROR_Y ); break; + case ( SYM_ORIENT_90 + SYM_MIRROR_X + SYM_MIRROR_Y ): + SetOrientation( SYM_ORIENT_90 ); + SetOrientation( SYM_MIRROR_X ); + SetOrientation( SYM_MIRROR_Y ); + break; + case ( SYM_ORIENT_180 + SYM_MIRROR_X ): SetOrientation( SYM_ORIENT_180 ); SetOrientation( SYM_MIRROR_X ); @@ -1624,6 +1636,12 @@ void SCH_SYMBOL::SetOrientation( int aOrientation ) SetOrientation( SYM_MIRROR_Y ); break; + case ( SYM_ORIENT_180 + SYM_MIRROR_X + SYM_MIRROR_Y ): + SetOrientation( SYM_ORIENT_180 ); + SetOrientation( SYM_MIRROR_X ); + SetOrientation( SYM_MIRROR_Y ); + break; + case ( SYM_ORIENT_270 + SYM_MIRROR_X ): SetOrientation( SYM_ORIENT_270 ); SetOrientation( SYM_MIRROR_X ); @@ -1634,6 +1652,12 @@ void SCH_SYMBOL::SetOrientation( int aOrientation ) SetOrientation( SYM_MIRROR_Y ); break; + case ( SYM_ORIENT_270 + SYM_MIRROR_X + SYM_MIRROR_Y ): + SetOrientation( SYM_ORIENT_270 ); + SetOrientation( SYM_MIRROR_X ); + SetOrientation( SYM_MIRROR_Y ); + break; + default: transform = false; wxFAIL_MSG( "Invalid schematic symbol orientation type." ); @@ -2619,8 +2643,12 @@ static struct SCH_SYMBOL_DESC ORIGIN_TRANSFORMS::ABS_Y_COORD ) ); propMgr.AddProperty( new PROPERTY_ENUM( - _HKI( "Orientation" ), &SCH_SYMBOL::SetOrientationProp, - &SCH_SYMBOL::GetOrientationProp ) ); + _HKI( "Orientation" ), + &SCH_SYMBOL::SetOrientationProp, &SCH_SYMBOL::GetOrientationProp ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Mirror X" ), + &SCH_SYMBOL::SetMirrorX, &SCH_SYMBOL::GetMirrorX ) ); + propMgr.AddProperty( new PROPERTY( _HKI( "Mirror Y" ), + &SCH_SYMBOL::SetMirrorY, &SCH_SYMBOL::GetMirrorY ) ); auto isMultiUnitSymbol = []( INSPECTABLE* aItem ) -> bool diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index e1ee54191b..38b49aad8e 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -350,15 +350,66 @@ public: int GetOrientation() const; /** - * Access for property manager. + * Orientation/mirroring access for property manager. */ void SetOrientationProp( SYMBOL_ORIENTATION_PROP aAngle ) { - SetOrientation( aAngle ); + int mirroring = GetOrientation(); + + mirroring &= ( SYMBOL_ORIENTATION_T::SYM_MIRROR_X | SYMBOL_ORIENTATION_T::SYM_MIRROR_Y ); + + SetOrientation( aAngle | mirroring ); } + SYMBOL_ORIENTATION_PROP GetOrientationProp() const { - return (SYMBOL_ORIENTATION_PROP) GetOrientation(); + int orientation = GetOrientation(); + + orientation &= ~( SYMBOL_ORIENTATION_T::SYM_MIRROR_X | SYMBOL_ORIENTATION_T::SYM_MIRROR_Y ); + + switch( orientation ) + { + default: + case SYM_NORMAL: + case SYM_ORIENT_0: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_0; + case SYM_ORIENT_90: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_90; + case SYM_ORIENT_180: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_180; + case SYM_ORIENT_270: return SYMBOL_ORIENTATION_PROP::SYMBOL_ANGLE_270; + } + } + + void SetMirrorX( bool aMirror ) + { + int orientation = GetOrientation(); + + if( aMirror ) + orientation |= SYMBOL_ORIENTATION_T::SYM_MIRROR_X; + else + orientation &= ~SYMBOL_ORIENTATION_T::SYM_MIRROR_X; + + SetOrientation( orientation ); + } + + bool GetMirrorX() const + { + return GetOrientation() & SYMBOL_ORIENTATION_T::SYM_MIRROR_X; + } + + void SetMirrorY( bool aMirror ) + { + int orientation = GetOrientation(); + + if( aMirror ) + orientation |= SYMBOL_ORIENTATION_T::SYM_MIRROR_Y; + else + orientation &= ~SYMBOL_ORIENTATION_T::SYM_MIRROR_Y; + + SetOrientation( orientation ); + } + + bool GetMirrorY() const + { + return GetOrientation() & SYMBOL_ORIENTATION_T::SYM_MIRROR_Y; } /**