From 2381583668f866113601c32fc4bf96cedddc6026 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 26 Aug 2010 10:09:11 +0000 Subject: [PATCH] MGR: On Mac only, Close Window menu item (or its shortcut Command-w) closes the Event Log if it is the front window svn path=/trunk/boinc/; revision=22292 --- checkin_notes | 7 +++++++ clientgui/BOINCBaseFrame.cpp | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/checkin_notes b/checkin_notes index f8c9297bb2..b08e3d74aa 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6216,3 +6216,10 @@ Charlie 23 Aug 2010 BOINCClientManager.cpp BOINCGUIApp.cpp MainDocument.cpp + +Charlie 26 Aug 2010 + - MGR: On Mac only, Close Window menu item (or its shortcut Command-w) + closes the Event Log if it is the front window. + + clientgui/ + BOINCBaseFrame.cpp diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index 9d68afd3d0..714997b1e3 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -320,6 +320,23 @@ void CBOINCBaseFrame::OnClose(wxCloseEvent& event) { void CBOINCBaseFrame::OnCloseWindow(wxCommandEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnCloseWindow - Function Begin")); +#ifdef __WXMAC__ + CFStringRef frontWindowTitle, eventLogTitle; + CDlgEventLog* eventLog = wxGetApp().GetEventLog(); + if (eventLog) { + WindowRef win = FrontNonFloatingWindow(); + if (win) { + CopyWindowTitleAsCFString(win, &frontWindowTitle); + eventLogTitle = CFStringCreateWithCString(NULL, eventLog->GetTitle().char_str(), kCFStringEncodingUTF8); + if (CFStringCompare(eventLogTitle, frontWindowTitle, 0) == kCFCompareEqualTo) { + wxCloseEvent eventClose; + eventLog->OnClose(eventClose); + return; + } + } + } +#endif + Close(); wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnCloseWindow - Function End"));