Some more wxPoint/EDA_RECT yeeting.

This commit is contained in:
Jeff Young 2022-08-30 15:13:51 +01:00
parent 570f4fe4a9
commit 0c8787cbb9
21 changed files with 161 additions and 162 deletions

View File

@ -620,7 +620,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter, const std::vector<BOX2D>& obscuri
while( !unobscuredPoly.IsEmpty() )
{
unobscuredCenter = (wxPoint) unobscuredPoly.BBox().Centre();
unobscuredCenter = unobscuredPoly.BBox().Centre();
unobscuredPoly.Deflate( step, 4 );
}

View File

@ -2101,8 +2101,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
for( int jj = 0; jj < arcSegments.SegmentCount(); jj++ )
{
VECTOR2I segStart = (wxPoint) arcSegments.Segment( jj ).A;
VECTOR2I segEnd = (wxPoint) arcSegments.Segment( jj ).B;
VECTOR2I segStart = arcSegments.Segment( jj ).A;
VECTOR2I segEnd = arcSegments.Segment( jj ).B;
loadGraphicStaightSegment( segStart, segEnd, aCadstarLineCodeID, aCadstarSheetID,
aKiCadSchLayerID, aMoveVector, aRotation, aScalingFactor,
@ -2869,7 +2869,7 @@ LIB_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_SYMBOL* aSym
SHAPE_LINE_CHAIN& poly = shape.GetPolyShape().Outline( 0 );
for( size_t ii = 0; ii < poly.GetPointCount(); ++ii )
poly.SetPoint( ii, scalePt( (wxPoint) poly.CPoint( ii ) ) );
poly.SetPoint( ii, scalePt( poly.CPoint( ii ) ) );
}
break;
}

View File

@ -674,7 +674,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
{
wxPoint cursorPos;
VECTOR2I cursorPos;
KICAD_T type = aEvent.Parameter<KICAD_T>();
EE_GRID_HELPER grid( m_toolMgr );
KIGFX::VIEW_CONTROLS* controls = getViewControls();
@ -784,10 +784,8 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
cursorPos = evt->IsPrime() ? (wxPoint) evt->Position()
: (wxPoint) controls->GetMousePosition();
cursorPos = wxPoint( grid.BestSnapAnchor( cursorPos, LAYER_CONNECTABLE, nullptr ) );
cursorPos = evt->IsPrime() ? evt->Position() : controls->GetMousePosition();
cursorPos = grid.BestSnapAnchor( cursorPos, LAYER_CONNECTABLE, nullptr );
controls->ForceCursorPosition( true, cursorPos );
if( evt->IsCancelInteractive() )
@ -853,7 +851,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
}
else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
{
previewItem->SetPosition( (wxPoint)cursorPos );
previewItem->SetPosition( cursorPos );
m_view->ClearPreview();
m_view->AddToPreview( previewItem->Clone() );
m_frame->SetMsgPanel( previewItem );
@ -1599,7 +1597,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
item->SetFlags( IS_NEW );
item->BeginEdit( (wxPoint) cursorPos );
item->BeginEdit( cursorPos );
m_view->ClearPreview();
m_view->AddToPreview( item->Clone() );
@ -1611,7 +1609,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
{
if( evt->IsDblClick( BUT_LEFT )
|| evt->IsAction( &EE_ACTIONS::finishDrawing )
|| !item->ContinueEdit( (wxPoint) cursorPos ) )
|| !item->ContinueEdit( cursorPos ) )
{
item->EndEdit();
item->ClearEditFlags();
@ -1655,7 +1653,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
item->CalcEdit( (wxPoint) cursorPos );
item->CalcEdit( cursorPos );
m_view->ClearPreview();
m_view->AddToPreview( item->Clone() );
m_frame->SetMsgPanel( item );

View File

@ -50,9 +50,7 @@
#include <sch_edit_frame.h>
#include <schematic.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <eeschema_id.h>
#include <status_popup.h>
#include <wx/gdicmn.h>
#include <dialogs/dialog_change_symbols.h>
#include <dialogs/dialog_image_properties.h>
@ -2053,7 +2051,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
{
wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() );
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() );
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_LINE_T } );
std::vector<SCH_LINE*> lines;

