Revision: 16222
http://sourceforge.net/p/skim-app/code/16222
Author: hofman
Date: 2026-05-05 14:55:13 +0000 (Tue, 05 May 2026)
Log Message:
-----------
better check whether to add edit items to note table menu
Modified Paths:
--------------
trunk/SKMainToolbarController.m
trunk/SKMainWindowController_UI.m
trunk/SKPDFView.m
Modified: trunk/SKMainToolbarController.m
===================================================================
--- trunk/SKMainToolbarController.m 2026-05-05 14:23:20 UTC (rev 16221)
+++ trunk/SKMainToolbarController.m 2026-05-05 14:55:13 UTC (rev 16222)
@@ -1063,7 +1063,7 @@
return [mainController.pdfView.document isLocked] == NO &&
[mainController hasOverview] == NO;
} else if (action == @selector(createNewTextNote:)) {
[menuItem setState:[textNoteButton tagForSegment:0] == [menuItem tag]
? NSControlStateValueOn : NSControlStateValueOff];
- return [mainController interactionMode] != SKPresentationMode &&
[mainController hasOverview] == NO && [mainController.pdfView canAddNotes] &&
([mainController.pdfView toolMode] == SKToolModeText || [mainController.pdfView
toolMode] == SKToolModeNote);
+ return [mainController interactionMode] != SKPresentationMode &&
[mainController hasOverview] == NO && [mainController.pdfView canSelectNote];
} else if (action == @selector(createNewShapeNote:)) {
[menuItem setState:[circleNoteButton tagForSegment:0] == [menuItem
tag] ? NSControlStateValueOn : NSControlStateValueOff];
return [mainController hasOverview] == NO && [mainController.pdfView
canSelectNote];
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2026-05-05 14:23:20 UTC (rev 16221)
+++ trunk/SKMainWindowController_UI.m 2026-05-05 14:55:13 UTC (rev 16222)
@@ -1412,7 +1412,7 @@
item = [menu addItemWithTitle:NSLocalizedString(@"Copy",
@"Menu item title") action:@selector(copyNotes:) target:self];
[item setRepresentedObject:items];
}
- if ([pdfView hideNotes] == NO && [items count] == 1) {
+ if ([items count] == 1) {
PDFAnnotation *annotation = [[self noteItems:items]
lastObject];
if ([annotation isEditable]) {
if ([(PDFAnnotation *)[items lastObject] type] == nil) {
@@ -1420,19 +1420,21 @@
item = [menu
addItemWithTitle:[NSLocalizedString(@"Edit", @"Menu item title")
stringByAppendingEllipsis] action:@selector(editNoteTextFromTable:)
target:self];
[item setRepresentedObject:annotation];
}
- } else if ([[rightSideController.noteOutlineView
tableColumnWithIdentifier:NOTE_COLUMNID] isHidden]) {
- item = [menu
addItemWithTitle:[NSLocalizedString(@"Edit", @"Menu item title")
stringByAppendingEllipsis] action:@selector(editThisAnnotation:)
target:pdfView];
- [item setRepresentedObject:annotation];
- } else {
+ } else if ([[rightSideController.noteOutlineView
tableColumnWithIdentifier:NOTE_COLUMNID] isHidden] == NO) {
item = [menu
addItemWithTitle:NSLocalizedString(@"Edit", @"Menu item title")
action:@selector(editNoteFromTable:) target:self];
[item setRepresentedObject:annotation];
+ if ([annotation isText] == NO || ([pdfView
canSelectNote] && [self hasOverview] == NO)) {
+ item = [menu
addItemWithTitle:[NSLocalizedString(@"Edit", @"Menu item title")
stringByAppendingEllipsis] action:@selector(editThisAnnotation:)
target:pdfView];
+ [item setRepresentedObject:annotation];
+ [item
setKeyEquivalentModifierMask:NSEventModifierFlagOption];
+ [item setAlternate:YES];
+ }
+ } else if ([annotation isText] == NO || ([pdfView
canSelectNote] && [self hasOverview] == NO)) {
item = [menu
addItemWithTitle:[NSLocalizedString(@"Edit", @"Menu item title")
stringByAppendingEllipsis] action:@selector(editThisAnnotation:)
target:pdfView];
[item setRepresentedObject:annotation];
- [item
setKeyEquivalentModifierMask:NSEventModifierFlagOption];
- [item setAlternate:YES];
}
}
- if ([pdfView canAddNotes]) {
+ if ([pdfView canAddNotes] && [self hasOverview] == NO) {
if ([pdfView currentAnnotation] == annotation) {
item = [menu
addItemWithTitle:NSLocalizedString(@"Deselect", @"Menu item title")
action:@selector(deselectNote:) target:self];
[item setRepresentedObject:annotation];
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2026-05-05 14:23:20 UTC (rev 16221)
+++ trunk/SKPDFView.m 2026-05-05 14:55:13 UTC (rev 16222)
@@ -1145,7 +1145,7 @@
}
- (void)pasteNote:(BOOL)preferNote plainText:(BOOL)isPlainText {
- if ([self hideNotes]) {
+ if ([self canAddNotes] == NO) {
NSBeep();
return;
}
@@ -1301,7 +1301,7 @@
- (IBAction)cut:(id)sender
{
- if ([self hideNotes] == NO && [currentAnnotation isSkimNote]) {
+ if ([self canAddNotes] && [currentAnnotation isSkimNote]) {
[self copy:sender];
[self delete:sender];
} else
@@ -2128,7 +2128,7 @@
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
NSDragOperation dragOp = NSDragOperationNone;
NSPasteboard *pboard = [sender draggingPasteboard];
- if ([self hideNotes] == NO && ([pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]] || [pboard canReadObjectForClasses:@[[NSURL class]]
options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}])) {
+ if ([self canAddNotes]&& ([pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]] || [pboard canReadObjectForClasses:@[[NSURL class]]
options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}])) {
return [self draggingUpdated:sender];
} else if ([[SKPDFView superclass] instancesRespondToSelector:_cmd]) {
dragOp = [super draggingEntered:sender];
@@ -2139,7 +2139,7 @@
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender {
NSDragOperation dragOp = NSDragOperationNone;
NSPasteboard *pboard = [sender draggingPasteboard];
- if ([self hideNotes] == NO && [pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]]) {
+ if ([self canAddNotes] && [pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]]) {
NSPoint location = [self convertPoint:[sender draggingLocation]
fromView:nil];
PDFPage *page = [self pageForPoint:location nearest:NO];
if (page) {
@@ -2160,7 +2160,7 @@
}
if (dragOp == NSDragOperationNone)
[self removeHighlightLayer];
- } else if ([self hideNotes] == NO && [pboard
canReadObjectForClasses:@[[NSURL class]]
options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}]) {
+ } else if ([self canAddNotes] && [pboard canReadObjectForClasses:@[[NSURL
class]] options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}]) {
if (([[sender draggingSource] respondsToSelector:@selector(window)] ==
NO || [[sender draggingSource] window] != [self window]) && [self
pageForPoint:[self convertPoint:[sender draggingLocation] fromView:nil]
nearest:NO])
dragOp = NSDragOperationGeneric;
} else if ([[SKPDFView superclass] instancesRespondToSelector:_cmd]) {
@@ -2171,7 +2171,7 @@
- (void)draggingExited:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard = [sender draggingPasteboard];
- if ([self hideNotes] == NO && ([pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]] || [pboard canReadObjectForClasses:@[[NSURL class]]
options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}])) {
+ if ([self canAddNotes] && ([pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]] || [pboard canReadObjectForClasses:@[[NSURL class]]
options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}])) {
[self removeHighlightLayer];
} else if ([[SKPDFView superclass] instancesRespondToSelector:_cmd]) {
[super draggingExited:sender];
@@ -2181,7 +2181,7 @@
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
BOOL performedDrag = NO;
NSPasteboard *pboard = [sender draggingPasteboard];
- if ([self hideNotes] == NO && [pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]]) {
+ if ([self canAddNotes] && [pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor,
SKPasteboardTypeLineStyle]]) {
PDFAnnotation *annotation = [highlightLayerController annotation];
if (annotation) {
if ([pboard
canReadItemWithDataConformingToTypes:@[NSPasteboardTypeColor]]) {
@@ -2208,7 +2208,7 @@
}
[self removeHighlightLayer];
}
- } else if ([self hideNotes] == NO && [pboard
canReadObjectForClasses:@[[NSURL class]]
options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}]) {
+ } else if ([self canAddNotes] && [pboard canReadObjectForClasses:@[[NSURL
class]] options:@{NSPasteboardURLReadingFileURLsOnlyKey:@YES,
NSPasteboardURLReadingContentsConformToTypesKey:[NSImage imageTypes]}]) {
NSPoint location = [self convertPoint:[sender draggingLocation]
fromView:nil];
PDFPage *page = [self pageForPoint:location nearest:NO];
if (page) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit