Skip to content
Snippets Groups Projects
Commit 6f5cb1f9 authored by Jeff Young's avatar Jeff Young :flag_ua:
Browse files

Fix printing of hidden refs and/or values.

IsLayerVisible() is patched to always return true when printing
(even when "print according to appearance settings" is checked, and
that's too risky to change at this point.  So we also look to see
if the layer colour is set to the background colour.

Fixes #8548
parent 5a325c59
No related branches found
No related tags found
Loading
Pipeline #314607091 failed
......@@ -32,6 +32,7 @@
#include <settings/settings_manager.h>
#include <trigo.h>
#include <kicad_string.h>
#include <painter.h>
FP_TEXT::FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type ) :
BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ),
......@@ -360,6 +361,8 @@ void FP_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
constexpr double HIDE = (double)std::numeric_limits<double>::max();
RENDER_SETTINGS* renderSettings = aView->GetPainter()->GetSettings();
COLOR4D backgroundColor = renderSettings->GetLayerColor( LAYER_PCB_BACKGROUND );
if( !aView )
return 0.0;
......@@ -370,13 +373,23 @@ double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
return HIDE;
// Handle Render tab switches
if( ( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) )
&& !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
return HIDE;
if( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) )
{
if( !aView->IsLayerVisible( LAYER_MOD_VALUES )
|| renderSettings->GetLayerColor( LAYER_MOD_VALUES ) == backgroundColor )
{
return HIDE;
}
}
if( ( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) )
&& !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
return HIDE;
if( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) )
{
if( !aView->IsLayerVisible( LAYER_MOD_REFERENCES )
|| renderSettings->GetLayerColor( LAYER_MOD_REFERENCES ) == backgroundColor )
{
return HIDE;
}
}
if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
return HIDE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment