Lint reduction.

This commit is contained in:
Jeff Young 2024-04-20 21:50:40 +01:00
parent 2d614898a8
commit c0f480eea8
6 changed files with 40 additions and 39 deletions

View File

@ -527,21 +527,21 @@ static bool isFieldsLayer( int aLayer )
void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition,
const TEXT_ATTRIBUTES& aAttributes, const TEXT_ATTRIBUTES& aAttrs,
const KIFONT::METRICS& aFontMetrics ) const KIFONT::METRICS& aFontMetrics )
{ {
KIFONT::FONT* font = aAttributes.m_Font; KIFONT::FONT* font = aAttrs.m_Font;
if( !font ) if( !font )
{ {
font = KIFONT::FONT::GetFont( eeconfig()->m_Appearance.default_font, aAttributes.m_Bold, font = KIFONT::FONT::GetFont( eeconfig()->m_Appearance.default_font, aAttrs.m_Bold,
aAttributes.m_Italic ); aAttrs.m_Italic );
} }
m_gal->SetIsFill( font->IsOutline() ); m_gal->SetIsFill( font->IsOutline() );
m_gal->SetIsStroke( font->IsStroke() ); m_gal->SetIsStroke( font->IsStroke() );
font->Draw( m_gal, aText, aPosition, aAttributes, aFontMetrics ); font->Draw( m_gal, aText, aPosition, aAttrs, aFontMetrics );
} }
@ -2848,13 +2848,13 @@ void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
if( aEntry->IsDanglingStart() ) if( aEntry->IsDanglingStart() )
{ {
m_gal->DrawCircle( aEntry->GetPosition(), m_gal->DrawCircle( aEntry->GetPosition(),
aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) ); aEntry->GetPenWidth() + KiROUND( TARGET_BUSENTRY_RADIUS / 2.0 ) );
} }
if( aEntry->IsDanglingEnd() ) if( aEntry->IsDanglingEnd() )
{ {
m_gal->DrawCircle( aEntry->GetEnd(), m_gal->DrawCircle( aEntry->GetEnd(),
aEntry->GetPenWidth() + ( TARGET_BUSENTRY_RADIUS / 2 ) ); aEntry->GetPenWidth() + KiROUND( TARGET_BUSENTRY_RADIUS / 2.0 ) );
} }
} }
else else

View File

