Support autopanning in GALified eeschema
Fixes: lp:1807234 * https://bugs.launchpad.net/kicad/+bug/1807234
This commit is contained in:
parent
a9efbf4716
commit
63d4afb3ee
|
@ -920,7 +920,7 @@ void EDA_DRAW_PANEL::OnMouseEntering( wxMouseEvent& aEvent )
|
|||
void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
|
||||
{
|
||||
if( m_mouseCaptureCallback == NULL ) // No command in progress.
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
|
||||
if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents )
|
||||
return;
|
||||
|
@ -1094,7 +1094,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
m_canStartBlock = -1;
|
||||
|
||||
if( !IsMouseCaptured() ) // No mouse capture in progress.
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
|
||||
if( GetParent()->IsActive() )
|
||||
SetFocus();
|
||||
|
@ -1268,7 +1268,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
{
|
||||
if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
|
||||
{
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
GetParent()->HandleBlockPlace( &DC );
|
||||
m_ignoreNextLeftButtonRelease = true;
|
||||
}
|
||||
|
@ -1298,7 +1298,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_requestAutoPan = true;
|
||||
SetAutoPanRequest( true );
|
||||
SetCursor( wxCURSOR_SIZING );
|
||||
}
|
||||
}
|
||||
|
@ -1324,19 +1324,19 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
if( m_endMouseCaptureCallback )
|
||||
{
|
||||
m_endMouseCaptureCallback( this, &DC );
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
}
|
||||
|
||||
SetCursor( (wxStockCursor) m_currentCursor );
|
||||
}
|
||||
else if( screen->m_BlockLocate.GetState() == STATE_BLOCK_END )
|
||||
{
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
GetParent()->HandleBlockEnd( &DC );
|
||||
SetCursor( (wxStockCursor) m_currentCursor );
|
||||
if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
|
||||
{
|
||||
m_requestAutoPan = true;
|
||||
SetAutoPanRequest( true );
|
||||
SetCursor( wxCURSOR_HAND );
|
||||
}
|
||||
}
|
||||
|
@ -1535,7 +1535,7 @@ void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title,
|
|||
|
||||
m_mouseCaptureCallback = NULL;
|
||||
m_endMouseCaptureCallback = NULL;
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
|
||||
if( id != -1 && cursor != -1 )
|
||||
{
|
||||
|
|
|
@ -119,7 +119,6 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
|
|||
m_mouseCaptureCallback = NULL;
|
||||
m_endMouseCaptureCallback = NULL;
|
||||
|
||||
m_requestAutoPan = false;
|
||||
m_enableBlockCommands = false;
|
||||
m_minDragEventCount = 0;
|
||||
|
||||
|
@ -216,13 +215,20 @@ void SCH_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable )
|
|||
|
||||
void SCH_DRAW_PANEL::SetEnableAutoPan( bool aEnable )
|
||||
{
|
||||
m_enableAutoPan = aEnable;
|
||||
EDA_DRAW_PANEL::SetEnableAutoPan( aEnable );
|
||||
|
||||
if( GetParent()->IsGalCanvasActive() )
|
||||
GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable );
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAW_PANEL::SetAutoPanRequest( bool aEnable )
|
||||
{
|
||||
wxCHECK( GetParent()->IsGalCanvasActive(), /*void*/ );
|
||||
GetParent()->GetGalCanvas()->GetViewControls()->SetAutoPan( aEnable );
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable )
|
||||
{
|
||||
m_enableZoomNoCenter = aEnable;
|
||||
|
@ -293,7 +299,7 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
m_canStartBlock = -1;
|
||||
|
||||
if( !IsMouseCaptured() ) // No mouse capture in progress.
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
|
||||
if( GetParent()->IsActive() )
|
||||
SetFocus();
|
||||
|
@ -436,7 +442,7 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
{
|
||||
if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
|
||||
{
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
GetParent()->HandleBlockPlace( nullptr );
|
||||
m_ignoreNextLeftButtonRelease = true;
|
||||
}
|
||||
|
@ -468,7 +474,7 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_requestAutoPan = true;
|
||||
SetAutoPanRequest( true );
|
||||
SetCursor( wxCURSOR_SIZING );
|
||||
}
|
||||
}
|
||||
|
@ -494,19 +500,19 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
if( m_endMouseCaptureCallback )
|
||||
{
|
||||
m_endMouseCaptureCallback( this, nullptr );
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
}
|
||||
|
||||
//SetCursor( (wxStockCursor) m_currentCursor );
|
||||
}
|
||||
else if( screen->m_BlockLocate.GetState() == STATE_BLOCK_END )
|
||||
{
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
GetParent()->HandleBlockEnd( nullptr );
|
||||
//SetCursor( (wxStockCursor) m_currentCursor );
|
||||
if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
|
||||
{
|
||||
m_requestAutoPan = true;
|
||||
SetAutoPanRequest( true );
|
||||
SetCursor( wxCURSOR_HAND );
|
||||
}
|
||||
}
|
||||
|
@ -575,7 +581,7 @@ void SCH_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title,
|
|||
|
||||
m_mouseCaptureCallback = NULL;
|
||||
m_endMouseCaptureCallback = NULL;
|
||||
m_requestAutoPan = false;
|
||||
SetAutoPanRequest( false );
|
||||
|
||||
if( id != -1 && cursor != -1 )
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
void SetEnableMousewheelPan( bool aEnable ) override;
|
||||
void SetEnableZoomNoCenter( bool aEnable ) override;
|
||||
void SetEnableAutoPan( bool aEnable ) override;
|
||||
void SetAutoPanRequest( bool aEnable ) override;
|
||||
|
||||
BASE_SCREEN* GetScreen() override;
|
||||
virtual EDA_DRAW_FRAME* GetParent() const override;
|
||||
|
|
|
@ -46,8 +46,6 @@ protected:
|
|||
|
||||
bool m_enableAutoPan; ///< True to enable automatic panning.
|
||||
|
||||
bool m_requestAutoPan; ///< true to request an auto pan. Valid only when m_enableAutoPan = true.
|
||||
|
||||
bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
|
||||
|
||||
/* Used to inhibit a response to a mouse left button release, after a double click
|
||||
|
@ -122,7 +120,7 @@ public:
|
|||
|
||||
virtual void SetEnableAutoPan( bool aEnable ) { m_enableAutoPan = aEnable; };
|
||||
|
||||
void SetAutoPanRequest( bool aEnable ) { m_requestAutoPan = aEnable; }
|
||||
virtual void SetAutoPanRequest( bool aEnable ) = 0;
|
||||
|
||||
void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue