Reduce compiler warnings.

This commit is contained in:
Jeff Young 2022-12-12 23:37:46 +00:00
parent ad9b983a27
commit 9d13e419c2
4 changed files with 29 additions and 31 deletions

View File

@ -87,7 +87,7 @@ public:
/**
* Returns the set of currently high-contrast layers.
*/
const std::set<unsigned int> GetHighContrastLayers() const
const std::set<int> GetHighContrastLayers() const
{
return m_highContrastLayers;
}
@ -307,7 +307,7 @@ protected:
PCB_LAYER_ID m_activeLayer; // The active layer (as shown by appearance mgr)
wxString m_layerName;
std::set<unsigned int> m_highContrastLayers; // High-contrast layers (both board layers and
std::set<int> m_highContrastLayers; // High-contrast layers (both board layers and
// synthetic GAL layers)
COLOR4D m_layerColors[LAYER_ID_COUNT]; // Layer colors
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]; // Layer colors for highlighted objects

View File

@ -380,7 +380,7 @@ std::set<BOARD_ITEM*> PCB_GRID_HELPER::queryVisible( const BOX2I& aArea,
KIGFX::VIEW* view = m_toolMgr->GetView();
RENDER_SETTINGS* settings = view->GetPainter()->GetSettings();
const std::set<unsigned int>& activeLayers = settings->GetHighContrastLayers();
const std::set<int>& activeLayers = settings->GetHighContrastLayers();
bool isHighContrast = settings->GetHighContrast();
view->Query( aArea, selectedItems );
@ -417,7 +417,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos
{
KIGFX::VIEW* view = m_toolMgr->GetView();
RENDER_SETTINGS* settings = view->GetPainter()->GetSettings();
const std::set<unsigned int>& activeLayers = settings->GetHighContrastLayers();
const std::set<int>& activeLayers = settings->GetHighContrastLayers();
bool isHighContrast = settings->GetHighContrast();
auto handlePadShape =

View File

@ -384,7 +384,6 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
[]( const VECTOR2I& aWhere, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* aTool )
{
VECTOR2I location = aWhere;
int accuracy = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() );
std::set<EDA_ITEM*> remove;
@ -394,8 +393,8 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
ZONE* zone = static_cast<ZONE*>( item );
if( !zone->HitTestForCorner( location, accuracy * 2 )
&& !zone->HitTestForEdge( location, accuracy ) )
if( !zone->HitTestForCorner( aWhere, accuracy * 2 )
&& !zone->HitTestForEdge( aWhere, accuracy ) )
{
remove.insert( zone );
}
@ -649,7 +648,7 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl
if( !lockedItems.empty() )
{
DIALOG_LOCKED_ITEMS_QUERY dlg( frame(), lockedItems.size() );
DIALOG_LOCKED_ITEMS_QUERY dlg( frame(), (int) lockedItems.size() );
switch( dlg.ShowModal() )
{
@ -1208,7 +1207,7 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks(
PROF_TIMER refreshTimer;
double refreshIntervalMs = 500; // Refresh display with this interval to indicate progress
int lastSelectionSize = m_selection.GetSize();
int lastSelectionSize = (int) m_selection.GetSize();
auto connectivity = board()->GetConnectivity();
@ -1300,7 +1299,7 @@ void PCB_SELECTION_TOOL::selectAllConnectedTracks(
{
expand = false;
for( int i = activePts.size() - 1; i >= 0; --i )
for( int i = (int) activePts.size() - 1; i >= 0; --i )
{
VECTOR2I pt = activePts[i].first;
LSET layerSetCu = activePts[i].second & allCuMask;
@ -1546,7 +1545,7 @@ int PCB_SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
bool select = aEvent.IsAction( &PCB_ACTIONS::selectNet );
// If we've been passed an argument, just select that netcode1
int netcode = aEvent.Parameter<intptr_t>();
int netcode = (int) aEvent.Parameter<intptr_t>();
if( netcode > 0 )
{
@ -1847,7 +1846,7 @@ void PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
#endif // DEFAULT_PCBNEW_CODE
#ifndef DEFAULT_PCBNEW_CODE // Do the scaled zoom
auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
auto bbSize = bbox.Inflate( KiROUND( bbox.GetWidth() * 0.2 ) ).GetSize();
auto screenSize = view->ToWorld( m_frame->GetCanvas()->GetClientSize(), false );
// This code tries to come up with a zoom factor that doesn't simply zoom in
@ -2345,10 +2344,10 @@ bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibili
if( settings->GetHighContrast() )
{
std::set<unsigned int> activeLayers = settings->GetHighContrastLayers();
const std::set<int> activeLayers = settings->GetHighContrastLayers();
bool onActiveLayer = false;
for( unsigned int layer : activeLayers )
for( int layer : activeLayers )
{
// NOTE: Only checking the regular layers (not GAL meta-layers)
if( layer < PCB_LAYER_ID_COUNT && aItem->IsOnLayer( ToLAYER_ID( layer ) ) )
@ -2699,7 +2698,7 @@ void PCB_SELECTION_TOOL::unhighlightInternal( EDA_ITEM* aItem, int aMode, bool a
bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
{
const unsigned GRIP_MARGIN = 20;
double margin = getView()->ToWorld( GRIP_MARGIN );
int margin = KiROUND( getView()->ToWorld( GRIP_MARGIN ) );
// Check if the point is located close to any of the currently selected items
for( EDA_ITEM* item : m_selection )
@ -2889,7 +2888,8 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector
// Prefer exact hits to sloppy ones
constexpr int MAX_SLOP = 5;
int pixel = (int) aCollector.GetGuide()->OnePixelInIU();
int singlePixel = KiROUND( aCollector.GetGuide()->OnePixelInIU() );
int maxSlop = KiROUND( MAX_SLOP * aCollector.GetGuide()->OnePixelInIU() );
int minSlop = INT_MAX;
std::map<BOARD_ITEM*, int> itemsBySloppiness;
@ -2897,7 +2897,7 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector
for( int i = 0; i < aCollector.GetCount(); ++i )
{
BOARD_ITEM* item = aCollector[i];
int itemSlop = hitTestDistance( where, item, MAX_SLOP * pixel );
int itemSlop = hitTestDistance( where, item, maxSlop );
itemsBySloppiness[ item ] = itemSlop;
@ -2910,7 +2910,7 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector
{
for( std::pair<BOARD_ITEM*, int> pair : itemsBySloppiness )
{
if( pair.second > minSlop + pixel )
if( pair.second > minSlop + singlePixel )
aCollector.Transfer( pair.first );
}
}
@ -2927,16 +2927,16 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector
double area = 0.0;
if( ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
&& static_cast<ZONE*>( item )->HitTestForEdge( where, MAX_SLOP * pixel / 2 ) )
&& static_cast<ZONE*>( item )->HitTestForEdge( where, maxSlop / 2 ) )
{
// Zone borders are very specific, so make them "small"
area = MAX_SLOP * SEG::Square( pixel );
area = (double) SEG::Square( singlePixel ) * MAX_SLOP;
}
else if( item->Type() == PCB_VIA_T )
{
// Vias rarely hide other things, and we don't want them deferring to short track
// segments underneath them -- so artificially reduce their size from πr² to 1.5r².
area = SEG::Square( static_cast<PCB_VIA*>( item )->GetDrill() / 2 ) * 1.5;
area = (double) SEG::Square( static_cast<PCB_VIA*>( item )->GetDrill() / 2 ) * 1.5;
}
else if( item->Type() == PCB_BITMAP_T )
{

View File

@ -33,8 +33,6 @@
#include <tools/pcb_grid_helper.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_viewer_tools.h>
#include <view/view_controls.h>
#include <wx/debug.h>
bool PCB_VIEWER_TOOLS::Init()