feature removal: remove Show Hidden Text

Does not work properly since 8.0 introduction of footprint fields.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18656
This commit is contained in:
Mike Williams 2024-09-11 09:53:26 -04:00
parent 32f84da9a2
commit 867cb58175
50 changed files with 79 additions and 146 deletions

View File

@ -347,7 +347,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
BOX2I bbbox;
if( m_board )
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline, false );
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline );
// Gives a non null size to avoid issues in zoom / scale calculations
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )

View File

@ -168,7 +168,6 @@ wxString LayerName( int aLayer )
case LAYER_FP_VALUES: return _( "Values" );
case LAYER_FP_REFERENCES: return _( "Reference designators" );
case LAYER_FP_TEXT: return _( "Footprint text" );
case LAYER_HIDDEN_TEXT: return _( "Hidden text" );
case LAYER_PADS_SMD_FR: return _( "SMD pads front" );
case LAYER_PADS_SMD_BK: return _( "SMD pads back" );
case LAYER_PADS_TH: return _( "Through-hole pads" );

View File

@ -840,7 +840,7 @@ GAL_SET GAL_SET::DefaultVisible()
LAYER_VIA_MICROVIA,
LAYER_VIA_BBLIND,
LAYER_VIA_THROUGH,
// LAYER_HIDDEN_TEXT, // Invisible text hidden by default
// LAYER_HIDDEN_TEXT, // DEPCREATED SINCE 9.0. Invisible text hidden by default
LAYER_ANCHOR,
LAYER_PADS_SMD_FR,
LAYER_PADS_SMD_BK,

View File

@ -161,7 +161,6 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ LAYER_DRC_ERROR, CSS_COLOR( 215, 91, 107, 0.8 ) },
{ LAYER_DRC_WARNING, CSS_COLOR( 255, 208, 66, 0.8 ) },
{ LAYER_DRC_EXCLUSION, CSS_COLOR( 255, 255, 255, 0.8 ) },
{ LAYER_HIDDEN_TEXT, CSS_COLOR( 132, 132, 132, 1 ) },
{ LAYER_GRID, CSS_COLOR( 132, 132, 132, 1 ) },
{ LAYER_GRID_AXES, CSS_COLOR( 194, 194, 194, 1 ) },
{ LAYER_PAD_PLATEDHOLES, CSS_COLOR( 194, 194, 0, 1 ) },
@ -383,7 +382,6 @@ static const std::map<int, COLOR4D> s_classicTheme =
{ LAYER_DRC_ERROR, COLOR4D( PURERED ).WithAlpha( 0.8 ) },
{ LAYER_DRC_WARNING, COLOR4D( PUREGREEN ).WithAlpha( 0.8 ) },
{ LAYER_DRC_EXCLUSION, COLOR4D( WHITE ) },
{ LAYER_HIDDEN_TEXT, COLOR4D( LIGHTGRAY ) },
{ LAYER_GRID, COLOR4D( DARKGRAY ) },
{ LAYER_GRID_AXES, COLOR4D( BLUE ) },
{ LAYER_PAD_PLATEDHOLES, COLOR4D( YELLOW ) },

View File

@ -123,7 +123,6 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "board.drc_error", LAYER_DRC_ERROR );
CLR( "board.drc_warning", LAYER_DRC_WARNING );
CLR( "board.drc_exclusion", LAYER_DRC_EXCLUSION );
CLR( "board.footprint_text_invisible", LAYER_HIDDEN_TEXT );
CLR( "board.grid", LAYER_GRID );
CLR( "board.grid_axes", LAYER_GRID_AXES );
CLR( "board.pad_plated_hole", LAYER_PAD_PLATEDHOLES );

View File

@ -131,7 +131,7 @@ VECTOR2I SELECTION::GetCenter() const
}
BOX2I SELECTION::GetBoundingBox( bool aOnlyVisible ) const
BOX2I SELECTION::GetBoundingBox() const
{
BOX2I bbox;

View File

@ -82,7 +82,7 @@ EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
}
BOX2I EE_SELECTION::GetBoundingBox( bool aOnlyVisible ) const
BOX2I EE_SELECTION::GetBoundingBox() const
{
BOX2I bbox;

View File

@ -46,7 +46,7 @@ public:
EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const override;
BOX2I GetBoundingBox( bool aOnlyVisible = false ) const override;
BOX2I GetBoundingBox() const override;
void SetScreen( SCH_SCREEN* aScreen ) { m_screen = aScreen; }
SCH_SCREEN* GetScreen() { return m_screen; }

View File

@ -199,7 +199,7 @@ enum GAL_LAYER_ID: int
LAYER_NON_PLATEDHOLES = GAL_LAYER_ID_START + 4, ///< handle color for not plated holes (holes, not pads)
LAYER_FP_TEXT = GAL_LAYER_ID_START + 5,
// LAYER_MOD_TEXT_BK deprecated + 6,
LAYER_HIDDEN_TEXT = GAL_LAYER_ID_START + 7, ///< text marked as invisible
// LAYER_HIDDEN_TEXT = GAL_LAYER_ID_START + 7, ///< DEPRECATED, UNUSED SINCE 9.0. text marked as invisible
LAYER_ANCHOR = GAL_LAYER_ID_START + 8, ///< anchor of items having an anchor point (texts, footprints)
LAYER_PADS_SMD_FR = GAL_LAYER_ID_START + 9, ///< smd pads, front layer
LAYER_PADS_SMD_BK = GAL_LAYER_ID_START + 10, ///< smd pads, back layer

View File

@ -154,7 +154,7 @@ public:
return GetBoundingBox().GetPosition();
}
virtual BOX2I GetBoundingBox( bool aOnlyVisible = false ) const;
virtual BOX2I GetBoundingBox() const;
virtual EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const
{

View File

@ -511,7 +511,7 @@ int AR_AUTOPLACER::testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSid
side = AR_SIDE_BOTTOM; otherside = AR_SIDE_TOP;
}
BOX2I fpBBox = aFootprint->GetBoundingBox( false, false );
BOX2I fpBBox = aFootprint->GetBoundingBox( false );
fpBBox.Move( -1*aOffset );
buildFpAreas( aFootprint, 0 );
@ -548,7 +548,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
lastPosOK = m_matrix.m_BrdBox.GetOrigin();
VECTOR2I fpPos = aFootprint->GetPosition();
BOX2I fpBBox = aFootprint->GetBoundingBox( false, false );
BOX2I fpBBox = aFootprint->GetBoundingBox( false );
// Move fpBBox to have the footprint position at (0,0)
fpBBox.Move( -fpPos );