@ -90,7 +90,7 @@ private:
void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed ); void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed ); void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed );
void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed ); void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed );
void draw( const SCH_LABEL* aText, int aLayer ); void draw( const SCH_LABEL* aLabel, int aLayer );
void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer ); void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
void draw( const SCH_HIERLABEL* aLabel, int aLayer ); void draw( const SCH_HIERLABEL* aLabel, int aLayer );
void draw( const SCH_GLOBALLABEL* aLabel, int aLayer ); void draw( const SCH_GLOBALLABEL* aLabel, int aLayer );
@ -127,9 +127,9 @@ private:
void triLine( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c ); void triLine( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
void strokeText( const wxString& aText, const VECTOR2D& aPosition, void strokeText( const wxString& aText, const VECTOR2D& aPosition,
const TEXT_ATTRIBUTES& aAttributes, const KIFONT::METRICS& aFontMetrics ); const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics );
void bitmapText( const wxString& aText, const VECTOR2D& aPosition, void bitmapText( const wxString& aText, const VECTOR2D& aPosition,
const TEXT_ATTRIBUTES& aAttributes ); const TEXT_ATTRIBUTES& aAttrs );
void knockoutText( const wxString& aText, const VECTOR2D& aPosition, void knockoutText( const wxString& aText, const VECTOR2D& aPosition,
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics ); const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics );
void boxText( const wxString& aText, const VECTOR2D& aPosition, void boxText( const wxString& aText, const VECTOR2D& aPosition,

View File

@ -42,7 +42,7 @@
// small margin in internal units between the pin text and the pin line // small margin in internal units between the pin text and the pin line
#define PIN_TEXT_MARGIN 4 #define PIN_TEXT_MARGIN 4
const wxString SCH_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType ) wxString SCH_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType )
{ {
// These strings are the canonical name of the electrictal type // These strings are the canonical name of the electrictal type
// Not translated, no space in name, only ASCII chars. // Not translated, no space in name, only ASCII chars.
@ -163,7 +163,7 @@ SCH_PIN::SCH_PIN( SCH_PIN* aLibPin, SCH_SYMBOL* aParentSymbol ) :
SetName( m_libPin->GetName() ); SetName( m_libPin->GetName() );
SetNumber( m_libPin->GetNumber() ); SetNumber( m_libPin->GetNumber() );
SetPosition( m_libPin->GetPosition() ); m_position = m_libPin->GetPosition();
m_layer = LAYER_PIN; m_layer = LAYER_PIN;
} }
@ -255,7 +255,7 @@ bool SCH_PIN::IsStacked( const SCH_PIN* aPin ) const
} }
bool SCH_PIN::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxDat ) const bool SCH_PIN::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
{ {
const SCH_SEARCH_DATA& schSearchData = const SCH_SEARCH_DATA& schSearchData =
dynamic_cast<const SCH_SEARCH_DATA&>( aSearchData ); dynamic_cast<const SCH_SEARCH_DATA&>( aSearchData );
@ -1205,7 +1205,7 @@ int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
return m_nameTextSize.value_or( 0 ) - tmp->m_nameTextSize.value_or( 0 ); return m_nameTextSize.value_or( 0 ) - tmp->m_nameTextSize.value_or( 0 );
if( m_alternates.size() != tmp->m_alternates.size() ) if( m_alternates.size() != tmp->m_alternates.size() )
return (int) m_alternates.size() - tmp->m_alternates.size(); return static_cast<int>( m_alternates.size() - tmp->m_alternates.size() );
auto lhsItem = m_alternates.begin(); auto lhsItem = m_alternates.begin();
auto rhsItem = tmp->m_alternates.begin(); auto rhsItem = tmp->m_alternates.begin();
@ -1568,8 +1568,8 @@ void SCH_PIN::validateExtentsCache( KIFONT::FONT* aFont, int aSize, const wxStri
} }
const BOX2I SCH_PIN::GetBoundingBox( bool aIncludeLabelsOnInvisiblePins, bool aIncludeNameAndNumber, BOX2I SCH_PIN::GetBoundingBox( bool aIncludeLabelsOnInvisiblePins, bool aIncludeNameAndNumber,
bool aIncludeElectricalType ) const bool aIncludeElectricalType ) const
{ {
if( const SCH_SYMBOL* symbol = dynamic_cast<const SCH_SYMBOL*>( GetParentSymbol() ) ) if( const SCH_SYMBOL* symbol = dynamic_cast<const SCH_SYMBOL*>( GetParentSymbol() ) )
{ {
@ -1747,7 +1747,7 @@ bool SCH_PIN::ConnectionPropagatesTo( const EDA_ITEM* aItem ) const
wxCHECK( m_libPin, false ); wxCHECK( m_libPin, false );
// Reciprocal checking is done in CONNECTION_GRAPH anyway // Reciprocal checking is done in CONNECTION_GRAPH anyway
return !( m_libPin->GetType() == ELECTRICAL_PINTYPE::PT_NC ); return m_libPin->GetType() != ELECTRICAL_PINTYPE::PT_NC;
} }

View File

@ -52,7 +52,7 @@ public:
SCH_PIN( LIB_SYMBOL* aParentSymbol, const wxString& aName, const wxString& aNumber, SCH_PIN( LIB_SYMBOL* aParentSymbol, const wxString& aName, const wxString& aNumber,
PIN_ORIENTATION aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength, PIN_ORIENTATION aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength,
int aNameTextSize, int aNumTextSize, int aConvert, const VECTOR2I& aPos, int aUnit ); int aNameTextSize, int aNumTextSize, int aBodyStyle, const VECTOR2I& aPos, int aUnit );
SCH_PIN( SCH_PIN* aLibPin, SCH_SYMBOL* aParentSymbol ); SCH_PIN( SCH_PIN* aLibPin, SCH_SYMBOL* aParentSymbol );
@ -289,8 +289,8 @@ public:
* @param aIncludeLabelsOnInvisiblePins - if false, do not include labels for invisible pins * @param aIncludeLabelsOnInvisiblePins - if false, do not include labels for invisible pins
* in the calculation. * in the calculation.
*/ */
const BOX2I GetBoundingBox( bool aIncludeLabelsOnInvisiblePins, bool aIncludeNameAndNumber, BOX2I GetBoundingBox( bool aIncludeLabelsOnInvisiblePins, bool aIncludeNameAndNumber,
bool aIncludeElectricalType ) const; bool aIncludeElectricalType ) const;
/** /**
* Return whether this pin forms a global power connection: i.e., is part of a power symbol * Return whether this pin forms a global power connection: i.e., is part of a power symbol
@ -357,7 +357,7 @@ public:
* @param aType is the electrical type (see enum ELECTRICAL_PINTYPE ) * @param aType is the electrical type (see enum ELECTRICAL_PINTYPE )
* @return The electrical name for a pin type (see enun MsgPinElectricType for names). * @return The electrical name for a pin type (see enun MsgPinElectricType for names).
*/ */
static const wxString GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType ); static wxString GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType );
bool IsConnectable() const override { return true; } bool IsConnectable() const override { return true; }
@ -393,10 +393,10 @@ public:
const wxString& GetOperatingPoint() const { return m_operatingPoint; } const wxString& GetOperatingPoint() const { return m_operatingPoint; }
void SetOperatingPoint( const wxString& aText ) { m_operatingPoint = aText; } void SetOperatingPoint( const wxString& aText ) { m_operatingPoint = aText; }
double Similarity( const SCH_ITEM& aItem ) const override; double Similarity( const SCH_ITEM& aOther ) const override;
bool operator==( const SCH_ITEM& aItem ) const override; bool operator==( const SCH_ITEM& aOther ) const override;
bool operator!=( const SCH_ITEM& aItem ) const { return !operator==( aItem ); } bool operator!=( const SCH_ITEM& aOther ) const { return !operator==( aOther ); }
bool operator<( const SCH_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) < 0; } bool operator<( const SCH_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) < 0; }
bool operator>( const SCH_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) > 0; } bool operator>( const SCH_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) > 0; }

