Use a softer Reset for grid settings.

Fixes https://gitlab.com/kicad/code/kicad/issues/14458
This commit is contained in:
Jeff Young 2023-04-04 17:04:24 +01:00
parent 247c2edbed
commit a9b2234f4e
3 changed files with 15 additions and 22 deletions

View File

@ -127,7 +127,7 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
// Notify TOOLS
TOOL_MANAGER* mgr = m_parent->GetToolManager();
mgr->ResetTools( TOOL_BASE::MODEL_RELOAD );
mgr->ResetTools( TOOL_BASE::REDRAW );
// Notify GAL
mgr->RunAction( ACTIONS::gridPreset, true, static_cast<intptr_t>( gridCfg.last_size_idx ) );

View File

@ -298,11 +298,15 @@ void EE_SELECTION_TOOL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<SCH_BASE_FRAME>();
if( aReason == TOOL_BASE::MODEL_RELOAD )
if( aReason != TOOL_BASE::REDRAW )
{
// Remove pointers to the selected items from containers without changing their
// properties (as they are already deleted while a new sheet is loaded)
m_selection.Clear();
}
if( aReason == TOOL_BASE::MODEL_RELOAD )
{
getView()->GetPainter()->GetSettings()->SetHighlight( false );
SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
@ -319,11 +323,6 @@ void EE_SELECTION_TOOL::Reset( RESET_REASON aReason )
m_isSymbolViewer = symbolViewerFrame != nullptr;
}
}
else
{
// Restore previous properties of selected items and remove them from containers
ClearSelection();
}
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
getView()->Remove( &m_selection );

View File

@ -211,24 +211,18 @@ void PCB_SELECTION_TOOL::Reset( RESET_REASON aReason )
m_frame = getEditFrame<PCB_BASE_FRAME>();
m_isFootprintEditor = m_frame->IsType( FRAME_FOOTPRINT_EDITOR );
if( m_enteredGroup )
ExitGroup();
if( aReason != TOOL_BASE::REDRAW )
{
if( m_enteredGroup )
ExitGroup();
// Deselect any item being currently in edit, to avoid unexpected behavior and remove
// pointers to the selected items from containers.
ClearSelection( true );
}
if( aReason == TOOL_BASE::MODEL_RELOAD )
{
// Deselect any item being currently in edit, to avoid unexpected behavior
// and remove pointers to the selected items from containers
// without changing their properties (as they are already deleted
// while a new board is loaded)
ClearSelection( true );
getView()->GetPainter()->GetSettings()->SetHighlight( false );
}
else if ( aReason != TOOL_BASE::REDRAW )
{
// Restore previous properties of selected items and remove them from containers
ClearSelection( true );
}
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
view()->Remove( &m_selection );