From b40e3a39f5fd93b1df6c9a63e1ce5f64e02cc411 Mon Sep 17 00:00:00 2001 From: Michael Kavanagh Date: Sat, 2 Jan 2021 15:38:56 +0000 Subject: [PATCH] Minor cleanup. --- eeschema/tools/ee_selection_tool.cpp | 1 - gerbview/tools/gerbview_selection_tool.cpp | 14 +++++++++++--- pagelayout_editor/tools/pl_selection_tool.cpp | 12 ++++++++---- pcbnew/tools/pcb_selection_tool.cpp | 12 +++++++----- pcbnew/tools/pcb_selection_tool.h | 3 +-- qa/qa_utils/mocks.cpp | 2 +- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index c7463af757..c316937cc1 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -702,7 +702,6 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, EDA_ITEM** aItem, // If still more than one item we're going to have to ask the user. if( aCollector.GetCount() > 1 ) { - aCollector.m_MenuTitle = wxEmptyString; // Must call selectionMenu via RunAction() to avoid event-loop contention m_toolMgr->RunAction( EE_ACTIONS::selectionMenu, true, &aCollector ); diff --git a/gerbview/tools/gerbview_selection_tool.cpp b/gerbview/tools/gerbview_selection_tool.cpp index d03ab40b64..d51ce2323e 100644 --- a/gerbview/tools/gerbview_selection_tool.cpp +++ b/gerbview/tools/gerbview_selection_tool.cpp @@ -424,9 +424,17 @@ EDA_ITEM* GERBVIEW_SELECTION_TOOL::disambiguationMenu( GERBER_COLLECTOR* aCollec menu.Add( text, i + 1, item->GetMenuImage() ); } - menu.SetTitle( _( "Clarify selection" ) ); - menu.SetIcon( info_xpm ); - menu.DisplayTitle( true ); + if( aCollector->m_MenuTitle.Length() ) + { + menu.SetTitle( aCollector->m_MenuTitle ); + menu.SetIcon( info_xpm ); + menu.DisplayTitle( true ); + } + else + { + menu.DisplayTitle( false ); + } + SetContextMenu( &menu, CMENU_NOW ); while( TOOL_EVENT* evt = Wait() ) diff --git a/pagelayout_editor/tools/pl_selection_tool.cpp b/pagelayout_editor/tools/pl_selection_tool.cpp index 596b8c3936..b5019207f1 100644 --- a/pagelayout_editor/tools/pl_selection_tool.cpp +++ b/pagelayout_editor/tools/pl_selection_tool.cpp @@ -256,8 +256,6 @@ void PL_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, bool* aSelectionCan // If still more than one item we're going to have to ask the user. if( collector.GetCount() > 1 ) { - collector.m_MenuTitle = _( "Clarify Selection" ); - // Must call selectionMenu via RunAction() to avoid event-loop contention m_toolMgr->RunAction( PL_ACTIONS::selectionMenu, true, &collector ); @@ -589,10 +587,16 @@ bool PL_SELECTION_TOOL::doSelectionMenu( COLLECTOR* aCollector ) menu.Add( _( "Select &All\tA" ), limit + 1, plus_xpm ); if( aCollector->m_MenuTitle.Length() ) + { menu.SetTitle( aCollector->m_MenuTitle ); + menu.SetIcon( info_xpm ); + menu.DisplayTitle( true ); + } + else + { + menu.DisplayTitle( false ); + } - menu.SetIcon( info_xpm ); - menu.DisplayTitle( true ); SetContextMenu( &menu, CMENU_NOW ); bool selectAll = false; diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index ed71426deb..46afda8d6e 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -671,7 +671,7 @@ bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag, if( aOnDrag ) Wait( TOOL_EVENT( TC_ANY, TA_MOUSE_UP, BUT_LEFT ) ); - if( !doSelectionMenu( &collector, wxEmptyString ) ) + if( !doSelectionMenu( &collector ) ) { if( aSelectionCancelledFlag ) *aSelectionCancelledFlag = true; @@ -1704,13 +1704,13 @@ int PCB_SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent ) { GENERAL_COLLECTOR* collector = aEvent.Parameter(); - doSelectionMenu( collector, wxEmptyString ); + doSelectionMenu( collector ); return 0; } -bool PCB_SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const wxString& aTitle ) +bool PCB_SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector ) { BOARD_ITEM* current = nullptr; PCB_SELECTION highlightGroup; @@ -1747,14 +1747,16 @@ bool PCB_SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const w if( !expandSelection && aCollector->HasAdditionalItems() ) menu.Add( _( "&Expand Selection\tE" ), limit + 2, nullptr ); - if( aTitle.Length() ) + if( aCollector->m_MenuTitle.Length() ) { - menu.SetTitle( aTitle ); + menu.SetTitle( aCollector->m_MenuTitle ); menu.SetIcon( info_xpm ); menu.DisplayTitle( true ); } else + { menu.DisplayTitle( false ); + } SetContextMenu( &menu, CMENU_NOW ); diff --git a/pcbnew/tools/pcb_selection_tool.h b/pcbnew/tools/pcb_selection_tool.h index 73b05e443d..e5beb5e688 100644 --- a/pcbnew/tools/pcb_selection_tool.h +++ b/pcbnew/tools/pcb_selection_tool.h @@ -240,10 +240,9 @@ private: * Allows the selection of a single item from a list via pop-up menu. The items are * highlighted on the canvas when hovered in the menu. The collector is trimmed to * the picked item. - * @param aTitle (optional) Allows the menu to be titled (ie: "Clarify Selection"). * @return true if an item was picked */ - bool doSelectionMenu( GENERAL_COLLECTOR* aItems, const wxString& aTitle ); + bool doSelectionMenu( GENERAL_COLLECTOR* aItems ); /** * Expands the current track selection to the next boundary (junctions, pads, or all) diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index 9b92ccb76b..77e266cc05 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -757,7 +757,7 @@ int PCB_SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent ) } -bool PCB_SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const wxString& aTitle ) +bool PCB_SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector ) { return false; }