Improve formatting.

This commit is contained in:
Jeff Young 2020-10-31 17:25:08 +00:00
parent 843974b0bf
commit 6bf29deb7f
3 changed files with 27 additions and 14 deletions

View File

@ -35,7 +35,9 @@ class SHAPE_SIMPLE;
class SHAPE_COMPOUND : public SHAPE class SHAPE_COMPOUND : public SHAPE
{ {
public: public:
SHAPE_COMPOUND() : SHAPE( SH_COMPOUND ), m_dirty( true ) SHAPE_COMPOUND() :
SHAPE( SH_COMPOUND ),
m_dirty( true )
{ {
} }

View File

@ -214,8 +214,10 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE
copy = static_cast<BOARD_ITEM*>( item->Clone() ); copy = static_cast<BOARD_ITEM*>( item->Clone() );
} }
auto prepItem = [&]( BOARD_ITEM* titem ) { auto prepItem = [&]( BOARD_ITEM* titem )
// locked means "locked in place"; copied items therefore can't be locked {
// locked means "locked in place"; copied items therefore can't
// be locked
if( MODULE* module = dyn_cast<MODULE*>( titem ) ) if( MODULE* module = dyn_cast<MODULE*>( titem ) )
module->SetLocked( false ); module->SetLocked( false );
else if( TRACK* track = dyn_cast<TRACK*>( titem ) ) else if( TRACK* track = dyn_cast<TRACK*>( titem ) )
@ -234,9 +236,10 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE
if( copy->Type() == PCB_GROUP_T ) if( copy->Type() == PCB_GROUP_T )
{ {
static_cast<PCB_GROUP*>( copy )->RunOnDescendants( prepItem ); static_cast<PCB_GROUP*>( copy )->RunOnDescendants( prepItem );
static_cast<PCB_GROUP*>( copy )->RunOnDescendants( [&]( BOARD_ITEM* titem ) { static_cast<PCB_GROUP*>( copy )->RunOnDescendants( [&]( BOARD_ITEM* titem )
Format( titem, 1 ); {
} ); Format( titem, 1 );
} );
} }
delete copy; delete copy;
@ -252,8 +255,8 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE
if( !clipboardLock || !clipboard->IsOpened() ) if( !clipboardLock || !clipboard->IsOpened() )
return; return;
clipboard->SetData( new wxTextDataObject( clipboard->SetData( new wxTextDataObject( wxString( m_formatter.GetString().c_str(),
wxString( m_formatter.GetString().c_str(), wxConvUTF8 ) ) ); wxConvUTF8 ) ) );
clipboard->Flush(); clipboard->Flush();

View File

@ -975,7 +975,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_MODULE_T )
{ {
for( auto pad : static_cast<MODULE*>( item )->Pads() ) for( D_PAD* pad : static_cast<MODULE*>( item )->Pads() )
{ {
if( pad->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest ) if( pad->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
items.push_back( pad ); items.push_back( pad );
@ -985,7 +985,9 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
{ {
PCB_GROUP *group = static_cast<PCB_GROUP*>( item ); PCB_GROUP *group = static_cast<PCB_GROUP*>( item );
group->RunOnDescendants( [ &queued_items ]( BOARD_ITEM *aItem ) group->RunOnDescendants( [ &queued_items ]( BOARD_ITEM *aItem )
{ queued_items.push_back( aItem );} ); {
queued_items.push_back( aItem );
} );
} }
else if( BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) ) else if( BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
{ {
@ -994,10 +996,16 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
} }
} }
if( items.empty() || std::none_of( items.begin(), items.end(), []( const BOARD_ITEM* aItem ) if( items.empty() || std::none_of( items.begin(), items.end(),
{ return( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_PAD_T || []( const BOARD_ITEM* aItem )
aItem->Type() == PCB_ARC_T || aItem->Type() == PCB_ZONE_AREA_T || {
aItem->Type() == PCB_MODULE_T || aItem->Type() == PCB_VIA_T ); } ) ) return( aItem->Type() == PCB_TRACE_T
|| aItem->Type() == PCB_PAD_T
|| aItem->Type() == PCB_ARC_T
|| aItem->Type() == PCB_ZONE_AREA_T
|| aItem->Type() == PCB_MODULE_T
|| aItem->Type() == PCB_VIA_T );
} ) )
{ {
return; return;
} }