Code formatting

This commit is contained in:
Maciej Suminski 2017-09-18 11:25:32 +02:00
parent 5e70810161
commit 25abe30c72
5 changed files with 26 additions and 17 deletions

View File

@ -763,8 +763,8 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) ); AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
msg = AddHotkeyName( _( "Select Items On PCB"), g_Schematic_Hokeys_Descr, HK_SELECT_ITEMS_ON_PCB ); msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr, HK_SELECT_ITEMS_ON_PCB );
AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm )); AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
wxMenu* orientmenu = new wxMenu; wxMenu* orientmenu = new wxMenu;

View File

@ -833,32 +833,33 @@ void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
m_canvas->Refresh(); m_canvas->Refresh();
} }
void SCH_EDIT_FRAME::SelectAllFromSheet( wxCommandEvent& aEvent ) void SCH_EDIT_FRAME::SelectAllFromSheet( wxCommandEvent& aEvent )
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem(); SCH_ITEM* item = screen->GetCurItem();
if( item != NULL ) if( item != NULL )
{ {
item = LocateAndShowItem( item->GetPosition() ); item = LocateAndShowItem( item->GetPosition() );
SendMessageToPCBNEW(item, NULL); SendMessageToPCBNEW( item, NULL );
} }
else else
{ {
// If we didn't get here by a hot key, then something has gone wrong. // If we didn't get here by a hot key, then something has gone wrong.
if( aEvent.GetInt() == 0 ) if( aEvent.GetInt() == 0 )
return; return;
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject(); EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) ); wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
item = LocateAndShowItem( data->GetPosition() ); item = LocateAndShowItem( data->GetPosition() );
SendMessageToPCBNEW(item, NULL); SendMessageToPCBNEW( item, NULL );
}
}
} }
void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();

View File

@ -1564,17 +1564,20 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint )
} }
std::list<TRACK*> BOARD::GetTracksByPosition( const wxPoint& aPosition, PCB_LAYER_ID aLayer ) const std::list<TRACK*> BOARD::GetTracksByPosition( const wxPoint& aPosition, PCB_LAYER_ID aLayer ) const
{ {
std::list<TRACK*> tracks; std::list<TRACK*> tracks;
for( TRACK *track = GetFirstTrack( m_Track); track; track = GetFirstTrack( track->Next() ) )
for( TRACK* track = GetFirstTrack( m_Track ); track; track = GetFirstTrack( track->Next() ) )
{ {
if( ( ( track->GetStart() == aPosition) || track->GetEnd() == aPosition ) && if( ( ( track->GetStart() == aPosition ) || track->GetEnd() == aPosition ) &&
( track->GetState( BUSY | IS_DELETED ) == 0 ) && ( track->GetState( BUSY | IS_DELETED ) == 0 ) &&
( ( aLayer == UNDEFINED_LAYER ) || ( track->IsOnLayer( aLayer ) ) ) ) ( ( aLayer == UNDEFINED_LAYER ) || ( track->IsOnLayer( aLayer ) ) ) )
tracks.push_back( track ); tracks.push_back( track );
} }
return tracks; return tracks;
} }

View File

@ -498,6 +498,9 @@ inline VIA* GetFirstVia( TRACK* aTrk, const TRACK* aStopPoint = NULL )
else else
return NULL; return NULL;
} }
/// Scan a track list for the first TRACK object. Returns NULL if not found (or NULL passed)
inline TRACK* GetFirstTrack( TRACK* aTrk, const TRACK* aStopPoint = NULL ) inline TRACK* GetFirstTrack( TRACK* aTrk, const TRACK* aStopPoint = NULL )
{ {
while( aTrk && ( aTrk != aStopPoint ) && ( aTrk->Type() != PCB_TRACE_T ) ) while( aTrk && ( aTrk != aStopPoint ) && ( aTrk->Type() != PCB_TRACE_T ) )

View File

@ -915,10 +915,12 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetpath )
// auto select trivial connections segments which are launched from the pads // auto select trivial connections segments which are launched from the pads
std::list<TRACK*> launchTracks; std::list<TRACK*> launchTracks;
for( auto pad : padList ) for( auto pad : padList )
{ {
launchTracks = board()->GetTracksByPosition( pad->GetPosition() ); launchTracks = board()->GetTracksByPosition( pad->GetPosition() );
for ( auto track : launchTracks )
for( auto track : launchTracks )
{ {
selectAllItemsConnectedToTrack( *track ); selectAllItemsConnectedToTrack( *track );
} }