Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Catalina (10.14+) #2

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
10e24c8
ADD .gitignore
Dec 19, 2019
92cef02
FIX target to 64bit
Dec 19, 2019
8072608
FIX 'Gestalt' is deprecated for appcast url
Dec 19, 2019
a59ed4b
FIX propertyListFromData deprecated
Dec 19, 2019
eb858f0
FIX 'NSLeftMouseDraggedMask', 'NSLeftMouseUp', 'NSLeftMouseUpMask' de…
Dec 19, 2019
7fcb03a
FIX 'NSUnarchiver', 'NSArchiver', 'NSCompositeSourceOver' deprecated
Dec 19, 2019
192e620
FIX 'NSLeftMouseDraggedMask', 'NSLeftMouseUp', 'NSLeftMouseUpMask' de…
Dec 19, 2019
cee6b98
FIX 'NSOnState', 'NSOffState', 'NSDeviceIndependentModifierFlagsMask'…
Dec 19, 2019
a773654
FIX 'NSLeftMouseDraggedMask', 'NSLeftMouseUp', 'NSLeftMouseUpMask' de…
Dec 19, 2019
5f8ec0c
FIX 'NSAlternateKeyMask', 'NSCommandKeyMask' is deprecated
Dec 19, 2019
158d201
FIX 'NSLeftMouseDraggedMask', 'NSLeftMouseUp', 'NSShiftKeyMask' depre…
Dec 19, 2019
cc534c4
FIX 'NSUnarchiver', 'unarchiveObjectWithData', 'NSArchiver', 'archive…
Dec 19, 2019
87a73f5
FIX NSOnState deprecated
Dec 19, 2019
afdd4bb
FIX ERROR Format String Issue
Dec 19, 2019
662d417
FIX dataFromPropertyList propertyListFromData deprecated - NOT FIXED …
Dec 19, 2019
60e76e4
FIX deprecated
Dec 19, 2019
0af37cc
FIX 'filename' is deprecated: first deprecated in macOS 10.6 - Use -U…
Dec 19, 2019
17cb949
FIX beginSheetForDirectory is deprecated
Dec 19, 2019
4e74561
TODO fix scrolling
Dec 20, 2019
b27dc39
FIX 'drawWithBox:' is deprecated
Dec 20, 2019
9e296a9
FIX building issues
Dec 22, 2019
a16d97a
FIX l18n
Dec 22, 2019
19a2c38
FIX alert for loading Frameworks libs
Dec 22, 2019
81b4c0e
Cleanup removing comments and old code
Dec 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Created by https://www.gitignore.io/api/xcode
# Edit at https://www.gitignore.io/?templates=xcode

### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Xcode Patch
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno

### Xcode Patch ###
**/xcshareddata/WorkspaceSettings.xcsettings

# End of https://www.gitignore.io/api/xcode
File renamed without changes.
4 changes: 2 additions & 2 deletions FPCheckmark.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ - (BOOL)placeWithEvent:(NSEvent *)theEvent

// get ready for next iteration of the loop, or break out of loop
theEvent = [[_docView window] nextEventMatchingMask:
(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
if ([theEvent type] == NSLeftMouseUp)
(NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp)];
if ([theEvent type] == NSEventTypeLeftMouseUp)
break;
}

Expand Down
40 changes: 23 additions & 17 deletions FPDocumentView.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,15 @@ - (void)scrollToMidpointOnPage:(unsigned int)page point:(NSPoint)midPoint
NSPoint viewPoint = [self convertPoint:midPoint fromPage:page];
NSPoint viewOrigin = NSMakePoint(floorf(viewPoint.x - viewWidth/2.0),
floorf(viewPoint.y - viewHeight/2.0));
/*
TODO
Fix the error:
Sending 'NSPoint' (aka 'struct CGPoint') to parameter of incompatible type 'NSRect' (aka 'struct CGRect')
[[_scrollView contentView] scrollToPoint:
[[_scrollView contentView] constrainScrollPoint:viewOrigin]];
[[_scrollView contentView] constrainBoundsRect:viewOrigin]];
*/
[[_scrollView contentView] scrollToPoint:viewOrigin];

[_scrollView reflectScrolledClipView:[_scrollView contentView]];
}

Expand Down Expand Up @@ -302,7 +309,8 @@ - (void)drawRect:(NSRect)rect
[at concat];

