Formatting and a bit of cleanup.

This commit is contained in:
Jeff Young 2022-10-21 18:41:21 +01:00
parent d16b23d16e
commit ce2dbdec75
7 changed files with 31 additions and 59 deletions

View File

@ -47,7 +47,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
// note the net name and the layer can be changed, so we must save all zones
deletedList.ClearListAndDeleteItems();
pickedList.ClearListAndDeleteItems();
SaveCopyOfZones( pickedList, GetBoard(), -1, UNDEFINED_LAYER );
SaveCopyOfZones( pickedList, GetBoard() );
if( aZone->GetIsRuleArea() )
{

View File

@ -48,7 +48,7 @@ void PCBNEW_PRINTOUT_SETTINGS::Load( APP_SETTINGS_BASE* aConfig )
{
BOARD_PRINTOUT_SETTINGS::Load( aConfig );
if( auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
{
m_DrillMarks = static_cast<DRILL_MARK_SHAPE_T>( cfg->m_Plot.pads_drill_mode );
m_Pagination = static_cast<PAGINATION_T>( cfg->m_Plot.all_layers_on_one_page );
@ -62,7 +62,7 @@ void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
{
BOARD_PRINTOUT_SETTINGS::Save( aConfig );
if( auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aConfig ) )
{
cfg->m_Plot.pads_drill_mode = m_DrillMarks;
cfg->m_Plot.all_layers_on_one_page = m_Pagination;
@ -73,7 +73,7 @@ void PCBNEW_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
PCBNEW_PRINTOUT::PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
const KIGFX::VIEW* aView, const wxString& aTitle ) :
const KIGFX::VIEW* aView, const wxString& aTitle ) :
BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams )
{
m_board = aBoard;
@ -296,8 +296,8 @@ int KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const
VECTOR2D KIGFX::PCB_PRINT_PAINTER::getDrillSize( const PAD* aPad ) const
{
return m_drillMarkReal ? KIGFX::PCB_PAINTER::getDrillSize( aPad ) :
VECTOR2D( m_drillMarkSize, m_drillMarkSize );
return m_drillMarkReal ? KIGFX::PCB_PAINTER::getDrillSize( aPad )
: VECTOR2D( m_drillMarkSize, m_drillMarkSize );
}

View File

@ -738,8 +738,8 @@ void BRDITEMS_PLOTTER::PlotFootprintShape( const FP_SHAPE* aShape )
for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
{
SHAPE_LINE_CHAIN &poly = tmpPoly.Outline( jj );
m_plotter->PlotPoly( poly, aShape->IsFilled() ?
FILL_T::FILLED_SHAPE : FILL_T::NO_FILL,
m_plotter->PlotPoly( poly, aShape->IsFilled() ? FILL_T::FILLED_SHAPE
: FILL_T::NO_FILL,
thickness, &gbr_metadata );
}
}

View File

@ -94,10 +94,8 @@ bool PLUGIN::FootprintExists( const wxString& aLibraryPath, const wxString& aFoo
}
FOOTPRINT* PLUGIN::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName,
bool aKeepUUID,
const PROPERTIES* aProperties )
FOOTPRINT* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
bool aKeepUUID, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
not_implemented( this, __FUNCTION__ );

View File

@ -906,12 +906,10 @@ void ZONE::HatchBorder()
// Iterate through all vertices
for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
{
double x, y;
const SEG seg = *iterator;
double x, y;
SEG segment = *iterator;
if( FindLineSegmentIntersection( a, slope, segment.A.x, segment.A.y, segment.B.x,
segment.B.y, x, y ) )
if( FindLineSegmentIntersection( a, slope, seg.A.x, seg.A.y, seg.B.x, seg.B.y, x, y ) )
pointbuffer.emplace_back( KiROUND( x ), KiROUND( y ) );
}
@ -976,7 +974,7 @@ void ZONE::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_ZONE_T || aImage->Type() == PCB_FP_ZONE_T );
std::swap( *((ZONE*) this), *((ZONE*) aImage) );
std::swap( *static_cast<ZONE*>( this ), *static_cast<ZONE*>( aImage) );
}
@ -984,8 +982,8 @@ void ZONE::CacheTriangulation( PCB_LAYER_ID aLayer )
{
if( aLayer == UNDEFINED_LAYER )
{
for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
pair.second->CacheTriangulation();
for( auto& [ layer, poly ] : m_FilledPolysList )
poly->CacheTriangulation();
m_Poly->CacheTriangulation( false );
}
@ -1070,9 +1068,11 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
bool smooth_requested = m_cornerSmoothingType == ZONE_SETTINGS::SMOOTHING_CHAMFER
|| m_cornerSmoothingType == ZONE_SETTINGS::SMOOTHING_FILLET;
if( IsTeardropArea() ) // We use teardrop shapes with no smoothing
// these shapes are already optimized
if( IsTeardropArea() )
{
// We use teardrop shapes with no smoothing; these shapes are already optimized
smooth_requested = false;
}
if( board )
{

View File

@ -1,12 +1,8 @@
/**
* @file zones_functions_for_undo_redo.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras <jp.charras@wanadoo.fr>
* Copyright (C) 2007-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2007-2022 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -45,8 +41,6 @@
#include <board.h>
#include <zone.h>
#include <pcbnew.h>
#include <zones.h>
#include <zones_functions_for_undo_redo.h>
@ -138,36 +132,17 @@ bool ZONE::IsSame( const ZONE& aZoneToCompare )
* Later, UpdateCopyOfZonesList will change and update these pickers after a zone editing
* @param aPickList = the pick list
* @param aPcb = the Board
* @param aNetCode = the reference netcode. if aNetCode < 0 all netcodes are used
* @param aLayer = the layer of zones. if aLayer < 0, all layers are used
* @return the count of saved copies
*/
int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, int aLayer )
void SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb )
{
int copyCount = 0;
for( unsigned ii = 0; ; ii++ )
for( ZONE* zone : aPcb->Zones() )
{
ZONE* zone = aPcb->GetArea( ii );
if( zone == nullptr ) // End of list
break;
if( aNetCode >= 0 && aNetCode != zone->GetNetCode() )
continue;
if( aLayer >= 0 && !zone->GetLayerSet().test( aLayer ) )
continue;
ZONE* zoneDup = new ZONE( *zone );
zoneDup->SetParent( aPcb );
ITEM_PICKER picker( nullptr, zone, UNDO_REDO::CHANGED );
picker.SetLink( zoneDup );
aPickList.PushItem( picker );
copyCount++;
}
return copyCount;
}
@ -206,9 +181,8 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, in
* must have been removed (removed for new and deleted zones, or moved in aPickList.)
* If not an error is set.
*/
void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
PICKED_ITEMS_LIST& aAuxiliaryList,
BOARD* aPcb )
void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList, PICKED_ITEMS_LIST& aAuxiliaryList,
BOARD* aPcb )
{
for( unsigned kk = 0; kk < aPickList.GetCount(); kk++ )
{
@ -266,12 +240,13 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
if( notfound ) // happens when the new zone overlaps an existing zone
// and these zones are combined
{
#if defined(DEBUG)
#if defined(DEBUG)
printf( "UpdateCopyOfZonesList(): item not found in aAuxiliaryList,"
"combined with another zone\n" );
fflush(nullptr);
#endif
#endif
}
break;
}
@ -309,7 +284,9 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
aAuxiliaryList.RemovePicker( ii );
}
else
{
ii++;
}
}
// Should not occur:

View File

@ -51,11 +51,8 @@
* and fill a pick list with pickers to handle these copies
* @param aPickList = the pick list
* @param aPcb = the Board
* @param aNetCode = the reference netcode. if aNetCode < 0 all netcodes are used
* @param aLayer = the layer of zones. if aLayer < 0, all layers are used
* @return the count of saved copies
*/
int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, int aLayer );
void SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb );
/**