*** empty log message ***

svn path=/trunk/boinc/; revision=6531
This commit is contained in:
Charlie Fenton 2005-07-06 05:16:53 +00:00
parent 77b10a23ed
commit 8daba3cd79
13 changed files with 127 additions and 19 deletions

View File

@ -8902,3 +8902,23 @@ David 5 July 2005
sched/
sched_send.C
Charlie 5 July 2005
Mac: Integrated Hide of BOINCManager with close of main Manager window.
Closing window hides Manager application, opening window (from menubar
icon menu or from Dock menu) Shows application. Hiding or showing
application closes or opens window. This eliminates having just the
manager's menu bar pop up when a foreground application quits.
Disable all application-specific menu items in Dock menu and menubar
icon menu when a modal dialog is active. This matches the disabling
of items in the Manager's regular menus.
Fixed bug where all items in menubar icon menu were disabled, which
required clicking on the icon repeatedly.
clientgui/
BOINCGUIApp.cpp
BOINCTaskBar.cpp
MainFrame.cpp, .h
mac/
MacSysMenu.cpp, .h
SystemMenu.m

View File

@ -216,7 +216,10 @@ bool CBOINCGUIApp::OnInit() {
if (m_bFrameVisible) {
m_pFrame->Show();
} else {
#ifndef __WXMAC__
#ifdef __WXMAC__
GetCurrentProcess(&psn);
ShowHideProcess(&psn, false);
#else
m_pFrame->Show();
m_pFrame->Show(false);
#endif

View File

@ -183,6 +183,14 @@ void CTaskBarIcon::OnNetworkSelection(wxCommandEvent& event) {
void CTaskBarIcon::OnAbout(wxCommandEvent& WXUNUSED(event)) {
#ifdef __WXMAC__
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
bool wasVisible = IsProcessVisible(&psn);
SetFrontProcess(&psn); // Shows process if hidden
#endif
ResetTaskBar();
CDlgAbout* pDlg = new CDlgAbout(NULL);
@ -192,6 +200,11 @@ void CTaskBarIcon::OnAbout(wxCommandEvent& WXUNUSED(event)) {
if (pDlg) {
pDlg->Destroy();
#ifdef __WXMAC__
if (! wasVisible)
ShowHideProcess(&psn, false);
#endif
}
}
@ -420,6 +433,23 @@ void CTaskBarIcon::AdjustMenuItems(wxMenu* menu) {
} else {
menu->Check(ID_TB_NETWORKSUSPEND, false);
}
#ifdef __WXMAC__
WindowRef win = ActiveNonFloatingWindow();
WindowModality modality = kWindowModalityNone;
wxMenuItem *item;
unsigned int i;
if (win)
GetWindowModality(win, &modality, NULL);
for (i = 0; i <menu->GetMenuItemCount() ; i++) {
item = menu->FindItemByPosition(i);
if (modality == kWindowModalityAppModal)
item->Enable(false);
else
item->Enable(!(item->IsSeparator()));
}
#endif // __WXMAC__
}
const char *BOINC_RCSID_531575eeaa = "$Id$";

View File

@ -319,19 +319,11 @@ bool CMainFrame::CreateMenu() {
// File menu
wxMenu *menuFile = new wxMenu;
#ifdef __WXMAC__
menuFile->Append(
ID_HIDE,
_("Close"),
_("Closes the main BOINC Manager window")
);
#else
menuFile->Append(
ID_HIDE,
_("&Hide"),
_("Hides the main BOINC Manager window")
);
#endif
menuFile->AppendSeparator();
menuFile->AppendRadioItem(
@ -1786,5 +1778,21 @@ void CMainFrame::ExecuteBrowserLink(const wxString &strLink) {
wxHyperLink::ExecuteLink(strLink);
}
#ifdef __WXMAC__
bool CMainFrame::Show(bool show) {
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
if (show) {
SetFrontProcess(&psn); // Shows process if hidden
} else
if (IsProcessVisible(&psn))
ShowHideProcess(&psn, false);
return wxFrame::Show(show);
}
#endif // __WXMAC__
const char *BOINC_RCSID_d881a56dc5 = "$Id$";

View File

@ -97,6 +97,10 @@ public:
void ShowAlert( const wxString title, const wxString message, const int style, const bool notification_only = false );
void ExecuteBrowserLink( const wxString& strLink );
#ifdef __WXMAC__
bool Show( bool show = true );
#endif
private:
wxMenuBar* m_pMenubar;

View File

@ -38,6 +38,8 @@ pascal OSStatus SysMenuEventHandler( EventHandlerCallRef inHandlerCallRef,
EventRef inEvent, void* pData);
EventTypeSpec myEvents[] = { {kEventClassCommand, kEventCommandProcess},
{ kEventClassApplication, kEventAppHidden},
{ kEventClassApplication, kEventAppShown},
{kEventClassMenu, kEventMenuOpening} };
EventTypeSpec removeEventList[] = { { kEventClassApplication, kEventAppGetDockTileMenu } };
@ -54,6 +56,8 @@ CMacSystemMenu::CMacSystemMenu() : CTaskBarIcon()
theBitsRefData = theBits.GetBitmapData();
thePICT = theBitsRefData->GetPictHandle();
m_OpeningAboutDlg = false;
LoadPrivateFrameworkBundle( CFSTR("SystemMenu.bundle"), &SysMenuBundle );
if ( SysMenuBundle != NULL )
{
@ -176,7 +180,12 @@ pascal OSStatus SysMenuEventHandler( EventHandlerCallRef inHandlerCallRef,
if ((command.attributes == kHICommandFromMenu) &&
(command.commandID == 0))
return eventNotHandledErr;
pMSM = wxGetApp().GetMacSystemMenu();
if (command.commandID == wxID_ABOUT)
pMSM->SetOpeningAboutDlg(true);
// If not our system menu, pass event on to next event handler
// sysMenuRef = command.menu.menuRef;
if (PLstrcmp("\pBOINC!", (GetMenuTitle((sysMenuRef), theMenuTitle) )))
@ -184,7 +193,6 @@ pascal OSStatus SysMenuEventHandler( EventHandlerCallRef inHandlerCallRef,
// Change the command to point to the same item in our base (prototype)
// menu and pass the event on to the Dock's menu event handler.
pMSM = (CMacSystemMenu*&) pData;
baseMenu = (pMSM->GetCurrentMenu());
baseMenuRef = (MenuRef)(baseMenu->GetHMenu());
command.menu.menuRef = baseMenuRef;
@ -208,7 +216,7 @@ pascal OSStatus SysMenuEventHandler( EventHandlerCallRef inHandlerCallRef,
if (PLstrcmp("\pBOINC!", (GetMenuTitle((sysMenuRef), theMenuTitle) )))
return eventNotHandledErr;
pMSM = (CMacSystemMenu*&) pData;
pMSM = wxGetApp().GetMacSystemMenu();
baseMenu = (pMSM->GetCurrentMenu());
pMSM->AdjustMenuItems(baseMenu);
@ -231,6 +239,33 @@ pascal OSStatus SysMenuEventHandler( EventHandlerCallRef inHandlerCallRef,
}
return noErr;
case kEventClassApplication:
CMainFrame* pFrame = wxGetApp().GetFrame();
pMSM = wxGetApp().GetMacSystemMenu();
switch (eventKind) {
case kEventAppHidden:
if (pFrame)
pFrame->Hide();
pMSM->SetOpeningAboutDlg(false);
break;
case kEventAppShown:
// Don't open main window if "About" Dialog from task bar menu.
if (pMSM->IsOpeningAboutDlg()) {
pMSM->SetOpeningAboutDlg(false);
break;
}
if (ActiveNonFloatingWindow()) // Prevent infinite loop
break;
if (pFrame) {
pFrame->Show();
pFrame->SendSizeEvent();
}
break;
}
return eventNotHandledErr;
} // End switch (eventClass)

View File

@ -46,10 +46,12 @@ public:
SetUpSystemMenuProc SetUpSystemMenu;
SetSystemMenuIconProc SetSystemMenuIcon;
bool IsOpeningAboutDlg() { return m_OpeningAboutDlg; }
void SetOpeningAboutDlg(bool b) { m_OpeningAboutDlg = b; }
private:
EventHandlerRef m_pSysMenuEventHandlerRef;
bool m_OpeningAboutDlg;
};

View File

@ -148,11 +148,17 @@ void SetUpSystemMenu(MenuRef menuToCopy, PicHandle theIcon)
newItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:(NSString*)CFText action:NULL keyEquivalent:@""];
[newItem setTarget:self];
[sysMenu addItem:newItem];
if( IsMenuItemEnabled(menuToCopy, i) )
[newItem setEnabled:YES];
else
[newItem setEnabled:NO];
[newItem release];
CFRelease(CFText);
}
}
[sysMenu setAutoenablesItems:NO];
return;
}

View File

@ -1,5 +1,5 @@
/* Localized versions of Info.plist keys */
CFBundleName = "BOINC";
CFBundleShortVersionString = "BOINC version 5.50";
CFBundleGetInfoString = "BOINC version 5.50, Copyright 2005 University of California.";
CFBundleShortVersionString = "BOINC version 4.70";
CFBundleGetInfoString = "BOINC version 4.70, Copyright 2005 University of California.";

View File

@ -17,6 +17,6 @@
<key>CFBundleSignature</key>
<string>BNC!</string>
<key>CFBundleVersion</key>
<string>5.50</string>
<string>4.70</string>
</dict>
</plist>

View File

@ -15,6 +15,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.50</string>
<string>4.70</string>
</dict>
</plist>

View File

@ -17,7 +17,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.50</string>
<string>4.70</string>
<key>NSPrincipalClass</key>
<string>BOINC_Saver_ModuleView</string>
</dict>

View File

@ -15,6 +15,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.50</string>
<string>4.70</string>
</dict>
</plist>