commit 1030e29175f5836f4033cfb0656200c43b5d7b11 Author: Simon Howard Date: Fri Dec 25 00:42:51 2009 +0000 Check in current launcher code. Subversion-branch: /launcher Subversion-revision: 1751 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bbee65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ + +# These are the default patterns globally ignored by Subversion: +*.o +*.lo +*.la +*.al +.libs +*.so +*.so.[0-9]* +*.a +*.pyc +*.pyo +*.rej +*~ +.#* +.*.swp +.DS_store diff --git a/AppController.h b/AppController.h new file mode 100644 index 0000000..3c09bab --- /dev/null +++ b/AppController.h @@ -0,0 +1,54 @@ +/* + Project: chocolate-launcher + + Copyright (C) 2009 Free Software Foundation + + Author: Simon Howard,,, + + Created: 2009-12-24 22:48:58 +0000 by fraggle + + Application Controller + + This application 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 application 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 + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +*/ + +#ifndef _PCAPPPROJ_APPCONTROLLER_H +#define _PCAPPPROJ_APPCONTROLLER_H + +#include +// Uncomment if your application is Renaissance-based +//#include + +@interface AppController : NSObject +{ +} + ++ (void)initialize; + +- (id)init; +- (void)dealloc; + +- (void)awakeFromNib; + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotif; +- (BOOL)applicationShouldTerminate:(id)sender; +- (void)applicationWillTerminate:(NSNotification *)aNotif; +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName; + +- (void)showPrefPanel:(id)sender; + +@end + +#endif diff --git a/AppController.m b/AppController.m new file mode 100644 index 0000000..c1e4055 --- /dev/null +++ b/AppController.m @@ -0,0 +1,88 @@ +/* + Project: chocolate-launcher + + Copyright (C) 2009 Free Software Foundation + + Author: Simon Howard,,, + + Created: 2009-12-24 22:48:58 +0000 by fraggle + + Application Controller + + This application 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 application 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 + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +*/ + +#include "AppController.h" + +@implementation AppController + ++ (void)initialize +{ + NSMutableDictionary *defaults = [NSMutableDictionary dictionary]; + + /* + * Register your app's defaults here by adding objects to the + * dictionary, eg + * + * [defaults setObject:anObject forKey:keyForThatObject]; + * + */ + + [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +- (id)init +{ + if ((self = [super init])) + { + } + return self; +} + +- (void)dealloc +{ + [super dealloc]; +} + +- (void)awakeFromNib +{ + [[NSApp mainMenu] setTitle:@"chocolate-launcher"]; +} + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotif +{ +// Uncomment if your application is Renaissance-based +// [NSBundle loadGSMarkupNamed:@"Main" owner:self]; +} + +- (BOOL)applicationShouldTerminate:(id)sender +{ + return YES; +} + +- (void)applicationWillTerminate:(NSNotification *)aNotif +{ +} + +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName +{ +} + +- (void)showPrefPanel:(id)sender +{ +} + +@end diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..9e69818 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,54 @@ +# +# GNUmakefile - Generated by ProjectCenter +# + +include $(GNUSTEP_MAKEFILES)/common.make + +# +# Application +# +VERSION = 0.1 +PACKAGE_NAME = chocolate-launcher +APP_NAME = chocolate-launcher +chocolate-launcher_APPLICATION_ICON = + + +# +# Resource files +# +chocolate-launcher_RESOURCE_FILES = \ +Resources/launcher.gorm \ +Resources/Main.gsmarkup \ +Resources/MainMenu-GNUstep.gsmarkup \ +Resources/MainMenu-OSX.gsmarkup + + +# +# Header files +# +chocolate-launcher_HEADER_FILES = \ +AppController.h \ +IWADList.h \ +LauncherManager.h + +# +# Class files +# +chocolate-launcher_OBJC_FILES = \ +AppController.m \ +IWADList.m \ +LauncherManager.m + +# +# Other sources +# +chocolate-launcher_OBJC_FILES += \ +main.m + +# +# Makefiles +# +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/aggregate.make +include $(GNUSTEP_MAKEFILES)/application.make +-include GNUmakefile.postamble diff --git a/GNUmakefile.postamble b/GNUmakefile.postamble new file mode 100644 index 0000000..00007e8 --- /dev/null +++ b/GNUmakefile.postamble @@ -0,0 +1,40 @@ +# +# GNUmakefile.postamble - Generated by ProjectCenter +# + +# Things to do before compiling +# before-all:: + +# Things to do after compiling +# after-all:: + +# Things to do before installing +# before-install:: + +# Things to do after installing +# after-install:: + +# Things to do before uninstalling +# before-uninstall:: + +# Things to do after uninstalling +# after-uninstall:: + +# Things to do before cleaning +# before-clean:: + +# Things to do after cleaning +# after-clean:: + +# Things to do before distcleaning +# before-distclean:: + +# Things to do after distcleaning +# after-distclean:: + +# Things to do before checking +# before-check:: + +# Things to do after checking +# after-check:: + diff --git a/GNUmakefile.preamble b/GNUmakefile.preamble new file mode 100644 index 0000000..b33bdf0 --- /dev/null +++ b/GNUmakefile.preamble @@ -0,0 +1,25 @@ +# +# GNUmakefile.preamble - Generated by ProjectCenter +# + +# Additional flags to pass to the preprocessor +ADDITIONAL_CPPFLAGS += + +# Additional flags to pass to Objective C compiler +ADDITIONAL_OBJCFLAGS += + +# Additional flags to pass to C compiler +ADDITIONAL_CFLAGS += + +# Additional flags to pass to the linker +ADDITIONAL_LDFLAGS += + +# Additional include directories the compiler should search +ADDITIONAL_INCLUDE_DIRS += + +# Additional library directories the linker should search +ADDITIONAL_LIB_DIRS += + +# Additional GUI libraries to link +ADDITIONAL_GUI_LIBS += + diff --git a/IWADList.h b/IWADList.h new file mode 100644 index 0000000..3a97294 --- /dev/null +++ b/IWADList.h @@ -0,0 +1,16 @@ +/* All Rights reserved */ + +#include + +@interface IWADList : NSObject +{ + id iwadListTable; + NSMutableArray *iwads; +} + +- (void) addIwad: (id)sender; +- (void) deleteIwad: (id)sender; +- (NSString *) getSelectedIwad; + +@end + diff --git a/IWADList.m b/IWADList.m new file mode 100644 index 0000000..fb5a0d2 --- /dev/null +++ b/IWADList.m @@ -0,0 +1,139 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// 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. +// +//----------------------------------------------------------------------------- +// +// Controller for managing the list of IWAD files. +// +//----------------------------------------------------------------------------- + +#include +#include "IWADList.h" + +static id WAD_TYPES[] = { + @"wad", @"WAD" +}; + +@implementation IWADList + +// Constructor. + +- init +{ + self = [super init]; + + iwads = [NSMutableArray array]; + [iwads retain]; + + return self; +} + +// Callback invoked when the add IWAD button is clicked. + +- (void) addIwad: (id)sender +{ + NSArray *wadTypes = [NSArray arrayWithObjects: WAD_TYPES count: 2]; + NSArray *filenames; + id filename; + NSOpenPanel *openPanel; + int result; + + [wadTypes retain]; + + // Open a file selector for the new file. + + openPanel = [NSOpenPanel openPanel]; + [openPanel setTitle: @"Add IWAD file"]; + [openPanel setCanChooseFiles: YES]; + [openPanel setCanChooseDirectories: NO]; + + result = [openPanel runModalForTypes: wadTypes]; + + // If the "OK" button was clicked, add the new IWAD file to the list. + + if (result == NSOKButton) + { + filenames = [openPanel filenames]; + filename = [filenames lastObject]; + [filename retain]; + [iwads addObject: filename]; + [iwadListTable reloadData]; + } +} + +// Callback invoked when the delete IWAD button is clicked. + +- (void) deleteIwad: (id)sender +{ + int row; + id str; + + [iwadListTable setHeaderView: nil]; + + // Check that a valid IWAD is selected. + + row = [iwadListTable selectedRow]; + + if (row >= 0 && row < [iwads count]) + { + str = [iwads objectAtIndex:row]; + + // Remove from the list. + + [iwads removeObjectAtIndex: row]; + [str release]; + [iwadListTable reloadData]; + } +} + +// Used by the table controller - returns number of rows for the table. + +- (int) numberOfRowsInTableView:(NSTableView *)aTableView +{ +printf("numberOfRowsInTableView\n"); + return [iwads count]; +} + +// Used by the table controller to get the contents for a cell. + +- (id) tableView:(NSTableView *) aTableView + objectValueForTableColumn: (NSTableColumn *) aTableColumn + row: (int) rowIndex +{ +printf("tableView\n"); + return [iwads objectAtIndex:rowIndex]; +} + +// Public interface to get the selected IWAD. + +- (NSString *) getSelectedIwad +{ + if ([iwads count] <= 0) + { + return nil; + } + else + { + return [iwads objectAtIndex:[iwadListTable selectedRow]]; + } +} + +@end + diff --git a/LauncherManager.h b/LauncherManager.h new file mode 100644 index 0000000..96c7478 --- /dev/null +++ b/LauncherManager.h @@ -0,0 +1,15 @@ +/* All Rights reserved */ + +#include + +@interface LauncherManager : NSObject +{ + id commandLineArguments; + id iwadList; +} + +- (void) launch: (id)sender; +- (void) runSetup: (id)sender; + +@end + diff --git a/LauncherManager.m b/LauncherManager.m new file mode 100644 index 0000000..05417f8 --- /dev/null +++ b/LauncherManager.m @@ -0,0 +1,51 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// 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. +// +//----------------------------------------------------------------------------- +// +// Controller for the launcher program. +// +//----------------------------------------------------------------------------- + +#include +#include "LauncherManager.h" +#include "IWADList.h" + +@implementation LauncherManager + +// Callback invoked when the launch button is clicked. + +- (void) launch: (id)sender +{ + printf("launch the game\n"); + printf("arguments: -iwad %s %s\n", + [[iwadList getSelectedIwad] UTF8String], + [[commandLineArguments stringValue] UTF8String]); +} + +// Callback invoked when the setup tool button is clicked. + +- (void) runSetup: (id)sender +{ + printf("run setup tool\n"); +} + +@end + diff --git a/PC.project b/PC.project new file mode 100644 index 0000000..b30849d --- /dev/null +++ b/PC.project @@ -0,0 +1,87 @@ +{ + APPLICATIONICON = ""; + APP_DOCUMENT_BASED = NO; + APP_TYPE = GORM; + BUILDER_ARGS = ( + ); + CLASS_FILES = ( + AppController.m, + IWADList.m, + LauncherManager.m + ); + COMPILEROPTIONS = ""; + CPPOPTIONS = ""; + CREATION_DATE = "2009-12-24 22:48:58 +0000"; + DOCU_FILES = ( + ); + FRAMEWORKS = ( + ); + HEADER_FILES = ( + AppController.h, + IWADList.h, + LauncherManager.h + ); + IMAGES = ( + ); + INSTALLDIR = "$(HOME)/GNUstep"; + INTERFACES = ( + launcher.gorm, + Main.gsmarkup, + "MainMenu-GNUstep.gsmarkup", + "MainMenu-OSX.gsmarkup" + ); + LANGUAGE = English; + LAST_EDITING = "2009-12-25 00:36:37 +0000"; + LIBRARIES = ( + "gnustep-base", + "gnustep-gui" + ); + LINKEROPTIONS = ""; + LOCALIZED_RESOURCES = ( + ); + MAININTERFACE = launcher.gorm; + MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)"; + OBJC_COMPILEROPTIONS = ""; + OTHER_RESOURCES = ( + ); + OTHER_SOURCES = ( + main.m + ); + PC_WINDOWS = { + ProjectBrowser = "{x = 0; y = 0; width = 786; height = 161}"; + ProjectWindow = "178 32 810 544 0 0 1024 600 "; + ShowToolbar = YES; + }; + PRINCIPAL_CLASS = NSApplication; + PROJECT_AUTHORS = ( + ); + PROJECT_COPYRIGHT = "Copyright (C) 200x"; + PROJECT_COPYRIGHT_DESC = "Released under ..."; + PROJECT_CREATOR = "Simon Howard,,,"; + PROJECT_DESCRIPTION = "No description avaliable!"; + PROJECT_DOCUMENTTYPES = ( + ); + PROJECT_GROUP = "No group avaliable!"; + PROJECT_MAINTAINER = "Simon Howard,,,"; + PROJECT_NAME = "chocolate-launcher"; + PROJECT_RELEASE = 0.1; + PROJECT_SUMMARY = "No summary avaliable!"; + PROJECT_TYPE = Application; + PROJECT_URL = ""; + SEARCH_HEADER_DIRS = ( + ); + SEARCH_LIB_DIRS = ( + ); + SUBPROJECTS = ( + ); + SUPPORTING_FILES = ( + GNUmakefile.preamble, + GNUmakefile, + GNUmakefile.postamble, + "chocolate-launcherInfo.plist" + ); + USER_LANGUAGES = ( + BritainEnglish, + English + ); +} \ No newline at end of file diff --git a/Resources/Main.gsmarkup b/Resources/Main.gsmarkup new file mode 100644 index 0000000..e403420 --- /dev/null +++ b/Resources/Main.gsmarkup @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Resources/MainMenu-GNUstep.gsmarkup b/Resources/MainMenu-GNUstep.gsmarkup new file mode 100644 index 0000000..fa9bb76 --- /dev/null +++ b/Resources/MainMenu-GNUstep.gsmarkup @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/MainMenu-OSX.gsmarkup b/Resources/MainMenu-OSX.gsmarkup new file mode 100644 index 0000000..a20024f --- /dev/null +++ b/Resources/MainMenu-OSX.gsmarkup @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/launcher.gorm/128x128.png b/Resources/launcher.gorm/128x128.png new file mode 100644 index 0000000..0ef1fe9 Binary files /dev/null and b/Resources/launcher.gorm/128x128.png differ diff --git a/Resources/launcher.gorm/data.classes b/Resources/launcher.gorm/data.classes new file mode 100644 index 0000000..fece661 --- /dev/null +++ b/Resources/launcher.gorm/data.classes @@ -0,0 +1,43 @@ +{ + "## Comment" = "Do NOT change this file, Gorm maintains it"; + AppController = { + Actions = ( + "showPrefPanel:" + ); + Outlets = ( + ); + Super = NSObject; + }; + FirstResponder = { + Actions = ( + "addIwad:", + "deleteIwad:", + "launch:", + "orderFrontFontPanel:", + "runSetup:", + "showPrefPanel:" + ); + Super = NSObject; + }; + IWADList = { + Actions = ( + "addIwad:", + "deleteIwad:" + ); + Outlets = ( + iwadListTable + ); + Super = NSObject; + }; + LauncherManager = { + Actions = ( + "launch:", + "runSetup:" + ); + Outlets = ( + commandLineArguments, + iwadList + ); + Super = NSObject; + }; +} \ No newline at end of file diff --git a/Resources/launcher.gorm/data.info b/Resources/launcher.gorm/data.info new file mode 100644 index 0000000..1b45549 Binary files /dev/null and b/Resources/launcher.gorm/data.info differ diff --git a/Resources/launcher.gorm/objects.gorm b/Resources/launcher.gorm/objects.gorm new file mode 100644 index 0000000..b39a0d0 Binary files /dev/null and b/Resources/launcher.gorm/objects.gorm differ diff --git a/chocolate-launcherInfo.plist b/chocolate-launcherInfo.plist new file mode 100644 index 0000000..95d3ff6 --- /dev/null +++ b/chocolate-launcherInfo.plist @@ -0,0 +1,12 @@ +{ + ApplicationDescription = "No description avaliable!"; + ApplicationName = "chocolate-launcher"; + ApplicationRelease = 0.1; + Copyright = "Copyright (C) 200x"; + CopyrightDescription = "Released under ..."; + FullVersionID = 0.1; + NSExecutable = "chocolate-launcher"; + NSMainNibFile = launcher.gorm; + NSPrincipalClass = NSApplication; + NSRole = Application; +} \ No newline at end of file diff --git a/main.m b/main.m new file mode 100644 index 0000000..e1244de --- /dev/null +++ b/main.m @@ -0,0 +1,29 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// 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. +// +//----------------------------------------------------------------------------- + +#include + +int main(int argc, const char *argv[]) +{ + return NSApplicationMain (argc, argv); +} +