Symbol Editor do not display bounding box of invisible pins and fields
This commit is contained in:
parent
eddf4883b6
commit
4f4d9be8d1
|
@ -230,20 +230,8 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
|
|||
|
||||
#endif
|
||||
|
||||
if( 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() );
|
||||
}
|
||||
// Enable draw bounding box on request. Some bboxes are handled locally.
|
||||
bool drawBoundingBox = m_schSettings.GetDrawBoundingBoxes();
|
||||
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
|
@ -254,9 +242,11 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
|
|||
draw( static_cast<const LIB_SHAPE*>( aItem ), aLayer, aDimmed );
|
||||
break;
|
||||
case LIB_PIN_T:
|
||||
drawBoundingBox = false;
|
||||
draw( static_cast<const LIB_PIN*>( aItem ), aLayer, aDimmed );
|
||||
break;
|
||||
case LIB_FIELD_T:
|
||||
drawBoundingBox = false;
|
||||
draw( static_cast<const LIB_FIELD*>( aItem ), aLayer, aDimmed );
|
||||
break;
|
||||
case LIB_TEXT_T:
|
||||
|
@ -325,6 +315,25 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
|
|||
|
||||
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() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1118,6 +1127,9 @@ void SCH_PAINTER::draw( const LIB_FIELD* aField, int aLayer, bool aDimmed )
|
|||
m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
|
||||
m_gal->DrawLine( bbox.Centre(), VECTOR2I( 0, 0 ) );
|
||||
}
|
||||
|
||||
if( m_schSettings.GetDrawBoundingBoxes() )
|
||||
drawItemBoundingBox( aField );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1426,6 +1438,9 @@ void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
|
|||
return;
|
||||
}
|
||||
|
||||
if( m_schSettings.GetDrawBoundingBoxes() )
|
||||
drawItemBoundingBox( aPin );
|
||||
|
||||
VECTOR2I p0;
|
||||
VECTOR2I dir;
|
||||
int len = aPin->GetLength();
|
||||
|
@ -2829,14 +2844,7 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer, bool aDimmed )
|
|||
}
|
||||
|
||||
if( m_schSettings.GetDrawBoundingBoxes() )
|
||||
{
|
||||
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() );
|
||||
}
|
||||
drawItemBoundingBox( aField );
|
||||
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -147,6 +147,7 @@ public:
|
|||
void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
|
||||
|
||||
private:
|
||||
void drawItemBoundingBox( const EDA_ITEM* aItem );
|
||||
void draw( const EDA_ITEM*, int, bool aDimmed );
|
||||
void draw( const LIB_PIN* aPin, int aLayer, bool aDimmed );
|
||||
void draw( const LIB_SHAPE* aCircle, int aLayer, bool aDimmed );
|
||||
|
|
Loading…
Reference in New Issue