router: fix shortcut crash & inline dragging for inline dragging P&S

This commit is contained in:
Tomasz Wlostowski 2015-07-02 16:10:07 +02:00 committed by Maciej Suminski
parent 2fd493255d
commit 0ade919a98
6 changed files with 22 additions and 5 deletions

View File

@ -40,6 +40,7 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
m_smoothDraggedSegments = true;
m_canViolateDRC = false;
m_freeAngleMode = false;
m_inlineDragEnabled = false;
}
void PNS_ROUTING_SETTINGS::Save ( TOOL_SETTINGS& aSettings ) const
@ -58,6 +59,7 @@ void PNS_ROUTING_SETTINGS::Save ( TOOL_SETTINGS& aSettings ) const
aSettings.Set( "CanViolateDRC", m_canViolateDRC );
aSettings.Set( "SuggestFinish", m_suggestFinish );
aSettings.Set( "FreeAngleMode", m_freeAngleMode );
aSettings.Set( "InlineDragEnabled", m_inlineDragEnabled );
}
void PNS_ROUTING_SETTINGS::Load ( const TOOL_SETTINGS& aSettings )
@ -76,6 +78,7 @@ void PNS_ROUTING_SETTINGS::Load ( const TOOL_SETTINGS& aSettings )
m_canViolateDRC = aSettings.Get( "CanViolateDRC", false );
m_suggestFinish = aSettings.Get( "SuggestFinish", false );
m_freeAngleMode = aSettings.Get( "FreeAngleMode", false );
m_inlineDragEnabled = aSettings.Get( "InlineDragEnabled", false );
}
const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const

View File

@ -131,6 +131,9 @@ public:
TIME_LIMIT WalkaroundTimeLimit() const;
void SetInlineDragEnabled ( bool aEnable ) { m_inlineDragEnabled = aEnable; }
bool InlineDragEnabled( ) const { return m_inlineDragEnabled; }
private:
bool m_shoveVias;
bool m_startDiagonal;
@ -142,6 +145,7 @@ private:
bool m_smoothDraggedSegments;
bool m_canViolateDRC;
bool m_freeAngleMode;
bool m_inlineDragEnabled;
PNS_MODE m_routingMode;
PNS_OPTIMIZATION_EFFORT m_optimizerEffort;

View File

@ -247,7 +247,7 @@ void PNS_TOOL_BASE::updateEndItem( TOOL_EVENT& aEvent )
VECTOR2I p = getView()->ToWorld( mp );
VECTOR2I cp = m_ctls->GetCursorPosition();
int layer;
bool snapEnabled = !aEvent.Modifier( MD_CTRL );
bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
m_router->EnableSnapping( snapEnabled );

View File

@ -43,6 +43,11 @@ public:
virtual void Reset( RESET_REASON aReason );
const PNS_ROUTING_SETTINGS& PNSSettings() const
{
return m_savedSettings;
}
protected:
virtual PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );

View File

@ -530,7 +530,7 @@ TOOL_ACTION COMMON_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.
_( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
TOOL_ACTION COMMON_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_TRACK_KEEP_SLOPE ),
AS_GLOBAL, 0,
"", "" );
// Point editor

View File

@ -49,6 +49,8 @@
#include "edit_tool.h"
#include "grid_helper.h"
#include <router/router_tool.h>
#include <dialogs/dialog_create_array.h>
#include <dialogs/dialog_move_exact.h>
@ -105,11 +107,14 @@ bool EDIT_TOOL::invokeInlineRouter()
TRACK* track = uniqueSelected<TRACK>();
VIA* via = uniqueSelected<VIA>();
if ( !GetSettings().Get("DragInvokesRouter", false ) )
return false;
if( track || via )
{
ROUTER_TOOL *theRouter = static_cast<ROUTER_TOOL*> ( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) );
assert ( theRouter );
if( !theRouter->PNSSettings().InlineDragEnabled() )
return false;
m_toolMgr->RunAction( COMMON_ACTIONS::routerInlineDrag, true, track ? track : via );
return true;
}