Add Unselect all in menu
This commit is contained in:
parent
a7a642e090
commit
cef0f176d3
|
@ -225,6 +225,13 @@ TOOL_ACTION ACTIONS::selectAll( TOOL_ACTION_ARGS()
|
|||
.MenuText( _( "Select All" ) )
|
||||
.Tooltip( _( "Select all items on screen" ) ) );
|
||||
|
||||
TOOL_ACTION ACTIONS::unselectAll( TOOL_ACTION_ARGS()
|
||||
.Name( "common.Interactive.unselectAll" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.DefaultHotkey( MD_CTRL + MD_SHIFT + 'A' )
|
||||
.MenuText( _( "Unselect All" ) )
|
||||
.Tooltip( _( "Unselect all items on screen" ) ) );
|
||||
|
||||
TOOL_ACTION ACTIONS::pasteSpecial( TOOL_ACTION_ARGS()
|
||||
.Name( "common.Interactive.pasteSpecial" )
|
||||
.Scope( AS_GLOBAL )
|
||||
|
|
|
@ -158,6 +158,7 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
|
|||
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->Add( ACTIONS::selectAll );
|
||||
editMenu->Add( ACTIONS::unselectAll );
|
||||
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->Add( ACTIONS::find );
|
||||
|
|
|
@ -565,6 +565,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
|
||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
|
||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
|
||||
mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
|
||||
|
||||
mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( hasElements ) );
|
||||
mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( hasElements ) );
|
||||
|
|
|
@ -95,6 +95,7 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
|
|||
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->Add( ACTIONS::selectAll );
|
||||
editMenu->Add( ACTIONS::unselectAll );
|
||||
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->Add( EE_ACTIONS::pinTable );
|
||||
|
|
|
@ -436,6 +436,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) );
|
||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) );
|
||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );
|
||||
mgr->SetConditions( ACTIONS::unselectAll, ENABLE( haveSymbolCond ) );
|
||||
|
||||
mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( isEditableCond ) );
|
||||
mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( isEditableCond ) );
|
||||
|
|
|
@ -1093,6 +1093,50 @@ int EE_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int EE_SELECTION_TOOL::UnselectAll( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_multiple = true; // Multiple selection mode is active
|
||||
KIGFX::VIEW* view = getView();
|
||||
|
||||
// hold all visible items
|
||||
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
|
||||
|
||||
// Filter the view items based on the selection box
|
||||
BOX2I selectionBox;
|
||||
|
||||
selectionBox.SetMaximum();
|
||||
view->Query( selectionBox, selectedItems ); // Get the list of selected items
|
||||
|
||||
for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
|
||||
{
|
||||
SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( pair.first );
|
||||
|
||||
if( sheet )
|
||||
{
|
||||
int layer = pair.second;
|
||||
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
{
|
||||
EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pin );
|
||||
if( Selectable( item ) )
|
||||
unselect( item );
|
||||
}
|
||||
}
|
||||
|
||||
if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first ) )
|
||||
{
|
||||
if( Selectable( item ) )
|
||||
unselect( item );
|
||||
}
|
||||
}
|
||||
|
||||
m_multiple = false;
|
||||
|
||||
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos )
|
||||
{
|
||||
|
@ -2069,6 +2113,7 @@ void EE_SELECTION_TOOL::setTransitions()
|
|||
Go( &EE_SELECTION_TOOL::SelectionMenu, EE_ACTIONS::selectionMenu.MakeEvent() );
|
||||
|
||||
Go( &EE_SELECTION_TOOL::SelectAll, EE_ACTIONS::selectAll.MakeEvent() );
|
||||
Go( &EE_SELECTION_TOOL::UnselectAll, EE_ACTIONS::unselectAll.MakeEvent() );
|
||||
|
||||
Go( &EE_SELECTION_TOOL::disambiguateCursor, EVENTS::DisambiguatePoint );
|
||||
}
|
||||
|
|
|
@ -140,6 +140,9 @@ public:
|
|||
///< Select all visible items in sheet
|
||||
int SelectAll( const TOOL_EVENT& aEvent );
|
||||
|
||||
///< Unselect all visible items in sheet
|
||||
int UnselectAll( const TOOL_EVENT& aEvent );
|
||||
|
||||
void ClearSelection( bool aQuietMode = false );
|
||||
|
||||
/**
|
||||
|
|
|
@ -705,6 +705,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
|
||||
selToolMenu.AddSeparator( 400 );
|
||||
selToolMenu.AddItem( ACTIONS::selectAll, hasElements, 400 );
|
||||
selToolMenu.AddItem( ACTIONS::unselectAll, hasElements, 400 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
|
||||
moveMenu.AddSeparator( 400 );
|
||||
moveMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
|
||||
moveMenu.AddItem( ACTIONS::unselectAll, haveSymbolCondition, 400 );
|
||||
}
|
||||
|
||||
// Add editing actions to the drawing tool menu
|
||||
|
@ -142,6 +143,7 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
|
||||
selToolMenu.AddSeparator( 400 );
|
||||
selToolMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
|
||||
selToolMenu.AddItem( ACTIONS::unselectAll, haveSymbolCondition, 400 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
static TOOL_ACTION paste;
|
||||
static TOOL_ACTION pasteSpecial;
|
||||
static TOOL_ACTION selectAll;
|
||||
static TOOL_ACTION unselectAll;
|
||||
static TOOL_ACTION duplicate;
|
||||
static TOOL_ACTION doDelete; // sadly 'delete' is a reserved word
|
||||
static TOOL_ACTION deleteTool;
|
||||
|
|
|
@ -1170,6 +1170,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
|
||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
|
||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( cond.HasItems() ) );
|
||||
mgr->SetConditions( ACTIONS::unselectAll, ENABLE( cond.HasItems() ) );
|
||||
|
||||
mgr->SetConditions( PCB_ACTIONS::rotateCw, ENABLE( cond.HasItems() ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::rotateCcw, ENABLE( cond.HasItems() ) );
|
||||
|
|
|
@ -200,6 +200,7 @@ void PCB_EDIT_FRAME::doReCreateMenuBar()
|
|||
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->Add( ACTIONS::selectAll );
|
||||
editMenu->Add( ACTIONS::unselectAll );
|
||||
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->Add( ACTIONS::find );
|
||||
|
|
|
@ -715,6 +715,7 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( ACTIONS::pasteSpecial,
|
||||
ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
|
||||
mgr->SetConditions( ACTIONS::selectAll, ENABLE( cond.HasItems() ) );
|
||||
mgr->SetConditions( ACTIONS::unselectAll, ENABLE( cond.HasItems() ) );
|
||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
|
||||
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
|
||||
|
||||
|
|
|
@ -310,6 +310,7 @@ bool EDIT_TOOL::Init()
|
|||
|
||||
menu.AddSeparator( 150 );
|
||||
menu.AddItem( ACTIONS::selectAll, noItemsCondition, 150 );
|
||||
menu.AddItem( ACTIONS::unselectAll, noItemsCondition, 150 );
|
||||
// clang-format on
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1112,6 +1112,36 @@ int PCB_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int PCB_SELECTION_TOOL::UnselectAll( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
KIGFX::VIEW* view = getView();
|
||||
|
||||
// hold all visible items
|
||||
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
|
||||
|
||||
// Filter the view items based on the selection box
|
||||
BOX2I selectionBox;
|
||||
|
||||
selectionBox.SetMaximum();
|
||||
view->Query( selectionBox, selectedItems ); // Get the list of selected items
|
||||
|
||||
for( const KIGFX::VIEW::LAYER_ITEM_PAIR& item_pair : selectedItems )
|
||||
{
|
||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( item_pair.first );
|
||||
|
||||
if( !item || !Selectable( item ) )
|
||||
continue;
|
||||
|
||||
unselect( item );
|
||||
}
|
||||
|
||||
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
|
||||
|
||||
m_frame->GetCanvas()->ForceRefresh();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void connectedItemFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
|
||||
PCB_SELECTION_TOOL* sTool )
|
||||
|
@ -3497,6 +3527,7 @@ void PCB_SELECTION_TOOL::setTransitions()
|
|||
Go( &PCB_SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsMoved );
|
||||
|
||||
Go( &PCB_SELECTION_TOOL::SelectAll, ACTIONS::selectAll.MakeEvent() );
|
||||
Go( &PCB_SELECTION_TOOL::UnselectAll, ACTIONS::unselectAll.MakeEvent() );
|
||||
|
||||
Go( &PCB_SELECTION_TOOL::disambiguateCursor, EVENTS::DisambiguatePoint );
|
||||
}
|
||||
|
|
|
@ -112,6 +112,9 @@ public:
|
|||
///< Select all items on the board
|
||||
int SelectAll( const TOOL_EVENT& aEvent );
|
||||
|
||||
///< Unselect all items on the board
|
||||
int UnselectAll( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Take necessary actions to mark an item as found.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue