Fix macOS -Wdeprecated-declarations warnings

git-svn-id: https://svn.eduke32.com/eduke32@7688 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	.gitignore
This commit is contained in:
hendricks266 2019-06-01 18:42:27 +00:00 committed by Christoph Oelckers
parent 5fc9868c6a
commit ff204ff034
3 changed files with 31 additions and 20 deletions

1
.gitignore vendored
View file

@ -53,6 +53,7 @@ project.xcworkspace/
*.dSYM/ *.dSYM/
.DS_Store .DS_Store
._*
Platform/Windows/Build Platform/Windows/Build
Platform/Windows/Win32 Platform/Windows/Win32
Platform/Windows/x64 Platform/Windows/x64

View file

@ -22,6 +22,13 @@
# define NSControlSizeSmall NSSmallControlSize # define NSControlSizeSmall NSSmallControlSize
#endif #endif
#ifndef MAC_OS_X_VERSION_10_14
# define NSButtonTypeSwitch NSSwitchButton
# define NSBezelStyleRounded NSRoundedBezelStyle
# define NSControlStateValueOn NSOnState
# define NSControlStateValueOff NSOffState
#endif
static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y) static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
{ {
return NSMakeRect(x, y, rect.size.width, rect.size.height); return NSMakeRect(x, y, rect.size.width, rect.size.height);
@ -71,7 +78,7 @@ static NSButton * makeCheckbox(NSString * labelText)
setFontToSmall(checkbox); setFontToSmall(checkbox);
setControlToSmall([checkbox cell]); setControlToSmall([checkbox cell]);
[checkbox setTitle:labelText]; [checkbox setTitle:labelText];
[checkbox setButtonType:NSSwitchButton]; [checkbox setButtonType:NSButtonTypeSwitch];
[checkbox sizeToFit]; [checkbox sizeToFit];
return checkbox; return checkbox;
} }
@ -82,7 +89,7 @@ static NSPopUpButton * makeComboBox(void)
[comboBox setPullsDown:NO]; [comboBox setPullsDown:NO];
setFontToSmall(comboBox); setFontToSmall(comboBox);
setControlToSmall([comboBox cell]); setControlToSmall([comboBox cell]);
[comboBox setBezelStyle:NSRoundedBezelStyle]; [comboBox setBezelStyle:NSBezelStyleRounded];
[comboBox setPreferredEdge:NSMaxYEdge]; [comboBox setPreferredEdge:NSMaxYEdge];
[[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter]; [[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter];
[comboBox sizeToFit]; [comboBox sizeToFit];
@ -247,7 +254,7 @@ static struct {
[startButton setTitle:@"Start"]; [startButton setTitle:@"Start"];
[startButton setTarget:self]; [startButton setTarget:self];
[startButton setAction:@selector(start:)]; [startButton setAction:@selector(start:)];
[startButton setBezelStyle:NSRoundedBezelStyle]; [startButton setBezelStyle:NSBezelStyleRounded];
[startButton setKeyEquivalent:@"\r"]; [startButton setKeyEquivalent:@"\r"];
[startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
@ -257,7 +264,7 @@ static struct {
[cancelButton setTitle:@"Cancel"]; [cancelButton setTitle:@"Cancel"];
[cancelButton setTarget:self]; [cancelButton setTarget:self];
[cancelButton setAction:@selector(cancel:)]; [cancelButton setAction:@selector(cancel:)];
[cancelButton setBezelStyle:NSRoundedBezelStyle]; [cancelButton setBezelStyle:NSBezelStyleRounded];
[cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
@ -395,7 +402,7 @@ static struct {
- (void)populateVideoModes:(BOOL)firstTime - (void)populateVideoModes:(BOOL)firstTime
{ {
int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState); int i, mode3d, fullscreen = ([fullscreenButton state] == NSControlStateValueOn);
int mode2d, idx2d = -1; int mode2d, idx2d = -1;
int idx3d = -1; int idx3d = -1;
int xdim2d = 0, ydim2d = 0; int xdim2d = 0, ydim2d = 0;
@ -504,7 +511,7 @@ static struct {
settings.fullscreen = validmode[mode].fs; settings.fullscreen = validmode[mode].fs;
} }
settings.forcesetup = [alwaysShowButton state] == NSOnState; settings.forcesetup = [alwaysShowButton state] == NSControlStateValueOn;
retval = 1; retval = 1;
} }
@ -513,8 +520,8 @@ static struct {
{ {
videoGetModes(); videoGetModes();
[fullscreenButton setState: (settings.fullscreen ? NSOnState : NSOffState)]; [fullscreenButton setState: (settings.fullscreen ? NSControlStateValueOn : NSControlStateValueOff)];
[alwaysShowButton setState: (settings.forcesetup ? NSOnState : NSOffState)]; [alwaysShowButton setState: (settings.forcesetup ? NSControlStateValueOn : NSControlStateValueOff)];
[self populateVideoModes:YES]; [self populateVideoModes:YES];
// enable all the controls on the Configuration page // enable all the controls on the Configuration page

View file

@ -29,6 +29,13 @@
# define NSControlSizeSmall NSSmallControlSize # define NSControlSizeSmall NSSmallControlSize
#endif #endif
#ifndef MAC_OS_X_VERSION_10_14
# define NSButtonTypeSwitch NSSwitchButton
# define NSBezelStyleRounded NSRoundedBezelStyle
# define NSControlStateValueOn NSOnState
# define NSControlStateValueOff NSOffState
#endif
static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y) static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
{ {
return NSMakeRect(x, y, rect.size.width, rect.size.height); return NSMakeRect(x, y, rect.size.width, rect.size.height);
@ -55,11 +62,7 @@ static void setFontToSmall(id control)
static void setControlToSmall(id control) static void setControlToSmall(id control)
{ {
#ifdef MAC_OS_X_VERSION_10_12
[control setControlSize:NSControlSizeSmall]; [control setControlSize:NSControlSizeSmall];
#else
[control setControlSize:NSControlSizeSmall];
#endif
} }
static NSTextField * makeLabel(NSString * labelText) static NSTextField * makeLabel(NSString * labelText)
@ -82,7 +85,7 @@ static NSButton * makeCheckbox(NSString * labelText)
setFontToSmall(checkbox); setFontToSmall(checkbox);
setControlToSmall([checkbox cell]); setControlToSmall([checkbox cell]);
[checkbox setTitle:labelText]; [checkbox setTitle:labelText];
[checkbox setButtonType:NSSwitchButton]; [checkbox setButtonType:NSButtonTypeSwitch];
[checkbox sizeToFit]; [checkbox sizeToFit];
return checkbox; return checkbox;
} }
@ -93,7 +96,7 @@ static NSPopUpButton * makeComboBox(void)
[comboBox setPullsDown:NO]; [comboBox setPullsDown:NO];
setFontToSmall(comboBox); setFontToSmall(comboBox);
setControlToSmall([comboBox cell]); setControlToSmall([comboBox cell]);
[comboBox setBezelStyle:NSRoundedBezelStyle]; [comboBox setBezelStyle:NSBezelStyleRounded];
[comboBox setPreferredEdge:NSMaxYEdge]; [comboBox setPreferredEdge:NSMaxYEdge];
[[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter]; [[comboBox cell] setArrowPosition:NSPopUpArrowAtCenter];
[comboBox sizeToFit]; [comboBox sizeToFit];
@ -258,7 +261,7 @@ static struct {
[startButton setTitle:@"Start"]; [startButton setTitle:@"Start"];
[startButton setTarget:self]; [startButton setTarget:self];
[startButton setAction:@selector(start:)]; [startButton setAction:@selector(start:)];
[startButton setBezelStyle:NSRoundedBezelStyle]; [startButton setBezelStyle:NSBezelStyleRounded];
[startButton setKeyEquivalent:@"\r"]; [startButton setKeyEquivalent:@"\r"];
[startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
@ -268,7 +271,7 @@ static struct {
[cancelButton setTitle:@"Cancel"]; [cancelButton setTitle:@"Cancel"];
[cancelButton setTarget:self]; [cancelButton setTarget:self];
[cancelButton setAction:@selector(cancel:)]; [cancelButton setAction:@selector(cancel:)];
[cancelButton setBezelStyle:NSRoundedBezelStyle]; [cancelButton setBezelStyle:NSBezelStyleRounded];
[cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [cancelButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
@ -425,7 +428,7 @@ static struct {
- (void)populateVideoModes:(BOOL)firstTime - (void)populateVideoModes:(BOOL)firstTime
{ {
int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState); int i, mode3d, fullscreen = ([fullscreenButton state] == NSControlStateValueOn);
int idx3d = -1; int idx3d = -1;
int xdim = 0, ydim = 0, bpp = 0; int xdim = 0, ydim = 0, bpp = 0;
@ -501,7 +504,7 @@ static struct {
settings.grp = [[gamelistsrc grpAtIndex:row] entryptr]; settings.grp = [[gamelistsrc grpAtIndex:row] entryptr];
} }
settings.forcesetup = [alwaysShowButton state] == NSOnState; settings.forcesetup = [alwaysShowButton state] == NSControlStateValueOn;
retval = 1; retval = 1;
} }
@ -510,8 +513,8 @@ static struct {
{ {
videoGetModes(); videoGetModes();
[fullscreenButton setState: (settings.fullscreen ? NSOnState : NSOffState)]; [fullscreenButton setState: (settings.fullscreen ? NSControlStateValueOn : NSControlStateValueOff)];
[alwaysShowButton setState: (settings.forcesetup ? NSOnState : NSOffState)]; [alwaysShowButton setState: (settings.forcesetup ? NSControlStateValueOn : NSControlStateValueOff)];
[self populateVideoModes:YES]; [self populateVideoModes:YES];
// enable all the controls on the Configuration page // enable all the controls on the Configuration page