Flip anything on a side-specific layer, rather than physical layer.

Fixes https://gitlab.com/kicad/code/kicad/issues/12726
This commit is contained in:
Jeff Young
2022-10-24 16:54:33 +01:00
parent 0e758d6bc2
commit 4778122aa0
8 changed files with 30 additions and 13 deletions
+6
View File
@@ -905,6 +905,12 @@ LSET LSET::BackMask()
return saved;
}
LSET LSET::FrontBackMask()
{
static const LSET saved = ( BackTechMask() | FrontTechMask() ).set( F_Cu ).set( B_Cu );
return saved;
}
LSET LSET::ForbiddenFootprintLayers()
{
+3 -3
View File
@@ -689,6 +689,8 @@ public:
*/
static LSET BackMask();
static LSET FrontBackMask();
static LSET UserMask();
/**
@@ -930,10 +932,8 @@ inline bool IsBackLayer( PCB_LAYER_ID aLayerId )
case B_Fab:
return true;
default:
;
return false;
}
return false;
}
+4 -1
View File
@@ -149,7 +149,10 @@ void FP_TEXT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
}
SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
SetMirrored( IsBackLayer( GetLayer() ) );
if( ( GetLayerSet() & LSET::FrontBackMask() ).any() )
SetMirrored( !IsMirrored() );
SetLocalCoord();
}
+4 -1
View File
@@ -278,7 +278,10 @@ void FP_TEXTBOX::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
}
SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
SetMirrored( IsBackLayer( GetLayer() ) );
if( ( GetLayerSet() & LSET::FrontBackMask() ).any() )
SetMirrored( !IsMirrored() );
SetLocalCoord();
}
+2 -1
View File
@@ -278,7 +278,8 @@ void PCB_DIMENSION_BASE::Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight
INVERT( m_end.y );
}
m_text.SetMirrored( !m_text.IsMirrored() );
if( ( GetLayerSet() & LSET::FrontBackMask() ).any() )
m_text.SetMirrored( !m_text.IsMirrored() );
Update();
}
+5 -5
View File
@@ -1904,7 +1904,7 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
else
attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() );
if( m_gal->IsFlippedX() && !( aText->GetLayerSet() & LSET::PhysicalLayersMask() ).any() )
if( m_gal->IsFlippedX() && !( aText->GetLayerSet() & LSET::FrontBackMask() ).any() )
{
attrs.m_Mirrored = !attrs.m_Mirrored;
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
@@ -1994,7 +1994,7 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
attrs.m_StrokeWidth = getLineThickness( aTextBox->GetEffectiveTextPenWidth() );
if( m_gal->IsFlippedX() && !( aTextBox->GetLayerSet() & LSET::PhysicalLayersMask() ).any() )
if( m_gal->IsFlippedX() && !( aTextBox->GetLayerSet() & LSET::FrontBackMask() ).any() )
{
attrs.m_Mirrored = !attrs.m_Mirrored;
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
@@ -2081,7 +2081,7 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
else
attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() );
if( m_gal->IsFlippedX() && !( aText->GetLayerSet() & LSET::PhysicalLayersMask() ).any() )
if( m_gal->IsFlippedX() && !( aText->GetLayerSet() & LSET::FrontBackMask() ).any() )
{
attrs.m_Mirrored = !attrs.m_Mirrored;
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
@@ -2155,7 +2155,7 @@ void PCB_PAINTER::draw( const FP_TEXTBOX* aTextBox, int aLayer )
attrs.m_Angle = aTextBox->GetDrawRotation();
attrs.m_StrokeWidth = getLineThickness( aTextBox->GetEffectiveTextPenWidth() );
if( m_gal->IsFlippedX() && !( aTextBox->GetLayerSet() & LSET::PhysicalLayersMask() ).any() )
if( m_gal->IsFlippedX() && !( aTextBox->GetLayerSet() & LSET::FrontBackMask() ).any() )
{
attrs.m_Mirrored = !attrs.m_Mirrored;
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
@@ -2446,7 +2446,7 @@ void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer )
wxString resolvedText = text.GetShownText();
TEXT_ATTRIBUTES attrs = text.GetAttributes();
if( m_gal->IsFlippedX() && !( aDimension->GetLayerSet() & LSET::PhysicalLayersMask() ).any() )
if( m_gal->IsFlippedX() && !( aDimension->GetLayerSet() & LSET::FrontBackMask() ).any() )
attrs.m_Mirrored = !attrs.m_Mirrored;
if( outline_mode )
+3 -1
View File
@@ -246,7 +246,9 @@ void PCB_TEXT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
}
SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
SetMirrored( !IsMirrored() );
if( ( GetLayerSet() & LSET::FrontBackMask() ).any() )
SetMirrored( !IsMirrored() );
}
+3 -1
View File
@@ -383,7 +383,9 @@ void PCB_TEXTBOX::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
}
SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
SetMirrored( !IsMirrored() );
if( ( GetLayerSet() & LSET::FrontBackMask() ).any() )
SetMirrored( !IsMirrored() );
}