Fix cursor bugs in simulation.
1) cancel simProbe or simTune when simulator window closed 2) handle non-stock cursors through SetCurrentCursor() Fixes: lp:1833583 * https://bugs.launchpad.net/kicad/+bug/1833583
This commit is contained in:
parent
95bfb733ee
commit
97d70d7844
|
@ -61,11 +61,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
||||||
m_lostFocus = false;
|
m_lostFocus = false;
|
||||||
m_stealsFocus = true;
|
m_stealsFocus = true;
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
m_defaultCursor = m_currentCursor = wxStockCursor( wxCURSOR_ARROW );
|
||||||
m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
|
|
||||||
#else
|
|
||||||
m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SetLayoutDirection( wxLayout_LeftToRight );
|
SetLayoutDirection( wxLayout_LeftToRight );
|
||||||
|
|
||||||
|
@ -502,18 +498,23 @@ void EDA_DRAW_PANEL_GAL::onShowTimer( wxTimerEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL_GAL::SetCurrentCursor( int aCursor )
|
void EDA_DRAW_PANEL_GAL::SetCurrentCursor( int aStockCursorID )
|
||||||
{
|
{
|
||||||
if ( aCursor > wxCURSOR_NONE && aCursor < wxCURSOR_MAX )
|
if ( aStockCursorID <= wxCURSOR_NONE || aStockCursorID >= wxCURSOR_MAX )
|
||||||
m_currentCursor = aCursor;
|
aStockCursorID = wxCURSOR_ARROW;
|
||||||
else
|
|
||||||
m_currentCursor = wxCURSOR_ARROW;
|
|
||||||
|
|
||||||
SetCursor( (wxStockCursor) m_currentCursor );
|
SetCurrentCursor( wxCursor( aStockCursorID ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_PANEL_GAL::SetCurrentCursor( const wxCursor& aCursor )
|
||||||
|
{
|
||||||
|
m_currentCursor = aCursor;
|
||||||
|
SetCursor( m_currentCursor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL_GAL::onSetCursor( wxSetCursorEvent& event )
|
void EDA_DRAW_PANEL_GAL::onSetCursor( wxSetCursorEvent& event )
|
||||||
{
|
{
|
||||||
event.SetCursor( (wxStockCursor) m_currentCursor );
|
event.SetCursor( m_currentCursor );
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
m_frame->GetCanvas()->SetCursor( m_cursor );
|
m_frame->GetCanvas()->SetCurrentCursor( m_cursor );
|
||||||
VECTOR2D cursorPos = controls->GetCursorPosition( snap && !evt->Modifier( MD_ALT ) );
|
VECTOR2D cursorPos = controls->GetCursorPosition( snap && !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
if( evt->IsClick( BUT_LEFT ) )
|
if( evt->IsClick( BUT_LEFT ) )
|
||||||
|
|
|
@ -1262,6 +1262,9 @@ void SIM_PLOT_FRAME::onClose( wxCloseEvent& aEvent )
|
||||||
if( IsSimulationRunning() )
|
if( IsSimulationRunning() )
|
||||||
m_simulator->Stop();
|
m_simulator->Stop();
|
||||||
|
|
||||||
|
// Cancel a running simProbe or simTune tool
|
||||||
|
m_schematicFrame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,13 +181,8 @@ public:
|
||||||
* Function SetCurrentCursor
|
* Function SetCurrentCursor
|
||||||
* Set the current cursor shape for this panel
|
* Set the current cursor shape for this panel
|
||||||
*/
|
*/
|
||||||
virtual void SetCurrentCursor( int aCursor );
|
void SetCurrentCursor( int aStockCursorID );
|
||||||
|
void SetCurrentCursor( const wxCursor& aCursor );
|
||||||
/**
|
|
||||||
* Function GetDefaultCursor
|
|
||||||
* @return the default cursor shape
|
|
||||||
*/
|
|
||||||
virtual int GetDefaultCursor() const { return m_defaultCursor; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bounding box of the view that should be used if model is not valid
|
* Returns the bounding box of the view that should be used if model is not valid
|
||||||
|
@ -213,22 +208,15 @@ protected:
|
||||||
|
|
||||||
static const int MinRefreshPeriod = 17; ///< 60 FPS.
|
static const int MinRefreshPeriod = 17; ///< 60 FPS.
|
||||||
|
|
||||||
/// Current mouse cursor shape id.
|
wxCursor m_currentCursor; /// Current mouse cursor shape id.
|
||||||
int m_currentCursor;
|
wxCursor m_defaultCursor; /// The default mouse cursor shape id.
|
||||||
/// The default mouse cursor shape id.
|
|
||||||
int m_defaultCursor;
|
|
||||||
|
|
||||||
/// Pointer to the parent window
|
wxWindow* m_parent; /// Pointer to the parent window
|
||||||
wxWindow* m_parent;
|
EDA_DRAW_FRAME* m_edaFrame; /// Parent EDA_DRAW_FRAME (if available)
|
||||||
|
|
||||||
/// Parent EDA_DRAW_FRAME (if available)
|
wxLongLong m_lastRefresh; /// Last timestamp when the panel was refreshed
|
||||||
EDA_DRAW_FRAME* m_edaFrame;
|
bool m_pendingRefresh; /// Is there a redraw event requested?
|
||||||
|
wxTimer m_refreshTimer; /// Timer to prevent too-frequent refreshing
|
||||||
/// Last timestamp when the panel was refreshed
|
|
||||||
wxLongLong m_lastRefresh;
|
|
||||||
|
|
||||||
/// Is there a redraw event requested?
|
|
||||||
bool m_pendingRefresh;
|
|
||||||
|
|
||||||
/// True if GAL is currently redrawing the view
|
/// True if GAL is currently redrawing the view
|
||||||
bool m_drawing;
|
bool m_drawing;
|
||||||
|
@ -236,9 +224,6 @@ protected:
|
||||||
/// Flag that determines if VIEW may use GAL for redrawing the screen.
|
/// Flag that determines if VIEW may use GAL for redrawing the screen.
|
||||||
bool m_drawingEnabled;
|
bool m_drawingEnabled;
|
||||||
|
|
||||||
/// Timer responsible for preventing too frequent refresh
|
|
||||||
wxTimer m_refreshTimer;
|
|
||||||
|
|
||||||
/// Timer used to execute OnShow() when the window finally appears on the screen.
|
/// Timer used to execute OnShow() when the window finally appears on the screen.
|
||||||
wxTimer m_onShowTimer;
|
wxTimer m_onShowTimer;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue