Subversion Repositories eduke32

Rev

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

Rev 7291 Rev 7688
Line 27... Line 27...
27
# define NSAlertStyleInformational NSInformationalAlertStyle
27
# define NSAlertStyleInformational NSInformationalAlertStyle
28
# define NSControlSizeSmall NSSmallControlSize
28
# define NSControlSizeSmall NSSmallControlSize
29
#endif
29
#endif
30
30
31
static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
31
#ifndef MAC_OS_X_VERSION_10_14
-
 
32
# define NSButtonTypeSwitch NSSwitchButton
-
 
33
# define NSBezelStyleRounded NSRoundedBezelStyle
-
 
34
# define NSControlStateValueOn NSOnState
-
 
35
# define NSControlStateValueOff NSOffState
-
 
36
#endif
-
 
37
-
 
38
static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
32
{
39
{
33
    return NSMakeRect(x, y, rect.size.width, rect.size.height);
40
    return NSMakeRect(x, y, rect.size.width, rect.size.height);
34
}
41
}
35
static NSRect NSSizeAddXY(NSSize const size, CGFloat const x, CGFloat const y)
42
static NSRect NSSizeAddXY(NSSize const size, CGFloat const x, CGFloat const y)
36
{
43
{
Line 53... Line 60...
53
}
60
}
54
61
55
static void setControlToSmall(id control)
62
static void setControlToSmall(id control)
56
{
63
{
57
#ifdef MAC_OS_X_VERSION_10_12
64
    [control setControlSize:NSControlSizeSmall];
58
    [control setControlSize:NSControlSizeSmall];
-
 
59
#else
65
}
60
    [control setControlSize:NSControlSizeSmall];
-
 
61
#endif
-
 
62
}
-
 
