1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

MacPDF: Add Debug menu items to hook up Clip Images/Paths settings

This commit is contained in:
Nico Weber 2024-01-16 20:53:55 -05:00 committed by Sam Atkins
parent 1845a406ea
commit b5aef8e404
5 changed files with 50 additions and 0 deletions

View file

@ -169,6 +169,14 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr<Gfx::Bitmap> 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<Gfx::Bitmap> 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.