From d6cd55e133734c5bb54438ce3a8de802c44a306b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 9 Aug 2022 08:45:29 +0100 Subject: [PATCH] ADDED esc-removes-net-highlight preference to PCBEditor. Fixes https://gitlab.com/kicad/code/kicad/issues/8760 --- pcbnew/dialogs/panel_edit_options.cpp | 3 + pcbnew/dialogs/panel_edit_options_base.cpp | 5 +- pcbnew/dialogs/panel_edit_options_base.fbp | 117 +++++++++++---------- pcbnew/dialogs/panel_edit_options_base.h | 3 +- pcbnew/pcbnew_settings.cpp | 4 + pcbnew/pcbnew_settings.h | 2 + pcbnew/tools/pcb_selection_tool.cpp | 15 ++- 7 files changed, 93 insertions(+), 56 deletions(-) diff --git a/pcbnew/dialogs/panel_edit_options.cpp b/pcbnew/dialogs/panel_edit_options.cpp index 20a20d389e..02eabf3a4a 100644 --- a/pcbnew/dialogs/panel_edit_options.cpp +++ b/pcbnew/dialogs/panel_edit_options.cpp @@ -89,6 +89,8 @@ void PANEL_EDIT_OPTIONS::loadPCBSettings( PCBNEW_SETTINGS* aCfg ) m_showPageLimits->SetValue( aCfg->m_ShowPageLimits ); m_autoRefillZones->SetValue( aCfg->m_AutoRefillZones ); m_allowFreePads->SetValue( aCfg->m_AllowFreePads ); + + m_escClearsNetHighlight->SetValue( aCfg->m_ESCClearsNetHighlight ); } @@ -152,6 +154,7 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow() cfg->m_MagneticItems.graphics = !m_magneticGraphicsChoice->GetSelection(); cfg->m_FlipLeftRight = m_flipLeftRight->GetValue(); + cfg->m_ESCClearsNetHighlight = m_escClearsNetHighlight->GetValue(); cfg->m_AutoRefillZones = m_autoRefillZones->GetValue(); cfg->m_AllowFreePads = m_allowFreePads->GetValue(); cfg->m_ShowPageLimits = m_showPageLimits->GetValue(); diff --git a/pcbnew/dialogs/panel_edit_options_base.cpp b/pcbnew/dialogs/panel_edit_options_base.cpp index 14d939b3c4..9c39728c87 100644 --- a/pcbnew/dialogs/panel_edit_options_base.cpp +++ b/pcbnew/dialogs/panel_edit_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-133-g388db8e4) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -72,6 +72,9 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i bSizerUniversal->Add( m_allowFreePads, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); + m_escClearsNetHighlight = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _(" clears net highlighting"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerUniversal->Add( m_escClearsNetHighlight, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); + bOptionsSizer->Add( bSizerUniversal, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); diff --git a/pcbnew/dialogs/panel_edit_options_base.fbp b/pcbnew/dialogs/panel_edit_options_base.fbp index 19e80a1c77..7a8c027538 100644 --- a/pcbnew/dialogs/panel_edit_options_base.fbp +++ b/pcbnew/dialogs/panel_edit_options_base.fbp @@ -35,7 +35,6 @@ 1 - 0 1 impl_virtual @@ -123,7 +122,6 @@ Dock 0 Left - 0 1 1 @@ -188,7 +186,6 @@ Dock 0 Left - 0 1 1 @@ -264,7 +261,6 @@ Dock 0 Left - 0 1 1 @@ -348,7 +344,6 @@ Dock 0 Left - 0 1 1 @@ -410,7 +405,6 @@ Dock 0 Left - 0 1 1 @@ -475,7 +469,6 @@ Dock 0 Left - 0 1 1 @@ -540,7 +533,6 @@ Dock 0 Left - 0 1 1 @@ -579,6 +571,70 @@ + + 5 + wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + <ESC> clears net highlighting + + 0 + + + 0 + + 1 + m_escClearsNetHighlight + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + @@ -620,7 +676,6 @@ Dock 0 Left - 0 1 1 @@ -682,7 +737,6 @@ Dock 0 Left - 0 1 1 @@ -757,7 +811,6 @@ Dock 0 Left - 0 1 1 @@ -819,7 +872,6 @@ Dock 0 Left - 0 1 1 @@ -881,7 +933,6 @@ Dock 0 Left - 0 1 1 @@ -943,7 +994,6 @@ Dock 0 Left - 0 1 1 @@ -1005,7 +1055,6 @@ Dock 0 Left - 0 1 1 @@ -1067,7 +1116,6 @@ Dock 0 Left - 0 1 1 @@ -1129,7 +1177,6 @@ Dock 0 Left - 0 1 1 @@ -1191,7 +1238,6 @@ Dock 0 Left - 0 1 1 @@ -1253,7 +1299,6 @@ Dock 0 Left - 0 1 1 @@ -1316,7 +1361,6 @@ Dock 0 Left - 0 1 1 @@ -1398,7 +1442,6 @@ Dock 0 Left - 0 1 1 @@ -1460,7 +1503,6 @@ Dock 0 Left - 0 1 1 @@ -1535,7 +1577,6 @@ Dock 0 Left - 0 1 1 @@ -1597,7 +1638,6 @@ Dock 0 Left - 0 1 1 @@ -1659,7 +1699,6 @@ Dock 0 Left - 0 1 1 @@ -1721,7 +1760,6 @@ Dock 0 Left - 0 1 1 @@ -1783,7 +1821,6 @@ Dock 0 Left - 0 1 1 @@ -1845,7 +1882,6 @@ Dock 0 Left - 0 1 1 @@ -1907,7 +1943,6 @@ Dock 0 Left - 0 1 1 @@ -1969,7 +2004,6 @@ Dock 0 Left - 0 1 1 @@ -2031,7 +2065,6 @@ Dock 0 Left - 0 1 1 @@ -2094,7 +2127,6 @@ Dock 0 Left - 0 1 1 @@ -2160,7 +2192,6 @@ Dock 0 Left - 0 1 1 @@ -2222,7 +2253,6 @@ Dock 0 Left - 0 1 1 @@ -2290,7 +2320,6 @@ Dock 0 Left - 0 1 1 @@ -2345,7 +2374,6 @@ Dock 0 Left - 0 1 1 @@ -2419,7 +2447,6 @@ Dock 0 Left - 0 1 1 @@ -2487,7 +2514,6 @@ Dock 0 Left - 0 1 1 @@ -2576,7 +2602,6 @@ Dock 0 Left - 0 1 1 @@ -2639,7 +2664,6 @@ Dock 0 Left - 0 1 1 @@ -2703,7 +2727,6 @@ Dock 0 Left - 0 1 1 @@ -2766,7 +2789,6 @@ Dock 0 Left - 0 1 1 @@ -2830,7 +2852,6 @@ Dock 0 Left - 0 1 1 @@ -2893,7 +2914,6 @@ Dock 0 Left - 0 1 1 @@ -2974,7 +2994,6 @@ Dock 0 Left - 0 1 1 @@ -3039,7 +3058,6 @@ Dock 0 Left - 0 1 1 @@ -3117,7 +3135,6 @@ Dock 0 Left - 0 1 1 @@ -3188,7 +3205,6 @@ Dock 0 Left - 0 1 1 @@ -3253,7 +3269,6 @@ Dock 0 Left - 0 1 1 @@ -3318,7 +3333,6 @@ Dock 0 Left - 0 1 1 @@ -3400,7 +3414,6 @@ Dock 0 Left - 0 1 1 @@ -3479,7 +3492,6 @@ Dock 0 Left - 0 1 1 @@ -3544,7 +3556,6 @@ Dock 0 Left - 0 1 1 diff --git a/pcbnew/dialogs/panel_edit_options_base.h b/pcbnew/dialogs/panel_edit_options_base.h index c72e523d0b..bd9a1d9646 100644 --- a/pcbnew/dialogs/panel_edit_options_base.h +++ b/pcbnew/dialogs/panel_edit_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-133-g388db8e4) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -45,6 +45,7 @@ class PANEL_EDIT_OPTIONS_BASE : public RESETTABLE_PANEL wxTextCtrl* m_rotationAngleCtrl; wxStaticText* m_rotationAngleUnits; wxCheckBox* m_allowFreePads; + wxCheckBox* m_escClearsNetHighlight; wxStaticBoxSizer* m_mouseCmdsWinLin; wxStaticText* m_staticText181; wxRadioBox* m_rbCtrlClickAction; diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index f983622010..5abc0e44aa 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -70,6 +70,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_CtrlClickHighlight( false ), m_Use45DegreeLimit( false ), m_FlipLeftRight( false ), + m_ESCClearsNetHighlight( true ), m_PolarCoords( false ), m_RotationAngle( ANGLE_90 ), m_ShowPageLimits( true ), @@ -109,6 +110,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_params.emplace_back( new PARAM( "editing.flip_left_right", &m_FlipLeftRight, true ) ); + m_params.emplace_back( new PARAM( "editing.esc_clears_net_highlight", + &m_ESCClearsNetHighlight, true ) ); + m_params.emplace_back( new PARAM( "editing.magnetic_graphics", &m_MagneticItems.graphics, true ) ); diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h index d580881f31..c27951e413 100644 --- a/pcbnew/pcbnew_settings.h +++ b/pcbnew/pcbnew_settings.h @@ -368,6 +368,8 @@ public: // vertical and 45deg bool m_FlipLeftRight; // True: Flip footprints across Y axis + bool m_ESCClearsNetHighlight; + bool m_PolarCoords; EDA_ANGLE m_RotationAngle; diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 779aee8129..c8cceb9c05 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -59,6 +59,7 @@ using namespace std::placeholders; #include #include #include +#include #include #include #include @@ -438,9 +439,21 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) m_frame->FocusOnItem( nullptr ); if( m_enteredGroup ) + { ExitGroup(); + ClearSelection(); + } + else if( !GetSelection().Empty() ) + { + ClearSelection(); + } + else if( evt->FirstResponder() == this && evt->GetCommandId() == (int) WXK_ESCAPE ) + { + BOARD_INSPECTION_TOOL* controller = m_toolMgr->GetTool(); - ClearSelection(); + if( controller && m_frame->GetPcbNewSettings()->m_ESCClearsNetHighlight ) + controller->ClearHighlight( *evt ); + } } else {