summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-11-22 11:50:17 +0000
committerDavid Athay <ko2fan@gmail.com>2008-11-22 11:50:17 +0000
commitf7179cdca447c534029bb36a776595bbe3fc999e (patch)
tree9e10eac658c0994d78a7e1e2d0ff39c5ee780608
parent991389a535985af072f830b89e5113da82650fe5 (diff)
downloadmana-client-f7179cdca447c534029bb36a776595bbe3fc999e.tar.gz
mana-client-f7179cdca447c534029bb36a776595bbe3fc999e.tar.bz2
mana-client-f7179cdca447c534029bb36a776595bbe3fc999e.tar.xz
mana-client-f7179cdca447c534029bb36a776595bbe3fc999e.zip
Added custom nib for Cmd-Q on OSX
-rw-r--r--English.lproj/SDLMain.nib/classes.nib8
-rw-r--r--English.lproj/SDLMain.nib/info.nib20
-rw-r--r--English.lproj/SDLMain.nib/objects.xib77
-rw-r--r--Info.plist2
-rw-r--r--SDLMain.nib/classes.nib8
-rw-r--r--SDLMain.nib/info.nib20
-rw-r--r--SDLMain.nib/objects.xib80
-rwxr-xr-xsrc/SDLMain.m257
-rw-r--r--themanaworld.xcodeproj/garfield.mode1v323
-rw-r--r--themanaworld.xcodeproj/garfield.pbxuser169
-rw-r--r--themanaworld.xcodeproj/project.pbxproj15
11 files changed, 513 insertions, 166 deletions
diff --git a/English.lproj/SDLMain.nib/classes.nib b/English.lproj/SDLMain.nib/classes.nib
new file mode 100644
index 00000000..c4b887e7
--- /dev/null
+++ b/English.lproj/SDLMain.nib/classes.nib
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
diff --git a/English.lproj/SDLMain.nib/info.nib b/English.lproj/SDLMain.nib/info.nib
new file mode 100644
index 00000000..0411a4a5
--- /dev/null
+++ b/English.lproj/SDLMain.nib/info.nib
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBFramework Version</key>
+ <string>670</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>../themanaworld.xcodeproj</string>
+ <key>IBOldestOS</key>
+ <integer>5</integer>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>29</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9F33</string>
+ <key>targetFramework</key>
+ <string>IBCarbonFramework</string>
+</dict>
+</plist>
diff --git a/English.lproj/SDLMain.nib/objects.xib b/English.lproj/SDLMain.nib/objects.xib
new file mode 100644
index 00000000..6d0c83db
--- /dev/null
+++ b/English.lproj/SDLMain.nib/objects.xib
@@ -0,0 +1,77 @@
+<?xml version="1.0" standalone="yes"?>
+<object class="NSIBObjectData">
+ <object name="rootObject" class="NSCustomObject" id="1">
+ </object>
+ <array count="8" name="allObjects">
+ <object class="IBCarbonMenuItem" id="229">
+ <string name="title">Quit</string>
+ <string name="keyEquivalent">q</string>
+ <boolean name="notPreviousAlternate">TRUE</boolean>
+ <ostype name="command">quit</ostype>
+ </object>
+ <object class="IBCarbonWindow" id="166">
+ <boolean name="receiveUpdates">FALSE</boolean>
+ <boolean name="liveResize">TRUE</boolean>
+ <boolean name="compositing">TRUE</boolean>
+ <boolean name="isConstrained">FALSE</boolean>
+ <string name="title">Window</string>
+ <object name="rootControl" class="IBCarbonRootControl" id="167">
+ <string name="viewFrame">0 0 480 360 </string>
+ <string name="bounds">0 0 360 480 </string>
+ </object>
+ <string name="windowRect">204 300 564 780 </string>
+ <string name="ScreenRectAtEncodeTime">0 0 768 1024 </string>
+ </object>
+ <object class="IBCarbonMenu" id="184">
+ <string name="title">themanaworld</string>
+ <string name="name">_NSAppleMenu</string>
+ <array count="3" name="items">
+ <object class="IBCarbonMenuItem" id="187">
+ <string name="title">About themanaworld</string>
+ <int name="keyEquivalentModifier">0</int>
+ <ostype name="command">abou</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="230">
+ <boolean name="separator">TRUE</boolean>
+ <boolean name="disabled">TRUE</boolean>
+ <boolean name="notPreviousAlternate">TRUE</boolean>
+ </object>
+ <reference idRef="229"/>
+ </array>
+ </object>
+ <reference idRef="230"/>
+ <object class="IBCarbonMenu" id="29">
+ <string name="title">main</string>
+ <string name="name">_NSMainMenu</string>
+ <array count="1" name="items">
+ <object class="IBCarbonMenuItem" id="185">
+ <string name="title">themanaworld</string>
+ <reference name="submenu" idRef="184"/>
+ </object>
+ </array>
+ </object>
+ <reference idRef="167"/>
+ <reference idRef="187"/>
+ <reference idRef="185"/>
+ </array>
+ <array count="8" name="allParents">
+ <reference idRef="184"/>
+ <reference idRef="1"/>
+ <reference idRef="185"/>
+ <reference idRef="184"/>
+ <reference idRef="1"/>
+ <reference idRef="166"/>
+ <reference idRef="184"/>
+ <reference idRef="29"/>
+ </array>
+ <dictionary count="3" name="nameTable">
+ <string>File&apos;s Owner</string>
+ <reference idRef="1"/>
+ <string>MainWindow</string>
+ <reference idRef="166"/>
+ <string>MenuBar</string>
+ <reference idRef="29"/>
+ </dictionary>
+ <string name="targetFramework">IBCarbonFramework</string>
+ <unsigned_int name="nextObjectID">231</unsigned_int>
+</object>
diff --git a/Info.plist b/Info.plist
index 8699a8ae..36084dd8 100644
--- a/Info.plist
+++ b/Info.plist
@@ -21,7 +21,7 @@
<key>NSHumanReadableCopyright</key>
<string>Copyright 2008 The Mana World Development Team</string>
<key>NSMainNibFile</key>
- <string>main</string>
+ <string>SDLMain</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSPrincipleClass</key>
diff --git a/SDLMain.nib/classes.nib b/SDLMain.nib/classes.nib
new file mode 100644
index 00000000..c4b887e7
--- /dev/null
+++ b/SDLMain.nib/classes.nib
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
diff --git a/SDLMain.nib/info.nib b/SDLMain.nib/info.nib
new file mode 100644
index 00000000..a753dd52
--- /dev/null
+++ b/SDLMain.nib/info.nib
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBFramework Version</key>
+ <string>670</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>themanaworld.xcodeproj</string>
+ <key>IBOldestOS</key>
+ <integer>5</integer>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>29</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9F33</string>
+ <key>targetFramework</key>
+ <string>IBCarbonFramework</string>
+</dict>
+</plist>
diff --git a/SDLMain.nib/objects.xib b/SDLMain.nib/objects.xib
new file mode 100644
index 00000000..f4adb409
--- /dev/null
+++ b/SDLMain.nib/objects.xib
@@ -0,0 +1,80 @@
+<?xml version="1.0" standalone="yes"?>
+<object class="NSIBObjectData">
+ <object name="rootObject" class="NSCustomObject" id="1">
+ </object>
+ <array count="8" name="allObjects">
+ <object class="IBCarbonMenu" id="184">
+ <string name="title">themanaworld</string>
+ <string name="name">_NSAppleMenu</string>
+ <array count="3" name="items">
+ <object class="IBCarbonMenuItem" id="187">
+ <string name="title">About themanaworld</string>
+ <int name="keyEquivalentModifier">0</int>
+ <ostype name="command">abou</ostype>
+ </object>
+ <object class="IBCarbonMenuItem" id="230">
+ <boolean name="separator">TRUE</boolean>
+ <boolean name="disabled">TRUE</boolean>
+ <boolean name="notPreviousAlternate">TRUE</boolean>
+ </object>
+ <object class="IBCarbonMenuItem" id="229">
+ <string name="title">Quit</string>
+ <string name="keyEquivalent">q</string>
+ <boolean name="notPreviousAlternate">TRUE</boolean>
+ <ostype name="command">quit</ostype>
+ </object>
+ </array>
+ </object>
+ <object class="IBCarbonWindow" id="166">
+ <boolean name="receiveUpdates">FALSE</boolean>
+ <boolean name="hasCloseBox">FALSE</boolean>
+ <boolean name="hasHorizontalZoom">FALSE</boolean>
+ <boolean name="isResizable">FALSE</boolean>
+ <boolean name="hasVerticalZoom">FALSE</boolean>
+ <boolean name="compositing">TRUE</boolean>
+ <boolean name="isConstrained">FALSE</boolean>
+ <string name="title">Window</string>
+ <object name="rootControl" class="IBCarbonRootControl" id="167">
+ <string name="viewFrame">0 0 800 600 </string>
+ <string name="bounds">0 0 600 800 </string>
+ </object>
+ <string name="windowRect">154 408 754 1208 </string>
+ <string name="ScreenRectAtEncodeTime">64 0 1028 1680 </string>
+ </object>
+ <object class="IBCarbonMenuItem" id="185">
+ <string name="title">The Mana World</string>
+ <reference name="submenu" idRef="184"/>
+ </object>
+ <reference idRef="167"/>
+ <reference idRef="187"/>
+ <object class="IBCarbonMenu" id="29">
+ <string name="title">main</string>
+ <string name="name">_NSMainMenu</string>
+ <array count="1" name="items">
+ <reference idRef="185"/>
+ </array>
+ </object>
+ <reference idRef="229"/>
+ <reference idRef="230"/>
+ </array>
+ <array count="8" name="allParents">
+ <reference idRef="185"/>
+ <reference idRef="1"/>
+ <reference idRef="29"/>
+ <reference idRef="166"/>
+ <reference idRef="184"/>
+ <reference idRef="1"/>
+ <reference idRef="184"/>
+ <reference idRef="184"/>
+ </array>
+ <dictionary count="3" name="nameTable">
+ <string>File&apos;s Owner</string>
+ <reference idRef="1"/>
+ <string>MainWindow</string>
+ <reference idRef="166"/>
+ <string>MenuBar</string>
+ <reference idRef="29"/>
+ </dictionary>
+ <string name="targetFramework">IBCarbonFramework</string>
+ <unsigned_int name="nextObjectID">231</unsigned_int>
+</object>
diff --git a/src/SDLMain.m b/src/SDLMain.m
index 19694b5f..3d02719c 100755
--- a/src/SDLMain.m
+++ b/src/SDLMain.m
@@ -1,33 +1,67 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
- Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
- Non-NIB-Code & other changes: Max Horn <max@quendi.de>
-
- Feel free to customize this file to suit your needs
-*/
+ Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
+ Non-NIB-Code & other changes: Max Horn <max@quendi.de>
+
+ Feel free to customize this file to suit your needs
+ */
#import "SDL.h"
#import "SDLMain.h"
#import <sys/param.h> /* for MAXPATHLEN */
#import <unistd.h>
+/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
+ but the method still is there and works. To avoid warnings, we declare
+ it ourselves here. */
+@interface NSApplication(SDL_Missing_Methods)
+- (void)setAppleMenu:(NSMenu *)menu;
+@end
+
/* Use this flag to determine whether we use SDLMain.nib or not */
#define SDL_USE_NIB_FILE 0
+/* Use this flag to determine whether we use CPS (docking) or not */
+#define SDL_USE_CPS 1
+#ifdef SDL_USE_CPS
+/* Portions of CPS.h */
+typedef struct CPSProcessSerNum
+ {
+ UInt32 lo;
+ UInt32 hi;
+ } CPSProcessSerNum;
+
+extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
+extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
+extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
+
+#endif /* SDL_USE_CPS */
static int gArgc;
static char **gArgv;
static BOOL gFinderLaunch;
+static BOOL gCalledAppMainline = FALSE;
+
+static NSString *getApplicationName(void)
+{
+ NSDictionary *dict;
+ NSString *appName = 0;
+
+ /* Determine the application name */
+ dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
+ if (dict)
+ appName = [dict objectForKey: @"CFBundleName"];
+
+ if (![appName length])
+ appName = [[NSProcessInfo processInfo] processName];
+
+ return appName;
+}
#if SDL_USE_NIB_FILE
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
-#else
-/* An internal Apple class used to setup Apple menus */
-@interface NSAppleMenuController:NSObject {}
-- (void)controlMenu:(NSMenu *)aMenu;
-@end
#endif
@interface SDLApplication : NSApplication
@@ -44,32 +78,24 @@ static BOOL gFinderLaunch;
}
@end
-
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
- char parentdir[MAXPATHLEN];
- char *c;
-
- strncpy ( parentdir, gArgv[0], sizeof(parentdir) );
- c = (char*) parentdir;
-
- while (*c != '\0') /* go to end */
- c++;
-
- while (*c != '/') /* back up to parent */
- c--;
-
- *c++ = '\0'; /* cut off last part (binary name) */
-
if (shouldChdir)
{
- assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
- assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
- }
+ char parentdir[MAXPATHLEN];
+ CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+ CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
+ if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
+ assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
+ }
+ CFRelease(url);
+ CFRelease(url2);
+ }
+
}
#if SDL_USE_NIB_FILE
@@ -80,11 +106,11 @@ static BOOL gFinderLaunch;
NSRange aRange;
NSEnumerator *enumerator;
NSMenuItem *menuItem;
-
+
aRange = [[aMenu title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
-
+
enumerator = [[aMenu itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject]))
{
@@ -99,39 +125,57 @@ static BOOL gFinderLaunch;
#else
-void setupAppleMenu(void)
+static void setApplicationMenu(void)
{
/* warning: this code is very odd */
- NSAppleMenuController *appleMenuController;
NSMenu *appleMenu;
- NSMenuItem *appleMenuItem;
-
- appleMenuController = [[NSAppleMenuController alloc] init];
+ NSMenuItem *menuItem;
+ NSString *title;
+ NSString *appName;
+
+ appName = getApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""];
- appleMenuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
-
- [appleMenuItem setSubmenu:appleMenu];
-
- /* yes, we do need to add it and then remove it --
- if you don't add it, it doesn't get displayed
- if you don't remove it, you have an extra, titleless item in the menubar
- when you remove it, it appears to stick around
- very, very odd */
- [[NSApp mainMenu] addItem:appleMenuItem];
- [appleMenuController controlMenu:appleMenu];
- [[NSApp mainMenu] removeItem:appleMenuItem];
+
+ /* Add menu items */
+ title = [@"About " stringByAppendingString:appName];
+ [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ title = [@"Hide " stringByAppendingString:appName];
+ [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
+
+ menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
+ [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
+
+ [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
+
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ title = [@"Quit " stringByAppendingString:appName];
+ [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
+
+
+ /* Put menu into the menubar */
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
+ [menuItem setSubmenu:appleMenu];
+ [[NSApp mainMenu] addItem:menuItem];
+
+ /* Tell the application object that this is now the application menu */
+ [NSApp setAppleMenu:appleMenu];
+
+ /* Finally give up our references to the objects */
[appleMenu release];
- [appleMenuItem release];
+ [menuItem release];
}
/* Create a window menu */
-void setupWindowMenu(void)
+static void setupWindowMenu(void)
{
- NSMenu *windowMenu;
- NSMenuItem *windowMenuItem;
- NSMenuItem *menuItem;
-
-
+ NSMenu *windowMenu;
+ NSMenuItem *windowMenuItem;
+ NSMenuItem *menuItem;
+
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
/* "Minimize" item */
@@ -146,24 +190,35 @@ void setupWindowMenu(void)
/* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu];
-
+
/* Finally give up our references to the objects */
[windowMenu release];
[windowMenuItem release];
}
/* Replacement for NSApplicationMain */
-void CustomApplicationMain (argc, argv)
+static void CustomApplicationMain (int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDLMain *sdlMain;
-
+
/* Ensure the application object is initialised */
[SDLApplication sharedApplication];
+#ifdef SDL_USE_CPS
+ {
+ CPSProcessSerNum PSN;
+ /* Tell the dock about us */
+ if (!CPSGetCurrentProcess(&PSN))
+ if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
+ if (!CPSSetFrontProcess(&PSN))
+ [SDLApplication sharedApplication];
+ }
+#endif /* SDL_USE_CPS */
+
/* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
- setupAppleMenu();
+ setApplicationMenu();
setupWindowMenu();
/* Create SDLMain and make it the app delegate */
@@ -179,22 +234,73 @@ void CustomApplicationMain (argc, argv)
#endif
+
+/*
+ * Catch document open requests...this lets us notice files when the app
+ * was launched by double-clicking a document, or when a document was
+ * dragged/dropped on the app's icon. You need to have a
+ * CFBundleDocumentsType section in your Info.plist to get this message,
+ * apparently.
+ *
+ * Files are added to gArgv, so to the app, they'll look like command line
+ * arguments. Previously, apps launched from the finder had nothing but
+ * an argv[0].
+ *
+ * This message may be received multiple times to open several docs on launch.
+ *
+ * This message is ignored once the app's mainline has been called.
+ */
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+ const char *temparg;
+ size_t arglen;
+ char *arg;
+ char **newargv;
+
+ if (!gFinderLaunch) /* MacOS is passing command line args. */
+ return FALSE;
+
+ if (gCalledAppMainline) /* app has started, ignore this document. */
+ return FALSE;
+
+ temparg = [filename UTF8String];
+ arglen = SDL_strlen(temparg) + 1;
+ arg = (char *) SDL_malloc(arglen);
+ if (arg == NULL)
+ return FALSE;
+
+ newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
+ if (newargv == NULL)
+ {
+ SDL_free(arg);
+ return FALSE;
+ }
+ gArgv = newargv;
+
+ SDL_strlcpy(arg, temparg, arglen);
+ gArgv[gArgc++] = arg;
+ gArgv[gArgc] = NULL;
+ return TRUE;
+}
+
+
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
-
+
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
-
+
#if SDL_USE_NIB_FILE
/* Set the main menu to contain the real app name instead of "SDL App" */
- [self fixMenu:[NSApp mainMenu] withAppName:[[NSProcessInfo processInfo] processName]];
+ [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
#endif
-
+
/* Hand off to main application code */
+ gCalledAppMainline = TRUE;
status = SDL_main (gArgc, gArgv);
-
+
/* We're done, thank you for playing */
exit(status);
}
@@ -211,7 +317,7 @@ void CustomApplicationMain (argc, argv)
unichar *buffer;
NSRange localRange;
NSString *result;
-
+
bufferSize = selfLen + aStringLen - aRange.length;
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
@@ -224,7 +330,7 @@ void CustomApplicationMain (argc, argv)
localRange.location = 0;
localRange.length = aStringLen;
[aString getCharacters:(buffer+aRange.location) range:localRange];
-
+
/* Get last part into buffer */
localRange.location = aRange.location + aRange.length;
localRange.length = selfLen - localRange.location;
@@ -250,24 +356,23 @@ void CustomApplicationMain (argc, argv)
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
-
/* Copy the arguments into a global variable */
- int i;
-
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
+ gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
+ gArgv[0] = argv[0];
+ gArgv[1] = NULL;
gArgc = 1;
- gFinderLaunch = YES;
+ gFinderLaunch = YES;
} else {
+ int i;
gArgc = argc;
- gFinderLaunch = NO;
+ gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
+ for (i = 0; i <= argc; i++)
+ gArgv[i] = argv[i];
+ gFinderLaunch = NO;
}
- gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1));
- assert (gArgv != NULL);
- for (i = 0; i < gArgc; i++)
- gArgv[i] = argv[i];
- gArgv[i] = NULL;
-
+
#if SDL_USE_NIB_FILE
[SDLApplication poseAsClass:[NSApplication class]];
NSApplicationMain (argc, argv);
diff --git a/themanaworld.xcodeproj/garfield.mode1v3 b/themanaworld.xcodeproj/garfield.mode1v3
index 1b941b63..0076a8bc 100644
--- a/themanaworld.xcodeproj/garfield.mode1v3
+++ b/themanaworld.xcodeproj/garfield.mode1v3
@@ -267,15 +267,12 @@
<string>20286C29FDCF999611CA2CEA</string>
<string>5048396909E3304600765E4B</string>
<string>20286C2CFDCF999611CA2CEA</string>
- <string>1C37FBAC04509CD000000102</string>
- <string>927F62010ED4EA4500D919E6</string>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>16</integer>
- <integer>15</integer>
- <integer>14</integer>
+ <integer>1</integer>
+ <integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
@@ -326,19 +323,27 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>927F623A0ED4EBEB00D919E6</string>
+ <string>927F62650ED4F41700D919E6</string>
<key>history</key>
<array>
- <string>92B1EBDD0ED4E43D009AF197</string>
<string>92B1EBDE0ED4E43D009AF197</string>
<string>92B1EBF30ED4E5C5009AF197</string>
- <string>92B1EC470ED4EA36009AF197</string>
+ <string>927F625B0ED4F41700D919E6</string>
+ <string>927F625C0ED4F41700D919E6</string>
+ <string>927F625D0ED4F41700D919E6</string>
</array>
<key>prevStack</key>
<array>
<string>92B1EBE00ED4E43D009AF197</string>
<string>92B1EBE10ED4E43D009AF197</string>
<string>92B1EBF50ED4E5C5009AF197</string>
+ <string>927F625E0ED4F41700D919E6</string>
+ <string>927F625F0ED4F41700D919E6</string>
+ <string>927F62600ED4F41700D919E6</string>
+ <string>927F62610ED4F41700D919E6</string>
+ <string>927F62620ED4F41700D919E6</string>
+ <string>927F62630ED4F41700D919E6</string>
+ <string>927F62640ED4F41700D919E6</string>
</array>
</dict>
<key>SplitCount</key>
@@ -531,8 +536,8 @@
<key>WindowOrderList</key>
<array>
<string>92A4CC8A0D1C5F1E00CA28FB</string>
- <string>1C78EAAD065D492600B07095</string>
<string>1CD10A99069EF8BA00B06720</string>
+ <string>1C78EAAD065D492600B07095</string>
<string>/Users/garfield/programming/tmwclient/themanaworld.xcodeproj</string>
</array>
<key>WindowString</key>
diff --git a/themanaworld.xcodeproj/garfield.pbxuser b/themanaworld.xcodeproj/garfield.pbxuser
index ada25426..42957a89 100644
--- a/themanaworld.xcodeproj/garfield.pbxuser
+++ b/themanaworld.xcodeproj/garfield.pbxuser
@@ -134,23 +134,26 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 248834629;
- PBXWorkspaceStateSaveDate = 248834629;
+ PBXPerProjectTemplateStateSaveDate = 249045476;
+ PBXWorkspaceStateSaveDate = 249045476;
};
perUserProjectItems = {
- 927F62190ED4EA6A00D919E6 /* PlistBookmark */ = 927F62190ED4EA6A00D919E6 /* PlistBookmark */;
- 927F621C0ED4EA6A00D919E6 /* PlistBookmark */ = 927F621C0ED4EA6A00D919E6 /* PlistBookmark */;
- 927F623A0ED4EBEB00D919E6 /* PlistBookmark */ = 927F623A0ED4EBEB00D919E6 /* PlistBookmark */;
- 92B1EBDD0ED4E43D009AF197 = 92B1EBDD0ED4E43D009AF197 /* PBXTextBookmark */;
+ 927F625B0ED4F41700D919E6 = 927F625B0ED4F41700D919E6 /* PBXTextBookmark */;
+ 927F625C0ED4F41700D919E6 = 927F625C0ED4F41700D919E6 /* PBXTextBookmark */;
+ 927F625D0ED4F41700D919E6 = 927F625D0ED4F41700D919E6 /* PlistBookmark */;
+ 927F625E0ED4F41700D919E6 = 927F625E0ED4F41700D919E6 /* PlistBookmark */;
+ 927F625F0ED4F41700D919E6 = 927F625F0ED4F41700D919E6 /* PBXTextBookmark */;
+ 927F62600ED4F41700D919E6 = 927F62600ED4F41700D919E6 /* PBXTextBookmark */;
+ 927F62610ED4F41700D919E6 = 927F62610ED4F41700D919E6 /* PlistBookmark */;
+ 927F62620ED4F41700D919E6 = 927F62620ED4F41700D919E6 /* PBXTextBookmark */;
+ 927F62630ED4F41700D919E6 = 927F62630ED4F41700D919E6 /* PlistBookmark */;
+ 927F62640ED4F41700D919E6 = 927F62640ED4F41700D919E6 /* PBXTextBookmark */;
+ 927F62650ED4F41700D919E6 = 927F62650ED4F41700D919E6 /* PlistBookmark */;
92B1EBDE0ED4E43D009AF197 = 92B1EBDE0ED4E43D009AF197 /* PBXTextBookmark */;
92B1EBE00ED4E43D009AF197 = 92B1EBE00ED4E43D009AF197 /* PBXTextBookmark */;
92B1EBE10ED4E43D009AF197 = 92B1EBE10ED4E43D009AF197 /* PBXTextBookmark */;
- 92B1EBE90ED4E547009AF197 = 92B1EBE90ED4E547009AF197 /* PBXBookmark */;
92B1EBF30ED4E5C5009AF197 = 92B1EBF30ED4E5C5009AF197 /* PBXTextBookmark */;
92B1EBF50ED4E5C5009AF197 = 92B1EBF50ED4E5C5009AF197 /* PBXTextBookmark */;
- 92B1EC440ED4EA36009AF197 = 92B1EC440ED4EA36009AF197 /* PlistBookmark */;
- 92B1EC470ED4EA36009AF197 = 92B1EC470ED4EA36009AF197 /* PlistBookmark */;
- 92B1EC480ED4EA36009AF197 = 92B1EC480ED4EA36009AF197 /* PlistBookmark */;
};
sourceControlManager = 92BC3EC80BAEE3C8000DAB7F /* Source Control */;
userBuildSettings = {
@@ -172,9 +175,10 @@
};
92037A190ED2035A00D3712D /* SDLMain.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {511, 348}}";
+ sepNavIntBoundsRect = "{{0, 0}, {802, 506}}";
sepNavSelRange = "{0, 0}";
sepNavVisRange = "{0, 307}";
+ sepNavWindowFrame = "{{15, 389}, {861, 634}}";
};
};
924A42600C0874D00066885E /* Info.plist */ = {
@@ -193,7 +197,38 @@
sepNavVisRange = "{1251, 209}";
};
};
- 927F62190ED4EA6A00D919E6 /* PlistBookmark */ = {
+ 927F625B0ED4F41700D919E6 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 92037A190ED2035A00D3712D /* SDLMain.h */;
+ name = "SDLMain.h: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 307;
+ vrLoc = 0;
+ };
+ 927F625C0ED4F41700D919E6 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 92BC40E50BAEF54B000DAB7F /* SDLMain.m */;
+ name = "SDLMain.m: 14";
+ rLen = 0;
+ rLoc = 440;
+ rType = 0;
+ vrLen = 759;
+ vrLoc = 0;
+ };
+ 927F625D0ED4F41700D919E6 /* PlistBookmark */ = {
+ isa = PlistBookmark;
+ fRef = 924A42600C0874D00066885E /* Info.plist */;
+ fallbackIsa = PBXBookmark;
+ isK = 0;
+ kPath = (
+ );
+ name = /Users/garfield/programming/tmwclient/Info.plist;
+ rLen = 0;
+ rLoc = 2147483647;
+ };
+ 927F625E0ED4F41700D919E6 /* PlistBookmark */ = {
isa = PlistBookmark;
fRef = 924A42600C0874D00066885E /* Info.plist */;
fallbackIsa = PBXBookmark;
@@ -205,24 +240,76 @@
rLen = 0;
rLoc = 2147483647;
};
- 927F621C0ED4EA6A00D919E6 /* PlistBookmark */ = {
+ 927F625F0ED4F41700D919E6 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 92037A190ED2035A00D3712D /* SDLMain.h */;
+ name = "SDLMain.h: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 307;
+ vrLoc = 0;
+ };
+ 927F62600ED4F41700D919E6 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 92BC40E50BAEF54B000DAB7F /* SDLMain.m */;
+ name = "SDLMain.m: 14";
+ rLen = 0;
+ rLoc = 440;
+ rType = 0;
+ vrLen = 635;
+ vrLoc = 124;
+ };
+ 927F62610ED4F41700D919E6 /* PlistBookmark */ = {
isa = PlistBookmark;
fRef = 924A42600C0874D00066885E /* Info.plist */;
fallbackIsa = PBXBookmark;
isK = 0;
kPath = (
+ NSPrincipalClass,
);
name = /Users/garfield/programming/tmwclient/Info.plist;
rLen = 0;
rLoc = 2147483647;
};
- 927F623A0ED4EBEB00D919E6 /* PlistBookmark */ = {
+ 927F62620ED4F41700D919E6 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 92BC40E50BAEF54B000DAB7F /* SDLMain.m */;
+ name = "SDLMain.m: 14";
+ rLen = 0;
+ rLoc = 440;
+ rType = 0;
+ vrLen = 643;
+ vrLoc = 7053;
+ };
+ 927F62630ED4F41700D919E6 /* PlistBookmark */ = {
isa = PlistBookmark;
fRef = 924A42600C0874D00066885E /* Info.plist */;
fallbackIsa = PBXBookmark;
isK = 0;
kPath = (
- NSPrincipleClass,
+ );
+ name = /Users/garfield/programming/tmwclient/Info.plist;
+ rLen = 0;
+ rLoc = 2147483647;
+ };
+ 927F62640ED4F41700D919E6 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 92BC40E50BAEF54B000DAB7F /* SDLMain.m */;
+ name = "SDLMain.m: 14";
+ rLen = 0;
+ rLoc = 440;
+ rType = 0;
+ vrLen = 759;
+ vrLoc = 0;
+ };
+ 927F62650ED4F41700D919E6 /* PlistBookmark */ = {
+ isa = PlistBookmark;
+ fRef = 924A42600C0874D00066885E /* Info.plist */;
+ fallbackIsa = PBXBookmark;
+ isK = 0;
+ kPath = (
+ CFBundleVersion,
);
name = /Users/garfield/programming/tmwclient/Info.plist;
rLen = 0;
@@ -252,16 +339,6 @@
sepNavWindowFrame = "{{180, 8}, {627, 714}}";
};
};
- 92B1EBDD0ED4E43D009AF197 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 92BC40E50BAEF54B000DAB7F /* SDLMain.m */;
- name = "SDLMain.m: 14";
- rLen = 0;
- rLoc = 440;
- rType = 0;
- vrLen = 759;
- vrLoc = 0;
- };
92B1EBDE0ED4E43D009AF197 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 92BC3F660BAEE55B000DAB7F /* viewport.cpp */;
@@ -292,10 +369,6 @@
vrLen = 780;
vrLoc = 7501;
};
- 92B1EBE90ED4E547009AF197 /* PBXBookmark */ = {
- isa = PBXBookmark;
- fRef = 924A42600C0874D00066885E /* Info.plist */;
- };
92B1EBF30ED4E5C5009AF197 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 92BC3EEF0BAEE55A000DAB7F /* graphics.h */;
@@ -316,40 +389,6 @@
vrLen = 692;
vrLoc = 434;
};
- 92B1EC440ED4EA36009AF197 /* PlistBookmark */ = {
- isa = PlistBookmark;
- fRef = 924A42600C0874D00066885E /* Info.plist */;
- fallbackIsa = PBXBookmark;
- isK = 0;
- kPath = (
- );
- name = /Users/garfield/programming/tmwclient/Info.plist;
- rLen = 0;
- rLoc = 2147483647;
- };
- 92B1EC470ED4EA36009AF197 /* PlistBookmark */ = {
- isa = PlistBookmark;
- fRef = 924A42600C0874D00066885E /* Info.plist */;
- fallbackIsa = PBXBookmark;
- isK = 0;
- kPath = (
- NSPrincipalClass,
- );
- name = /Users/garfield/programming/tmwclient/Info.plist;
- rLen = 0;
- rLoc = 2147483647;
- };
- 92B1EC480ED4EA36009AF197 /* PlistBookmark */ = {
- isa = PlistBookmark;
- fRef = 924A42600C0874D00066885E /* Info.plist */;
- fallbackIsa = PBXBookmark;
- isK = 0;
- kPath = (
- );
- name = /Users/garfield/programming/tmwclient/Info.plist;
- rLen = 0;
- rLoc = 2147483647;
- };
92BC3EBC0BAEE3BB000DAB7F /* themanaworld */ = {
isa = PBXExecutable;
activeArgIndices = (
@@ -862,8 +901,8 @@
92BC40E50BAEF54B000DAB7F /* SDLMain.m */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {726, 3906}}";
- sepNavSelRange = "{440, 0}";
- sepNavVisRange = "{7053, 643}";
+ sepNavSelRange = "{3069, 0}";
+ sepNavVisRange = "{2696, 949}";
sepNavWindowFrame = "{{583, 96}, {627, 714}}";
};
};
diff --git a/themanaworld.xcodeproj/project.pbxproj b/themanaworld.xcodeproj/project.pbxproj
index 7bd2a8e0..5bd59f57 100644
--- a/themanaworld.xcodeproj/project.pbxproj
+++ b/themanaworld.xcodeproj/project.pbxproj
@@ -88,7 +88,6 @@
926F9CF80DB005FA00AACD26 /* itemshortcut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 926F9CF60DB005FA00AACD26 /* itemshortcut.cpp */; };
926F9D450DB00AFC00AACD26 /* itemshortcutcontainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 926F9D410DB00AFC00AACD26 /* itemshortcutcontainer.cpp */; };
926F9D460DB00AFC00AACD26 /* itemshortcutwindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 926F9D430DB00AFC00AACD26 /* itemshortcutwindow.cpp */; };
- 927F62590ED4F1D100D919E6 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 927F62570ED4F1D100D919E6 /* main.nib */; };
9294DA9B0C17E70400FCEDE9 /* physfs.c in Sources */ = {isa = PBXBuildFile; fileRef = 92BC3FAB0BAEE55B000DAB7F /* physfs.c */; };
9294DA9C0C17E70600FCEDE9 /* physfs_byteorder.c in Sources */ = {isa = PBXBuildFile; fileRef = 92BC3FAD0BAEE55B000DAB7F /* physfs_byteorder.c */; };
9294DAA10C17E73200FCEDE9 /* libpng.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9294DAA00C17E73200FCEDE9 /* libpng.framework */; };
@@ -474,7 +473,6 @@
926F9D420DB00AFC00AACD26 /* itemshortcutcontainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = itemshortcutcontainer.h; sourceTree = "<group>"; };
926F9D430DB00AFC00AACD26 /* itemshortcutwindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = itemshortcutwindow.cpp; sourceTree = "<group>"; };
926F9D440DB00AFC00AACD26 /* itemshortcutwindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = itemshortcutwindow.h; sourceTree = "<group>"; };
- 927F62580ED4F1D100D919E6 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; };
9294DAA00C17E73200FCEDE9 /* libpng.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libpng.framework; path = /Library/Frameworks/libpng.framework; sourceTree = "<absolute>"; };
92A4CC9D0D1C622E00CA28FB /* dye.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dye.cpp; path = src/resources/dye.cpp; sourceTree = "<group>"; };
92A4CCE00D1DA58D00CA28FB /* dir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dir.c; sourceTree = "<group>"; };
@@ -905,7 +903,6 @@
20286C2CFDCF999611CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
- 927F62570ED4F1D100D919E6 /* main.nib */,
92A4CCFE0D1DA8E500CA28FB /* LICENSE.rtf */,
924A42590C0871EC0066885E /* The Mana World.icns */,
924A3E590C085ED70066885E /* data */,
@@ -1405,7 +1402,6 @@
files = (
924A425A0C0871EC0066885E /* The Mana World.icns in Resources */,
92A4CCFF0D1DA8E500CA28FB /* LICENSE.rtf in Resources */,
- 927F62590ED4F1D100D919E6 /* main.nib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1577,17 +1573,6 @@
};
/* End PBXSourcesBuildPhase section */
-/* Begin PBXVariantGroup section */
- 927F62570ED4F1D100D919E6 /* main.nib */ = {
- isa = PBXVariantGroup;
- children = (
- 927F62580ED4F1D100D919E6 /* English */,
- );
- name = main.nib;
- sourceTree = "<group>";
- };
-/* End PBXVariantGroup section */
-
/* Begin XCBuildConfiguration section */
C0E91AC608A95435008D54AB /* Debug */ = {
isa = XCBuildConfiguration;