selection_tool.* add comments and use better names for 2 similar methods.

This commit is contained in:
jean-pierre charras 2017-03-04 17:30:44 +01:00
parent 5b3d7962bb
commit 7a120ad698
4 changed files with 19 additions and 14 deletions

View File

@ -82,7 +82,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
msg.Printf( _( "Selecting all from sheet '%s'" ), FROM_UTF8( text ) );
wxString sheetStamp( FROM_UTF8( text ) );
SetStatusText( msg );
GetToolManager()->RunAction( PCB_ACTIONS::selectOnSheet, true,
GetToolManager()->RunAction( PCB_ACTIONS::selectOnSheetFromEeschema, true,
static_cast<void*>( &sheetStamp ) );
return;
}

View File

@ -67,10 +67,10 @@ public:
/// Selects all connections belonging to a single net.
static TOOL_ACTION selectNet;
/// Selects all components on sheet.
static TOOL_ACTION selectOnSheet;
/// Selects all components on sheet from Eeschema crossprobing.
static TOOL_ACTION selectOnSheetFromEeschema;
/// Selects all components on the same sheet.
/// Selects all components on the same sheet as the selected footprint.
static TOOL_ACTION selectSameSheet;
/// Filters the items in the current selection (invokes dialog)

View File

@ -89,12 +89,12 @@ TOOL_ACTION PCB_ACTIONS::selectNet( "pcbnew.InteractiveSelection.SelectNet",
AS_GLOBAL, 0,
_( "Whole Net" ), _( "Selects all tracks & vias belonging to the same net." ) );
TOOL_ACTION PCB_ACTIONS::selectOnSheet( "pcbnew.InteractiveSelection.SelectOnSheet",
TOOL_ACTION PCB_ACTIONS::selectOnSheetFromEeschema( "pcbnew.InteractiveSelection.SelectOnSheet",
AS_GLOBAL, 0,
_( "Sheet" ), _( "Selects all modules and tracks in the schematic sheet" ) );
TOOL_ACTION PCB_ACTIONS::selectSameSheet( "pcbnew.InteractiveSelection.SelectSameSheet",
AS_GLOBAL, 'P',
AS_GLOBAL, 0,
_( "Items in Same Hierarchical Sheet" ),
_( "Selects all modules and tracks in the same schematic sheet" ) );
@ -106,7 +106,7 @@ TOOL_ACTION PCB_ACTIONS::findMove( "pcbnew.InteractiveSelection.FindMove",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GET_AND_MOVE_FOOTPRINT ) );
TOOL_ACTION PCB_ACTIONS::filterSelection( "pcbnew.InteractiveSelection.FilterSelection",
AS_GLOBAL, MD_SHIFT + 'F',
AS_GLOBAL, 0,
_( "Filter Selection" ), _( "Filter the types of items in the selection" ),
nullptr );
@ -547,7 +547,7 @@ void SELECTION_TOOL::SetTransitions()
Go( &SELECTION_TOOL::selectCopper, PCB_ACTIONS::selectCopper.MakeEvent() );
Go( &SELECTION_TOOL::selectNet, PCB_ACTIONS::selectNet.MakeEvent() );
Go( &SELECTION_TOOL::selectSameSheet, PCB_ACTIONS::selectSameSheet.MakeEvent() );
Go( &SELECTION_TOOL::selectOnSheet, PCB_ACTIONS::selectOnSheet.MakeEvent() );
Go( &SELECTION_TOOL::selectOnSheetFromEeschema, PCB_ACTIONS::selectOnSheetFromEeschema.MakeEvent() );
}
@ -881,11 +881,13 @@ void SELECTION_TOOL::zoomFitSelection( void )
m_frame->GetGalCanvas()->ForceRefresh();
}
int SELECTION_TOOL::selectOnSheet( const TOOL_EVENT& aEvent )
int SELECTION_TOOL::selectOnSheetFromEeschema( const TOOL_EVENT& aEvent )
{
clearSelection();
wxString* sheet = aEvent.Parameter<wxString*>();
selectAllItemsOnSheet( *sheet );
wxString* sheetpath = aEvent.Parameter<wxString*>();
selectAllItemsOnSheet( *sheetpath );
zoomFitSelection();
@ -896,6 +898,7 @@ int SELECTION_TOOL::selectOnSheet( const TOOL_EVENT& aEvent )
return 0;
}
int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
{
if( !selectCursor( true ) )

View File

@ -195,10 +195,12 @@ private:
*/
void selectAllItemsOnSheet( wxString& aSheetpath );
///> Selects all modules belonging to same sheet.
int selectOnSheet( const TOOL_EVENT& aEvent );
///> Selects all modules belonging to same sheet, from Eeschema,
///> using crossprobing
int selectOnSheetFromEeschema( const TOOL_EVENT& aEvent );
///> Selects all modules belonging to same sheet.
///> Selects all modules belonging to same hierarchical sheet
///> as the selected footprint.
int selectSameSheet( const TOOL_EVENT& aEvent );
///> Find dialog callback.