From 2a153599d50bc4bb626f6f7bec7d3a67e4f02c6b Mon Sep 17 00:00:00 2001 From: Dhinesh Date: Tue, 17 Sep 2024 00:49:46 +0530 Subject: [PATCH] Remove Context Menu in Empty Space of Hierarchy Navigator Previously, a single RMB-click at empty space had no effect, while a double-click opened the context menu. As per the @sethhillbrand suggestion, instead of fixing this, no context menus should appear in empty space, as it is not necessary. To address this, the wxEVT_RIGHT_UP event binding has been removed by unbinding it from both the constructor and destructor. Additionally, the onRightClick(wxMouseEvent& aEvent) method has been removed, as it is linked to wxEVT_RIGHT_UP and is no longer necessary. Fixes #17962 --- eeschema/widgets/hierarchy_pane.cpp | 8 -------- eeschema/widgets/hierarchy_pane.h | 1 - 2 files changed, 9 deletions(-) diff --git a/eeschema/widgets/hierarchy_pane.cpp b/eeschema/widgets/hierarchy_pane.cpp index dd78cd86d7..f2ee8eeb8a 100644 --- a/eeschema/widgets/hierarchy_pane.cpp +++ b/eeschema/widgets/hierarchy_pane.cpp @@ -108,7 +108,6 @@ HIERARCHY_PANE::HIERARCHY_PANE( SCH_EDIT_FRAME* aParent ) : Bind( wxEVT_TREE_ITEM_RIGHT_CLICK, &HIERARCHY_PANE::onTreeItemRightClick, this ); Bind( wxEVT_CHAR_HOOK, &HIERARCHY_PANE::onCharHook, this ); m_tree->Bind( wxEVT_TREE_END_LABEL_EDIT, &HIERARCHY_PANE::onTreeEditFinished, this ); - m_tree->Bind( wxEVT_RIGHT_UP, &HIERARCHY_PANE::onRightClick, this ); m_events_bound = true; } @@ -120,7 +119,6 @@ HIERARCHY_PANE::~HIERARCHY_PANE() Unbind( wxEVT_TREE_ITEM_RIGHT_CLICK, &HIERARCHY_PANE::onTreeItemRightClick, this ); Unbind( wxEVT_CHAR_HOOK, &HIERARCHY_PANE::onCharHook, this ); m_tree->Unbind( wxEVT_TREE_END_LABEL_EDIT, &HIERARCHY_PANE::onTreeEditFinished, this ); - m_tree->Unbind( wxEVT_RIGHT_UP, &HIERARCHY_PANE::onRightClick, this ); } @@ -373,12 +371,6 @@ void HIERARCHY_PANE::onTreeItemRightClick( wxTreeEvent& aEvent ) } -void HIERARCHY_PANE::onRightClick( wxMouseEvent& aEvent ) -{ - onRightClick( wxTreeItemId() ); -} - - void HIERARCHY_PANE::onRightClick( wxTreeItemId aItem ) { wxMenu ctxMenu; diff --git a/eeschema/widgets/hierarchy_pane.h b/eeschema/widgets/hierarchy_pane.h index e7a3e88a41..c8c5d29c61 100644 --- a/eeschema/widgets/hierarchy_pane.h +++ b/eeschema/widgets/hierarchy_pane.h @@ -116,7 +116,6 @@ private: void onSelectSheetPath( wxTreeEvent& aEvent ); void onTreeItemRightClick( wxTreeEvent& aEvent ); - void onRightClick( wxMouseEvent& aEvent ); void onRightClick( wxTreeItemId aItem ); void onCharHook( wxKeyEvent& aKeyStroke ); void onTreeRightClick( wxTreeEvent& event );