OS X: whitespace-cleanup Objective-C files. Also does TAB-->space.

git-svn-id: https://svn.eduke32.com/eduke32@2431 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-03-08 19:16:47 +00:00
parent 3b89d3af08
commit 8b25714262
2 changed files with 150 additions and 150 deletions

View file

@ -36,7 +36,7 @@ static struct soundQuality_t {
{ {
NSMutableArray *modeslist3d; NSMutableArray *modeslist3d;
GameListSource *gamelistsrc; GameListSource *gamelistsrc;
IBOutlet NSButton *alwaysShowButton; IBOutlet NSButton *alwaysShowButton;
IBOutlet NSButton *fullscreenButton; IBOutlet NSButton *fullscreenButton;
IBOutlet NSTextView *messagesView; IBOutlet NSTextView *messagesView;
@ -44,7 +44,7 @@ static struct soundQuality_t {
IBOutlet NSPopUpButton *videoMode3DPUButton; IBOutlet NSPopUpButton *videoMode3DPUButton;
IBOutlet NSPopUpButton *soundQualityPUButton; IBOutlet NSPopUpButton *soundQualityPUButton;
IBOutlet NSScrollView *gameList; IBOutlet NSScrollView *gameList;
IBOutlet NSButton *cancelButton; IBOutlet NSButton *cancelButton;
IBOutlet NSButton *startButton; IBOutlet NSButton *startButton;
} }
@ -80,7 +80,7 @@ static struct soundQuality_t {
int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState); int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState);
int idx3d = -1; int idx3d = -1;
int xdim, ydim, bpp; int xdim, ydim, bpp;
if (firstTime) { if (firstTime) {
xdim = settings.xdim3d; xdim = settings.xdim3d;
ydim = settings.ydim3d; ydim = settings.ydim3d;
@ -92,7 +92,7 @@ static struct soundQuality_t {
ydim = validmode[mode3d].ydim; ydim = validmode[mode3d].ydim;
bpp = validmode[mode3d].bpp; bpp = validmode[mode3d].bpp;
} }
} }
mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1); mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1);
if (mode3d < 0) { if (mode3d < 0) {
@ -104,12 +104,12 @@ static struct soundQuality_t {
break; break;
} }
} }
[modeslist3d release]; [modeslist3d release];
[videoMode3DPUButton removeAllItems]; [videoMode3DPUButton removeAllItems];
modeslist3d = [[NSMutableArray alloc] init]; modeslist3d = [[NSMutableArray alloc] init];
for (i = 0; i < validmodecnt; i++) { for (i = 0; i < validmodecnt; i++) {
if (fullscreen == validmode[i].fs) { if (fullscreen == validmode[i].fs) {
if (i == mode3d) idx3d = [modeslist3d count]; if (i == mode3d) idx3d = [modeslist3d count];
@ -118,16 +118,16 @@ static struct soundQuality_t {
validmode[i].xdim, 0xd7, validmode[i].ydim, validmode[i].bpp]]; validmode[i].xdim, 0xd7, validmode[i].ydim, validmode[i].bpp]];
} }
} }
if (idx3d >= 0) [videoMode3DPUButton selectItemAtIndex:idx3d]; if (idx3d >= 0) [videoMode3DPUButton selectItemAtIndex:idx3d];
} }
- (void)populateSoundQuality:(BOOL)firstTime - (void)populateSoundQuality:(BOOL)firstTime
{ {
int i, curidx = -1; int i, curidx = -1;
[soundQualityPUButton removeAllItems]; [soundQualityPUButton removeAllItems];
for (i = 0; soundQualities[i].frequency > 0; i++) { for (i = 0; soundQualities[i].frequency > 0; i++) {
const char *ch; const char *ch;
switch (soundQualities[i].channels) { switch (soundQualities[i].channels) {
@ -135,14 +135,14 @@ static struct soundQuality_t {
case 2: ch = "Stereo"; break; case 2: ch = "Stereo"; break;
default: ch = "?"; break; default: ch = "?"; break;
} }
NSString *s = [NSString stringWithFormat:@"%dkHz, %d-bit, %s", NSString *s = [NSString stringWithFormat:@"%dkHz, %d-bit, %s",
soundQualities[i].frequency / 1000, soundQualities[i].frequency / 1000,
soundQualities[i].samplesize, soundQualities[i].samplesize,
ch ch
]; ];
[soundQualityPUButton addItemWithTitle:s]; [soundQualityPUButton addItemWithTitle:s];
if (firstTime && if (firstTime &&
soundQualities[i].frequency == settings.samplerate && soundQualities[i].frequency == settings.samplerate &&
soundQualities[i].samplesize == settings.bitspersample && soundQualities[i].samplesize == settings.bitspersample &&
@ -150,12 +150,12 @@ static struct soundQuality_t {
curidx = i; curidx = i;
} }
} }
if (firstTime && curidx < 0) { if (firstTime && curidx < 0) {
soundQualities[i].frequency = settings.samplerate; soundQualities[i].frequency = settings.samplerate;
soundQualities[i].samplesize = settings.bitspersample; soundQualities[i].samplesize = settings.bitspersample;
soundQualities[i].channels = settings.channels; soundQualities[i].channels = settings.channels;
const char *ch; const char *ch;
switch (soundQualities[i].channels) { switch (soundQualities[i].channels) {
case 1: ch = "Mono"; break; case 1: ch = "Mono"; break;
@ -168,11 +168,11 @@ static struct soundQuality_t {
ch ch
]; ];
[soundQualityPUButton addItemWithTitle:s]; [soundQualityPUButton addItemWithTitle:s];
curidx = i++; curidx = i++;
soundQualities[i].frequency = -1; soundQualities[i].frequency = -1;
} }
if (curidx >= 0) { if (curidx >= 0) {
[soundQualityPUButton selectItemAtIndex:curidx]; [soundQualityPUButton selectItemAtIndex:curidx];
} }
@ -201,14 +201,14 @@ static struct soundQuality_t {
settings.bpp3d = validmode[mode].bpp; settings.bpp3d = validmode[mode].bpp;
settings.fullscreen = validmode[mode].fs; settings.fullscreen = validmode[mode].fs;
} }
int quality = [soundQualityPUButton indexOfSelectedItem]; int quality = [soundQualityPUButton indexOfSelectedItem];
if (quality >= 0) { if (quality >= 0) {
settings.samplerate = soundQualities[quality].frequency; settings.samplerate = soundQualities[quality].frequency;
settings.bitspersample = soundQualities[quality].samplesize; settings.bitspersample = soundQualities[quality].samplesize;
settings.channels = soundQualities[quality].channels; settings.channels = soundQualities[quality].channels;
} }
int row = [[gameList documentView] selectedRow]; int row = [[gameList documentView] selectedRow];
if (row >= 0) { if (row >= 0) {
struct grpfile *p = [[gamelistsrc grpAtIndex:row] entryptr]; struct grpfile *p = [[gamelistsrc grpAtIndex:row] entryptr];
@ -217,30 +217,30 @@ static struct soundQuality_t {
settings.game = p->game; settings.game = p->game;
} }
} }
settings.forcesetup = [alwaysShowButton state] == NSOnState; settings.forcesetup = [alwaysShowButton state] == NSOnState;
[nsapp stopModal]; [nsapp stopModal];
} }
- (void)setupRunMode - (void)setupRunMode
{ {
getvalidmodes(); getvalidmodes();
[fullscreenButton setState: (settings.fullscreen ? NSOnState : NSOffState)]; [fullscreenButton setState: (settings.fullscreen ? NSOnState : NSOffState)];
[alwaysShowButton setState: (settings.forcesetup ? NSOnState : NSOffState)]; [alwaysShowButton setState: (settings.forcesetup ? NSOnState : NSOffState)];
[self populateVideoModes:YES]; [self populateVideoModes:YES];
[self populateSoundQuality:YES]; [self populateSoundQuality:YES];
// enable all the controls on the Configuration page // enable all the controls on the Configuration page
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
NSControl *control; NSControl *control;
while (control = [enumerator nextObject]) [control setEnabled:true]; while (control = [enumerator nextObject]) [control setEnabled:true];
gamelistsrc = [[GameListSource alloc] init]; gamelistsrc = [[GameListSource alloc] init];
[[gameList documentView] setDataSource:gamelistsrc]; [[gameList documentView] setDataSource:gamelistsrc];
[[gameList documentView] deselectAll:nil]; [[gameList documentView] deselectAll:nil];
int row = [gamelistsrc findIndexForGrpname:[NSString stringWithCString:settings.selectedgrp]]; int row = [gamelistsrc findIndexForGrpname:[NSString stringWithCString:settings.selectedgrp]];
if (row >= 0) { if (row >= 0) {
[[gameList documentView] scrollRowToVisible:row]; [[gameList documentView] scrollRowToVisible:row];
@ -250,10 +250,10 @@ static struct soundQuality_t {
[[gameList documentView] selectRow:row byExtendingSelection:NO]; [[gameList documentView] selectRow:row byExtendingSelection:NO];
#endif #endif
} }
[cancelButton setEnabled:true]; [cancelButton setEnabled:true];
[startButton setEnabled:true]; [startButton setEnabled:true];
[tabView selectTabViewItemAtIndex:0]; [tabView selectTabViewItemAtIndex:0];
[NSCursor unhide]; // Why should I need to do this? [NSCursor unhide]; // Why should I need to do this?
} }
@ -261,7 +261,7 @@ static struct soundQuality_t {
- (void)setupMessagesMode - (void)setupMessagesMode
{ {
[tabView selectTabViewItemAtIndex:2]; [tabView selectTabViewItemAtIndex:2];
// disable all the controls on the Configuration page except "always show", so the // disable all the controls on the Configuration page except "always show", so the
// user can enable it if they want to while waiting for something else to happen // user can enable it if they want to while waiting for something else to happen
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
@ -270,7 +270,7 @@ static struct soundQuality_t {
if (control == alwaysShowButton) continue; if (control == alwaysShowButton) continue;
[control setEnabled:false]; [control setEnabled:false];
} }
[cancelButton setEnabled:false]; [cancelButton setEnabled:false];
[startButton setEnabled:false]; [startButton setEnabled:false];
} }
@ -280,16 +280,16 @@ static struct soundQuality_t {
NSRange end; NSRange end;
NSTextStorage *text = [messagesView textStorage]; NSTextStorage *text = [messagesView textStorage];
BOOL shouldAutoScroll; BOOL shouldAutoScroll;
shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect])); shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect]));
end.location = [text length]; end.location = [text length];
end.length = 0; end.length = 0;
[text beginEditing]; [text beginEditing];
[messagesView replaceCharactersInRange:end withString:str]; [messagesView replaceCharactersInRange:end withString:str];
[text endEditing]; [text endEditing];
if (shouldAutoScroll) { if (shouldAutoScroll) {
end.location = [text length]; end.location = [text length];
end.length = 0; end.length = 0;
@ -315,22 +315,22 @@ int startwin_open(void)
nsapp = [NSApplication sharedApplication]; nsapp = [NSApplication sharedApplication];
if (startwin != nil) return 1; if (startwin != nil) return 1;
startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"]; startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"];
if (startwin == nil) return -1; if (startwin == nil) return -1;
{ {
static int soundQualityFrequencies[] = { 48000, 44100, 32000, 24000, 22050 }; static int soundQualityFrequencies[] = { 48000, 44100, 32000, 24000, 22050 };
static int soundQualitySampleSizes[] = { 16, 8 }; static int soundQualitySampleSizes[] = { 16, 8 };
static int soundQualityChannels[] = { 2, 1 }; static int soundQualityChannels[] = { 2, 1 };
int f, b, c, i; int f, b, c, i;
i = sizeof(soundQualityFrequencies) * i = sizeof(soundQualityFrequencies) *
sizeof(soundQualitySampleSizes) * sizeof(soundQualitySampleSizes) *
sizeof(soundQualityChannels) / sizeof(soundQualityChannels) /
sizeof(int) + 2; // one for the terminator, one for a custom setting sizeof(int) + 2; // one for the terminator, one for a custom setting
soundQualities = (struct soundQuality_t *) malloc(i * sizeof(struct soundQuality_t)); soundQualities = (struct soundQuality_t *) malloc(i * sizeof(struct soundQuality_t));
i = 0; i = 0;
for (c = 0; c < sizeof(soundQualityChannels) / sizeof(int); c++) { for (c = 0; c < sizeof(soundQualityChannels) / sizeof(int); c++) {
for (b = 0; b < sizeof(soundQualitySampleSizes) / sizeof(int); b++) { for (b = 0; b < sizeof(soundQualitySampleSizes) / sizeof(int); b++) {
@ -338,59 +338,59 @@ int startwin_open(void)
soundQualities[i].frequency = soundQualityFrequencies[f]; soundQualities[i].frequency = soundQualityFrequencies[f];
soundQualities[i].samplesize = soundQualitySampleSizes[b]; soundQualities[i].samplesize = soundQualitySampleSizes[b];
soundQualities[i].channels = soundQualityChannels[c]; soundQualities[i].channels = soundQualityChannels[c];
i++; i++;
} }
} }
} }
soundQualities[i].frequency = -1; soundQualities[i].frequency = -1;
} }
[startwin setupMessagesMode]; [startwin setupMessagesMode];
[startwin showWindow:nil]; [startwin showWindow:nil];
return 0; return 0;
} }
int startwin_close(void) int startwin_close(void)
{ {
if (startwin == nil) return 1; if (startwin == nil) return 1;
[startwin close]; [startwin close];
[startwin release]; [startwin release];
startwin = nil; startwin = nil;
free(soundQualities); free(soundQualities);
return 0; return 0;
} }
int startwin_puts(const char *s) int startwin_puts(const char *s)
{ {
NSString *ns; NSString *ns;
if (!s) return -1; if (!s) return -1;
if (startwin == nil) return 1; if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s]; ns = [[NSString alloc] initWithCString:s];
[startwin putsMessage:ns]; [startwin putsMessage:ns];
[ns release]; [ns release];
return 0; return 0;
} }
int startwin_settitle(const char *s) int startwin_settitle(const char *s)
{ {
NSString *ns; NSString *ns;
if (!s) return -1; if (!s) return -1;
if (startwin == nil) return 1; if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s]; ns = [[NSString alloc] initWithCString:s];
[startwin setTitle:ns]; [startwin setTitle:ns];
[ns release]; [ns release];
return 0; return 0;
} }
@ -404,9 +404,9 @@ int startwin_idle(void *v)
int startwin_run(void) int startwin_run(void)
{ {
int retval; int retval;
if (startwin == nil) return 0; if (startwin == nil) return 0;
settings.fullscreen = ud.config.ScreenMode; settings.fullscreen = ud.config.ScreenMode;
settings.xdim3d = ud.config.ScreenWidth; settings.xdim3d = ud.config.ScreenWidth;
settings.ydim3d = ud.config.ScreenHeight; settings.ydim3d = ud.config.ScreenHeight;
@ -417,17 +417,17 @@ int startwin_run(void)
settings.forcesetup = ud.config.ForceSetup; settings.forcesetup = ud.config.ForceSetup;
// settings.game = gametype; // settings.game = gametype;
strncpy(settings.selectedgrp, defaultduke3dgrp, BMAX_PATH); strncpy(settings.selectedgrp, defaultduke3dgrp, BMAX_PATH);
[startwin setupRunMode]; [startwin setupRunMode];
switch ([nsapp runModalForWindow:[startwin window]]) { switch ([nsapp runModalForWindow:[startwin window]]) {
case NSRunStoppedResponse: retval = 1; break; case NSRunStoppedResponse: retval = 1; break;
case NSRunAbortedResponse: retval = 0; break; case NSRunAbortedResponse: retval = 0; break;
default: retval = -1; default: retval = -1;
} }
[startwin setupMessagesMode]; [startwin setupMessagesMode];
if (retval) { if (retval) {
ud.config.ScreenMode = settings.fullscreen; ud.config.ScreenMode = settings.fullscreen;
ud.config.ScreenWidth = settings.xdim3d; ud.config.ScreenWidth = settings.xdim3d;
@ -435,11 +435,11 @@ int startwin_run(void)
ud.config.ScreenBPP = settings.bpp3d; ud.config.ScreenBPP = settings.bpp3d;
ud.config.MixRate = settings.samplerate; ud.config.MixRate = settings.samplerate;
ud.config.NumBits = settings.bitspersample; ud.config.NumBits = settings.bitspersample;
ud.config.NumChannels = settings.channels; ud.config.NumChannels = settings.channels;
ud.config.ForceSetup = settings.forcesetup; ud.config.ForceSetup = settings.forcesetup;
strncpy(defaultduke3dgrp, settings.selectedgrp, BMAX_PATH); strncpy(defaultduke3dgrp, settings.selectedgrp, BMAX_PATH);
// gametype = settings.game; // gametype = settings.game;
} }
return retval; return retval;
} }

