Clear ctx-menu before rebuilding; don't veto ctx-menu mousewarp for non-ctx-menu dialog.

Fixes: lp:1833312
* https://bugs.launchpad.net/kicad/+bug/1833312
This commit is contained in:
Jeff Young 2019-06-19 21:04:34 +01:00
parent 4054d7ddf7
commit 485d436860
4 changed files with 14 additions and 3 deletions

View File

@ -100,7 +100,7 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
{
TOOL_MANAGER* toolMgr = static_cast<EDA_BASE_FRAME*>( kiwayHolder )->GetToolManager();
if( toolMgr )
if( toolMgr && toolMgr->IsContextMenuActive() )
toolMgr->VetoContextMenuMouseWarp();
}

View File

@ -195,6 +195,7 @@ TOOL_MANAGER::TOOL_MANAGER() :
m_view( NULL ),
m_viewControls( NULL ),
m_frame( NULL ),
m_warpMouseAfterContextMenu( true ),
m_menuActive( false ),
m_menuOwner( -1 ),
m_activeState( nullptr )
@ -487,7 +488,7 @@ void TOOL_MANAGER::ScheduleNextState( TOOL_BASE* aTool, TOOL_STATE_FUNC& aHandle
{
TOOL_STATE* st = m_toolState[aTool];
st->transitions.push_back( TRANSITION( aConditions, aHandler ) );
st->transitions.emplace_back( TRANSITION( aConditions, aHandler ) );
}
@ -634,7 +635,7 @@ bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent )
{
wxString cmdStr( *aEvent.GetCommandStr() );
std::map<std::string, TOOL_STATE*>::iterator tool = m_toolNameIndex.find( *aEvent.GetCommandStr() );
auto tool = m_toolNameIndex.find( *aEvent.GetCommandStr() );
if( tool != m_toolNameIndex.end() )
{

View File

@ -80,6 +80,8 @@ private:
EE_SELECTION& selection = selTool->GetSelection();
SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( selection.Front() );
Clear();
if( !component )
{
Append( ID_POPUP_SCH_UNFOLD_BUS, _( "no symbol selected" ), wxEmptyString );

View File

@ -351,6 +351,14 @@ public:
*/
const KIGFX::VC_SETTINGS& GetCurrentToolVC() const;
/**
* True while processing a context menu.
*/
bool IsContextMenuActive()
{
return m_menuActive;
}
/**
* Disables mouse warping after the current context menu is closed.
* Must be called before invoking each context menu.