Skip to content
Permalink
Browse files

Replace deprecated constants with new names

  • Loading branch information...
dmoagx committed Jun 14, 2019
1 parent d460725 commit 6c525888deda667f458b4b8b427f0df8c82931ba
@@ -201,7 +201,7 @@ - (void)setCloseButtonPressed:(BOOL)value

- (BOOL)closeButtonOver
{
return (_closeButtonOver && ([_customControlView allowsBackgroundTabClosing] || ([self tabState] & PSMTab_SelectedMask) || [[NSApp currentEvent] modifierFlags] & NSCommandKeyMask));
return (_closeButtonOver && ([_customControlView allowsBackgroundTabClosing] || ([self tabState] & PSMTab_SelectedMask) || [[NSApp currentEvent] modifierFlags] & NSEventModifierFlagCommand));
}

- (void)setCloseButtonOver:(BOOL)value
@@ -386,7 +386,7 @@ - (void)mouseEntered:(NSEvent *)theEvent
}

// scrubtastic
if ([_customControlView allowsScrubbing] && ([theEvent modifierFlags] & NSAlternateKeyMask))
if ([_customControlView allowsScrubbing] && ([theEvent modifierFlags] & NSEventModifierFlagOption))
[_customControlView tabClick:self];

// tell the control we only need to redraw the affected tab
@@ -1317,7 +1317,7 @@ - (void)mouseDown:(NSEvent *)theEvent
if (overClose &&
![self disableTabClose] &&
![cell isCloseButtonSuppressed] &&
([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[tabView selectedTabViewItem]] || [theEvent modifierFlags] & NSCommandKeyMask)) {
([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[tabView selectedTabViewItem]] || [theEvent modifierFlags] & NSEventModifierFlagCommand)) {
[cell setCloseButtonOver:NO];
[cell setCloseButtonPressed:YES];
_closeClicked = YES;
@@ -1422,7 +1422,7 @@ - (void)mouseUp:(NSEvent *)theEvent
NSRect iconRect = [mouseDownCell closeButtonRectForFrame:mouseDownCellFrame];

if ((NSMouseInRect(mousePt, iconRect,[self isFlipped])) && ![self disableTabClose] && ![cell isCloseButtonSuppressed] && [mouseDownCell closeButtonPressed]) {
if (([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) {
if (([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagOption) != 0) {
//If the user is holding Option, close all other tabs
NSEnumerator *enumerator = [[[[self cells] copy] autorelease] objectEnumerator];
PSMTabBarCell *otherCell;
@@ -1874,11 +1874,11 @@ - (IBAction)reloadBundles:(id)sender
NSString *theKey = [cmdData objectForKey:SPBundleFileKeyEquivalentKey];
NSString *theChar = [theKey substringFromIndex:[theKey length]-1];
NSString *theMods = [theKey substringToIndex:[theKey length]-1];
NSUInteger mask = 0;
if([theMods rangeOfString:@"^"].length) mask = mask | NSControlKeyMask;
if([theMods rangeOfString:@"@"].length) mask = mask | NSCommandKeyMask;
if([theMods rangeOfString:@"~"].length) mask = mask | NSAlternateKeyMask;
if([theMods rangeOfString:@"$"].length) mask = mask | NSShiftKeyMask;
NSEventModifierFlags mask = 0;
if([theMods rangeOfString:@"^"].length) mask = mask | NSEventModifierFlagControl;
if([theMods rangeOfString:@"@"].length) mask = mask | NSEventModifierFlagCommand;
if([theMods rangeOfString:@"~"].length) mask = mask | NSEventModifierFlagOption;
if([theMods rangeOfString:@"$"].length) mask = mask | NSEventModifierFlagShift;

if(![[bundleKeyEquivalents objectForKey:scope] objectForKey:[cmdData objectForKey:SPBundleFileKeyEquivalentKey]])
[[bundleKeyEquivalents objectForKey:scope] setObject:[NSMutableArray array] forKey:[cmdData objectForKey:SPBundleFileKeyEquivalentKey]];
@@ -1943,7 +1943,7 @@ - (IBAction)reloadBundles:(id)sender
// Add default menu items
NSMenuItem *anItem;
anItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bundle Editor", @"bundle editor menu item label") action:@selector(openBundleEditor:) keyEquivalent:@"b"];
[anItem setKeyEquivalentModifierMask:(NSCommandKeyMask|NSAlternateKeyMask|NSControlKeyMask)];
[anItem setKeyEquivalentModifierMask:(NSEventModifierFlagCommand|NSEventModifierFlagOption|NSEventModifierFlagControl)];
[menu addItem:anItem];
[anItem release];
anItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Reload Bundles", @"reload bundles menu item label") action:@selector(reloadBundles:) keyEquivalent:@""];
@@ -245,7 +245,7 @@ + (NSString *)runBashCommand:(NSString *)command withEnvironment:(NSDictionary*)
if(!event) continue;
if ([event type] == NSKeyDown) {
unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
if (([event modifierFlags] & NSEventModifierFlagCommand) && key == '.') {
[bashTask terminate];
userTerminated = YES;
break;
@@ -483,7 +483,7 @@ - (BOOL)wrapSelectionWithPrefix:(unichar)prefix
- (void)keyDown:(NSEvent *)theEvent
{

long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
NSEventModifierFlags allFlags = (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand);

NSString *characters = [theEvent characters];
NSString *charactersIgnMod = [theEvent charactersIgnoringModifiers];
@@ -492,9 +492,9 @@ - (void)keyDown:(NSEvent *)theEvent
return;
}
unichar insertedCharacter = [characters characterAtIndex:0];
long curFlags = ([theEvent modifierFlags] & allFlags);
NSEventModifierFlags curFlags = ([theEvent modifierFlags] & allFlags);

if(curFlags & NSCommandKeyMask) {
if(curFlags & NSEventModifierFlagCommand) {
if([charactersIgnMod isEqualToString:@"+"] || [charactersIgnMod isEqualToString:@"="]) // increase text size by 1; ⌘+ and numpad +
{
[self makeTextSizeLarger];
@@ -534,7 +534,7 @@ - (void)keyDown:(NSEvent *)theEvent
// or a RETURN but not for each char due to writing speed
if ([charactersIgnMod isEqualToString:@" "] ||
[theEvent keyCode] == 36 ||
[theEvent modifierFlags] & (NSCommandKeyMask|NSControlKeyMask|NSAlternateKeyMask))
[theEvent modifierFlags] & (NSEventModifierFlagCommand|NSEventModifierFlagControl|NSEventModifierFlagOption))
{
[(SPBundleEditorController *)[self delegate] setDoGroupDueToChars];
}
@@ -685,7 +685,7 @@ - (IBAction)removeCommandBundle:(id)sender

// Change the alert's cancel button to have the key equivalent of return
[[buttons objectAtIndex:0] setKeyEquivalent:@"r"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];

[alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removeSelectedBundles"];
@@ -1137,15 +1137,15 @@ - (void)shortcutRecorder:(SRRecorderControl *)aRecorder keyComboDidChange:(KeyCo
theChar =[[aRecorder keyCharsIgnoringModifiers] lowercaseString];
[keyEq setString:@""];
if(newKeyCombo.code > -1) {
if(newKeyCombo.flags & NSControlKeyMask)
if(newKeyCombo.flags & NSEventModifierFlagControl)
[keyEq appendString:@"^"];
if(newKeyCombo.flags & NSAlternateKeyMask)
if(newKeyCombo.flags & NSEventModifierFlagOption)
[keyEq appendString:@"~"];
if(newKeyCombo.flags & NSShiftKeyMask) {
if(newKeyCombo.flags & NSEventModifierFlagShift) {
[keyEq appendString:@"$"];
theChar = [theChar uppercaseString];
}
if(newKeyCombo.flags & NSCommandKeyMask)
if(newKeyCombo.flags & NSEventModifierFlagCommand)
[keyEq appendString:@"@"];
if(theChar)
[keyEq appendString:theChar];
@@ -130,11 +130,11 @@ - (void)dealloc

- (void)keyDown:(NSEvent *)theEvent
{
long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
NSEventModifierFlags allFlags = (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand);
NSString *charactersIgnMod = [theEvent charactersIgnoringModifiers];
long curFlags = ([theEvent modifierFlags] & allFlags);
NSEventModifierFlags curFlags = ([theEvent modifierFlags] & allFlags);

if(curFlags & NSCommandKeyMask) {
if(curFlags & NSEventModifierFlagCommand) {
if([charactersIgnMod isEqualToString:@"+"] || [charactersIgnMod isEqualToString:@"="]) // increase text size by 1; ⌘+, ⌘=, and ⌘ numpad +
{
[webView makeTextLarger:nil];
@@ -165,6 +165,11 @@ typedef struct {
#define NSAlertStyleCritical NSCriticalAlertStyle

#define NSEventModifierFlagShift NSShiftKeyMask
#define NSEventModifierFlagControl NSControlKeyMask
#define NSEventModifierFlagOption NSAlternateKeyMask
#define NSEventModifierFlagCommand NSCommandKeyMask
#define NSEventModifierFlagNumericPad NSNumericPadKeyMask
#define NSEventModifierFlagFunction NSFunctionKeyMask
#define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask

@interface NSWindow (Sierra)
@@ -1063,7 +1063,7 @@ - (IBAction)removeNode:(id)sender

// Change the alert's cancel button to have the key equivalent of return
[[buttons objectAtIndex:0] setKeyEquivalent:@"d"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];

[alert setAlertStyle:NSCriticalAlertStyle];
@@ -307,7 +307,7 @@ - (IBAction)removeContentFilter:(id)sender

// Change the alert's cancel button to have the key equivalent of return
[[buttons objectAtIndex:0] setKeyEquivalent:@"r"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];

[alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removeSelectedFilters"];
@@ -304,7 +304,7 @@ - (IBAction)chooseQueryFavorite:(id)sender
// Choose favorite
BOOL replaceContent = [prefs boolForKey:SPQueryFavoriteReplacesContent];

if([[NSApp currentEvent] modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask))
if([[NSApp currentEvent] modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand))
replaceContent = !replaceContent;
if(replaceContent) {
[textView setSelectedRange:NSMakeRange(0,[[textView string] length])];
@@ -331,7 +331,7 @@ - (IBAction)chooseQueryHistory:(id)sender

BOOL replaceContent = [prefs boolForKey:SPQueryHistoryReplacesContent];
[textView breakUndoCoalescing];
if([[NSApp currentEvent] modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask))
if([[NSApp currentEvent] modifierFlags] & (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand))
replaceContent = !replaceContent;
if(replaceContent)
[textView setSelectedRange:NSMakeRange(0,[[textView string] length])];
@@ -418,7 +418,7 @@ - (IBAction)gearMenuItemSelected:(id)sender
// "Completion List" menu item - used to autocomplete. Uses a different shortcut to avoid the menu button flickering
// on normal autocomplete usage.
if (sender == completionListMenuItem) {
if([[NSApp currentEvent] modifierFlags] & (NSControlKeyMask))
if([[NSApp currentEvent] modifierFlags] & (NSEventModifierFlagControl))
[textView doCompletionByUsingSpellChecker:NO fuzzyMode:YES autoCompleteMode:NO];
else
[textView doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:NO];
@@ -545,7 +545,7 @@ - (IBAction)clearQueryHistory:(id)sender

// Change the alert's cancel button to have the key equivalent of return
[[buttons objectAtIndex:0] setKeyEquivalent:@"r"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];

[alert beginSheetModalForWindow:[tableDocumentInstance parentWindow]
@@ -2157,13 +2157,13 @@ - (void)tableView:(NSTableView*)tableView didClickTableColumn:(NSTableColumn *)t

NSMutableString *queryString = [NSMutableString stringWithString:lastExecutedQuery];

NSUInteger modifierFlags = [[NSApp currentEvent] modifierFlags];
NSEventModifierFlags modifierFlags = [[NSApp currentEvent] modifierFlags];

// Sets column order as tri-state descending, ascending, no sort, descending, ascending etc. order if the same
// header is clicked several times
if (sortField && [[tableColumn identifier] integerValue] == [sortField integerValue]) {
BOOL invert = NO;
if (modifierFlags & NSShiftKeyMask) {
if (modifierFlags & NSEventModifierFlagShift) {
invert = YES;
}

@@ -2175,7 +2175,7 @@ - (void)tableView:(NSTableView*)tableView didClickTableColumn:(NSTableColumn *)t
}
} else {
// When the column is not sorted, allow to sort in reverse order using Shift+click
if (modifierFlags & NSShiftKeyMask) {
if (modifierFlags & NSEventModifierFlagShift) {
isDesc = YES;
} else {
isDesc = NO;
@@ -968,7 +968,7 @@ - (IBAction)removeDatabase:(id)sender
#ifndef SP_CODA
// Change the alert's cancel button to have the key equivalent of return
[[buttons objectAtIndex:0] setKeyEquivalent:@"d"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];
#else
[[buttons objectAtIndex:1] setKeyEquivalent:@"\e"]; // Esc = Cancel
@@ -5404,7 +5404,7 @@ - (void)handleSchemeCommand:(NSDictionary*)commandDict
NSEvent* event = [NSApp currentEvent];
if ([event type] == NSKeyDown) {
unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
if (([event modifierFlags] & NSEventModifierFlagCommand) && key == '.') {
userTerminated = YES;
break;
}
@@ -5598,7 +5598,7 @@ - (void)handleSchemeCommand:(NSDictionary*)commandDict
NSEvent* event = [NSApp currentEvent];
if ([event type] == NSKeyDown) {
unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
if (([event modifierFlags] & NSEventModifierFlagCommand) && key == '.') {
userTerminated = YES;
break;
}
@@ -5637,7 +5637,7 @@ - (void)handleSchemeCommand:(NSDictionary*)commandDict
NSEvent* event = [NSApp currentEvent];
if ([event type] == NSKeyDown) {
unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
if (([event modifierFlags] & NSEventModifierFlagCommand) && key == '.') {
userTerminated = YES;
break;
}
@@ -7241,7 +7241,7 @@ - (IBAction)printDocument:(id)sender

// Change the alert's cancel button to have the key equivalent of return
[[buttons objectAtIndex:0] setKeyEquivalent:@"p"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];

[alert beginSheetModalForWindow:[self parentWindow] modalDelegate:self didEndSelector:@selector(printWarningDidEnd:returnCode:contextInfo:) contextInfo:NULL];
@@ -114,21 +114,21 @@ - (void)textDidChange:(NSNotification *)aNotification

- (void)keyDown:(NSEvent *)theEvent
{
long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
NSEventModifierFlags allFlags = (NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand);

// Check if user pressed ⌥ to allow composing of accented characters.
// e.g. for US keyboard "⌥u a" to insert ä
// or for non-US keyboards to allow to enter dead keys
// e.g. for German keyboard ` is a dead key, press space to enter `
if (([theEvent modifierFlags] & allFlags) == NSAlternateKeyMask || [[theEvent characters] length] == 0) {
if (([theEvent modifierFlags] & allFlags) == NSEventModifierFlagOption || [[theEvent characters] length] == 0) {
[super keyDown: theEvent];
return;
}

NSString *charactersIgnMod = [theEvent charactersIgnoringModifiers];
long curFlags = ([theEvent modifierFlags] & allFlags);
NSEventModifierFlags curFlags = ([theEvent modifierFlags] & allFlags);

if (curFlags & NSCommandKeyMask) {
if (curFlags & NSEventModifierFlagCommand) {
if ([charactersIgnMod isEqualToString:@"+"] || [charactersIgnMod isEqualToString:@"="]) // increase text size by 1; ⌘+ and numpad +
{
[self makeTextSizeLarger];
@@ -156,7 +156,7 @@ - (void)keyDown:(NSEvent *)theEvent
// or a RETURN but not for each char due to writing speed
if ([charactersIgnMod isEqualToString:@" "] ||
[theEvent keyCode] == 36 ||
[theEvent modifierFlags] & (NSCommandKeyMask|NSControlKeyMask|NSAlternateKeyMask))
[theEvent modifierFlags] & (NSEventModifierFlagCommand|NSEventModifierFlagControl|NSEventModifierFlagOption))
{
[(SPFieldEditorController *)[self delegate] setDoGroupDueToChars];
}
@@ -1887,7 +1887,7 @@ - (void)errorCreatingExportFileHandles:(NSArray *)files
[alert addButtonWithTitle:NSLocalizedString(@"Replace", @"Replace button")];
[[[alert buttons] objectAtIndex:0] setTag:SPExportErrorReplaceFiles];
[[[alert buttons] objectAtIndex:0] setKeyEquivalent:@"r"];
[[[alert buttons] objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[[alert buttons] objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];

[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"cancel button")];
[[[alert buttons] objectAtIndex:1] setTag:SPExportErrorCancelExport];
@@ -1897,7 +1897,7 @@ - (void)errorCreatingExportFileHandles:(NSArray *)files
[alert addButtonWithTitle:NSLocalizedString(@"Skip existing", @"skip existing button")];
[[[alert buttons] objectAtIndex:2] setTag:SPExportErrorSkipErrorFiles];
[[[alert buttons] objectAtIndex:2] setKeyEquivalent:@"s"];
[[[alert buttons] objectAtIndex:2] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[[alert buttons] objectAtIndex:2] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
}
}
// If one or multiple files failed, but only due to unhandled errors, show a short dialog
@@ -1942,7 +1942,7 @@ - (void)errorCreatingExportFileHandles:(NSArray *)files
[alert addButtonWithTitle:NSLocalizedString(@"Skip problems", @"skip problems button")];
[[[alert buttons] objectAtIndex:1] setTag:SPExportErrorSkipErrorFiles];
[[[alert buttons] objectAtIndex:1] setKeyEquivalent:@"s"];
[[[alert buttons] objectAtIndex:1] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[[alert buttons] objectAtIndex:1] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
}
}

@@ -135,7 +135,7 @@ - (IBAction)updateTableType:(id)sender

// Change the alert's cancel button to have the key equivalent of return
[[buttons objectAtIndex:0] setKeyEquivalent:@"d"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];

NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] initWithCapacity:2];
@@ -97,7 +97,7 @@ - (void)keyDown:(NSEvent *)event
}
// If the Tab key is used, change focus rather than entering edit mode.
if ([[event characters] length] && [[event characters] characterAtIndex:0] == NSTabCharacter) {
if (([event modifierFlags] & NSShiftKeyMask) != NSShiftKeyMask) {
if (([event modifierFlags] & NSEventModifierFlagShift) != NSEventModifierFlagShift) {
[[self window] selectKeyViewFollowingView:self];
}
else {

0 comments on commit 6c52588

Please sign in to comment.
You can’t perform that action at this time.