router: fix corruption of board data when the inline drag is activated while the router tool is running
Fixes: lp:1712838 * https://bugs.launchpad.net/kicad/+bug/1712838
This commit is contained in:
parent
3bcc3dc4f9
commit
2e4c22f718
|
@ -27,6 +27,11 @@
|
|||
|
||||
#include <wxPcbStruct.h> // LAME!
|
||||
|
||||
bool TOOL_BASE::IsToolActive() const
|
||||
{
|
||||
return m_toolMgr->IsToolActive( m_toolId );
|
||||
}
|
||||
|
||||
KIGFX::VIEW* TOOL_BASE::getView() const
|
||||
{
|
||||
return m_toolMgr->GetView();
|
||||
|
|
|
@ -580,6 +580,7 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
|||
// got match? Run the handler.
|
||||
pushViewControls();
|
||||
applyViewControls( st );
|
||||
st->idle = false;
|
||||
st->cofunc->Call( aEvent );
|
||||
saveViewControls( st );
|
||||
popViewControls();
|
||||
|
@ -721,6 +722,7 @@ TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState )
|
|||
if( tool->GetType() == INTERACTIVE )
|
||||
static_cast<TOOL_INTERACTIVE*>( tool )->resetTransitions();
|
||||
|
||||
aState->idle = true;
|
||||
|
||||
return it;
|
||||
}
|
||||
|
@ -875,3 +877,9 @@ void TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
|
|||
processEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
bool TOOL_MANAGER::IsToolActive( TOOL_ID aId ) const
|
||||
{
|
||||
auto it = m_toolIdIndex.find( aId );
|
||||
return !it->second->idle;
|
||||
}
|
||||
|
|
|
@ -148,6 +148,8 @@ public:
|
|||
|
||||
TOOL_SETTINGS& GetSettings();
|
||||
|
||||
bool IsToolActive() const;
|
||||
|
||||
protected:
|
||||
friend class TOOL_MANAGER;
|
||||
friend class TOOL_SETTINGS;
|
||||
|
|
|
@ -202,6 +202,14 @@ public:
|
|||
*/
|
||||
void DeactivateTool();
|
||||
|
||||
|
||||
/**
|
||||
* Function IsToolActive()
|
||||
* Returns true if a tool with given id is active (executing)
|
||||
*/
|
||||
bool IsToolActive( TOOL_ID aId ) const;
|
||||
|
||||
|
||||
/**
|
||||
* Function ResetTools()
|
||||
* Resets all tools (i.e. calls their Reset() method).
|
||||
|
|
|
@ -307,16 +307,20 @@ bool EDIT_TOOL::Init()
|
|||
|
||||
bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
|
||||
{
|
||||
TRACK* track = uniqueSelected<TRACK>();
|
||||
VIA* via = uniqueSelected<VIA>();
|
||||
|
||||
if( track || via )
|
||||
{
|
||||
auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
|
||||
|
||||
if( !theRouter )
|
||||
return false;
|
||||
|
||||
// make sure we don't accidentally invoke inline routing mode while the router is already active!
|
||||
if ( theRouter->IsToolActive() )
|
||||
return false;
|
||||
|
||||
TRACK* track = uniqueSelected<TRACK>();
|
||||
VIA* via = uniqueSelected<VIA>();
|
||||
|
||||
if( track || via )
|
||||
{
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::routerInlineDrag, true, aDragMode );
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue