Revision: 14980 http://sourceforge.net/p/skim-app/code/14980 Author: hofman Date: 2025-03-17 17:50:11 +0000 (Mon, 17 Mar 2025) Log Message: ----------- Add a toolbar item to toggle the note toolbar
Modified Paths: -------------- trunk/MainToolbar.xib trunk/NSImage_SKExtensions.h trunk/NSImage_SKExtensions.m trunk/SKMainToolbarController.h trunk/SKMainToolbarController.m trunk/SKMainWindowController.h trunk/SKMainWindowController.m trunk/SKMainWindowController_Actions.m trunk/de.lproj/Localizable.strings trunk/en.lproj/Localizable.strings trunk/en.lproj/MainMenu.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 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/MainToolbar.xib 2025-03-17 17:50:11 UTC (rev 14980) @@ -30,6 +30,7 @@ <outlet property="markupNoteButton" destination="8" id="120"/> <outlet property="nextPageButton" destination="20" id="85"/> <outlet property="noteButton" destination="34" id="98"/> + <outlet property="notesButton" destination="QAZ-7p-tLt" id="Feq-8t-UFi"/> <outlet property="pacerButton" destination="Veq-Br-EFG" id="J9Q-bD-AEQ"/> <outlet property="pacerSpeedField" destination="jHc-Bm-dWJ" id="bX9-eZ-X4K"/> <outlet property="pacerSpeedStepper" destination="jYx-ER-Exi" id="sy8-pN-C86"/> @@ -707,6 +708,19 @@ <action selector="toggleSplitPDF:" target="-2" id="Xd4-fe-2EM"/> </connections> </segmentedControl> + <segmentedControl verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QAZ-7p-tLt"> + <rect key="frame" x="166" y="99" width="33" height="23"/> + <autoresizingMask key="autoresizingMask"/> + <segmentedCell key="cell" borderStyle="border" alignment="left" segmentDistribution="fill" style="texturedSquare" trackingMode="selectAny" id="63Q-cd-We8"> + <font key="font" metaFont="system"/> + <segments> + <segment image="ToolbarNotes" imageScaling="none" width="27"/> + </segments> + </segmentedCell> + <connections> + <action selector="toggleNoteToolbar:" target="-1" id="Q1r-DD-NdN"/> + </connections> + </segmentedControl> </subviews> <constraints> <constraint firstAttribute="bottom" secondItem="38" secondAttribute="bottom" constant="275" id="6OB-P3-1wa"/> @@ -760,6 +774,7 @@ <image name="ToolbarMagnifyTool" width="128" height="128"/> <image name="ToolbarMediaBox" width="128" height="128"/> <image name="ToolbarMoveTool" width="27" height="19"/> + <image name="ToolbarNotes" width="128" height="128"/> <image name="ToolbarPageBreaks" width="128" height="128"/> <image name="ToolbarPageDown" width="128" height="128"/> <image name="ToolbarPageUp" width="128" height="128"/> Modified: trunk/NSImage_SKExtensions.h =================================================================== --- trunk/NSImage_SKExtensions.h 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/NSImage_SKExtensions.h 2025-03-17 17:50:11 UTC (rev 14980) @@ -108,6 +108,7 @@ extern NSString *SKImageNameToolbarAddStrikeOutNoteMenu; extern NSString *SKImageNameToolbarAddLineNoteMenu; extern NSString *SKImageNameToolbarAddInkNoteMenu; +extern NSString *SKImageNameToolbarNotes; extern NSString *SKImageNameToolbarTextTool; extern NSString *SKImageNameToolbarMoveTool; extern NSString *SKImageNameToolbarMagnifyTool; Modified: trunk/NSImage_SKExtensions.m =================================================================== --- trunk/NSImage_SKExtensions.m 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/NSImage_SKExtensions.m 2025-03-17 17:50:11 UTC (rev 14980) @@ -112,6 +112,7 @@ NSString *SKImageNameToolbarAddStrikeOutNoteMenu = @"ToolbarAddStrikeOutNoteMenu"; NSString *SKImageNameToolbarAddLineNoteMenu = @"ToolbarAddLineNoteMenu"; NSString *SKImageNameToolbarAddInkNoteMenu = @"ToolbarAddInkNoteMenu"; +NSString *SKImageNameToolbarNotes = @"ToolbarNotes"; NSString *SKImageNameToolbarTextTool = @"ToolbarTextTool"; NSString *SKImageNameToolbarMoveTool = @"ToolbarMoveTool"; NSString *SKImageNameToolbarMagnifyTool = @"ToolbarMagnifyTool"; @@ -780,6 +781,17 @@ [path fill]; ); + MAKE_IMAGE(SKImageNameToolbarNotes, YES, 27.0, 19.0, + translate(3.0, 0.0); + drawTextNote(nil); + [[NSColor blackColor] setStroke]; + NSBezierPath *path = [NSBezierPath bezierPath]; + [path moveToPoint:NSMakePoint(2.0, 3.0)]; + [path lineToPoint:NSMakePoint(19.0, 3.0)]; + [path setLineWidth:2.0]; + [path stroke]; + ); + MAKE_IMAGE(SKImageNameToolbarMoveTool, YES, 27.0, 19.0, [[NSColor blackColor] setStroke]; translate(-3, -6); Modified: trunk/SKMainToolbarController.h =================================================================== --- trunk/SKMainToolbarController.h 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/SKMainToolbarController.h 2025-03-17 17:50:11 UTC (rev 14980) @@ -86,6 +86,7 @@ NSSegmentedControl *customizeButton; NSTextField *scaleField; NSSegmentedControl *noteButton; + NSSegmentedControl *notesButton; SKColorSwatch *colorSwatch; NSSegmentedControl *pacerButton; NSTextField *pacerSpeedField; @@ -96,7 +97,7 @@ } @property (nonatomic, nullable, weak) IBOutlet SKMainWindowController *mainController; -@property (nonatomic, nullable, strong) IBOutlet NSSegmentedControl *backForwardButton, *previousNextPageButton, *previousPageButton, *nextPageButton, *previousNextFirstLastPageButton, *zoomInOutButton, *zoomInActualOutButton, *zoomActualButton, *zoomFitButton, *zoomSelectionButton, *autoScalesButton, *rotateLeftButton, *rotateRightButton, *rotateLeftRightButton, *cropButton, *fullScreenButton, *presentationButton, *leftPaneButton, *rightPaneButton, *splitPDFButton, *toolModeButton, *textNoteButton, *circleNoteButton, *markupNoteButton, *lineNoteButton, *singleTwoUpButton, *continuousButton, *displayModeButton, *displayDirectionButton, *displaysRTLButton, *bookModeButton, *pageBreaksButton, *displayBoxButton, *infoButton, *colorsButton, *fontsButton, *linesButton, *printButton, *customizeButton, *noteButton, *pacerButton, *shareButton; +@property (nonatomic, nullable, strong) IBOutlet NSSegmentedControl *backForwardButton, *previousNextPageButton, *previousPageButton, *nextPageButton, *previousNextFirstLastPageButton, *zoomInOutButton, *zoomInActualOutButton, *zoomActualButton, *zoomFitButton, *zoomSelectionButton, *autoScalesButton, *rotateLeftButton, *rotateRightButton, *rotateLeftRightButton, *cropButton, *fullScreenButton, *presentationButton, *leftPaneButton, *rightPaneButton, *splitPDFButton, *toolModeButton, *textNoteButton, *circleNoteButton, *markupNoteButton, *lineNoteButton, *singleTwoUpButton, *continuousButton, *displayModeButton, *displayDirectionButton, *displaysRTLButton, *bookModeButton, *pageBreaksButton, *displayBoxButton, *infoButton, *colorsButton, *fontsButton, *linesButton, *printButton, *customizeButton, *noteButton, *notesButton, *pacerButton, *shareButton; @property (nonatomic, nullable, strong) IBOutlet NSTextField *pageNumberField, *scaleField, *pacerSpeedField; @property (nonatomic, nullable, strong) IBOutlet SKColorSwatch *colorSwatch; @property (nonatomic, nullable, strong) IBOutlet NSStepper *pacerSpeedStepper; @@ -107,6 +108,8 @@ - (void)handleChangedHistoryNotification:(nullable NSNotification *)notification; - (void)handlePageChangedNotification:(nullable NSNotification *)notification; +- (void)noteToolbarDidShowOrHide; + - (void)updateMinMaxScale; #pragma mark Actions @@ -139,6 +142,7 @@ - (void)createNewCircleNote:(nullable id)sender; - (void)createNewMarkupNote:(nullable id)sender; - (void)createNewLineNote:(nullable id)sender; +- (void)toggleNoteToolbar:(nullable id)sender; - (IBAction)createNewNote:(nullable id)sender; - (IBAction)changeToolMode:(nullable id)sender; - (IBAction)selectColor:(nullable id)sender; Modified: trunk/SKMainToolbarController.m =================================================================== --- trunk/SKMainToolbarController.m 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/SKMainToolbarController.m 2025-03-17 17:50:11 UTC (rev 14980) @@ -62,6 +62,7 @@ #import "PDFDocument_SKExtensions.h" #import "SKShareMenuController.h" #import "NSFont_SKExtensions.h" +#import "SKNoteToolbarController.h" #define SKDocumentToolbarIdentifier @"SKDocumentToolbar" @@ -89,6 +90,7 @@ #define SKDocumentToolbarNewMarkupItemIdentifier @"SKDocumentToolbarNewMarkupItemIdentifier" #define SKDocumentToolbarNewLineItemIdentifier @"SKDocumentToolbarNewLineItemIdentifier" #define SKDocumentToolbarNewNoteItemIdentifier @"SKDocumentToolbarNewNoteItemIdentifier" +#define SKDocumentToolbarNotesItemIdentifier @"SKDocumentToolbarNotesItemIdentifier" #define SKDocumentToolbarInfoItemIdentifier @"SKDocumentToolbarInfoItemIdentifier" #define SKDocumentToolbarToolModeItemIdentifier @"SKDocumentToolbarToolModeItemIdentifier" #define SKDocumentToolbarSingleTwoUpItemIdentifier @"SKDocumentToolbarSingleTwoUpItemIdentifier" @@ -137,7 +139,7 @@ @implementation SKMainToolbarController -@synthesize mainController, backForwardButton, pageNumberField, previousNextPageButton, previousPageButton, nextPageButton, previousNextFirstLastPageButton, zoomInOutButton, zoomInActualOutButton, zoomActualButton, zoomFitButton, zoomSelectionButton, autoScalesButton, rotateLeftButton, rotateRightButton, rotateLeftRightButton, cropButton, fullScreenButton, presentationButton, leftPaneButton, rightPaneButton, splitPDFButton, 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, splitPDFButton, toolModeButton, textNoteButton, circleNoteButton, markupNoteButton, lineNoteButton, singleTwoUpButton, continuousButton, displayModeButton, displayDirectionButton, displaysRTLButton, bookModeButton, pageBreaksButton, displayBoxButton, infoButton, colorsButton, fontsButton, linesButton, printButton, customizeButton, scaleField, noteButton, notesButton, colorSwatch, pacerButton, pacerSpeedField, pacerSpeedStepper, shareButton; - (void)dealloc { @try { [[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:SKSwatchColorsKey context:&SKDefaultsObservationContext]; } @@ -518,6 +520,18 @@ [item setView:noteButton]; [item setMenuFormRepresentation:menuItem]; + } else if ([identifier isEqualToString:SKDocumentToolbarNotesItemIdentifier]) { + + menuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Notes", @"Toolbar item label") action:@selector(toggleNoteToolbar:) target:self]; + + menu = [menuItem submenu]; + [item setLabels:NSLocalizedString(@"Notes", @"Toolbar item label")]; + [item setToolTip:NSLocalizedString(@"Show Note Toolbar", @"Tool tip message")]; + [item setView:notesButton]; + [item setMenuFormRepresentation:menuItem]; + + [self noteToolbarDidShowOrHide]; + } else if ([identifier isEqualToString:SKDocumentToolbarToolModeItemIdentifier]) { menu = [NSMenu menu]; @@ -930,6 +944,7 @@ SKDocumentToolbarNewCircleNoteItemIdentifier, SKDocumentToolbarNewMarkupItemIdentifier, SKDocumentToolbarNewLineItemIdentifier, + SKDocumentToolbarNotesItemIdentifier, SKDocumentToolbarToolModeItemIdentifier, SKDocumentToolbarColorSwatchItemIdentifier, SKDocumentToolbarShareItemIdentifier, @@ -1062,6 +1077,11 @@ [(NSNumberFormatter *)[scaleField formatter] setMaximum:[NSNumber numberWithDouble:[mainController.pdfView maxScaleFactor]]]; } +- (void)noteToolbarDidShowOrHide { + [notesButton setSelected:[mainController hasNoteToolbar] forSegment:0]; + [[toolbarItems objectForKey:SKDocumentToolbarNotesItemIdentifier] setToolTip:[mainController hasNoteToolbar] ? NSLocalizedString(@"Hide Note Toolbar", @"Tool tip message") : NSLocalizedString(@"Show Note Toolbar", @"Tool tip message")]; +} + - (IBAction)goToPreviousNextFirstLastPage:(id)sender { NSInteger tag = [sender selectedTag]; if (tag == -1) @@ -1231,6 +1251,10 @@ } else NSBeep(); } +- (void)toggleNoteToolbar:(id)sender { + [mainController toggleNoteToolbar:sender]; +} + - (IBAction)changeToolMode:(id)sender { NSInteger newToolMode = [sender selectedTag]; [mainController.pdfView setToolMode:newToolMode]; Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/SKMainWindowController.h 2025-03-17 17:50:11 UTC (rev 14980) @@ -287,8 +287,10 @@ @property (nonatomic, nullable, readonly) NSMenu *notesMenu; -@property (nonatomic) BOOL hasOverview; +@property (nonatomic, readonly) BOOL hasNoteToolbar; +@property (nonatomic, readonly) BOOL hasOverview; + - (void)showOverviewAnimating:(BOOL)animate; - (void)hideOverviewAnimating:(BOOL)animate; - (void)hideOverviewAnimating:(BOOL)animate completionHandler:(nullable void (^)(void))handler; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/SKMainWindowController.m 2025-03-17 17:50:11 UTC (rev 14980) @@ -218,7 +218,7 @@ @implementation SKMainWindowController @synthesize mainWindow, splitView, topConstraint, centerContentView, pdfSplitView, pdfContentView, findBarTopConstraint, statusBar, pdfView, secondaryPdfView, leftSideController, rightSideController, leftSideContentView, rightSideContentView, presentationNotesDocument, presentationNotesOffset, notes, thumbnails, snapshots, searchResults, groupedSearchResults, tags, rating, pageLabel, interactionMode, placeholderPdfDocument; -@dynamic pdfDocument, presentationUndoManager, selectedNotes, hasNotes, widgetProperties, currentPage, leftSidePaneState, rightSidePaneState, findPaneState, displaysFindPane, leftSidePaneIsOpen, rightSidePaneIsOpen, searchString, hasOverview, notesMenu; +@dynamic pdfDocument, presentationUndoManager, selectedNotes, hasNotes, widgetProperties, currentPage, leftSidePaneState, rightSidePaneState, findPaneState, displaysFindPane, leftSidePaneIsOpen, rightSidePaneIsOpen, searchString, hasNoteToolbar, hasOverview, notesMenu; + (BOOL)automaticallyNotifiesObserversOfPageLabel { return NO; } @@ -1511,6 +1511,10 @@ } } +- (BOOL)hasNoteToolbar { + return [noteToolbarController isVisible]; +} + #pragma mark Overview - (BOOL)hasOverview { Modified: trunk/SKMainWindowController_Actions.m =================================================================== --- trunk/SKMainWindowController_Actions.m 2025-03-17 16:37:25 UTC (rev 14979) +++ trunk/SKMainWindowController_Actions.m 2025-03-17 17:50:11 UTC (rev 14980) @@ -1153,6 +1153,7 @@ } [[self window] addTitlebarAccessoryViewController:noteToolbarController]; } + [toolbarController noteToolbarDidShowOrHide]; } - (IBAction)toggleFullscreen:(id)sender { Modified: trunk/de.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/en.lproj/Localizable.strings =================================================================== (Binary files differ) Modified: trunk/en.lproj/MainMenu.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