View File

@ -137,7 +137,7 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, VECTOR2I aTargetBox
wxString path =
aGroupBySheet ? footprint->GetPath().AsString().BeforeLast( '/' ) : wxString( wxS( "" ) );
VECTOR2I size = footprint->GetBoundingBox( false, false ).GetSize();
VECTOR2I size = footprint->GetBoundingBox( false ).GetSize();
size.x += aComponentGap;
size.y += aComponentGap;
@ -212,10 +212,10 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, VECTOR2I aTargetBox
position.y += fpSize.y * ( i / optimalCountPerLine );
}
BOX2I old_fp_bbox = footprint->GetBoundingBox( false, false );
BOX2I old_fp_bbox = footprint->GetBoundingBox( false );
footprint->Move( position - old_fp_bbox.GetOrigin() );
BOX2I new_fp_bbox = footprint->GetBoundingBox( false, false );
BOX2I new_fp_bbox = footprint->GetBoundingBox( false );
new_fp_bbox.Inflate( aComponentGap / 2 );
block_bbox.Merge( new_fp_bbox );
}
@ -262,7 +262,7 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, VECTOR2I aTargetBox
for( FOOTPRINT* footprint : footprints )
{
footprint->Move( target_pos - src_bbox.GetPosition() );
sheet_bbox.Merge( footprint->GetBoundingBox( false, false ) );
sheet_bbox.Merge( footprint->GetBoundingBox( false ) );
}
block_i++;

View File

@ -1652,7 +1652,7 @@ unsigned BOARD::GetNodesCount( int aNet ) const
}
BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly, bool aIncludeHiddenText ) const
BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
{
BOX2I bbox;
LSET visible = GetVisibleLayers();
@ -1688,7 +1688,7 @@ BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly, bool aIncludeHiddenText )
}
else if( ( footprint->GetLayerSet() & visible ).any() )
{
bbox.Merge( footprint->GetBoundingBox( true, aIncludeHiddenText ) );
bbox.Merge( footprint->GetBoundingBox( true ) );
}
}
@ -2390,7 +2390,7 @@ FOOTPRINT* BOARD::GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveL
// Filter non visible footprints if requested
if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
{
BOX2I bb = candidate->GetBoundingBox( false, false );
BOX2I bb = candidate->GetBoundingBox( false );
int offx = bb.GetX() + bb.GetWidth() / 2;
int offy = bb.GetY() + bb.GetHeight() / 2;

View File

@ -903,11 +903,11 @@ public:
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
* @return the board's bounding box.
*/
BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false, bool aIncludeHiddenText = false ) const;
BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
const BOX2I GetBoundingBox() const override
{
return ComputeBoundingBox( false, IsElementVisible( LAYER_HIDDEN_TEXT ) );
return ComputeBoundingBox( false );
}
/**
@ -921,7 +921,7 @@ public:
*/
const BOX2I GetBoardEdgesBoundingBox() const
{
return ComputeBoundingBox( true, false );
return ComputeBoundingBox( true );
}
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;

View File

