Some code cleanup to follow kicad style better

This commit is contained in:
Kristoffer Ödmark 2017-05-21 22:18:22 +02:00 committed by Tomasz Włostowski
parent 6a02ee6c4b
commit bd8980596f
3 changed files with 13 additions and 20 deletions

View File

@ -53,7 +53,7 @@ STRING_FORMATTER* CLIPBOARD_IO::GetFormatter()
return &m_formatter; return &m_formatter;
} }
void CLIPBOARD_IO::setBoard(BOARD* aBoard) void CLIPBOARD_IO::setBoard( BOARD* aBoard )
{ {
m_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 it is only a module, clear the nets from the pads
if( clone->Type() == PCB_PAD_T ) if( clone->Type() == PCB_PAD_T )
{ {
D_PAD* pad = static_cast<D_PAD*>(clone); D_PAD* pad = static_cast<D_PAD*>( clone );
pad->SetNetCode(0,0); pad->SetNetCode( 0, 0 );
} }
module.Add( clone ); module.Add( clone );

View File

@ -46,7 +46,7 @@ public:
MODULE* parseMODULE( wxArrayString* aInitialComments ) MODULE* parseMODULE( wxArrayString* aInitialComments )
throw( IO_ERROR, PARSE_ERROR, FUTURE_FORMAT_ERROR ) override 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 //TODO: figure out better way of handling paths
mod->SetPath( wxT( "" ) ); mod->SetPath( wxT( "" ) );
@ -74,8 +74,8 @@ public:
CLIPBOARD_IO(); CLIPBOARD_IO();
~CLIPBOARD_IO(); ~CLIPBOARD_IO();
void setBoard(BOARD* aBoard); void setBoard( BOARD* aBoard );
void writeHeader(BOARD* aBoard); void writeHeader( BOARD* aBoard );
STRING_FORMATTER* GetFormatter(); STRING_FORMATTER* GetFormatter();

View File

@ -746,15 +746,7 @@ int PCBNEW_CONTROL::AppendBoardFromClipboard( const TOOL_EVENT& aEvent )
// or a single module // or a single module
PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>(); PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
if(frame->IsType( FRAME_PCB) ) if( !( frame->IsType( FRAME_PCB ) ) && !( frame->IsType( FRAME_PCB_MODULE_EDITOR ) ) )
{
}
else if( frame->IsType( FRAME_PCB_MODULE_EDITOR ) )
{
}
else
{ {
return 1; return 1;
} }
@ -817,14 +809,14 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
{ {
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame ); PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
if(!editFrame) if( !editFrame )
return 1; return 1;
// Mark existing tracks, in order to know what are the new tracks // Mark existing tracks, in order to know what are the new tracks
// Tracks are inserted, not appended, so mark existing tracks to be // Tracks are inserted, not appended, so mark existing tracks to be
// able to select the new tracks only later // able to select the new tracks only later
BOARD* board = getModel<BOARD>(); BOARD* board = getModel<BOARD>();
if(!board) if( !board )
return 1; return 1;
for( TRACK* track = board->m_Track; track; track = track->Next() ) 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() ); Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );
// Append control // Append control
Go( &PCBNEW_CONTROL::AppendBoardFromFile,PCB_ACTIONS::appendBoard.MakeEvent() ); Go( &PCBNEW_CONTROL::AppendBoardFromFile,
Go( &PCBNEW_CONTROL::AppendBoardFromClipboard PCB_ACTIONS::appendBoard.MakeEvent() );
,PCB_ACTIONS::appendClipboard.MakeEvent() ); Go( &PCBNEW_CONTROL::AppendBoardFromClipboard,
PCB_ACTIONS::appendClipboard.MakeEvent() );
} }