Revert "Eeschema: fix block mirroring of fields attached to labels (all types)"
This reverts commit b968bac318
.
This commit is contained in:
parent
84eacd13a1
commit
6b1c2da867
|
@ -40,7 +40,6 @@
|
|||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <core/mirror.h>
|
||||
#include <trigo.h>
|
||||
#include <sch_label.h>
|
||||
|
||||
|
@ -403,52 +402,6 @@ void SCH_LABEL_BASE::MirrorSpinStyle( bool aLeftRight )
|
|||
}
|
||||
|
||||
|
||||
void SCH_LABEL_BASE::MirrorHorizontally( int aCenter )
|
||||
{
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
SCH_TEXT::MirrorHorizontally( aCenter );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
switch( field.GetHorizJustify() )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT:
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
break;
|
||||
|
||||
case GR_TEXT_H_ALIGN_CENTER:
|
||||
break;
|
||||
|
||||
case GR_TEXT_H_ALIGN_RIGHT:
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
break;
|
||||
}
|
||||
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.x = GetPosition().x + delta.x;
|
||||
|
||||
field.SetPosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_LABEL_BASE::MirrorVertically( int aCenter )
|
||||
{
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
SCH_TEXT::MirrorVertically( aCenter );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.y = GetPosition().y + delta.y;
|
||||
|
||||
field.SetPosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LABEL_BASE::IncrementLabel( int aIncrement )
|
||||
{
|
||||
wxString text = GetText();
|
||||
|
@ -1230,64 +1183,6 @@ void SCH_DIRECTIVE_LABEL::MirrorSpinStyle( bool aLeftRight )
|
|||
}
|
||||
|
||||
|
||||
void SCH_DIRECTIVE_LABEL::MirrorHorizontally( int aCenter )
|
||||
{
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
// The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
|
||||
// vertical shape (like a text reduced to only "I" letter).
|
||||
// So the mirroring is not exactly similar to a SCH_TEXT item
|
||||
// Text is NOT really mirrored; it is moved to a suitable horizontal position
|
||||
SetTextSpinStyle( GetTextSpinStyle().MirrorX() );
|
||||
|
||||
SetTextX( MIRRORVAL( GetTextPos().x, aCenter ) );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
switch( field.GetHorizJustify() )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT:
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
break;
|
||||
|
||||
case GR_TEXT_H_ALIGN_CENTER:
|
||||
break;
|
||||
|
||||
case GR_TEXT_H_ALIGN_RIGHT:
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
break;
|
||||
}
|
||||
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.x = GetPosition().x + delta.x;
|
||||
|
||||
field.SetPosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_DIRECTIVE_LABEL::MirrorVertically( int aCenter )
|
||||
{
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
// The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
|
||||
// vertical shape (like a text reduced to only "I" letter).
|
||||
// So the mirroring is not exactly similar to a SCH_TEXT item
|
||||
// Text is NOT really mirrored; it is moved to a suitable vertical position
|
||||
SetTextSpinStyle( GetTextSpinStyle().MirrorY() );
|
||||
|
||||
SetTextY( MIRRORVAL( GetTextPos().y, aCenter ) );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.y = GetPosition().y + delta.y;
|
||||
|
||||
field.SetPosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_DIRECTIVE_LABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
|
||||
std::vector<VECTOR2I>& aPoints,
|
||||
const VECTOR2I& aPos ) const
|
||||
|
@ -1484,6 +1379,80 @@ void SCH_GLOBALLABEL::SetTextSpinStyle( TEXT_SPIN_STYLE aSpinStyle )
|
|||
}
|
||||
|
||||
|
||||
void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
|
||||
{
|
||||
SCH_TEXT::MirrorSpinStyle( aLeftRight );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
if( ( aLeftRight && field.GetTextAngle().IsHorizontal() )
|
||||
|| ( !aLeftRight && field.GetTextAngle().IsVertical() ) )
|
||||
{
|
||||
if( field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
else
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
}
|
||||
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = (VECTOR2I)GetPosition() - pos;
|
||||
|
||||
if( aLeftRight )
|
||||
pos.x = GetPosition().x + delta.x;
|
||||
else
|
||||
pos.y = GetPosition().y + delta.y;
|
||||
|
||||
field.SetTextPos( pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter )
|
||||
{
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
SCH_TEXT::MirrorHorizontally( aCenter );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
switch( field.GetHorizJustify() )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT:
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
break;
|
||||
|
||||
case GR_TEXT_H_ALIGN_CENTER:
|
||||
break;
|
||||
|
||||
case GR_TEXT_H_ALIGN_RIGHT:
|
||||
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
break;
|
||||
}
|
||||
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.x = GetPosition().x + delta.x;
|
||||
|
||||
field.SetPosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_GLOBALLABEL::MirrorVertically( int aCenter )
|
||||
{
|
||||
VECTOR2I old_pos = GetPosition();
|
||||
SCH_TEXT::MirrorVertically( aCenter );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
VECTOR2I pos = field.GetTextPos();
|
||||
VECTOR2I delta = old_pos - pos;
|
||||
pos.y = GetPosition().y + delta.y;
|
||||
|
||||
field.SetPosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_GLOBALLABEL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
|
||||
int aDepth ) const
|
||||
{
|
||||
|
|
|
@ -118,9 +118,6 @@ public:
|
|||
|
||||
void MirrorSpinStyle( bool aLeftRight ) override;
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
|
||||
void SetPosition( const VECTOR2I& aPosition ) override;
|
||||
|
||||
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
|
||||
|
@ -327,9 +324,6 @@ public:
|
|||
|
||||
void MirrorSpinStyle( bool aLeftRight ) override;
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
|
||||
private:
|
||||
int m_pinLength;
|
||||
int m_symbolSize;
|
||||
|
@ -362,6 +356,11 @@ public:
|
|||
|
||||
int GetMandatoryFieldCount() override { return 1; }
|
||||
|
||||
void MirrorSpinStyle( bool aLeftRight ) override;
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
|
||||
void SetTextSpinStyle( TEXT_SPIN_STYLE aSpinStyle ) override;
|
||||
|
||||
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
|
||||
|
|
Loading…
Reference in New Issue