From cbf7d708b28d0b07fb6a42b74f613f74da815508 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 23 Oct 2018 10:41:30 +0200 Subject: [PATCH] pcbnew: Draw title block normally even when the view is flipped --- common/worksheet_viewitem.cpp | 15 ++++++++++++++- include/gal/graphics_abstraction_layer.h | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/common/worksheet_viewitem.cpp b/common/worksheet_viewitem.cpp index c1e3d9426f..97a1fd6e55 100644 --- a/common/worksheet_viewitem.cpp +++ b/common/worksheet_viewitem.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2013 CERN + * Copyright (C) 2013-2018 CERN * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -97,6 +97,16 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const COLOR4D color = settings->GetColor( this, aLayer ); drawList.BuildWorkSheetGraphicList( *m_pageInfo, *m_titleBlock, color, color ); + // Draw the title block normally even if the view is flipped + bool flipped = gal->IsFlippedX(); + + if( flipped ) + { + gal->Save(); + gal->Translate( VECTOR2D( m_pageInfo->GetWidthMils() * m_mils2IUscalefactor, 0 ) ); + gal->Scale( VECTOR2D( -1.0, 1.0 ) ); + } + // Draw all the components that make the page layout WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); while( item ) @@ -130,6 +140,9 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const // Draw gray line that outlines the sheet size if( settings->GetShowPageLimits() ) drawBorder( gal ); + + if( flipped ) + gal->Restore(); } diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index a033846d17..112f353816 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -771,6 +771,21 @@ public: globalFlipY = yAxis; } + /** + * Return true if flip flag for the X axis is set. + */ + bool IsFlippedX() const + { + return globalFlipX; + } + + /** + * Return true if flip flag for the Y axis is set. + */ + bool IsFlippedY() const + { + return globalFlipY; + } // --------------------------- // Buffer manipulation methods