eeschema: fixing intersheet ref mirroring for global labels

Implementing Mirror{X,Y} overrides in SCH_GLOBALLABEL in order
to properly handle Intersheet Ref field mirroring.

Fixes: https://gitlab.com/kicad/code/kicad/issues/7225
This commit is contained in:
Zoltan Gyarmati 2021-02-03 20:54:09 +01:00 committed by Seth Hillbrand
parent dc424ec7ff
commit 17b0117074
2 changed files with 33 additions and 0 deletions

View File

@ -1057,6 +1057,36 @@ void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
} }
void SCH_GLOBALLABEL::MirrorY( int aYaxis_position )
{
wxPoint old_pos = GetPosition();
SCH_TEXT::MirrorY( aYaxis_position );
if( m_intersheetRefsField.GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
m_intersheetRefsField.SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
else
m_intersheetRefsField.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
wxPoint pos = m_intersheetRefsField.GetTextPos();
wxPoint delta = old_pos - pos;
pos.x = GetPosition().x + delta.x;
m_intersheetRefsField.SetPosition( pos );
}
void SCH_GLOBALLABEL::MirrorX( int aXaxis_position )
{
wxPoint old_pos = GetPosition();
SCH_TEXT::MirrorX( aXaxis_position );
wxPoint pos = m_intersheetRefsField.GetTextPos();
wxPoint delta = old_pos - pos;
pos.y = GetPosition().y + delta.y;
m_intersheetRefsField.SetPosition( pos );
}
void SCH_GLOBALLABEL::UpdateIntersheetRefProps() void SCH_GLOBALLABEL::UpdateIntersheetRefProps()
{ {
m_intersheetRefsField.SetTextSize( GetTextSize() ); m_intersheetRefsField.SetTextSize( GetTextSize() );

View File

@ -406,6 +406,9 @@ public:
void Rotate90( bool aClockwise ) override; void Rotate90( bool aClockwise ) override;
void MirrorSpinStyle( bool aLeftRight ) override; void MirrorSpinStyle( bool aLeftRight ) override;
void MirrorY( int aYaxis_position ) override;
void MirrorX( int aXaxis_position ) override;
void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override; void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override;
wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;