From bd8980596fcdfbb7c1cc382f0eba75df5855d0a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= Date: Sun, 21 May 2017 22:18:22 +0200 Subject: [PATCH] Some code cleanup to follow kicad style better --- pcbnew/kicad_clipboard.cpp | 6 +++--- pcbnew/kicad_clipboard.h | 6 +++--- pcbnew/tools/pcbnew_control.cpp | 21 +++++++-------------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 5cf3900d1f..18f5d549fa 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -53,7 +53,7 @@ STRING_FORMATTER* CLIPBOARD_IO::GetFormatter() return &m_formatter; } -void CLIPBOARD_IO::setBoard(BOARD* aBoard) +void CLIPBOARD_IO::setBoard( BOARD* aBoard ) { m_board = aBoard; } @@ -114,8 +114,8 @@ void CLIPBOARD_IO::SaveSelection( SELECTION& aSelected ) // If it is only a module, clear the nets from the pads if( clone->Type() == PCB_PAD_T ) { - D_PAD* pad = static_cast(clone); - pad->SetNetCode(0,0); + D_PAD* pad = static_cast( clone ); + pad->SetNetCode( 0, 0 ); } module.Add( clone ); diff --git a/pcbnew/kicad_clipboard.h b/pcbnew/kicad_clipboard.h index bb002a8286..a44645647b 100644 --- a/pcbnew/kicad_clipboard.h +++ b/pcbnew/kicad_clipboard.h @@ -46,7 +46,7 @@ public: MODULE* parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERROR, PARSE_ERROR, FUTURE_FORMAT_ERROR ) override { - MODULE* mod = PCB_PARSER::parseMODULE(aInitialComments); + MODULE* mod = PCB_PARSER::parseMODULE( aInitialComments ); //TODO: figure out better way of handling paths mod->SetPath( wxT( "" ) ); @@ -74,8 +74,8 @@ public: CLIPBOARD_IO(); ~CLIPBOARD_IO(); - void setBoard(BOARD* aBoard); - void writeHeader(BOARD* aBoard); + void setBoard( BOARD* aBoard ); + void writeHeader( BOARD* aBoard ); STRING_FORMATTER* GetFormatter(); diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 7a0263286a..e3099f0f5f 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -746,15 +746,7 @@ int PCBNEW_CONTROL::AppendBoardFromClipboard( const TOOL_EVENT& aEvent ) // or a single module PCB_BASE_FRAME* frame = getEditFrame(); - if(frame->IsType( FRAME_PCB) ) - { - - } - else if( frame->IsType( FRAME_PCB_MODULE_EDITOR ) ) - { - - } - else + if( !( frame->IsType( FRAME_PCB ) ) && !( frame->IsType( FRAME_PCB_MODULE_EDITOR ) ) ) { return 1; } @@ -817,14 +809,14 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName ) { PCB_EDIT_FRAME* editFrame = dynamic_cast( m_frame ); - if(!editFrame) + if( !editFrame ) return 1; // Mark existing tracks, in order to know what are the new tracks // Tracks are inserted, not appended, so mark existing tracks to be // able to select the new tracks only later BOARD* board = getModel(); - if(!board) + if( !board ) return 1; for( TRACK* track = board->m_Track; track; track = track->Next() ) @@ -1025,9 +1017,10 @@ void PCBNEW_CONTROL::setTransitions() Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() ); // Append control - Go( &PCBNEW_CONTROL::AppendBoardFromFile,PCB_ACTIONS::appendBoard.MakeEvent() ); - Go( &PCBNEW_CONTROL::AppendBoardFromClipboard - ,PCB_ACTIONS::appendClipboard.MakeEvent() ); + Go( &PCBNEW_CONTROL::AppendBoardFromFile, + PCB_ACTIONS::appendBoard.MakeEvent() ); + Go( &PCBNEW_CONTROL::AppendBoardFromClipboard, + PCB_ACTIONS::appendClipboard.MakeEvent() ); }