View File

@ -560,7 +560,7 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
if( item )
{
m_selectionTool->AddItemToSel( item );
m_frame->FocusOnLocation( (wxPoint)item->GetBoundingBox().GetCenter() );
m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter() );
m_frame->GetCanvas()->Refresh();
}
else

View File

@ -975,7 +975,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
if( !segment )
m_toolMgr->VetoContextMenuMouseWarp();
contextMenuPos = (wxPoint)cursorPos;
contextMenuPos = (wxPoint) cursorPos;
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
@ -1046,7 +1046,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos
else
{
aSegment = static_cast<SCH_LINE*>( aSegment->Duplicate() );
aSegment->SetStartPoint( (wxPoint) aPos );
aSegment->SetStartPoint( aPos );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 CERN
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.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
@ -301,7 +301,7 @@ LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::CreatePin( const VECTOR2I& aPosition, LIB_SYMBO
if( m_frame->SynchronizePins() )
pin->SetFlags( IS_LINKED );
pin->MoveTo((wxPoint) aPosition );
pin->MoveTo( aPosition );
pin->SetLength( GetLastPinLength() );
pin->SetOrientation( g_LastPinOrient );
pin->SetType( g_LastPinType );

View File

@ -169,7 +169,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
// ... and second click places:
else
{
item->GetPeer()->MoveStartPointToUi( (wxPoint) cursorPos );
item->GetPeer()->MoveStartPointToUi( cursorPos );
item->SetPosition( item->GetPeer()->GetStartPosUi( 0 ) );
item->ClearEditFlags();
getView()->Update( item );
@ -194,7 +194,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
}
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
item->GetPeer()->MoveStartPointToUi( (wxPoint) cursorPos );
item->GetPeer()->MoveStartPointToUi( cursorPos );
item->SetPosition( item->GetPeer()->GetStartPosUi( 0 ) );
getView()->Update( item );
}
@ -278,7 +278,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
DS_DATA_ITEM* dataItem = m_frame->AddDrawingSheetItem( type );
dataItem->MoveToUi( (wxPoint) cursorPos );
dataItem->MoveToUi( cursorPos );
item = dataItem->GetDrawItems()[0];
item->SetFlags( IS_NEW );
@ -307,7 +307,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
{
if( item )
{
item->GetPeer()->MoveEndPointToUi( (wxPoint) cursorPos );
item->GetPeer()->MoveEndPointToUi( cursorPos );
item->SetEnd( item->GetPeer()->GetEndPosUi( 0 ) );
getView()->Update( item );
}

View File

@ -423,7 +423,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
{
for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
{
if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
if( drawItem->HitTest( aPos, threshold ) )
{
item = drawItem;
break;

View File

@ -245,7 +245,7 @@ void PL_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, bool* aSelectionCan
{
for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
{
if( drawItem->HitTest( (wxPoint) aWhere, threshold ) )
if( drawItem->HitTest( aWhere, threshold ) )
collector.Append( drawItem );
}
}
@ -317,7 +317,7 @@ void PL_SELECTION_TOOL::guessSelectionCandidates( COLLECTOR& collector, const VE
EDA_ITEM* item = collector[ i ];
EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
if( item->HitTest( (wxPoint) aPos, 0 ) && !other->HitTest( (wxPoint) aPos, 0 ) )
if( item->HitTest( aPos, 0 ) && !other->HitTest( aPos, 0 ) )
collector.Transfer( other );
}
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Created on: 11 Mar 2016, author John Beard
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.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
@ -44,7 +44,7 @@ static void TransformItem( const ARRAY_OPTIONS& aArrOpts, int aIndex, BOARD_ITEM
{
const ARRAY_OPTIONS::TRANSFORM transform = aArrOpts.GetTransform( aIndex, aItem.GetPosition() );
aItem.Move( (wxPoint) transform.m_offset );
aItem.Move( transform.m_offset );
aItem.Rotate( aItem.GetPosition(), transform.m_rotation );
}
@ -57,8 +57,8 @@ void ARRAY_CREATOR::Invoke()
FOOTPRINT* const fp = m_isFootprintEditor ? m_parent.GetBoard()->GetFirstFootprint() : nullptr;
const bool enableArrayNumbering = m_isFootprintEditor;
const wxPoint rotPoint = (wxPoint) m_selection.GetCenter();
const bool enableArrayNumbering = m_isFootprintEditor;
const VECTOR2I rotPoint = m_selection.GetCenter();
std::unique_ptr<ARRAY_OPTIONS> array_opts;

View File

@ -225,11 +225,9 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( crossProbingSettings.center_on_items && bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
{
if( crossProbingSettings.zoom_to_fit )
{
GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
}
FocusOnLocation( (wxPoint) bbox.Centre() );
FocusOnLocation( bbox.Centre() );
}
view->UpdateAllLayersColor();

View File

@ -148,7 +148,7 @@ static const std::vector<NUMBERING_LIST_DATA> numberingTypeData {
DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent,
std::unique_ptr<ARRAY_OPTIONS>& aSettings,
bool aIsFootprintEditor, const wxPoint& aOrigPos ) :
bool aIsFootprintEditor, const VECTOR2I& aOrigPos ) :
DIALOG_CREATE_ARRAY_BASE( aParent ),
m_settings( aSettings ),
m_originalItemPosition( aOrigPos ),

View File

@ -44,12 +44,12 @@ public:
* Construct a new dialog.
*
* @param aParent the parent window
* @param aOptions the options that will be re-seated when dialog is validly closed
* @param aOptions the options that will be updated when dialog is closed with OK
* @param aEnableNumbering enable pad numbering
* @param aOrigPos original item position (used for computing the circular array radius)
*/
DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, std::unique_ptr<ARRAY_OPTIONS>& aOptions,
bool enableNumbering, const wxPoint& aOrigPos );
bool enableNumbering, const VECTOR2I& aOrigPos );
private:
// Event callbacks
@ -69,7 +69,7 @@ private:
/*
* The position of the original item(s), used for finding radius, etc
*/
const wxPoint m_originalItemPosition;
const VECTOR2I m_originalItemPosition;
// Decide whether to display pad numbering options or not
bool m_isFootprintEditor;

View File

@ -480,7 +480,7 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
while( !itemPoly.IsEmpty() )
{
focusPt = (wxPoint) itemPoly.BBox().Centre();
focusPt = itemPoly.BBox().Centre();
try
{

View File

@ -1039,9 +1039,9 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
dimension->SetLayer( layer );
dimension->SetPrecision( DIMENSION_PRECISION );
dimension->SetStart( (wxPoint) pt1 );
dimension->SetEnd( (wxPoint) pt2 );
dimension->Text().SetPosition( (wxPoint) pt3 );
dimension->SetStart( pt1 );
dimension->SetEnd( pt2 );
dimension->Text().SetPosition( pt3 );
dimension->Text().SetTextSize( textSize );
dimension->Text().SetTextThickness( textThickness );
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
@ -1055,9 +1055,9 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
leader->SetLayer( layer );
leader->SetPrecision( DIMENSION_PRECISION );
leader->SetStart( (wxPoint) pt1 );
leader->SetEnd( (wxPoint) pt2 );
leader->Text().SetPosition( (wxPoint) pt3 );
leader->SetStart( pt1 );
leader->SetEnd( pt2 );
leader->Text().SetPosition( pt3 );
leader->Text().SetTextSize( textSize );
leader->Text().SetTextThickness( textThickness );
leader->SetText( wxEmptyString );
@ -1122,7 +1122,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
}
else
{
int offset = GetLineLength( (wxPoint) pt3, (wxPoint) pt1 );
int offset = GetLineLength( pt3, pt1 );
if( pt1.y > pt2.y )
dimension->SetHeight( offset );

View File

@ -89,7 +89,7 @@ void PCB_CONTROL::Reset( RESET_REASON aReason )
if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
{
m_gridOrigin->SetPosition( (wxPoint) board()->GetDesignSettings().GetGridOrigin() );
m_gridOrigin->SetPosition( board()->GetDesignSettings().GetGridOrigin() );
m_gridOrigin->SetColor( m_frame->GetGridColor() );
getView()->Remove( m_gridOrigin.get() );
getView()->Add( m_gridOrigin.get() );
@ -478,7 +478,7 @@ void PCB_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
{
aFrame->GetDesignSettings().SetGridOrigin( wxPoint( aPoint ) );
aView->GetGAL()->SetGridOrigin( aPoint );
originViewItem->SetPosition( (wxPoint) aPoint );
originViewItem->SetPosition( aPoint );
aView->MarkDirty();
aFrame->OnModify();
}

View File

@ -2511,13 +2511,13 @@ bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
collector.Collect( board(), m_isFootprintEditor ? GENERAL_COLLECTOR::FootprintItems
: GENERAL_COLLECTOR::AllBoardItems,
(wxPoint) aPoint, guide );
aPoint, guide );
for( int i = collector.GetCount() - 1; i >= 0; --i )
{
BOARD_ITEM* item = collector[i];
if( item->IsSelected() && item->HitTest( (wxPoint) aPoint, 5 * guide.OnePixelInIU() ) )
if( item->IsSelected() && item->HitTest( aPoint, 5 * guide.OnePixelInIU() ) )
return true;
}

View File

@ -73,7 +73,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
if( newItem )
{
newItem->SetPosition( (wxPoint) aPosition );
newItem->SetPosition( aPosition );
preview.Add( newItem.get() );
if( newItem->Type() == PCB_FOOTPRINT_T )
@ -240,7 +240,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
preview.Clear();
newItem.release();
makeNewItem( (wxPoint) cursorPos );
makeNewItem( cursorPos );
aPlacer->SnapItem( newItem.get() );
view()->Update( &preview );
}
@ -252,7 +252,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
else if( newItem && evt->IsMotion() )
{
// track the cursor
newItem->SetPosition( (wxPoint) cursorPos );
newItem->SetPosition( cursorPos );
aPlacer->SnapItem( newItem.get() );
// Show a preview of the item

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2016 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -35,7 +35,6 @@
#include <board_commit.h>
#include <bitmaps.h>
#include <confirm.h>
#include <menus_helpers.h>
@ -86,9 +85,9 @@ bool ALIGN_DISTRIBUTE_TOOL::Init()
template <class T>
ALIGNMENT_RECTS GetBoundingBoxes( const T& aItems )
std::vector<std::pair<BOARD_ITEM*, BOX2I>> GetBoundingBoxes( const T& aItems )
{
ALIGNMENT_RECTS rects;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> rects;
for( EDA_ITEM* item : aItems )
{
@ -97,12 +96,12 @@ ALIGNMENT_RECTS GetBoundingBoxes( const T& aItems )
if( item->Type() == PCB_FOOTPRINT_T )
{
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
rects.emplace_back( std::make_pair( boardItem,
rects.emplace_back( std::make_pair( footprint,
footprint->GetBoundingBox( false, false ) ) );
}
else
{
rects.emplace_back( std::make_pair( boardItem, item->GetBoundingBox() ) );
rects.emplace_back( std::make_pair( boardItem, boardItem->GetBoundingBox() ) );
}
}
@ -111,17 +110,18 @@ ALIGNMENT_RECTS GetBoundingBoxes( const T& aItems )
template< typename T >
int ALIGN_DISTRIBUTE_TOOL::selectTarget( ALIGNMENT_RECTS& aItems, ALIGNMENT_RECTS& aLocked,
int ALIGN_DISTRIBUTE_TOOL::selectTarget( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aLocked,
T aGetValue )
{
wxPoint curPos = (wxPoint) getViewControls()->GetCursorPosition();
VECTOR2I curPos = getViewControls()->GetCursorPosition();
// Prefer locked items to unlocked items.
// Secondly, prefer items under the cursor to other items.
if( aLocked.size() >= 1 )
{
for( const ALIGNMENT_RECT& item : aLocked )
for( const std::pair<BOARD_ITEM*, BOX2I>& item : aLocked )
{
if( item.second.Contains( curPos ) )
return aGetValue( item );
@ -130,7 +130,7 @@ int ALIGN_DISTRIBUTE_TOOL::selectTarget( ALIGNMENT_RECTS& aItems, ALIGNMENT_RECT
return aGetValue( aLocked.front() );
}
for( const ALIGNMENT_RECT& item : aItems )
for( const std::pair<BOARD_ITEM*, BOX2I>& item : aItems )
{
if( item.second.Contains( curPos ) )
return aGetValue( item );
@ -141,8 +141,9 @@ int ALIGN_DISTRIBUTE_TOOL::selectTarget( ALIGNMENT_RECTS& aItems, ALIGNMENT_RECT
template< typename T >
size_t ALIGN_DISTRIBUTE_TOOL::GetSelections( ALIGNMENT_RECTS& aItemsToAlign,
ALIGNMENT_RECTS& aLockedItems, T aCompare )
size_t ALIGN_DISTRIBUTE_TOOL::GetSelections( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItemsToAlign,
std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aLockedItems,
T aCompare )
{
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
@ -193,11 +194,11 @@ size_t ALIGN_DISTRIBUTE_TOOL::GetSelections( ALIGNMENT_RECTS& aItemsToAlign,
int ALIGN_DISTRIBUTE_TOOL::AlignTop( const TOOL_EVENT& aEvent )
{
ALIGNMENT_RECTS itemsToAlign;
ALIGNMENT_RECTS locked_items;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToAlign;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> locked_items;
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetTop() < right.second.GetTop() );
} ) )
@ -208,13 +209,13 @@ int ALIGN_DISTRIBUTE_TOOL::AlignTop( const TOOL_EVENT& aEvent )
BOARD_COMMIT commit( m_frame );
int targetTop = selectTarget( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT& aVal )
[]( const std::pair<BOARD_ITEM*, BOX2I>& aVal )
{
return aVal.second.GetTop();
} );
// Move the selected items
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : itemsToAlign )
{
BOARD_ITEM* item = i.first;
int difference = targetTop - i.second.GetTop();
@ -227,7 +228,7 @@ int ALIGN_DISTRIBUTE_TOOL::AlignTop( const TOOL_EVENT& aEvent )
item = item->GetParent();
commit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( 0, difference ) );
item->Move( VECTOR2I( 0, difference ) );
}
commit.Push( _( "Align to top" ) );
@ -238,11 +239,11 @@ int ALIGN_DISTRIBUTE_TOOL::AlignTop( const TOOL_EVENT& aEvent )
int ALIGN_DISTRIBUTE_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
{
ALIGNMENT_RECTS itemsToAlign;
ALIGNMENT_RECTS locked_items;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToAlign;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> locked_items;
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetBottom() < right.second.GetBottom() );
} ) )
@ -253,13 +254,13 @@ int ALIGN_DISTRIBUTE_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
BOARD_COMMIT commit( m_frame );
int targetBottom = selectTarget( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT& aVal )
[]( const std::pair<BOARD_ITEM*, BOX2I>& aVal )
{
return aVal.second.GetBottom();
} );
// Move the selected items
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : itemsToAlign )
{
int difference = targetBottom - i.second.GetBottom();
BOARD_ITEM* item = i.first;
@ -272,7 +273,7 @@ int ALIGN_DISTRIBUTE_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
item = item->GetParent();
commit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( 0, difference ) );
item->Move( VECTOR2I( 0, difference ) );
}
commit.Push( _( "Align to bottom" ) );
@ -298,11 +299,11 @@ int ALIGN_DISTRIBUTE_TOOL::AlignLeft( const TOOL_EVENT& aEvent )
int ALIGN_DISTRIBUTE_TOOL::doAlignLeft()
{
ALIGNMENT_RECTS itemsToAlign;
ALIGNMENT_RECTS locked_items;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToAlign;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> locked_items;
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetLeft() < right.second.GetLeft() );
} ) )
@ -313,13 +314,13 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignLeft()
BOARD_COMMIT commit( m_frame );
int targetLeft = selectTarget( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT& aVal )
[]( const std::pair<BOARD_ITEM*, BOX2I>& aVal )
{
return aVal.second.GetLeft();
} );
// Move the selected items
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : itemsToAlign )
{
int difference = targetLeft - i.second.GetLeft();
BOARD_ITEM* item = i.first;
@ -332,7 +333,7 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignLeft()
item = item->GetParent();
commit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( difference, 0 ) );
item->Move( VECTOR2I( difference, 0 ) );
}
commit.Push( _( "Align to left" ) );
@ -358,11 +359,11 @@ int ALIGN_DISTRIBUTE_TOOL::AlignRight( const TOOL_EVENT& aEvent )
int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
{
ALIGNMENT_RECTS itemsToAlign;
ALIGNMENT_RECTS locked_items;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToAlign;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> locked_items;
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetRight() < right.second.GetRight() );
} ) )
@ -373,13 +374,13 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
BOARD_COMMIT commit( m_frame );
int targetRight = selectTarget( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT& aVal )
[]( const std::pair<BOARD_ITEM*, BOX2I>& aVal )
{
return aVal.second.GetRight();
} );
// Move the selected items
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : itemsToAlign )
{
int difference = targetRight - i.second.GetRight();
BOARD_ITEM* item = i.first;
@ -392,7 +393,7 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
item = item->GetParent();
commit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( difference, 0 ) );
item->Move( VECTOR2I( difference, 0 ) );
}
commit.Push( _( "Align to right" ) );
@ -403,13 +404,13 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
int ALIGN_DISTRIBUTE_TOOL::AlignCenterX( const TOOL_EVENT& aEvent )
{
ALIGNMENT_RECTS itemsToAlign;
ALIGNMENT_RECTS locked_items;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToAlign;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> locked_items;
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetCenter().x < right.second.GetCenter().x );
return ( left.second.Centre().x < right.second.Centre().x );
} ) )
{
return 0;
@ -418,15 +419,15 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterX( const TOOL_EVENT& aEvent )
BOARD_COMMIT commit( m_frame );
int targetX = selectTarget( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT& aVal )
[]( const std::pair<BOARD_ITEM*, BOX2I>& aVal )
{
return aVal.second.GetCenter().x;
return aVal.second.Centre().x;
} );
// Move the selected items
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : itemsToAlign )
{
int difference = targetX - i.second.GetCenter().x;
int difference = targetX - i.second.Centre().x;
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
@ -437,7 +438,7 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterX( const TOOL_EVENT& aEvent )
item = item->GetParent();
commit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( difference, 0 ) );
item->Move( VECTOR2I( difference, 0 ) );
}
commit.Push( _( "Align to middle" ) );
@ -448,13 +449,13 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterX( const TOOL_EVENT& aEvent )
int ALIGN_DISTRIBUTE_TOOL::AlignCenterY( const TOOL_EVENT& aEvent )
{
ALIGNMENT_RECTS itemsToAlign;
ALIGNMENT_RECTS locked_items;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToAlign;
std::vector<std::pair<BOARD_ITEM*, BOX2I>> locked_items;
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetCenter().y < right.second.GetCenter().y );
return ( left.second.Centre().y < right.second.Centre().y );
} ) )
{
return 0;
@ -463,15 +464,15 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterY( const TOOL_EVENT& aEvent )
BOARD_COMMIT commit( m_frame );
int targetY = selectTarget( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT& aVal )
[]( const std::pair<BOARD_ITEM*, BOX2I>& aVal )
{
return aVal.second.GetCenter().y;
return aVal.second.Centre().y;
} );
// Move the selected items
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : itemsToAlign )
{
int difference = targetY - i.second.GetCenter().y;
int difference = targetY - i.second.Centre().y;
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
@ -482,7 +483,7 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterY( const TOOL_EVENT& aEvent )
item = item->GetParent();
commit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( 0, difference ) );
item->Move( VECTOR2I( 0, difference ) );
}
commit.Push( _( "Align to center" ) );
@ -510,12 +511,13 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
if( selection.Size() <= 1 )
return 0;
BOARD_COMMIT commit( m_frame );
ALIGNMENT_RECTS itemsToDistribute = GetBoundingBoxes( selection );
BOARD_COMMIT commit( m_frame );
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToDistribute = GetBoundingBoxes( selection );
// find the last item by reverse sorting
std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
[] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[] ( const std::pair<BOARD_ITEM*, BOX2I> left,
const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetRight() > right.second.GetRight() );
} );
@ -525,7 +527,8 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
// sort to get starting order
std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
[] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[] ( const std::pair<BOARD_ITEM*, BOX2I> left,
const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetX() < right.second.GetX() );
} );
@ -534,8 +537,8 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
int totalGap = maxRight - minX;
int totalWidth = 0;
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
totalWidth += i.second.GetWidth();
for( const auto& [ item, rect ] : itemsToDistribute )
totalWidth += rect.GetWidth();
if( totalGap < totalWidth )
{
@ -554,15 +557,15 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
}
void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally( ALIGNMENT_RECTS& itemsToDistribute,
void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
BOARD_COMMIT& aCommit,
const BOARD_ITEM* lastItem,
int totalGap ) const
{
const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
int targetX = itemsToDistribute.begin()->second.GetX();
const int itemGap = totalGap / ( aItems.size() - 1 );
int targetX = aItems.begin()->second.GetX();
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : aItems )
{
BOARD_ITEM* item = i.first;
@ -579,27 +582,27 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally( ALIGNMENT_RECTS& items
int difference = targetX - i.second.GetX();
aCommit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( difference, 0 ) );
item->Move( VECTOR2I( difference, 0 ) );
targetX += ( i.second.GetWidth() + itemGap );
}
}
void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally( ALIGNMENT_RECTS &itemsToDistribute,
void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally( std::vector<std::pair<BOARD_ITEM*, BOX2I>> &aItems,
BOARD_COMMIT& aCommit ) const
{
std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
[] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
std::sort( aItems.begin(), aItems.end(),
[] ( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetCenter().x < right.second.GetCenter().x );
return ( left.second.Centre().x < right.second.Centre().x );
} );
const int totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().x
- itemsToDistribute.begin()->second.GetCenter().x;
const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
int targetX = itemsToDistribute.begin()->second.GetCenter().x;
const int totalGap = ( aItems.end() - 1 )->second.Centre().x
- aItems.begin()->second.Centre().x;
const int itemGap = totalGap / ( aItems.size() - 1 );
int targetX = aItems.begin()->second.Centre().x;
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : aItems )
{
BOARD_ITEM* item = i.first;
@ -610,9 +613,9 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally( ALIGNMENT_RECTS &it
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
int difference = targetX - i.second.GetCenter().x;
int difference = targetX - i.second.Centre().x;
aCommit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( difference, 0 ) );
item->Move( VECTOR2I( difference, 0 ) );
targetX += ( itemGap );
}
}
@ -637,12 +640,12 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
if( selection.Size() <= 1 )
return 0;
BOARD_COMMIT commit( m_frame );
ALIGNMENT_RECTS itemsToDistribute = GetBoundingBoxes( selection );
BOARD_COMMIT commit( m_frame );
std::vector<std::pair<BOARD_ITEM*, BOX2I>> itemsToDistribute = GetBoundingBoxes( selection );
// find the last item by reverse sorting
std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
[] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[] ( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetBottom() > right.second.GetBottom() );
} );
@ -652,16 +655,16 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
// sort to get starting order
std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
[] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
[] ( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetCenter().y < right.second.GetCenter().y );
return ( left.second.Centre().y < right.second.Centre().y );
} );
int minY = itemsToDistribute.begin()->second.GetY();
int totalGap = maxBottom - minY;
int totalHeight = 0;
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : itemsToDistribute )
totalHeight += i.second.GetHeight();
if( totalGap < totalHeight )
@ -681,15 +684,15 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
}
void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically( ALIGNMENT_RECTS& itemsToDistribute,
void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
BOARD_COMMIT& aCommit,
const BOARD_ITEM* lastItem,
int totalGap ) const
{
const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
int targetY = itemsToDistribute.begin()->second.GetY();
const int itemGap = totalGap / ( aItems.size() - 1 );
int targetY = aItems.begin()->second.GetY();
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
for( std::pair<BOARD_ITEM*, BOX2I>& i : aItems )
{
BOARD_ITEM* item = i.first;
@ -706,27 +709,27 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically( ALIGNMENT_RECTS& itemsTo
int difference = targetY - i.second.GetY();
aCommit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( 0, difference ) );
item->Move( VECTOR2I( 0, difference ) );
targetY += ( i.second.GetHeight() + itemGap );
}
}
void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically( ALIGNMENT_RECTS& itemsToDistribute,
void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
BOARD_COMMIT& aCommit ) const
{
std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
[] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
std::sort( aItems.begin(), aItems.end(),
[] ( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetCenter().y < right.second.GetCenter().y );
return ( left.second.Centre().y < right.second.Centre().y );
} );
const int totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().y
- itemsToDistribute.begin()->second.GetCenter().y;
const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
int targetY = itemsToDistribute.begin()->second.GetCenter().y;
const int totalGap = ( aItems.end() - 1 )->second.Centre().y
- aItems.begin()->second.Centre().y;
const int itemGap = totalGap / ( aItems.size() - 1 );
int targetY = aItems.begin()->second.Centre().y;
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
for( const std::pair<BOARD_ITEM*, BOX2I>& i : aItems )
{
BOARD_ITEM* item = i.first;
@ -737,9 +740,9 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically( ALIGNMENT_RECTS& item
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
int difference = targetY - i.second.GetCenter().y;
int difference = targetY - i.second.Centre().y;
aCommit.Stage( item, CHT_MODIFY );
item->Move( wxPoint( 0, difference ) );
item->Move( VECTOR2I( 0, difference ) );
targetY += ( itemGap );
}
}

