mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-27 05:05:32 +03:00
MacPDF: Add "Show Images" debug menu entry
PDFViewer has this, and it's useful for PDFs that have the same text both as a scanned bitmap in the background as well as using vector text in the foreground. xib changes: Added a new menu entry connected to `toggleShowImages:`, and also toggled the initial state of two menu entries. (The latter part has no effect when the program runs since we dynamically update this state, but it makes the menu entries show their initial state in Xcode's menu editor.)
This commit is contained in:
parent
98729c97f4
commit
d15785cccc
Notes:
sideshowbarker
2024-07-17 01:00:06 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/d15785cccc Pull-request: https://github.com/SerenityOS/serenity/pull/23582
@ -30,5 +30,6 @@
|
||||
- (IBAction)toggleClipImages:(id)sender;
|
||||
- (IBAction)toggleClipPaths:(id)sender;
|
||||
- (IBAction)toggleClipText:(id)sender;
|
||||
- (IBAction)toggleShowImages:(id)sender;
|
||||
|
||||
@end
|
||||
|
@ -181,6 +181,10 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr<Gfx::Bitmap> bitmap_p)
|
||||
[item setState:_preferences.clip_text ? NSControlStateValueOn : NSControlStateValueOff];
|
||||
return _doc ? YES : NO;
|
||||
}
|
||||
if ([item action] == @selector(toggleShowImages:)) {
|
||||
[item setState:_preferences.show_images ? NSControlStateValueOn : NSControlStateValueOff];
|
||||
return _doc ? YES : NO;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@ -216,6 +220,14 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr<Gfx::Bitmap> bitmap_p)
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)toggleShowImages:(id)sender
|
||||
{
|
||||
if (_doc) {
|
||||
_preferences.show_images = !_preferences.show_images;
|
||||
[self invalidateCachedBitmap];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)keyDown:(NSEvent*)event
|
||||
{
|
||||
// Calls moveLeft: or moveRight: below.
|
||||
|
@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (IBAction)toggleClipImages:(id)sender;
|
||||
- (IBAction)toggleClipPaths:(id)sender;
|
||||
- (IBAction)toggleClipText:(id)sender;
|
||||
- (IBAction)toggleShowImages:(id)sender;
|
||||
- (IBAction)showGoToPageDialog:(id)sender;
|
||||
|
||||
- (void)pdfDidInitialize;
|
||||
|
@ -159,6 +159,11 @@
|
||||
[_pdfView toggleClipText:sender];
|
||||
}
|
||||
|
||||
- (IBAction)toggleShowImages:(id)sender
|
||||
{
|
||||
[_pdfView toggleShowImages:sender];
|
||||
}
|
||||
|
||||
- (IBAction)showGoToPageDialog:(id)sender
|
||||
{
|
||||
auto alert = [[NSAlert alloc] init];
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
@ -670,13 +670,13 @@
|
||||
<action selector="toggleShowClippingPaths:" target="-1" id="ZXz-gM-52n"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Clip Images" id="os0-En-UkL">
|
||||
<menuItem title="Clip Images" state="on" id="os0-En-UkL">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleClipImages:" target="-1" id="bHz-O3-V8K"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Clip Paths" id="KB8-Ld-jv8">
|
||||
<menuItem title="Clip Paths" state="on" id="KB8-Ld-jv8">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleClipPaths:" target="-1" id="pZu-tJ-RFh"/>
|
||||
@ -688,6 +688,12 @@
|
||||
<action selector="toggleClipText:" target="-1" id="qxg-tH-KXd"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show images" state="on" id="ArW-nr-ktv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleShowImages:" target="-1" id="mNE-9J-Nle"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
|
Loading…
Reference in New Issue
Block a user