From 8567739a7aa271745b7053742572dcd27528c756 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 31 Jan 2021 14:43:46 -0800 Subject: [PATCH] Remove conditions from common immediate-mode keys The conditions prevent use in immediate mode for common actions. While this makes enable/disable easier in menu items, this fix is a patch until we refactor the action framework to distinguish between immediate mode hotkeys that should start without selections and menu items that need a selection before running. Fixes https://gitlab.com/kicad/code/kicad/issues/5333 --- eeschema/menubar.cpp | 1 - eeschema/sch_edit_frame.cpp | 8 ++++---- pcbnew/menubar_pcb_editor.cpp | 1 - pcbnew/pcb_edit_frame.cpp | 2 -- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 25c5207ca7..74adcd1ab2 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -140,7 +140,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() editMenu->Add( ACTIONS::paste ); editMenu->Add( ACTIONS::pasteSpecial ); editMenu->Add( ACTIONS::doDelete ); - editMenu->Add( ACTIONS::duplicate ); editMenu->AppendSeparator(); editMenu->Add( ACTIONS::selectAll ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 3a74c8d63c..2f546b50ba 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -389,12 +389,12 @@ void SCH_EDIT_FRAME::setupUIConditions() mgr->SetConditions( ACTIONS::acceleratedGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) ) ); mgr->SetConditions( ACTIONS::standardGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) ) ); - mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); - mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); + mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) ); + mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) ); mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) ); mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( SELECTION_CONDITIONS::Idle ) ); - mgr->SetConditions( ACTIONS::doDelete, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); - mgr->SetConditions( ACTIONS::duplicate, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); + mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) ); + mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) ); mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) ); mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) ); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 03dee6702f..4c9af54e37 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -199,7 +199,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() editMenu->Add( ACTIONS::copy ); editMenu->Add( ACTIONS::paste ); editMenu->Add( ACTIONS::doDelete ); - editMenu->Add( ACTIONS::duplicate ); editMenu->AppendSeparator(); editMenu->Add( ACTIONS::selectAll ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 1d135586d3..1ae7214d47 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -657,8 +657,6 @@ void PCB_EDIT_FRAME::setupUIConditions() ENABLE( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) ) ); mgr->SetConditions( PCB_ACTIONS::deselectNet, ENABLE( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) ) ); - mgr->SetConditions( PCB_ACTIONS::selectConnection, - ENABLE( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) ) ); mgr->SetConditions( PCB_ACTIONS::selectSameSheet, ENABLE( SELECTION_CONDITIONS::OnlyType( PCB_FOOTPRINT_T ) ) );