Cvpcb: fix not working icon "select previous symbol"
From Master branch Fixes #11509 https://gitlab.com/kicad/code/kicad/issues/11509
This commit is contained in:
parent
82631db1bb
commit
7890d78801
|
@ -231,8 +231,9 @@ int CVPCB_CONTROL::ToNA( const TOOL_EVENT& aEvent )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Extract the current selection
|
// Extract the current selection
|
||||||
unsigned int curSel = -1;
|
bool changeSel = false;
|
||||||
unsigned int newSel = -1;
|
unsigned int newSel = UINT_MAX;
|
||||||
|
|
||||||
switch( dir )
|
switch( dir )
|
||||||
{
|
{
|
||||||
case CVPCB_MAINFRAME::ITEM_NEXT:
|
case CVPCB_MAINFRAME::ITEM_NEXT:
|
||||||
|
@ -240,11 +241,12 @@ int CVPCB_CONTROL::ToNA( const TOOL_EVENT& aEvent )
|
||||||
newSel = tempSel.front();
|
newSel = tempSel.front();
|
||||||
|
|
||||||
// Find the next index in the component list
|
// Find the next index in the component list
|
||||||
for( unsigned int i : naComp )
|
for( unsigned int idx : naComp )
|
||||||
{
|
{
|
||||||
if( i > newSel )
|
if( idx > newSel )
|
||||||
{
|
{
|
||||||
newSel = i;
|
changeSel = true;
|
||||||
|
newSel = idx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +257,19 @@ int CVPCB_CONTROL::ToNA( const TOOL_EVENT& aEvent )
|
||||||
if( !tempSel.empty() )
|
if( !tempSel.empty() )
|
||||||
{
|
{
|
||||||
newSel = tempSel.front();
|
newSel = tempSel.front();
|
||||||
curSel = newSel - 1; // Break one before the current selection
|
|
||||||
|
// Find the previous index in the component list
|
||||||
|
for( int jj = naComp.size()-1; jj >= 0; jj-- )
|
||||||
|
{
|
||||||
|
unsigned idx = naComp[jj];
|
||||||
|
|
||||||
|
if( idx < newSel )
|
||||||
|
{
|
||||||
|
changeSel = true;
|
||||||
|
newSel = idx;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -264,18 +278,9 @@ int CVPCB_CONTROL::ToNA( const TOOL_EVENT& aEvent )
|
||||||
wxASSERT_MSG( false, wxT( "Invalid direction" ) );
|
wxASSERT_MSG( false, wxT( "Invalid direction" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the next index in the component list
|
// Set the new component selection
|
||||||
for( unsigned int i : naComp )
|
if( changeSel )
|
||||||
{
|
m_frame->SetSelectedComponent( newSel );
|
||||||
if( i >= curSel )
|
|
||||||
{
|
|
||||||
newSel = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the component selection
|
|
||||||
m_frame->SetSelectedComponent( newSel );
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue