Mac: 32-bit builds give trouble with the supposed equivalence of CGRect/Size and NSRect/Size. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5975 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-12-26 20:02:51 +00:00
parent 66f353fbf5
commit 346f391d4a
2 changed files with 61 additions and 61 deletions

View file

@ -6,20 +6,20 @@
#include "build.h" #include "build.h"
#include "editor.h" #include "editor.h"
static CGRect CGRectChangeXY(CGRect const rect, CGFloat const x, CGFloat const y) static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
{ {
return CGRectMake(x, y, rect.size.width, rect.size.height); return NSMakeRect(x, y, rect.size.width, rect.size.height);
} }
static CGRect CGSizeAddXY(CGSize const size, CGFloat const x, CGFloat const y) static NSRect NSSizeAddXY(NSSize const size, CGFloat const x, CGFloat const y)
{ {
return CGRectMake(x, y, size.width, size.height); return NSMakeRect(x, y, size.width, size.height);
} }
#if 0 #if 0
static CGFloat CGRightEdge(CGRect rect) static CGFloat NSRightEdge(NSRect rect)
{ {
return rect.origin.x + rect.size.width; return rect.origin.x + rect.size.width;
} }
static CGFloat CGTopEdge(CGRect rect) static CGFloat NSTopEdge(NSRect rect)
{ {
return rect.origin.y + rect.size.height; return rect.origin.y + rect.size.height;
} }
@ -201,7 +201,7 @@ static struct {
- (StartupWindow *)init - (StartupWindow *)init
{ {
NSUInteger const style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask; NSUInteger const style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
CGRect const windowFrame = CGRectMake(0, 0, 480, 280); NSRect const windowFrame = NSMakeRect(0, 0, 480, 280);
self = [super initWithContentRect:windowFrame styleMask:style backing:NSBackingStoreBuffered defer:NO]; self = [super initWithContentRect:windowFrame styleMask:style backing:NSBackingStoreBuffered defer:NO];
if (self) if (self)
@ -217,7 +217,7 @@ static struct {
// image on the left // image on the left
CGRect const imageFrame = CGRectMake(0, 0, 100, 280); NSRect const imageFrame = NSMakeRect(0, 0, 100, 280);
NSImageView * imageView = [[NSImageView alloc] initWithFrame:imageFrame]; NSImageView * imageView = [[NSImageView alloc] initWithFrame:imageFrame];
#ifdef MAC_OS_X_VERSION_10_5 #ifdef MAC_OS_X_VERSION_10_5
[imageView setImageScaling:NSImageScaleNone]; [imageView setImageScaling:NSImageScaleNone];
@ -233,7 +233,7 @@ static struct {
CGFloat const buttonWidth = 80; CGFloat const buttonWidth = 80;
CGFloat const buttonHeight = 32; CGFloat const buttonHeight = 32;
CGRect const startButtonFrame = CGRectMake(windowFrame.size.width - buttonWidth, 0, buttonWidth, buttonHeight); NSRect const startButtonFrame = NSMakeRect(windowFrame.size.width - buttonWidth, 0, buttonWidth, buttonHeight);
startButton = [[NSButton alloc] initWithFrame:startButtonFrame]; startButton = [[NSButton alloc] initWithFrame:startButtonFrame];
[[self contentView] addSubview:startButton]; [[self contentView] addSubview:startButton];
[startButton setTitle:@"Start"]; [startButton setTitle:@"Start"];
@ -243,7 +243,7 @@ static struct {
[startButton setKeyEquivalent:@"\r"]; [startButton setKeyEquivalent:@"\r"];
[startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
CGRect const cancelButtonFrame = CGRectMake(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight); NSRect const cancelButtonFrame = NSMakeRect(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight);
cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame]; cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame];
[[self contentView] addSubview:cancelButton]; [[self contentView] addSubview:cancelButton];
[cancelButton setTitle:@"Cancel"]; [cancelButton setTitle:@"Cancel"];
@ -254,7 +254,7 @@ static struct {
// tab frame // tab frame
CGRect const tabViewFrame = CGRectMake(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5); NSRect const tabViewFrame = NSMakeRect(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5);
tabView = [[NSTabView alloc] initWithFrame:tabViewFrame]; tabView = [[NSTabView alloc] initWithFrame:tabViewFrame];
[[self contentView] addSubview:tabView]; [[self contentView] addSubview:tabView];
setFontToSmall(tabView); setFontToSmall(tabView);
@ -267,14 +267,14 @@ static struct {
tabViewItemSetup = [[NSTabViewItem alloc] init]; tabViewItemSetup = [[NSTabViewItem alloc] init];
[tabView addTabViewItem:tabViewItemSetup]; [tabView addTabViewItem:tabViewItemSetup];
[tabViewItemSetup setLabel:@"Setup"]; [tabViewItemSetup setLabel:@"Setup"];
CGRect const tabViewItemSetupFrame = [[tabViewItemSetup view] frame]; NSRect const tabViewItemSetupFrame = [[tabViewItemSetup view] frame];
// always show checkbox // always show checkbox
alwaysShowButton = makeCheckbox(@"Always show this window at startup"); alwaysShowButton = makeCheckbox(@"Always show this window at startup");
[[tabViewItemSetup view] addSubview:alwaysShowButton]; [[tabViewItemSetup view] addSubview:alwaysShowButton];
CGSize const alwaysShowButtonSize = [alwaysShowButton frame].size; NSSize const alwaysShowButtonSize = [alwaysShowButton frame].size;
CGRect const alwaysShowButtonFrame = CGSizeAddXY(alwaysShowButtonSize, tabViewItemSetupFrame.size.width - alwaysShowButtonSize.width, 0); NSRect const alwaysShowButtonFrame = NSSizeAddXY(alwaysShowButtonSize, tabViewItemSetupFrame.size.width - alwaysShowButtonSize.width, 0);
[alwaysShowButton setFrame:alwaysShowButtonFrame]; [alwaysShowButton setFrame:alwaysShowButtonFrame];
[alwaysShowButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [alwaysShowButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
@ -282,17 +282,17 @@ static struct {
// video mode selectors and labels // video mode selectors and labels
NSTextField * label2DVideoMode = makeLabel(@"2D Video mode:"); NSTextField * label2DVideoMode = makeLabel(@"2D Video mode:");
[[tabViewItemSetup view] addSubview:label2DVideoMode]; [[tabViewItemSetup view] addSubview:label2DVideoMode];
CGSize const label2DVideoModeSize = [label2DVideoMode frame].size; NSSize const label2DVideoModeSize = [label2DVideoMode frame].size;
[label2DVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; [label2DVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
NSTextField * label3DVideoMode = makeLabel(@"3D Video mode:"); NSTextField * label3DVideoMode = makeLabel(@"3D Video mode:");
[[tabViewItemSetup view] addSubview:label3DVideoMode]; [[tabViewItemSetup view] addSubview:label3DVideoMode];
CGSize const label3DVideoModeSize = [label3DVideoMode frame].size; NSSize const label3DVideoModeSize = [label3DVideoMode frame].size;
[label3DVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; [label3DVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
fullscreenButton = makeCheckbox(@"Fullscreen"); fullscreenButton = makeCheckbox(@"Fullscreen");
[[tabViewItemSetup view] addSubview:fullscreenButton]; [[tabViewItemSetup view] addSubview:fullscreenButton];
CGSize const fullscreenButtonSize = [fullscreenButton frame].size; NSSize const fullscreenButtonSize = [fullscreenButton frame].size;
[fullscreenButton setAction:@selector(fullscreenClicked:)]; [fullscreenButton setAction:@selector(fullscreenClicked:)];
[fullscreenButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; [fullscreenButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
@ -300,27 +300,27 @@ static struct {
videoMode2DPUButton = makeComboBox(); videoMode2DPUButton = makeComboBox();
[[tabViewItemSetup view] addSubview:videoMode2DPUButton]; [[tabViewItemSetup view] addSubview:videoMode2DPUButton];
CGSize const videoMode2DPUButtonSize = [videoMode2DPUButton frame].size; NSSize const videoMode2DPUButtonSize = [videoMode2DPUButton frame].size;
CGFloat const videoMode2DButtonX = labelsVideoModeRightEdge; CGFloat const videoMode2DButtonX = labelsVideoModeRightEdge;
CGRect const videoMode2DPUButtonFrame = CGRectMake(videoMode2DButtonX, tabViewItemSetupFrame.size.height - videoMode2DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode2DButtonX - fullscreenButtonSize.width, videoMode2DPUButtonSize.height); NSRect const videoMode2DPUButtonFrame = NSMakeRect(videoMode2DButtonX, tabViewItemSetupFrame.size.height - videoMode2DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode2DButtonX - fullscreenButtonSize.width, videoMode2DPUButtonSize.height);
[videoMode2DPUButton setFrame:videoMode2DPUButtonFrame]; [videoMode2DPUButton setFrame:videoMode2DPUButtonFrame];
[videoMode2DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin]; [videoMode2DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
videoMode3DPUButton = makeComboBox(); videoMode3DPUButton = makeComboBox();
[[tabViewItemSetup view] addSubview:videoMode3DPUButton]; [[tabViewItemSetup view] addSubview:videoMode3DPUButton];
CGSize const videoMode3DPUButtonSize = [videoMode3DPUButton frame].size; NSSize const videoMode3DPUButtonSize = [videoMode3DPUButton frame].size;
CGFloat const videoMode3DButtonX = labelsVideoModeRightEdge; CGFloat const videoMode3DButtonX = labelsVideoModeRightEdge;
CGRect const videoMode3DPUButtonFrame = CGRectMake(videoMode3DButtonX, videoMode2DPUButtonFrame.origin.y - videoMode3DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode3DButtonX - fullscreenButtonSize.width, videoMode3DPUButtonSize.height); NSRect const videoMode3DPUButtonFrame = NSMakeRect(videoMode3DButtonX, videoMode2DPUButtonFrame.origin.y - videoMode3DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode3DButtonX - fullscreenButtonSize.width, videoMode3DPUButtonSize.height);
[videoMode3DPUButton setFrame:videoMode3DPUButtonFrame]; [videoMode3DPUButton setFrame:videoMode3DPUButtonFrame];
[videoMode3DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin]; [videoMode3DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
CGRect const label2DVideoModeFrame = CGSizeAddXY(label2DVideoModeSize, 0, videoMode2DPUButtonFrame.origin.y + rintf((videoMode2DPUButtonSize.height - label2DVideoModeSize.height) * 0.5f) + 1); NSRect const label2DVideoModeFrame = NSSizeAddXY(label2DVideoModeSize, 0, videoMode2DPUButtonFrame.origin.y + rintf((videoMode2DPUButtonSize.height - label2DVideoModeSize.height) * 0.5f) + 1);
[label2DVideoMode setFrame:label2DVideoModeFrame]; [label2DVideoMode setFrame:label2DVideoModeFrame];
CGRect const label3DVideoModeFrame = CGSizeAddXY(label3DVideoModeSize, 0, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - label3DVideoModeSize.height) * 0.5f) + 1); NSRect const label3DVideoModeFrame = NSSizeAddXY(label3DVideoModeSize, 0, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - label3DVideoModeSize.height) * 0.5f) + 1);
[label3DVideoMode setFrame:label3DVideoModeFrame]; [label3DVideoMode setFrame:label3DVideoModeFrame];
CGRect const fullscreenButtonFrame = CGSizeAddXY(fullscreenButtonSize, tabViewItemSetupFrame.size.width - fullscreenButtonSize.width, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - fullscreenButtonSize.height) * 0.5f) + 1); NSRect const fullscreenButtonFrame = NSSizeAddXY(fullscreenButtonSize, tabViewItemSetupFrame.size.width - fullscreenButtonSize.width, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - fullscreenButtonSize.height) * 0.5f) + 1);
[fullscreenButton setFrame:fullscreenButtonFrame]; [fullscreenButton setFrame:fullscreenButtonFrame];
@ -329,11 +329,11 @@ static struct {
tabViewItemMessageLog = [[NSTabViewItem alloc] init]; tabViewItemMessageLog = [[NSTabViewItem alloc] init];
[tabView addTabViewItem:tabViewItemMessageLog]; [tabView addTabViewItem:tabViewItemMessageLog];
[tabViewItemMessageLog setLabel:@"Message Log"]; [tabViewItemMessageLog setLabel:@"Message Log"];
CGRect const tabViewItemMessageLogFrame = [[tabViewItemMessageLog view] frame]; NSRect const tabViewItemMessageLogFrame = [[tabViewItemMessageLog view] frame];
// message log // message log
NSScrollView * messagesScrollView = [[NSScrollView alloc] initWithFrame:CGRectChangeXY(tabViewItemMessageLogFrame, 0, 0)]; NSScrollView * messagesScrollView = [[NSScrollView alloc] initWithFrame:NSRectChangeXY(tabViewItemMessageLogFrame, 0, 0)];
[[tabViewItemMessageLog view] addSubview:messagesScrollView]; [[tabViewItemMessageLog view] addSubview:messagesScrollView];
[messagesScrollView setBorderType:NSBezelBorder]; [messagesScrollView setBorderType:NSBezelBorder];
[messagesScrollView setHasVerticalScroller:YES]; [messagesScrollView setHasVerticalScroller:YES];
@ -342,18 +342,18 @@ static struct {
NSSize const messagesScrollViewContentSize = [messagesScrollView contentSize]; NSSize const messagesScrollViewContentSize = [messagesScrollView contentSize];
[messagesScrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; [messagesScrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
messagesView = [[NSTextView alloc] initWithFrame:CGRectMake(0, 0, messagesScrollViewContentSize.width, messagesScrollViewContentSize.height)]; messagesView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, messagesScrollViewContentSize.width, messagesScrollViewContentSize.height)];
[messagesScrollView setDocumentView:messagesView]; [messagesScrollView setDocumentView:messagesView];
[messagesView setEditable:NO]; [messagesView setEditable:NO];
[messagesView setRichText:NO]; [messagesView setRichText:NO];
setFontToSmall(messagesView); setFontToSmall(messagesView);
[messagesView setMinSize:CGSizeMake(0.0, messagesScrollViewContentSize.height)]; [messagesView setMinSize:NSMakeSize(0.0, messagesScrollViewContentSize.height)];
[messagesView setMaxSize:CGSizeMake(FLT_MAX, FLT_MAX)]; [messagesView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
[messagesView setVerticallyResizable:YES]; [messagesView setVerticallyResizable:YES];
[messagesView setHorizontallyResizable:NO]; [messagesView setHorizontallyResizable:NO];
[messagesView setAutoresizingMask:NSViewWidthSizable]; [messagesView setAutoresizingMask:NSViewWidthSizable];
[[messagesView textContainer] setContainerSize:CGSizeMake(messagesScrollViewContentSize.width, FLT_MAX)]; [[messagesView textContainer] setContainerSize:NSMakeSize(messagesScrollViewContentSize.width, FLT_MAX)];
[[messagesView textContainer] setWidthTracksTextView:YES]; [[messagesView textContainer] setWidthTracksTextView:YES];
} }

View file

@ -13,21 +13,21 @@
#import "GrpFile.game.h" #import "GrpFile.game.h"
#import "GameListSource.game.h" #import "GameListSource.game.h"
static CGRect CGRectChangeXY(CGRect const rect, CGFloat const x, CGFloat const y) static NSRect NSRectChangeXY(NSRect const rect, CGFloat const x, CGFloat const y)
{ {
return CGRectMake(x, y, rect.size.width, rect.size.height); return NSMakeRect(x, y, rect.size.width, rect.size.height);
} }
static CGRect CGSizeAddXY(CGSize const size, CGFloat const x, CGFloat const y) static NSRect NSSizeAddXY(NSSize const size, CGFloat const x, CGFloat const y)
{ {
return CGRectMake(x, y, size.width, size.height); return NSMakeRect(x, y, size.width, size.height);
} }
#if 0 #if 0
static CGFloat CGRightEdge(CGRect rect) static CGFloat NSRightEdge(NSRect rect)
{ {
return rect.origin.x + rect.size.width; return rect.origin.x + rect.size.width;
} }
#endif #endif
static CGFloat CGTopEdge(CGRect rect) static CGFloat NSTopEdge(NSRect rect)
{ {
return rect.origin.y + rect.size.height; return rect.origin.y + rect.size.height;
} }
@ -208,7 +208,7 @@ static struct {
- (StartupWindow *)init - (StartupWindow *)init
{ {
NSUInteger const style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask; NSUInteger const style = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
CGRect const windowFrame = CGRectMake(0, 0, 480, 280); NSRect const windowFrame = NSMakeRect(0, 0, 480, 280);
self = [super initWithContentRect:windowFrame styleMask:style backing:NSBackingStoreBuffered defer:NO]; self = [super initWithContentRect:windowFrame styleMask:style backing:NSBackingStoreBuffered defer:NO];
if (self) if (self)
@ -224,7 +224,7 @@ static struct {
// image on the left // image on the left
CGRect const imageFrame = CGRectMake(0, 0, 100, 280); NSRect const imageFrame = NSMakeRect(0, 0, 100, 280);
NSImageView * imageView = [[NSImageView alloc] initWithFrame:imageFrame]; NSImageView * imageView = [[NSImageView alloc] initWithFrame:imageFrame];
#ifdef MAC_OS_X_VERSION_10_5 #ifdef MAC_OS_X_VERSION_10_5
[imageView setImageScaling:NSImageScaleNone]; [imageView setImageScaling:NSImageScaleNone];
@ -240,7 +240,7 @@ static struct {
CGFloat const buttonWidth = 80; CGFloat const buttonWidth = 80;
CGFloat const buttonHeight = 32; CGFloat const buttonHeight = 32;
CGRect const startButtonFrame = CGRectMake(windowFrame.size.width - buttonWidth, 0, buttonWidth, buttonHeight); NSRect const startButtonFrame = NSMakeRect(windowFrame.size.width - buttonWidth, 0, buttonWidth, buttonHeight);
startButton = [[NSButton alloc] initWithFrame:startButtonFrame]; startButton = [[NSButton alloc] initWithFrame:startButtonFrame];
[[self contentView] addSubview:startButton]; [[self contentView] addSubview:startButton];
[startButton setTitle:@"Start"]; [startButton setTitle:@"Start"];
@ -250,7 +250,7 @@ static struct {
[startButton setKeyEquivalent:@"\r"]; [startButton setKeyEquivalent:@"\r"];
[startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [startButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
CGRect const cancelButtonFrame = CGRectMake(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight); NSRect const cancelButtonFrame = NSMakeRect(startButtonFrame.origin.x - buttonWidth, 0, buttonWidth, buttonHeight);
cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame]; cancelButton = [[NSButton alloc] initWithFrame:cancelButtonFrame];
[[self contentView] addSubview:cancelButton]; [[self contentView] addSubview:cancelButton];
[cancelButton setTitle:@"Cancel"]; [cancelButton setTitle:@"Cancel"];
@ -261,7 +261,7 @@ static struct {
// tab frame // tab frame
CGRect const tabViewFrame = CGRectMake(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5); NSRect const tabViewFrame = NSMakeRect(imageFrame.size.width, buttonHeight, windowFrame.size.width - imageFrame.size.width, windowFrame.size.height - buttonHeight - 5);
tabView = [[NSTabView alloc] initWithFrame:tabViewFrame]; tabView = [[NSTabView alloc] initWithFrame:tabViewFrame];
[[self contentView] addSubview:tabView]; [[self contentView] addSubview:tabView];
setFontToSmall(tabView); setFontToSmall(tabView);
@ -274,14 +274,14 @@ static struct {
tabViewItemSetup = [[NSTabViewItem alloc] init]; tabViewItemSetup = [[NSTabViewItem alloc] init];
[tabView addTabViewItem:tabViewItemSetup]; [tabView addTabViewItem:tabViewItemSetup];
[tabViewItemSetup setLabel:@"Setup"]; [tabViewItemSetup setLabel:@"Setup"];
CGRect const tabViewItemSetupFrame = [[tabViewItemSetup view] frame]; NSRect const tabViewItemSetupFrame = [[tabViewItemSetup view] frame];
// always show checkbox // always show checkbox
alwaysShowButton = makeCheckbox(@"Always show this window at startup"); alwaysShowButton = makeCheckbox(@"Always show this window at startup");
[[tabViewItemSetup view] addSubview:alwaysShowButton]; [[tabViewItemSetup view] addSubview:alwaysShowButton];
CGSize const alwaysShowButtonSize = [alwaysShowButton frame].size; NSSize const alwaysShowButtonSize = [alwaysShowButton frame].size;
CGRect const alwaysShowButtonFrame = CGSizeAddXY(alwaysShowButtonSize, tabViewItemSetupFrame.size.width - alwaysShowButtonSize.width, 0); NSRect const alwaysShowButtonFrame = NSSizeAddXY(alwaysShowButtonSize, tabViewItemSetupFrame.size.width - alwaysShowButtonSize.width, 0);
[alwaysShowButton setFrame:alwaysShowButtonFrame]; [alwaysShowButton setFrame:alwaysShowButtonFrame];
[alwaysShowButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin]; [alwaysShowButton setAutoresizingMask:NSViewMinXMargin | NSViewMaxYMargin];
@ -289,41 +289,41 @@ static struct {
// video mode selectors and labels // video mode selectors and labels
NSTextField * labelVideoMode = makeLabel(@"Video mode:"); NSTextField * labelVideoMode = makeLabel(@"Video mode:");
[[tabViewItemSetup view] addSubview:labelVideoMode]; [[tabViewItemSetup view] addSubview:labelVideoMode];
CGSize const labelVideoModeSize = [labelVideoMode frame].size; NSSize const labelVideoModeSize = [labelVideoMode frame].size;
[labelVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; [labelVideoMode setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
fullscreenButton = makeCheckbox(@"Fullscreen"); fullscreenButton = makeCheckbox(@"Fullscreen");
[[tabViewItemSetup view] addSubview:fullscreenButton]; [[tabViewItemSetup view] addSubview:fullscreenButton];
CGSize const fullscreenButtonSize = [fullscreenButton frame].size; NSSize const fullscreenButtonSize = [fullscreenButton frame].size;
[fullscreenButton setAction:@selector(fullscreenClicked:)]; [fullscreenButton setAction:@selector(fullscreenClicked:)];
[fullscreenButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; [fullscreenButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
videoMode3DPUButton = makeComboBox(); videoMode3DPUButton = makeComboBox();
[[tabViewItemSetup view] addSubview:videoMode3DPUButton]; [[tabViewItemSetup view] addSubview:videoMode3DPUButton];
CGSize const videoMode3DPUButtonSize = [videoMode3DPUButton frame].size; NSSize const videoMode3DPUButtonSize = [videoMode3DPUButton frame].size;
CGFloat const videoMode3DButtonX = labelVideoModeSize.width; // CGRightEdge(labelVideoModeFrame); CGFloat const videoMode3DButtonX = labelVideoModeSize.width; // NSRightEdge(labelVideoModeFrame);
CGRect const videoMode3DPUButtonFrame = CGRectMake(videoMode3DButtonX, tabViewItemSetupFrame.size.height - videoMode3DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode3DButtonX - fullscreenButtonSize.width, videoMode3DPUButtonSize.height); NSRect const videoMode3DPUButtonFrame = NSMakeRect(videoMode3DButtonX, tabViewItemSetupFrame.size.height - videoMode3DPUButtonSize.height, tabViewItemSetupFrame.size.width - videoMode3DButtonX - fullscreenButtonSize.width, videoMode3DPUButtonSize.height);
[videoMode3DPUButton setFrame:videoMode3DPUButtonFrame]; [videoMode3DPUButton setFrame:videoMode3DPUButtonFrame];
[videoMode3DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin]; [videoMode3DPUButton setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
CGRect const labelVideoModeFrame = CGSizeAddXY(labelVideoModeSize, 0, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - labelVideoModeSize.height) * 0.5f) + 1); NSRect const labelVideoModeFrame = NSSizeAddXY(labelVideoModeSize, 0, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - labelVideoModeSize.height) * 0.5f) + 1);
[labelVideoMode setFrame:labelVideoModeFrame]; [labelVideoMode setFrame:labelVideoModeFrame];
CGRect const fullscreenButtonFrame = CGSizeAddXY(fullscreenButtonSize, tabViewItemSetupFrame.size.width - fullscreenButtonSize.width, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - fullscreenButtonSize.height) * 0.5f) + 1); NSRect const fullscreenButtonFrame = NSSizeAddXY(fullscreenButtonSize, tabViewItemSetupFrame.size.width - fullscreenButtonSize.width, videoMode3DPUButtonFrame.origin.y + rintf((videoMode3DPUButtonSize.height - fullscreenButtonSize.height) * 0.5f) + 1);
[fullscreenButton setFrame:fullscreenButtonFrame]; [fullscreenButton setFrame:fullscreenButtonFrame];
// game selector and label // game selector and label
NSTextField * labelGame = makeLabel(@"Game:"); NSTextField * labelGame = makeLabel(@"Game:");
[[tabViewItemSetup view] addSubview:labelGame]; [[tabViewItemSetup view] addSubview:labelGame];
CGSize const labelGameSize = [labelGame frame].size; NSSize const labelGameSize = [labelGame frame].size;
CGRect const labelGameFrame = CGSizeAddXY(labelGameSize, 0, videoMode3DPUButtonFrame.origin.y - labelGameSize.height); NSRect const labelGameFrame = NSSizeAddXY(labelGameSize, 0, videoMode3DPUButtonFrame.origin.y - labelGameSize.height);
[labelGame setFrame:labelGameFrame]; [labelGame setFrame:labelGameFrame];
[labelGame setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; [labelGame setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
CGFloat const gameListVerticalPadding = 3; CGFloat const gameListVerticalPadding = 3;
CGFloat const gameListY = CGTopEdge(alwaysShowButtonFrame) + gameListVerticalPadding; CGFloat const gameListY = NSTopEdge(alwaysShowButtonFrame) + gameListVerticalPadding;
CGRect const gameListFrame = CGRectMake(0, gameListY, tabViewItemSetupFrame.size.width, labelGameFrame.origin.y - gameListY - gameListVerticalPadding); NSRect const gameListFrame = NSMakeRect(0, gameListY, tabViewItemSetupFrame.size.width, labelGameFrame.origin.y - gameListY - gameListVerticalPadding);
gameList = [[NSScrollView alloc] initWithFrame:gameListFrame]; gameList = [[NSScrollView alloc] initWithFrame:gameListFrame];
[[tabViewItemSetup view] addSubview:gameList]; [[tabViewItemSetup view] addSubview:gameList];
[gameList setBorderType:NSBezelBorder]; [gameList setBorderType:NSBezelBorder];
@ -354,11 +354,11 @@ static struct {
tabViewItemMessageLog = [[NSTabViewItem alloc] init]; tabViewItemMessageLog = [[NSTabViewItem alloc] init];
[tabView addTabViewItem:tabViewItemMessageLog]; [tabView addTabViewItem:tabViewItemMessageLog];
[tabViewItemMessageLog setLabel:@"Message Log"]; [tabViewItemMessageLog setLabel:@"Message Log"];
CGRect const tabViewItemMessageLogFrame = [[tabViewItemMessageLog view] frame]; NSRect const tabViewItemMessageLogFrame = [[tabViewItemMessageLog view] frame];
// message log // message log
NSScrollView * messagesScrollView = [[NSScrollView alloc] initWithFrame:CGRectChangeXY(tabViewItemMessageLogFrame, 0, 0)]; NSScrollView * messagesScrollView = [[NSScrollView alloc] initWithFrame:NSRectChangeXY(tabViewItemMessageLogFrame, 0, 0)];
[[tabViewItemMessageLog view] addSubview:messagesScrollView]; [[tabViewItemMessageLog view] addSubview:messagesScrollView];
[messagesScrollView setBorderType:NSBezelBorder]; [messagesScrollView setBorderType:NSBezelBorder];
[messagesScrollView setHasVerticalScroller:YES]; [messagesScrollView setHasVerticalScroller:YES];
@ -367,18 +367,18 @@ static struct {
NSSize const messagesScrollViewContentSize = [messagesScrollView contentSize]; NSSize const messagesScrollViewContentSize = [messagesScrollView contentSize];
[messagesScrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; [messagesScrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
messagesView = [[NSTextView alloc] initWithFrame:CGRectMake(0, 0, messagesScrollViewContentSize.width, messagesScrollViewContentSize.height)]; messagesView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, messagesScrollViewContentSize.width, messagesScrollViewContentSize.height)];
[messagesScrollView setDocumentView:messagesView]; [messagesScrollView setDocumentView:messagesView];
[messagesView setEditable:NO]; [messagesView setEditable:NO];
[messagesView setRichText:NO]; [messagesView setRichText:NO];
setFontToSmall(messagesView); setFontToSmall(messagesView);
[messagesView setMinSize:CGSizeMake(0.0, messagesScrollViewContentSize.height)]; [messagesView setMinSize:NSMakeSize(0.0, messagesScrollViewContentSize.height)];
[messagesView setMaxSize:CGSizeMake(FLT_MAX, FLT_MAX)]; [messagesView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
[messagesView setVerticallyResizable:YES]; [messagesView setVerticallyResizable:YES];
[messagesView setHorizontallyResizable:NO]; [messagesView setHorizontallyResizable:NO];
[messagesView setAutoresizingMask:NSViewWidthSizable]; [messagesView setAutoresizingMask:NSViewWidthSizable];
[[messagesView textContainer] setContainerSize:CGSizeMake(messagesScrollViewContentSize.width, FLT_MAX)]; [[messagesView textContainer] setContainerSize:NSMakeSize(messagesScrollViewContentSize.width, FLT_MAX)];
[[messagesView textContainer] setWidthTracksTextView:YES]; [[messagesView textContainer] setWidthTracksTextView:YES];
} }