diff --git a/include/render_settings.h b/include/render_settings.h index dc5780f39e..28c86a82f3 100644 --- a/include/render_settings.h +++ b/include/render_settings.h @@ -87,7 +87,7 @@ public: /** * Returns the set of currently high-contrast layers. */ - const std::set GetHighContrastLayers() const + const std::set 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 m_highContrastLayers; // High-contrast layers (both board layers and + std::set 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 diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index d9ceb2174d..76be6dc7e0 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -378,10 +378,10 @@ std::set PCB_GRID_HELPER::queryVisible( const BOX2I& aArea, std::set items; std::vector selectedItems; - KIGFX::VIEW* view = m_toolMgr->GetView(); - RENDER_SETTINGS* settings = view->GetPainter()->GetSettings(); - const std::set& activeLayers = settings->GetHighContrastLayers(); - bool isHighContrast = settings->GetHighContrast(); + KIGFX::VIEW* view = m_toolMgr->GetView(); + RENDER_SETTINGS* settings = view->GetPainter()->GetSettings(); + const std::set& activeLayers = settings->GetHighContrastLayers(); + bool isHighContrast = settings->GetHighContrast(); view->Query( aArea, selectedItems ); @@ -415,10 +415,10 @@ std::set PCB_GRID_HELPER::queryVisible( const BOX2I& aArea, void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bool aFrom, const SELECTION_FILTER_OPTIONS* aSelectionFilter ) { - KIGFX::VIEW* view = m_toolMgr->GetView(); - RENDER_SETTINGS* settings = view->GetPainter()->GetSettings(); - const std::set& activeLayers = settings->GetHighContrastLayers(); - bool isHighContrast = settings->GetHighContrast(); + KIGFX::VIEW* view = m_toolMgr->GetView(); + RENDER_SETTINGS* settings = view->GetPainter()->GetSettings(); + const std::set& activeLayers = settings->GetHighContrastLayers(); + bool isHighContrast = settings->GetHighContrast(); auto handlePadShape = [&]( PAD* aPad ) diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index c2e44e5693..aa044d4514 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -384,8 +384,7 @@ 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() ); + int accuracy = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() ); std::set remove; for( EDA_ITEM* item : aCollector ) @@ -394,8 +393,8 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { ZONE* zone = static_cast( 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(); + int netcode = (int) aEvent.Parameter(); 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 activeLayers = settings->GetHighContrastLayers(); - bool onActiveLayer = false; + const std::set 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 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 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( item )->HitTestForEdge( where, MAX_SLOP * pixel / 2 ) ) + && static_cast( 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( item )->GetDrill() / 2 ) * 1.5; + area = (double) SEG::Square( static_cast( item )->GetDrill() / 2 ) * 1.5; } else if( item->Type() == PCB_BITMAP_T ) { diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp index 846ed298b3..464660a2e3 100644 --- a/pcbnew/tools/pcb_viewer_tools.cpp +++ b/pcbnew/tools/pcb_viewer_tools.cpp @@ -33,8 +33,6 @@ #include #include #include -#include -#include bool PCB_VIEWER_TOOLS::Init()