@ -236,11 +236,8 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
{
PCB_LAYER_ID layer = text->GetLayer();
if( m_Guide->IgnoreHiddenFPText() )
{
if( !text->IsVisible() )
return INSPECT_RESULT::CONTINUE;
}
if( !text->IsVisible() )
return INSPECT_RESULT::CONTINUE;
if( m_Guide->IgnoreFPTextOnBack() && IsBackLayer( layer ) )
return INSPECT_RESULT::CONTINUE;

View File

@ -77,11 +77,6 @@ public:
*/
virtual bool IncludeSecondary() const = 0;
/**
* @return true if footprint texts marked as "no show" should be ignored.
*/
virtual bool IgnoreHiddenFPText() const = 0;
/**
* @return true if should ignore footprint text on back layers
*/
@ -347,7 +342,6 @@ public:
m_includeSecondary = true;
#endif
m_ignoreHiddenFPText = true; // g_ModuleTextNOVColor;
m_ignoreFPTextOnBack = true;
m_ignoreFPTextOnFront = false;
m_ignoreFootprintsOnBack = true; // !Show_footprints_Cmp;
@ -403,12 +397,6 @@ public:
bool IncludeSecondary() const override { return m_includeSecondary; }
void SetIncludeSecondary( bool include ) { m_includeSecondary = include; }
/**
* @return true if Fooptrint Text marked as "no show" should be ignored.
*/
bool IgnoreHiddenFPText() const override { return m_ignoreHiddenFPText; }
void SetIgnoreHiddenFPText( bool ignore ) { m_ignoreHiddenFPText = ignore; }
/**
* @return true if should ignore Footprint Text on back layers
*/
@ -494,7 +482,6 @@ private:
bool m_ignoreLockedItems;
bool m_includeSecondary;
bool m_ignoreHiddenFPText;
bool m_ignoreFPTextOnBack;
bool m_ignoreFPTextOnFront;
bool m_ignoreFootprintsOnBack;

View File

@ -811,7 +811,7 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE
// If null area, uses the global bounding box.
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
bbbox = aBoard->ComputeBoundingBox( false, false );
bbbox = aBoard->ComputeBoundingBox( false );
// Ensure non null area. If happen, gives a minimal size.
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
@ -871,7 +871,7 @@ void buildBoardBoundingBoxPoly( const BOARD* aBoard, SHAPE_POLY_SET& aOutline )
// If null area, uses the global bounding box.
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
bbbox = aBoard->ComputeBoundingBox( false, false );
bbbox = aBoard->ComputeBoundingBox( false );
// Ensure non null area. If happen, gives a minimal size.
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )

View File

@ -189,7 +189,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( footprint )
{
bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc
bbox = footprint->GetBoundingBox( true );
if( pad )
m_toolManager->RunAction<BOARD_ITEM*>( PCB_ACTIONS::highlightItem, pad );

View File

@ -650,7 +650,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
case STEP_ORIGIN_BOARD_CENTER:
{
BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true, false );
BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true );
double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
double yOrg = pcbIUScale.IUTomm( bbox.GetCenter().y );
LOCALE_IO dummy;
@ -691,4 +691,4 @@ double DIALOG_EXPORT_STEP::GetXOrg() const
double DIALOG_EXPORT_STEP::GetYOrg()
{
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_STEP_Yorg->GetValue() );
}
}

View File

@ -189,7 +189,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
{
// Origin = board center:
BOARD* pcb = GetBoard();
BOX2I bbox = pcb->ComputeBoundingBox( true, false );
BOX2I bbox = pcb->ComputeBoundingBox( true );
aXRef = pcbIUScale.IUTomm( bbox.GetCenter().x );
aYRef = pcbIUScale.IUTomm( bbox.GetCenter().y );
}
@ -227,4 +227,4 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
DisplayErrorMessage( this, msg );
return;
}
}
}

View File

@ -39,7 +39,7 @@ void DRC_INTERACTIVE_COURTYARD_CLEARANCE::testCourtyardClearances()
{
FOOTPRINT* fpB = m_FpInMove[i];
BOX2I bbox = fpB->GetBoundingBox( true, false );
BOX2I bbox = fpB->GetBoundingBox( true );
movingBBox.Merge( bbox );
fpBBBoxes[i] = bbox;
}
@ -51,7 +51,7 @@ void DRC_INTERACTIVE_COURTYARD_CLEARANCE::testCourtyardClearances()
if( fpA->IsSelected() )
continue;
BOX2I fpABBox = fpA->GetBoundingBox( true, false );
BOX2I fpABBox = fpA->GetBoundingBox( true );
if( !movingBBox.Intersects( fpABBox ) )
continue;

View File

