ALL: synced with ScummVM commit 09bf38c120
This commit is contained in:
parent
b5d73d4c22
commit
b586571900
414 changed files with 111155 additions and 38279 deletions
|
@ -137,6 +137,10 @@ NSString *constructNSStringFromCString(const char *rawCString, CFStringEncoding
|
|||
}
|
||||
|
||||
static NSMenu *addMenu(const char *title, CFStringEncoding encoding, NSString *key, SEL setAs) {
|
||||
if (setAs && ![NSApp respondsToSelector:setAs]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *str = constructNSStringFromCString(title, encoding);
|
||||
NSMenu *menu = [[NSMenu alloc] initWithTitle:str];
|
||||
|
||||
|
@ -178,10 +182,6 @@ void releaseMenu() {
|
|||
}
|
||||
|
||||
void replaceApplicationMenuItems() {
|
||||
if (!delegate) {
|
||||
delegate = [[ScummVMMenuHandler alloc] init];
|
||||
}
|
||||
|
||||
// We cannot use [[NSApp mainMenu] removeAllItems] as removeAllItems was added in OS X 10.6
|
||||
// So remove the SDL generated menus one by one instead.
|
||||
while ([[NSApp mainMenu] numberOfItems] > 0) {
|
||||
|
@ -200,30 +200,38 @@ void replaceApplicationMenuItems() {
|
|||
#endif
|
||||
|
||||
NSMenu *appleMenu = addMenu("ResidualVM", kCFStringEncodingASCII, @"", @selector(setAppleMenu:));
|
||||
addMenuItem(_("About ResidualVM"), stringEncoding, nil, @selector(orderFrontStandardAboutPanel:), @"", appleMenu);
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("Hide ResidualVM"), stringEncoding, nil, @selector(hide:), @"h", appleMenu);
|
||||
addMenuItem(_("Hide Others"), stringEncoding, nil, @selector(hideOtherApplications:), @"h", appleMenu, (NSEventModifierFlagOption|NSEventModifierFlagCommand));
|
||||
addMenuItem(_("Show All"), stringEncoding, nil, @selector(unhideAllApplications:), @"", appleMenu);
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("Quit ResidualVM"), stringEncoding, nil, @selector(terminate:), @"q", appleMenu);
|
||||
if (appleMenu) {
|
||||
addMenuItem(_("About ResidualVM"), stringEncoding, nil, @selector(orderFrontStandardAboutPanel:), @"", appleMenu);
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("Hide ResidualVM"), stringEncoding, nil, @selector(hide:), @"h", appleMenu);
|
||||
addMenuItem(_("Hide Others"), stringEncoding, nil, @selector(hideOtherApplications:), @"h", appleMenu, (NSEventModifierFlagOption|NSEventModifierFlagCommand));
|
||||
addMenuItem(_("Show All"), stringEncoding, nil, @selector(unhideAllApplications:), @"", appleMenu);
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("Quit ResidualVM"), stringEncoding, nil, @selector(terminate:), @"q", appleMenu);
|
||||
}
|
||||
|
||||
NSMenu *windowMenu = addMenu(_("Window"), stringEncoding, @"", @selector(setWindowsMenu:));
|
||||
addMenuItem(_("Minimize"), stringEncoding, nil, @selector(performMiniaturize:), @"m", windowMenu);
|
||||
if (windowMenu) {
|
||||
addMenuItem(_("Minimize"), stringEncoding, nil, @selector(performMiniaturize:), @"m", windowMenu);
|
||||
}
|
||||
|
||||
NSMenu *helpMenu = addMenu(_("Help"), stringEncoding, @"", @selector(setHelpMenu:));
|
||||
addMenuItem(_("User Manual"), stringEncoding, delegate, @selector(openUserManual), @"", helpMenu);
|
||||
[helpMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("General Information"), stringEncoding, delegate, @selector(openReadme), @"", helpMenu);
|
||||
addMenuItem(_("What's New in ResidualVM"), stringEncoding, delegate, @selector(openNews), @"", helpMenu);
|
||||
[helpMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("Credits"), stringEncoding, delegate, @selector(openCredits), @"", helpMenu);
|
||||
addMenuItem(_("GPL License"), stringEncoding, delegate, @selector(openLicenseGPL), @"", helpMenu);
|
||||
addMenuItem(_("LGPL License"), stringEncoding, delegate, @selector(openLicenseLGPL), @"", helpMenu);
|
||||
addMenuItem(_("Freefont License"), stringEncoding, delegate, @selector(openLicenseFreefont), @"", helpMenu);
|
||||
addMenuItem(_("OFL License"), stringEncoding, delegate, @selector(openLicenseOFL), @"", helpMenu);
|
||||
addMenuItem(_("BSD License"), stringEncoding, delegate, @selector(openLicenseBSD), @"", helpMenu);
|
||||
|
||||
if (helpMenu) {
|
||||
if (!delegate) {
|
||||
delegate = [[ScummVMMenuHandler alloc] init];
|
||||
}
|
||||
addMenuItem(_("User Manual"), stringEncoding, delegate, @selector(openUserManual), @"", helpMenu);
|
||||
[helpMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("General Information"), stringEncoding, delegate, @selector(openReadme), @"", helpMenu);
|
||||
addMenuItem(_("What's New in ResidualVM"), stringEncoding, delegate, @selector(openNews), @"", helpMenu);
|
||||
[helpMenu addItem:[NSMenuItem separatorItem]];
|
||||
addMenuItem(_("Credits"), stringEncoding, delegate, @selector(openCredits), @"", helpMenu);
|
||||
addMenuItem(_("GPL License"), stringEncoding, delegate, @selector(openLicenseGPL), @"", helpMenu);
|
||||
addMenuItem(_("LGPL License"), stringEncoding, delegate, @selector(openLicenseLGPL), @"", helpMenu);
|
||||
addMenuItem(_("Freefont License"), stringEncoding, delegate, @selector(openLicenseFreefont), @"", helpMenu);
|
||||
addMenuItem(_("OFL License"), stringEncoding, delegate, @selector(openLicenseOFL), @"", helpMenu);
|
||||
addMenuItem(_("BSD License"), stringEncoding, delegate, @selector(openLicenseBSD), @"", helpMenu);
|
||||
}
|
||||
|
||||
[appleMenu release];
|
||||
[windowMenu release];
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "backends/platform/sdl/macosx/macosx.h"
|
||||
#include "backends/updates/macosx/macosx-updates.h"
|
||||
#include "backends/taskbar/macosx/macosx-taskbar.h"
|
||||
#include "backends/text-to-speech/macosx/macosx-text-to-speech.h"
|
||||
#include "backends/dialogs/macosx/macosx-dialogs.h"
|
||||
#include "backends/platform/sdl/macosx/macosx_wrapper.h"
|
||||
#include "backends/fs/posix/posix-fs.h"
|
||||
|
@ -44,11 +45,6 @@
|
|||
#include "ApplicationServices/ApplicationServices.h" // for LSOpenFSRef
|
||||
#include "CoreFoundation/CoreFoundation.h" // for CF* stuff
|
||||
|
||||
OSystem_MacOSX::OSystem_MacOSX()
|
||||
:
|
||||
OSystem_POSIX("Library/Preferences/ResidualVM Preferences") {
|
||||
}
|
||||
|
||||
OSystem_MacOSX::~OSystem_MacOSX() {
|
||||
releaseMenu();
|
||||
}
|
||||
|
@ -86,6 +82,11 @@ void OSystem_MacOSX::initBackend() {
|
|||
_updateManager = new MacOSXUpdateManager();
|
||||
#endif
|
||||
|
||||
#ifdef USE_TTS
|
||||
// Initialize Text to Speech manager
|
||||
_textToSpeechManager = new MacOSXTextToSpeechManager();
|
||||
#endif
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_POSIX::initBackend();
|
||||
}
|
||||
|
@ -147,7 +148,7 @@ bool OSystem_MacOSX::setTextInClipboard(const Common::String &text) {
|
|||
}
|
||||
|
||||
bool OSystem_MacOSX::openUrl(const Common::String &url) {
|
||||
CFURLRef urlRef = CFURLCreateWithBytes (NULL, (UInt8*)url.c_str(), url.size(), kCFStringEncodingASCII, NULL);
|
||||
CFURLRef urlRef = CFURLCreateWithBytes (NULL, (const UInt8*)url.c_str(), url.size(), kCFStringEncodingASCII, NULL);
|
||||
OSStatus err = LSOpenCFURLRef(urlRef, NULL);
|
||||
CFRelease(urlRef);
|
||||
return err == noErr;
|
||||
|
@ -200,6 +201,24 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
|
|||
#endif // USE_DETECTLANG
|
||||
}
|
||||
|
||||
Common::String OSystem_MacOSX::getDefaultConfigFileName() {
|
||||
const Common::String baseConfigName = "Library/Preferences/ResidualVM Preferences";
|
||||
|
||||
Common::String configFile;
|
||||
|
||||
Common::String prefix = getenv("HOME");
|
||||
|
||||
if (!prefix.empty() && (prefix.size() + 1 + baseConfigName.size()) < MAXPATHLEN) {
|
||||
configFile = prefix;
|
||||
configFile += '/';
|
||||
configFile += baseConfigName;
|
||||
} else {
|
||||
configFile = baseConfigName;
|
||||
}
|
||||
|
||||
return configFile;
|
||||
}
|
||||
|
||||
Common::String OSystem_MacOSX::getDefaultLogFileName() {
|
||||
const char *prefix = getenv("HOME");
|
||||
if (prefix == nullptr) {
|
||||
|
@ -210,7 +229,7 @@ Common::String OSystem_MacOSX::getDefaultLogFileName() {
|
|||
return Common::String();
|
||||
}
|
||||
|
||||
return Common::String(prefix) + "/Library/Logs/scummvm.log";
|
||||
return Common::String(prefix) + "/Library/Logs/residualvm.log";
|
||||
}
|
||||
|
||||
Common::String OSystem_MacOSX::getScreenshotsPath() {
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
class OSystem_MacOSX : public OSystem_POSIX {
|
||||
public:
|
||||
OSystem_MacOSX();
|
||||
~OSystem_MacOSX();
|
||||
|
||||
virtual bool hasFeature(Feature f);
|
||||
|
@ -50,6 +49,7 @@ public:
|
|||
virtual Common::String getScreenshotsPath();
|
||||
|
||||
protected:
|
||||
virtual Common::String getDefaultConfigFileName();
|
||||
virtual Common::String getDefaultLogFileName();
|
||||
|
||||
// Override createAudioCDManager() to get our Mac-specific
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue