Right click on an item when there is nothing selected - enables the context menu.
This commit is contained in:
parent
63e4defd2a
commit
9ef713dfa8
|
@ -112,6 +112,16 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
|
||||||
selectSingle( evt->Position() );
|
selectSingle( evt->Position() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// right click? if there is any object - show the context menu
|
||||||
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
|
{
|
||||||
|
if( m_selection.Empty() )
|
||||||
|
selectSingle( evt->Position() );
|
||||||
|
|
||||||
|
if( !m_selection.Empty() )
|
||||||
|
SetContextMenu( &m_menu, CMENU_NOW );
|
||||||
|
}
|
||||||
|
|
||||||
// double click? Display the properties window
|
// double click? Display the properties window
|
||||||
else if( evt->IsDblClick( BUT_LEFT ) )
|
else if( evt->IsDblClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
|
@ -310,9 +320,6 @@ void SELECTION_TOOL::clearSelection()
|
||||||
m_selection.clear();
|
m_selection.clear();
|
||||||
|
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetCurItem( NULL );
|
getEditFrame<PCB_EDIT_FRAME>()->SetCurItem( NULL );
|
||||||
|
|
||||||
// Do not show the context menu when there is nothing selected
|
|
||||||
SetContextMenu( &m_menu, CMENU_OFF );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -509,9 +516,6 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem )
|
||||||
{
|
{
|
||||||
// Set as the current item, so the information about selection is displayed
|
// Set as the current item, so the information about selection is displayed
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetCurItem( aItem, true );
|
getEditFrame<PCB_EDIT_FRAME>()->SetCurItem( aItem, true );
|
||||||
|
|
||||||
// Now the context menu should be enabled
|
|
||||||
SetContextMenu( &m_menu, CMENU_BUTTON );
|
|
||||||
}
|
}
|
||||||
else if( m_selection.Size() == 2 ) // Check only for 2, so it will not be
|
else if( m_selection.Size() == 2 ) // Check only for 2, so it will not be
|
||||||
{ // called for every next selected item
|
{ // called for every next selected item
|
||||||
|
@ -539,11 +543,8 @@ void SELECTION_TOOL::deselect( BOARD_ITEM* aItem )
|
||||||
|
|
||||||
// If there is nothing selected, disable the context menu
|
// If there is nothing selected, disable the context menu
|
||||||
if( m_selection.Empty() )
|
if( m_selection.Empty() )
|
||||||
{
|
|
||||||
SetContextMenu( &m_menu, CMENU_OFF );
|
|
||||||
getEditFrame<PCB_EDIT_FRAME>()->SetCurItem( NULL );
|
getEditFrame<PCB_EDIT_FRAME>()->SetCurItem( NULL );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SELECTION_TOOL::selectVisually( BOARD_ITEM* aItem ) const
|
void SELECTION_TOOL::selectVisually( BOARD_ITEM* aItem ) const
|
||||||
|
|
Loading…
Reference in New Issue