Fix pads and footprints rendering switches behavior
Pads and footprints rendering switches in Render tab were working incorrectly, as described in bug report: https://bugs.launchpad.net/kicad/+bug/1743890 This patch fixes it and makes GAL behave as the legacy canvas. Fixes: lp:1743890
This commit is contained in:
parent
b300e8cce5
commit
4c19606eb7
|
@ -49,6 +49,8 @@
|
||||||
#include <class_module.h>
|
#include <class_module.h>
|
||||||
#include <class_edge_mod.h>
|
#include <class_edge_mod.h>
|
||||||
|
|
||||||
|
#include <view/view.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) :
|
EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) :
|
||||||
|
@ -321,6 +323,12 @@ void EDGE_MODULE::Flip( const wxPoint& aCentre )
|
||||||
SetLayer( FlipLayer( GetLayer() ) );
|
SetLayer( FlipLayer( GetLayer() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EDGE_MODULE::IsParentFlipped() const
|
||||||
|
{
|
||||||
|
if( GetParent() && GetParent()->GetLayer() == B_Cu )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void EDGE_MODULE::Mirror( wxPoint aCentre, bool aMirrorAroundXAxis )
|
void EDGE_MODULE::Mirror( wxPoint aCentre, bool aMirrorAroundXAxis )
|
||||||
{
|
{
|
||||||
|
@ -394,3 +402,21 @@ void EDGE_MODULE::Move( const wxPoint& aMoveVector )
|
||||||
|
|
||||||
SetDrawCoord();
|
SetDrawCoord();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int EDGE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
|
{
|
||||||
|
const int HIDE = std::numeric_limits<unsigned int>::max();
|
||||||
|
|
||||||
|
if( !aView )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Handle Render tab switches
|
||||||
|
if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
// Other layers are shown without any conditions
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -88,6 +88,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void Flip( const wxPoint& aCentre ) override;
|
void Flip( const wxPoint& aCentre ) override;
|
||||||
|
|
||||||
|
bool IsParentFlipped() const;
|
||||||
|
|
||||||
void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; }
|
void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; }
|
||||||
const wxPoint& GetStart0() const { return m_Start0; }
|
const wxPoint& GetStart0() const { return m_Start0; }
|
||||||
|
|
||||||
|
@ -126,6 +128,7 @@ public:
|
||||||
|
|
||||||
EDA_ITEM* Clone() const override;
|
EDA_ITEM* Clone() const override;
|
||||||
|
|
||||||
|
virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
|
||||||
|
#include <view/view.h>
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
|
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
|
@ -1274,6 +1275,25 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
|
|
||||||
unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
{
|
{
|
||||||
|
const int HIDE = std::numeric_limits<unsigned int>::max();
|
||||||
|
|
||||||
|
// Handle Render tab switches
|
||||||
|
if( ( GetAttribute() == PAD_ATTRIB_STANDARD || GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||||
|
&& !aView->IsLayerVisible( LAYER_PADS_TH ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
if( !IsFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
if( IsFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
if( IsFrontLayer( ( PCB_LAYER_ID )aLayer ) && !aView->IsLayerVisible( LAYER_PAD_FR ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
if( IsBackLayer( ( PCB_LAYER_ID )aLayer ) && !aView->IsLayerVisible( LAYER_PAD_BK ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
// Netnames will be shown only if zoom is appropriate
|
// Netnames will be shown only if zoom is appropriate
|
||||||
if( IsNetnameLayer( aLayer ) )
|
if( IsNetnameLayer( aLayer ) )
|
||||||
{
|
{
|
||||||
|
@ -1282,7 +1302,7 @@ unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
// Pad sizes can be zero briefly when someone is typing a number like "0.5"
|
// Pad sizes can be zero briefly when someone is typing a number like "0.5"
|
||||||
// in the pad properties dialog
|
// in the pad properties dialog
|
||||||
if( divisor == 0 )
|
if( divisor == 0 )
|
||||||
return UINT_MAX;
|
return HIDE;
|
||||||
|
|
||||||
return ( Millimeter2iu( 100 ) / divisor );
|
return ( Millimeter2iu( 100 ) / divisor );
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,13 @@ void TEXTE_MODULE::Flip( const wxPoint& aCentre )
|
||||||
SetLocalCoord();
|
SetLocalCoord();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TEXTE_MODULE::IsParentFlipped() const
|
||||||
|
{
|
||||||
|
if( GetParent() && GetParent()->GetLayer() == B_Cu )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
|
void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
|
||||||
{
|
{
|
||||||
|
@ -473,27 +480,33 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
|
|
||||||
unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
{
|
{
|
||||||
const int MAX = std::numeric_limits<unsigned int>::max();
|
const int HIDE = std::numeric_limits<unsigned int>::max();
|
||||||
|
|
||||||
if( !aView )
|
if( !aView )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Handle Render tab switches
|
||||||
if( ( m_Type == TEXT_is_VALUE || m_Text == wxT( "%V" ) )
|
if( ( m_Type == TEXT_is_VALUE || m_Text == wxT( "%V" ) )
|
||||||
&& !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
|
&& !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
|
||||||
return MAX;
|
return HIDE;
|
||||||
|
|
||||||
if( ( m_Type == TEXT_is_REFERENCE || m_Text == wxT( "%R" ) )
|
if( ( m_Type == TEXT_is_REFERENCE || m_Text == wxT( "%R" ) )
|
||||||
&& !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
|
&& !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
|
||||||
return MAX;
|
return HIDE;
|
||||||
|
|
||||||
if( IsFrontLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_FR ) ||
|
if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||||
!aView->IsLayerVisible( LAYER_MOD_FR ) ) )
|
return HIDE;
|
||||||
return MAX;
|
|
||||||
|
|
||||||
if( IsBackLayer( m_Layer ) && ( !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) ||
|
if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||||
!aView->IsLayerVisible( LAYER_MOD_BK ) ) )
|
return HIDE;
|
||||||
return MAX;
|
|
||||||
|
|
||||||
|
if( IsFrontLayer( m_Layer ) && !aView->IsLayerVisible( LAYER_MOD_TEXT_FR ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
if( IsBackLayer( m_Layer ) && !aView->IsLayerVisible( LAYER_MOD_TEXT_BK ) )
|
||||||
|
return HIDE;
|
||||||
|
|
||||||
|
// Other layers are shown without any conditions
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,8 @@ public:
|
||||||
/// Flip entity during module flip
|
/// Flip entity during module flip
|
||||||
void Flip( const wxPoint& aCentre ) override;
|
void Flip( const wxPoint& aCentre ) override;
|
||||||
|
|
||||||
|
bool IsParentFlipped() const;
|
||||||
|
|
||||||
/// Mirror text position in footprint edition
|
/// Mirror text position in footprint edition
|
||||||
/// the text itself is not mirrored, and the layer not modified,
|
/// the text itself is not mirrored, and the layer not modified,
|
||||||
/// only position is mirrored.
|
/// only position is mirrored.
|
||||||
|
|
|
@ -446,26 +446,12 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
|
||||||
m_view->SetRequired( LAYER_PADS_NETNAMES, LAYER_PADS_TH );
|
m_view->SetRequired( LAYER_PADS_NETNAMES, LAYER_PADS_TH );
|
||||||
|
|
||||||
// Front modules
|
// Front modules
|
||||||
m_view->SetRequired( LAYER_PAD_FR, LAYER_MOD_FR );
|
|
||||||
m_view->SetRequired( LAYER_MOD_TEXT_FR, LAYER_MOD_FR );
|
m_view->SetRequired( LAYER_MOD_TEXT_FR, LAYER_MOD_FR );
|
||||||
m_view->SetRequired( LAYER_PAD_FR_NETNAMES, LAYER_PAD_FR );
|
m_view->SetRequired( LAYER_PAD_FR_NETNAMES, LAYER_PAD_FR );
|
||||||
m_view->SetRequired( F_Adhes, LAYER_PAD_FR );
|
|
||||||
m_view->SetRequired( F_Paste, LAYER_PAD_FR );
|
|
||||||
m_view->SetRequired( F_Mask, LAYER_PAD_FR );
|
|
||||||
m_view->SetRequired( F_CrtYd, LAYER_MOD_FR );
|
|
||||||
m_view->SetRequired( F_Fab, LAYER_MOD_FR );
|
|
||||||
m_view->SetRequired( F_SilkS, LAYER_MOD_FR );
|
|
||||||
|
|
||||||
// Back modules
|
// Back modules
|
||||||
m_view->SetRequired( LAYER_PAD_BK, LAYER_MOD_BK );
|
|
||||||
m_view->SetRequired( LAYER_MOD_TEXT_BK, LAYER_MOD_BK );
|
m_view->SetRequired( LAYER_MOD_TEXT_BK, LAYER_MOD_BK );
|
||||||
m_view->SetRequired( LAYER_PAD_BK_NETNAMES, LAYER_PAD_BK );
|
m_view->SetRequired( LAYER_PAD_BK_NETNAMES, LAYER_PAD_BK );
|
||||||
m_view->SetRequired( B_Adhes, LAYER_PAD_BK );
|
|
||||||
m_view->SetRequired( B_Paste, LAYER_PAD_BK );
|
|
||||||
m_view->SetRequired( B_Mask, LAYER_PAD_BK );
|
|
||||||
m_view->SetRequired( B_CrtYd, LAYER_MOD_BK );
|
|
||||||
m_view->SetRequired( B_Fab, LAYER_MOD_BK );
|
|
||||||
m_view->SetRequired( B_SilkS, LAYER_MOD_BK );
|
|
||||||
|
|
||||||
m_view->SetLayerTarget( LAYER_GP_OVERLAY , KIGFX::TARGET_OVERLAY );
|
m_view->SetLayerTarget( LAYER_GP_OVERLAY , KIGFX::TARGET_OVERLAY );
|
||||||
m_view->SetLayerDisplayOnly( LAYER_GP_OVERLAY ) ;
|
m_view->SetLayerDisplayOnly( LAYER_GP_OVERLAY ) ;
|
||||||
|
|
Loading…
Reference in New Issue