if (!_is_printing || [_doc drawsOriginalPDF])
[[_pdf_document pageAtIndex:i] drawWithBox:_box];
[[_pdf_document pageAtIndex:i] drawWithBox:_box
toContext:theContext.CGContext];

for (unsigned int j = 0; j < [_overlayGraphics count]; j++) {
FPGraphic *g;
Expand Down Expand Up @@ -453,9 +461,8 @@ - (void)moveSelectionWithEvent:(NSEvent *)theEvent
for (;;) {
// get ready for next iteration of the loop, or break out of loop
theEvent =
[[self window] nextEventMatchingMask:(NSLeftMouseDraggedMask |
NSLeftMouseUpMask)];
if ([theEvent type] == NSLeftMouseUp)
[[self window] nextEventMatchingMask:(NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp)];
if ([theEvent type] == NSEventTypeLeftMouseUp)
break;

// main loop body
Expand Down Expand Up @@ -586,7 +593,7 @@ - (void)mouseDown:(NSEvent *)theEvent
if (([graphic page] == page) &&
NSPointInRect(pagePoint, [graphic safeBounds])) {
// we hit 'graphic'
if ([theEvent modifierFlags] & NSShiftKeyMask) {
if ([theEvent modifierFlags] & NSEventModifierFlagShift) {
[_selectedGraphics invertMembershipForObject:graphic];
[[NSNotificationCenter defaultCenter] postNotificationName:FPSelectionChangedNotification
object:[self window]
Expand Down Expand Up @@ -630,7 +637,7 @@ - (void)mouseDown:(NSEvent *)theEvent
} else {
if ([_selectedGraphics count]) {
[self setNeedsDisplay:YES];
if ([theEvent modifierFlags] & NSAlternateKeyMask) {
if ([theEvent modifierFlags] & NSEventModifierFlagOption) {
DLog(@"will copy\n");
// if option key is down, and a drag is begun,
// copy the elements and drag those new ones
Expand Down Expand Up @@ -762,23 +769,22 @@ - (IBAction)placeImage:(id)sender
DLog(@"DocView's plageImage\n");
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:NO];
[panel beginSheetForDirectory:nil
file:nil
types:nil
modalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
contextInfo:nil];
[panel beginSheetModalForWindow:[self window]
completionHandler:^(NSInteger returnCode) {
[self openPanelDidEnd:panel
returnCode:returnCode
contextInfo:NULL ];
} ];

}

- (void)openPanelDidEnd:(NSOpenPanel *)panel
returnCode:(int)returnCode
contextInfo:(void *)contextInfo
{
if (NSOKButton != returnCode) return;

if (NSModalResponseOK != returnCode) return;
NSImage *image = [[[NSImage alloc]
initWithContentsOfFile:[panel filename]] autorelease];
initWithContentsOfFile:[[panel URL] path]] autorelease];

if (nil == image) {
// failed to open
Expand Down
4 changes: 2 additions & 2 deletions FPDocumentWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ - (void)flagsChanged:(NSEvent *)theEvent
{
DLog(@"flags changed\n");
if ((NO == _sentQuickMove) &&
([theEvent modifierFlags] & NSAlternateKeyMask) &&
([theEvent modifierFlags] & NSCommandKeyMask) &&
([theEvent modifierFlags] & NSEventModifierFlagOption) &&
([theEvent modifierFlags] & NSEventModifierFlagCommand) &&
([_docView shouldEnterQuickMove])) {
DLog(@"got apple-option\n");
[[NSNotificationCenter defaultCenter] postNotification:
Expand Down
22 changes: 9 additions & 13 deletions FPGraphic.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,9 @@ - (id)initWithArchivalDictionary:(NSDictionary *)dict
_strokeWidth =
[[dict objectForKey:strokeWidthArchiveKey] floatValue];
_fillColor =
[[NSUnarchiver
unarchiveObjectWithData:
[dict objectForKey:fillColorArchiveKey]] retain];
[[NSKeyedUnarchiver unarchivedObjectOfClass:[NSColor class] fromData:[dict objectForKey:fillColorArchiveKey] error:nil] retain];
_strokeColor =
[[NSUnarchiver
unarchiveObjectWithData:
[dict objectForKey:strokeColorArchiveKey]] retain];
[[NSKeyedUnarchiver unarchivedObjectOfClass:[NSColor class] fromData:[dict objectForKey:strokeColorArchiveKey] error:nil] retain];
_knobMask =
[[dict objectForKey:knobMaskArchiveKey] intValue];
_gFlags.hidesWhenPrinting =
Expand All @@ -171,9 +167,9 @@ - (NSDictionary *)archivalDictionary
forKey:drawsStrokeArchiveKey];
[ret setObject:[NSNumber numberWithFloat:_strokeWidth]
forKey:strokeWidthArchiveKey];
[ret setObject:[NSArchiver archivedDataWithRootObject:_fillColor]
[ret setObject:[NSKeyedArchiver archivedDataWithRootObject:_fillColor requiringSecureCoding:YES error:nil]
forKey:fillColorArchiveKey];
[ret setObject:[NSArchiver archivedDataWithRootObject:_strokeColor]
[ret setObject:[NSKeyedArchiver archivedDataWithRootObject:_strokeColor requiringSecureCoding:YES error:nil]
forKey:strokeColorArchiveKey];
[ret setObject:[NSNumber numberWithInt:_knobMask]
forKey:knobMaskArchiveKey];
Expand Down Expand Up @@ -218,8 +214,8 @@ - (BOOL)placeWithEvent:(NSEvent *)theEvent

// get ready for next iteration of the loop, or break out of loop
theEvent = [[_docView window] nextEventMatchingMask:
(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
if ([theEvent type] == NSLeftMouseUp)
(NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp)];
if ([theEvent type] == NSEventTypeLeftMouseUp)
break;
}
assert(_hasPage);
Expand Down Expand Up @@ -365,7 +361,7 @@ - (void)resizeWithEvent:(NSEvent *)theEvent byKnob:(int)knob
}
}

if ([theEvent modifierFlags] & NSShiftKeyMask) {
if ([theEvent modifierFlags] & NSEventModifierFlagShift) {
BOOL didFlip;
switch (knob) {
case UpperRightKnob:
Expand Down Expand Up @@ -395,8 +391,8 @@ - (void)resizeWithEvent:(NSEvent *)theEvent byKnob:(int)knob

// get ready for next iteration of the loop, or break out of loop
theEvent = [[_docView window] nextEventMatchingMask:
(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
if ([theEvent type] == NSLeftMouseUp)
(NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp)];
if ([theEvent type] == NSEventTypeLeftMouseUp)
break;
}
[_docView discardCursorRects];
Expand Down
10 changes: 6 additions & 4 deletions FPImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ - (id)initWithArchivalDictionary:(NSDictionary *)dict
self = [super initWithArchivalDictionary:dict
inDocumentView:docView];
if (self) {
_image = [[NSUnarchiver unarchiveObjectWithData:
[dict objectForKey:imageArchiveKey]] retain];
_image=[[NSKeyedUnarchiver unarchivedObjectOfClass:[FPImage class]
fromData:[dict objectForKey:imageArchiveKey] error:nil] retain];
}
return self;
}
Expand All @@ -47,7 +47,9 @@ - (NSDictionary *)archivalDictionary
NSMutableDictionary *ret =
[NSMutableDictionary
dictionaryWithDictionary:[super archivalDictionary]];
[ret setObject:[NSArchiver archivedDataWithRootObject:_image]
[ret setObject:[NSKeyedArchiver archivedDataWithRootObject:_image
requiringSecureCoding:YES
error:nil]
forNonexistentKey:imageArchiveKey];
return ret;
}
Expand Down Expand Up @@ -81,7 +83,7 @@ - (void)draw:(BOOL)selected
{
[_image drawInRect:[self bounds]
fromRect:NSZeroRect
operation:NSCompositeSourceOver
operation:NSCompositingOperationSourceOver
fraction:1.0]; // 1.0 means fully opaque
}

Expand Down
4 changes: 2 additions & 2 deletions FPInspectorController.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)awakeFromNib

- (void)cascadeEnabledness
{
BOOL doStroke = ([_strokeCheckbox state] == NSOnState);
BOOL doStroke = ([_strokeCheckbox state] == NSControlStateValueOn);
[_widthTextField setEnabled:doStroke];
[_widthStepper setEnabled:doStroke];
[_strokeColorWell setEnabled:doStroke];
Expand All @@ -46,7 +46,7 @@ - (void)cascadeEnabledness
[_widthLabel setTextColor:[NSColor grayColor]];
}

BOOL doFill = ([_fillCheckbox state] == NSOnState);
BOOL doFill = ([_fillCheckbox state] == NSControlStateValueOn);
[_fillColorWell setEnabled:doFill];
}

Expand Down
4 changes: 2 additions & 2 deletions FPRectangle.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ - (BOOL)placeWithEvent:(NSEvent *)theEvent
_naturalBounds.size = NSMakeSize(1.0, 1.0);

// if the next event is mouse up, then the user didn't drag at all, so scrap the shape.
theEvent = [[_docView window] nextEventMatchingMask:(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
if ([theEvent type] == NSLeftMouseUp)
theEvent = [[_docView window] nextEventMatchingMask:(NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp)];
if ([theEvent type] == NSEventTypeLeftMouseUp)
return NO;
// ok, we have a shape, and user is dragging to size it
[self resizeWithEvent:theEvent byKnob:LowerRightKnob];
Expand Down
6 changes: 3 additions & 3 deletions FPSquiggle.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ - (BOOL)placeWithEvent:(NSEvent *)theEvent

// get ready for next iteration of the loop, or break out of loop
point = new_point;

theEvent = [[_docView window] nextEventMatchingMask:
(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
if ([theEvent type] == NSLeftMouseUp)
(NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp)];
if ([theEvent type] == NSEventTypeLeftMouseUp)
break;
}
_bounds = [_path bounds];
Expand Down
6 changes: 3 additions & 3 deletions FPTextAreaB.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ - (NSDictionary *)archivalDictionary
forNonexistentKey:editorFrameKey];
NSData *d =
[_textStorage RTFFromRange:NSMakeRange(0, [_textStorage length])
documentAttributes:nil];
documentAttributes: @{}];
NSString *rtfstr =
[[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];

Expand Down Expand Up @@ -149,9 +149,9 @@ - (BOOL)placeWithEvent:(NSEvent *)theEvent

// if the next event is mouse up, then the user didn't drag at all
theEvent = [[_docView window] nextEventMatchingMask:
(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
(NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp)];
_isAutoSizedX = _isAutoSizedY = YES;
if ([theEvent type] != NSLeftMouseUp) {
if ([theEvent type] != NSEventTypeLeftMouseUp) {
[self resizeWithEvent:theEvent byKnob:LowerRightKnob];
}
_isPlacing = NO;
Expand Down
8 changes: 4 additions & 4 deletions FPTipsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ - (void)awakeFromNib
DLog(@"unable to load tips.plist\n");
return;
}
_tips = [NSPropertyListSerialization propertyListFromData:data
mutabilityOption:NSPropertyListImmutable
format:nil
errorDescription:nil];
_tips = [NSPropertyListSerialization propertyListWithData:data
options:NSPropertyListImmutable
format:nil
error:nil];
[_tips retain];
_tipOnDisplay = [self getNextTipIndexFromDefaults];
[self displayTip:_tipOnDisplay];
Expand Down
8 changes: 4 additions & 4 deletions FPToolPaletteController.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ + (FPToolPaletteController *)sharedToolPaletteController
- (IBAction)chooseTool:(id)sender
{
[_buttonArray makeObjectsPerformSelector:@selector(setState:)
withObject:(id)NSOffState];
[sender setState:NSOnState];
withObject:(id)NSControlStateValueOff];
[sender setState:NSControlStateValueOn];
[[NSNotificationCenter defaultCenter] postNotification:
[NSNotification notificationWithName:FPToolChosen
object:self]];
Expand All @@ -78,7 +78,7 @@ - (unsigned int)currentTool
for (unsigned int i = 0; i < [_buttonArray count]; i++) {
NSButton *b = [_buttonArray objectAtIndex:i];
DLog(@"button = 0x%08x\n", (unsigned)b);
if ([[_buttonArray objectAtIndex:i] state] == NSOnState)
if ([[_buttonArray objectAtIndex:i] state] == NSControlStateValueOn)
return i;
}
assert(0);
Expand All @@ -103,7 +103,7 @@ - (void)keyDown:(NSEvent *)theEvent
if (1 != [[theEvent charactersIgnoringModifiers] length])
return;
// we don't want any modifiers, except numeric pad is okay
if ((NSDeviceIndependentModifierFlagsMask ^ NSNumericPadKeyMask) & [theEvent modifierFlags]) {
if ((NSEventModifierFlagDeviceIndependentFlagsMask ^ NSEventModifierFlagNumericPad) & [theEvent modifierFlags]) {
return;
}
unichar c = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
Expand Down
Loading