View File

@ -1384,14 +1384,13 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
{ {
EDA_ITEM* item = collector[ i ]; EDA_ITEM* item = collector[ i ];
if( !exactHits.count( item ) ) if( !exactHits.contains( item ) )
collector.Transfer( item ); collector.Transfer( item );
} }
} }
// Find the closest item. (Note that at this point all hits are either exact or non-exact.) // Find the closest item. (Note that at this point all hits are either exact or non-exact.)
VECTOR2I pos( aPos ); SEG poss( mapCoords( aPos, m_isSymbolEditor ), mapCoords( aPos, m_isSymbolEditor ) );
SEG poss( mapCoords( pos, m_isSymbolEditor ), mapCoords( pos, m_isSymbolEditor ) );
EDA_ITEM* closest = nullptr; EDA_ITEM* closest = nullptr;
int closestDist = INT_MAX / 4; int closestDist = INT_MAX / 4;
@ -1400,7 +1399,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
BOX2I bbox = item->GetBoundingBox(); BOX2I bbox = item->GetBoundingBox();
int dist = INT_MAX / 4; int dist = INT_MAX / 4;
if( exactHits.count( item ) ) if( exactHits.contains( item ) )
{ {
if( item->Type() == SCH_PIN_T || item->Type() == SCH_JUNCTION_T ) if( item->Type() == SCH_PIN_T || item->Type() == SCH_JUNCTION_T )
{ {
@ -1417,7 +1416,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
if( line ) if( line )
{ {
dist = KiROUND( DistanceLinePoint( line->GetStartPoint(), dist = KiROUND( DistanceLinePoint( line->GetStartPoint(),
line->GetEndPoint(), pos ) ); line->GetEndPoint(), aPos ) );
} }
else if( field ) else if( field )
{ {
@ -1463,14 +1462,14 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
SHAPE_RECT rect( bbox.GetPosition(), bbox.GetWidth(), bbox.GetHeight() ); SHAPE_RECT rect( bbox.GetPosition(), bbox.GetWidth(), bbox.GetHeight() );
if( bbox.Contains( pos ) ) if( bbox.Contains( aPos ) )
dist = KiROUND( EuclideanNorm( bbox.GetCenter() - pos ) ); dist = KiROUND( EuclideanNorm( bbox.GetCenter() - aPos ) );
else else
rect.Collide( poss, closestDist, &dist ); rect.Collide( poss, closestDist, &dist );
} }
else else
{ {
dist = KiROUND( EuclideanNorm( bbox.GetCenter() - pos ) ); dist = KiROUND( EuclideanNorm( bbox.GetCenter() - aPos ) );
} }
} }
else else
@ -2235,7 +2234,7 @@ void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
BOX2I bbox = aBBox; BOX2I bbox = aBBox;
bbox.Normalize(); bbox.Normalize();
VECTOR2I bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize(); VECTOR2I bbSize = bbox.Inflate( KiROUND( bbox.GetWidth() * 0.2f ) ).GetSize();
VECTOR2D screenSize = getView()->GetViewport().GetSize(); VECTOR2D screenSize = getView()->GetViewport().GetSize();
// This code tries to come up with a zoom factor that doesn't simply zoom in to the cross // This code tries to come up with a zoom factor that doesn't simply zoom in to the cross
@ -2274,7 +2273,7 @@ void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
// linearly interpolate "second" which gives the scaling factor needed. // linearly interpolate "second" which gives the scaling factor needed.
if( compRatio >= lut.front().first ) if( compRatio >= lut.front().first )
{ {
for( it = lut.begin(); it < lut.end() - 1; it++ ) for( it = lut.begin(); it < lut.end() - 1; ++it )
{ {
if( it->first <= compRatio && next( it )->first >= compRatio ) if( it->first <= compRatio && next( it )->first >= compRatio )
{ {
@ -2590,6 +2589,7 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup
if( aItem->GetParent() && aItem->GetParent()->Type() != SCHEMATIC_T ) if( aItem->GetParent() && aItem->GetParent()->Type() != SCHEMATIC_T )
getView()->Update( aItem->GetParent(), KIGFX::REPAINT ); getView()->Update( aItem->GetParent(), KIGFX::REPAINT );
getView()->Update( aItem, KIGFX::REPAINT ); getView()->Update( aItem, KIGFX::REPAINT );
} }
@ -2638,6 +2638,7 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro
if( aItem->GetParent() && aItem->GetParent()->Type() != SCHEMATIC_T ) if( aItem->GetParent() && aItem->GetParent()->Type() != SCHEMATIC_T )
getView()->Update( aItem->GetParent(), KIGFX::REPAINT ); getView()->Update( aItem->GetParent(), KIGFX::REPAINT );
getView()->Update( aItem, KIGFX::REPAINT ); getView()->Update( aItem, KIGFX::REPAINT );
} }
@ -2645,7 +2646,7 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro
bool EE_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const bool EE_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
{ {
const unsigned GRIP_MARGIN = 20; const unsigned GRIP_MARGIN = 20;
double margin = getView()->ToWorld( GRIP_MARGIN ); int margin = KiROUND( getView()->ToWorld( GRIP_MARGIN ) );
// Check if the point is located within any of the currently selected items bounding boxes // Check if the point is located within any of the currently selected items bounding boxes
for( EDA_ITEM* item : m_selection ) for( EDA_ITEM* item : m_selection )

View File

@ -267,19 +267,19 @@ private:
* Highlight the item visually. * Highlight the item visually.
* *
* @param aItem The item to be highlighted. * @param aItem The item to be highlighted.
* @param aHighlightMode Either SELECTED or BRIGHTENED * @param aMode Either SELECTED or BRIGHTENED
* @param aGroup [otpional] A group to add the item to. * @param aGroup [otpional] A group to add the item to.
*/ */
void highlight( EDA_ITEM* aItem, int aHighlightMode, SELECTION* aGroup = nullptr ) override; void highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup = nullptr ) override;
/** /**
* Unhighlight the item visually. * Unhighlight the item visually.
* *
* @param aItem is an item to be highlighted. * @param aItem is an item to be highlighted.
* @param aHighlightMode should be either SELECTED or BRIGHTENED * @param aMode should be either SELECTED or BRIGHTENED
* @param aGroup [optional] A group to remove the item from. * @param aGroup [optional] A group to remove the item from.
*/ */
void unhighlight( EDA_ITEM* aItem, int aHighlightMode, SELECTION* aGroup = nullptr ) override; void unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup = nullptr ) override;
/** /**
* Set the reference point to the anchor of the top-left item. * Set the reference point to the anchor of the top-left item.