View file

@ -6,14 +6,14 @@ static id nsapp;
@interface StartupWinController : NSWindowController @interface StartupWinController : NSWindowController
{ {
IBOutlet NSButton *alwaysShowButton; IBOutlet NSButton *alwaysShowButton;
IBOutlet NSButton *fullscreenButton; IBOutlet NSButton *fullscreenButton;
IBOutlet NSTextView *messagesView; IBOutlet NSTextView *messagesView;
IBOutlet NSTabView *tabView; IBOutlet NSTabView *tabView;
IBOutlet NSComboBox *videoModeCbox; IBOutlet NSComboBox *videoModeCbox;
IBOutlet NSButton *cancelButton; IBOutlet NSButton *cancelButton;
IBOutlet NSButton *startButton; IBOutlet NSButton *startButton;
} }
- (IBAction)alwaysShowClicked:(id)sender; - (IBAction)alwaysShowClicked:(id)sender;
@ -36,78 +36,78 @@ static id nsapp;
- (IBAction)fullscreenClicked:(id)sender - (IBAction)fullscreenClicked:(id)sender
{ {
// XXX: recalculate the video modes list to take into account the fullscreen status // XXX: recalculate the video modes list to take into account the fullscreen status
} }
- (IBAction)cancel:(id)sender - (IBAction)cancel:(id)sender
{ {
[nsapp abortModal]; [nsapp abortModal];
} }
- (IBAction)start:(id)sender - (IBAction)start:(id)sender
{ {
// XXX: write the states of the form controls to their respective homes // XXX: write the states of the form controls to their respective homes
[nsapp stopModal]; [nsapp stopModal];
} }
- (void)setupRunMode - (void)setupRunMode
{ {
// XXX: populate the lists and set everything up to represent the current options // XXX: populate the lists and set everything up to represent the current options
// enable all the controls on the Configuration page // enable all the controls on the Configuration page
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
NSControl *control; NSControl *control;
while (control = [enumerator nextObject]) while (control = [enumerator nextObject])
[control setEnabled:true]; [control setEnabled:true];
[cancelButton setEnabled:true];
[startButton setEnabled:true];
[tabView selectTabViewItemAtIndex:0]; [cancelButton setEnabled:true];
[startButton setEnabled:true];
[tabView selectTabViewItemAtIndex:0];
} }
- (void)setupMessagesMode - (void)setupMessagesMode
{ {
[tabView selectTabViewItemAtIndex:1]; [tabView selectTabViewItemAtIndex:1];
// disable all the controls on the Configuration page except "always show", so the // disable all the controls on the Configuration page except "always show", so the
// user can enable it if they want to while waiting for something else to happen // user can enable it if they want to while waiting for something else to happen
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
NSControl *control; NSControl *control;
while (control = [enumerator nextObject]) { while (control = [enumerator nextObject]) {
if (control == alwaysShowButton) continue; if (control == alwaysShowButton) continue;
[control setEnabled:false]; [control setEnabled:false];
} }
[cancelButton setEnabled:false]; [cancelButton setEnabled:false];
[startButton setEnabled:false]; [startButton setEnabled:false];
} }
- (void)putsMessage:(NSString *)str - (void)putsMessage:(NSString *)str
{ {
NSRange end; NSRange end;
NSTextStorage *text = [messagesView textStorage]; NSTextStorage *text = [messagesView textStorage];
BOOL shouldAutoScroll; BOOL shouldAutoScroll;
shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect])); shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect]));
end.location = [text length]; end.location = [text length];
end.length = 0; end.length = 0;
[text beginEditing]; [text beginEditing];
[messagesView replaceCharactersInRange:end withString:str]; [messagesView replaceCharactersInRange:end withString:str];
[text endEditing]; [text endEditing];
if (shouldAutoScroll) { if (shouldAutoScroll) {
end.location = [text length]; end.location = [text length];
end.length = 0; end.length = 0;
[messagesView scrollRangeToVisible:end]; [messagesView scrollRangeToVisible:end];
} }
} }
- (void)setTitle:(NSString *)str - (void)setTitle:(NSString *)str
{ {
[[self window] setTitle:str]; [[self window] setTitle:str];
} }
@end @end
@ -118,76 +118,76 @@ int startwin_open(void)
{ {
nsapp = [NSApplication sharedApplication]; nsapp = [NSApplication sharedApplication];
if (startwin != nil) return 1; if (startwin != nil) return 1;
startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.editor"];
if (startwin == nil) return -1;
[startwin showWindow:nil]; startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.editor"];
[startwin setupMessagesMode]; if (startwin == nil) return -1;
return 0; [startwin showWindow:nil];
[startwin setupMessagesMode];
return 0;
} }
int startwin_close(void) int startwin_close(void)
{ {
if (startwin == nil) return 1; if (startwin == nil) return 1;
[startwin close]; [startwin close];
startwin = nil; startwin = nil;
return 0; return 0;
} }
int startwin_puts(const char *s) int startwin_puts(const char *s)
{ {
NSString *ns; NSString *ns;
if (!s) return -1; if (!s) return -1;
if (startwin == nil) return 1; if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s]; ns = [[NSString alloc] initWithCString:s];
[startwin putsMessage:ns]; [startwin putsMessage:ns];
[ns release]; [ns release];
return 0; return 0;
} }
int startwin_settitle(const char *s) int startwin_settitle(const char *s)
{ {
NSString *ns; NSString *ns;
if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
[startwin setTitle:ns];
[ns release];
return 0; if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
[startwin setTitle:ns];
[ns release];
return 0;
} }
int startwin_idle(void *v) int startwin_idle(void *v)
{ {
if (startwin) [[startwin window] displayIfNeeded]; if (startwin) [[startwin window] displayIfNeeded];
return 0; return 0;
} }
int startwin_run(void) int startwin_run(void)
{ {
int retval; int retval;
if (startwin == nil) return 0; if (startwin == nil) return 0;
[startwin setupRunMode]; [startwin setupRunMode];
switch ([nsapp runModalForWindow:[startwin window]]) { switch ([nsapp runModalForWindow:[startwin window]]) {
case NSRunStoppedResponse: retval = 1; break; case NSRunStoppedResponse: retval = 1; break;
case NSRunAbortedResponse: retval = 0; break; case NSRunAbortedResponse: retval = 0; break;
default: retval = -1; default: retval = -1;
} }
[startwin setupMessagesMode]; [startwin setupMessagesMode];
return retval; return retval;
} }