pcbnew: Draw title block normally even when the view is flipped

This commit is contained in:
Maciej Suminski 2018-10-23 10:41:30 +02:00
parent 6602e17edc
commit cbf7d708b2
2 changed files with 29 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * 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 <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * 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 ); COLOR4D color = settings->GetColor( this, aLayer );
drawList.BuildWorkSheetGraphicList( *m_pageInfo, *m_titleBlock, color, color ); 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 // Draw all the components that make the page layout
WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); WS_DRAW_ITEM_BASE* item = drawList.GetFirst();
while( item ) while( item )
@ -130,6 +140,9 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
// Draw gray line that outlines the sheet size // Draw gray line that outlines the sheet size
if( settings->GetShowPageLimits() ) if( settings->GetShowPageLimits() )
drawBorder( gal ); drawBorder( gal );
if( flipped )
gal->Restore();
} }

View File

@ -771,6 +771,21 @@ public:
globalFlipY = yAxis; 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 // Buffer manipulation methods