Subversion Repositories eduke32

Rev

Rev 6855 | Rev 8351 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6855 Rev 7688
Line 20... Line 20...
20
# define NSAlertStyleInformational NSInformationalAlertStyle
20
# define NSAlertStyleInformational NSInformationalAlertStyle
21
# define NSControlSizeSmall NSSmallControlSize
21
# define NSControlSizeSmall NSSmallControlSize
22
#endif
22
#endif
23
23
24
static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
24
#ifndef MAC_OS_X_VERSION_10_14
-
 
25
# define NSButtonTypeSwitch NSSwitchButton
-
 
26
# define NSBezelStyleRounded NSRoundedBezelStyle
-
 
27
# define NSControlStateValueOn NSOnState
-
 
28
# define NSControlStateValueOff NSOffState
-
 
29
#endif
-
 
30
-
 
31
static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
25
{
32
{
26
    return NSMakeRect(x, y, rect.size.width, rect.size.height);
33
    return NSMakeRect(x, y, rect.size.width, rect.size.height);
27
}
34
}
28
static NSRect NSSizeAddXY(NSSize const size, CGFloat const x, CGFloat const y)
35
static NSRect NSSizeAddXY(NSSize const size, CGFloat const x, CGFloat const y)
29
{
36
{
Line 69... Line 76...
69
    NSButton *checkbox = [[NSButton alloc] init];
76
    NSButton *checkbox = [[NSButton alloc] init];
70
    setFontToSmall(checkbox);
77
    setFontToSmall(checkbox);
71
    setControlToSmall([checkbox cell]);
78
    setControlToSmall([checkbox cell]);
72
    [checkbox setTitle:labelText];
79
    [checkbox setTitle:labelText];
73
    [checkbox setButtonType:NSSwitchButton];
80
    [checkbox setButtonType:NSButtonTypeSwitch];
74
    [checkbox sizeToFit];
81
    [checkbox sizeToFit];
75
    return checkbox;
82
    return checkbox;
76
}
83
}
77
84
78
static NSPopUpButton * makeComboBox(void)
85
static NSPopUpButton * makeComboBox(void)
79
{
86
{
80
    NSPopUpButton *comboBox = [[NSPopUpButton alloc] init];
87
    NSPopUpButton *comboBox = [[NSPopUpButton alloc] init];
81
    [comboBox setPullsDown:NO];
88
    [comboBox setPullsDown:NO];
82
    setFontToSmall(comboBox);
89
    setFontToSmall(comboBox);
83
    setControlToSmall([comboBox cell]);
90
    setControlToSmall([comboBox cell]);
84
    [comboBox setBezelStyle:NSRoundedBezelStyle];
91
    [comboBox setBezelStyle:NSBezelStyleRounded];
85
    [comboBox setPreferredEdge:NSMaxYEdge];
92
    [comboBox setPreferredEdge:NSMaxYEdge];
86
    [[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter];
93
    [[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter];
87
    [comboBox sizeToFit];
94
    [comboBox sizeToFit];
88
    return comboBox;
95
    return comboBox;
89
}
96
}
90
97
Line 245... Line 252...
245
        [[self contentView] addSubview:startButton];
252
        [[self contentView] addSubview:startButton];
246
        [startButton setTitle:@"Start"];
253
        [startButton setTitle:@"Start"];
247
        [startButton setTarget:self];
254
        [startButton setTarget:self];
248
        [startButton setAction:@selector(start:)];
255
        [startButton setAction:@selector(start:)];
249
        [startButton setBezelStyle:NSRoundedBezelStyle];
256
        [startButton setBezelStyle:NSBezelStyleRounded];
250
        [startButton setKeyEquivalent:@"\r"];
257
        [startButton setKeyEquivalent:@"\r"];
251
        [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
258
        [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
252
259
253
        NSRect const cancelButtonFrame = NSMakeRect(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight);
260
        NSRect const cancelButtonFrame = NSMakeRect(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight);
254
        cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame];
261
        cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame];
255
        [[self contentView] addSubview:cancelButton];
262
        [[self contentView] addSubview:cancelButton];
256
        [cancelButton setTitle:@"Cancel"];
263
        [cancelButton setTitle:@"Cancel"];
257
        [cancelButton setTarget:self];
264
        [cancelButton setTarget:self];
258
        [cancelButton setAction:@selector(cancel:)];
265
        [cancelButton setAction:@selector(cancel:)];
259
        [cancelButton setBezelStyle:NSRoundedBezelStyle];
266
        [cancelButton setBezelStyle:NSBezelStyleRounded];
260
        [cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
267
        [cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
261
268
262
269
263
        // tab frame
270
        // tab frame
264
        NSRect const tabViewFrame = NSMakeRect(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5);
271
        NSRect const tabViewFrame = NSMakeRect(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5);
265
        tabView = [[NSTabView alloc] initWithFrame:tabViewFrame];
272
        tabView = [[NSTabView alloc] initWithFrame:tabViewFrame];
Line 393... Line 400...
393
}
400
}
394
401
395
- (void)populateVideoModes:(BOOL)firstTime
402
- (void)populateVideoModes:(BOOL)firstTime
396
{
403
{
397
    int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState);
404
    int i, mode3d, fullscreen = ([fullscreenButton state] == NSControlStateValueOn);
398
    int mode2d, idx2d = -1;
405
    int mode2d, idx2d = -1;
399
    int idx3d = -1;
406
    int idx3d = -1;
400
    int xdim2d = 0, ydim2d = 0;
407
    int xdim2d = 0, ydim2d = 0;
401
    int const bpp2d = 8;
408
    int const bpp2d = 8;
402
    int xdim = 0, ydim = 0, bpp = 0;
409
    int xdim = 0, ydim = 0, bpp = 0;
403
410
Line 502... Line 509...
502
        settings.bpp3d = validmode[mode].bpp;
509
        settings.bpp3d = validmode[mode].bpp;
503
        settings.fullscreen = validmode[mode].fs;
510
        settings.fullscreen = validmode[mode].fs;
504
    }
511
    }
505
512
506
    settings.forcesetup = [alwaysShowButton state] == NSOnState;
513
    settings.forcesetup = [alwaysShowButton state] == NSControlStateValueOn;
507
514
508
    retval = 1;
515
    retval = 1;
509
}
516
}
510
517
511
- (void)setupRunMode
518
- (void)setupRunMode
512
{
519
{
513
    videoGetModes();
520
    videoGetModes();
514
521
515
    [fullscreenButton setState: (settings.fullscreen ? NSOnState : NSOffState)];
522
    [fullscreenButton setState: (settings.fullscreen ? NSControlStateValueOn : NSControlStateValueOff)];
516
    [alwaysShowButton setState: (settings.forcesetup ? NSOnState : NSOffState)];
523
    [alwaysShowButton setState: (settings.forcesetup ? NSControlStateValueOn : NSControlStateValueOff)];
517
    [self populateVideoModes:YES];
524
    [self populateVideoModes:YES];
518
525
519
    // enable all the controls on the Configuration page
526
    // enable all the controls on the Configuration page
520
    NSEnumerator *enumerator = [[[tabViewItemSetup view] subviews] objectEnumerator];
527
    NSEnumerator *enumerator = [[[tabViewItemSetup view] subviews] objectEnumerator];
521
    NSControl *control;
528
    NSControl *control;
522
    while ((control = [enumerator nextObject]))
529
    while ((control = [enumerator nextObject]))