New enum for trace selection mode
This avoids giving KICAD_T another meaning, which is especially messy here as "select up to the next via" is encoded as SCH_JUNCTION_T, which belongs to eeschema. Also, document what is happening.
This commit is contained in:
parent
4a3cd77416
commit
5aac36dba9
|
@ -797,7 +797,7 @@ int SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
|
||||||
if( initialCount == 0 )
|
if( initialCount == 0 )
|
||||||
selectCursor( true, connectedItemFilter );
|
selectCursor( true, connectedItemFilter );
|
||||||
|
|
||||||
for( KICAD_T stopCondition : { PCB_VIA_T, PCB_PAD_T, EOT } )
|
for( STOP_CONDITION stopCondition : { STOP_AT_JUNCTION, STOP_AT_PAD, STOP_NEVER } )
|
||||||
{
|
{
|
||||||
// copy the selection, since we're going to iterate and modify
|
// copy the selection, since we're going to iterate and modify
|
||||||
std::deque<EDA_ITEM*> selectedItems = m_selection.GetItems();
|
std::deque<EDA_ITEM*> selectedItems = m_selection.GetItems();
|
||||||
|
@ -828,7 +828,7 @@ int SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
|
|
||||||
void SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
|
void SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
|
||||||
KICAD_T aStopCondition )
|
STOP_CONDITION aStopCondition )
|
||||||
{
|
{
|
||||||
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
|
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
|
||||||
|
|
||||||
|
@ -900,13 +900,13 @@ void SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
|
||||||
{
|
{
|
||||||
wxPoint pt = activePts[i];
|
wxPoint pt = activePts[i];
|
||||||
|
|
||||||
if( trackMap[ pt ].size() > 2 && aStopCondition == SCH_JUNCTION_T )
|
if( trackMap[ pt ].size() > 2 && aStopCondition == STOP_AT_JUNCTION )
|
||||||
{
|
{
|
||||||
activePts.erase( activePts.begin() + i );
|
activePts.erase( activePts.begin() + i );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( padMap.count( pt ) && aStopCondition != EOT )
|
if( padMap.count( pt ) && aStopCondition != STOP_NEVER )
|
||||||
{
|
{
|
||||||
activePts.erase( activePts.begin() + i );
|
activePts.erase( activePts.begin() + i );
|
||||||
continue;
|
continue;
|
||||||
|
@ -1012,7 +1012,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
|
||||||
std::list<TRACK*> launchTracks;
|
std::list<TRACK*> launchTracks;
|
||||||
|
|
||||||
for( D_PAD* pad : padList )
|
for( D_PAD* pad : padList )
|
||||||
selectConnectedTracks( *pad, EOT );
|
selectConnectedTracks( *pad, STOP_NEVER );
|
||||||
|
|
||||||
// now we need to find all modules that are connected to each of these nets
|
// now we need to find all modules that are connected to each of these nets
|
||||||
// then we need to determine if these modules are in the list of modules
|
// then we need to determine if these modules are in the list of modules
|
||||||
|
|
|
@ -219,12 +219,26 @@ private:
|
||||||
*/
|
*/
|
||||||
int selectNet( const TOOL_EVENT& aEvent );
|
int selectNet( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
enum STOP_CONDITION
|
||||||
|
{
|
||||||
|
/** Stop at any place where more than two traces meet
|
||||||
|
*
|
||||||
|
* Because vias are also traces, this makes selection stop at a
|
||||||
|
* via if there is a trace on another layer as well, but a via
|
||||||
|
* with only one connection will be selected. */
|
||||||
|
STOP_AT_JUNCTION,
|
||||||
|
/** Stop when reaching a pad */
|
||||||
|
STOP_AT_PAD,
|
||||||
|
/** Select the entire net */
|
||||||
|
STOP_NEVER
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects connecteed tracks and vias.
|
* Selects connecteed tracks and vias.
|
||||||
*
|
*
|
||||||
* @param aStopCondition must be one of JUNCTION_T, PAD_T, or EOT.
|
* @param aStopCondition where to stop selecting more items
|
||||||
*/
|
*/
|
||||||
void selectConnectedTracks( BOARD_CONNECTED_ITEM& aSourceItem, KICAD_T aStopCondition );
|
void selectConnectedTracks( BOARD_CONNECTED_ITEM& aSourceItem, STOP_CONDITION aStopCondition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects all items with the given net code
|
* Selects all items with the given net code
|
||||||
|
|
Loading…
Reference in New Issue