Fix Xcode auto-fixable issues

This commit is contained in:
Koen Schmeets 2019-11-23 13:38:41 +01:00 committed by whitequark
parent 74aa80b645
commit 0dcc8f3369
2 changed files with 23 additions and 24 deletions

View File

@ -225,9 +225,9 @@ public:
NSUInteger modifierMask = 0; NSUInteger modifierMask = 0;
if(accel.shiftDown) if(accel.shiftDown)
modifierMask |= NSShiftKeyMask; modifierMask |= NSEventModifierFlagShift;
if(accel.controlDown) if(accel.controlDown)
modifierMask |= NSCommandKeyMask; modifierMask |= NSEventModifierFlagCommand;
nsMenuItem.keyEquivalentModifierMask = modifierMask; nsMenuItem.keyEquivalentModifierMask = modifierMask;
} }
@ -236,7 +236,7 @@ public:
} }
void SetActive(bool active) override { void SetActive(bool active) override {
nsMenuItem.state = active ? NSOnState : NSOffState; nsMenuItem.state = active ? NSControlStateValueOn : NSControlStateValueOff;
} }
void SetEnabled(bool enabled) override { void SetEnabled(bool enabled) override {
@ -422,7 +422,7 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
width * 4, colorspace, kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, width * 4, colorspace, kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
provider, NULL, true, kCGRenderingIntentDefault); provider, NULL, true, kCGRenderingIntentDefault);
CGContextDrawImage((CGContextRef) [[NSGraphicsContext currentContext] graphicsPort], CGContextDrawImage((CGContextRef) [[NSGraphicsContext currentContext] CGContext],
[self bounds], image); [self bounds], image);
CGImageRelease(image); CGImageRelease(image);
@ -453,8 +453,8 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
event.y = self.bounds.size.height - nsPoint.y; event.y = self.bounds.size.height - nsPoint.y;
NSUInteger nsFlags = [nsEvent modifierFlags]; NSUInteger nsFlags = [nsEvent modifierFlags];
if(nsFlags & NSShiftKeyMask) event.shiftDown = true; if(nsFlags & NSEventModifierFlagShift) event.shiftDown = true;
if(nsFlags & NSCommandKeyMask) event.controlDown = true; if(nsFlags & NSEventModifierFlagCommand) event.controlDown = true;
return event; return event;
} }
@ -587,9 +587,9 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
KeyboardEvent event = {}; KeyboardEvent event = {};
NSUInteger nsFlags = [nsEvent modifierFlags]; NSUInteger nsFlags = [nsEvent modifierFlags];
if(nsFlags & NSShiftKeyMask) if(nsFlags & NSEventModifierFlagShift)
event.shiftDown = true; event.shiftDown = true;
if(nsFlags & NSCommandKeyMask) if(nsFlags & NSEventModifierFlagCommand)
event.controlDown = true; event.controlDown = true;
unichar chr = 0; unichar chr = 0;
@ -610,7 +610,7 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
- (void)keyDown:(NSEvent *)nsEvent { - (void)keyDown:(NSEvent *)nsEvent {
using Platform::KeyboardEvent; using Platform::KeyboardEvent;
if([NSEvent modifierFlags] & ~(NSShiftKeyMask|NSCommandKeyMask)) { if([NSEvent modifierFlags] & ~(NSEventModifierFlagShift|NSEventModifierFlagCommand)) {
[super keyDown:nsEvent]; [super keyDown:nsEvent];
return; return;
} }
@ -629,7 +629,7 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
- (void)keyUp:(NSEvent *)nsEvent { - (void)keyUp:(NSEvent *)nsEvent {
using Platform::KeyboardEvent; using Platform::KeyboardEvent;
if([NSEvent modifierFlags] & ~(NSShiftKeyMask|NSCommandKeyMask)) { if([NSEvent modifierFlags] & ~(NSEventModifierFlagShift|NSEventModifierFlagCommand)) {
[super keyUp:nsEvent]; [super keyUp:nsEvent];
return; return;
} }
@ -811,16 +811,16 @@ public:
switch(kind) { switch(kind) {
case Window::Kind::TOPLEVEL: case Window::Kind::TOPLEVEL:
nsWindow = [[NSWindow alloc] init]; nsWindow = [[NSWindow alloc] init];
nsWindow.styleMask = NSTitledWindowMask | NSResizableWindowMask | nsWindow.styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskResizable |
NSClosableWindowMask | NSMiniaturizableWindowMask; NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable;
nsWindow.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary; nsWindow.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
ssView.acceptsFirstResponder = YES; ssView.acceptsFirstResponder = YES;
break; break;
case Window::Kind::TOOL: case Window::Kind::TOOL:
NSPanel *nsPanel = [[NSPanel alloc] init]; NSPanel *nsPanel = [[NSPanel alloc] init];
nsPanel.styleMask = NSTitledWindowMask | NSResizableWindowMask | nsPanel.styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskResizable |
NSClosableWindowMask | NSUtilityWindowMask; NSWindowStyleMaskClosable | NSWindowStyleMaskUtilityWindow;
[nsPanel standardWindowButton:NSWindowMiniaturizeButton].hidden = YES; [nsPanel standardWindowButton:NSWindowMiniaturizeButton].hidden = YES;
[nsPanel standardWindowButton:NSWindowZoomButton].hidden = YES; [nsPanel standardWindowButton:NSWindowZoomButton].hidden = YES;
nsPanel.floatingPanel = YES; nsPanel.floatingPanel = YES;
@ -1128,17 +1128,17 @@ void Open3DConnexion() {
connexionClient = registerConnexionClient(connexionSignature, connexionName, connexionClient = registerConnexionClient(connexionSignature, connexionName,
kConnexionClientModeTakeOver, kConnexionMaskButtons | kConnexionMaskAxis); kConnexionClientModeTakeOver, kConnexionMaskButtons | kConnexionMaskAxis);
[NSEvent addLocalMonitorForEventsMatchingMask:(NSKeyDownMask | NSFlagsChangedMask) [NSEvent addLocalMonitorForEventsMatchingMask:(NSEventMaskKeyDown | NSEventMaskFlagsChanged)
handler:^(NSEvent *event) { handler:^(NSEvent *event) {
connexionShiftIsDown = (event.modifierFlags & NSShiftKeyMask); connexionShiftIsDown = (event.modifierFlags & NSEventModifierFlagShift);
connexionCommandIsDown = (event.modifierFlags & NSCommandKeyMask); connexionCommandIsDown = (event.modifierFlags & NSEventModifierFlagCommand);
return event; return event;
}]; }];
[NSEvent addLocalMonitorForEventsMatchingMask:(NSKeyUpMask | NSFlagsChangedMask) [NSEvent addLocalMonitorForEventsMatchingMask:(NSEventMaskKeyUp | NSEventMaskFlagsChanged)
handler:^(NSEvent *event) { handler:^(NSEvent *event) {
connexionShiftIsDown = (event.modifierFlags & NSShiftKeyMask); connexionShiftIsDown = (event.modifierFlags & NSEventModifierFlagShift);
connexionCommandIsDown = (event.modifierFlags & NSCommandKeyMask); connexionCommandIsDown = (event.modifierFlags & NSEventModifierFlagCommand);
return event; return event;
}]; }];
} }
@ -1173,12 +1173,12 @@ public:
switch(type) { switch(type) {
case Type::INFORMATION: case Type::INFORMATION:
case Type::QUESTION: case Type::QUESTION:
nsAlert.alertStyle = NSInformationalAlertStyle; nsAlert.alertStyle = NSAlertStyleInformational;
break; break;
case Type::WARNING: case Type::WARNING:
case Type::ERROR: case Type::ERROR:
nsAlert.alertStyle = NSWarningAlertStyle; nsAlert.alertStyle = NSAlertStyleWarning;
break; break;
} }
} }
@ -1289,7 +1289,7 @@ public:
} }
bool RunModal() override { bool RunModal() override {
if([nsPanel runModal] == NSFileHandlingPanelOKButton) { if([nsPanel runModal] == NSModalResponseOK) {
return true; return true;
} else { } else {
return false; return false;

View File

@ -799,7 +799,6 @@ void SolveSpaceUI::MenuAnalyze(Command id) {
Group *g = SK.GetGroup(SS.GW.activeGroup); Group *g = SK.GetGroup(SS.GW.activeGroup);
SS.GW.GroupSelection(); SS.GW.GroupSelection();
auto const &gs = SS.GW.gs; auto const &gs = SS.GW.gs;
double scale = SS.MmPerUnit();
if(gs.faces > 0) { if(gs.faces > 0) {
std::vector<uint32_t> faces; std::vector<uint32_t> faces;