Revision: 12466 http://sourceforge.net/p/skim-app/code/12466 Author: hofman Date: 2021-10-24 13:49:30 +0000 (Sun, 24 Oct 2021) Log Message: ----------- Add toolbar item for Automatically Resize
Modified Paths: -------------- trunk/MainToolbar.xib trunk/NSImage_SKExtensions.h trunk/NSImage_SKExtensions.m trunk/SKMainToolbarController.h trunk/SKMainToolbarController.m trunk/SKPDFView.h trunk/SKPDFView.m trunk/de.lproj/Localizable.strings trunk/en.lproj/Localizable.strings trunk/es.lproj/Localizable.strings trunk/fr.lproj/Localizable.strings trunk/it.lproj/Localizable.strings trunk/ja.lproj/Localizable.strings trunk/nl.lproj/Localizable.strings trunk/pl.lproj/Localizable.strings trunk/ru.lproj/Localizable.strings trunk/zh_CN.lproj/Localizable.strings trunk/zh_TW.lproj/Localizable.strings Modified: trunk/MainToolbar.xib =================================================================== --- trunk/MainToolbar.xib 2021-10-14 15:42:49 UTC (rev 12465) +++ trunk/MainToolbar.xib 2021-10-24 13:49:30 UTC (rev 12466) @@ -1,14 +1,14 @@ <?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="19162" 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="19162"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="SKMainToolbarController"> <connections> + <outlet property="autoScalesButton" destination="RKf-GA-hdu" id="n7o-ZL-0fL"/> <outlet property="backForwardButton" destination="39" id="86"/> <outlet property="bookModeButton" destination="197" id="203"/> <outlet property="circleNoteButton" destination="9" id="118"/> @@ -677,6 +677,19 @@ <binding destination="190" name="value" keyPath="selection.pdfView.pacerSpeed" id="G0d-wg-67j"/> </connections> </stepper> + <segmentedControl verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RKf-GA-hdu"> + <rect key="frame" x="289" y="242" width="33" height="23"/> + <autoresizingMask key="autoresizingMask"/> + <segmentedCell key="cell" borderStyle="border" alignment="left" segmentDistribution="fill" style="texturedSquare" trackingMode="selectAny" id="N4Z-bP-JO7"> + <font key="font" metaFont="system"/> + <segments> + <segment image="ToolbarAutoScales" imageScaling="none" width="27"/> + </segments> + </segmentedCell> + <connections> + <action selector="changeAutoScales:" target="-2" id="N8d-E4-EoP"/> + </connections> + </segmentedControl> </subviews> <constraints> <constraint firstAttribute="bottom" secondItem="38" secondAttribute="bottom" constant="275" id="6OB-P3-1wa"/> @@ -709,6 +722,7 @@ <image name="ToolbarAddTextNote" width="128" height="128"/> <image name="ToolbarAddTextNoteMenu" width="128" height="128"/> <image name="ToolbarAddUnderlineNote" width="128" height="128"/> + <image name="ToolbarAutoScales" width="128" height="128"/> <image name="ToolbarBack" width="128" height="128"/> <image name="ToolbarBookMode" width="128" height="128"/> <image name="ToolbarColors" width="27" height="20"/> Modified: trunk/NSImage_SKExtensions.h =================================================================== --- trunk/NSImage_SKExtensions.h 2021-10-14 15:42:49 UTC (rev 12465) +++ trunk/NSImage_SKExtensions.h 2021-10-24 13:49:30 UTC (rev 12466) @@ -59,6 +59,7 @@ extern NSString *SKImageNameToolbarZoomActual; extern NSString *SKImageNameToolbarZoomToFit; extern NSString *SKImageNameToolbarZoomToSelection; +extern NSString *SKImageNameToolbarAutoScales; extern NSString *SKImageNameToolbarRotateRight; extern NSString *SKImageNameToolbarRotateLeft; extern NSString *SKImageNameToolbarCrop; Modified: trunk/NSImage_SKExtensions.m =================================================================== --- trunk/NSImage_SKExtensions.m 2021-10-14 15:42:49 UTC (rev 12465) +++ trunk/NSImage_SKExtensions.m 2021-10-24 13:49:30 UTC (rev 12466) @@ -63,6 +63,7 @@ NSString *SKImageNameToolbarZoomActual = @"ToolbarZoomActual"; NSString *SKImageNameToolbarZoomToFit = @"ToolbarZoomToFit"; NSString *SKImageNameToolbarZoomToSelection = @"ToolbarZoomToSelection"; +NSString *SKImageNameToolbarAutoScales = @"ToolbarAutoScales"; NSString *SKImageNameToolbarRotateRight = @"ToolbarRotateRight"; NSString *SKImageNameToolbarRotateLeft = @"ToolbarRotateLeft"; NSString *SKImageNameToolbarCrop = @"ToolbarCrop"; @@ -559,7 +560,26 @@ [path stroke]; ); - MAKE_IMAGE(SKImageNameToolbarRotateLeft, YES, 27.0, 21.0, + MAKE_IMAGE(SKImageNameToolbarAutoScales, YES, 27.0, 19.0, + [[NSColor blackColor] setStroke]; + NSBezierPath *path = [NSBezierPath bezierPath]; + [path appendBezierPathWithOvalInRect:NSMakeRect(6.5, 5.5, 10.0, 10.0)]; + [path moveToPoint:NSMakePoint(15.0, 7.0)]; + [path lineToPoint:NSMakePoint(20.0, 2.0)]; + [path stroke]; + path = [NSBezierPath bezierPath]; + [path moveToPoint:NSMakePoint(8.5, 11.0)]; + [path lineToPoint:NSMakePoint(14.5, 11.0)]; + [path lineToPoint:NSMakePoint(11.5, 14.0)]; + [path closePath]; + [path moveToPoint:NSMakePoint(8.5, 10.0)]; + [path lineToPoint:NSMakePoint(14.5, 10.0)]; + [path lineToPoint:NSMakePoint(11.5, 7.0)]; + [path closePath]; + [path fill]; + ); + + MAKE_IMAGE(SKImageNameToolbarRotateLeft, YES, 27.0, 21.0, [[NSColor blackColor] set]; NSBezierPath *path = [NSBezierPath bezierPath]; [path appendBezierPathWithRoundedRect:NSMakeRect(7.5, 4.5, 9.0, 7.0) xRadius:1.0 yRadius:1.0]; Modified: trunk/SKMainToolbarController.h =================================================================== --- trunk/SKMainToolbarController.h 2021-10-14 15:42:49 UTC (rev 12465) +++ trunk/SKMainToolbarController.h 2021-10-24 13:49:30 UTC (rev 12466) @@ -53,6 +53,7 @@ NSSegmentedControl *zoomActualButton; NSSegmentedControl *zoomFitButton; NSSegmentedControl *zoomSelectionButton; + NSSegmentedControl *autoScalesButton; NSSegmentedControl *rotateLeftButton; NSSegmentedControl *rotateRightButton; NSSegmentedControl *rotateLeftRightButton; @@ -92,7 +93,7 @@ } @property (nonatomic, assign) IBOutlet SKMainWindowController *mainController; -@property (nonatomic, retain) IBOutlet NSSegmentedControl *backForwardButton, *previousNextPageButton, *previousPageButton, *nextPageButton, *previousNextFirstLastPageButton, *zoomInOutButton, *zoomInActualOutButton, *zoomActualButton, *zoomFitButton, *zoomSelectionButton, *rotateLeftButton, *rotateRightButton, *rotateLeftRightButton, *cropButton, *fullScreenButton, *presentationButton, *leftPaneButton, *rightPaneButton, *toolModeButton, *textNoteButton, *circleNoteButton, *markupNoteButton, *lineNoteButton, *singleTwoUpButton, *continuousButton, *displayModeButton, *displayDirectionButton, *displaysRTLButton, *bookModeButton, *pageBreaksButton, *displayBoxButton, *infoButton, *colorsButton, *fontsButton, *linesButton, *printButton, *customizeButton, *noteButton, *pacerButton, *shareButton; +@property (nonatomic, retain) IBOutlet NSSegmentedControl *backForwardButton, *previousNextPageButton, *previousPageButton, *nextPageButton, *previousNextFirstLastPageButton, *zoomInOutButton, *zoomInActualOutButton, *zoomActualButton, *zoomFitButton, *zoomSelectionButton, *autoScalesButton, *rotateLeftButton, *rotateRightButton, *rotateLeftRightButton, *cropButton, *fullScreenButton, *presentationButton, *leftPaneButton, *rightPaneButton, *toolModeButton, *textNoteButton, *circleNoteButton, *markupNoteButton, *lineNoteButton, *singleTwoUpButton, *continuousButton, *displayModeButton, *displayDirectionButton, *displaysRTLButton, *bookModeButton, *pageBreaksButton, *displayBoxButton, *infoButton, *colorsButton, *fontsButton, *linesButton, *printButton, *customizeButton, *noteButton, *pacerButton, *shareButton; @property (nonatomic, retain) IBOutlet NSTextField *pageNumberField, *scaleField, *pacerSpeedField; @property (nonatomic, retain) IBOutlet SKColorSwatch *colorSwatch; @property (nonatomic, retain) IBOutlet NSStepper *pacerSpeedStepper; @@ -113,6 +114,7 @@ - (IBAction)zoomInActualOut:(id)sender; - (IBAction)zoomToFit:(id)sender; - (IBAction)zoomToSelection:(id)sender; +- (IBAction)changeAutoScales:(id)sender; - (IBAction)rotateAllLeftRight:(id)sender; - (IBAction)cropAll:(id)sender; - (IBAction)toggleFullscreen:(id)sender; Modified: trunk/SKMainToolbarController.m =================================================================== --- trunk/SKMainToolbarController.m 2021-10-14 15:42:49 UTC (rev 12465) +++ trunk/SKMainToolbarController.m 2021-10-24 13:49:30 UTC (rev 12466) @@ -75,6 +75,7 @@ #define SKDocumentToolbarZoomToFitItemIdentifier @"SKDocumentToolbarZoomToFitItemIdentifier" #define SKDocumentToolbarZoomInOutItemIdentifier @"SKDocumentToolbarZoomInOutItemIdentifier" #define SKDocumentToolbarZoomInActualOutItemIdentifier @"SKDocumentToolbarZoomInActualOutItemIdentifier" +#define SKDocumentToolbarAutoScalesItemIdentifier @"SKDocumentToolbarAutoScalesItemIdentifier" #define SKDocumentToolbarRotateRightItemIdentifier @"SKDocumentToolbarRotateRightItemIdentifier" #define SKDocumentToolbarRotateLeftItemIdentifier @"SKDocumentToolbarRotateLeftItemIdentifier" #define SKDocumentToolbarRotateLeftRightItemIdentifier @"SKDocumentToolbarRotateLeftRightItemIdentifier" @@ -131,7 +132,7 @@ @implementation SKMainToolbarController -@synthesize mainController, backForwardButton, pageNumberField, previousNextPageButton, previousPageButton, nextPageButton, previousNextFirstLastPageButton, zoomInOutButton, zoomInActualOutButton, zoomActualButton, zoomFitButton, zoomSelectionButton, rotateLeftButton, rotateRightButton, rotateLeftRightButton, cropButton, fullScreenButton, presentationButton, leftPaneButton, rightPaneButton, toolModeButton, textNoteButton, circleNoteButton, markupNoteButton, lineNoteButton, singleTwoUpButton, continuousButton, displayModeButton, displayDirectionButton, displaysRTLButton, bookModeButton, pageBreaksButton, displayBoxButton, infoButton, colorsButton, fontsButton, linesButton, printButton, customizeButton, scaleField, noteButton, colorSwatch, pacerButton, pacerSpeedField, pacerSpeedStepper, shareButton; +@synthesize mainController, backForwardButton, pageNumberField, previousNextPageButton, previousPageButton, nextPageButton, previousNextFirstLastPageButton, zoomInOutButton, zoomInActualOutButton, zoomActualButton, zoomFitButton, zoomSelectionButton, autoScalesButton, rotateLeftButton, rotateRightButton, rotateLeftRightButton, cropButton, fullScreenButton, presentationButton, leftPaneButton, rightPaneButton, toolModeButton, textNoteButton, circleNoteButton, markupNoteButton, lineNoteButton, singleTwoUpButton, continuousButton, displayModeButton, displayDirectionButton, displaysRTLButton, bookModeButton, pageBreaksButton, displayBoxButton, infoButton, colorsButton, fontsButton, linesButton, printButton, customizeButton, scaleField, noteButton, colorSwatch, pacerButton, pacerSpeedField, pacerSpeedStepper, shareButton; - (void)dealloc { mainController = nil; @@ -146,6 +147,7 @@ SKDESTROY(zoomActualButton); SKDESTROY(zoomFitButton); SKDESTROY(zoomSelectionButton); + SKDESTROY(autoScalesButton); SKDESTROY(rotateLeftButton); SKDESTROY(rotateRightButton); SKDESTROY(rotateLeftRightButton); @@ -390,6 +392,16 @@ [item setViewWithSizes:zoomInActualOutButton]; [item setMenuFormRepresentation:menuItem]; + } else if ([identifier isEqualToString:SKDocumentToolbarAutoScalesItemIdentifier]) { + + menuItem = [NSMenuItem menuItemWithTitle:NSLocalizedString(@"Automatically Resize", @"Menu item title") action:@selector(toggleAutoScale:) target:mainController]; + + [item setLabels:NSLocalizedString(@"Automatically Resize", @"Toolbar item label")]; + [item setToolTip:NSLocalizedString(@"Automatically Resize", @"Tool tip message")]; + [autoScalesButton setHelp:NSLocalizedString(@"Automatically Resize", @"Tool tip message") forSegment:0]; + [item setViewWithSizes:autoScalesButton]; + [item setMenuFormRepresentation:menuItem]; + } else if ([identifier isEqualToString:SKDocumentToolbarRotateRightItemIdentifier]) { menuItem = [NSMenuItem menuItemWithTitle:NSLocalizedString(@"Rotate Right", @"Menu item title") action:@selector(rotateAllRight:) target:mainController]; @@ -900,6 +912,7 @@ SKDocumentToolbarZoomActualItemIdentifier, SKDocumentToolbarZoomToFitItemIdentifier, SKDocumentToolbarZoomToSelectionItemIdentifier, + SKDocumentToolbarAutoScalesItemIdentifier, SKDocumentToolbarScaleItemIdentifier, SKDocumentToolbarDisplayModeItemIdentifier, SKDocumentToolbarSingleTwoUpItemIdentifier, @@ -945,6 +958,7 @@ SKDocumentToolbarZoomActualItemIdentifier, SKDocumentToolbarZoomToFitItemIdentifier, SKDocumentToolbarZoomToSelectionItemIdentifier, + SKDocumentToolbarAutoScalesItemIdentifier, SKDocumentToolbarScaleItemIdentifier, SKDocumentToolbarDisplayModeItemIdentifier, SKDocumentToolbarSingleTwoUpItemIdentifier, @@ -994,9 +1008,9 @@ } else if ([identifier isEqualToString:SKDocumentToolbarZoomToSelectionItemIdentifier]) { return [mainController.pdfView.document isLocked] == NO && [mainController hasOverview] == NO && NSIsEmptyRect([mainController.pdfView currentSelectionRect]) == NO; } else if ([identifier isEqualToString:SKDocumentToolbarZoomInOutItemIdentifier] || - [identifier isEqualToString:SKDocumentToolbarZoomInActualOutItemIdentifier]) { - return [mainController hasOverview] == NO; - } else if ([identifier isEqualToString:SKDocumentToolbarScaleItemIdentifier]) { + [identifier isEqualToString:SKDocumentToolbarZoomInActualOutItemIdentifier] || + [identifier isEqualToString:SKDocumentToolbarAutoScalesItemIdentifier] || + [identifier isEqualToString:SKDocumentToolbarScaleItemIdentifier]) { return [mainController.pdfView.document isLocked] == NO && [mainController hasOverview] == NO; } else if ([identifier isEqualToString:SKDocumentToolbarPageNumberItemIdentifier]) { return [mainController.pdfView.document isLocked] == NO; @@ -1145,6 +1159,10 @@ [mainController doZoomToSelection:sender]; } +- (IBAction)changeAutoScales:(id)sender { + [mainController toggleAutoScale:sender]; +} + - (IBAction)rotateAllLeftRight:(id)sender { if ([sender selectedTag] == 1) [mainController rotateAllRight:sender]; @@ -1305,8 +1323,14 @@ [zoomInActualOutButton setEnabled:[mainController.pdfView.document isLocked] == NO forSegment:1]; [zoomInActualOutButton setEnabled:[mainController.pdfView canZoomIn] forSegment:2]; [zoomActualButton setEnabled:[mainController.pdfView.document isLocked] == NO]; + + [autoScalesButton setSelected:[mainController.pdfView autoScales] forSegment:0]; } +- (void)handleAutoScalesChangedNotification:(NSNotification *)notification { + [autoScalesButton setSelected:[mainController.pdfView autoScales] forSegment:0]; +} + - (void)handleToolModeChangedNotification:(NSNotification *)notification { [toolModeButton selectSegmentWithTag:[mainController.pdfView toolMode]]; } @@ -1366,9 +1390,11 @@ name:PDFViewScaleChangedNotification object:mainController.pdfView]; [nc addObserver:self selector:@selector(handleBookModeChangedNotification:) name:SKPDFViewDisplaysAsBookChangedNotification object:mainController.pdfView]; - [nc addObserver:self selector:@selector(handlePageBreaksChangedNotification:) + [nc addObserver:self selector:@selector(handlePageBreaksChangedNotification:) name:SKPDFViewDisplaysPageBreaksChangedNotification object:mainController.pdfView]; - [nc addObserver:self selector:@selector(handleToolModeChangedNotification:) + [nc addObserver:self selector:@selector(handleAutoScalesChangedNotification:) + name:SKPDFViewAutoScalesChangedNotification object:mainController.pdfView]; + [nc addObserver:self selector:@selector(handleToolModeChangedNotification:) name:SKPDFViewToolModeChangedNotification object:mainController.pdfView]; [nc addObserver:self selector:@selector(handleAnnotationModeChangedNotification:) name:SKPDFViewAnnotationModeChangedNotification object:mainController.pdfView]; Modified: trunk/SKPDFView.h =================================================================== --- trunk/SKPDFView.h 2021-10-14 15:42:49 UTC (rev 12465) +++ trunk/SKPDFView.h 2021-10-24 13:49:30 UTC (rev 12466) @@ -45,6 +45,7 @@ extern NSString *SKPDFViewDisplaysPageBreaksChangedNotification; extern NSString *SKPDFViewDisplaysHorizontallyChangedNotification; extern NSString *SKPDFViewDisplaysRTLChangedNotification; +extern NSString *SKPDFViewAutoScalesChangedNotification; extern NSString *SKPDFViewToolModeChangedNotification; extern NSString *SKPDFViewToolModeChangedNotification; extern NSString *SKPDFViewAnnotationModeChangedNotification; Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2021-10-14 15:42:49 UTC (rev 12465) +++ trunk/SKPDFView.m 2021-10-24 13:49:30 UTC (rev 12466) @@ -119,6 +119,7 @@ NSString *SKPDFViewDisplaysPageBreaksChangedNotification = @"SKPDFViewDisplaysPageBreaksChangedNotification"; NSString *SKPDFViewDisplaysHorizontallyChangedNotification = @"SKPDFViewDisplaysHorizontallyChangedNotification"; NSString *SKPDFViewDisplaysRTLChangedNotification = @"SKPDFViewDisplaysRTLChangedNotification"; +NSString *SKPDFViewAutoScalesChangedNotification = @"SKPDFViewAutoScalesChangedNotification"; NSString *SKPDFViewToolModeChangedNotification = @"SKPDFViewToolModeChangedNotification"; NSString *SKPDFViewAnnotationModeChangedNotification = @"SKPDFViewAnnotationModeChangedNotification"; NSString *SKPDFViewActiveAnnotationDidChangeNotification = @"SKPDFViewActiveAnnotationDidChangeNotification"; @@ -860,10 +861,17 @@ [super setDisplaysPageBreaks:pageBreaks]; [self resetPDFToolTipRects]; [editor layoutWithEvent:nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewDisplaysPageBreaksChangedNotification object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewDisplaysPageBreaksChangedNotification object:self]; } } +- (void)setAutoScales:(BOOL)autoScales { + if (autoScales != [self autoScales]) { + [super setAutoScales:autoScales]; + [[NSNotificationCenter defaultCenter] postNotificationName:SKPDFViewAutoScalesChangedNotification object:self]; + } +} + - (void)setCurrentSelection:(PDFSelection *)selection { if (toolMode == SKNoteToolMode && annotationMode == SKHighlightNote) [selection setColor:[[NSUserDefaults standardUserDefaults] colorForKey:SKHighlightNoteColorKey]]; Modified: trunk/de.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/en.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/es.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/fr.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/it.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/ja.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/nl.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/pl.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/ru.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/zh_CN.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/zh_TW.lproj/Localizable.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