View File

@ -32,8 +32,6 @@
#include <board_item.h>
#include <pcb_base_frame.h>
using ALIGNMENT_RECT = std::pair<BOARD_ITEM*, EDA_RECT>;
using ALIGNMENT_RECTS = std::vector<ALIGNMENT_RECT>;
class PCB_SELECTION_TOOL;
@ -105,11 +103,13 @@ private:
* Returns the size of aItemsToAlign()
*/
template< typename T >
size_t GetSelections( ALIGNMENT_RECTS& aItemsToAlign, ALIGNMENT_RECTS& aLockedItems,
size_t GetSelections( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItemsToAlign,
std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aLockedItems,
T aCompare );
template< typename T >
int selectTarget( ALIGNMENT_RECTS& aItems, ALIGNMENT_RECTS& aLocked, T aGetValue );
int selectTarget( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aLocked, T aGetValue );
/**
* Sets X coordinate of the selected items to the value of the left-most selected item
@ -136,7 +136,7 @@ private:
* since items of differing widths will be placed with different gaps. Is only used if
* items overlap.
*/
void doDistributeCentersHorizontally( ALIGNMENT_RECTS& itemsToDistribute,
void doDistributeCentersHorizontally( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
BOARD_COMMIT& aCommit ) const;
/**
@ -147,7 +147,7 @@ private:
* since items of differing widths will be placed with different gaps. Is only used
* if items overlap
*/
void doDistributeCentersVertically( ALIGNMENT_RECTS& itemsToDistribute,
void doDistributeCentersVertically( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
BOARD_COMMIT& aCommit ) const;
/**
@ -156,8 +156,9 @@ private:
* @note Using the edges of bounding box of items is only possible if there is enough space
* between them. If this is not the case, use the center spacing method
*/
void doDistributeGapsHorizontally( ALIGNMENT_RECTS& itemsToDistribute, BOARD_COMMIT& aCommit,
const BOARD_ITEM* lastItem, int totalGap ) const;
void doDistributeGapsHorizontally( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
BOARD_COMMIT& aCommit, const BOARD_ITEM* lastItem,
int totalGap ) const;
/**
* Distributes selected items using an even spacing between their bounding boxes
@ -165,8 +166,9 @@ private:
* @note Using the edges of bounding box of items is only possible if there is enough space
* between them. If this is not the case, use the center spacing method
*/
void doDistributeGapsVertically( ALIGNMENT_RECTS& itemsToDistribute, BOARD_COMMIT& aCommit,
const BOARD_ITEM* lastItem, int totalGap ) const;
void doDistributeGapsVertically( std::vector<std::pair<BOARD_ITEM*, BOX2I>>& aItems,
BOARD_COMMIT& aCommit, const BOARD_ITEM* lastItem,
int totalGap ) const;
private:
PCB_SELECTION_TOOL* m_selectionTool;