From 1fd0ad08ed4840e681e902bc1b9420a1d41619b4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 7 May 2011 23:52:26 +0000 Subject: Rework OS X launcher package. Include documentation files within the application bundle and add a help menu with links. Rework .dmg generation to generate a file with a "fancy" background image and overall nicer appearance. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2332 --- pkg/Makefile.am | 3 + pkg/osx/Execute.h | 1 + pkg/osx/Execute.m | 10 + pkg/osx/GNUmakefile | 29 ++- pkg/osx/LauncherManager.h | 6 + pkg/osx/LauncherManager.m | 25 ++ pkg/osx/Resources/launcher.nib/designable.nib | 296 ++++++++++++++++++++++-- pkg/osx/Resources/launcher.nib/keyedobjects.nib | Bin 24936 -> 27157 bytes pkg/osx/disk/background.png | Bin 0 -> 42578 bytes pkg/osx/disk/dir.DS_Store | Bin 0 -> 8196 bytes pkg/osx/dmgfix | 64 +++++ 11 files changed, 416 insertions(+), 18 deletions(-) create mode 100644 pkg/osx/disk/background.png create mode 100644 pkg/osx/disk/dir.DS_Store create mode 100755 pkg/osx/dmgfix diff --git a/pkg/Makefile.am b/pkg/Makefile.am index a22e4018..a2850195 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -7,10 +7,13 @@ osx/Resources/wadfile.icns \ osx/Resources/wadfile.png \ osx/Resources/launcher.nib/designable.nib \ osx/Resources/launcher.nib/keyedobjects.nib \ +osx/disk/dir.DS_Store \ +osx/disk/background.png \ osx/GNUmakefile \ osx/Info.plist.in osx/Info-gnustep.plist.in \ osx/PkgInfo \ osx/cp-with-libs \ +osx/dmgfix \ osx/main.m \ osx/AppController.m osx/AppController.h \ osx/Execute.m osx/Execute.h \ diff --git a/pkg/osx/Execute.h b/pkg/osx/Execute.h index 2098be8a..79591f64 100644 --- a/pkg/osx/Execute.h +++ b/pkg/osx/Execute.h @@ -26,6 +26,7 @@ void SetProgramLocation(const char *path); void ExecuteProgram(const char *executable, const char *iwad, const char *args); void OpenTerminalWindow(const char *doomwadpath); +void OpenDocumentation(const char *filename); #endif /* #ifndef LAUNCHER_EXECUTE_H */ diff --git a/pkg/osx/Execute.m b/pkg/osx/Execute.m index ffeddadd..0dcfbb7c 100644 --- a/pkg/osx/Execute.m +++ b/pkg/osx/Execute.m @@ -219,3 +219,13 @@ void OpenTerminalWindow(const char *doomwadpath) withApplication: @"Terminal"]; } +void OpenDocumentation(const char *filename) +{ + NSString *path; + + path = [NSString stringWithFormat: @"%s/Documentation/%s", + executable_path, filename]; + + [[NSWorkspace sharedWorkspace] openFile: path]; +} + diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index f9bb6417..514a208d 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -20,9 +20,17 @@ ifndef GNUSTEP_MAKEFILES # DMG file containing package: -$(DMG) : $(STAGING_DIR) +$(DMG) : tmp.dmg rm -f $@ - hdiutil create -volname "$(PACKAGE_STRING)" -srcdir $(STAGING_DIR) $@ + ./dmgfix "$(realpath tmp.dmg)" "$(PACKAGE_STRING)" "$(PACKAGE_NAME).app" + hdiutil convert -format UDZO -o $@ tmp.dmg + rm -f tmp.dmg + +tmp.dmg : $(STAGING_DIR) + rm -f $@ + hdiutil makehybrid -hfs -hfs-volume-name "$(PACKAGE_STRING)" \ + -hfs-openfolder $(STAGING_DIR) $(STAGING_DIR) \ + -o tmp.dmg endif @@ -46,12 +54,13 @@ APP_BIN_DIR=$(APP_DIR)/Contents/MacOS SRC_INFO_PLIST=Info.plist endif +APP_DOC_DIR=$(APP_BIN_DIR)/Documentation +APP_DOC_RELDIR=$(patsubst $(STAGING_DIR)/%,%,$(APP_DOC_DIR)) + $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) rm -rf $(STAGING_DIR) mkdir $(STAGING_DIR) - cp $(TOPLEVEL_DOCS) "$(STAGING_DIR)" - mkdir -p "$(APP_TOP_DIR)" cp -R Resources "$(APP_TOP_DIR)" cp PkgInfo "$(APP_TOP_DIR)" @@ -59,6 +68,13 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) mkdir -p "$(APP_BIN_DIR)" + mkdir -p "$(APP_DOC_DIR)" + cp $(TOPLEVEL_DOCS) "$(APP_DOC_DIR)" + + ln -s "$(APP_DOC_RELDIR)/COPYING" "$(STAGING_DIR)/Software License" + ln -s "$(APP_DOC_RELDIR)/README" "$(STAGING_DIR)/README" + ln -s /Applications "$(STAGING_DIR)" + cp launcher "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/launcher" @@ -69,13 +85,16 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) $(TOPLEVEL)/man/simplecpp -DPRECOMPILED -D__MACOSX__ \ < $(TOPLEVEL)/man/INSTALL.template \ - > $(STAGING_DIR)/INSTALL + > "$(APP_DOC_DIR)/INSTALL" find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; || true mkdir -p "$(APP_BIN_DIR)/man/man5" "$(APP_BIN_DIR)/man/man6" cp $(TOPLEVEL)/man/*.5 "$(APP_BIN_DIR)/man/man5" cp $(TOPLEVEL)/man/*.6 "$(APP_BIN_DIR)/man/man6" + cp disk/dir.DS_Store $(STAGING_DIR)/.DS_Store + cp disk/background.png $(STAGING_DIR)/background.png +# setfile -a V $(STAGING_DIR)/background.png clean : launcher_clean rm -f $(DMG) diff --git a/pkg/osx/LauncherManager.h b/pkg/osx/LauncherManager.h index 7e8c35cd..712bc093 100644 --- a/pkg/osx/LauncherManager.h +++ b/pkg/osx/LauncherManager.h @@ -45,6 +45,12 @@ forArgument: (NSString *) args; - (void) openTerminal: (id) sender; +- (void) openREADME: (id) sender; +- (void) openINSTALL: (id) sender; +- (void) openCMDLINE: (id) sender; +- (void) openCOPYING: (id) sender; +- (void) openDocumentation: (id) sender; + @end #endif /* #ifndef LAUNCHER_LAUNCHERMANAGER_H */ diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index 8c523ab4..df1ad18e 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -325,6 +325,31 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) free(doomwadpath); } +- (void) openREADME: (id) sender +{ + OpenDocumentation("README"); +} + +- (void) openINSTALL: (id) sender +{ + OpenDocumentation("INSTALL"); +} + +- (void) openCMDLINE: (id) sender +{ + OpenDocumentation("CMDLINE"); +} + +- (void) openCOPYING: (id) sender +{ + OpenDocumentation("COPYING"); +} + +- (void) openDocumentation: (id) sender +{ + OpenDocumentation(""); +} + - (void) awakeFromNib { [self->launcherWindow setTitle: @PACKAGE_NAME " Launcher"]; diff --git a/pkg/osx/Resources/launcher.nib/designable.nib b/pkg/osx/Resources/launcher.nib/designable.nib index 856ea06f..b3e76d22 100644 --- a/pkg/osx/Resources/launcher.nib/designable.nib +++ b/pkg/osx/Resources/launcher.nib/designable.nib @@ -2,19 +2,19 @@ 1060 - 10F569 - 823 - 1038.29 + 10J869 + 851 + 1038.35 461.00 com.apple.InterfaceBuilder.CocoaPlugin - 823 + 851 YES - + - + YES @@ -600,6 +600,73 @@ _NSWindowsMenu + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + Introduction + ? + 1048576 + 2147483647 + + + + + + Set up guide + + 2147483647 + + + + + + Command line reference + + 2147483647 + + + + + + More documentation... + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Software license + + 2147483647 + + + + + _NSHelpMenu + + _NSMainMenu @@ -921,6 +988,26 @@ 25 + + + 268 + {{17, 16}, {25, 25}} + + YES + + 67239424 + 134217728 + + + + -2038415105 + 161 + + + 200 + 25 + + {480, 316} @@ -1312,6 +1399,54 @@ 322 + + + openINSTALL: + + + + 374 + + + + openCMDLINE: + + + + 376 + + + + openDocumentation: + + + + 378 + + + + openCOPYING: + + + + 381 + + + + openREADME: + + + + 382 + + + + openINSTALL: + + + + 385 + @@ -1442,6 +1577,7 @@ + MainMenu @@ -1693,6 +1829,7 @@ + @@ -2035,6 +2172,73 @@ + + 369 + + + YES + + + + + + 370 + + + YES + + + + + + + + + + + 371 + + + + + 373 + + + + + 375 + + + + + 377 + + + + + 379 + + + + + 380 + + + + + 383 + + + YES + + + + + + 384 + + + @@ -2043,6 +2247,7 @@ YES 129.IBPluginDependency 129.ImportedFromIB2 + 130.IBEditorWindowLastContentRect 130.IBPluginDependency 130.ImportedFromIB2 131.IBPluginDependency @@ -2131,6 +2336,7 @@ 238.ImportedFromIB2 239.IBPluginDependency 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect 24.IBPluginDependency 24.ImportedFromIB2 240.IBPluginDependency @@ -2158,6 +2364,7 @@ 270.ImportedFromIB2 274.IBPluginDependency 274.ImportedFromIB2 + 275.IBEditorWindowLastContentRect 275.IBPluginDependency 275.ImportedFromIB2 281.IBPluginDependency @@ -2184,10 +2391,22 @@ 349.IBPluginDependency 350.IBPluginDependency 351.IBPluginDependency + 369.IBPluginDependency + 370.IBEditorWindowLastContentRect + 370.IBPluginDependency + 371.IBPluginDependency + 373.IBPluginDependency + 375.IBPluginDependency + 377.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency 5.IBPluginDependency 5.ImportedFromIB2 56.IBPluginDependency 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect 57.IBPluginDependency 57.ImportedFromIB2 58.IBPluginDependency @@ -2199,6 +2418,7 @@ YES com.apple.InterfaceBuilder.CocoaPlugin + {{576, 728}, {64, 6}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2231,9 +2451,9 @@ P4AAAL+AAABBiAAAwyEAAA - {{337, 406}, {530, 190}} + {{368, 418}, {530, 190}} com.apple.InterfaceBuilder.CocoaPlugin - {{337, 406}, {530, 190}} + {{368, 418}, {530, 190}} @@ -2274,13 +2494,13 @@ com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABBYAAAwgQAAA + P4AAAL+AAABBYAAAwigAAA - {{329, 484}, {480, 316}} + {{421, 438}, {480, 316}} com.apple.InterfaceBuilder.CocoaPlugin - {{329, 484}, {480, 316}} + {{421, 438}, {480, 316}} {213, 107} @@ -2303,6 +2523,7 @@ com.apple.InterfaceBuilder.CocoaPlugin + {{469, 741}, {194, 73}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2330,6 +2551,7 @@ com.apple.InterfaceBuilder.CocoaPlugin + {{425, 661}, {151, 153}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2340,7 +2562,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{329, 814}, {223, 20}} + {{329, 814}, {272, 20}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2357,9 +2579,21 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{540, 701}, {238, 113}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{341, 611}, {235, 203}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2384,7 +2618,7 @@ - 351 + 385 @@ -2410,6 +2644,7 @@ FirstResponder + NSObject IBUserSource @@ -2560,6 +2795,11 @@ YES launch: + openCMDLINE: + openCOPYING: + openDocumentation: + openINSTALL: + openREADME: openTerminal: runSetup: @@ -2568,6 +2808,11 @@ id id id + id + id + id + id + id @@ -2575,6 +2820,11 @@ YES launch: + openCMDLINE: + openCOPYING: + openDocumentation: + openINSTALL: + openREADME: openTerminal: runSetup: @@ -2584,6 +2834,26 @@ launch: id + + openCMDLINE: + id + + + openCOPYING: + id + + + openDocumentation: + id + + + openINSTALL: + id + + + openREADME: + id + openTerminal: id diff --git a/pkg/osx/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/Resources/launcher.nib/keyedobjects.nib index 93066265..7df7670c 100644 Binary files a/pkg/osx/Resources/launcher.nib/keyedobjects.nib and b/pkg/osx/Resources/launcher.nib/keyedobjects.nib differ diff --git a/pkg/osx/disk/background.png b/pkg/osx/disk/background.png new file mode 100644 index 00000000..07c3d81b Binary files /dev/null and b/pkg/osx/disk/background.png differ diff --git a/pkg/osx/disk/dir.DS_Store b/pkg/osx/disk/dir.DS_Store new file mode 100644 index 00000000..b7104637 Binary files /dev/null and b/pkg/osx/disk/dir.DS_Store differ diff --git a/pkg/osx/dmgfix b/pkg/osx/dmgfix new file mode 100755 index 00000000..560b17ed --- /dev/null +++ b/pkg/osx/dmgfix @@ -0,0 +1,64 @@ +#!/usr/bin/osascript +-- +-- Copyright(C) 2009 Simon Howard +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; either version 2 +-- of the License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. +-- +-- +-- AppleScript script to automatically set the view properties in a +-- .dmg file - ie. the background image, other Finder view options +-- and icon positions. +-- +-- Usage: dmgfix +-- + +on run argv + set dmgFile to POSIX file (item 1 of argv) + set diskName to item 2 of argv + set appName to item 3 of argv + + tell application "Finder" + --activate + open dmgFile + delay 1 + set win to the front Finder window + set theDisk to disk diskName + set the target of win to theDisk + + -- window options: + + set bgfile to file "background.png" of theDisk + set the bounds of win to {200, 200, 717, 536} + set icon size of icon view options of win to 96 + set background picture of icon view options of win to bgfile + set toolbar visible of win to false + + -- hide background file: + + set bgloc to quoted form of POSIX path of (bgfile as text) + do shell script "SetFile -a V " & bgloc + + -- icon positions: + + set position of file "README" of theDisk to {120, 250} + set position of file "Software License" of theDisk to {380, 250} + set position of file appName of theDisk to {70, 110} + set position of file "Applications" of theDisk to {450, 110} + + eject theDisk + end tell +end run + -- cgit v1.2.3