From 909302c9d1ad302949c228e2a59696b1068517da Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 14 Mar 2013 04:03:06 -0700 Subject: [PATCH] MGR: Fix bugs in code which limits event log to 2000 messages --- clientgui/DlgEventLog.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index 148b9c2866..153e61ecae 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -133,11 +133,16 @@ CDlgEventLog::~CDlgEventLog() { bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin CDlgEventLog member initialisation + CMainDocument* pDoc = wxGetApp().GetDocument(); + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + m_iPreviousRowCount = 0; m_iTotalDocCount = 0; m_iPreviousTotalDocCount = 0; - m_iPreviousFirstMsgSeqNum = 0; - m_iPreviousLastMsgSeqNum = 0; + m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum(); + m_iPreviousLastMsgSeqNum = pDoc->GetLastMsgSeqNum(); + m_iNumDeletedFilteredRows = 0; m_iTotalDeletedFilterRows = 0; @@ -465,10 +470,14 @@ wxInt32 CDlgEventLog::GetDocCount() { ResetMessageFiltering(); m_iPreviousFirstMsgSeqNum = 0; m_iPreviousLastMsgSeqNum = 0; + m_iPreviousTotalDocCount = m_iTotalDocCount; + return m_iTotalDocCount; } numDeletedRows = pDoc->GetFirstMsgSeqNum() - m_iPreviousFirstMsgSeqNum; - if (numDeletedRows < 0) numDeletedRows = 0; + if ((numDeletedRows < 0) || (m_iPreviousFirstMsgSeqNum < 0)) { + numDeletedRows = 0; + } m_iNumDeletedFilteredRows = 0; if (s_bIsFiltered) { @@ -564,8 +573,8 @@ void CDlgEventLog::OnRefresh() { strLastMachineName = strNewMachineName; was_connected = false; ResetMessageFiltering(); - m_iPreviousFirstMsgSeqNum = 0; - m_iPreviousLastMsgSeqNum = 0; + m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum(); + m_iPreviousLastMsgSeqNum = pDoc->GetLastMsgSeqNum(); } }