Don't inadventently clear selection reference point.
New algorithm more targetted and just clears the items. This also obviates the need for the aQuietMode flags. Only fixes one part of the bug, but the "fixes" line is the easiest way to get a link in the bug to the commit. Fixes: lp:1786727 * https://bugs.launchpad.net/kicad/+bug/1786727
This commit is contained in:
parent
60a55d75fa
commit
c91e51f688
|
@ -1192,11 +1192,9 @@ void PCBNEW_CONTROL::setTransitions()
|
||||||
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );
|
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );
|
||||||
|
|
||||||
// Append control
|
// Append control
|
||||||
Go( &PCBNEW_CONTROL::AppendBoardFromFile,
|
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
|
||||||
PCB_ACTIONS::appendBoard.MakeEvent() );
|
|
||||||
|
|
||||||
Go( &PCBNEW_CONTROL::PasteItemsFromClipboard,
|
Go( &PCBNEW_CONTROL::PasteItemsFromClipboard, PCB_ACTIONS::pasteFromClipboard.MakeEvent() );
|
||||||
PCB_ACTIONS::pasteFromClipboard.MakeEvent() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -394,38 +394,40 @@ SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilt
|
||||||
{
|
{
|
||||||
GENERAL_COLLECTOR collector;
|
GENERAL_COLLECTOR collector;
|
||||||
|
|
||||||
for( auto item : m_selection.Items() )
|
while( m_selection.GetSize() )
|
||||||
collector.Append( item );
|
{
|
||||||
|
collector.Append( m_selection.Front() );
|
||||||
|
unselect( static_cast<BOARD_ITEM*>( m_selection.Front() ) );
|
||||||
|
}
|
||||||
|
|
||||||
aClientFilter( VECTOR2I(), collector );
|
aClientFilter( VECTOR2I(), collector );
|
||||||
|
|
||||||
clearSelection( true );
|
|
||||||
|
|
||||||
for( int i = 0; i < collector.GetCount(); ++i )
|
for( int i = 0; i < collector.GetCount(); ++i )
|
||||||
{
|
{
|
||||||
m_additive = true;
|
m_additive = true;
|
||||||
toggleSelection( collector[ i ], true );
|
select( collector[ i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetGalCanvas()->ForceRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_selection;
|
return m_selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem, bool aQuietMode )
|
void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( aItem->IsSelected() )
|
if( aItem->IsSelected() )
|
||||||
{
|
{
|
||||||
unselect( aItem );
|
unselect( aItem );
|
||||||
|
|
||||||
// Inform other potentially interested tools
|
// Inform other potentially interested tools
|
||||||
if( !aQuietMode )
|
|
||||||
m_toolMgr->ProcessEvent( UnselectedEvent );
|
m_toolMgr->ProcessEvent( UnselectedEvent );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !m_additive )
|
if( !m_additive )
|
||||||
clearSelection( aQuietMode );
|
clearSelection();
|
||||||
|
|
||||||
// Prevent selection of invisible or inactive items
|
// Prevent selection of invisible or inactive items
|
||||||
if( selectable( aItem ) )
|
if( selectable( aItem ) )
|
||||||
|
@ -433,7 +435,6 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem, bool aQuietMode )
|
||||||
select( aItem );
|
select( aItem );
|
||||||
|
|
||||||
// Inform other potentially interested tools
|
// Inform other potentially interested tools
|
||||||
if( !aQuietMode )
|
|
||||||
m_toolMgr->ProcessEvent( SelectedEvent );
|
m_toolMgr->ProcessEvent( SelectedEvent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1369,7 +1370,7 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SELECTION_TOOL::clearSelection( bool aQuietMode )
|
void SELECTION_TOOL::clearSelection()
|
||||||
{
|
{
|
||||||
if( m_selection.Empty() )
|
if( m_selection.Empty() )
|
||||||
return;
|
return;
|
||||||
|
@ -1390,7 +1391,6 @@ void SELECTION_TOOL::clearSelection( bool aQuietMode )
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
|
|
||||||
// Inform other potentially interested tools
|
// Inform other potentially interested tools
|
||||||
if( !aQuietMode )
|
|
||||||
m_toolMgr->ProcessEvent( ClearedEvent );
|
m_toolMgr->ProcessEvent( ClearedEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1778,15 +1778,12 @@ void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
|
||||||
unhighlight( aItem, SELECTED, m_selection );
|
unhighlight( aItem, SELECTED, m_selection );
|
||||||
view()->Update( &m_selection );
|
view()->Update( &m_selection );
|
||||||
|
|
||||||
if( m_selection.Empty() )
|
if( m_frame && m_frame->GetCurItem() == aItem )
|
||||||
{
|
|
||||||
if( m_frame )
|
|
||||||
{
|
|
||||||
m_frame->SetCurItem( NULL );
|
m_frame->SetCurItem( NULL );
|
||||||
}
|
|
||||||
|
if( m_selection.Empty() )
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SELECTION_TOOL::highlight( BOARD_ITEM* aItem, int aMode, SELECTION& aGroup )
|
void SELECTION_TOOL::highlight( BOARD_ITEM* aItem, int aMode, SELECTION& aGroup )
|
||||||
|
|
|
@ -248,10 +248,8 @@ private:
|
||||||
/**
|
/**
|
||||||
* Function clearSelection()
|
* Function clearSelection()
|
||||||
* Clears the current selection.
|
* Clears the current selection.
|
||||||
*
|
|
||||||
* @param aQuietMode if true selection events are not broadcast to other tools.
|
|
||||||
*/
|
*/
|
||||||
void clearSelection( bool aQuietMode = false );
|
void clearSelection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function pickSmallestComponent()
|
* Function pickSmallestComponent()
|
||||||
|
@ -266,9 +264,8 @@ private:
|
||||||
* Changes selection status of a given item.
|
* Changes selection status of a given item.
|
||||||
*
|
*
|
||||||
* @param aItem is the item to have selection status changed.
|
* @param aItem is the item to have selection status changed.
|
||||||
* @param aQuietMode if true selection events are not broadcast to other tools.
|
|
||||||
*/
|
*/
|
||||||
void toggleSelection( BOARD_ITEM* aItem, bool aQuietMode = false );
|
void toggleSelection( BOARD_ITEM* aItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function selectable()
|
* Function selectable()
|
||||||
|
|
Loading…
Reference in New Issue