Revision: 12413 http://sourceforge.net/p/skim-app/code/12413 Author: hofman Date: 2021-09-18 17:53:40 +0000 (Sat, 18 Sep 2021) Log Message: ----------- Add an alternate action to reset the cropping of pages
Modified Paths: -------------- trunk/Base.lproj/MainMenu.xib trunk/SKMainWindowController_Actions.h trunk/SKMainWindowController_Actions.m trunk/SKMainWindowController_UI.m trunk/de.lproj/MainMenu.strings trunk/en.lproj/MainMenu.strings trunk/es.lproj/MainMenu.strings trunk/fr.lproj/MainMenu.strings trunk/it.lproj/MainMenu.strings trunk/ja.lproj/MainMenu.strings trunk/nl.lproj/MainMenu.strings trunk/pl.lproj/MainMenu.strings trunk/ru.lproj/MainMenu.strings trunk/zh_CN.lproj/MainMenu.strings trunk/zh_TW.lproj/MainMenu.strings Modified: trunk/Base.lproj/MainMenu.xib =================================================================== --- trunk/Base.lproj/MainMenu.xib 2021-09-18 17:30:20 UTC (rev 12412) +++ trunk/Base.lproj/MainMenu.xib 2021-09-18 17:53:40 UTC (rev 12413) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> <deployment identifier="macosx"/> <development version="8000" identifier="xcode"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="NSApplication"> @@ -1129,6 +1129,12 @@ <action selector="smartAutoCropAll:" target="-1" id="787"/> </connections> </menuItem> + <menuItem title="Reset Crop" alternate="YES" keyEquivalent="K" id="3CO-Cw-8Fj"> + <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> + <connections> + <action selector="resetCrop:" target="-1" id="Tk5-g7-0Xj"/> + </connections> + </menuItem> <menuItem title="Crop Page" keyEquivalent="k" id="764"> <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> <connections> Modified: trunk/SKMainWindowController_Actions.h =================================================================== --- trunk/SKMainWindowController_Actions.h 2021-09-18 17:30:20 UTC (rev 12412) +++ trunk/SKMainWindowController_Actions.h 2021-09-18 17:53:40 UTC (rev 12413) @@ -90,6 +90,7 @@ - (IBAction)cropAll:(id)sender; - (IBAction)autoCropAll:(id)sender; - (IBAction)smartAutoCropAll:(id)sender; +- (IBAction)resetCrop:(id)sender; - (IBAction)autoSelectContent:(id)sender; - (IBAction)getInfo:(id)sender; - (IBAction)delete:(id)sender; Modified: trunk/SKMainWindowController_Actions.m =================================================================== --- trunk/SKMainWindowController_Actions.m 2021-09-18 17:30:20 UTC (rev 12412) +++ trunk/SKMainWindowController_Actions.m 2021-09-18 17:53:40 UTC (rev 12413) @@ -698,6 +698,30 @@ [self dismissProgressSheet]; } +- (IBAction)resetCrop:(id)sender { + NSPointerArray *rectArray = [NSPointerArray rectPointerArray]; + BOOL hasChanges = NO; + PDFDocument *pdfDoc = [pdfView document]; + NSInteger i, iMax = [[pdfView document] pageCount]; + + [self beginProgressSheetWithMessage:[NSLocalizedString(@"Cropping Pages", @"Message for progress sheet") stringByAppendingEllipsis] maxValue:iMax]; + + for (i = 0; i < iMax; i++) { + PDFPage *page = [pdfDoc pageAtIndex:i] ; + NSRect rect = NSRectFromCGRect(CGPDFPageGetBoxRect([page pageRef], kCGPDFCropBox)); + if (hasChanges == NO && NSEqualRects(rect, [page boundsForBox:kPDFDisplayBoxCropBox]) == NO) + hasChanges = YES; + [rectArray addPointer:&rect]; + [self incrementProgressSheet]; + if (i && i % 10 == 0) + [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; + } + if (hasChanges) + [self cropPagesToRects:rectArray]; + + [self dismissProgressSheet]; +} + - (IBAction)autoSelectContent:(id)sender { [pdfView autoSelectContent:sender]; } Modified: trunk/SKMainWindowController_UI.m =================================================================== --- trunk/SKMainWindowController_UI.m 2021-09-18 17:30:20 UTC (rev 12412) +++ trunk/SKMainWindowController_UI.m 2021-09-18 17:53:40 UTC (rev 12413) @@ -1699,7 +1699,7 @@ return [[self pdfDocument] isLocked] == NO && [self hasOverview] == NO; } else if (action == @selector(rotateRight:) || action == @selector(rotateLeft:) || action == @selector(rotateAllRight:) || action == @selector(rotateAllLeft:)) { return [[self pdfDocument] isLocked] == NO; - } else if (action == @selector(cropAll:) || action == @selector(crop:) || action == @selector(autoCropAll:) || action == @selector(smartAutoCropAll:)) { + } else if (action == @selector(cropAll:) || action == @selector(crop:) || action == @selector(autoCropAll:) || action == @selector(smartAutoCropAll:) || action == @selector(resetCrop:)) { return [self interactionMode] != SKPresentationMode && [[self pdfDocument] isLocked] == NO; } else if (action == @selector(autoSelectContent:)) { return [self interactionMode] != SKPresentationMode && [self hasOverview] == NO && [[self pdfDocument] isLocked] == NO && [pdfView toolMode] == SKSelectToolMode; Modified: trunk/de.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/en.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/es.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/fr.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/it.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/ja.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/nl.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/pl.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/ru.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/zh_CN.lproj/MainMenu.strings =================================================================== (Binary files differ) Modified: trunk/zh_TW.lproj/MainMenu.strings =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit