Move KICAD_T[] to std::initializer_list<KICAD_T>.

This commit is contained in:
Jeff Young
2022-08-20 10:28:11 +01:00
parent 66b8ecb467
commit aa2ad3b44c
93 changed files with 1002 additions and 1813 deletions
+4 -5
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2017 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <[email protected]>
* @author Maciej Suminski <[email protected]>
*
@@ -70,8 +70,7 @@ bool SELECTION::Contains( EDA_ITEM* aItem ) const
/// Returns the center point of the selection area bounding box.
VECTOR2I SELECTION::GetCenter() const
{
KICAD_T textTypes[] = { SCH_TEXT_T, SCH_LABEL_LOCATE_ANY_T, EOT };
bool hasOnlyText = true;
bool hasOnlyText = true;
// If the selection contains only texts calculate the center as the mean of all positions
// instead of using the center of the total bounding box. Otherwise rotating the selection will
@@ -79,7 +78,7 @@ VECTOR2I SELECTION::GetCenter() const
for( EDA_ITEM* item : m_items )
{
if( !item->IsType( textTypes ) )
if( !item->IsType( { SCH_TEXT_T, SCH_LABEL_LOCATE_ANY_T } ) )
{
hasOnlyText = false;
break;
@@ -101,7 +100,7 @@ VECTOR2I SELECTION::GetCenter() const
for( EDA_ITEM* item : m_items )
{
if( !item->IsType( textTypes ) )
if( !item->IsType( { SCH_TEXT_T, SCH_LABEL_LOCATE_ANY_T } ) )
bbox.Merge( item->GetBoundingBox() );
}