osx: Tweak launcher interface.
Change preferences window to use standard NSPathControl controls for selecting IWAD file paths. Make the command line arguments text box multiline to better support long command lines.
This commit is contained in:
parent
46b0556624
commit
d8cfdba5bf
6 changed files with 528 additions and 3708 deletions
|
|
@ -129,7 +129,6 @@ LAUNCHER_OBJS= \
|
||||||
AppController.o \
|
AppController.o \
|
||||||
Execute.o \
|
Execute.o \
|
||||||
IWADController.o \
|
IWADController.o \
|
||||||
IWADLocation.o \
|
|
||||||
LauncherManager.o \
|
LauncherManager.o \
|
||||||
main.o
|
main.o
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
#include "IWADController.h"
|
#include "IWADController.h"
|
||||||
#include "IWADLocation.h"
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
@ -58,7 +57,7 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
|
||||||
|
|
||||||
@implementation IWADController
|
@implementation IWADController
|
||||||
|
|
||||||
- (void) getIWADList: (IWADLocation **) iwadList
|
- (void) getIWADList: (NSPathControl **) iwadList
|
||||||
{
|
{
|
||||||
iwadList[IWAD_DOOM1] = self->doom1;
|
iwadList[IWAD_DOOM1] = self->doom1;
|
||||||
iwadList[IWAD_DOOM2] = self->doom2;
|
iwadList[IWAD_DOOM2] = self->doom2;
|
||||||
|
|
@ -90,7 +89,7 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
|
||||||
- (NSString *) getIWADLocation
|
- (NSString *) getIWADLocation
|
||||||
{
|
{
|
||||||
IWAD selectedIWAD;
|
IWAD selectedIWAD;
|
||||||
IWADLocation *iwadList[NUM_IWAD_TYPES];
|
NSPathControl *iwadList[NUM_IWAD_TYPES];
|
||||||
|
|
||||||
selectedIWAD = [self getSelectedIWAD];
|
selectedIWAD = [self getSelectedIWAD];
|
||||||
|
|
||||||
|
|
@ -102,7 +101,7 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
|
||||||
{
|
{
|
||||||
[self getIWADList: iwadList];
|
[self getIWADList: iwadList];
|
||||||
|
|
||||||
return [iwadList[selectedIWAD] getLocation];
|
return [[iwadList[selectedIWAD] URL] path];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,7 +132,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
- (void) setIWADConfig
|
- (void) setIWADConfig
|
||||||
{
|
{
|
||||||
IWADLocation *iwadList[NUM_IWAD_TYPES];
|
NSPathControl *iwadList[NUM_IWAD_TYPES];
|
||||||
NSUserDefaults *defaults;
|
NSUserDefaults *defaults;
|
||||||
NSString *key;
|
NSString *key;
|
||||||
NSString *value;
|
NSString *value;
|
||||||
|
|
@ -152,7 +151,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
if (value != nil)
|
if (value != nil)
|
||||||
{
|
{
|
||||||
[iwadList[i] setLocation:value];
|
[iwadList[i] setURL: [NSURL fileURLWithPath: value]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +189,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
- (BOOL) setDropdownList
|
- (BOOL) setDropdownList
|
||||||
{
|
{
|
||||||
IWADLocation *iwadList[NUM_IWAD_TYPES];
|
NSPathControl *iwadList[NUM_IWAD_TYPES];
|
||||||
BOOL have_wads;
|
BOOL have_wads;
|
||||||
id location;
|
id location;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
@ -205,7 +204,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
||||||
{
|
{
|
||||||
location = [iwadList[i] getLocation];
|
location = [[iwadList[i] URL] path];
|
||||||
|
|
||||||
if (location != nil && [location length] > 0)
|
if (location != nil && [location length] > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -229,7 +228,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
- (void) saveConfig
|
- (void) saveConfig
|
||||||
{
|
{
|
||||||
IWADLocation *iwadList[NUM_IWAD_TYPES];
|
NSPathControl *iwadList[NUM_IWAD_TYPES];
|
||||||
IWAD selectedIWAD;
|
IWAD selectedIWAD;
|
||||||
NSUserDefaults *defaults;
|
NSUserDefaults *defaults;
|
||||||
NSString *key;
|
NSString *key;
|
||||||
|
|
@ -245,7 +244,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
||||||
{
|
{
|
||||||
key = IWADFilenames[i];
|
key = IWADFilenames[i];
|
||||||
value = [iwadList[i] getLocation];
|
value = [[iwadList[i] URL] path];
|
||||||
|
|
||||||
[defaults setObject:value forKey:key];
|
[defaults setObject:value forKey:key];
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +297,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
- (char *) doomWadPath
|
- (char *) doomWadPath
|
||||||
{
|
{
|
||||||
IWADLocation *iwadList[NUM_IWAD_TYPES];
|
NSPathControl *iwadList[NUM_IWAD_TYPES];
|
||||||
NSString *location;
|
NSString *location;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
BOOL first;
|
BOOL first;
|
||||||
|
|
@ -313,7 +312,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
||||||
{
|
{
|
||||||
location = [iwadList[i] getLocation];
|
location = [[iwadList[i] URL] path];
|
||||||
|
|
||||||
if (location != nil && [location length] > 0)
|
if (location != nil && [location length] > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -330,7 +329,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
for (i=0; i<NUM_IWAD_TYPES; ++i)
|
||||||
{
|
{
|
||||||
location = [iwadList[i] getLocation];
|
location = [[iwadList[i] URL] path];
|
||||||
|
|
||||||
if (location != nil && [location length] > 0)
|
if (location != nil && [location length] > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -375,7 +374,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
- (BOOL) addIWADPath: (NSString *) path
|
- (BOOL) addIWADPath: (NSString *) path
|
||||||
{
|
{
|
||||||
IWADLocation *iwadList[NUM_IWAD_TYPES];
|
NSPathControl *iwadList[NUM_IWAD_TYPES];
|
||||||
NSArray *pathComponents;
|
NSArray *pathComponents;
|
||||||
NSString *filename;
|
NSString *filename;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
@ -394,7 +393,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
{
|
{
|
||||||
// Configure this IWAD.
|
// Configure this IWAD.
|
||||||
|
|
||||||
[iwadList[i] setLocation: path];
|
[iwadList[i] setURL: [NSURL fileURLWithPath: path]];
|
||||||
|
|
||||||
// Rebuild dropdown list and select the new IWAD.
|
// Rebuild dropdown list and select the new IWAD.
|
||||||
|
|
||||||
|
|
@ -411,7 +410,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
- (BOOL) selectGameByName: (const char *) name
|
- (BOOL) selectGameByName: (const char *) name
|
||||||
{
|
{
|
||||||
IWADLocation *iwadList[NUM_IWAD_TYPES];
|
NSPathControl *iwadList[NUM_IWAD_TYPES];
|
||||||
NSString *location;
|
NSString *location;
|
||||||
const char *name2;
|
const char *name2;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -429,7 +428,7 @@ static const char *NameForIWAD(IWAD iwad)
|
||||||
|
|
||||||
for (i = 0; i < NUM_IWAD_TYPES; ++i)
|
for (i = 0; i < NUM_IWAD_TYPES; ++i)
|
||||||
{
|
{
|
||||||
location = [iwadList[i] getLocation];
|
location = [[iwadList[i] URL] path];
|
||||||
name2 = NameForIWAD(i);
|
name2 = NameForIWAD(i);
|
||||||
|
|
||||||
if (!strcmp(name, name2)
|
if (!strcmp(name, name2)
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright(C) 2005-2014 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.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef LAUNCHER_IWADLOCATION_H
|
|
||||||
#define LAUNCHER_IWADLOCATION_H
|
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
|
||||||
|
|
||||||
#include "IWADController.h"
|
|
||||||
|
|
||||||
@interface IWADLocation : NSObject
|
|
||||||
{
|
|
||||||
IWADController *iwadController;
|
|
||||||
|
|
||||||
id locationConfigBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setButtonClicked: (id)sender;
|
|
||||||
- (NSString *) getLocation;
|
|
||||||
- (void) setLocation: (NSString *) value;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif /* #ifndef LAUNCHER_IWADLOCATION_H */
|
|
||||||
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright(C) 2005-2014 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.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
|
||||||
#include "IWADLocation.h"
|
|
||||||
|
|
||||||
static id WAD_TYPES[] =
|
|
||||||
{
|
|
||||||
@"wad", @"WAD"
|
|
||||||
};
|
|
||||||
|
|
||||||
@implementation IWADLocation
|
|
||||||
|
|
||||||
- (void) setButtonClicked: (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 setLocation: [filenames lastObject]];
|
|
||||||
|
|
||||||
[self->iwadController saveConfig];
|
|
||||||
[self->iwadController setDropdownList];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) getLocation
|
|
||||||
{
|
|
||||||
return [self->locationConfigBox stringValue];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setLocation: (NSString *) filename
|
|
||||||
{
|
|
||||||
[self->locationConfigBox setStringValue: filename];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
4100
pkg/osx/Resources/launcher.nib/designable.nib
generated
4100
pkg/osx/Resources/launcher.nib/designable.nib
generated
File diff suppressed because it is too large
Load diff
BIN
pkg/osx/Resources/launcher.nib/keyedobjects.nib
generated
BIN
pkg/osx/Resources/launcher.nib/keyedobjects.nib
generated
Binary file not shown.
Loading…
Reference in a new issue