diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index e69d087aec..e68c1285a2 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -198,9 +198,6 @@ TOOL_MANAGER::TOOL_MANAGER() : m_menuActive( false ) { m_actionMgr = new ACTION_MANAGER( this ); - - // Keep default VIEW_CONTROLS settings at the bottom of the stack - m_vcStack.push( KIGFX::VC_SETTINGS() ); } @@ -533,11 +530,9 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent ) if( st->cofunc ) { - pushViewControls(); applyViewControls( st ); bool end = !st->cofunc->Resume(); saveViewControls( st ); - popViewControls(); if( end ) it = finishTool( st ); @@ -576,12 +571,10 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent ) st->transitions.clear(); // got match? Run the handler. - pushViewControls(); applyViewControls( st ); st->idle = false; st->cofunc->Call( aEvent ); saveViewControls( st ); - popViewControls(); if( !st->cofunc->Running() ) finishTool( st ); // The couroutine has finished immediately? @@ -734,20 +727,20 @@ TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState ) bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent ) { + if( TOOL_STATE* active = GetCurrentToolState() ) + saveViewControls( active ); + bool hotkey_handled = processEvent( aEvent ); if( TOOL_STATE* active = GetCurrentToolState() ) - { applyViewControls( active ); - } if( m_view->IsDirty() ) { auto f = dynamic_cast( GetEditFrame() ); + if( f ) - { f->GetGalCanvas()->Refresh(); // fixme: ugly hack, provide a method in TOOL_DISPATCHER. - } } return hotkey_handled; @@ -855,19 +848,6 @@ void TOOL_MANAGER::applyViewControls( TOOL_STATE* aState ) } -void TOOL_MANAGER::pushViewControls() -{ - m_vcStack.push( m_viewControls->GetSettings() ); -} - - -void TOOL_MANAGER::popViewControls() -{ - m_viewControls->ApplySettings( m_vcStack.top() ); - m_vcStack.pop(); -} - - bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent ) { // Early dispatch of events destined for the TOOL_MANAGER diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h index e26a29138f..b87165db61 100644 --- a/include/tool/tool_manager.h +++ b/include/tool/tool_manager.h @@ -479,18 +479,6 @@ private: */ void applyViewControls( TOOL_STATE* aState ); - /** - * Function pushViewControls() - * Stores the current VIEW_CONTROLS settings on the stack. - */ - void pushViewControls(); - - /** - * Function pushViewControls() - * Restores VIEW_CONTROLS settings from the stack. - */ - void popViewControls(); - ///> Main function for event processing. ///> @return true if a hotkey was handled bool processEvent( const TOOL_EVENT& aEvent ); @@ -524,9 +512,6 @@ private: /// Queue that stores events to be processed at the end of the event processing cycle. std::list m_eventQueue; - ///> VIEW_CONTROLS settings stack - std::stack m_vcStack; - /// Flag saying if the currently processed event should be passed to other tools. bool m_passEvent;