Subversion Repositories eduke32

Rev

Rev 6855 | Rev 8351 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5964 hendricks2 1
 
194 terminx 2
3
 
5964 hendricks2 4
#include "baselayer.h"
194 terminx 5
#include "build.h"
5964 hendricks2 6
#include "editor.h"
7
194 terminx 8
 
6109 hendricks2 9
# define NSImageScaleNone NSScaleNone
10
#endif
11
12
 
13
# define NSEventModifierFlagOption NSAlternateKeyMask
14
# define NSEventModifierFlagCommand NSCommandKeyMask
15
# define NSEventMaskAny NSAnyEventMask
16
# define NSWindowStyleMaskTitled NSTitledWindowMask
17
# define NSWindowStyleMaskClosable NSClosableWindowMask
18
# define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
19
# define NSWindowStyleMaskResizable NSResizableWindowMask
20
# define NSAlertStyleInformational NSInformationalAlertStyle
21
# define NSControlSizeSmall NSSmallControlSize
22
#endif
23
24
 
7688 hendricks2 25
# define NSButtonTypeSwitch NSSwitchButton
26
# define NSBezelStyleRounded NSRoundedBezelStyle
27
# define NSControlStateValueOn NSOnState
28
# define NSControlStateValueOff NSOffState
29
#endif
30
31
 
5975 hendricks2 32
{
5964 hendricks2 33
    return NSMakeRect(x, y, rect.size.width, rect.size.height);
5975 hendricks2 34
}
5964 hendricks2 35
static NSRect NSSizeAddXY(NSSize const size, CGFloat const x, CGFloat const y)
5975 hendricks2 36
{
5964 hendricks2 37
    return NSMakeRect(x, y, size.width, size.height);
5975 hendricks2 38
}
5964 hendricks2 39
#if 0
40
static CGFloat NSRightEdge(NSRect rect)
5975 hendricks2 41
{
5964 hendricks2 42
    return rect.origin.x + rect.size.width;
43
}
44
static CGFloat NSTopEdge(NSRect rect)
5975 hendricks2 45
{
5964 hendricks2 46
    return rect.origin.y + rect.size.height;
47
}
48
#endif
49
50
 
51
{
52
    [control setFont:[NSFont fontWithDescriptor:[[control font] fontDescriptor] size:[NSFont smallSystemFontSize]]];
53
}
54
55
 
56
{
57
    [control setControlSize:NSControlSizeSmall];
58
}
59
60
 
61
{
62
    NSTextField *textField = [[NSTextField alloc] init];
63
    setFontToSmall(textField);
64
    setControlToSmall([textField cell]);
65
    [textField setStringValue:labelText];
66
    [textField setBezeled:NO];
67
    [textField setDrawsBackground:NO];
68
    [textField setEditable:NO];
69
    [textField setSelectable:NO];
70
    [textField sizeToFit];
71
    return textField;
72
}
73
74
 
75
{
76
    NSButton *checkbox = [[NSButton alloc] init];
77
    setFontToSmall(checkbox);
78
    setControlToSmall([checkbox cell]);
79
    [checkbox setTitle:labelText];
80
    [checkbox setButtonType:NSButtonTypeSwitch];
7688 hendricks2 81
    [checkbox sizeToFit];
5964 hendricks2 82
    return checkbox;
83
}
84
85
 
