From 8cb3aa79f2ec4b39920b108669e0272fedb23110 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 8 May 2018 10:36:50 +0200 Subject: [PATCH] pcbnew_control.cpp code formatting --- pcbnew/tools/pcbnew_control.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 9340f3d461..9b2c9aa6f7 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -828,19 +828,17 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent ) return 0; } + int PCBNEW_CONTROL::PasteItemsFromClipboard( const TOOL_EVENT& aEvent ) { CLIPBOARD_IO pi; - BOARD tmpBoard; BOARD_ITEM* clipItem = pi.Parse(); if( !clipItem ) - { return 0; - } if( clipItem->Type() == PCB_T ) - static_cast(clipItem)->ClearAllNetCodes(); + static_cast( clipItem )->ClearAllNetCodes(); bool editModules = m_editModules || frame()->IsType( FRAME_PCB_MODULE_EDITOR ); @@ -853,7 +851,6 @@ int PCBNEW_CONTROL::PasteItemsFromClipboard( const TOOL_EVENT& aEvent ) return 0; } - switch( clipItem->Type() ) { case PCB_T: @@ -864,28 +861,29 @@ int PCBNEW_CONTROL::PasteItemsFromClipboard( const TOOL_EVENT& aEvent ) return 0; } - placeBoardItems( static_cast( clipItem ) ); + placeBoardItems( static_cast( clipItem ) ); break; } case PCB_MODULE_T: { - std::vector items; + std::vector items; clipItem->SetParent( board() ); if( editModules ) { - auto mod = static_cast( clipItem ); + auto mod = static_cast( clipItem ); for( auto pad : mod->Pads() ) { - pad->SetParent ( board()->m_Modules.GetFirst() ); + pad->SetParent( board()->m_Modules.GetFirst() ); items.push_back( pad ); } + for( auto item : mod->GraphicalItems() ) { - item->SetParent ( board()->m_Modules.GetFirst() ); + item->SetParent( board()->m_Modules.GetFirst() ); items.push_back( item ); } } @@ -897,14 +895,16 @@ int PCBNEW_CONTROL::PasteItemsFromClipboard( const TOOL_EVENT& aEvent ) placeBoardItems( items, true ); break; } + default: m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) ); - // FAILED break; } + return 1; } + int PCBNEW_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent ) { int open_ctl; @@ -925,6 +925,7 @@ int PCBNEW_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent ) return AppendBoard( *pi, fileName ); } + int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard ) { std::vector items; @@ -1078,7 +1079,6 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName ) brd->SetEnabledLayers( enabledLayers ); brd->SetVisibleLayers( enabledLayers ); - return placeBoardItems( brd ); }