Symbol Editor do not display bounding box of invisible pins and fields
This commit is contained in:
parent
6ebccdecc6
commit
3d04d78f76
|
@ -229,20 +229,8 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_schSettings.GetDrawBoundingBoxes() )
|
// Enable draw bounding box on request. Some bboxes are handled locally.
|
||||||
{
|
bool drawBoundingBox = m_schSettings.GetDrawBoundingBoxes();
|
||||||
BOX2I box = aItem->GetBoundingBox();
|
|
||||||
|
|
||||||
if( aItem->Type() == SCH_SYMBOL_T )
|
|
||||||
box = static_cast<const SCH_SYMBOL*>( aItem )->GetBodyBoundingBox();
|
|
||||||
|
|
||||||
m_gal->SetIsFill( false );
|
|
||||||
m_gal->SetIsStroke( true );
|
|
||||||
m_gal->SetStrokeColor( aItem->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 )
|
|
||||||
: COLOR4D( 0.2, 0.2, 0.2, 1 ) );
|
|
||||||
m_gal->SetLineWidth( schIUScale.MilsToIU( 3 ) );
|
|
||||||
m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( aItem->Type() )
|
switch( aItem->Type() )
|
||||||
{
|
{
|
||||||
|
@ -253,9 +241,11 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
|
||||||
draw( static_cast<const LIB_SHAPE*>( aItem ), aLayer, aDimmed );
|
draw( static_cast<const LIB_SHAPE*>( aItem ), aLayer, aDimmed );
|
||||||
break;
|
break;
|
||||||
case LIB_PIN_T:
|
case LIB_PIN_T:
|
||||||
|
drawBoundingBox = false;
|
||||||
draw( static_cast<const LIB_PIN*>( aItem ), aLayer, aDimmed );
|
draw( static_cast<const LIB_PIN*>( aItem ), aLayer, aDimmed );
|
||||||
break;
|
break;
|
||||||
case LIB_FIELD_T:
|
case LIB_FIELD_T:
|
||||||
|
drawBoundingBox = false;
|
||||||
draw( static_cast<const LIB_FIELD*>( aItem ), aLayer, aDimmed );
|
draw( static_cast<const LIB_FIELD*>( aItem ), aLayer, aDimmed );
|
||||||
break;
|
break;
|
||||||
case LIB_TEXT_T:
|
case LIB_TEXT_T:
|
||||||
|
@ -321,6 +311,25 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
|
||||||
|
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( drawBoundingBox )
|
||||||
|
drawItemBoundingBox( aItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_PAINTER::drawItemBoundingBox( const EDA_ITEM* aItem )
|
||||||
|
{
|
||||||
|
BOX2I box = aItem->GetBoundingBox();
|
||||||
|
|
||||||
|
if( aItem->Type() == SCH_SYMBOL_T )
|
||||||
|
box = static_cast<const SCH_SYMBOL*>( aItem )->GetBodyBoundingBox();
|
||||||
|
|
||||||
|
m_gal->SetIsFill( false );
|
||||||
|
m_gal->SetIsStroke( true );
|
||||||
|
m_gal->SetStrokeColor( aItem->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 )
|
||||||
|
: COLOR4D( 0.2, 0.2, 0.2, 1 ) );
|
||||||
|
m_gal->SetLineWidth( schIUScale.MilsToIU( 3 ) );
|
||||||
|
m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1111,6 +1120,9 @@ void SCH_PAINTER::draw( const LIB_FIELD* aField, int aLayer, bool aDimmed )
|
||||||
m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
|
m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
|
||||||
m_gal->DrawLine( bbox.Centre(), VECTOR2I( 0, 0 ) );
|
m_gal->DrawLine( bbox.Centre(), VECTOR2I( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_schSettings.GetDrawBoundingBoxes() )
|
||||||
|
drawItemBoundingBox( aField );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1401,6 +1413,9 @@ void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_schSettings.GetDrawBoundingBoxes() )
|
||||||
|
drawItemBoundingBox( aPin );
|
||||||
|
|
||||||
VECTOR2I p0;
|
VECTOR2I p0;
|
||||||
VECTOR2I dir;
|
VECTOR2I dir;
|
||||||
int len = aPin->GetLength();
|
int len = aPin->GetLength();
|
||||||
|
@ -2666,14 +2681,7 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer, bool aDimmed )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_schSettings.GetDrawBoundingBoxes() )
|
if( m_schSettings.GetDrawBoundingBoxes() )
|
||||||
{
|
drawItemBoundingBox( aField );
|
||||||
m_gal->SetIsFill( false );
|
|
||||||
m_gal->SetIsStroke( true );
|
|
||||||
m_gal->SetStrokeColor( aField->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 )
|
|
||||||
: COLOR4D( 0.2, 0.2, 0.2, 1 ) );
|
|
||||||
m_gal->SetLineWidth( schIUScale.MilsToIU( 3 ) );
|
|
||||||
m_gal->DrawRectangle( bbox.GetOrigin(), bbox.GetEnd() );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_gal->SetStrokeColor( color );
|
m_gal->SetStrokeColor( color );
|
||||||
m_gal->SetFillColor( color );
|
m_gal->SetFillColor( color );
|
||||||
|
|
|
@ -2,7 +2,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) 2019-2020 CERN
|
* Copyright (C) 2019-2020 CERN
|
||||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -146,6 +146,7 @@ public:
|
||||||
void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
|
void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void drawItemBoundingBox( const EDA_ITEM* aItem );
|
||||||
void draw( const EDA_ITEM*, int, bool aDimmed );
|
void draw( const EDA_ITEM*, int, bool aDimmed );
|
||||||
void draw( const LIB_PIN* aPin, int aLayer, bool aDimmed );
|
void draw( const LIB_PIN* aPin, int aLayer, bool aDimmed );
|
||||||
void draw( const LIB_SHAPE* aCircle, int aLayer, bool aDimmed );
|
void draw( const LIB_SHAPE* aCircle, int aLayer, bool aDimmed );
|
||||||
|
|
Loading…
Reference in New Issue