86
{
87
    NSPopUpButton *comboBox = [[NSPopUpButton alloc] init];
88
    [comboBox setPullsDown:NO];
89
    setFontToSmall(comboBox);
90
    setControlToSmall([comboBox cell]);
91
    [comboBox setBezelStyle:NSBezelStyleRounded];
7688 hendricks2 92
    [comboBox setPreferredEdge:NSMaxYEdge];
5964 hendricks2 93
    [[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter];
94
    [comboBox sizeToFit];
95
    return comboBox;
96
}
97
98
 
2429 helixhorne 99
100
 
5966 hendricks2 101
@interface NSApplication(NSAppleMenu)
102
- (void)setAppleMenu:(NSMenu *)menu;
103
@end
104
105
 
106
{
107
    NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
108
    if (!appName)
109
        appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
110
    if (![appName length])
111
        appName = [[NSProcessInfo processInfo] processName];
112
113
 
114
}
115
116
 
117
{
118
    NSString *appName;
119
    NSString *title;
120
    NSMenu *rootMenu;
121
    NSMenu *serviceMenu;
122
    NSMenuItem *menuItem;
123
124
 
125
126
 
127
    appName = GetApplicationName();
128
    rootMenu = [[NSMenu alloc] init];
129
130
 
131
    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
132
    [menuItem setSubmenu:rootMenu];
133
    [mainMenu addItem:menuItem];
134
    [menuItem release];
135
136
 
137
    title = [@"About " stringByAppendingString:appName];
138
    [rootMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
139
140
 
141
142
 
143
    menuItem = (NSMenuItem *)[rootMenu addItemWithTitle:@"Services" action:nil keyEquivalent:@""];
144
    [menuItem setSubmenu:serviceMenu];
145
146
 
147
    [serviceMenu release];
148
149
 
150
151
 
152
    [rootMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
153
154
 
155
    [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)];
6109 hendricks2 156
5966 hendricks2 157
 
158
159
 
160
161
 
162
    [rootMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
163
164
 
165
    [nsapp setMainMenu:mainMenu];
166
    [mainMenu release];  /* we're done with it, let NSApp own it. */
167
168
 
169
    [nsapp setAppleMenu:rootMenu];
170
    [rootMenu release];
171
}
172
173
 
5965 hendricks2 174
175
 
5964 hendricks2 176
    int fullscreen;
177
    int xdim2d, ydim2d;
178
    int xdim3d, ydim3d, bpp3d;
179
    int forcesetup;
180
} settings;
181
182
 
183
{
194 terminx 184
    NSMutableArray *modeslist2d;
5964 hendricks2 185
    NSMutableArray *modeslist3d;
186
2431 helixhorne 187
 
5964 hendricks2 188
    NSButton *fullscreenButton;
189
    NSTextView *messagesView;
190
    NSTabView *tabView;
191
    NSTabViewItem *tabViewItemSetup;
192
    NSTabViewItem *tabViewItemMessageLog;
193
    NSPopUpButton *videoMode2DPUButton;
194
    NSPopUpButton *videoMode3DPUButton;
195
196
 
197
    NSButton *startButton;
198
}
194 terminx 199
200
 
5964 hendricks2 201
194 terminx 202
 
5964 hendricks2 203
- (void)populateVideoModes:(BOOL)firstTime;
204
194 terminx 205
 
5964 hendricks2 206
207
 
208
- (void)start:(id)sender;
209
210
 
194 terminx 211
- (void)setupMessagesMode;
212
5964 hendricks2 213
 
194 terminx 214
5964 hendricks2 215
 
194 terminx 216
217
 
5964 hendricks2 218
194 terminx 219
 
5964 hendricks2 220
{
194 terminx 221
    NSUInteger const style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable;
6109 hendricks2 222
    NSRect const windowFrame = NSMakeRect(0, 0, 480, 280);
5975 hendricks2 223
    self = [super initWithContentRect:windowFrame styleMask:style backing:NSBackingStoreBuffered defer:NO];
5964 hendricks2 224
225
 
226
    {
227
        // window properties
228
        [self setDelegate:self];
229
        [self setReleasedWhenClosed:NO];
230
#if defined MAC_OS_X_VERSION_10_3 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3
231
        [self setContentMinSize:[[self contentView] frame].size];
232
#else
233
        [self setMinSize:[NSWindow frameRectForContentRect:[[self contentView] frame] styleMask:[self styleMask]].size];
234
#endif
235
236
 
237
 
238
        NSRect const imageFrame = NSMakeRect(0, 0, 100, 280);
5975 hendricks2 239
        NSImageView * imageView = [[NSImageView alloc] initWithFrame:imageFrame];
5964 hendricks2 240
        [imageView setImageScaling:NSImageScaleNone];
241
        [imageView setImage:[NSImage imageNamed:@"build"]];
242
        [[self contentView] addSubview:imageView];
243
        [imageView setAutoresizingMask:NSViewMaxXMargin | NSViewHeightSizable];
244
245
 
246
 
247
        CGFloat const buttonWidth = 80;
248
        CGFloat const buttonHeight = 32;
249
250
 
5975 hendricks2 251
        startButton = [[NSButton alloc] initWithFrame:startButtonFrame];
5964 hendricks2 252
        [[self contentView] addSubview:startButton];
253
        [startButton setTitle:@"Start"];
254
        [startButton setTarget:self];
255
        [startButton setAction:@selector(start:)];
256
        [startButton setBezelStyle:NSBezelStyleRounded];
7688 hendricks2 257
        [startButton setKeyEquivalent:@"\r"];
5964 hendricks2 258
        [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
259
260
 
5975 hendricks2 261
        cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame];
5964 hendricks2 262
        [[self contentView] addSubview:cancelButton];
263
        [cancelButton setTitle:@"Cancel"];
264
        [cancelButton setTarget:self];
265
        [cancelButton setAction:@selector(cancel:)];
266
        [cancelButton setBezelStyle:NSBezelStyleRounded];
7688 hendricks2 267
        [cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
5964 hendricks2 268
269
 
270
 
271
        NSRect const tabViewFrame = NSMakeRect(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5);
5975 hendricks2 272
        tabView = [[NSTabView alloc] initWithFrame:tabViewFrame];
5964 hendricks2 273
        [[self contentView] addSubview:tabView];
274
        setFontToSmall(tabView);
275
        setControlToSmall(tabView);
276
        [tabView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
277
278
 
279
 
280
281
 
282
        [tabView addTabViewItem:tabViewItemSetup];
283
        [tabViewItemSetup setLabel:@"Setup"];
284
        NSRect const tabViewItemSetupFrame = [[tabViewItemSetup view] frame];
5975 hendricks2 285
5964 hendricks2 286
 
287
 
288
        alwaysShowButton = makeCheckbox(@"Always show this window at startup");
289
        [[tabViewItemSetup view] addSubview:alwaysShowButton];
290
        NSSize const alwaysShowButtonSize = [alwaysShowButton frame].size;
5975 hendricks2 291
        NSRect const alwaysShowButtonFrame = NSSizeAddXY(alwaysShowButtonSize, tabViewItemSetupFrame.size.width - alwaysShowButtonSize.width, 0);
292
        [alwaysShowButton setFrame:alwaysShowButtonFrame];
5964 hendricks2 293
        [alwaysShowButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
294
295
 
296
 
297
        NSTextField * label2DVideoMode = makeLabel(@"2D Video mode:");
298
        [[tabViewItemSetup view] addSubview:label2DVideoMode];
299
        NSSize const label2DVideoModeSize = [label2DVideoMode frame].size;
5975 hendricks2 300
        [label2DVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
5964 hendricks2 301
302
 
303
        [[tabViewItemSetup view] addSubview:label3DVideoMode];
304
        NSSize const label3DVideoModeSize = [label3DVideoMode frame].size;
5975 hendricks2 305
        [label3DVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
5964 hendricks2 306
307
 
308
        [[tabViewItemSetup view] addSubview:fullscreenButton];
309
        NSSize const fullscreenButtonSize = [fullscreenButton frame].size;
5975 hendricks2 310
        [fullscreenButton setAction:@selector(fullscreenClicked:)];
5964 hendricks2 311
        [fullscreenButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
312
313
 
314
315
 
316
        [[tabViewItemSetup view] addSubview:videoMode2DPUButton];
317
        NSSize const videoMode2DPUButtonSize = [videoMode2DPUButton frame].size;
5975 hendricks2 318
        CGFloat const videoMode2DButtonX = labelsVideoModeRightEdge;
5964 hendricks2 319
        NSRect const videoMode2DPUButtonFrame = NSMakeRect(videoMode2DButtonX, tabViewItemSetupFrame.size.height - videoMode2DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode2DButtonX - fullscreenButtonSize.width, videoMode2DPUButtonSize.height);
5975 hendricks2 320
        [videoMode2DPUButton setFrame:videoMode2DPUButtonFrame];
5964 hendricks2 321
        [videoMode2DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
322
323
 
324
        [[tabViewItemSetup view] addSubview:videoMode3DPUButton];
325
        NSSize const videoMode3DPUButtonSize = [videoMode3DPUButton frame].size;
5975 hendricks2 326
        CGFloat const videoMode3DButtonX = labelsVideoModeRightEdge;
5964 hendricks2 327
        NSRect const videoMode3DPUButtonFrame = NSMakeRect(videoMode3DButtonX, videoMode2DPUButtonFrame.origin.y - videoMode3DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode3DButtonX - fullscreenButtonSize.width, videoMode3DPUButtonSize.height);
5975 hendricks2 328
        [videoMode3DPUButton setFrame:videoMode3DPUButtonFrame];
5964 hendricks2 329
        [videoMode3DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
330
331
 
5975 hendricks2 332
        [label2DVideoMode setFrame:label2DVideoModeFrame];
5964 hendricks2 333
334
 
5975 hendricks2 335
        [label3DVideoMode setFrame:label3DVideoModeFrame];
5964 hendricks2 336
337
 
5975 hendricks2 338
        [fullscreenButton setFrame:fullscreenButtonFrame];
5964 hendricks2 339
340
 
341
 
342
343
 
344
        [tabView addTabViewItem:tabViewItemMessageLog];
345
        [tabViewItemMessageLog setLabel:@"Message Log"];
346
        NSRect const tabViewItemMessageLogFrame = [[tabViewItemMessageLog view] frame];
5975 hendricks2 347
5964 hendricks2 348
 
349
 
350
        NSScrollView * messagesScrollView = [[NSScrollView alloc] initWithFrame:NSRectChangeXY(tabViewItemMessageLogFrame, 0, 0)];
5975 hendricks2 351
        [[tabViewItemMessageLog view] addSubview:messagesScrollView];
5964 hendricks2 352
        [messagesScrollView setBorderType:NSBezelBorder];
353
        [messagesScrollView setHasVerticalScroller:YES];
354
        [messagesScrollView setHasHorizontalScroller:NO];
355
        setControlToSmall([[messagesScrollView verticalScroller] cell]);
356
        NSSize const messagesScrollViewContentSize = [messagesScrollView contentSize];
357
        [messagesScrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
358
359
 
5975 hendricks2 360
        [messagesScrollView setDocumentView:messagesView];
5964 hendricks2 361
        [messagesView setEditable:NO];
362
        [messagesView setRichText:NO];
363
        setFontToSmall(messagesView);
364
        [messagesView setMinSize:NSMakeSize(0.0, messagesScrollViewContentSize.height)];
5975 hendricks2 365
        [messagesView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
366
        [messagesView setVerticallyResizable:YES];
5964 hendricks2 367
        [messagesView setHorizontallyResizable:NO];
368
        [messagesView setAutoresizingMask:NSViewWidthSizable];
369
370
 
5975 hendricks2 371
        [[messagesView textContainer] setWidthTracksTextView:YES];
5964 hendricks2 372
    }
373
374
 
375
}
376
377
 
378
{
379
    return YES;
380
}
381
382
 
383
{
384
    return YES;
385
}
386
387
 
388
{
389
    UNREFERENCED_PARAMETER(sender);
4647 hendricks2 390
5964 hendricks2 391
 
5965 hendricks2 392
5964 hendricks2 393
 
394
}
194 terminx 395
396
 
5964 hendricks2 397
{
194 terminx 398
    [modeslist3d release];
5964 hendricks2 399
    [super dealloc];
400
}
401
402
 
403
{
404
    int i, mode3d, fullscreen = ([fullscreenButton state] == NSControlStateValueOn);
7688 hendricks2 405
    int mode2d, idx2d = -1;
5964 hendricks2 406
    int idx3d = -1;
407
    int xdim2d = 0, ydim2d = 0;
408
    int const bpp2d = 8;
409
    int xdim = 0, ydim = 0, bpp = 0;
410
411
 
412
        xdim2d = settings.xdim2d;
413
        ydim2d = settings.ydim2d;
414
        xdim = settings.xdim3d;
415
        ydim = settings.ydim3d;
416
        bpp  = settings.bpp3d;
417
    } else {
418
        mode2d = [[modeslist2d objectAtIndex:[videoMode2DPUButton indexOfSelectedItem]] intValue];
419
        if (mode2d >= 0) {
420
            xdim2d = validmode[mode2d].xdim;
421
            ydim2d = validmode[mode2d].ydim;
422
        }
423
424
 
425
        if (mode3d >= 0) {
426
            xdim = validmode[mode3d].xdim;
427
            ydim = validmode[mode3d].ydim;
428
            bpp = validmode[mode3d].bpp;
429
        }
430
    }
431
432
 
433
 
6855 terminx 434
5964 hendricks2 435
 
436
    [videoMode2DPUButton removeAllItems];
437
438
 
439
440
 
441
        if (fullscreen == validmode[i].fs) {
442
            if (i == mode2d) idx2d = [modeslist2d count];
443
            [modeslist2d addObject:[NSNumber numberWithInt:i]];
444
            [videoMode2DPUButton addItemWithTitle:[NSString stringWithFormat:@"%d %C %d",
445
                                                   validmode[i].xdim, 0xd7, validmode[i].ydim]];
446
        }
447
    }
448
449
 
450
451
 
452
 
6855 terminx 453
    if (mode3d < 0) {
5964 hendricks2 454
        int i, cd[] = { 32, 24, 16, 15, 8, 0 };
455
        for (i=0; cd[i]; ) { if (cd[i] >= bpp) i++; else break; }
456
        for ( ; cd[i]; i++) {
457
            mode3d = videoCheckMode(&xdim, &ydim, cd[i], fullscreen, 1);
6855 terminx 458
            if (mode3d < 0) continue;
5964 hendricks2 459
            break;
460
        }
461
    }
462
463
 
464
    [videoMode3DPUButton removeAllItems];
465
466
 
467
468
 
469
        if (fullscreen == validmode[i].fs) {
470
            if (i == mode3d) idx3d = [modeslist3d count];
471
            [modeslist3d addObject:[NSNumber numberWithInt:i]];
472
            [videoMode3DPUButton addItemWithTitle:[NSString stringWithFormat:@"%d %C %d %d-bpp",
473
                                                   validmode[i].xdim, 0xd7, validmode[i].ydim, validmode[i].bpp]];
474
        }
475
    }
476
477
 
478
}
479
480
 
481
{
482
    UNREFERENCED_PARAMETER(sender);
4647 hendricks2 483
4644 hendricks2 484
 
5964 hendricks2 485
}
194 terminx 486
487
 
5964 hendricks2 488
{
194 terminx 489
    UNREFERENCED_PARAMETER(sender);
4647 hendricks2 490
4644 hendricks2 491
 
5965 hendricks2 492
}
194 terminx 493
494
 
5964 hendricks2 495
{
194 terminx 496
    UNREFERENCED_PARAMETER(sender);
4647 hendricks2 497
4644 hendricks2 498
 
5964 hendricks2 499
    if (mode2d >= 0) {
500
        settings.xdim2d = validmode[mode2d].xdim;
501
        settings.ydim2d = validmode[mode2d].ydim;
502
        settings.fullscreen = validmode[mode2d].fs;
503
    }
504
505
 
506
    if (mode >= 0) {
507
        settings.xdim3d = validmode[mode].xdim;
508
        settings.ydim3d = validmode[mode].ydim;
509
        settings.bpp3d = validmode[mode].bpp;
510
        settings.fullscreen = validmode[mode].fs;
511
    }
512
513
 
7688 hendricks2 514
5964 hendricks2 515
 
5965 hendricks2 516
}
194 terminx 517
518
 
519
{
520
    videoGetModes();
6855 terminx 521
194 terminx 522
 
7688 hendricks2 523
    [alwaysShowButton setState: (settings.forcesetup ? NSControlStateValueOn : NSControlStateValueOff)];
524
    [self populateVideoModes:YES];
5964 hendricks2 525
526
 
2431 helixhorne 527
    NSEnumerator *enumerator = [[[tabViewItemSetup view] subviews] objectEnumerator];
5964 hendricks2 528
    NSControl *control;
2431 helixhorne 529
    while ((control = [enumerator nextObject]))
2537 hendricks2 530
    {
5964 hendricks2 531
        if ([control respondsToSelector:@selector(setEnabled:)])
532
            [control setEnabled:true];
533
    }
534
194 terminx 535
 
2431 helixhorne 536
    [startButton setEnabled:true];
537
538
 
5964 hendricks2 539
    [NSCursor unhide]; // Why should I need to do this?
540
}
194 terminx 541
542
 
543
{
544
    [tabView selectTabViewItem:tabViewItemMessageLog];
5964 hendricks2 545
194 terminx 546
 
2431 helixhorne 547
    // user can enable it if they want to while waiting for something else to happen
548
    NSEnumerator *enumerator = [[[tabViewItemSetup view] subviews] objectEnumerator];
5964 hendricks2 549
    NSControl *control;
2431 helixhorne 550
    while ((control = [enumerator nextObject]))
5964 hendricks2 551
    {
552
        if (control != alwaysShowButton && [control respondsToSelector:@selector(setEnabled:)])
553
            [control setEnabled:false];
554
    }
2431 helixhorne 555
194 terminx 556
 
2431 helixhorne 557
    [startButton setEnabled:false];
558
}
194 terminx 559
560
 
561
{
562
    NSRange end;
2431 helixhorne 563
    NSTextStorage *text = [messagesView textStorage];
564
    BOOL shouldAutoScroll;
565
194 terminx 566
 
2431 helixhorne 567
194 terminx 568
 
2431 helixhorne 569
    end.length = 0;
570
194 terminx 571
 
2431 helixhorne 572
    [messagesView replaceCharactersInRange:end withString:str];
573
    [text endEditing];
574
575
 
576
        end.location = [text length];
577
        end.length = 0;
578
        [messagesView scrollRangeToVisible:end];
579
    }
580
}
194 terminx 581
582
 
583
584
 
5964 hendricks2 585
194 terminx 586
 
587
{
588
    // fix for "ld: absolute address to symbol _NSApp in a different linkage unit not supported"
5964 hendricks2 589
    // (OS X 10.6) when building for PPC
590
    nsapp = [NSApplication sharedApplication];
2429 helixhorne 591
592
 
2431 helixhorne 593
194 terminx 594
 
5964 hendricks2 595
    if (startwin == nil) return -1;
2431 helixhorne 596
194 terminx 597
 
2431 helixhorne 598
599
 
5967 hendricks2 600
601
 
602
    [startwin makeKeyAndOrderFront:nil];
603
604
 
605
606
 
2431 helixhorne 607
}
194 terminx 608
609
 
610
{
611
    if (startwin == nil) return 1;
2431 helixhorne 612
194 terminx 613
 
2431 helixhorne 614
    [startwin release];
5964 hendricks2 615
    startwin = nil;
2431 helixhorne 616
194 terminx 617
 
2431 helixhorne 618
}
194 terminx 619
620
 
621
{
622
    NSString *ns;
2431 helixhorne 623
194 terminx 624
 
2431 helixhorne 625
    if (startwin == nil) return 1;
626
194 terminx 627
 
5964 hendricks2 628
    [startwin putsMessage:ns];
2431 helixhorne 629
    [ns release];
630
194 terminx 631
 
2431 helixhorne 632
}
194 terminx 633
634
 
635
{
636
    NSString *ns;
2431 helixhorne 637
194 terminx 638
 
2431 helixhorne 639
    if (startwin == nil) return 1;
640
641
 
5964 hendricks2 642
    [startwin setTitle:ns];
2431 helixhorne 643
    [ns release];
644
645
 
646
}
194 terminx 647
648
 
649
{
650
    UNREFERENCED_PARAMETER(v);
4647 hendricks2 651
4644 hendricks2 652
 
5967 hendricks2 653
    {
654
        NSEvent *event;
655
        do
656
        {
657
            event = [nsapp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate date] inMode:NSDefaultRunLoopMode dequeue:YES];
6109 hendricks2 658
            [nsapp sendEvent:event];
5967 hendricks2 659
        }
660
        while (event != nil);
661
662
 
663
        [nsapp updateWindows];
664
    }
665
666
 
2431 helixhorne 667
}
194 terminx 668
669
 
5964 hendricks2 670
 
194 terminx 671
{
672
    if (startwin == nil) return 0;
2431 helixhorne 673
674
 
5964 hendricks2 675
    settings.xdim2d = xdim2d;
676
    settings.ydim2d = ydim2d;
677
    settings.xdim3d = xdimgame;
678
    settings.ydim3d = ydimgame;
679
    settings.bpp3d = bppgame;
680
    settings.forcesetup = forcesetup;
681
682
 
2431 helixhorne 683
684
 
5965 hendricks2 685
    {
686
        NSEvent *event = [nsapp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES];
6109 hendricks2 687
        [nsapp sendEvent:event];
5965 hendricks2 688
        [nsapp updateWindows];
689
    }
2431 helixhorne 690
    while (retval == -1);
5965 hendricks2 691
2431 helixhorne 692
 
693
    [nsapp updateWindows];
5967 hendricks2 694
2431 helixhorne 695
 
5964 hendricks2 696
        fullscreen = settings.fullscreen;
697
        xdim2d = settings.xdim2d;
698
        ydim2d = settings.ydim2d;
699
        xdimgame = settings.xdim3d;
700
        ydimgame = settings.ydim3d;
701
        bppgame = settings.bpp3d;
702
        forcesetup = settings.forcesetup;
703
    }
704
705
 
2431 helixhorne 706
}
194 terminx 707