Implement quiet-mode for selection clearing.
Also adds comments for exising quiet-mode calls. Fixes: lp:1843177 * https://bugs.launchpad.net/kicad/+bug/1843177
This commit is contained in:
parent
37fac7a8f2
commit
44a1cf9f1b
|
@ -304,7 +304,7 @@ int LIB_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
selectionTool->UnbrightenItem( m_pickerItem );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
|
||||
m_toolMgr->RunAction( ACTIONS::doDelete, true );
|
||||
m_pickerItem = nullptr;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
&& pin->GetOrientation() == cur_pin->GetOrientation()
|
||||
&& pin->GetConvert() == cur_pin->GetConvert() )
|
||||
{
|
||||
m_selectionTool->AddItemToSel( pin, true );
|
||||
m_selectionTool->AddItemToSel( pin, true /*quiet mode*/ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -986,7 +986,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
selectionTool->UnbrightenItem( m_pickerItem );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
|
||||
m_toolMgr->RunAction( ACTIONS::doDelete, true );
|
||||
m_pickerItem = nullptr;
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PL_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PL_SELECTION_TOOL>();
|
||||
selectionTool->UnbrightenItem( m_pickerItem );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
|
||||
m_toolMgr->RunAction( ACTIONS::doDelete, true );
|
||||
m_pickerItem = nullptr;
|
||||
}
|
||||
|
|
|
@ -337,16 +337,18 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
|||
// We also refresh the selection VIEW_GROUP here. I'm not sure exactly what
|
||||
// needs refreshing, but updating the RTREE (via remove/add) doesn't work, nor
|
||||
// does updating the hidden flag in the view. See bug 1813038.
|
||||
m_selectionTool->ClearSelection( TOOL_EVENT() );
|
||||
m_selectionTool->ClearSelection( true /*quiet mode*/ );
|
||||
|
||||
for( EDA_ITEM* item : sel_items )
|
||||
{
|
||||
BOARD_ITEM* board_item = (BOARD_ITEM*) item;
|
||||
|
||||
// Don't double move footprint pads, fields, etc.
|
||||
if( item->GetParent() && item->GetParent()->IsSelected() )
|
||||
continue;
|
||||
|
||||
static_cast<BOARD_ITEM*>( item )->Move( movement );
|
||||
m_selectionTool->AddItemToSel( static_cast<BOARD_ITEM*>( item ), true );
|
||||
board_item->Move( movement );
|
||||
m_selectionTool->AddItemToSel( board_item, true /*quiet mode*/ );
|
||||
}
|
||||
|
||||
frame()->UpdateMsgPanel();
|
||||
|
|
|
@ -515,7 +515,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||
selectionTool->UnbrightenItem( m_pickerItem );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true );
|
||||
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
|
||||
m_toolMgr->RunAction( ACTIONS::doDelete, true );
|
||||
m_pickerItem = nullptr;
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
|
|||
else
|
||||
{
|
||||
// Restore previous properties of selected items and remove them from containers
|
||||
clearSelection();
|
||||
ClearSelection( true );
|
||||
}
|
||||
|
||||
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
|
||||
|
@ -263,7 +263,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
else if( evt->IsCancel() )
|
||||
{
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
|
||||
if( evt->FirstResponder() == this )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::clearHighlight );
|
||||
|
@ -271,7 +271,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
||||
{
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -306,7 +306,7 @@ PCBNEW_SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCli
|
|||
|
||||
if ( aConfirmLockedItems && CheckLock() == SELECTION_LOCKED )
|
||||
{
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
}
|
||||
|
||||
if( aClientFilter )
|
||||
|
@ -433,7 +433,7 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
|
|||
}
|
||||
|
||||
if( !m_additive && !m_subtractive && !m_exclusive_or )
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
|
||||
if( collector.GetCount() == 1 )
|
||||
{
|
||||
|
@ -461,7 +461,7 @@ bool SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aC
|
|||
{
|
||||
if( aForceSelect || m_selection.Empty() )
|
||||
{
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
selectPoint( getViewControls()->GetCursorPosition( false ), false, NULL, aClientFilter );
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ bool SELECTION_TOOL::selectMultiple()
|
|||
if( evt->IsDrag( BUT_LEFT ) )
|
||||
{
|
||||
if( !m_additive && !m_subtractive && !m_exclusive_or )
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
|
||||
// Start drawing a selection box
|
||||
area.SetOrigin( evt->DragOrigin() );
|
||||
|
@ -641,7 +641,7 @@ int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1032,7 +1032,7 @@ void SELECTION_TOOL::zoomFitSelection()
|
|||
|
||||
int SELECTION_TOOL::selectSheetContents( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
wxString* sheetpath = aEvent.Parameter<wxString*>();
|
||||
|
||||
selectAllItemsOnSheet( *sheetpath );
|
||||
|
@ -1063,7 +1063,7 @@ int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
|
|||
|
||||
auto mod = dynamic_cast<MODULE*>( item );
|
||||
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
|
||||
// get the lowest subsheet name for this.
|
||||
wxString sheetPath = mod->GetPath();
|
||||
|
@ -1082,7 +1082,7 @@ int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
|
|||
|
||||
void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
|
||||
{
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
|
||||
if( aItem )
|
||||
{
|
||||
|
@ -1206,7 +1206,7 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
|
|||
auto selection = m_selection.GetItems();
|
||||
|
||||
// clear current selection
|
||||
clearSelection();
|
||||
ClearSelection();
|
||||
|
||||
// copy selection items from the saved selection
|
||||
// according to the dialog options
|
||||
|
@ -1224,7 +1224,7 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void SELECTION_TOOL::clearSelection()
|
||||
void SELECTION_TOOL::ClearSelection( bool aQuietMode )
|
||||
{
|
||||
if( m_selection.Empty() )
|
||||
return;
|
||||
|
@ -1240,9 +1240,12 @@ void SELECTION_TOOL::clearSelection()
|
|||
m_locked = true;
|
||||
|
||||
// Inform other potentially interested tools
|
||||
if( !aQuietMode )
|
||||
{
|
||||
m_toolMgr->ProcessEvent( EVENTS::ClearedEvent );
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::hideDynamicRatsnest, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SELECTION_TOOL::RebuildSelection()
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
|
||||
///> Clear current selection event handler.
|
||||
int ClearSelection( const TOOL_EVENT& aEvent );
|
||||
void ClearSelection( bool aQuietMode = false );
|
||||
|
||||
///> Item selection event handler.
|
||||
int SelectItem( const TOOL_EVENT& aEvent );
|
||||
|
@ -261,12 +262,6 @@ private:
|
|||
///> Invoke filter dialog and modify current selection
|
||||
int filterSelection( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Function clearSelection()
|
||||
* Clears the current selection.
|
||||
*/
|
||||
void clearSelection();
|
||||
|
||||
/**
|
||||
* Function pickSmallestComponent()
|
||||
* Allows one to find the smallest (in terms of bounding box area) item from the list.
|
||||
|
|
Loading…
Reference in New Issue