mirror of
https://github.com/chocolate-doom/launcher.git
synced 2024-11-10 07:12:06 +00:00
Restructure launcher interface to move IWAD configuration into a
separate window. Subversion-branch: /launcher Subversion-revision: 1753
This commit is contained in:
parent
a12b745823
commit
24b7ebbc9d
12 changed files with 138 additions and 254 deletions
|
@ -28,7 +28,8 @@ Resources/MainMenu-OSX.gsmarkup
|
||||||
#
|
#
|
||||||
chocolate-launcher_HEADER_FILES = \
|
chocolate-launcher_HEADER_FILES = \
|
||||||
AppController.h \
|
AppController.h \
|
||||||
IWADList.h \
|
IWADController.h \
|
||||||
|
IWADLocation.h \
|
||||||
LauncherManager.h
|
LauncherManager.h
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -36,7 +37,8 @@ LauncherManager.h
|
||||||
#
|
#
|
||||||
chocolate-launcher_OBJC_FILES = \
|
chocolate-launcher_OBJC_FILES = \
|
||||||
AppController.m \
|
AppController.m \
|
||||||
IWADList.m \
|
IWADController.m \
|
||||||
|
IWADLocation.m \
|
||||||
LauncherManager.m
|
LauncherManager.m
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
17
IWADController.h
Normal file
17
IWADController.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/* All Rights reserved */
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
@interface IWADController : NSObject
|
||||||
|
{
|
||||||
|
id chex;
|
||||||
|
id doom1;
|
||||||
|
id doom2;
|
||||||
|
id iwadSelector;
|
||||||
|
id configWindow;
|
||||||
|
id plutonia;
|
||||||
|
id tnt;
|
||||||
|
}
|
||||||
|
- (void) closeConfigWindow: (id)sender;
|
||||||
|
- (void) openConfigWindow: (id)sender;
|
||||||
|
@end
|
23
IWADController.m
Normal file
23
IWADController.m
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/* All Rights reserved */
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
#include "IWADController.h"
|
||||||
|
|
||||||
|
@implementation IWADController
|
||||||
|
|
||||||
|
|
||||||
|
- (void) closeConfigWindow: (id)sender
|
||||||
|
{
|
||||||
|
[self->configWindow orderOut: sender];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) openConfigWindow: (id)sender
|
||||||
|
{
|
||||||
|
if (![self->configWindow isVisible])
|
||||||
|
{
|
||||||
|
[self->configWindow makeKeyAndOrderFront: sender];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
40
IWADList.h
40
IWADList.h
|
@ -1,40 +0,0 @@
|
||||||
/* ... */
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// 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>
|
|
||||||
|
|
||||||
@interface IWADList : NSObject
|
|
||||||
{
|
|
||||||
id iwadListTable;
|
|
||||||
NSMutableArray *iwads;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) addIwad: (id)sender;
|
|
||||||
- (void) deleteIwad: (id)sender;
|
|
||||||
- (NSString *) getSelectedIwad;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
139
IWADList.m
139
IWADList.m
|
@ -1,139 +0,0 @@
|
||||||
/* ... */
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
|
|
14
IWADLocation.h
Normal file
14
IWADLocation.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/* All Rights reserved */
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
@interface IWADLocation : NSObject
|
||||||
|
{
|
||||||
|
id locationConfigBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setLocation: (id)sender;
|
||||||
|
- (NSString *) getLocation;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
45
IWADLocation.m
Normal file
45
IWADLocation.m
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/* All Rights reserved */
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
#include "IWADLocation.h"
|
||||||
|
|
||||||
|
static id WAD_TYPES[] = {
|
||||||
|
@"wad", @"WAD"
|
||||||
|
};
|
||||||
|
|
||||||
|
@implementation IWADLocation
|
||||||
|
|
||||||
|
- (void) setLocation: (id)sender
|
||||||
|
{
|
||||||
|
NSArray *wadTypes = [NSArray arrayWithObjects: WAD_TYPES count: 2];
|
||||||
|
NSOpenPanel *openPanel;
|
||||||
|
NSArray *filenames;
|
||||||
|
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];
|
||||||
|
[self->locationConfigBox setStringValue: [filenames lastObject]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) getLocation
|
||||||
|
{
|
||||||
|
return [self->locationConfigBox stringValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -1,39 +1,12 @@
|
||||||
/* ... */
|
/* All Rights reserved */
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// 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 <AppKit/AppKit.h>
|
||||||
|
|
||||||
@interface LauncherManager : NSObject
|
@interface LauncherManager : NSObject
|
||||||
{
|
{
|
||||||
id commandLineArguments;
|
id commandLineArguments;
|
||||||
id iwadList;
|
id iwadController;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) launch: (id)sender;
|
- (void) launch: (id)sender;
|
||||||
- (void) runSetup: (id)sender;
|
- (void) runSetup: (id)sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -1,51 +1,20 @@
|
||||||
/* ... */
|
/* All Rights reserved */
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// 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 <AppKit/AppKit.h>
|
||||||
#include "LauncherManager.h"
|
#include "LauncherManager.h"
|
||||||
#include "IWADList.h"
|
|
||||||
|
|
||||||
@implementation LauncherManager
|
@implementation LauncherManager
|
||||||
|
|
||||||
// Callback invoked when the launch button is clicked.
|
|
||||||
|
|
||||||
- (void) launch: (id)sender
|
- (void) launch: (id)sender
|
||||||
{
|
{
|
||||||
printf("launch the game\n");
|
/* insert your code here */
|
||||||
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
|
- (void) runSetup: (id)sender
|
||||||
{
|
{
|
||||||
printf("run setup tool\n");
|
/* insert your code here */
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
10
PC.project
10
PC.project
|
@ -6,7 +6,8 @@
|
||||||
);
|
);
|
||||||
CLASS_FILES = (
|
CLASS_FILES = (
|
||||||
AppController.m,
|
AppController.m,
|
||||||
IWADList.m,
|
IWADController.m,
|
||||||
|
IWADLocation.m,
|
||||||
LauncherManager.m
|
LauncherManager.m
|
||||||
);
|
);
|
||||||
COMPILEROPTIONS = "";
|
COMPILEROPTIONS = "";
|
||||||
|
@ -18,7 +19,8 @@
|
||||||
);
|
);
|
||||||
HEADER_FILES = (
|
HEADER_FILES = (
|
||||||
AppController.h,
|
AppController.h,
|
||||||
IWADList.h,
|
IWADController.h,
|
||||||
|
IWADLocation.h,
|
||||||
LauncherManager.h
|
LauncherManager.h
|
||||||
);
|
);
|
||||||
IMAGES = (
|
IMAGES = (
|
||||||
|
@ -55,7 +57,7 @@
|
||||||
PRINCIPAL_CLASS = NSApplication;
|
PRINCIPAL_CLASS = NSApplication;
|
||||||
PROJECT_AUTHORS = (
|
PROJECT_AUTHORS = (
|
||||||
);
|
);
|
||||||
PROJECT_COPYRIGHT = "Copyright (C) 200x";
|
PROJECT_COPYRIGHT = "Copyright (C) 2009";
|
||||||
PROJECT_COPYRIGHT_DESC = "Released under ...";
|
PROJECT_COPYRIGHT_DESC = "Released under ...";
|
||||||
PROJECT_CREATOR = "Simon Howard,,,";
|
PROJECT_CREATOR = "Simon Howard,,,";
|
||||||
PROJECT_DESCRIPTION = "No description avaliable!";
|
PROJECT_DESCRIPTION = "No description avaliable!";
|
||||||
|
@ -84,4 +86,4 @@
|
||||||
BritainEnglish,
|
BritainEnglish,
|
||||||
English
|
English
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,19 +13,37 @@
|
||||||
"addIwad:",
|
"addIwad:",
|
||||||
"deleteIwad:",
|
"deleteIwad:",
|
||||||
"launch:",
|
"launch:",
|
||||||
|
"closeConfigWindow:",
|
||||||
|
"openConfigWindow:",
|
||||||
"orderFrontFontPanel:",
|
"orderFrontFontPanel:",
|
||||||
"runSetup:",
|
"runSetup:",
|
||||||
|
"setLocation:",
|
||||||
"showPrefPanel:"
|
"showPrefPanel:"
|
||||||
);
|
);
|
||||||
Super = NSObject;
|
Super = NSObject;
|
||||||
};
|
};
|
||||||
IWADList = {
|
IWADController = {
|
||||||
Actions = (
|
Actions = (
|
||||||
"addIwad:",
|
"closeConfigWindow:",
|
||||||
"deleteIwad:"
|
"openConfigWindow:"
|
||||||
);
|
);
|
||||||
Outlets = (
|
Outlets = (
|
||||||
iwadListTable
|
chex,
|
||||||
|
doom1,
|
||||||
|
doom2,
|
||||||
|
iwadSelector,
|
||||||
|
configWindow,
|
||||||
|
plutonia,
|
||||||
|
tnt
|
||||||
|
);
|
||||||
|
Super = NSObject;
|
||||||
|
};
|
||||||
|
IWADLocation = {
|
||||||
|
Actions = (
|
||||||
|
"setLocation:"
|
||||||
|
);
|
||||||
|
Outlets = (
|
||||||
|
locationConfigBox
|
||||||
);
|
);
|
||||||
Super = NSObject;
|
Super = NSObject;
|
||||||
};
|
};
|
||||||
|
@ -36,7 +54,7 @@
|
||||||
);
|
);
|
||||||
Outlets = (
|
Outlets = (
|
||||||
commandLineArguments,
|
commandLineArguments,
|
||||||
iwadList
|
iwadController
|
||||||
);
|
);
|
||||||
Super = NSObject;
|
Super = NSObject;
|
||||||
};
|
};
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue