diff --git a/checkin_notes b/checkin_notes index e42c9c8693..44bb718602 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1490,3 +1490,17 @@ David 1 Mar 2010 app.h app_control.cpp cs_prefs.cpp + +Charlie 1 Mar 2010 + - MGR: Fix more Event Log bugs: Exit from taskbar closes Event Log just + like exit from regular menu; enable and disable Copy Selected and Filter + buttons depending on selected messages; fix misplaced curly bracket in + CMainDocument::RunPeriodicRPCs() which caused excessive CPU usage and + other problems. + + clientgui/ + AdvancedFrame.cpp + BOINCBaseFrame.cpp + BOINCTaskBar.cpp + DlgEventLog.cpp, .h + MainDocument.cpp diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index 2f47f1d138..430cb310bd 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -2074,7 +2074,6 @@ void CAdvancedFrame::UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage ) m_pPeriodicRPCTimer->Start(1000); } else { m_pPeriodicRPCTimer->Start(m_iFrameRefreshRate); - } } else { // Set view refresh rate to 1 second diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index ab306bb3e0..bf53c0119a 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -310,22 +310,6 @@ void CBOINCBaseFrame::OnClose(wxCloseEvent& event) { wxGetApp().FrameClosed(); Destroy(); } else { -#ifdef __WXMAC__ - // If Event Log is currently the active (frontmost) window, just close it - wxTopLevelWindowMac* eventLog = NULL; - WindowRef macWin = NULL; - - eventLog = (wxTopLevelWindowMac*)wxWindow::FindWindowById(ID_DLGEVENTLOG); - if (eventLog) { - macWin = (WindowRef)eventLog->MacGetWindowRef(); - if (macWin) { - if (IsWindowActive(macWin)) { - eventLog->Close(); - return; - } - } - } -#endif Hide(); } diff --git a/clientgui/BOINCTaskBar.cpp b/clientgui/BOINCTaskBar.cpp index 1b70a94839..a73868c01a 100644 --- a/clientgui/BOINCTaskBar.cpp +++ b/clientgui/BOINCTaskBar.cpp @@ -32,6 +32,7 @@ #include "BOINCBaseFrame.h" #include "BOINCClientManager.h" #include "DlgAbout.h" +#include "DlgEventLog.h" #include "Events.h" #ifdef __WXMAC__ @@ -117,6 +118,11 @@ void CTaskBarIcon::OnClose(wxCloseEvent& event) { RemoveIcon(); m_bTaskbarInitiatedShutdown = true; + CDlgEventLog* eventLog = wxGetApp().GetEventLog(); + if (eventLog) { + eventLog->Close(); + } + CBOINCBaseFrame* pFrame = wxGetApp().GetFrame(); if (pFrame) { wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame)); diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index d106ca20d5..6582be18b0 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -71,6 +71,8 @@ BEGIN_EVENT_TABLE( CDlgEventLog, wxDialog ) EVT_BUTTON(ID_TASK_MESSAGES_FILTERBYPROJECT, CDlgEventLog::OnMessagesFilter) EVT_BUTTON(ID_SIMPLE_HELP, CDlgEventLog::OnButtonHelp) EVT_CLOSE(CDlgEventLog::OnClose) + EVT_LIST_ITEM_SELECTED(ID_SIMPLE_MESSAGESVIEW, CDlgEventLog::OnListSelected) + EVT_LIST_ITEM_DESELECTED(ID_SIMPLE_MESSAGESVIEW, CDlgEventLog::OnListDeselected) ////@end CDlgEventLog event table entries END_EVENT_TABLE() @@ -219,8 +221,8 @@ void CDlgEventLog::CreateControls() #endif itemBoxSizer4->Add(itemButton1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxButton* itemButton2 = new wxButton(this, ID_COPYSELECTED, _("Copy Selected"), wxDefaultPosition, wxDefaultSize ); - itemButton2->SetHelpText( + m_pCopySelectedButton = new wxButton(this, ID_COPYSELECTED, _("Copy Selected"), wxDefaultPosition, wxDefaultSize ); + m_pCopySelectedButton->SetHelpText( #ifdef __WXMAC__ _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.") #else @@ -228,7 +230,7 @@ void CDlgEventLog::CreateControls() #endif ); #if wxUSE_TOOLTIPS - itemButton2->SetToolTip( + m_pCopySelectedButton->SetToolTip( #ifdef __WXMAC__ _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.") #else @@ -236,7 +238,7 @@ void CDlgEventLog::CreateControls() #endif ); #endif - itemBoxSizer4->Add(itemButton2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemBoxSizer4->Add(m_pCopySelectedButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); #endif wxButton* itemButton44 = new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition, wxDefaultSize); @@ -424,7 +426,7 @@ wxInt32 CDlgEventLog::GetDocCount() { void CDlgEventLog::OnRefresh() { bool isConnected; static bool was_connected = false; - + if (!m_bProcessingRefreshEvent) { m_bProcessingRefreshEvent = true; @@ -484,18 +486,7 @@ void CDlgEventLog::OnRefresh() { m_iPreviousRowCount = iRowCount; } - bool enableButton = m_bIsFiltered; - if ((! m_bIsFiltered) && (m_iTotalDocCount > 0)) { - int n = m_pList->GetSelectedItemCount(); - if (n == 1) { - n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - MESSAGE* message = wxGetApp().GetDocument()->message(n); - if ((message->project).size() > 0) { - enableButton = true; - } - } - } - m_pFilterButton->Enable(enableButton); + UpdateButtons(); m_bProcessingRefreshEvent = false; } @@ -772,6 +763,37 @@ void CDlgEventLog::OnButtonHelp( wxCommandEvent& event ) { } +void CDlgEventLog::UpdateButtons() { + bool enableFilterButton = m_bIsFiltered; + bool enableCopySelectedButon = false; + if ((! m_bIsFiltered) && (m_iTotalDocCount > 0)) { + int n = m_pList->GetSelectedItemCount(); + if (n > 0) { + enableCopySelectedButon = true; + } + if (n == 1) { + n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + MESSAGE* message = wxGetApp().GetDocument()->message(n); + if ((message->project).size() > 0) { + enableFilterButton = true; + } + } + } + m_pFilterButton->Enable(enableFilterButton); + m_pCopySelectedButton->Enable(enableCopySelectedButon); +} + + +void CDlgEventLog::OnListSelected(wxListEvent& event) { + UpdateButtons(); +} + + +void CDlgEventLog::OnListDeselected(wxListEvent& event) { + UpdateButtons(); +} + + wxString CDlgEventLog::OnListGetItemText(long item, long column) const { wxString strBuffer = wxEmptyString; wxInt32 index = GetFilteredMessageIndex(item); diff --git a/clientgui/DlgEventLog.h b/clientgui/DlgEventLog.h index 78a3241ea4..7ec2785924 100644 --- a/clientgui/DlgEventLog.h +++ b/clientgui/DlgEventLog.h @@ -138,6 +138,7 @@ private: bool m_bIsFiltered; std::string m_strFilteredProjectName; wxButton* m_pFilterButton; + wxButton* m_pCopySelectedButton; wxListItemAttr* m_pMessageInfoAttr; wxListItemAttr* m_pMessageErrorAttr; @@ -151,6 +152,10 @@ private: bool RestoreState(); void RestoreWindowDimensions(); + void UpdateButtons(); + void OnListSelected(wxListEvent& event); + void OnListDeselected(wxListEvent& event); + bool EnsureLastItemVisible(); wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatTime( wxInt32 item, wxString& strBuffer ) const; diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 4be391945b..f5ed29fe7e 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -898,10 +898,11 @@ void CMainDocument::RunPeriodicRPCs(int frameRefreshRate) { request.resultPtr = &m_iGet_messages_rpc_result; RequestRPC(request); - - ts = dtNow - m_dtCachedStateTimestamp; - if (ts.GetSeconds() >= STATERPC_INTERVAL) { } + + ts = dtNow - m_dtCachedStateTimestamp; + if (ts.GetSeconds() >= STATERPC_INTERVAL) { + // *********** RPC_GET_STATE ************** request.clear();