Check in current launcher code.

Subversion-branch: /launcher
Subversion-revision: 1751
This commit is contained in:
Simon Howard 2009-12-25 00:42:51 +00:00
commit 1030e29175
20 changed files with 773 additions and 0 deletions

17
.gitignore vendored Normal file
View File

@ -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

54
AppController.h Normal file
View File

@ -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 <AppKit/AppKit.h>
// Uncomment if your application is Renaissance-based
//#include <Renaissance/Renaissance.h>
@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

88
AppController.m Normal file
View File

@ -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

54
GNUmakefile Normal file
View File

@ -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

40
GNUmakefile.postamble Normal file
View File

@ -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::

25
GNUmakefile.preamble Normal file
View File

@ -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 +=

16
IWADList.h Normal file
View File

@ -0,0 +1,16 @@
/* All Rights reserved */
#include <AppKit/AppKit.h>
@interface IWADList : NSObject
{
id iwadListTable;
NSMutableArray *iwads;
}
- (void) addIwad: (id)sender;
- (void) deleteIwad: (id)sender;
- (NSString *) getSelectedIwad;
@end

139
IWADList.m Normal file
View File

@ -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 <AppKit/AppKit.h>
#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

15
LauncherManager.h Normal file
View File

@ -0,0 +1,15 @@
/* All Rights reserved */
#include <AppKit/AppKit.h>
@interface LauncherManager : NSObject
{
id commandLineArguments;
id iwadList;
}
- (void) launch: (id)sender;
- (void) runSetup: (id)sender;
@end

51
LauncherManager.m Normal file
View File

@ -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 <AppKit/AppKit.h>
#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

87
PC.project Normal file
View File

@ -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
);
}

8
Resources/Main.gsmarkup Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<gsmarkup>
<objects>
<window/>
</objects>
</gsmarkup>

View File

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<!-- Remove any menu items and submenus which you don't need. Add any
menu items and submenus which you need. -->
<gsmarkup>
<objects>
<menu type="main">
<menu title="Info">
<menuItem title="Info Panel..."
action="orderFrontStandardInfoPanel:"/>
<menuItem title="Preferences..." action=""/>
<menuItem title="Help..." action="orderFrontHelpPanel:" key="?"/>
</menu>
<menu title="Windows">
<menuItem title="Arrange In Front" action="arrangeInFront:"/>
<menuItem title="Miniaturize Window" action="performMiniaturize:"
key="m"/>
<menuItem title="Close Window" action="performClose:" key="w"/>
</menu>
<menu title="Services" type="services"/>
<menuItem title="Hide" action="hide:" key="h"/>
<menuItem title="Quit" action="terminate:" key="q"/>
</menu>
</objects>
</gsmarkup>

View File

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<gsmarkup>
<objects>
<menu type="main">
<menu title="MyApplication" type="apple">
<menuItem title="About MyApplication"
action="orderFrontStandardAboutPanel:"/>
<menuSeparator/>
<menuItem title="Preferences..." action="runPreferencesPanel:"/>
<menu title="Services" type="services"/>
<menuSeparator/>
<menuItem title="Hide MyApplication" action="hide:" key="h"/>
<menuItem title="Hide Others" action="hideOtherApplications:"/>
<menuItem title="Show All" action="unhideAllApplications:"/>
<menuSeparator/>
<menuItem title="Quit MyApplication" action="terminate:" key="q"/>
</menu>
<menu title="File">
<menuItem title="New" action="" key="n"/>
<menuItem title="Open..." action="" key="o"/>
<menu title="Open Recent" type="openRecent">
<menuItem title="Clear menu" action=""/>
</menu>
<menuSeparator/>
<menuItem title="Close" action="performClose:" key="w"/>
<menuItem title="Save" action="" key="s"/>
<menuItem title="Save As..." action="" key="S"/>
<menuItem title="Revert" action=""/>
<menuSeparator/>
<menuItem title="Page Setup..." action="runPageLayout:" key="P"/>
<menuItem title="Print..." action="print:" key="p"/>
</menu>
<menu title="Edit">
<menuItem title="Undo" action="undo:" key="z"/>
<menuItem title="Redo" action="redo:" key="Z"/>
<menuSeparator/>
<menuItem title="Cut" action="cut:" key="x"/>
<menuItem title="Copy" action="copy:" key="c"/>
<menuItem title="Paste" action="paste:" key="v"/>
<menuItem title="Delete" action="delete:"/>
<menuItem title="Select All" action="selectAll:" key="a"/>
</menu>
<menu title="Window" type="windows">
<menuItem title="Close Window" action="performClose:" key="w"/>
<menuItem title="Minimize Window" action="performMiniaturize:"
key="m"/>
<menuSeparator/>
<menuItem title="Bring All to Front" action="arrangeInFront:" key=""/>
</menu>
<menu title="Help">
<menuItem title="MyApplication Help" action="showHelp:" key="?"/>
</menu>
</menu>
</objects>
</gsmarkup>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -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;
};
}

Binary file not shown.

Binary file not shown.

View File

@ -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;
}

29
main.m Normal file
View File

@ -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 <AppKit/AppKit.h>
int main(int argc, const char *argv[])
{
return NSApplicationMain (argc, argv);
}