From 9b58b3fb6e6d01fd4a3040e640d7dfe5f204380a Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sun, 1 May 2016 17:02:28 +0100 Subject: [PATCH] Console: Do not scroll to bottom unless text is updated Also remove the size event handler and use Bind instead of Connect --- pcsx2/gui/ConsoleLogger.cpp | 2 -- pcsx2/gui/ConsoleLogger.h | 12 +---------- pcsx2/gui/pxLogTextCtrl.cpp | 40 ++----------------------------------- 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index 4959af6092..01772dbbe6 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -979,8 +979,6 @@ void ConsoleLogFrame::DoFlushQueue() if( len > 64 ) m_TextCtrl.Thaw(); - m_TextCtrl.ConcludeIssue(); - m_QueueColorSection.Clear(); m_CurQueuePos = 0; } diff --git a/pcsx2/gui/ConsoleLogger.h b/pcsx2/gui/ConsoleLogger.h index 834f75b097..df19bf70e0 100644 --- a/pcsx2/gui/ConsoleLogger.h +++ b/pcsx2/gui/ConsoleLogger.h @@ -87,21 +87,15 @@ public: // -------------------------------------------------------------------------------------- // pxLogTextCtrl // -------------------------------------------------------------------------------------- -class pxLogTextCtrl : public wxTextCtrl, - public EventListener_CoreThread, - public EventListener_Plugins +class pxLogTextCtrl : public wxTextCtrl { protected: std::unique_ptr m_IsPaused; - bool m_FreezeWrites; public: pxLogTextCtrl(wxWindow* parent); virtual ~pxLogTextCtrl() throw(); - bool HasWriteLock() const { return m_FreezeWrites; } - void ConcludeIssue(); - #ifdef __WXMSW__ virtual void WriteText(const wxString& text); #endif @@ -109,10 +103,6 @@ public: protected: virtual void OnThumbTrack(wxScrollWinEvent& event); virtual void OnThumbRelease(wxScrollWinEvent& event); - virtual void OnResize( wxSizeEvent& evt ); - - void DispatchEvent( const CoreThreadStatus& status ); - void DispatchEvent( const PluginEventType& evt ); }; // -------------------------------------------------------------------------------------- diff --git a/pcsx2/gui/pxLogTextCtrl.cpp b/pcsx2/gui/pxLogTextCtrl.cpp index 485d2d4a25..1699ed28bf 100644 --- a/pcsx2/gui/pxLogTextCtrl.cpp +++ b/pcsx2/gui/pxLogTextCtrl.cpp @@ -17,35 +17,15 @@ #include "App.h" #include "ConsoleLogger.h" -#ifdef __WXMSW__ -# include // needed for windows-specific rich text messages to make scrolling not lame -#endif #include -void pxLogTextCtrl::DispatchEvent( const CoreThreadStatus& status ) -{ - // See ConcludeIssue for details on WM_VSCROLL - if( HasWriteLock() ) return; - ConcludeIssue(); -} - -void pxLogTextCtrl::DispatchEvent( const PluginEventType& evt ) -{ - if( HasWriteLock() ) return; - ConcludeIssue(); -} - pxLogTextCtrl::pxLogTextCtrl( wxWindow* parent ) : wxTextCtrl( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2 | wxTE_NOHIDESEL ) { - m_FreezeWrites = false; - - Connect( wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(pxLogTextCtrl::OnThumbTrack) ); - Connect( wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(pxLogTextCtrl::OnThumbRelease) ); - - Connect( wxEVT_SIZE, wxSizeEventHandler(pxLogTextCtrl::OnResize) ); + Bind(wxEVT_SCROLLWIN_THUMBTRACK, &pxLogTextCtrl::OnThumbTrack, this); + Bind(wxEVT_SCROLLWIN_THUMBRELEASE, &pxLogTextCtrl::OnThumbRelease, this); } #ifdef __WXMSW__ @@ -56,15 +36,9 @@ void pxLogTextCtrl::WriteText(const wxString& text) } #endif -void pxLogTextCtrl::OnResize( wxSizeEvent& evt ) -{ - evt.Skip(); -} - void pxLogTextCtrl::OnThumbTrack(wxScrollWinEvent& evt) { //Console.Warning( "Thumb Tracking!!!" ); - m_FreezeWrites = true; if( !m_IsPaused ) m_IsPaused = std::unique_ptr(new ScopedCoreThreadPause()); @@ -74,7 +48,6 @@ void pxLogTextCtrl::OnThumbTrack(wxScrollWinEvent& evt) void pxLogTextCtrl::OnThumbRelease(wxScrollWinEvent& evt) { //Console.Warning( "Thumb Releasing!!!" ); - m_FreezeWrites = false; if( m_IsPaused ) { m_IsPaused->AllowResume(); @@ -86,12 +59,3 @@ void pxLogTextCtrl::OnThumbRelease(wxScrollWinEvent& evt) pxLogTextCtrl::~pxLogTextCtrl() throw() { } - -void pxLogTextCtrl::ConcludeIssue() -{ - if( HasWriteLock() ) return; - - ScrollLines(1); - ShowPosition( GetLastPosition() ); -} -