router: fixed inline dragging & settings dialogs inconsistency

This commit is contained in:
Tomasz Włostowski 2017-08-22 16:44:47 +02:00
parent 31ef52a365
commit 60fdc6229d
4 changed files with 12 additions and 21 deletions

View File

@ -235,7 +235,6 @@ void LENGTH_TUNER_TOOL::setTransitions()
Go( &LENGTH_TUNER_TOOL::TuneDiffPair, PCB_ACTIONS::routerActivateTuneDiffPair.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPairSkew, PCB_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::routerOptionsDialog, ACT_RouterOptions.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::meanderSettingsDialog, ACT_Settings.MakeEvent() );
}
@ -284,20 +283,6 @@ int LENGTH_TUNER_TOOL::mainLoop( PNS::ROUTER_MODE aMode )
return 0;
}
int LENGTH_TUNER_TOOL::routerOptionsDialog( const TOOL_EVENT& aEvent )
{
DIALOG_PNS_SETTINGS settingsDlg( frame(), m_router->Settings() );
if( settingsDlg.ShowModal() == wxID_OK )
{
// FIXME: do we need an explicit update?
}
return 0;
}
int LENGTH_TUNER_TOOL::meanderSettingsDialog( const TOOL_EVENT& aEvent )
{
PNS::MEANDER_PLACER_BASE* placer = static_cast<PNS::MEANDER_PLACER_BASE*>( m_router->Placer() );

View File

@ -798,7 +798,9 @@ int ROUTER_TOOL::SettingsDialog( const TOOL_EVENT& aEvent )
DIALOG_PNS_SETTINGS settingsDlg( frame(), m_router->Settings() );
if( settingsDlg.ShowModal() )
{
m_savedSettings = m_router->Settings();
}
return 0;
}

View File

@ -310,16 +310,11 @@ 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" ) );
assert( theRouter );
if( !theRouter->Router()->Settings().InlineDragEnabled() )
return false;
m_toolMgr->RunAction( PCB_ACTIONS::routerInlineDrag, true, aDragMode );
return true;
}
@ -327,6 +322,14 @@ bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
return false;
}
bool EDIT_TOOL::isInteractiveDragEnabled() const
{
auto theRouter = static_cast<ROUTER_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
assert( theRouter );
return theRouter->Router()->Settings().InlineDragEnabled();
}
int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent )
{
int mode = PNS::DM_ANY;
@ -401,7 +404,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
{
bool invokedRouter = false;
if ( !evt->IsAction( &PCB_ACTIONS::move ) )
if ( !evt->IsAction( &PCB_ACTIONS::move ) && isInteractiveDragEnabled() )
invokedRouter = invokeInlineRouter( PNS::DM_ANY );
if( !invokedRouter )

View File

@ -160,6 +160,7 @@ private:
int editFootprintInFpEditor( const TOOL_EVENT& aEvent );
bool invokeInlineRouter( int aDragMode );
bool isInteractiveDragEnabled() const;
bool changeTrackWidthOnClick( const SELECTION& selection );