Reverting last commit since it causes regressions

This commit is contained in:
Andrew Zonenberg 2015-07-12 12:54:11 -07:00
parent ed43694682
commit b87ab79d6d
3 changed files with 3 additions and 53 deletions

View File

@ -36,8 +36,7 @@ using namespace KIGFX;
const wxEventType WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE = wxNewEventType();
WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel ) :
VIEW_CONTROLS( aView ), m_state( IDLE ), m_parentPanel( aParentPanel ), m_scrollScale( 1.0, 1.0 ),
m_mouseIsInView(false), m_cursorWasDisplayedOnLeave(false)
VIEW_CONTROLS( aView ), m_state( IDLE ), m_parentPanel( aParentPanel ), m_scrollScale( 1.0, 1.0 )
{
m_parentPanel->Connect( wxEVT_MOTION,
wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this );
@ -55,8 +54,10 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel
wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
m_parentPanel->Connect( wxEVT_LEFT_DOWN,
wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this );
#if defined _WIN32 || defined _WIN64
m_parentPanel->Connect( wxEVT_ENTER_WINDOW,
wxMouseEventHandler( WX_VIEW_CONTROLS::onEnter ), NULL, this );
#endif
m_parentPanel->Connect( wxEVT_LEAVE_WINDOW,
wxMouseEventHandler( WX_VIEW_CONTROLS::onLeave ), NULL, this );
m_parentPanel->Connect( wxEVT_SCROLLWIN_THUMBTRACK,
@ -211,28 +212,12 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent )
void WX_VIEW_CONTROLS::onEnter( wxMouseEvent& aEvent )
{
//If the cursor was enabled when we left, turn it on now
m_mouseIsInView = true;
m_view->GetGAL()->SetCursorEnabled(m_cursorWasDisplayedOnLeave);
#if defined _WIN32 || defined _WIN64
m_parentPanel->SetFocus();
#endif
}
void WX_VIEW_CONTROLS::onLeave( wxMouseEvent& aEvent )
{
// Always hide the cursor when the mouse leaves the window to avoid confusing the user
// But we may need to re-enable it, so keep track of whether it was visible
m_mouseIsInView = false;
m_cursorWasDisplayedOnLeave = m_view->GetGAL()->GetCursorEnabled();
m_view->GetGAL()->SetCursorEnabled(false);
// If we hid the cursor, redraw the window to get rid of it
if(m_cursorWasDisplayedOnLeave)
m_view->Redraw();
if( m_cursorCaptured )
{
bool warp = false;
@ -449,15 +434,3 @@ void WX_VIEW_CONTROLS::UpdateScrollbars()
( viewport.Centre().x - boundary.GetLeft() ) / boundary.GetWidth() * m_scrollScale.x,
( viewport.Centre().y - boundary.GetTop() ) / boundary.GetHeight() * m_scrollScale.y );
}
void WX_VIEW_CONTROLS::ShowCursor( bool aEnabled )
{
// If the mouse is outside the view (on a toolbar etc), don't show the cursor
// until the mouse enters the view again. Just remember we want to show it now
if(!m_mouseIsInView)
m_cursorWasDisplayedOnLeave = aEnabled;
// but if it's in the view, we want to show it right now
else
m_view->GetGAL()->SetCursorEnabled( aEnabled );
}

View File

@ -762,16 +762,6 @@ public:
{
isCursorEnabled = aCursorEnabled;
}
/**
* @brief Returns the cursor enable state
*
* @return True if the cursor is being drawn, else false
*/
inline bool GetCursorEnabled() const
{
return isCursorEnabled;
}
/**
* @brief Set the cursor color.

View File

@ -84,13 +84,6 @@ public:
if( m_state == AUTO_PANNING )
m_state = IDLE;
}
/**
* Function ShowCursor()
* Enables or disables display of cursor.
* @param aEnabled decides if the cursor should be shown.
*/
virtual void ShowCursor( bool aEnabled );
/// @copydoc VIEW_CONTROLS::GetMousePosition()
VECTOR2D GetMousePosition() const;
@ -147,12 +140,6 @@ private:
/// Ratio used for scaling world coordinates to scrollbar position.
VECTOR2D m_scrollScale;
/// Indicates whether the mouse is inside the window
bool m_mouseIsInView;
/// Indicates whether the cursor was being displayed at the time the mouse left the window
bool m_cursorWasDisplayedOnLeave;
};
} // namespace KIGFX