mirror of https://github.com/PCSX2/pcsx2.git
Console: Do not scroll to bottom unless text is updated
Also remove the size event handler and use Bind instead of Connect
This commit is contained in:
parent
21e6a344a2
commit
9b58b3fb6e
|
@ -979,8 +979,6 @@ void ConsoleLogFrame::DoFlushQueue()
|
||||||
|
|
||||||
if( len > 64 ) m_TextCtrl.Thaw();
|
if( len > 64 ) m_TextCtrl.Thaw();
|
||||||
|
|
||||||
m_TextCtrl.ConcludeIssue();
|
|
||||||
|
|
||||||
m_QueueColorSection.Clear();
|
m_QueueColorSection.Clear();
|
||||||
m_CurQueuePos = 0;
|
m_CurQueuePos = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,21 +87,15 @@ public:
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// pxLogTextCtrl
|
// pxLogTextCtrl
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
class pxLogTextCtrl : public wxTextCtrl,
|
class pxLogTextCtrl : public wxTextCtrl
|
||||||
public EventListener_CoreThread,
|
|
||||||
public EventListener_Plugins
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<ScopedCoreThreadPause> m_IsPaused;
|
std::unique_ptr<ScopedCoreThreadPause> m_IsPaused;
|
||||||
bool m_FreezeWrites;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
pxLogTextCtrl(wxWindow* parent);
|
pxLogTextCtrl(wxWindow* parent);
|
||||||
virtual ~pxLogTextCtrl() throw();
|
virtual ~pxLogTextCtrl() throw();
|
||||||
|
|
||||||
bool HasWriteLock() const { return m_FreezeWrites; }
|
|
||||||
void ConcludeIssue();
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
virtual void WriteText(const wxString& text);
|
virtual void WriteText(const wxString& text);
|
||||||
#endif
|
#endif
|
||||||
|
@ -109,10 +103,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void OnThumbTrack(wxScrollWinEvent& event);
|
virtual void OnThumbTrack(wxScrollWinEvent& event);
|
||||||
virtual void OnThumbRelease(wxScrollWinEvent& event);
|
virtual void OnThumbRelease(wxScrollWinEvent& event);
|
||||||
virtual void OnResize( wxSizeEvent& evt );
|
|
||||||
|
|
||||||
void DispatchEvent( const CoreThreadStatus& status );
|
|
||||||
void DispatchEvent( const PluginEventType& evt );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -17,35 +17,15 @@
|
||||||
#include "App.h"
|
#include "App.h"
|
||||||
#include "ConsoleLogger.h"
|
#include "ConsoleLogger.h"
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
# include <wx/msw/wrapwin.h> // needed for windows-specific rich text messages to make scrolling not lame
|
|
||||||
#endif
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
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 )
|
pxLogTextCtrl::pxLogTextCtrl( wxWindow* parent )
|
||||||
: wxTextCtrl( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
: wxTextCtrl( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2 | wxTE_NOHIDESEL
|
wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2 | wxTE_NOHIDESEL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_FreezeWrites = false;
|
Bind(wxEVT_SCROLLWIN_THUMBTRACK, &pxLogTextCtrl::OnThumbTrack, this);
|
||||||
|
Bind(wxEVT_SCROLLWIN_THUMBRELEASE, &pxLogTextCtrl::OnThumbRelease, this);
|
||||||
Connect( wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(pxLogTextCtrl::OnThumbTrack) );
|
|
||||||
Connect( wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(pxLogTextCtrl::OnThumbRelease) );
|
|
||||||
|
|
||||||
Connect( wxEVT_SIZE, wxSizeEventHandler(pxLogTextCtrl::OnResize) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@ -56,15 +36,9 @@ void pxLogTextCtrl::WriteText(const wxString& text)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void pxLogTextCtrl::OnResize( wxSizeEvent& evt )
|
|
||||||
{
|
|
||||||
evt.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void pxLogTextCtrl::OnThumbTrack(wxScrollWinEvent& evt)
|
void pxLogTextCtrl::OnThumbTrack(wxScrollWinEvent& evt)
|
||||||
{
|
{
|
||||||
//Console.Warning( "Thumb Tracking!!!" );
|
//Console.Warning( "Thumb Tracking!!!" );
|
||||||
m_FreezeWrites = true;
|
|
||||||
if( !m_IsPaused )
|
if( !m_IsPaused )
|
||||||
m_IsPaused = std::unique_ptr<ScopedCoreThreadPause>(new ScopedCoreThreadPause());
|
m_IsPaused = std::unique_ptr<ScopedCoreThreadPause>(new ScopedCoreThreadPause());
|
||||||
|
|
||||||
|
@ -74,7 +48,6 @@ void pxLogTextCtrl::OnThumbTrack(wxScrollWinEvent& evt)
|
||||||
void pxLogTextCtrl::OnThumbRelease(wxScrollWinEvent& evt)
|
void pxLogTextCtrl::OnThumbRelease(wxScrollWinEvent& evt)
|
||||||
{
|
{
|
||||||
//Console.Warning( "Thumb Releasing!!!" );
|
//Console.Warning( "Thumb Releasing!!!" );
|
||||||
m_FreezeWrites = false;
|
|
||||||
if( m_IsPaused )
|
if( m_IsPaused )
|
||||||
{
|
{
|
||||||
m_IsPaused->AllowResume();
|
m_IsPaused->AllowResume();
|
||||||
|
@ -86,12 +59,3 @@ void pxLogTextCtrl::OnThumbRelease(wxScrollWinEvent& evt)
|
||||||
pxLogTextCtrl::~pxLogTextCtrl() throw()
|
pxLogTextCtrl::~pxLogTextCtrl() throw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void pxLogTextCtrl::ConcludeIssue()
|
|
||||||
{
|
|
||||||
if( HasWriteLock() ) return;
|
|
||||||
|
|
||||||
ScrollLines(1);
|
|
||||||
ShowPosition( GetLastPosition() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue