diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFView.h b/Meta/Lagom/Contrib/MacPDF/MacPDFView.h index 298a7297a9..1f176809ee 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFView.h +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFView.h @@ -27,5 +27,7 @@ - (IBAction)goToPreviousPage:(id)sender; - (IBAction)toggleShowClippingPaths:(id)sender; +- (IBAction)toggleClipImages:(id)sender; +- (IBAction)toggleClipPaths:(id)sender; @end diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm b/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm index 37ca793afa..5245034104 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm @@ -169,6 +169,14 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr bitmap_p) [item setState:_preferences.show_clipping_paths ? NSControlStateValueOn : NSControlStateValueOff]; return _doc ? YES : NO; } + if ([item action] == @selector(toggleClipImages:)) { + [item setState:_preferences.clip_images ? NSControlStateValueOn : NSControlStateValueOff]; + return _doc ? YES : NO; + } + if ([item action] == @selector(toggleClipPaths:)) { + [item setState:_preferences.clip_paths ? NSControlStateValueOn : NSControlStateValueOff]; + return _doc ? YES : NO; + } return NO; } @@ -180,6 +188,22 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr bitmap_p) } } +- (IBAction)toggleClipImages:(id)sender +{ + if (_doc) { + _preferences.clip_images = !_preferences.clip_images; + [self invalidateCachedBitmap]; + } +} + +- (IBAction)toggleClipPaths:(id)sender +{ + if (_doc) { + _preferences.clip_paths = !_preferences.clip_paths; + [self invalidateCachedBitmap]; + } +} + - (void)keyDown:(NSEvent*)event { // Calls moveLeft: or moveRight: below. diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h index e579318f24..a3387dc2d5 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h @@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN - (IBAction)goToNextPage:(id)sender; - (IBAction)goToPreviousPage:(id)sender; - (IBAction)toggleShowClippingPaths:(id)sender; +- (IBAction)toggleClipImages:(id)sender; +- (IBAction)toggleClipPaths:(id)sender; - (IBAction)showGoToPageDialog:(id)sender; - (void)pdfDidInitialize; diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm index 4d2caf2b88..fa355c395f 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm @@ -144,6 +144,16 @@ [_pdfView toggleShowClippingPaths:sender]; } +- (IBAction)toggleClipImages:(id)sender +{ + [_pdfView toggleClipImages:sender]; +} + +- (IBAction)toggleClipPaths:(id)sender +{ + [_pdfView toggleClipPaths:sender]; +} + - (IBAction)showGoToPageDialog:(id)sender { auto alert = [[NSAlert alloc] init]; diff --git a/Meta/Lagom/Contrib/MacPDF/MainMenu.xib b/Meta/Lagom/Contrib/MacPDF/MainMenu.xib index 9ddfae8b46..9e833db67e 100644 --- a/Meta/Lagom/Contrib/MacPDF/MainMenu.xib +++ b/Meta/Lagom/Contrib/MacPDF/MainMenu.xib @@ -670,6 +670,18 @@ + + + + + + + + + + + +