@ -168,7 +168,7 @@ bool GENCAD_EXPORTER::WriteFile( wxString& aFullFileName )
BOARD* pcb = m_board;
// Update some board data, to ensure a reliable gencad export
pcb->ComputeBoundingBox( false, false );
pcb->ComputeBoundingBox( false );
/* Temporary modification of footprints that are flipped (i.e. on bottom
* layer) to convert them to non flipped footprints.

View File

@ -72,7 +72,7 @@ bool EXPORT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOption
if( aSvgPlotOptions.m_pageSizeMode == 2 ) // Page is board boundary size
{
BOX2I bbox = aBoard->ComputeBoundingBox( false, false );
BOX2I bbox = aBoard->ComputeBoundingBox( false );
PAGE_INFO currpageInfo = aBoard->GetPageSettings();
currpageInfo.SetWidthMils( bbox.GetWidth() / pcbIUScale.IU_PER_MILS );

View File

@ -309,7 +309,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
buffer += "\n$BeginDESCRIPTION\n";
BOX2I bbbox = m_board->ComputeBoundingBox( false, false );
BOX2I bbbox = m_board->ComputeBoundingBox( false );
buffer += "\n$BOARD\n";

View File

@ -69,7 +69,6 @@
FOOTPRINT::FOOTPRINT( BOARD* parent ) :
BOARD_ITEM_CONTAINER((BOARD_ITEM*) parent, PCB_FOOTPRINT_T ),
m_boundingBoxCacheTimeStamp( 0 ),
m_visibleBBoxCacheTimeStamp( 0 ),
m_textExcludedBBoxCacheTimeStamp( 0 ),
m_hullCacheTimeStamp( 0 ),
m_initial_comments( nullptr )
@ -127,8 +126,6 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
m_cachedBoundingBox = aFootprint.m_cachedBoundingBox;
m_boundingBoxCacheTimeStamp = aFootprint.m_boundingBoxCacheTimeStamp;
m_cachedVisibleBBox = aFootprint.m_cachedVisibleBBox;
m_visibleBBoxCacheTimeStamp = aFootprint.m_visibleBBoxCacheTimeStamp;
m_cachedTextExcludedBBox = aFootprint.m_cachedTextExcludedBBox;
m_textExcludedBBoxCacheTimeStamp = aFootprint.m_textExcludedBBoxCacheTimeStamp;
m_cachedHull = aFootprint.m_cachedHull;
@ -700,8 +697,6 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
m_cachedBoundingBox = aOther.m_cachedBoundingBox;
m_boundingBoxCacheTimeStamp = aOther.m_boundingBoxCacheTimeStamp;
m_cachedVisibleBBox = aOther.m_cachedVisibleBBox;
m_visibleBBoxCacheTimeStamp = aOther.m_visibleBBoxCacheTimeStamp;
m_cachedTextExcludedBBox = aOther.m_cachedTextExcludedBBox;
m_textExcludedBBoxCacheTimeStamp = aOther.m_textExcludedBBoxCacheTimeStamp;
m_cachedHull = aOther.m_cachedHull;
@ -794,8 +789,6 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
m_cachedBoundingBox = aOther.m_cachedBoundingBox;
m_boundingBoxCacheTimeStamp = aOther.m_boundingBoxCacheTimeStamp;
m_cachedVisibleBBox = aOther.m_cachedVisibleBBox;
m_visibleBBoxCacheTimeStamp = aOther.m_visibleBBoxCacheTimeStamp;
m_cachedTextExcludedBBox = aOther.m_cachedTextExcludedBBox;
m_textExcludedBBoxCacheTimeStamp = aOther.m_textExcludedBBoxCacheTimeStamp;
m_cachedHull = aOther.m_cachedHull;
@ -1137,7 +1130,7 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode )
double FOOTPRINT::GetArea( int aPadding ) const
{
BOX2I bbox = GetBoundingBox( false, false );
BOX2I bbox = GetBoundingBox( false );
double w = std::abs( static_cast<double>( bbox.GetWidth() ) ) + aPadding;
double h = std::abs( static_cast<double>( bbox.GetHeight() ) ) + aPadding;
@ -1252,26 +1245,21 @@ bool FOOTPRINT::TextOnly() const
const BOX2I FOOTPRINT::GetBoundingBox() const
{
return GetBoundingBox( true, true );
return GetBoundingBox( true );
}
const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const
const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText ) const
{
const BOARD* board = GetBoard();
if( board )
{
if( aIncludeText && aIncludeInvisibleText )
if( aIncludeText )
{
if( m_boundingBoxCacheTimeStamp >= board->GetTimeStamp() )
return m_cachedBoundingBox;
}
else if( aIncludeText )
{
if( m_visibleBBoxCacheTimeStamp >= board->GetTimeStamp() )
return m_cachedVisibleBBox;
}
else
{
if( m_textExcludedBBoxCacheTimeStamp >= board->GetTimeStamp() )
@ -1347,7 +1335,7 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
if( !isFPEdit && m_privateLayers.test( text->GetLayer() ) )
continue;
if( aIncludeInvisibleText || text->IsVisible() )
if( text->IsVisible() )
bbox.Merge( text->GetBoundingBox() );
}
@ -1372,16 +1360,12 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
}
if( ( Value().IsVisible() && valueLayerIsVisible )
|| aIncludeInvisibleText
|| noDrawItems )
if( ( Value().IsVisible() && valueLayerIsVisible ) || noDrawItems )
{
bbox.Merge( Value().GetBoundingBox() );
}
if( ( Reference().IsVisible() && refLayerIsVisible )
|| aIncludeInvisibleText
|| noDrawItems )
if( ( Reference().IsVisible() && refLayerIsVisible ) || noDrawItems )
{
bbox.Merge( Reference().GetBoundingBox() );
}
@ -1389,16 +1373,11 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
if( board )
{
if( ( aIncludeText && aIncludeInvisibleText ) || noDrawItems )
if( aIncludeText || noDrawItems )
{
m_boundingBoxCacheTimeStamp = board->GetTimeStamp();
m_cachedBoundingBox = bbox;
}
else if( aIncludeText )
{
m_visibleBBoxCacheTimeStamp = board->GetTimeStamp();
m_cachedVisibleBBox = bbox;
}
else
{
m_textExcludedBBoxCacheTimeStamp = board->GetTimeStamp();
@ -1749,7 +1728,7 @@ bool FOOTPRINT::HitTestOnLayer( const BOX2I& aRect, bool aContained, PCB_LAYER_I
bool FOOTPRINT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
BOX2I rect = GetBoundingBox( false, false );
BOX2I rect = GetBoundingBox( false );
return rect.Inflate( aAccuracy ).Contains( aPosition );
}
@ -1767,17 +1746,17 @@ bool FOOTPRINT::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) co
if( aContained )
{
return arect.Contains( GetBoundingBox( false, false ) );
return arect.Contains( GetBoundingBox( false ) );
}
else
{
// If the rect does not intersect the bounding box, skip any tests
if( !aRect.Intersects( GetBoundingBox( false, false ) ) )
if( !aRect.Intersects( GetBoundingBox( false ) ) )
return false;
// If there are no pads, zones, or drawings, allow intersection with text
if( m_pads.empty() && m_zones.empty() && m_drawings.empty() )
return GetBoundingBox( true, false ).Intersects( arect );
return GetBoundingBox( true ).Intersects( arect );
// Determine if any elements in the FOOTPRINT intersect the rect
for( PAD* pad : m_pads )
@ -2198,7 +2177,7 @@ double FOOTPRINT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
const BOX2I FOOTPRINT::ViewBBox() const
{
BOX2I area = GetBoundingBox( true, true );
BOX2I area = GetBoundingBox( true );
// Inflate in case clearance lines are drawn around pads, etc.
if( const BOARD* board = GetBoard() )
@ -2271,7 +2250,6 @@ void FOOTPRINT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
}
m_boundingBoxCacheTimeStamp = 0;
m_visibleBBoxCacheTimeStamp = 0;
m_textExcludedBBoxCacheTimeStamp = 0;
m_hullCacheTimeStamp = 0;
}
@ -2336,7 +2314,6 @@ void FOOTPRINT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
Rotate( aCentre, ANGLE_180 );
m_boundingBoxCacheTimeStamp = 0;
m_visibleBBoxCacheTimeStamp = 0;
m_textExcludedBBoxCacheTimeStamp = 0;
m_cachedHull.Mirror( aFlipLeftRight, !aFlipLeftRight, m_pos );
@ -2364,7 +2341,6 @@ void FOOTPRINT::SetPosition( const VECTOR2I& aPos )
item->Move( delta );
m_cachedBoundingBox.Move( delta );
m_cachedVisibleBBox.Move( delta );
m_cachedTextExcludedBBox.Move( delta );
m_courtyard_cache_back.Move( delta );
m_courtyard_cache_front.Move( delta );
@ -2411,7 +2387,6 @@ void FOOTPRINT::MoveAnchorPosition( const VECTOR2I& aMoveVector )
}
m_cachedBoundingBox.Move( moveVector );
m_cachedVisibleBBox.Move( moveVector );
m_cachedTextExcludedBBox.Move( moveVector );
m_cachedHull.Move( moveVector );
}
@ -2437,7 +2412,6 @@ void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
item->Rotate( GetPosition(), angleChange );
m_boundingBoxCacheTimeStamp = 0;
m_visibleBBoxCacheTimeStamp = 0;
m_textExcludedBBoxCacheTimeStamp = 0;
m_cachedHull.Rotate( angleChange, GetPosition() );
@ -2609,7 +2583,7 @@ wxString FOOTPRINT::GetNextPadNumber( const wxString& aLastPadNumber ) const
void FOOTPRINT::AutoPositionFields()
{
// Auto-position reference and value
BOX2I bbox = GetBoundingBox( false, false );
BOX2I bbox = GetBoundingBox( false );
bbox.Inflate( pcbIUScale.mmToIU( 0.2 ) ); // Gap between graphics and text
if( Reference().GetPosition() == VECTOR2I( 0, 0 ) )

View File

@ -187,7 +187,7 @@ public:
// Virtual function
const BOX2I GetBoundingBox() const override;
const BOX2I GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
const BOX2I GetBoundingBox( bool aIncludeText ) const;
/**
* Return the bounding box of the footprint on a given set of layers
@ -196,7 +196,7 @@ public:
VECTOR2I GetCenter() const override
{
return GetBoundingBox( false, false ).GetCenter();
return GetBoundingBox( false ).GetCenter();
}
PCB_FIELDS& Fields() { return m_fields; }
@ -1049,8 +1049,6 @@ private:
// fragile.
mutable BOX2I m_cachedBoundingBox;
mutable int m_boundingBoxCacheTimeStamp;
mutable BOX2I m_cachedVisibleBBox;
mutable int m_visibleBBoxCacheTimeStamp;
mutable BOX2I m_cachedTextExcludedBBox;
mutable int m_textExcludedBBoxCacheTimeStamp;
mutable SHAPE_POLY_SET m_cachedHull;

View File

@ -731,7 +731,7 @@ const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible )
if( hasGraphicalItem )
{
return footprint->GetBoundingBox( false, false );
return footprint->GetBoundingBox( false );
}
else
{

View File

@ -420,7 +420,6 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
migrateLegacyColor( f + "Color4DPCBBackground", LAYER_PCB_BACKGROUND );
migrateLegacyColor( f + "Color4DPCBCursor", LAYER_CURSOR );
migrateLegacyColor( f + "Color4DRatsEx", LAYER_RATSNEST );
migrateLegacyColor( f + "Color4DTxtInvisEx", LAYER_HIDDEN_TEXT );
migrateLegacyColor( f + "Color4DViaBBlindEx", LAYER_VIA_BBLIND );
migrateLegacyColor( f + "Color4DViaMicroEx", LAYER_VIA_MICROVIA );
migrateLegacyColor( f + "Color4DViaThruEx", LAYER_VIA_THROUGH );

View File

@ -144,7 +144,7 @@ void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<FOOTPRINT> aFootp
void FOOTPRINT_PREVIEW_PANEL::fitToCurrentFootprint()
{
bool includeText = m_currentFootprint->TextOnly();
BOX2I bbox = m_currentFootprint->GetBoundingBox( includeText, false );
BOX2I bbox = m_currentFootprint->GetBoundingBox( includeText );
if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
{

View File

@ -758,7 +758,6 @@ GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
GetCanvas()->GetView() );
// account for the globals
guide.SetIgnoreHiddenFPText( !m_pcb->IsElementVisible( LAYER_HIDDEN_TEXT ) );
guide.SetIgnoreFPTextOnBack( !m_pcb->IsElementVisible( LAYER_FP_TEXT ) );
guide.SetIgnoreFPTextOnFront( !m_pcb->IsElementVisible( LAYER_FP_TEXT ) );
guide.SetIgnoreFootprintsOnBack( !m_pcb->IsElementVisible( LAYER_FOOTPRINTS_BK ) );

View File

@ -264,7 +264,7 @@ const BOX2I PCB_GROUP::GetBoundingBox() const
for( BOARD_ITEM* item : m_items )
{
if( item->Type() == PCB_FOOTPRINT_T )
bbox.Merge( static_cast<FOOTPRINT*>( item )->GetBoundingBox( true, false ) );
bbox.Merge( static_cast<FOOTPRINT*>( item )->GetBoundingBox( true ) );
else
bbox.Merge( item->GetBoundingBox() );
}

View File

@ -245,7 +245,7 @@ BOARD* PCB_IO_EASYEDA::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
parser.ParseBoard( m_board, origin, m_loadedFootprints, doc.shape );
// Center the board
BOX2I outlineBbox = m_board->ComputeBoundingBox( true, false );
BOX2I outlineBbox = m_board->ComputeBoundingBox( true );
PAGE_INFO pageInfo = m_board->GetPageSettings();
VECTOR2D pageCenter( pcbIUScale.MilsToIU( pageInfo.GetWidthMils() / 2 ),
@ -551,4 +551,4 @@ std::vector<FOOTPRINT*> PCB_IO_EASYEDA::GetImportedCachedLibraryFootprints()
}
return result;
}
}

View File

@ -1832,7 +1832,7 @@ void PCB_IO_EASYEDAPRO_PARSER::ParseBoard(
aBoard->Add( ptr.release(), ADD_MODE::APPEND );
// Center the board
BOX2I outlineBbox = aBoard->ComputeBoundingBox( true, false );
BOX2I outlineBbox = aBoard->ComputeBoundingBox( true );
PAGE_INFO pageInfo = aBoard->GetPageSettings();
VECTOR2D pageCenter( pcbIUScale.MilsToIU( pageInfo.GetWidthMils() / 2 ),

View File

@ -2109,8 +2109,7 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
{
wxString resolvedText( aText->GetShownText( true ) );
if( resolvedText.Length() == 0
|| !( aText->GetAttributes().m_Visible || aLayer == LAYER_HIDDEN_TEXT ) )
if( resolvedText.Length() == 0 || !aText->GetAttributes().m_Visible )
return;
if( aLayer == LAYER_LOCKED_ITEM_SHADOW ) // happens only if locked
@ -2543,7 +2542,7 @@ void PCB_PAINTER::draw( const FOOTPRINT* aFootprint, int aLayer )
const SHAPE_POLY_SET& poly = aFootprint->GetBoundingHull();
m_gal->DrawPolygon( poly );
#else
BOX2I bbox = aFootprint->GetBoundingBox( false, false );
BOX2I bbox = aFootprint->GetBoundingBox( false );
VECTOR2I topLeft = bbox.GetPosition();
VECTOR2I botRight = bbox.GetPosition() + bbox.GetSize();

View File

@ -254,10 +254,7 @@ const BOX2I PCB_TEXT::ViewBBox() const
void PCB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
{
if( GetParentFootprint() == nullptr || IsVisible() )
aLayers[0] = GetLayer();
else
aLayers[0] = LAYER_HIDDEN_TEXT;
aLayers[0] = GetLayer();
aCount = 1;
@ -276,8 +273,6 @@ double PCB_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( aView->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
// Hidden text gets put on the LAYER_HIDDEN_TEXT for rendering, but
// should only render if its native layer is visible.
if( !aView->IsLayerVisible( GetLayer() ) )
return HIDE;

View File

@ -172,7 +172,7 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob )
if( !aStepJob->m_hasUserOrigin )
{
BOX2I bbox = brd->ComputeBoundingBox( true, false );
BOX2I bbox = brd->ComputeBoundingBox( true );
originX = pcbIUScale.IUTomm( bbox.GetCenter().x );
originY = pcbIUScale.IUTomm( bbox.GetCenter().y );
}

View File

@ -170,7 +170,6 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
setVisibility( LAYER_FP_VALUES );
setVisibility( LAYER_FP_REFERENCES );
setVisibility( LAYER_FP_TEXT );
setVisibility( LAYER_HIDDEN_TEXT );
setVisibility( LAYER_PADS );
setVisibility( LAYER_PADS_SMD_FR );
setVisibility( LAYER_PADS_SMD_BK );
@ -290,10 +289,7 @@ void PCBNEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
BOX2I PCBNEW_PRINTOUT::getBoundingBox()
{
bool showHiddenText = m_pcbnewSettings.m_AsItemCheckboxes
&& m_board->IsElementVisible( LAYER_HIDDEN_TEXT );
return m_board->ComputeBoundingBox( false, showHiddenText );
return m_board->ComputeBoundingBox( false );
}

View File

@ -959,7 +959,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
migrateLegacyColor( "Color4DPCBBackground", LAYER_PCB_BACKGROUND );
migrateLegacyColor( "Color4DPCBCursor", LAYER_CURSOR );
migrateLegacyColor( "Color4DRatsEx", LAYER_RATSNEST );
migrateLegacyColor( "Color4DTxtInvisEx", LAYER_HIDDEN_TEXT );
migrateLegacyColor( "Color4DViaBBlindEx", LAYER_VIA_BBLIND );
migrateLegacyColor( "Color4DViaMicroEx", LAYER_VIA_MICROVIA );
migrateLegacyColor( "Color4DViaThruEx", LAYER_VIA_THROUGH );

View File

@ -140,14 +140,14 @@ void PlotInteractiveLayer( BOARD* aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARA
VECTOR2I offset = -aPlotter->GetPlotOffsetUserUnits();
// Use a footprint bbox without texts to create the hyperlink area
BOX2I bbox = fp->GetBoundingBox( false, false );
BOX2I bbox = fp->GetBoundingBox( false );
bbox.Move( offset );
aPlotter->HyperlinkMenu( bbox, properties );
// Use a footprint bbox with visible texts only to create the bookmark area
// which is the area to zoom on ft selection
// However the bbox need to be inflated for a better look.
bbox = fp->GetBoundingBox( true, false );
bbox = fp->GetBoundingBox( true );
bbox.Move( offset );
bbox.Inflate( bbox.GetWidth() /2, bbox.GetHeight() /2 );
aPlotter->Bookmark( bbox, fp->GetReference(), _( "Footprints" ) );
@ -1075,7 +1075,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
autocenter = (aPlotOpts->GetScale() != 1.0);
}
BOX2I bbox = aBoard->ComputeBoundingBox( false, false );
BOX2I bbox = aBoard->ComputeBoundingBox( false );
VECTOR2I boardCenter = bbox.Centre();
VECTOR2I boardSize = bbox.GetSize();
@ -1278,7 +1278,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
// done in the driver (if supported)
if( aPlotOpts->GetNegative() )
{
BOX2I bbox = aBoard->ComputeBoundingBox( false, false );
BOX2I bbox = aBoard->ComputeBoundingBox( false );
FillNegativeKnockout( plotter, bbox );
}

View File

@ -197,7 +197,7 @@ int EDIT_TOOL::PackAndMoveFootprints( const TOOL_EVENT& aEvent )
{
commit.Modify( item );
item->SetFlags( IS_MOVING );
footprintsBbox.Merge( item->GetBoundingBox( false, false ) );
footprintsBbox.Merge( item->GetBoundingBox( false ) );
}
SpreadFootprints( &footprintsToPack, footprintsBbox.Normalize().GetOrigin(), false );

View File

@ -140,7 +140,7 @@ const SHAPE_LINE_CHAIN MULTICHANNEL_TOOL::buildRAOutline( std::set<FOOTPRINT*>&
for( auto fp : aFootprints )
{
auto bb = fp->GetBoundingBox( false, false );
auto bb = fp->GetBoundingBox( false );
bb.Inflate( aMargin );
bbCorners.push_back( VECTOR2I( bb.GetX(), bb.GetY() ) );
@ -393,12 +393,12 @@ int MULTICHANNEL_TOOL::RepeatLayout( const TOOL_EVENT& aEvent, ZONE* aRefZone )
PCB_GROUP* grp = new PCB_GROUP( board() );
grpCommit.Add( grp );
for( auto item : groupableItems )
{
grpCommit.Stage( item, CHT_GROUP );
}
grpCommit.Push( _( "Group components with their placement rule areas" ) );
}
@ -638,7 +638,7 @@ bool MULTICHANNEL_TOOL::resolveConnectionTopology( RULE_AREA* aRefArea, RULE_ARE
break;
}
return (status == TMATCH::CONNECTION_GRAPH::ST_OK );
return ( status == TMATCH::CONNECTION_GRAPH::ST_OK );
}

View File

@ -310,7 +310,6 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
GENERAL_COLLECTOR collector;
GENERAL_COLLECTORS_GUIDE guide = frame()->GetCollectorsGuide();
guide.SetIgnoreHiddenFPText( true );
guide.SetIgnoreFPTextOnBack( true );
guide.SetIgnoreFPTextOnFront( true );
guide.SetIgnoreFPValues( true );

View File

@ -1309,7 +1309,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
// If the cursor is not over a pad, snap to the anchor (if visible) or the center
// (if markedly different from the anchor).
VECTOR2I position = footprint->GetPosition();
VECTOR2I center = footprint->GetBoundingBox( false, false ).Centre();
VECTOR2I center = footprint->GetBoundingBox( false ).Centre();
VECTOR2I grid( GetGrid() );
if( view->IsLayerVisible( LAYER_ANCHOR ) )

View File

@ -109,7 +109,7 @@ const std::vector<KIGFX::VIEW_ITEM*> PCB_SELECTION::updateDrawList() const
}
BOX2I PCB_SELECTION::GetBoundingBox( bool aOnlyVisible ) const
BOX2I PCB_SELECTION::GetBoundingBox() const
{
BOX2I bbox;
@ -119,7 +119,7 @@ BOX2I PCB_SELECTION::GetBoundingBox( bool aOnlyVisible ) const
{
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
bbox.Merge( footprint->GetBoundingBox( true, !aOnlyVisible ) );
bbox.Merge( footprint->GetBoundingBox( true ) );
}
else
{
@ -128,4 +128,4 @@ BOX2I PCB_SELECTION::GetBoundingBox( bool aOnlyVisible ) const
}
return bbox;
}
}

View File

@ -33,7 +33,7 @@ class PCB_SELECTION : public SELECTION
public:
EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override;
BOX2I GetBoundingBox( bool aOnlyVisible = false ) const override;
BOX2I GetBoundingBox() const override;
const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
};

View File

@ -744,7 +744,6 @@ const GENERAL_COLLECTORS_GUIDE PCB_SELECTION_TOOL::getCollectorsGuide() const
bool padsDisabled = !board()->IsElementVisible( LAYER_PADS );
// account for the globals
guide.SetIgnoreHiddenFPText( !board()->IsElementVisible( LAYER_HIDDEN_TEXT ) );
guide.SetIgnoreFPTextOnBack( !board()->IsElementVisible( LAYER_FP_TEXT ) );
guide.SetIgnoreFPTextOnFront( !board()->IsElementVisible( LAYER_FP_TEXT ) );
guide.SetIgnoreFootprintsOnBack( !board()->IsElementVisible( LAYER_FOOTPRINTS_BK ) );
@ -2135,7 +2134,7 @@ void PCB_SELECTION_TOOL::doSyncSelection( const std::vector<BOARD_ITEM*>& aItems
if( aWithNets )
selectConnections( aItems );
BOX2I bbox = m_selection.GetBoundingBox( true );
BOX2I bbox = m_selection.GetBoundingBox();
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
{
@ -2940,7 +2939,7 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
if( !text->IsVisible() )
{
if( !m_isFootprintEditor || !view()->IsLayerVisible( LAYER_HIDDEN_TEXT ) )
if( !m_isFootprintEditor )
return false;
}
@ -3259,7 +3258,7 @@ int PCB_SELECTION_TOOL::hitTestDistance( const VECTOR2I& aWhere, BOARD_ITEM* aIt
case PCB_FOOTPRINT_T:
{
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
BOX2I bbox = footprint->GetBoundingBox( false, false );
BOX2I bbox = footprint->GetBoundingBox( false );
try
{

View File

@ -104,8 +104,7 @@ std::vector<std::pair<BOARD_ITEM*, BOX2I>> GetBoundingBoxes( const T& aItems )
if( boardItem->Type() == PCB_FOOTPRINT_T )
{
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( boardItem );
rects.emplace_back( std::make_pair( footprint,
footprint->GetBoundingBox( false, false ) ) );
rects.emplace_back( std::make_pair( footprint, footprint->GetBoundingBox( false ) ) );
}
else
{

View File

@ -339,7 +339,6 @@ const APPEARANCE_CONTROLS::APPEARANCE_SETTING APPEARANCE_CONTROLS::s_objectSetti
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
RR( _HKI( "Hidden Text" ), LAYER_HIDDEN_TEXT, _HKI( "Show text marked as hidden" ) ),
RR(),
RR(),
RR( _HKI( "Ratsnest" ), LAYER_RATSNEST, _HKI( "Show unconnected nets as a ratsnest") ),
@ -365,7 +364,6 @@ static std::set<int> s_allowedInFpEditor =
LAYER_FP_VALUES,
LAYER_FP_REFERENCES,
LAYER_FP_TEXT,
LAYER_HIDDEN_TEXT,
LAYER_DRAW_BITMAPS,
LAYER_GRID
};

View File

@ -513,7 +513,7 @@ PCB_SELECTION& PCB_TOOL_BASE::selection()
return sel;
}
BOX2I PCB_SELECTION::GetBoundingBox( bool aOnlyVisible ) const
BOX2I PCB_SELECTION::GetBoundingBox() const
{
return BOX2I();
}

View File

@ -53,7 +53,6 @@ const GENERAL_COLLECTORS_GUIDE PCB_TEST_SELECTION_TOOL::getCollectorsGuide() con
bool padsDisabled = !board()->IsElementVisible( LAYER_PADS );
// account for the globals
guide.SetIgnoreHiddenFPText( !board()->IsElementVisible( LAYER_HIDDEN_TEXT ) );
guide.SetIgnoreFPTextOnBack( !board()->IsElementVisible( LAYER_FP_TEXT ) );
guide.SetIgnoreFPTextOnFront( !board()->IsElementVisible( LAYER_FP_TEXT ) );
guide.SetIgnoreFootprintsOnBack( !board()->IsElementVisible( LAYER_FOOTPRINTS_BK ) );