Minor cleanup.

This commit is contained in:
Michael Kavanagh 2021-01-02 15:38:56 +00:00
parent 87d5318187
commit b40e3a39f5
6 changed files with 28 additions and 16 deletions

View File

@ -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 );

View File

@ -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() )

View File

@ -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;

View File

@ -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<GENERAL_COLLECTOR*>();
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 );

View File

@ -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)

View File

@ -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;
}