diff --git a/Applications/NewApplication/src/AppDelegate.mm b/Applications/NewApplication/src/AppDelegate.mm index 0aed553f..71767461 100644 --- a/Applications/NewApplication/src/AppDelegate.mm +++ b/Applications/NewApplication/src/AppDelegate.mm @@ -204,7 +204,7 @@ - (void)applicationDidFinishLaunching:(NSNotification*)aNotification { - _window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 400, 400) styleMask:(NSTitledWindowMask|NSResizableWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO]; + _window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 400, 400) styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskResizable|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]; _window.releasedWhenClosed = NO; _window.delegate = self; _window.title = @"New Application"; diff --git a/Applications/TextMate/src/AboutWindowController.mm b/Applications/TextMate/src/AboutWindowController.mm index c5423103..df363993 100644 --- a/Applications/TextMate/src/AboutWindowController.mm +++ b/Applications/TextMate/src/AboutWindowController.mm @@ -98,7 +98,7 @@ static NSData* Digest (NSString* someString) rect.origin.y = round(NSMinY(visibleRect) + dy*3/4); rect.origin.x = NSMaxY(visibleRect) - NSMaxY(rect); - NSWindow* win = [[NSWindow alloc] initWithContentRect:rect styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO]; + NSWindow* win = [[NSWindow alloc] initWithContentRect:rect styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]; if((self = [super initWithWindow:win])) { self.toolbar = [[NSToolbar alloc] initWithIdentifier:@"About TextMate"]; diff --git a/Applications/TextMate/src/AppController Documents.mm b/Applications/TextMate/src/AppController Documents.mm index 7f0d89e4..604c579c 100644 --- a/Applications/TextMate/src/AppController Documents.mm +++ b/Applications/TextMate/src/AppController Documents.mm @@ -42,7 +42,7 @@ OAK_DEBUG_VAR(AppController_Documents); openPanel.title = [NSString stringWithFormat:@"%@: Open", [[[NSBundle mainBundle] localizedInfoDictionary] valueForKey: @"CFBundleName"] ?: [[NSProcessInfo processInfo] processName]]; [openPanel setShowsHiddenFilesCheckBox:YES]; - if([openPanel runModal] == NSOKButton) + if([openPanel runModal] == NSModalResponseOK) { NSMutableArray* filenames = [NSMutableArray array]; for(NSURL* url in [openPanel URLs]) diff --git a/Applications/TextMate/src/AppController.mm b/Applications/TextMate/src/AppController.mm index eeb05ab2..2ae697b6 100644 --- a/Applications/TextMate/src/AppController.mm +++ b/Applications/TextMate/src/AppController.mm @@ -47,7 +47,7 @@ void OakOpenDocuments (NSArray* paths, BOOL treatFilePackageAsFolder) NSMutableArray* documents = [NSMutableArray array]; NSMutableArray* itemsToInstall = [NSMutableArray array]; NSMutableArray* plugInsToInstall = [NSMutableArray array]; - BOOL enableInstallHandler = treatFilePackageAsFolder == NO && ([NSEvent modifierFlags] & NSAlternateKeyMask) == 0; + BOOL enableInstallHandler = treatFilePackageAsFolder == NO && ([NSEvent modifierFlags] & NSEventModifierFlagOption) == 0; for(NSString* path in paths) { BOOL isDirectory = NO; @@ -448,9 +448,9 @@ BOOL HasDocumentWindow (NSArray* windows) forwardMenuItem.keyEquivalent = @""; shiftLeftMenuItem.keyEquivalent = @"["; - shiftLeftMenuItem.keyEquivalentModifierMask = NSCommandKeyMask; + shiftLeftMenuItem.keyEquivalentModifierMask = NSEventModifierFlagCommand; shiftRightMenuItem.keyEquivalent = @"]"; - shiftRightMenuItem.keyEquivalentModifierMask = NSCommandKeyMask; + shiftRightMenuItem.keyEquivalentModifierMask = NSEventModifierFlagCommand; } else { @@ -458,9 +458,9 @@ BOOL HasDocumentWindow (NSArray* windows) shiftRightMenuItem.keyEquivalent = @""; backMenuItem.keyEquivalent = @"["; - backMenuItem.keyEquivalentModifierMask = NSCommandKeyMask; + backMenuItem.keyEquivalentModifierMask = NSEventModifierFlagCommand; forwardMenuItem.keyEquivalent = @"]"; - forwardMenuItem.keyEquivalentModifierMask = NSCommandKeyMask; + forwardMenuItem.keyEquivalentModifierMask = NSEventModifierFlagCommand; } } } @@ -574,7 +574,7 @@ BOOL HasDocumentWindow (NSArray* windows) NSString* promptUser = nil; if(path::exists(prematureTerminationDuringRestore)) promptUser = @"Previous attempt of restoring your session caused an abnormal exit. Would you like to skip session restore?"; - else if([NSEvent modifierFlags] & NSShiftKeyMask) + else if([NSEvent modifierFlags] & NSEventModifierFlagShift) promptUser = @"By holding down shift (⇧) you have indicated that you wish to disable restoring the documents which were open in last session."; if(promptUser) diff --git a/Applications/TextMate/src/Favorites.mm b/Applications/TextMate/src/Favorites.mm index 7fa6760b..e612d1e2 100644 --- a/Applications/TextMate/src/Favorites.mm +++ b/Applications/TextMate/src/Favorites.mm @@ -118,7 +118,7 @@ static NSUInteger const kOakSourceIndexFavorites = 1; if(!res) { NSButton* removeButton = [NSButton new]; - [[removeButton cell] setControlSize:NSSmallControlSize]; + [[removeButton cell] setControlSize:NSControlSizeSmall]; removeButton.refusesFirstResponder = YES; removeButton.bezelStyle = NSRoundRectBezelStyle; removeButton.buttonType = NSMomentaryPushInButton; diff --git a/Applications/TextMate/src/main.mm b/Applications/TextMate/src/main.mm index b1f4b36e..559de0b2 100644 --- a/Applications/TextMate/src/main.mm +++ b/Applications/TextMate/src/main.mm @@ -23,7 +23,7 @@ static void sig_term_handler (void* unused) [DocumentWindowController saveSessionIncludingUntitledDocuments:YES]; [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillTerminateNotification object:NSApp]; [NSApp stop:nil]; - [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 context:NULL subtype:0 data1:0 data2:0] atStart:NO]; + [NSApp postEvent:[NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 context:NULL subtype:0 data1:0 data2:0] atStart:NO]; [[NSUserDefaults standardUserDefaults] synchronize]; } diff --git a/Frameworks/CommitWindow/src/CWTableCellView.mm b/Frameworks/CommitWindow/src/CWTableCellView.mm index 5675150f..822d3f58 100644 --- a/Frameworks/CommitWindow/src/CWTableCellView.mm +++ b/Frameworks/CommitWindow/src/CWTableCellView.mm @@ -11,7 +11,7 @@ self.textField = textField; NSButton* commitCheckBox = OakCreateCheckBox(@""); - [commitCheckBox.cell setControlSize:NSSmallControlSize]; + [commitCheckBox.cell setControlSize:NSControlSizeSmall]; _commitCheckBox = commitCheckBox; NSTextField* statusTextField = OakCreateLabel(); @@ -19,7 +19,7 @@ NSButton* diffButton = OakCreateButton(@"Diff", NSRoundedBezelStyle); diffButton.font = [NSFont messageFontOfSize:9]; - [diffButton.cell setControlSize: NSMiniControlSize]; + [diffButton.cell setControlSize: NSControlSizeMini]; _diffButton = diffButton; [textField bind:NSValueBinding toObject:self withKeyPath:@"objectValue.path" options:0]; diff --git a/Frameworks/CommitWindow/src/CommitWindow.mm b/Frameworks/CommitWindow/src/CommitWindow.mm index 0985cd1c..e7f834bb 100644 --- a/Frameworks/CommitWindow/src/CommitWindow.mm +++ b/Frameworks/CommitWindow/src/CommitWindow.mm @@ -146,20 +146,20 @@ static void* kOakCommitWindowIncludeItemBinding = &kOakCommitWindowIncludeItemBi [CWStatusStringTransformer register]; - self.window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 600, 350) styleMask:NSTitledWindowMask|NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO]; + self.window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 600, 350) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]; self.window.delegate = self; self.window.frameAutosaveName = @"Commit Window"; _commitButton = OakCreateButton([self commitButtonTitle], NSRoundedBezelStyle); _commitButton.action = @selector(performCommit:); _commitButton.keyEquivalent = @"\r"; - _commitButton.keyEquivalentModifierMask = NSCommandKeyMask; + _commitButton.keyEquivalentModifierMask = NSEventModifierFlagCommand; _commitButton.target = self; _cancelButton = OakCreateButton(@"Cancel", NSRoundedBezelStyle); _cancelButton.action = @selector(cancel:); _cancelButton.keyEquivalent = @"."; - _cancelButton.keyEquivalentModifierMask = NSCommandKeyMask; + _cancelButton.keyEquivalentModifierMask = NSEventModifierFlagCommand; _cancelButton.target = self; _showTableButton = [[NSButton alloc] initWithFrame:NSZeroRect]; @@ -207,19 +207,19 @@ static void* kOakCommitWindowIncludeItemBinding = &kOakCommitWindowIncludeItemBi if(self.showContinueSuffix) { __weak auto wealf = self; - _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^NSEvent*(NSEvent* event){ + _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskFlagsChanged handler:^NSEvent*(NSEvent* event){ if(![wealf.window isKeyWindow]) return event; - if([event modifierFlags] & NSAlternateKeyMask) + if([event modifierFlags] & NSEventModifierFlagOption) { - wealf.commitButton.keyEquivalentModifierMask |= NSAlternateKeyMask; + wealf.commitButton.keyEquivalentModifierMask |= NSEventModifierFlagOption; wealf.commitButton.action = @selector(performCommit:); wealf.showContinueSuffix = NO; } else { - wealf.commitButton.keyEquivalentModifierMask &= ~NSAlternateKeyMask; + wealf.commitButton.keyEquivalentModifierMask &= ~NSEventModifierFlagOption; wealf.commitButton.action = @selector(performCommitAndContinue:); wealf.showContinueSuffix = YES; } diff --git a/Frameworks/DocumentWindow/src/DocumentWindowController.mm b/Frameworks/DocumentWindow/src/DocumentWindowController.mm index 8e2fa20f..e4b9343a 100644 --- a/Frameworks/DocumentWindow/src/DocumentWindowController.mm +++ b/Frameworks/DocumentWindow/src/DocumentWindowController.mm @@ -203,7 +203,7 @@ static NSArray* const kObservedKeyPaths = @[ @"arrayController.arrangedObjects.p self.layoutView.tabBarView = self.tabBarView; self.layoutView.documentView = self.documentView; - NSUInteger windowStyle = (NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask|NSTexturedBackgroundWindowMask); + NSUInteger windowStyle = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskTexturedBackground); self.window = [[NSWindow alloc] initWithContentRect:[NSWindow contentRectForFrameRect:[self frameRectForNewWindow] styleMask:windowStyle] styleMask:windowStyle backing:NSBackingStoreBuffered defer:NO]; self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary; self.window.delegate = self; @@ -278,7 +278,7 @@ static NSArray* const kObservedKeyPaths = @[ @"arrayController.arrangedObjects.p std::map ourWindows; for(NSWindow* win in [NSApp windows]) { - if([win isVisible] && [win isOnActiveSpace] && ![win isZoomed] && (([win styleMask] & NSFullScreenWindowMask)) != NSFullScreenWindowMask && [[win delegate] isKindOfClass:[self class]]) + if([win isVisible] && [win isOnActiveSpace] && ![win isZoomed] && (([win styleMask] & NSWindowStyleMaskFullScreen)) != NSWindowStyleMaskFullScreen && [[win delegate] isKindOfClass:[self class]]) ourWindows.emplace(NSMaxY([win frame]), win); } @@ -321,7 +321,7 @@ static NSArray* const kObservedKeyPaths = @[ @"arrayController.arrangedObjects.p - (void)windowWillClose:(NSNotification*)aNotification { - if((([self.window styleMask] & NSFullScreenWindowMask) != NSFullScreenWindowMask) && !self.window.isZoomed) + if((([self.window styleMask] & NSWindowStyleMaskFullScreen) != NSWindowStyleMaskFullScreen) && !self.window.isZoomed) [[NSUserDefaults standardUserDefaults] setObject:NSStringFromRect([self windowFrame]) forKey:@"DocumentControllerWindowFrame"]; [_arrayController unbind:NSContentBinding]; @@ -1786,7 +1786,7 @@ static NSArray* const kObservedKeyPaths = @[ @"arrayController.arrangedObjects.p [self revealFileInProject:self]; } - if(!self.disableFileBrowserWindowResize && ([self.window styleMask] & NSFullScreenWindowMask) != NSFullScreenWindowMask) + if(!self.disableFileBrowserWindowResize && ([self.window styleMask] & NSWindowStyleMaskFullScreen) != NSWindowStyleMaskFullScreen) { NSRect windowFrame = self.window.frame; @@ -2397,7 +2397,7 @@ static NSTouchBarItemIdentifier kTouchBarFavoritesItemIdentifier = @"com.macroma - (BOOL)previewPanel:(QLPreviewPanel*)panel handleEvent:(NSEvent*)event { - if([event type] == NSKeyDown) + if([event type] == NSEventTypeKeyDown) { [self.fileBrowser.outlineView keyDown:event]; NSArray* newSelection = self.fileBrowser.selectedURLs; @@ -2567,7 +2567,7 @@ static NSUInteger DisableSessionSavingCount = 0; if(NSDictionary* history = self.fileBrowserHistory) res[@"fileBrowserState"] = history; - if(([self.window styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask) + if(([self.window styleMask] & NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen) res[@"fullScreen"] = @YES; else if(self.window.isZoomed) res[@"zoomed"] = @YES; diff --git a/Frameworks/DocumentWindow/src/OakRunCommandWindowController.mm b/Frameworks/DocumentWindow/src/OakRunCommandWindowController.mm index 1fbc5853..ab96f74e 100644 --- a/Frameworks/DocumentWindow/src/OakRunCommandWindowController.mm +++ b/Frameworks/DocumentWindow/src/OakRunCommandWindowController.mm @@ -32,14 +32,14 @@ static NSString* const kUserDefaultsFilterOutputType = @"filterOutputType"; - (id)init { - if((self = [super initWithWindow:[[NSPanel alloc] initWithContentRect:NSZeroRect styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO]])) + if((self = [super initWithWindow:[[NSPanel alloc] initWithContentRect:NSZeroRect styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]])) { self.outputType = output::replace_input; self.myConstraints = [NSMutableArray new]; - self.commandLabel = OakCreateLabel(@"Command:", nil, NSRightTextAlignment); + self.commandLabel = OakCreateLabel(@"Command:", nil, NSTextAlignmentRight); self.commandComboBox = OakCreateComboBox(); - self.resultLabel = OakCreateLabel(@"Result:", nil, NSRightTextAlignment); + self.resultLabel = OakCreateLabel(@"Result:", nil, NSTextAlignmentRight); self.resultPopUpButton = OakCreatePopUpButton(); self.executeButton = OakCreateButton(@"Execute"); self.cancelButton = OakCreateButton(@"Cancel"); diff --git a/Frameworks/DocumentWindow/src/ProjectLayoutView.mm b/Frameworks/DocumentWindow/src/ProjectLayoutView.mm index 330713ac..aa837a8c 100644 --- a/Frameworks/DocumentWindow/src/ProjectLayoutView.mm +++ b/Frameworks/DocumentWindow/src/ProjectLayoutView.mm @@ -315,7 +315,7 @@ NSString* const kUserDefaultsHTMLOutputSizeKey = @"htmlOutputSize"; else if(NSMouseInRect(mouseDownPos, [self htmlOutputResizeRect], [self isFlipped])) view = _htmlOutputView; - if(!view || [anEvent type] != NSLeftMouseDown) + if(!view || [anEvent type] != NSEventTypeLeftMouseDown) { [super mouseDown:anEvent]; } @@ -339,10 +339,10 @@ NSString* const kUserDefaultsHTMLOutputSizeKey = @"htmlOutputSize"; NSRect initialFrame = view.frame; BOOL didDrag = NO; - while([anEvent type] != NSLeftMouseUp) + while([anEvent type] != NSEventTypeLeftMouseUp) { - anEvent = [NSApp nextEventMatchingMask:(NSLeftMouseDraggedMask|NSLeftMouseDownMask|NSLeftMouseUpMask) untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; - if([anEvent type] != NSLeftMouseDragged) + anEvent = [NSApp nextEventMatchingMask:(NSEventMaskLeftMouseDragged|NSEventMaskLeftMouseDown|NSEventMaskLeftMouseUp) untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; + if([anEvent type] != NSEventTypeLeftMouseDragged) break; NSPoint mouseCurrentPos = [self convertPoint:[anEvent locationInWindow] fromView:nil]; diff --git a/Frameworks/DocumentWindow/src/SelectGrammarViewController.mm b/Frameworks/DocumentWindow/src/SelectGrammarViewController.mm index 6eb26477..dd9d50e0 100644 --- a/Frameworks/DocumentWindow/src/SelectGrammarViewController.mm +++ b/Frameworks/DocumentWindow/src/SelectGrammarViewController.mm @@ -29,7 +29,7 @@ static NSButton* OakSmallButton (NSString* title, SEL action, id target, NSInteg NSButton* res = OakCreateButton(title); [res setContentCompressionResistancePriority:NSLayoutPriorityRequired forOrientation:NSLayoutConstraintOrientationHorizontal]; res.font = [NSFont messageFontOfSize:[NSFont smallSystemFontSize]]; - res.cell.controlSize = NSSmallControlSize; + res.cell.controlSize = NSControlSizeSmall; res.action = action; res.target = target; res.tag = tag; @@ -68,7 +68,7 @@ static NSButton* OakSmallButton (NSString* title, SEL action, id target, NSInteg [_label setContentCompressionResistancePriority:NSLayoutPriorityDefaultLow forOrientation:NSLayoutConstraintOrientationHorizontal]; _progressIndicator = [NSProgressIndicator new]; - _progressIndicator.controlSize = NSSmallControlSize; + _progressIndicator.controlSize = NSControlSizeSmall; _progressIndicator.maxValue = 1; _progressIndicator.indeterminate = YES; _progressIndicator.displayedWhenStopped = NO; @@ -95,10 +95,10 @@ static NSButton* OakSmallButton (NSString* title, SEL action, id target, NSInteg self.neverButton.hidden = YES; - _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^NSEvent*(NSEvent* event){ - NSUInteger modifierFlags = [self.view.window isKeyWindow] ? ([event modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) : 0; - self.neverButton.hidden = modifierFlags != NSAlternateKeyMask; - self.notNowButton.hidden = modifierFlags == NSAlternateKeyMask; + _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskFlagsChanged handler:^NSEvent*(NSEvent* event){ + NSUInteger modifierFlags = [self.view.window isKeyWindow] ? ([event modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)) : 0; + self.neverButton.hidden = modifierFlags != NSEventModifierFlagOption; + self.notNowButton.hidden = modifierFlags == NSEventModifierFlagOption; return event; }]; } diff --git a/Frameworks/Find/src/FFResultsViewController.mm b/Frameworks/Find/src/FFResultsViewController.mm index 684b38b5..af8aa1af 100644 --- a/Frameworks/Find/src/FFResultsViewController.mm +++ b/Frameworks/Find/src/FFResultsViewController.mm @@ -48,7 +48,7 @@ static FFResultNode* PreviousNode (FFResultNode* node) - (id)initWithFrame:(NSRect)aFrame { NSButton* button = OakCreateCheckBox(nil); - [[button cell] setControlSize:NSSmallControlSize]; + [[button cell] setControlSize:NSControlSizeSmall]; [button sizeToFit]; [button setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; @@ -183,13 +183,13 @@ static FFResultNode* PreviousNode (FFResultNode* node) NSButton* countOfLeafs = [NSButton new]; [[countOfLeafs cell] setHighlightsBy:NSNoCellMask]; - countOfLeafs.alignment = NSCenterTextAlignment; + countOfLeafs.alignment = NSTextAlignmentCenter; countOfLeafs.bezelStyle = NSInlineBezelStyle; countOfLeafs.font = [NSFont labelFontOfSize:0]; countOfLeafs.identifier = @"countOfLeafs"; NSButton* remove = [NSButton new]; - [[remove cell] setControlSize:NSSmallControlSize]; + [[remove cell] setControlSize:NSControlSizeSmall]; remove.bezelStyle = NSRoundRectBezelStyle; remove.buttonType = NSMomentaryPushInButton; remove.image = [NSImage imageNamed:NSImageNameRemoveTemplate]; @@ -251,7 +251,7 @@ static FFResultNode* PreviousNode (FFResultNode* node) [path stroke]; NSMutableParagraphStyle* pStyle = [NSMutableParagraphStyle new]; - [pStyle setAlignment:NSCenterTextAlignment]; + [pStyle setAlignment:NSTextAlignmentCenter]; NSDictionary* attributes = @{ NSFontAttributeName : [NSFont boldSystemFontOfSize:0], NSForegroundColorAttributeName : color, @@ -352,17 +352,17 @@ static FFResultNode* PreviousNode (FFResultNode* node) _outlineView.action = @selector(didSingleClick:); _outlineView.doubleAction = @selector(didDoubleClick:); - _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^NSEvent*(NSEvent* event){ - NSUInteger modifierFlags = [_outlineView.window isKeyWindow] ? ([event modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) : 0; + _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskFlagsChanged handler:^NSEvent*(NSEvent* event){ + NSUInteger modifierFlags = [_outlineView.window isKeyWindow] ? ([event modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)) : 0; if(_longPressedCommandModifier) { - self.showKeyEquivalent = modifierFlags == NSCommandKeyMask; + self.showKeyEquivalent = modifierFlags == NSEventModifierFlagCommand; if(modifierFlags == 0) _longPressedCommandModifier = NO; } else { - if(modifierFlags == NSCommandKeyMask) + if(modifierFlags == NSEventModifierFlagCommand) [self performSelector:@selector(delayedLongPressedCommandModifier:) withObject:self afterDelay:0.2]; else [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayedLongPressedCommandModifier:) object:self]; } diff --git a/Frameworks/Find/src/Find.mm b/Frameworks/Find/src/Find.mm index 192b4b87..1ea44b9a 100644 --- a/Frameworks/Find/src/Find.mm +++ b/Frameworks/Find/src/Find.mm @@ -296,7 +296,7 @@ NSString* const FFFindWasTriggeredByEnter = @"FFFindWasTriggeredByEnter"; case FindActionReplace: _findOperation = kFindOperationReplace; break; } - self.closeWindowOnSuccess = action == FindActionFindNext && [[NSApp currentEvent] type] == NSKeyDown && to_s([NSApp currentEvent]) == utf8::to_s(NSCarriageReturnCharacter); + self.closeWindowOnSuccess = action == FindActionFindNext && [[NSApp currentEvent] type] == NSEventTypeKeyDown && to_s([NSApp currentEvent]) == utf8::to_s(NSCarriageReturnCharacter); [OakPasteboard pasteboardWithName:NSFindPboard].auxiliaryOptionsForCurrent = nil; [NSApp sendAction:@selector(performFindOperation:) to:nil from:self]; } diff --git a/Frameworks/Find/src/FindWindowController.mm b/Frameworks/Find/src/FindWindowController.mm index ff435502..6aebb3fb 100644 --- a/Frameworks/Find/src/FindWindowController.mm +++ b/Frameworks/Find/src/FindWindowController.mm @@ -26,7 +26,7 @@ NSButton* OakCreateClickableStatusBar () { NSButton* res = [[NSButton alloc] initWithFrame:NSZeroRect]; [res.cell setLineBreakMode:NSLineBreakByTruncatingTail]; - res.alignment = NSLeftTextAlignment; + res.alignment = NSTextAlignmentLeft; res.bordered = NO; res.buttonType = NSToggleButton; res.title = @""; @@ -83,7 +83,7 @@ static NSProgressIndicator* OakCreateProgressIndicator () { NSProgressIndicator* res = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect]; res.style = NSProgressIndicatorSpinningStyle; - res.controlSize = NSSmallControlSize; + res.controlSize = NSControlSizeSmall; res.displayedWhenStopped = NO; return res; } @@ -97,7 +97,7 @@ static NSButton* OakCreateStopSearchButton () res.imagePosition = NSImageOnly; res.toolTip = @"Stop Search"; res.keyEquivalent = @"."; - res.keyEquivalentModifierMask = NSCommandKeyMask; + res.keyEquivalentModifierMask = NSEventModifierFlagCommand; [res.cell setImageScaling:NSImageScaleProportionallyDown]; OakSetAccessibilityLabel(res, res.toolTip); return res; @@ -159,7 +159,7 @@ static NSButton* OakCreateStopSearchButton () - (id)init { NSRect r = [[NSScreen mainScreen] visibleFrame]; - if((self = [super initWithWindow:[[NSPanel alloc] initWithContentRect:NSMakeRect(NSMidX(r)-100, NSMidY(r)+100, 200, 200) styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO]])) + if((self = [super initWithWindow:[[NSPanel alloc] initWithContentRect:NSMakeRect(NSMidX(r)-100, NSMidY(r)+100, 200, 200) styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]])) { _projectFolder = NSHomeDirectory(); @@ -224,7 +224,7 @@ static NSButton* OakCreateStopSearchButton () { @"Symbolic Links to Folders", @selector(toggleSearchFolderLinks:), .indent = 1 }, { @"Symbolic Links to Files", @selector(toggleSearchFileLinks:), .indent = 1 }, { /* -------- */ }, - { @"Collapse Results", @selector(toggleCollapsedState:), @"1", .modifierFlags = NSCommandKeyMask|NSAlternateKeyMask, .target = self.resultsViewController }, + { @"Collapse Results", @selector(toggleCollapsedState:), @"1", .modifierFlags = NSEventModifierFlagCommand|NSEventModifierFlagOption, .target = self.resultsViewController }, { @"Select Result", .delegate = self }, { /* -------- */ }, { @"Copy Matching Parts", @selector(copyMatchingParts:) }, diff --git a/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm b/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm index ec0811a1..8c47f1e3 100644 --- a/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm +++ b/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm @@ -64,14 +64,14 @@ static NSTextField* OakCreateTextField () [_statusTextField.cell setLineBreakMode:NSLineBreakByTruncatingMiddle]; _progressIndicator = [NSProgressIndicator new]; - _progressIndicator.controlSize = NSSmallControlSize; + _progressIndicator.controlSize = NSControlSizeSmall; _progressIndicator.maxValue = 1; _progressIndicator.indeterminate = NO; _progressIndicator.displayedWhenStopped = NO; _progressIndicator.bezeled = NO; _spinner = [NSProgressIndicator new]; - _spinner.controlSize = NSSmallControlSize; + _spinner.controlSize = NSControlSizeSmall; _spinner.style = NSProgressIndicatorSpinningStyle; _spinner.displayedWhenStopped = NO; diff --git a/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm b/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm index 90f78f65..cc08ae5f 100644 --- a/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm +++ b/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm @@ -83,7 +83,7 @@ static BOOL IsProtocolRelativeURL (NSURL* url) HOBrowserView* view = [HOBrowserView new]; NSWindow* window = [[NSWindow alloc] initWithContentRect:(NSRect){origin, NSMakeSize(750, 800)} - styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask) + styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]; [window bind:NSTitleBinding toObject:view.webView withKeyPath:@"mainFrameTitle" options:nil]; diff --git a/Frameworks/HTMLOutputWindow/src/HTMLOutputWindow.mm b/Frameworks/HTMLOutputWindow/src/HTMLOutputWindow.mm index df077ce4..d80bbd68 100644 --- a/Frameworks/HTMLOutputWindow/src/HTMLOutputWindow.mm +++ b/Frameworks/HTMLOutputWindow/src/HTMLOutputWindow.mm @@ -22,7 +22,7 @@ OAK_DEBUG_VAR(HTMLOutputWindow); NSRect rect = [[NSScreen mainScreen] visibleFrame]; rect = NSIntegralRect(NSInsetRect(rect, NSWidth(rect) / 3, NSHeight(rect) / 5)); - self.window = [[NSWindow alloc] initWithContentRect:rect styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO]; + self.window = [[NSWindow alloc] initWithContentRect:rect styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]; self.htmlOutputView = [[OakHTMLOutputView alloc] init]; [self.window bind:NSTitleBinding toObject:self.htmlOutputView withKeyPath:@"mainFrameTitle" options:nil]; diff --git a/Frameworks/MenuBuilder/src/DumpMenu.mm b/Frameworks/MenuBuilder/src/DumpMenu.mm index 4075908e..7ef229f3 100644 --- a/Frameworks/MenuBuilder/src/DumpMenu.mm +++ b/Frameworks/MenuBuilder/src/DumpMenu.mm @@ -71,10 +71,10 @@ static NSString* MBInternalDumpMenu (NSMenu* menu, NSInteger indent) NSUInteger flags = item.keyEquivalentModifierMask; BOOL includeFlags = YES; - if(flags == NSCommandKeyMask) + if(flags == NSEventModifierFlagCommand) includeFlags = NO; - if(flags == (NSShiftKeyMask|NSCommandKeyMask) && item.keyEquivalent.length == 1) + if(flags == (NSEventModifierFlagShift|NSEventModifierFlagCommand) && item.keyEquivalent.length == 1) { unichar ch = [item.keyEquivalent characterAtIndex:0]; if(ch < 0x80 && isalpha(ch)) diff --git a/Frameworks/OakAppKit/src/NSMenuItem Additions.mm b/Frameworks/OakAppKit/src/NSMenuItem Additions.mm index 86db9ee7..7b58c353 100644 --- a/Frameworks/OakAppKit/src/NSMenuItem Additions.mm +++ b/Frameworks/OakAppKit/src/NSMenuItem Additions.mm @@ -136,8 +136,8 @@ static char const* kOakMenuItemTabTrigger = "OakMenuItemTabTrigger"; [table setNumberOfColumns:2]; NSFont* font = self.menu.font ?: [NSFont menuFontOfSize:0]; - [attributedTitle appendTableCellWithString:self.title table:table textAlignment:NSLeftTextAlignment verticalAlignment:NSTextBlockMiddleAlignment font:font row:0 column:0]; - [attributedTitle appendTableCellWithString:anActivationString table:table textAlignment:NSRightTextAlignment verticalAlignment:aFont && aFont.pointSize >= 13 ? NSTextBlockBottomAlignment : NSTextBlockMiddleAlignment font:(aFont ?: font) row:0 column:1]; + [attributedTitle appendTableCellWithString:self.title table:table textAlignment:NSTextAlignmentLeft verticalAlignment:NSTextBlockMiddleAlignment font:font row:0 column:0]; + [attributedTitle appendTableCellWithString:anActivationString table:table textAlignment:NSTextAlignmentRight verticalAlignment:aFont && aFont.pointSize >= 13 ? NSTextBlockBottomAlignment : NSTextBlockMiddleAlignment font:(aFont ?: font) row:0 column:1]; NSString* plainTitle = self.title; self.attributedTitle = attributedTitle; @@ -175,11 +175,11 @@ static char const* kOakMenuItemTabTrigger = "OakMenuItemTabTrigger"; switch(aKeyEquivalent[i++]) { - case '$': modifiers |= NSShiftKeyMask; break; - case '^': modifiers |= NSControlKeyMask; break; - case '~': modifiers |= NSAlternateKeyMask; break; - case '@': modifiers |= NSCommandKeyMask; break; - case '#': modifiers |= NSNumericPadKeyMask; break; + case '$': modifiers |= NSEventModifierFlagShift; break; + case '^': modifiers |= NSEventModifierFlagControl; break; + case '~': modifiers |= NSEventModifierFlagOption; break; + case '@': modifiers |= NSEventModifierFlagCommand; break; + case '#': modifiers |= NSEventModifierFlagNumericPad; break; } } diff --git a/Frameworks/OakAppKit/src/OakAppKit.h b/Frameworks/OakAppKit/src/OakAppKit.h index fa021431..92e5ed3a 100644 --- a/Frameworks/OakAppKit/src/OakAppKit.h +++ b/Frameworks/OakAppKit/src/OakAppKit.h @@ -3,7 +3,7 @@ PUBLIC extern NSString* const OakCursorDidHideNotification; -PUBLIC BOOL OakIsAlternateKeyOrMouseEvent (NSUInteger flags = NSAlternateKeyMask, NSEvent* anEvent = [NSApp currentEvent]); +PUBLIC BOOL OakIsAlternateKeyOrMouseEvent (NSUInteger flags = NSEventModifierFlagOption, NSEvent* anEvent = [NSApp currentEvent]); PUBLIC extern NSUInteger const OakMoveMoveReturn; PUBLIC extern NSUInteger const OakMoveAcceptReturn; diff --git a/Frameworks/OakAppKit/src/OakAppKit.mm b/Frameworks/OakAppKit/src/OakAppKit.mm index aafc6fe5..e969bd65 100644 --- a/Frameworks/OakAppKit/src/OakAppKit.mm +++ b/Frameworks/OakAppKit/src/OakAppKit.mm @@ -25,7 +25,7 @@ void OakRunIOAlertPanel (char const* format, ...) BOOL OakIsAlternateKeyOrMouseEvent (NSUInteger flags, NSEvent* anEvent) { - return ([anEvent type] == NSLeftMouseUp || [anEvent type] == NSOtherMouseUp || [anEvent type] == NSKeyDown) && (([anEvent modifierFlags] & flags) == flags); + return ([anEvent type] == NSEventTypeLeftMouseUp || [anEvent type] == NSEventTypeOtherMouseUp || [anEvent type] == NSEventTypeKeyDown) && (([anEvent modifierFlags] & flags) == flags); } // ====================== diff --git a/Frameworks/OakAppKit/src/OakBorderlessPanel.mm b/Frameworks/OakAppKit/src/OakBorderlessPanel.mm index 1e207e8c..12681e29 100644 --- a/Frameworks/OakAppKit/src/OakBorderlessPanel.mm +++ b/Frameworks/OakAppKit/src/OakBorderlessPanel.mm @@ -3,8 +3,8 @@ @implementation OakBorderlessPanel - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag { - styleMask |= NSBorderlessWindowMask; - styleMask &= ~NSTitledWindowMask; + styleMask |= NSWindowStyleMaskBorderless; + styleMask &= ~NSWindowStyleMaskTitled; return [super initWithContentRect:contentRect styleMask:styleMask backing:backingType defer:flag]; } diff --git a/Frameworks/OakAppKit/src/OakFileIconImage.mm b/Frameworks/OakAppKit/src/OakFileIconImage.mm index 5fd28c08..aa3bb63e 100644 --- a/Frameworks/OakAppKit/src/OakFileIconImage.mm +++ b/Frameworks/OakAppKit/src/OakFileIconImage.mm @@ -218,17 +218,17 @@ enum { [buffer lockFocus]; } - NSCompositingOperation op = NSCompositeCopy; + NSCompositingOperation op = NSCompositingOperationCopy; for(NSImage* image in self.imageStack) { [image drawInRect:(NSRect){ NSZeroPoint, dstSize } fromRect:NSZeroRect operation:op fraction:1]; - op = NSCompositeSourceOver; + op = NSCompositingOperationSourceOver; } if(self.isModified) { [buffer unlockFocus]; - [buffer drawInRect:(NSRect){ NSZeroPoint, self.size } fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.4]; + [buffer drawInRect:(NSRect){ NSZeroPoint, self.size } fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.4]; } return YES; diff --git a/Frameworks/OakAppKit/src/OakFinderLabelChooser.mm b/Frameworks/OakAppKit/src/OakFinderLabelChooser.mm index 38bc6de9..7e6f6d62 100644 --- a/Frameworks/OakAppKit/src/OakFinderLabelChooser.mm +++ b/Frameworks/OakAppKit/src/OakFinderLabelChooser.mm @@ -164,7 +164,7 @@ static CGFloat const LabelNameHeight = 15; if(self.highlightedIndex != -1) { NSMutableParagraphStyle* style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - [style setAlignment:NSCenterTextAlignment]; + [style setAlignment:NSTextAlignmentCenter]; NSDictionary* attributes = @{ NSFontAttributeName : [[NSFontManager sharedFontManager] convertFont:[NSFont labelFontOfSize:0] toHaveTrait:NSBoldFontMask], NSForegroundColorAttributeName : [NSColor grayColor], diff --git a/Frameworks/OakAppKit/src/OakImage.mm b/Frameworks/OakAppKit/src/OakImage.mm index db66e9e8..ed0bea4a 100644 --- a/Frameworks/OakAppKit/src/OakImage.mm +++ b/Frameworks/OakAppKit/src/OakImage.mm @@ -35,8 +35,8 @@ CGFloat x = self.image.edge == CGRectMinXEdge || self.image.edge == CGRectMaxYEdge ? 0 : imageSize.width - badgeSize.width; CGFloat y = self.image.edge == CGRectMinXEdge || self.image.edge == CGRectMinYEdge ? 0 : imageSize.height - badgeSize.height; - [self.image.base drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:1]; - [self.image.badge drawAtPoint:NSMakePoint(x, y) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1]; + [self.image.base drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositingOperationCopy fraction:1]; + [self.image.badge drawAtPoint:NSMakePoint(x, y) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1]; return YES; } @end diff --git a/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm b/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm index 50bad48b..03b186e7 100644 --- a/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm +++ b/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm @@ -109,13 +109,13 @@ static NSString* const kRecordingPlaceholderString = @"…"; if(self.disableGlobalHotkeys) _hotkeyToken = PushSymbolicHotKeyMode(kHIHotKeyModeAllDisabled); - _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask|NSKeyDownMask handler:^NSEvent*(NSEvent* event){ - if([event type] == NSFlagsChanged) + _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskFlagsChanged|NSEventMaskKeyDown handler:^NSEvent*(NSEvent* event){ + if([event type] == NSEventTypeFlagsChanged) { std::string const str = ns::glyphs_for_flags([event modifierFlags]); self.displayString = str == "" ? kRecordingPlaceholderString : [NSString stringWithCxxString:str]; } - else if([event type] == NSKeyDown) + else if([event type] == NSEventTypeKeyDown) { self.eventString = [NSString stringWithCxxString:to_s(event)]; self.recording = NO; diff --git a/Frameworks/OakAppKit/src/OakPasteboardChooser.mm b/Frameworks/OakAppKit/src/OakPasteboardChooser.mm index 057f566a..0954a5b4 100644 --- a/Frameworks/OakAppKit/src/OakPasteboardChooser.mm +++ b/Frameworks/OakAppKit/src/OakPasteboardChooser.mm @@ -128,7 +128,7 @@ static NSMutableDictionary* SharedChoosers; _scrollView.borderType = NSNoBorder; _scrollView.documentView = _tableView; - _window = [[NSPanel alloc] initWithContentRect:NSMakeRect(600, 700, 400, 500) styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSTexturedBackgroundWindowMask) backing:NSBackingStoreBuffered defer:NO]; + _window = [[NSPanel alloc] initWithContentRect:NSMakeRect(600, 700, 400, 500) styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskTexturedBackground) backing:NSBackingStoreBuffered defer:NO]; [_window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; [_window setContentBorderThickness:32 forEdge:NSMaxYEdge]; [[_window standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES]; diff --git a/Frameworks/OakAppKit/src/OakPasteboardSelector.mm b/Frameworks/OakAppKit/src/OakPasteboardSelector.mm index 358b13d6..d6dad2bd 100644 --- a/Frameworks/OakAppKit/src/OakPasteboardSelector.mm +++ b/Frameworks/OakAppKit/src/OakPasteboardSelector.mm @@ -107,7 +107,7 @@ static size_t line_count (std::string const& text) NSString* moreLinesText = [NSString stringWithFormat:@"%lu more line%s", [lines count] - [clippedLines count], ([lines count] - [clippedLines count]) != 1 ? "s" : ""]; NSDictionary* moreLinesAttributes = @{ NSForegroundColorAttributeName : ([self isHighlighted] ? [NSColor whiteColor] : [NSColor lightGrayColor]), - NSFontAttributeName : [NSFont controlContentFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]], + NSFontAttributeName : [NSFont controlContentFontOfSize:[NSFont systemFontSizeForControlSize:NSControlSizeSmall]], }; NSAttributedString* moreLines = [[NSAttributedString alloc] initWithString:moreLinesText attributes:moreLinesAttributes]; NSSize size = [moreLines size]; @@ -311,13 +311,13 @@ static size_t line_count (std::string const& text) [window orderFront:self]; [tableView scrollRowToVisible:tableView.selectedRow]; - while(NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]) + while(NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]) { - static std::set const keyEvent = { NSKeyDown, NSKeyUp }; - static std::set const mouseEvent = { NSLeftMouseDown, NSLeftMouseUp, NSRightMouseDown, NSRightMouseUp, NSOtherMouseDown, NSOtherMouseUp }; + static std::set const keyEvent = { NSEventTypeKeyDown, NSEventTypeKeyUp }; + static std::set const mouseEvent = { NSEventTypeLeftMouseDown, NSEventTypeLeftMouseUp, NSEventTypeRightMouseDown, NSEventTypeRightMouseUp, NSEventTypeOtherMouseDown, NSEventTypeOtherMouseUp }; bool orderOutEvent = (keyEvent.find([event type]) != keyEvent.end() && [event window] != parentWindow) || (mouseEvent.find([event type]) != mouseEvent.end() && [event window] != window); - if(!orderOutEvent && keyEvent.find([event type]) != keyEvent.end() && !([event modifierFlags] & NSCommandKeyMask)) + if(!orderOutEvent && keyEvent.find([event type]) != keyEvent.end() && !([event modifierFlags] & NSEventModifierFlagCommand)) [window sendEvent:event]; else [NSApp sendEvent:event]; diff --git a/Frameworks/OakAppKit/src/OakPopOutAnimation.mm b/Frameworks/OakAppKit/src/OakPopOutAnimation.mm index 35c88d35..2052c136 100644 --- a/Frameworks/OakAppKit/src/OakPopOutAnimation.mm +++ b/Frameworks/OakAppKit/src/OakPopOutAnimation.mm @@ -48,7 +48,7 @@ void OakShowPopOutAnimation (NSView* parentView, NSRect popOutRect, NSImage* anI windowRect.size.width += 2 * extraWidth; windowRect.size.height += 2 * extraHeight; - NSWindow* window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + NSWindow* window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]; CFRetain((CFTypeRef)window); // isReleasedWhenClosed == YES [window setBackgroundColor:[NSColor clearColor]]; [window setExcludedFromWindowsMenu:YES]; @@ -61,7 +61,7 @@ void OakShowPopOutAnimation (NSView* parentView, NSRect popOutRect, NSImage* anI [anImage lockFocus]; [[NSColor blackColor] set]; - NSRectFillUsingOperation((NSRect){ NSZeroPoint, [anImage size] }, NSCompositeSourceAtop); + NSRectFillUsingOperation((NSRect){ NSZeroPoint, [anImage size] }, NSCompositingOperationSourceAtop); [anImage unlockFocus]; aView.contentImage = anImage; diff --git a/Frameworks/OakAppKit/src/OakRolloverButton.mm b/Frameworks/OakAppKit/src/OakRolloverButton.mm index a043f25c..36f669a0 100644 --- a/Frameworks/OakAppKit/src/OakRolloverButton.mm +++ b/Frameworks/OakAppKit/src/OakRolloverButton.mm @@ -120,12 +120,12 @@ typedef NS_ENUM(NSUInteger, OakImageState) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidChangeMainOrKey:) name:NSWindowDidResignKeyNotification object:newWindow]; } - self.active = ([newWindow styleMask] & NSFullScreenWindowMask) || [newWindow isMainWindow] || [newWindow isKeyWindow]; + self.active = ([newWindow styleMask] & NSWindowStyleMaskFullScreen) || [newWindow isMainWindow] || [newWindow isKeyWindow]; } - (void)windowDidChangeMainOrKey:(NSNotification*)aNotification { - self.active = ([self.window styleMask] & NSFullScreenWindowMask) || [self.window isMainWindow] || [self.window isKeyWindow]; + self.active = ([self.window styleMask] & NSWindowStyleMaskFullScreen) || [self.window isMainWindow] || [self.window isKeyWindow]; } - (void)updateTrackingAreas diff --git a/Frameworks/OakAppKit/src/OakScopeBarView.mm b/Frameworks/OakAppKit/src/OakScopeBarView.mm index ee5c71a4..edb0d15d 100644 --- a/Frameworks/OakAppKit/src/OakScopeBarView.mm +++ b/Frameworks/OakAppKit/src/OakScopeBarView.mm @@ -5,7 +5,7 @@ static NSButton* OakCreateScopeButton (NSString* label, NSUInteger tag, SEL acti { NSButton* res = [NSButton new]; [[res cell] setBackgroundStyle:NSBackgroundStyleRaised]; - [[res cell] setControlSize:NSSmallControlSize]; + [[res cell] setControlSize:NSControlSizeSmall]; NSString* accessibilityRole = NSAccessibilityRadioButtonRole; [[res cell] accessibilitySetOverrideValue:accessibilityRole forAttribute:NSAccessibilityRoleAttribute]; [[res cell] accessibilitySetOverrideValue:NSAccessibilityRoleDescription(accessibilityRole, nil) forAttribute:NSAccessibilityRoleDescriptionAttribute]; diff --git a/Frameworks/OakAppKit/src/OakToolTip.mm b/Frameworks/OakAppKit/src/OakToolTip.mm index 346fb666..d9a3b460 100644 --- a/Frameworks/OakAppKit/src/OakToolTip.mm +++ b/Frameworks/OakAppKit/src/OakToolTip.mm @@ -33,7 +33,7 @@ static __weak OakToolTip* LastToolTip; - (id)init { D(DBF_OakToolTip, bug("\n");); - if(self = [super initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) + if(self = [super initWithContentRect:NSZeroRect styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]) { NSFont* defaultFont = [NSFont toolTipsFontOfSize:0]; NSFontDescriptor* descriptor = [defaultFont.fontDescriptor fontDescriptorByAddingAttributes:@{ @@ -110,11 +110,11 @@ static __weak OakToolTip* LastToolTip; didOpenAtDate = [NSDate date]; mousePositionWhenOpened = NSZeroPoint; - __weak __block id eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:(NSLeftMouseDownMask|NSRightMouseDownMask|NSMouseMovedMask|NSKeyDownMask|NSScrollWheelMask|NSOtherMouseDownMask) handler:^NSEvent*(NSEvent* event){ - if([event type] == NSMouseMoved && ![self shouldCloseForMousePosition:[NSEvent mouseLocation]]) + __weak __block id eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:(NSEventMaskLeftMouseDown|NSEventMaskRightMouseDown|NSEventMaskMouseMoved|NSEventMaskKeyDown|NSEventMaskScrollWheel|NSEventMaskOtherMouseDown) handler:^NSEvent*(NSEvent* event){ + if([event type] == NSEventTypeMouseMoved && ![self shouldCloseForMousePosition:[NSEvent mouseLocation]]) return event; - [self fadeOutSlowly:[event type] == NSMouseMoved]; + [self fadeOutSlowly:[event type] == NSEventTypeMouseMoved]; [NSEvent removeMonitor:eventMonitor]; return event; }]; diff --git a/Frameworks/OakAppKit/src/OakUIConstructionFunctions.h b/Frameworks/OakAppKit/src/OakUIConstructionFunctions.h index f31b1afe..60b9e935 100644 --- a/Frameworks/OakAppKit/src/OakUIConstructionFunctions.h +++ b/Frameworks/OakAppKit/src/OakUIConstructionFunctions.h @@ -16,7 +16,7 @@ PUBLIC @interface OakBackgroundFillView : NSView PUBLIC NSFont* OakStatusBarFont (); PUBLIC NSFont* OakControlFont (); -PUBLIC NSTextField* OakCreateLabel (NSString* label = @"", NSFont* font = nil, NSTextAlignment alignment = NSLeftTextAlignment, NSLineBreakMode lineBreakMode = NSLineBreakByTruncatingMiddle); +PUBLIC NSTextField* OakCreateLabel (NSString* label = @"", NSFont* font = nil, NSTextAlignment alignment = NSTextAlignmentLeft, NSLineBreakMode lineBreakMode = NSLineBreakByTruncatingMiddle); PUBLIC NSButton* OakCreateCheckBox (NSString* label); PUBLIC NSButton* OakCreateButton (NSString* label, NSBezelStyle bezel = NSRoundedBezelStyle); PUBLIC NSPopUpButton* OakCreatePopUpButton (BOOL pullsDown = NO, NSString* initialItemTitle = nil, NSObject* accessibilityLabel = nil); diff --git a/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm b/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm index c94b908b..a3e7199c 100644 --- a/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm +++ b/Frameworks/OakAppKit/src/OakUIConstructionFunctions.mm @@ -146,12 +146,12 @@ OakRolloverButton* OakCreateCloseButton (NSString* accessibilityLabel) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidChangeMainOrKey:) name:NSWindowDidResignKeyNotification object:newWindow]; } - self.active = ([newWindow styleMask] & NSFullScreenWindowMask) || [newWindow isMainWindow] || [newWindow isKeyWindow]; + self.active = ([newWindow styleMask] & NSWindowStyleMaskFullScreen) || [newWindow isMainWindow] || [newWindow isKeyWindow]; } - (void)windowDidChangeMainOrKey:(NSNotification*)aNotification { - self.active = ([self.window styleMask] & NSFullScreenWindowMask) || [self.window isMainWindow] || [self.window isKeyWindow]; + self.active = ([self.window styleMask] & NSWindowStyleMaskFullScreen) || [self.window isMainWindow] || [self.window isKeyWindow]; } - (void)setActive:(BOOL)flag @@ -216,7 +216,7 @@ OakRolloverButton* OakCreateCloseButton (NSString* accessibilityLabel) CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; CGAffineTransform affineTransform = CGContextGetCTM(context); CGContextSetPatternPhase(context, CGSizeMake(affineTransform.tx, affineTransform.ty)); - NSRectFillUsingOperation(aRect, NSCompositeSourceOver); + NSRectFillUsingOperation(aRect, NSCompositingOperationSourceOver); } else if([value isKindOfClass:[NSColor class]]) { diff --git a/Frameworks/OakAppKit/src/OakZoomingIcon.mm b/Frameworks/OakAppKit/src/OakZoomingIcon.mm index 3d23b5e7..d9f74e9e 100644 --- a/Frameworks/OakAppKit/src/OakZoomingIcon.mm +++ b/Frameworks/OakAppKit/src/OakZoomingIcon.mm @@ -9,7 +9,7 @@ @implementation OakZoomingIcon - (id)initWithIcon:(NSImage*)icon rect:(NSRect)aRect { - if(self = [super initWithContentRect:aRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) + if(self = [super initWithContentRect:aRect styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]) { self.releasedWhenClosed = NO; self.ignoresMouseEvents = YES; @@ -29,7 +29,7 @@ [NSAnimationContext beginGrouping]; - [NSAnimationContext currentContext].duration = ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) ? 2.5 : 0.25; + [NSAnimationContext currentContext].duration = ([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagShift) ? 2.5 : 0.25; [NSAnimationContext currentContext].completionHandler = ^{ [self orderOut:self]; }; diff --git a/Frameworks/OakCommand/src/OakCommand.mm b/Frameworks/OakCommand/src/OakCommand.mm index 8ba8d90d..7292cc58 100644 --- a/Frameworks/OakCommand/src/OakCommand.mm +++ b/Frameworks/OakCommand/src/OakCommand.mm @@ -472,7 +472,7 @@ static pid_t run_command (dispatch_group_t rootGroup, std::string const& cmd, in // Wake potential event loop didTerminate = YES; - [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 context:NULL subtype:0 data1:0 data2:0] atStart:NO]; + [NSApp postEvent:[NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 context:NULL subtype:0 data1:0 data2:0] atStart:NO]; [[NSNotificationCenter defaultCenter] postNotificationName:OakCommandDidTerminateNotification object:self]; }); diff --git a/Frameworks/OakFileBrowser/src/OakFileBrowser.mm b/Frameworks/OakFileBrowser/src/OakFileBrowser.mm index a0e7a034..36c0cf96 100644 --- a/Frameworks/OakFileBrowser/src/OakFileBrowser.mm +++ b/Frameworks/OakFileBrowser/src/OakFileBrowser.mm @@ -545,7 +545,7 @@ static bool is_binary (std::string const& path) NSIndexSet* indexSet = [_outlineView selectedRowIndexes]; NSEvent* currentEvent = [NSApp currentEvent]; - if(currentEvent.type != NSKeyDown && currentEvent.type != NSKeyUp) + if(currentEvent.type != NSEventTypeKeyDown && currentEvent.type != NSEventTypeKeyUp) { NSInteger clickedRow = [_outlineView clickedRow]; if(0 <= clickedRow && clickedRow < _outlineView.numberOfRows && ![indexSet containsIndex:clickedRow]) @@ -879,8 +879,8 @@ static bool is_binary (std::string const& path) if(rootPath) { [aMenu addItem:[NSMenuItem separatorItem]]; - [[aMenu addItemWithTitle:@"New File" action:@selector(newDocumentInDirectory:) keyEquivalent:@"n"] setKeyEquivalentModifierMask:NSCommandKeyMask|NSControlKeyMask]; - [[aMenu addItemWithTitle:@"New Folder" action:@selector(newFolder:) keyEquivalent:@"n"] setKeyEquivalentModifierMask:NSCommandKeyMask|NSShiftKeyMask]; + [[aMenu addItemWithTitle:@"New File" action:@selector(newDocumentInDirectory:) keyEquivalent:@"n"] setKeyEquivalentModifierMask:NSEventModifierFlagCommand|NSEventModifierFlagControl]; + [[aMenu addItemWithTitle:@"New Folder" action:@selector(newFolder:) keyEquivalent:@"n"] setKeyEquivalentModifierMask:NSEventModifierFlagCommand|NSEventModifierFlagShift]; } if(rootPath || hasFileSelected) @@ -934,7 +934,7 @@ static bool is_binary (std::string const& path) [aMenu addItemWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@""]; NSMenuItem* copyPathnameItem = [aMenu addItemWithTitle:@"Copy As Pathname" action:@selector(copyAsPathname:) keyEquivalent:@""]; - copyPathnameItem.keyEquivalentModifierMask = NSAlternateKeyMask; + copyPathnameItem.keyEquivalentModifierMask = NSEventModifierFlagOption; copyPathnameItem.alternate = YES; } @@ -945,7 +945,7 @@ static bool is_binary (std::string const& path) [aMenu addItemWithTitle:[NSString stringWithFormat:@"Paste %@", label] action:@selector(paste:) keyEquivalent:@""]; NSMenuItem* menuItem = [aMenu addItemWithTitle:[NSString stringWithFormat:@"Move %@ Here", label] action:@selector(pasteNext:) keyEquivalent:@"v"]; - [menuItem setKeyEquivalentModifierMask:NSAlternateKeyMask|NSCommandKeyMask]; + [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagOption|NSEventModifierFlagCommand]; } } @@ -1024,7 +1024,7 @@ static bool is_binary (std::string const& path) { if(FSItem* item = [_outlineView itemAtRow:row]) { - if([item.url isFileURL] && ([NSEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSCommandKeyMask)) == NSCommandKeyMask) + if([item.url isFileURL] && ([NSEvent modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagCommand)) == NSEventModifierFlagCommand) [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[ item.url ]]; else [self openItems:@[ item ] animate:YES]; } @@ -1104,7 +1104,7 @@ static bool is_binary (std::string const& path) - (IBAction)didSingleClickOutlineView:(id)sender { BOOL singleClickShouldOpen = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsFileBrowserSingleClickToOpenKey]; - BOOL noModifiers = !([NSEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSCommandKeyMask)); + BOOL noModifiers = !([NSEvent modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagCommand)); FSItem* item = _outlineView.clickedRow != -1 ? [_outlineView itemAtRow:_outlineView.clickedRow] : nil; if(singleClickShouldOpen && noModifiers && item.urlType == FSItemURLTypeFile) [self openItems:@[ item ] animate:NO]; diff --git a/Frameworks/OakFileBrowser/src/io/FSDataSource.mm b/Frameworks/OakFileBrowser/src/io/FSDataSource.mm index 1473c8b7..fb663a23 100644 --- a/Frameworks/OakFileBrowser/src/io/FSDataSource.mm +++ b/Frameworks/OakFileBrowser/src/io/FSDataSource.mm @@ -166,8 +166,8 @@ FSDataSource* DataSourceForURL (NSURL* anURL, NSUInteger someOptions) NSString* dropPath = [(item ?: self.rootItem).url path]; dev_t targetDevice = path::device([dropPath fileSystemRepresentation]); - BOOL linkOperation = ([[NSApp currentEvent] modifierFlags] & NSControlKeyMask) == NSControlKeyMask; - BOOL toggleOperation = ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask; + BOOL linkOperation = ([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagControl) == NSEventModifierFlagControl; + BOOL toggleOperation = ([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagOption) == NSEventModifierFlagOption; // We accept the drop as long as long as it is valid for at least one of the items for(NSString* aPath in draggedPaths) diff --git a/Frameworks/OakFileBrowser/src/ui/OFBOutlineView.mm b/Frameworks/OakFileBrowser/src/ui/OFBOutlineView.mm index 7bdfb503..f8d88c1c 100644 --- a/Frameworks/OakFileBrowser/src/ui/OFBOutlineView.mm +++ b/Frameworks/OakFileBrowser/src/ui/OFBOutlineView.mm @@ -115,7 +115,7 @@ NSWindow* win = [self window]; NSEvent* anEvent = [NSApp currentEvent]; NSEvent* fakeEvent = [NSEvent - mouseEventWithType:NSLeftMouseDown + mouseEventWithType:NSEventTypeLeftMouseDown location:pos modifierFlags:0 timestamp:[anEvent timestamp] diff --git a/Frameworks/OakFilterList/src/BundleItemChooser.mm b/Frameworks/OakFilterList/src/BundleItemChooser.mm index f02aca8c..69489cca 100644 --- a/Frameworks/OakFilterList/src/BundleItemChooser.mm +++ b/Frameworks/OakFilterList/src/BundleItemChooser.mm @@ -172,22 +172,22 @@ static std::string key_equivalent_for_menu_item (NSMenuItem* menuItem) static struct { NSUInteger flag; std::string symbol; } const EventFlags[] = { - { NSNumericPadKeyMask, "#" }, - { NSControlKeyMask, "^" }, - { NSAlternateKeyMask, "~" }, - { NSShiftKeyMask, "$" }, - { NSCommandKeyMask, "@" }, + { NSEventModifierFlagNumericPad, "#" }, + { NSEventModifierFlagControl, "^" }, + { NSEventModifierFlagOption, "~" }, + { NSEventModifierFlagShift, "$" }, + { NSEventModifierFlagCommand, "@" }, }; std::string key = to_s([menuItem keyEquivalent]); NSUInteger flags = [menuItem keyEquivalentModifierMask]; - if(flags & NSShiftKeyMask) + if(flags & NSEventModifierFlagShift) { std::string const upCased = text::uppercase(key); if(key != upCased) { - flags &= ~NSShiftKeyMask; + flags &= ~NSEventModifierFlagShift; key = upCased; } } @@ -481,13 +481,13 @@ static std::vector relevant_items_in_scope (scope::context_t self.selectButton = OakCreateButton(@"Select"); self.selectButton.font = [NSFont messageFontOfSize:[NSFont smallSystemFontSize]]; - self.selectButton.cell.controlSize = NSSmallControlSize; + self.selectButton.cell.controlSize = NSControlSizeSmall; self.selectButton.target = self; self.selectButton.action = @selector(accept:); self.editButton = OakCreateButton(@"Edit"); self.editButton.font = [NSFont messageFontOfSize:[NSFont smallSystemFontSize]]; - self.editButton.cell.controlSize = NSSmallControlSize; + self.editButton.cell.controlSize = NSControlSizeSmall; self.editButton.target = self; self.editButton.action = @selector(editItem:); @@ -512,7 +512,7 @@ static std::vector relevant_items_in_scope (scope::context_t { auto updateDefaultButton = ^NSEvent*(NSEvent* event){ BOOL isKeyWindow = NSApp.keyWindow == self.window; - BOOL optionDown = ([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == NSAlternateKeyMask; + BOOL optionDown = ([event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask) == NSEventModifierFlagOption; self.window.defaultButtonCell = self.canEdit && (!self.canAccept || (optionDown && isKeyWindow)) ? self.editButton.cell : self.selectButton.cell; return event; }; @@ -520,7 +520,7 @@ static std::vector relevant_items_in_scope (scope::context_t updateDefaultButton([NSApp currentEvent]); if(NSApp.keyWindow == self.window) { - _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:updateDefaultButton]; + _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskFlagsChanged handler:updateDefaultButton]; } else if(_eventMonitor) { diff --git a/Frameworks/OakFilterList/src/FileChooser.mm b/Frameworks/OakFilterList/src/FileChooser.mm index 67617796..1f889fee 100644 --- a/Frameworks/OakFilterList/src/FileChooser.mm +++ b/Frameworks/OakFilterList/src/FileChooser.mm @@ -262,7 +262,7 @@ static NSDictionary* globs_for_path (std::string const& path) _progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect]; _progressIndicator.style = NSProgressIndicatorSpinningStyle; - _progressIndicator.controlSize = NSSmallControlSize; + _progressIndicator.controlSize = NSControlSizeSmall; _progressIndicator.displayedWhenStopped = NO; OakBackgroundFillView* aboveScopeBarDark = OakCreateHorizontalLine([NSColor grayColor], [NSColor lightGrayColor]); diff --git a/Frameworks/OakFilterList/src/OakChooser.mm b/Frameworks/OakFilterList/src/OakChooser.mm index a362d2a6..5781f0ec 100644 --- a/Frameworks/OakFilterList/src/OakChooser.mm +++ b/Frameworks/OakFilterList/src/OakChooser.mm @@ -174,7 +174,7 @@ static void* kFirstResponderBinding = &kFirstResponderBinding; [[_itemCountTextField cell] setBackgroundStyle:NSBackgroundStyleRaised]; [_itemCountTextField setContentHuggingPriority:NSLayoutPriorityDefaultHigh forOrientation:NSLayoutConstraintOrientationHorizontal]; - _window = [[NSPanel alloc] initWithContentRect:NSMakeRect(600, 700, 400, 500) styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSTexturedBackgroundWindowMask) backing:NSBackingStoreBuffered defer:NO]; + _window = [[NSPanel alloc] initWithContentRect:NSMakeRect(600, 700, 400, 500) styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskTexturedBackground) backing:NSBackingStoreBuffered defer:NO]; [_window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; [_window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge]; [_window setContentBorderThickness:32 forEdge:NSMaxYEdge]; diff --git a/Frameworks/OakTabBarView/src/OakTabBarView.mm b/Frameworks/OakTabBarView/src/OakTabBarView.mm index 7e354e2b..d74f18db 100644 --- a/Frameworks/OakTabBarView/src/OakTabBarView.mm +++ b/Frameworks/OakTabBarView/src/OakTabBarView.mm @@ -628,7 +628,7 @@ static NSString* const OakTabItemPasteboardType = @"com.macromates.TextMate.tabI NSImage* dragImage = [[NSImage alloc] initWithSize:image.size]; [dragImage lockFocus]; - [image drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:0.8]; + [image drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositingOperationCopy fraction:0.8]; [dragImage unlockFocus]; _draggedTabIndex = [_tabItems indexOfObject:tabItem]; @@ -812,7 +812,7 @@ static NSString* const OakTabItemPasteboardType = @"com.macromates.TextMate.tabI _tag = [_tabItems indexOfObject:tabItem]; // performCloseTab: asks for [sender tag] BOOL closeOther = OakIsAlternateKeyOrMouseEvent(); - if(_isMouseInside && ([[NSApp currentEvent] type] == NSLeftMouseUp || [[NSApp currentEvent] type] == NSOtherMouseUp) && !closeOther && tabItem != _overflowTabItem) + if(_isMouseInside && ([[NSApp currentEvent] type] == NSEventTypeLeftMouseUp || [[NSApp currentEvent] type] == NSEventTypeOtherMouseUp) && !closeOther && tabItem != _overflowTabItem) { _didCloseTabIndex = _tag; _didCloseTabFrame = tabItem.targetFrame; diff --git a/Frameworks/OakTabBarView/src/OakTabItemView.mm b/Frameworks/OakTabBarView/src/OakTabItemView.mm index aa368cfe..ad467634 100644 --- a/Frameworks/OakTabBarView/src/OakTabItemView.mm +++ b/Frameworks/OakTabBarView/src/OakTabItemView.mm @@ -450,7 +450,7 @@ static NSString* kUserDefaultsTabItemLineBreakStyleKey = @"tabItemLineBreakStyle _overflowButton = [[OakRolloverButton alloc] initWithFrame:NSZeroRect]; OakSetAccessibilityLabel(_overflowButton, @"Show tab overflow menu"); - [_overflowButton sendActionOn:NSLeftMouseDownMask]; + [_overflowButton sendActionOn:NSEventMaskLeftMouseDown]; [self updateStyle]; OakAddAutoLayoutViewsToSuperview(@[ _overflowButton ], self); diff --git a/Frameworks/OakTextView/src/GutterView.mm b/Frameworks/OakTextView/src/GutterView.mm index f429a5dc..b7041672 100644 --- a/Frameworks/OakTextView/src/GutterView.mm +++ b/Frameworks/OakTextView/src/GutterView.mm @@ -322,11 +322,11 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel [self.selectionBackgroundColor set]; for(auto const& rect : backgroundRects) - NSRectFillUsingOperation(NSIntersectionRect(rect, NSIntersectionRect(aRect, self.frame)), NSCompositeSourceOver); + NSRectFillUsingOperation(NSIntersectionRect(rect, NSIntersectionRect(aRect, self.frame)), NSCompositingOperationSourceOver); [self.selectionBorderColor set]; for(auto const& rect : borderRects) - NSRectFillUsingOperation(NSIntersectionRect(rect, NSIntersectionRect(aRect, self.frame)), NSCompositeSourceOver); + NSRectFillUsingOperation(NSIntersectionRect(rect, NSIntersectionRect(aRect, self.frame)), NSCompositingOperationSourceOver); if(!self.antiAlias) CGContextSetShouldAntialias((CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], false); @@ -385,7 +385,7 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel CGImageRef cgImage = [image CGImageForProposedRect:&imageRect context:[NSGraphicsContext currentContext] hints:nil]; CGContextClipToMask((CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], imageRect, cgImage); - NSRectFillUsingOperation(imageRect, NSCompositeSourceOver); + NSRectFillUsingOperation(imageRect, NSCompositingOperationSourceOver); [NSGraphicsContext restoreGraphicsState]; } else @@ -465,10 +465,10 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel mouseDownAtPoint = pos; [self setNeedsDisplayInRect:columnRect]; - while([event type] != NSLeftMouseUp) + while([event type] != NSEventTypeLeftMouseUp) { - event = [NSApp nextEventMatchingMask:(NSLeftMouseUpMask|NSMouseMovedMask|NSLeftMouseDraggedMask|NSMouseEnteredMask|NSMouseExitedMask) untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; - if([event type] == NSMouseMoved || [event type] == NSLeftMouseDragged) + event = [NSApp nextEventMatchingMask:(NSEventMaskLeftMouseUp|NSEventMaskMouseMoved|NSEventMaskLeftMouseDragged|NSEventMaskMouseEntered|NSEventMaskMouseExited) untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; + if([event type] == NSEventTypeMouseMoved || [event type] == NSEventTypeLeftMouseDragged) [self mouseMoved:event]; } @@ -493,10 +493,10 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel else { [_partnerView mouseDown:event]; - while([event type] != NSLeftMouseUp) + while([event type] != NSEventTypeLeftMouseUp) { - event = [NSApp nextEventMatchingMask:(NSLeftMouseUpMask|NSMouseMovedMask|NSLeftMouseDraggedMask|NSMouseEnteredMask|NSMouseExitedMask) untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; - if([event type] == NSMouseMoved || [event type] == NSLeftMouseDragged) + event = [NSApp nextEventMatchingMask:(NSEventMaskLeftMouseUp|NSEventMaskMouseMoved|NSEventMaskLeftMouseDragged|NSEventMaskMouseEntered|NSEventMaskMouseExited) untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; + if([event type] == NSEventTypeMouseMoved || [event type] == NSEventTypeLeftMouseDragged) [_partnerView mouseDragged:event]; } [_partnerView mouseUp:event]; diff --git a/Frameworks/OakTextView/src/OTVHUD.mm b/Frameworks/OakTextView/src/OTVHUD.mm index 758e2bb5..338a347a 100644 --- a/Frameworks/OakTextView/src/OTVHUD.mm +++ b/Frameworks/OakTextView/src/OTVHUD.mm @@ -30,7 +30,7 @@ aRect = NSInsetRect(aRect, 10, 10); aRect = NSMakeRect(NSMaxX(aRect) - kWidth, NSMaxY(aRect) - kHeight, kWidth, kHeight); - NSWindow* window = [[NSWindow alloc] initWithContentRect:aRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + NSWindow* window = [[NSWindow alloc] initWithContentRect:aRect styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]; if(!window) return nil; @@ -61,7 +61,7 @@ - (void)setStringValue:(NSString*)someText { NSMutableParagraphStyle* pStyle = [NSMutableParagraphStyle new]; - [pStyle setAlignment:NSCenterTextAlignment]; + [pStyle setAlignment:NSTextAlignmentCenter]; NSShadow* shadow = [NSShadow new]; [shadow setShadowColor:[NSColor darkGrayColor]]; diff --git a/Frameworks/OakTextView/src/OTVStatusBar.mm b/Frameworks/OakTextView/src/OTVStatusBar.mm index cefa2a4b..905bb634 100644 --- a/Frameworks/OakTextView/src/OTVStatusBar.mm +++ b/Frameworks/OakTextView/src/OTVStatusBar.mm @@ -20,7 +20,7 @@ static NSTextField* OakCreateTextField (NSString* label) [res setDrawsBackground:NO]; [res setFont:OakStatusBarFont()]; [res setStringValue:label]; - [res setAlignment:NSRightTextAlignment]; + [res setAlignment:NSTextAlignmentRight]; [[res cell] setBackgroundStyle:NSBackgroundStyleRaised]; [[res cell] setLineBreakMode:NSLineBreakByTruncatingMiddle]; return res; diff --git a/Frameworks/OakTextView/src/OakChoiceMenu.mm b/Frameworks/OakTextView/src/OakChoiceMenu.mm index 4b301deb..00acea7e 100644 --- a/Frameworks/OakTextView/src/OakChoiceMenu.mm +++ b/Frameworks/OakTextView/src/OakChoiceMenu.mm @@ -43,7 +43,7 @@ enum action_t { kActionNop, kActionTab, kActionReturn, kActionCancel, kActionMov CGFloat const kTableViewPadding = 4; CGFloat const kScrollBarWidth = 15; - NSTextField* textField = OakCreateLabel(@"", self.font, NSLeftTextAlignment, NSLineBreakByTruncatingTail); + NSTextField* textField = OakCreateLabel(@"", self.font, NSTextAlignmentLeft, NSLineBreakByTruncatingTail); if(_choices.count == 0) [textField sizeToFit]; @@ -132,7 +132,7 @@ enum action_t { kActionNop, kActionTab, kActionReturn, kActionCancel, kActionMov NSTextField* res = [aTableView makeViewWithIdentifier:identifier owner:self]; if(!res) { - res = OakCreateLabel(@"", self.font, NSLeftTextAlignment, NSLineBreakByTruncatingTail); + res = OakCreateLabel(@"", self.font, NSTextAlignmentLeft, NSLineBreakByTruncatingTail); res.identifier = identifier; } return res; @@ -140,7 +140,7 @@ enum action_t { kActionNop, kActionTab, kActionReturn, kActionCancel, kActionMov - (void)showAtTopLeftPoint:(NSPoint)aPoint forView:(NSView*)aView { - _window = [[NSPanel alloc] initWithContentRect:NSMakeRect(aPoint.x, aPoint.y, 0, 0) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + _window = [[NSPanel alloc] initWithContentRect:NSMakeRect(aPoint.x, aPoint.y, 0, 0) styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]; _window.opaque = NO; _window.alphaValue = 0.97; _window.backgroundColor = [NSColor colorWithCalibratedRed:1.00 green:0.96 blue:0.76 alpha:1]; diff --git a/Frameworks/OakTextView/src/OakTextView.mm b/Frameworks/OakTextView/src/OakTextView.mm index 79c44aa2..f2526ea5 100644 --- a/Frameworks/OakTextView/src/OakTextView.mm +++ b/Frameworks/OakTextView/src/OakTextView.mm @@ -1041,7 +1041,7 @@ static std::string shell_quote (std::vector paths) - (void)ensureSelectionIsInVisibleArea:(id)sender { self.needsEnsureSelectionIsInVisibleArea = NO; - if([[self.window currentEvent] type] == NSLeftMouseDragged) // User is drag-selecting + if([[self.window currentEvent] type] == NSEventTypeLeftMouseDragged) // User is drag-selecting return; ng::range_t range = documentView->ranges().last(); @@ -2038,7 +2038,7 @@ static void update_menu_key_equivalents (NSMenu* menu, std::multimap(&anAction)) { __block id eventMonitor; - eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask handler:^NSEvent*(NSEvent* event){ + eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^NSEvent*(NSEvent* event){ plist::dictionary_t::const_iterator pair = nested->find(to_s(event)); if(pair != nested->end()) { @@ -2057,7 +2057,7 @@ static void update_menu_key_equivalents (NSMenu* menu, std::multimapbundle_variables(); @@ -3799,9 +3799,9 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; - (void)actOnMouseDown { - bool optionDown = mouseDownModifierFlags & NSAlternateKeyMask; - bool shiftDown = mouseDownModifierFlags & NSShiftKeyMask; - bool commandDown = mouseDownModifierFlags & NSCommandKeyMask; + bool optionDown = mouseDownModifierFlags & NSEventModifierFlagOption; + bool shiftDown = mouseDownModifierFlags & NSEventModifierFlagShift; + bool commandDown = mouseDownModifierFlags & NSEventModifierFlagCommand; ng::ranges_t s = documentView->ranges(); @@ -3879,7 +3879,7 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; } NSUInteger currentModifierFlags = [anEvent modifierFlags]; - if(currentModifierFlags & NSAlternateKeyMask) + if(currentModifierFlags & NSEventModifierFlagOption) range.last().columnar = true; ng::ranges_t s = documentView->ranges(); @@ -3899,7 +3899,7 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; NSImage* image = [[NSImage alloc] initWithSize:srcImage.size]; [image lockFocus]; - [srcImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:0.5]; + [srcImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositingOperationCopy fraction:0.5]; [image unlockFocus]; std::vector v; @@ -3942,7 +3942,7 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle"; - (void)preparePotentialDrag:(NSEvent*)anEvent { - if([self dragDelay] != 0 && ([[self window] isKeyWindow] || ([anEvent modifierFlags] & NSCommandKeyMask))) + if([self dragDelay] != 0 && ([[self window] isKeyWindow] || ([anEvent modifierFlags] & NSEventModifierFlagCommand))) self.initiateDragTimer = [NSTimer scheduledTimerWithTimeInterval:(0.001 * [self dragDelay]) target:self selector:@selector(changeToDragPointer:) userInfo:nil repeats:NO]; else [self changeToDragPointer:nil]; delayMouseDown = [[self window] isKeyWindow]; @@ -3952,10 +3952,10 @@ static scope::context_t add_modifiers_to_scope (scope::context_t scope, NSUInteg { static struct { NSUInteger modifier; char const* scope; } const map[] = { - { NSShiftKeyMask, "dyn.modifier.shift" }, - { NSControlKeyMask, "dyn.modifier.control" }, - { NSAlternateKeyMask, "dyn.modifier.option" }, - { NSCommandKeyMask, "dyn.modifier.command" } + { NSEventModifierFlagShift, "dyn.modifier.shift" }, + { NSEventModifierFlagControl, "dyn.modifier.control" }, + { NSEventModifierFlagOption, "dyn.modifier.option" }, + { NSEventModifierFlagCommand, "dyn.modifier.command" } }; for(auto const& it : map) @@ -4000,7 +4000,7 @@ static scope::context_t add_modifiers_to_scope (scope::context_t scope, NSUInteg - (void)mouseDown:(NSEvent*)anEvent { - if([self.inputContext handleEvent:anEvent] || !documentView || [anEvent type] != NSLeftMouseDown || ignoreMouseDown) + if([self.inputContext handleEvent:anEvent] || !documentView || [anEvent type] != NSEventTypeLeftMouseDown || ignoreMouseDown) return (void)(ignoreMouseDown = NO); if(ng::range_t r = documentView->folded_range_at_point([self convertPoint:[anEvent locationInWindow] fromView:nil])) @@ -4010,7 +4010,7 @@ static scope::context_t add_modifiers_to_scope (scope::context_t scope, NSUInteg return; } - if(macroRecordingArray && [anEvent type] == NSLeftMouseDown) + if(macroRecordingArray && [anEvent type] == NSEventTypeLeftMouseDown) { NSAlert* alert = [[NSAlert alloc] init]; alert.messageText = @"You are recording a macro"; @@ -4048,9 +4048,9 @@ static scope::context_t add_modifiers_to_scope (scope::context_t scope, NSUInteg BOOL hasFocus = (self.keyState & (OakViewViewIsFirstResponderMask|OakViewWindowIsKeyMask|OakViewApplicationIsActiveMask)) == (OakViewViewIsFirstResponderMask|OakViewWindowIsKeyMask|OakViewApplicationIsActiveMask); if(!hasFocus) - mouseDownModifierFlags &= ~NSCommandKeyMask; + mouseDownModifierFlags &= ~NSEventModifierFlagCommand; - if(!(mouseDownModifierFlags & NSShiftKeyMask) && [self isPointInSelection:[self convertPoint:[anEvent locationInWindow] fromView:nil]] && [anEvent clickCount] == 1 && [self dragDelay] >= 0 && !([anEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask))) + if(!(mouseDownModifierFlags & NSEventModifierFlagShift) && [self isPointInSelection:[self convertPoint:[anEvent locationInWindow] fromView:nil]] && [anEvent clickCount] == 1 && [self dragDelay] >= 0 && !([anEvent modifierFlags] & (NSEventModifierFlagShift | NSEventModifierFlagControl | NSEventModifierFlagOption | NSEventModifierFlagCommand))) [self preparePotentialDrag:anEvent]; else [self actOnMouseDown]; } @@ -4391,14 +4391,14 @@ static scope::context_t add_modifiers_to_scope (scope::context_t scope, NSUInteg { // We use CFRunLoopRunInMode() to handle dispatch queues and nextEventMatchingMask:… to catcn ⌃C CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5, true); - if(NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]) + if(NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]) { - static NSEventType const events[] = { NSLeftMouseDown, NSLeftMouseUp, NSRightMouseDown, NSRightMouseUp, NSOtherMouseDown, NSOtherMouseUp, NSLeftMouseDragged, NSRightMouseDragged, NSOtherMouseDragged, NSKeyDown, NSKeyUp, NSFlagsChanged }; + static NSEventType const events[] = { NSEventTypeLeftMouseDown, NSEventTypeLeftMouseUp, NSEventTypeRightMouseDown, NSEventTypeRightMouseUp, NSEventTypeOtherMouseDown, NSEventTypeOtherMouseUp, NSEventTypeLeftMouseDragged, NSEventTypeRightMouseDragged, NSEventTypeOtherMouseDragged, NSEventTypeKeyDown, NSEventTypeKeyUp, NSEventTypeFlagsChanged }; if(!oak::contains(std::begin(events), std::end(events), [event type])) { [NSApp sendEvent:event]; } - else if([event type] == NSKeyDown && (([[event charactersIgnoringModifiers] isEqualToString:@"c"] && ([event modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) == NSControlKeyMask) || ([[event charactersIgnoringModifiers] isEqualToString:@"."] && ([event modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) == NSCommandKeyMask))) + else if([event type] == NSEventTypeKeyDown && (([[event charactersIgnoringModifiers] isEqualToString:@"c"] && ([event modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)) == NSEventModifierFlagControl) || ([[event charactersIgnoringModifiers] isEqualToString:@"."] && ([event modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)) == NSEventModifierFlagCommand))) { NSAlert* alert = [[NSAlert alloc] init]; alert.messageText = [NSString stringWithFormat:@"Stop “%@”", to_ns(aBundleCommand.name)]; diff --git a/Frameworks/SoftwareUpdate/src/SoftwareUpdate.mm b/Frameworks/SoftwareUpdate/src/SoftwareUpdate.mm index 67dd6d5d..2cb30d80 100644 --- a/Frameworks/SoftwareUpdate/src/SoftwareUpdate.mm +++ b/Frameworks/SoftwareUpdate/src/SoftwareUpdate.mm @@ -125,8 +125,8 @@ typedef std::shared_ptr shared_state_ptr; { D(DBF_SoftwareUpdate_Check, bug("\n");); - BOOL isShiftDown = OakIsAlternateKeyOrMouseEvent(NSShiftKeyMask); - NSURL* url = [self.channels objectForKey:OakIsAlternateKeyOrMouseEvent(NSAlternateKeyMask) ? kSoftwareUpdateChannelNightly : [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsSoftwareUpdateChannelKey]]; + BOOL isShiftDown = OakIsAlternateKeyOrMouseEvent(NSEventModifierFlagShift); + NSURL* url = [self.channels objectForKey:OakIsAlternateKeyOrMouseEvent(NSEventModifierFlagOption) ? kSoftwareUpdateChannelNightly : [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsSoftwareUpdateChannelKey]]; [self checkVersionAtURL:url inBackground:NO allowRedownload:isShiftDown]; } diff --git a/Frameworks/command/src/runner.mm b/Frameworks/command/src/runner.mm index 2508e558..6bb451cc 100644 --- a/Frameworks/command/src/runner.mm +++ b/Frameworks/command/src/runner.mm @@ -175,7 +175,7 @@ namespace command runner->did_exit(rc); // Wake up our local event loop (if it is running) - [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 context:NULL subtype:0 data1:0 data2:0] atStart:NO]; + [NSApp postEvent:[NSEvent otherEventWithType:NSEventTypeApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 context:NULL subtype:0 data1:0 data2:0] atStart:NO]; }; bool hasHTMLOutput = _command.output == output::new_window && _command.output_format == output_format::html; @@ -202,14 +202,14 @@ namespace command { // We use CFRunLoopRunInMode() to handle dispatch queues and nextEventMatchingMask:… to catcn ⌃C CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5, true); - if(NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]) + if(NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]) { - static NSEventType const events[] = { NSLeftMouseDown, NSLeftMouseUp, NSRightMouseDown, NSRightMouseUp, NSOtherMouseDown, NSOtherMouseUp, NSLeftMouseDragged, NSRightMouseDragged, NSOtherMouseDragged, NSKeyDown, NSKeyUp, NSFlagsChanged }; + static NSEventType const events[] = { NSEventTypeLeftMouseDown, NSEventTypeLeftMouseUp, NSEventTypeRightMouseDown, NSEventTypeRightMouseUp, NSEventTypeOtherMouseDown, NSEventTypeOtherMouseUp, NSEventTypeLeftMouseDragged, NSEventTypeRightMouseDragged, NSEventTypeOtherMouseDragged, NSEventTypeKeyDown, NSEventTypeKeyUp, NSEventTypeFlagsChanged }; if(!oak::contains(std::begin(events), std::end(events), [event type])) { [NSApp sendEvent:event]; } - else if([event type] == NSKeyDown && (([[event charactersIgnoringModifiers] isEqualToString:@"c"] && ([event modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) == NSControlKeyMask) || ([[event charactersIgnoringModifiers] isEqualToString:@"."] && ([event modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) == NSCommandKeyMask))) + else if([event type] == NSEventTypeKeyDown && (([[event charactersIgnoringModifiers] isEqualToString:@"c"] && ([event modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)) == NSEventModifierFlagControl) || ([[event charactersIgnoringModifiers] isEqualToString:@"."] && ([event modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand)) == NSEventModifierFlagCommand))) { NSAlert* alert = [[NSAlert alloc] init]; alert.messageText = [NSString stringWithFormat:@"Stop “%@”", [NSString stringWithCxxString:_command.name]]; diff --git a/Frameworks/document/src/EncodingView.mm b/Frameworks/document/src/EncodingView.mm index 94e53fe0..3f6eb9bb 100644 --- a/Frameworks/document/src/EncodingView.mm +++ b/Frameworks/document/src/EncodingView.mm @@ -176,7 +176,7 @@ static NSTextView* MyCreateTextView () @implementation EncodingWindowController - (instancetype)initWithData:(NSData*)data { - if(self = [super initWithWindow:[[NSWindow alloc] initWithContentRect:NSZeroRect styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO]]) + if(self = [super initWithWindow:[[NSWindow alloc] initWithContentRect:NSZeroRect styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]]) { _data = data; _encoding = @"ISO-8859-1"; diff --git a/Frameworks/layout/tests/gui_layout.mm b/Frameworks/layout/tests/gui_layout.mm index cbb1de36..7543ae84 100644 --- a/Frameworks/layout/tests/gui_layout.mm +++ b/Frameworks/layout/tests/gui_layout.mm @@ -215,8 +215,8 @@ private: if([anEvent keyCode] != 58 && [anEvent keyCode] != 61) return; - NSInteger modifiers = [anEvent modifierFlags] & (NSAlternateKeyMask | NSControlKeyMask | NSCommandKeyMask); - BOOL didPressOption = modifiers == NSAlternateKeyMask; + NSInteger modifiers = [anEvent modifierFlags] & (NSEventModifierFlagOption | NSEventModifierFlagControl | NSEventModifierFlagCommand); + BOOL didPressOption = modifiers == NSEventModifierFlagOption; BOOL didReleaseOption = modifiers == 0 && _optionDownDate && [[NSDate date] timeIntervalSinceDate:_optionDownDate] < 0.18; self.optionDownDate = didPressOption ? [NSDate date] : nil; @@ -363,10 +363,10 @@ private: AUTO_REFRESH; CGPoint pos = [self convertPoint:[anEvent locationInWindow] fromView:nil]; - NSUInteger modifierFlags = [anEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask); - bool optionDown = modifierFlags & NSAlternateKeyMask; - bool shiftDown = modifierFlags & NSShiftKeyMask; - bool commandDown = modifierFlags & NSCommandKeyMask; + NSUInteger modifierFlags = [anEvent modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand); + bool optionDown = modifierFlags & NSEventModifierFlagOption; + bool shiftDown = modifierFlags & NSEventModifierFlagShift; + bool commandDown = modifierFlags & NSEventModifierFlagCommand; ng::index_t index = layout->index_at_point(pos); if(!optionDown) diff --git a/Frameworks/license/src/LicenseManager.mm b/Frameworks/license/src/LicenseManager.mm index c9309702..c2f7b905 100644 --- a/Frameworks/license/src/LicenseManager.mm +++ b/Frameworks/license/src/LicenseManager.mm @@ -93,9 +93,9 @@ static NSTextField* OakCreateTextField () @implementation AddLicenseViewController - (void)loadView { - self.ownerLabel = OakCreateLabel(@"Owner:", nil, NSRightTextAlignment); + self.ownerLabel = OakCreateLabel(@"Owner:", nil, NSTextAlignmentRight); self.ownerTextField = OakCreateTextField(); - self.licenseLabel = OakCreateLabel(@"License:", nil, NSRightTextAlignment); + self.licenseLabel = OakCreateLabel(@"License:", nil, NSTextAlignmentRight); self.licenseTextField = OakCreateTextField(); self.licenseTextField.font = [NSFont userFixedPitchFontOfSize:12]; self.statusTextField = OakCreateLabel(@"", [NSFont labelFontOfSize:0]); @@ -172,7 +172,7 @@ static NSTextField* OakCreateTextField () @implementation AddLicenseWindowController - (instancetype)initWithLicense:(License*)license { - if((self = [super initWithWindow:[[NSPanel alloc] initWithContentRect:NSZeroRect styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO]])) + if((self = [super initWithWindow:[[NSPanel alloc] initWithContentRect:NSZeroRect styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable) backing:NSBackingStoreBuffered defer:NO]])) { self.window.title = @"Add License"; self.window.level = NSModalPanelWindowLevel; @@ -297,10 +297,10 @@ static NSString* const kAddLicenseViewIdentifier = @"org.TextMate.addLicenseButt NSButton* addLicenseButton = [[NSButton alloc] initWithFrame:NSZeroRect]; addLicenseButton.cell.backgroundStyle = NSBackgroundStyleRaised; - addLicenseButton.cell.controlSize = NSSmallControlSize; + addLicenseButton.cell.controlSize = NSControlSizeSmall; addLicenseButton.showsBorderOnlyWhileMouseInside = YES; - addLicenseButton.font = [NSFont messageFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]; + addLicenseButton.font = [NSFont messageFontOfSize:[NSFont systemFontSizeForControlSize:NSControlSizeSmall]]; addLicenseButton.bezelStyle = NSRecessedBezelStyle; addLicenseButton.buttonType = NSMomentaryPushInButton; addLicenseButton.title = @"Add License"; diff --git a/Frameworks/ns/src/event.mm b/Frameworks/ns/src/event.mm index cda5df3b..0b0eda36 100644 --- a/Frameworks/ns/src/event.mm +++ b/Frameworks/ns/src/event.mm @@ -105,11 +105,11 @@ static std::string string_for (NSUInteger flags) { static struct EventFlag_t { NSUInteger flag; std::string symbol; } const EventFlags[] = { - { NSNumericPadKeyMask, "#" }, - { NSControlKeyMask, "^" }, - { NSAlternateKeyMask, "~" }, - { NSShiftKeyMask, "$" }, - { NSCommandKeyMask, "@" }, + { NSEventModifierFlagNumericPad, "#" }, + { NSEventModifierFlagControl, "^" }, + { NSEventModifierFlagOption, "~" }, + { NSEventModifierFlagShift, "$" }, + { NSEventModifierFlagCommand, "@" }, }; std::string res = ""; @@ -122,11 +122,11 @@ static NSUInteger ns_flag_for_char (uint32_t ch) { switch(ch) { - case '$': return NSShiftKeyMask; - case '^': return NSControlKeyMask; - case '~': return NSAlternateKeyMask; - case '@': return NSCommandKeyMask; - case '#': return NSNumericPadKeyMask; + case '$': return NSEventModifierFlagShift; + case '^': return NSEventModifierFlagControl; + case '~': return NSEventModifierFlagOption; + case '@': return NSEventModifierFlagCommand; + case '#': return NSEventModifierFlagNumericPad; } return 0; } @@ -189,13 +189,13 @@ namespace ns std::string glyphs_for_flags (NSUInteger flags) { std::string res = ""; - if(flags & NSControlKeyMask) + if(flags & NSEventModifierFlagControl) res += glyph_named("control"); - if(flags & NSAlternateKeyMask) + if(flags & NSEventModifierFlagOption) res += glyph_named("modifier"); - if(flags & NSShiftKeyMask) + if(flags & NSEventModifierFlagShift) res += glyph_named("shift"); - if(flags & NSCommandKeyMask) + if(flags & NSEventModifierFlagCommand) res += glyph_named("command"); return res; } @@ -205,11 +205,11 @@ namespace ns std::string key; NSUInteger flags; parse_event_string(eventString, key, flags); - if((flags & NSShiftKeyMask) == 0) + if((flags & NSEventModifierFlagShift) == 0) { std::string const upCased = text::uppercase(key); if(key != text::lowercase(key)) - flags |= NSShiftKeyMask; + flags |= NSEventModifierFlagShift; else if(key != upCased) key = upCased; } @@ -218,7 +218,7 @@ namespace ns if(startOfKey) *startOfKey = modifierString.size(); - return modifierString + glyphs_for_key(key, flags & NSNumericPadKeyMask); + return modifierString + glyphs_for_key(key, flags & NSEventModifierFlagNumericPad); } } /* ns */ @@ -245,7 +245,7 @@ NSAttributedString* OakAttributedStringForEventString (NSString* eventString, NS CGFloat keyWidth = [font maximumAdvancement].width; NSMutableParagraphStyle* pStyle = [NSMutableParagraphStyle new]; - [pStyle setAlignment:NSRightTextAlignment]; + [pStyle setAlignment:NSTextAlignmentRight]; [pStyle setTabStops:@[ [[NSTextTab alloc] initWithType:NSLeftTabStopType location:ceil(flagsWidth + keyWidth)] ]]; [str addAttributes:@{ NSParagraphStyleAttributeName : pStyle } range:NSMakeRange(0, [str length])]; diff --git a/PlugIns/dialog b/PlugIns/dialog index bdf01015..a893ac1e 160000 --- a/PlugIns/dialog +++ b/PlugIns/dialog @@ -1 +1 @@ -Subproject commit bdf010150f91dd22395c89d86bc2472326f3d0b4 +Subproject commit a893ac1e6d1af38165e20651f3ee6aeff0e40111 diff --git a/PlugIns/dialog-1.x b/PlugIns/dialog-1.x index 006368a2..f9d50752 160000 --- a/PlugIns/dialog-1.x +++ b/PlugIns/dialog-1.x @@ -1 +1 @@ -Subproject commit 006368a2156ef5fdc68c15288b95b5ab71dd2738 +Subproject commit f9d50752d108726015e9cb69818b27edeab0e27b diff --git a/Shared/include/oak/sdk-compat.h b/Shared/include/oak/sdk-compat.h index 95b0d8e1..272da839 100644 --- a/Shared/include/oak/sdk-compat.h +++ b/Shared/include/oak/sdk-compat.h @@ -6,7 +6,7 @@ @protocol CAAnimationDelegate @end -#define NSAlertStyleWarning NSWarningAlertStyle -#define NSAlertStyleInformational NSInformationalAlertStyle -#define NSAlertStyleCritical NSCriticalAlertStyle +#define NSAlertStyleWarning NSAlertStyleWarning +#define NSAlertStyleInformational NSAlertStyleInformational +#define NSAlertStyleCritical NSAlertStyleCritical #endif diff --git a/Shared/include/test/cocoa.h b/Shared/include/test/cocoa.h index 9c208bf7..07a4d13f 100644 --- a/Shared/include/test/cocoa.h +++ b/Shared/include/test/cocoa.h @@ -51,8 +51,8 @@ static void OakSetupApplicationWithView (NSResponder* aView, std::string testNam else if([aView isKindOfClass:[NSView class]]) { NSView* view = (NSView*)aView; - NSRect winRect = [NSWindow frameRectForContentRect:NSInsetRect([view bounds], -10, -10) styleMask:NSTitledWindowMask|NSResizableWindowMask]; - window = [[NSWindow alloc] initWithContentRect:winRect styleMask:NSTitledWindowMask|NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO]; + NSRect winRect = [NSWindow frameRectForContentRect:NSInsetRect([view bounds], -10, -10) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskResizable]; + window = [[NSWindow alloc] initWithContentRect:winRect styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]; [view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; [view setFrame:NSInsetRect([[window contentView] bounds], 10, 10)]; [[window contentView] addSubview:view];