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

@ -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]; [cancelButton setEnabled:true];
[startButton setEnabled:true]; [startButton setEnabled:true];
[tabView selectTabViewItemAtIndex:0]; [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"]; startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.editor"];
if (startwin == nil) return -1; if (startwin == nil) return -1;
[startwin showWindow:nil]; [startwin showWindow:nil];
[startwin setupMessagesMode]; [startwin setupMessagesMode];
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 = 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 (!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;
} }
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;
} }