support "disable autopan" with gal canvas

Fixes: lp:1670712
* https://bugs.launchpad.net/kicad/+bug/1670712
This commit is contained in:
Julius Schmidt 2017-11-23 22:04:52 +00:00 committed by Maciej Suminski
parent 37f68f824b
commit 9df938484a
6 changed files with 25 additions and 2 deletions

View File

@ -1155,6 +1155,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
// Transfer EDA_DRAW_PANEL settings
GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
GetGalCanvas()->GetViewControls()->EnableAutoPan( m_canvas->GetEnableAutoPan() );
}
else if( m_galCanvasActive )
{

View File

@ -652,6 +652,14 @@ void EDA_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable )
GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable );
}
void EDA_DRAW_PANEL::SetEnableAutoPan( bool aEnable )
{
m_enableAutoPan = aEnable;
if( GetParent()->IsGalCanvasActive() )
GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable );
}
void EDA_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable )
{

View File

@ -62,6 +62,7 @@ void VC_SETTINGS::Reset()
m_snappingEnabled = true;
m_grabMouse = false;
m_autoPanEnabled = false;
m_autoPanSettingEnabled = false;
m_autoPanMargin = 0.1;
m_autoPanSpeed = 0.15;
m_warpCursor = false;

View File

@ -87,7 +87,7 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
bool isAutoPanning = false;
VECTOR2D mousePos( aEvent.GetX(), aEvent.GetY() );
if( m_settings.m_autoPanEnabled )
if( m_settings.m_autoPanEnabled && m_settings.m_autoPanSettingEnabled )
isAutoPanning = handleAutoPanning( aEvent );
if( !isAutoPanning && aEvent.Dragging() )

View File

@ -149,7 +149,7 @@ public:
bool GetEnableAutoPan() const { return m_enableAutoPan; }
void SetEnableAutoPan( bool aEnable ) { m_enableAutoPan = aEnable; }
void SetEnableAutoPan( bool aEnable );
void SetAutoPanRequest( bool aEnable ) { m_requestAutoPan = aEnable; }

View File

@ -72,6 +72,9 @@ struct VC_SETTINGS
///> Flag for turning on autopanning
bool m_autoPanEnabled;
///> Flag for turning on autopanning
bool m_autoPanSettingEnabled;
///> Distance from cursor to VIEW edge when panning is active
float m_autoPanMargin;
@ -140,6 +143,16 @@ public:
m_settings.m_autoPanEnabled = aEnabled;
}
/**
* Function EnableAutoPan
* Turns on/off auto panning (user setting to disable it entirely).
* @param aEnabled tells if the autopanning should be enabled.
*/
virtual void EnableAutoPan( bool aEnabled )
{
m_settings.m_autoPanSettingEnabled = aEnabled;
}
/**
* Function SetAutoPanSpeed()
* Sets speed of autopanning.