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 https://gitlab.com/kicad/code/kicad/issues/8548
This commit is contained in:
parent
5a325c59db
commit
6f5cb1f97d
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue