Added trivial connection selection (GAL).
This commit is contained in:
parent
e25ba1f51e
commit
4fe65715a2
|
@ -54,6 +54,10 @@ TOOL_ACTION COMMON_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
|
|||
"", "" ); // No description, it is not supposed to be shown anywhere
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::selectConnection( "pcbnew.InteractiveSelection.SelectConnection",
|
||||
AS_GLOBAL, 0,
|
||||
_( "trivial connection" ), _( "Selects a connection between two junctions." ) );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::selectCopper( "pcbnew.InteractiveSelection.SelectCopper",
|
||||
AS_GLOBAL, 0,
|
||||
_( "copper connection" ), _( "Selects whole copper connection." ) );
|
||||
|
||||
|
|
|
@ -56,9 +56,12 @@ public:
|
|||
/// Unselects an item (specified as the event parameter).
|
||||
static TOOL_ACTION unselectItem;
|
||||
|
||||
/// Selects whole copper connection.
|
||||
/// Selects a connection between junctions.
|
||||
static TOOL_ACTION selectConnection;
|
||||
|
||||
/// Selects whole copper connection.
|
||||
static TOOL_ACTION selectCopper;
|
||||
|
||||
/// Selects all connections belonging to a single net.
|
||||
static TOOL_ACTION selectNet;
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
SELECT_MENU()
|
||||
{
|
||||
Add( COMMON_ACTIONS::selectConnection );
|
||||
Add( COMMON_ACTIONS::selectCopper );
|
||||
Add( COMMON_ACTIONS::selectNet );
|
||||
}
|
||||
};
|
||||
|
@ -88,7 +89,7 @@ bool SELECTION_TOOL::Init()
|
|||
m_selection.group = new KIGFX::VIEW_GROUP;
|
||||
|
||||
m_menu.AddMenu( new SELECT_MENU, _( "Select..." ), false,
|
||||
(SELECTION_CONDITION) SELECTION_CONDITIONS::OnlyConnectedItems &&
|
||||
( SELECTION_CONDITIONS::OnlyType( PCB_VIA_T ) || SELECTION_CONDITIONS::OnlyType( PCB_TRACE_T ) ) &&
|
||||
SELECTION_CONDITIONS::Count( 1 ) );
|
||||
|
||||
m_menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 );
|
||||
|
@ -259,6 +260,11 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
selectConnection( *evt );
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::selectCopper ) )
|
||||
{
|
||||
selectCopper( *evt );
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::selectNet ) )
|
||||
{
|
||||
selectNet( *evt );
|
||||
|
@ -459,6 +465,7 @@ void SELECTION_TOOL::SetTransitions()
|
|||
Go( &SELECTION_TOOL::find, COMMON_ACTIONS::find.MakeEvent() );
|
||||
Go( &SELECTION_TOOL::findMove, COMMON_ACTIONS::findMove.MakeEvent() );
|
||||
Go( &SELECTION_TOOL::selectConnection, COMMON_ACTIONS::selectConnection.MakeEvent() );
|
||||
Go( &SELECTION_TOOL::selectCopper, COMMON_ACTIONS::selectCopper.MakeEvent() );
|
||||
Go( &SELECTION_TOOL::selectNet, COMMON_ACTIONS::selectNet.MakeEvent() );
|
||||
}
|
||||
|
||||
|
@ -561,6 +568,35 @@ int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
|
||||
int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* item = m_selection.Item<BOARD_CONNECTED_ITEM>( 0 );
|
||||
int segmentCount;
|
||||
|
||||
if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
|
||||
return 0;
|
||||
|
||||
clearSelection();
|
||||
TRACK* trackList = getModel<BOARD>()->MarkTrace( static_cast<TRACK*>( item ), &segmentCount,
|
||||
NULL, NULL, true );
|
||||
|
||||
if( segmentCount == 0 )
|
||||
return 0;
|
||||
|
||||
for( int i = 0; i < segmentCount; ++i )
|
||||
{
|
||||
select( trackList );
|
||||
trackList = trackList->Next();
|
||||
}
|
||||
|
||||
// Inform other potentially interested tools
|
||||
TOOL_EVENT selectEvent( SelectedEvent );
|
||||
m_toolMgr->ProcessEvent( selectEvent );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int SELECTION_TOOL::selectCopper( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::list<BOARD_CONNECTED_ITEM*> itemsList;
|
||||
RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
|
||||
|
|
|
@ -199,9 +199,12 @@ private:
|
|||
*/
|
||||
bool selectMultiple();
|
||||
|
||||
///> Selects a continuous copper connection.
|
||||
///> Selects a trivial connection (between two junctions).
|
||||
int selectConnection( const TOOL_EVENT& aEvent );
|
||||
|
||||
///> Selects a continuous copper connection.
|
||||
int selectCopper( const TOOL_EVENT& aEvent );
|
||||
|
||||
///> Selects all copper connections belonging to a single net.
|
||||
int selectNet( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
|
Loading…
Reference in New Issue