Skip to content

Commit

Permalink
notes secondary toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
scris committed Feb 9, 2024
1 parent 6e7c4a3 commit 1013d4a
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 52 deletions.
14 changes: 7 additions & 7 deletions Base.lproj/FindBar.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19162" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19162"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -21,7 +21,7 @@
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1" customClass="SKTopBarView">
<rect key="frame" x="0.0" y="0.0" width="220" height="36"/>
<subviews>
<searchField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3">
<searchField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3">
<rect key="frame" x="77" y="7" width="32" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="500" id="WyN-YQ-969"/>
Expand Down Expand Up @@ -55,7 +55,7 @@
<action selector="find:" target="-2" id="29"/>
</connections>
</segmentedControl>
<button horizontalHuggingPriority="750" verticalHuggingPriority="750" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7">
<button imageHugsTitle="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7">
<rect key="frame" x="168" y="8" width="44" height="19"/>
<buttonCell key="cell" type="roundRect" title="Done" bezelStyle="roundedRect" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
Expand All @@ -68,7 +68,7 @@ Gw
<action selector="remove:" target="-2" id="10"/>
</connections>
</button>
<textField hidden="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="31">
<textField hidden="YES" focusRingType="none" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="31">
<rect key="frame" x="6" y="10" width="65" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Not found" id="32">
<font key="font" metaFont="message"/>
Expand Down Expand Up @@ -101,7 +101,7 @@ Gw
</objectController>
</objects>
<resources>
<image name="NSGoLeftTemplate" width="10" height="14"/>
<image name="NSGoRightTemplate" width="10" height="14"/>
<image name="NSGoLeftTemplate" width="12" height="17"/>
<image name="NSGoRightTemplate" width="12" height="17"/>
</resources>
</document>
23 changes: 12 additions & 11 deletions Base.lproj/HighlightBar.xib
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,31 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SKSecondaryToolbarController">
<connections>
<outlet property="noteButton" destination="JFe-KB-smj" id="nE7-HO-UHK"/>
<outlet property="ownerController" destination="18" id="xWk-eN-FWo"/>
<outlet property="view" destination="1" id="VDW-MM-JR9"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1" customClass="SKTopBarView">
<rect key="frame" x="0.0" y="0.0" width="220" height="109"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1" userLabel="Highlight Bar View" customClass="SKTopBarView">
<rect key="frame" x="0.0" y="0.0" width="220" height="44"/>
<subviews>
<segmentedControl verticalHuggingPriority="750" id="JFe-KB-smj">
<rect key="frame" x="-66" y="42" width="352" height="23"/>
<rect key="frame" x="-66" y="10" width="352" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<segmentedCell key="cell" alignment="left" segmentDistribution="fill" style="texturedSquare" trackingMode="momentary" id="Grd-h1-ge4">
<font key="font" metaFont="system"/>
<segments>
<segment image="ToolbarAddHighlightNote" imageScaling="none" width="34"/>
<segment image="ToolbarAddAnchoredNote" imageScaling="none" width="34" tag="1"/>
<segment image="ToolbarAddCircleNote" imageScaling="none" width="34" tag="2"/>
<segment image="ToolbarAddSquareNote" imageScaling="none" width="34" tag="3"/>
<segment image="ToolbarAddTextNote" imageScaling="none" width="34" tag="4"/>
<segment image="ToolbarAddUnderlineNote" imageScaling="none" width="34" tag="5"/>
<segment image="ToolbarAddStrikeOutNote" imageScaling="none" width="34" tag="6"/>
<segment image="ToolbarAddLineNote" imageScaling="none" width="34" tag="7"/>
<segment image="ToolbarAddInkNote" imageScaling="none" width="34" tag="8">
<segment image="ToolbarAddUnderlineNote" imageScaling="none" width="34" tag="1"/>
<segment image="ToolbarAddStrikeOutNote" imageScaling="none" width="34" tag="2"/>
<segment image="ToolbarAddLineNote" imageScaling="none" width="34" tag="3"/>
<segment image="ToolbarAddInkNote" imageScaling="none" width="34" tag="4"/>
<segment image="ToolbarAddTextNote" imageScaling="none" width="34" tag="5"/>
<segment image="ToolbarAddAnchoredNote" imageScaling="none" width="34" tag="6"/>
<segment image="ToolbarAddCircleNote" imageScaling="none" width="34" tag="7"/>
<segment image="ToolbarAddSquareNote" imageScaling="none" width="34" tag="8">
<nil key="label"/>
</segment>
</segments>
Expand Down
23 changes: 13 additions & 10 deletions ReleaseNotes.rtf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{\rtf1\ansi\ansicpg936\cocoartf2758
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 LucidaGrande;\f2\fswiss\fcharset0 Helvetica-Bold;
\f3\fswiss\fcharset0 Helvetica-BoldOblique;\f4\fswiss\fcharset0 Helvetica-Oblique;\f5\fnil\fcharset0 LucidaGrande-Bold;
}
\f3\fswiss\fcharset0 Helvetica-BoldOblique;\f4\fnil\fcharset134 PingFangSC-Regular;\f5\fswiss\fcharset0 Helvetica-Oblique;
\f6\fnil\fcharset0 LucidaGrande-Bold;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
{\*\expandedcolortbl;;\cssrgb\c0\c0\c0\cname textColor;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}
Expand Down Expand Up @@ -375,8 +375,11 @@
New Features\
\pard\tx220\tx720\tx1440\tx2880\tx4320\tx5760\tx7200\li720\fi-720\partightenfactor0
\ls1\ilvl0
\f1\i0\b0\fs22 \cf2 {\listtext \uc0\u8226 }A brand-new app icon for Preskim.\
{\listtext \uc0\u8226 }Use Sparkle updater via SwiftPM for easier dependency updating.
\f1\i0\b0\fs22 \cf2 {\listtext \uc0\u8226 }A brand-new designed app icon for Preskim.\
{\listtext \uc0\u8226 }Use Sparkle updater via SwiftPM for easier dependency updating
\f4 .
\f1 \
{\listtext \uc0\u8226 }Use a secondary toolbar for adding notes and comments.
\f2\b\fs28 \
\pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0
\cf2 \
Expand Down Expand Up @@ -1127,7 +1130,7 @@ Changes since 1.5.6\
\f3\i\fs26 \
\f2\i0\fs28 NOTE:
\f4\i\b0\fs24 \cf0 If you need attached notes to be read by older versions of Skim (before 1.5.4), you should choose to write legacy Skim notes in the General preferences.
\f5\i\b0\fs24 \cf0 If you need attached notes to be read by older versions of Skim (before 1.5.4), you should choose to write legacy Skim notes in the General preferences.
\f2\i0\b\fs28 \cf2 \
\f3\i\fs26 \
Expand Down Expand Up @@ -3155,11 +3158,11 @@ Bugs Fixed\
Changes since 1.1.4\
\pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0
\f5\fs22 \cf2 \
\f6\fs22 \cf2 \
\pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0
\f2\fs28 \cf2 NOTE:
\f4\i\b0\fs24 \cf0 If you are using customized export templates, you should move those to the new location. See the Wiki for details.
\f5\i\b0\fs24 \cf0 If you are using customized export templates, you should move those to the new location. See the Wiki for details.
\f2\i0\b\fs28 \cf2 \
\f3\i\fs26 \
Expand Down Expand Up @@ -3505,11 +3508,11 @@ New Features\
Changes since 0.9.3\
\pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0
\f5\fs22 \cf2 \
\f6\fs22 \cf2 \
\pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0
\f2\fs28 \cf2 NOTE:
\f4\i\b0\fs24 If you use custom export templates, you may want to change the "contents" key by the key "string". See the Wiki for further details.
\f5\i\b0\fs24 If you use custom export templates, you may want to change the "contents" key by the key "string". See the Wiki for further details.
\f2\i0\b\fs28 \
\pard\tx220\tx720\tx1440\tx2880\tx4320\tx5760\tx7200\li720\fi-720\partightenfactor0
\cf2 \
Expand Down Expand Up @@ -4185,6 +4188,6 @@ If you have a problem with using the program and you'd like to talk with other u
\f1\i0\b0\fs22 \cf2 \
Bug reports should be submitted to the {\field{\*\fldinst{HYPERLINK "http://sourceforge.net/p/skim-app/bugs"}}{\fldrslt bug tracker}} on SourceForge.
\f5\b Note:
\f6\b Note:
\f1\b0 If you can, please assign the bug report to someone - if you don't personally know any developers, assign the bug to Mike (username mmcc). If you don't assign the bug to someone, nobody may notice it for a long time. Assigning it to someone sends them an email notification.\
}
1 change: 0 additions & 1 deletion SKMainToolbarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,6 @@ - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar {
SKDocumentToolbarRotateLeftItemIdentifier,
SKDocumentToolbarRotateLeftRightItemIdentifier,
SKDocumentToolbarCropItemIdentifier,
SKDocumentToolbarNewNoteItemIdentifier,
SKDocumentToolbarToolModeItemIdentifier,
SKDocumentToolbarColorSwatchItemIdentifier,
SKDocumentToolbarShareItemIdentifier,
Expand Down
3 changes: 2 additions & 1 deletion SKMainWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ enum {

@class PDFAnnotation, PDFSelection, SKGroupedSearchResult;
@class SKPDFView, SKSecondaryPDFView, SKStatusBar, SKFindController, SKSplitView, SKFieldEditor, SKOverviewView, SKSideWindow;
@class SKLeftSideViewController, SKRightSideViewController, SKMainToolbarController, SKMainTouchBarController, SKProgressController, SKPresentationOptionsSheetController, SKNoteTypeSheetController, SKSnapshotWindowController;
@class SKLeftSideViewController, SKRightSideViewController, SKMainToolbarController, SKMainTouchBarController, SKProgressController, SKPresentationOptionsSheetController, SKNoteTypeSheetController, SKSnapshotWindowController, SKSecondaryToolbarController;

@interface SKMainWindowController : NSWindowController <SKSnapshotWindowControllerDelegate, SKThumbnailDelegate, SKFindControllerDelegate, SKPDFViewDelegate, SKPDFDocumentDelegate, NSTouchBarDelegate, SKSecondaryToolbarControllerDelegate> {
SKSplitView *splitView;
Expand Down Expand Up @@ -221,6 +221,7 @@ enum {
@property (nonatomic, nullable, strong) IBOutlet SKRightSideViewController *rightSideController;

@property (nonatomic, nullable, strong) IBOutlet SKMainToolbarController *toolbarController;
@property (nonatomic, nullable, strong) IBOutlet SKSecondaryToolbarController *secondaryToolbarController;

@property (nonatomic, nullable, strong) IBOutlet NSView *leftSideContentView, *rightSideContentView;

Expand Down
12 changes: 11 additions & 1 deletion SKMainWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ This software is Copyright (c) 2006
#import "NSColor_SKExtensions.h"
#import "NSObject_SKExtensions.h"
#import "SKChainedUndoManager.h"
#import "SKSecondaryToolbarController.h"

#define MULTIPLICATION_SIGN_CHARACTER (unichar)0x00d7

Expand Down Expand Up @@ -215,7 +216,7 @@ + (void)defineFullScreenGlobalVariables;

@implementation SKMainWindowController

@synthesize mainWindow, splitView, centerContentView, pdfSplitView, pdfContentView, pdfView, secondaryPdfView, leftSideController, rightSideController, toolbarController, leftSideContentView, rightSideContentView, presentationNotesDocument, presentationNotesOffset, notes, thumbnails, snapshots, searchResults, groupedSearchResults, tags, rating, pageLabel, interactionMode, placeholderPdfDocument, splitViewController, pdfViewController;
@synthesize mainWindow, splitView, centerContentView, pdfSplitView, pdfContentView, pdfView, secondaryPdfView, leftSideController, rightSideController, toolbarController, leftSideContentView, rightSideContentView, presentationNotesDocument, presentationNotesOffset, notes, thumbnails, snapshots, searchResults, groupedSearchResults, tags, rating, pageLabel, interactionMode, placeholderPdfDocument, splitViewController, pdfViewController, secondaryToolbarController;
@dynamic pdfDocument, presentationOptions, presentationUndoManager, selectedNotes, hasNotes, widgetProperties, autoScales, leftSidePaneState, rightSidePaneState, findPaneState, leftSidePaneIsOpen, leftSidebarIsOpen, rightSidePaneIsOpen, recentInfoNeedsUpdate, searchString, hasOverview, notesMenu;

+ (void)initialize {
Expand Down Expand Up @@ -287,6 +288,7 @@ - (void)cleanup {
[rightSideController setMainController:nil];
[toolbarController setMainController:nil];
[touchBarController setMainController:nil];
[secondaryToolbarController setMainController:nil];
[findController setDelegate:nil]; // this breaks the retain loop from binding
[secondaryToolbarController setDelegate:nil];
[pdfView setDelegate:nil]; // this cleans up the pdfview
Expand Down Expand Up @@ -3201,4 +3203,12 @@ - (NSTouchBar *)makeTouchBar {
return [touchBarController makeTouchBar];
}

#pragma mark Secondary Toolbar

- (void)createNewNoteWithTag:(NSInteger)tag {
if ([pdfView canSelectNote])
[pdfView addAnnotationWithType:tag];
else NSBeep();
}

@end
1 change: 1 addition & 0 deletions SKMainWindowController_Actions.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ This software is Copyright (c) 2009
#import "PDFSelection_SKExtensions.h"
#import "SKOutlineView.h"
#import "SKOverviewView.h"
#import "SKSecondaryToolbarController.h"

#define STATUSBAR_HEIGHT 22.0

Expand Down
1 change: 1 addition & 0 deletions SKMainWindowController_UI.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ This software is Copyright (c) 2008
#import "NSObject_SKExtensions.h"
#import "NSPasteboard_SKExtensions.h"
#import "SKApplicationController.h"
#import "SKSecondaryToolbarController.h"

#define NOTES_KEY @"notes"
#define SNAPSHOTS_KEY @"snapshots"
Expand Down
10 changes: 6 additions & 4 deletions SKSecondaryToolbarController.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,20 @@ NS_ASSUME_NONNULL_BEGIN

@protocol SKSecondaryToolbarControllerDelegate;

@class SKMainWindowController;

@interface SKSecondaryToolbarController : NSViewController {
__weak id <SKSecondaryToolbarControllerDelegate> delegate;
NSSegmentedControl *navigationButton;
NSSegmentedControl *noteButton;
NSObjectController *ownerController;
NSString *findString;
__weak SKMainWindowController *mainController;
BOOL didChange;
}

@property (nonatomic, nullable, weak) IBOutlet SKMainWindowController *mainController;
@property (nonatomic, nullable, strong) IBOutlet NSSegmentedControl *noteButton;
@property (nonatomic, nullable, strong) IBOutlet NSObjectController *ownerController;
@property (nonatomic, nullable, weak) id <SKSecondaryToolbarControllerDelegate> delegate;
@property (nonatomic, nullable, strong) NSString *findString;

- (void)didAddBar;
- (IBAction)remove:(nullable id)sender;
Expand All @@ -62,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN


@protocol SKSecondaryToolbarControllerDelegate <NSObject>
- (BOOL)findString:(NSString *)string forward:(BOOL)forward;
- (void)createNewNoteWithTag:(NSInteger)tag;
- (void)removeSecondaryToolbarController;
@end

Expand Down
Loading

0 comments on commit 1013d4a

Please sign in to comment.