From fe32315efb508c3957a8ba96a59504fa4111c76c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 1 Oct 2025 20:49:49 +0100 Subject: [PATCH] Implement flipping for barcodes. --- pcbnew/pcb_barcode.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pcbnew/pcb_barcode.cpp b/pcbnew/pcb_barcode.cpp index 02aa6a4c01..c2dec351f8 100644 --- a/pcbnew/pcb_barcode.cpp +++ b/pcbnew/pcb_barcode.cpp @@ -104,6 +104,8 @@ void PCB_BARCODE::SetLayer( PCB_LAYER_ID aLayer ) { m_layer = aLayer; m_text.SetLayer( aLayer ); + + AssembleBarcode( true, true ); } @@ -140,10 +142,16 @@ void PCB_BARCODE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) } -void PCB_BARCODE::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipLeftRight ) +void PCB_BARCODE::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) { - BOARD* board = GetBoard(); - SetLayer( FlipLayer( GetLayer(), board ? board->GetCopperLayerCount() : 0 ) ); + MIRROR( m_pos, aCentre, aFlipDirection ); + + if( aFlipDirection == FLIP_DIRECTION::TOP_BOTTOM ) + m_angle += ANGLE_180; + + SetLayer( GetBoard()->FlipLayer( GetLayer() ) ); + + AssembleBarcode( true, true ); } @@ -196,6 +204,9 @@ void PCB_BARCODE::AssembleBarcode( bool aRebuildBarcode, bool aRebuildText ) m_poly = std::move( ko ); } + if( IsSideSpecific() && GetBoard() && GetBoard()->IsBackLayer( m_layer ) ) + m_poly.Mirror( m_pos, FLIP_DIRECTION::LEFT_RIGHT ); + if( !m_angle.IsZero() ) m_poly.Rotate( m_angle, m_pos );