mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-03-30 06:46:55 +00:00
GAL: ViewGetLOD should not be able to change the VIEW
Make the VIEW* parameter const. Since PCB_TEXT does a null-check, it's not very clear if this can ever be null (and if it is, why don't the other VIEW_ITEMs check?), so don't make them all references too at this time. Also dereference a few pointers a bit earlier to make non-null promises sooner rather than later.
This commit is contained in:
parent
527faddbfd
commit
520a7cf62c
eeschema
gerbview
include/view
pcbnew
@ -195,7 +195,7 @@ std::vector<int> SCH_LINE::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double SCH_LINE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double SCH_LINE::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
if( aLayer == LAYER_OP_VOLTAGES )
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ public:
|
||||
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
|
@ -979,7 +979,7 @@ const BOX2I GERBER_DRAW_ITEM::ViewBBox() const
|
||||
}
|
||||
|
||||
|
||||
double GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double GERBER_DRAW_ITEM::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
// DCodes will be shown only if zoom is appropriate:
|
||||
// Returns the level of detail of the item.
|
||||
|
@ -214,7 +214,7 @@ public:
|
||||
virtual const BOX2I ViewBBox() const override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLOD()
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
///< @copydoc EDA_ITEM::Visit()
|
||||
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
* @return the level of detail. 0 always shows the item, because the actual zoom level
|
||||
* (or VIEW scale) is always > 0
|
||||
*/
|
||||
virtual double ViewGetLOD( int aLayer, VIEW* aView ) const
|
||||
virtual double ViewGetLOD( int aLayer, const VIEW* aView ) const
|
||||
{
|
||||
// By default always show the item
|
||||
return LOD_SHOW;
|
||||
|
@ -2257,7 +2257,7 @@ std::vector<int> FOOTPRINT::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double FOOTPRINT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double FOOTPRINT::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
{
|
||||
|
@ -909,7 +909,7 @@ public:
|
||||
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
virtual const BOX2I ViewBBox() const override;
|
||||
|
||||
|
@ -1724,10 +1724,10 @@ std::vector<int> PAD::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PAD::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
|
||||
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
PCB_PAINTER& painter = static_cast<PCB_PAINTER&>( *aView->GetPainter() );
|
||||
PCB_RENDER_SETTINGS& renderSettings = *painter.GetSettings();
|
||||
const BOARD* board = GetBoard();
|
||||
|
||||
// Meta control for hiding all pads
|
||||
@ -1752,10 +1752,10 @@ double PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
}
|
||||
else if( IsNetnameLayer( aLayer ) )
|
||||
{
|
||||
if( renderSettings->GetHighContrast() )
|
||||
if( renderSettings.GetHighContrast() )
|
||||
{
|
||||
// Hide netnames unless pad is flashed to a high-contrast layer
|
||||
if( !FlashLayer( renderSettings->GetPrimaryHighContrastLayer() ) )
|
||||
if( !FlashLayer( renderSettings.GetPrimaryHighContrastLayer() ) )
|
||||
return LOD_HIDE;
|
||||
}
|
||||
else
|
||||
|
@ -872,7 +872,7 @@ public:
|
||||
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
virtual const BOX2I ViewBBox() const override;
|
||||
|
||||
|
@ -167,7 +167,7 @@ wxString PCB_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFu
|
||||
}
|
||||
|
||||
|
||||
double PCB_FIELD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_FIELD::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
if( !aView )
|
||||
return LOD_SHOW;
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
@ -335,7 +335,7 @@ std::vector<int> PCB_GROUP::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double PCB_GROUP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_GROUP::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
if( aView->IsLayerVisible( LAYER_ANCHOR ) )
|
||||
return LOD_SHOW;
|
||||
|
@ -175,7 +175,7 @@ public:
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLOD
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
/// @copydoc BOARD_ITEM::Move
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
|
@ -104,7 +104,7 @@ void PCB_REFERENCE_IMAGE::swapData( BOARD_ITEM* aItem )
|
||||
}
|
||||
|
||||
|
||||
double PCB_REFERENCE_IMAGE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_REFERENCE_IMAGE::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
|
||||
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
wxString GetClass() const override { return wxT( "PCB_REFERENCE_IMAGE" ); }
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
|
@ -569,10 +569,10 @@ void PCB_SHAPE::SetIsProxyItem( bool aIsProxy )
|
||||
}
|
||||
|
||||
|
||||
double PCB_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_SHAPE::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( aView->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
KIGFX::PCB_PAINTER& painter = static_cast<KIGFX::PCB_PAINTER&>( *aView->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS& renderSettings = *painter.GetSettings();
|
||||
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
{
|
||||
@ -581,9 +581,9 @@ double PCB_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
return LOD_HIDE;
|
||||
|
||||
// Hide shadow on dimmed tracks
|
||||
if( renderSettings->GetHighContrast() )
|
||||
if( renderSettings.GetHighContrast() )
|
||||
{
|
||||
if( m_layer != renderSettings->GetPrimaryHighContrastLayer() )
|
||||
if( m_layer != renderSettings.GetPrimaryHighContrastLayer() )
|
||||
return LOD_HIDE;
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public:
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
///< @copydoc VIEW_ITEM::ViewGetLOD
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
double Similarity( const BOARD_ITEM& aBoardItem ) const override;
|
||||
|
||||
|
@ -209,13 +209,13 @@ std::vector<int> PCB_TEXT::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double PCB_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_TEXT::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
if( !aView )
|
||||
return LOD_SHOW;
|
||||
|
||||
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( aView->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
KIGFX::PCB_PAINTER& painter = static_cast<KIGFX::PCB_PAINTER&>( *aView->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS& renderSettings = *painter.GetSettings();
|
||||
|
||||
if( !aView->IsLayerVisible( GetLayer() ) )
|
||||
return LOD_HIDE;
|
||||
@ -223,9 +223,9 @@ double PCB_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
{
|
||||
// Hide shadow on dimmed tracks
|
||||
if( renderSettings->GetHighContrast() )
|
||||
if( renderSettings.GetHighContrast() )
|
||||
{
|
||||
if( m_layer != renderSettings->GetPrimaryHighContrastLayer() )
|
||||
if( m_layer != renderSettings.GetPrimaryHighContrastLayer() )
|
||||
return LOD_HIDE;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public:
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
///< @copydoc VIEW_ITEM::ViewGetLOD
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
// Virtual function
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
@ -393,10 +393,10 @@ VECTOR2I PCB_TEXTBOX::GetDrawPos( bool aIsFlipped ) const
|
||||
}
|
||||
|
||||
|
||||
double PCB_TEXTBOX::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_TEXTBOX::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( aView->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
KIGFX::PCB_PAINTER& painter = static_cast<KIGFX::PCB_PAINTER&>( *aView->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS& renderSettings = *painter.GetSettings();
|
||||
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
{
|
||||
@ -405,9 +405,9 @@ double PCB_TEXTBOX::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
return LOD_HIDE;
|
||||
|
||||
// Hide shadow on dimmed tracks
|
||||
if( renderSettings->GetHighContrast() )
|
||||
if( renderSettings.GetHighContrast() )
|
||||
{
|
||||
if( m_layer != renderSettings->GetPrimaryHighContrastLayer() )
|
||||
if( m_layer != renderSettings.GetPrimaryHighContrastLayer() )
|
||||
return LOD_HIDE;
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public:
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
|
@ -1350,7 +1350,7 @@ std::vector<int> PCB_TRACK::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double PCB_TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_TRACK::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
|
||||
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
@ -1467,7 +1467,7 @@ std::vector<int> PCB_VIA::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double PCB_VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double PCB_VIA::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
PCB_PAINTER* painter = static_cast<PCB_PAINTER*>( aView->GetPainter() );
|
||||
PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
|
@ -227,7 +227,7 @@ public:
|
||||
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
@ -511,7 +511,7 @@ public:
|
||||
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
|
||||
|
||||
|
@ -536,7 +536,7 @@ std::vector<int> ZONE::ViewGetLayers() const
|
||||
}
|
||||
|
||||
|
||||
double ZONE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double ZONE::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
|
||||
{
|
||||
if( !aView )
|
||||
return LOD_SHOW;
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
|
||||
|
||||
void SetFillMode( ZONE_FILL_MODE aFillMode ) { m_fillMode = aFillMode; }
|
||||
ZONE_FILL_MODE GetFillMode() const { return m_fillMode; }
|
||||
|
Loading…
Reference in New Issue
Block a user