63
66
64
static NSTextField * makeLabel(NSString * labelText)
67
static NSTextField * makeLabel(NSString * labelText)
65
{
68
{
66
    NSTextField *textField = [[NSTextField alloc] init];
69
    NSTextField *textField = [[NSTextField alloc] init];
67
    setFontToSmall(textField);
70
    setFontToSmall(textField);
Line 80... Line 83...
80
    NSButton *checkbox = [[NSButton alloc] init];
83
    NSButton *checkbox = [[NSButton alloc] init];
81
    setFontToSmall(checkbox);
84
    setFontToSmall(checkbox);
82
    setControlToSmall([checkbox cell]);
85
    setControlToSmall([checkbox cell]);
83
    [checkbox setTitle:labelText];
86
    [checkbox setTitle:labelText];
84
    [checkbox setButtonType:NSSwitchButton];
87
    [checkbox setButtonType:NSButtonTypeSwitch];
85
    [checkbox sizeToFit];
88
    [checkbox sizeToFit];
86
    return checkbox;
89
    return checkbox;
87
}
90
}
88
91
89
static NSPopUpButton * makeComboBox(void)
92
static NSPopUpButton * makeComboBox(void)
90
{
93
{
91
    NSPopUpButton *comboBox = [[NSPopUpButton alloc] init];
94
    NSPopUpButton *comboBox = [[NSPopUpButton alloc] init];
92
    [comboBox setPullsDown:NO];
95
    [comboBox setPullsDown:NO];
93
    setFontToSmall(comboBox);
96
    setFontToSmall(comboBox);
94
    setControlToSmall([comboBox cell]);
97
    setControlToSmall([comboBox cell]);
95
    [comboBox setBezelStyle:NSRoundedBezelStyle];
98
    [comboBox setBezelStyle:NSBezelStyleRounded];
96
    [comboBox setPreferredEdge:NSMaxYEdge];
99
    [comboBox setPreferredEdge:NSMaxYEdge];
97
    [[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter];
100
    [[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter];
98
    [comboBox sizeToFit];
101
    [comboBox sizeToFit];
99
    return comboBox;
102
    return comboBox;
100
}
103
}
101
104
Line 256... Line 259...
256
        [[self contentView] addSubview:startButton];
259
        [[self contentView] addSubview:startButton];
257
        [startButton setTitle:@"Start"];
260
        [startButton setTitle:@"Start"];
258
        [startButton setTarget:self];
261
        [startButton setTarget:self];
259
        [startButton setAction:@selector(start:)];
262
        [startButton setAction:@selector(start:)];
260
        [startButton setBezelStyle:NSRoundedBezelStyle];
263
        [startButton setBezelStyle:NSBezelStyleRounded];
261
        [startButton setKeyEquivalent:@"\r"];
264
        [startButton setKeyEquivalent:@"\r"];
262
        [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
265
        [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
263
266
264
        NSRect const cancelButtonFrame = NSMakeRect(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight);
267
        NSRect const cancelButtonFrame = NSMakeRect(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight);
265
        cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame];
268
        cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame];
266
        [[self contentView] addSubview:cancelButton];
269
        [[self contentView] addSubview:cancelButton];
267
        [cancelButton setTitle:@"Cancel"];
270
        [cancelButton setTitle:@"Cancel"];
268
        [cancelButton setTarget:self];
271
        [cancelButton setTarget:self];
269
        [cancelButton setAction:@selector(cancel:)];
272
        [cancelButton setAction:@selector(cancel:)];
270
        [cancelButton setBezelStyle:NSRoundedBezelStyle];
273
        [cancelButton setBezelStyle:NSBezelStyleRounded];
271
        [cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
274
        [cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
272
275
273
276
274
        // tab frame
277
        // tab frame
275
        NSRect const tabViewFrame = NSMakeRect(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5);
278
        NSRect const tabViewFrame = NSMakeRect(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5);
276
        tabView = [[NSTabView alloc] initWithFrame:tabViewFrame];
279
        tabView = [[NSTabView alloc] initWithFrame:tabViewFrame];
Line 423... Line 426...
423
}
426
}
424
427
425
- (void)populateVideoModes:(BOOL)firstTime
428
- (void)populateVideoModes:(BOOL)firstTime
426
{
429
{
427
    int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState);
430
    int i, mode3d, fullscreen = ([fullscreenButton state] == NSControlStateValueOn);
428
    int idx3d = -1;
431
    int idx3d = -1;
429
    int xdim = 0, ydim = 0, bpp = 0;
432
    int xdim = 0, ydim = 0, bpp = 0;
430
433
431
    if (firstTime) {
434
    if (firstTime) {
432
        xdim = settings.xdim3d;
435
        xdim = settings.xdim3d;
433
        ydim = settings.ydim3d;
436
        ydim = settings.ydim3d;
Line 499... Line 502...
499
    if (row >= 0) {
502
    if (row >= 0) {
500
        settings.grp = [[gamelistsrc grpAtIndex:row] entryptr];
503
        settings.grp = [[gamelistsrc grpAtIndex:row] entryptr];
501
    }
504
    }
502
505
503
    settings.forcesetup = [alwaysShowButton state] == NSOnState;
506
    settings.forcesetup = [alwaysShowButton state] == NSControlStateValueOn;
504
507
505
    retval = 1;
508
    retval = 1;
506
}
509
}
507
510
508
- (void)setupRunMode
511
- (void)setupRunMode
509
{
512
{
510
    videoGetModes();
513
    videoGetModes();
511
514
512
    [fullscreenButton setState: (settings.fullscreen ? NSOnState : NSOffState)];
515
    [fullscreenButton setState: (settings.fullscreen ? NSControlStateValueOn : NSControlStateValueOff)];
513
    [alwaysShowButton setState: (settings.forcesetup ? NSOnState : NSOffState)];
516
    [alwaysShowButton setState: (settings.forcesetup ? NSControlStateValueOn : NSControlStateValueOff)];
514
    [self populateVideoModes:YES];
517
    [self populateVideoModes:YES];
515
518
516
    // enable all the controls on the Configuration page
519
    // enable all the controls on the Configuration page
517
    NSEnumerator *enumerator = [[[tabViewItemSetup view] subviews] objectEnumerator];
520
    NSEnumerator *enumerator = [[[tabViewItemSetup view] subviews] objectEnumerator];
518
    NSControl *control;
521
    NSControl *control;
519
    while ((control = [enumerator nextObject]))
522
    while ((control = [enumerator nextObject]))