|
@@ -95,14 +95,15 @@ extension KMLeftSideViewController: NSMenuDelegate {
|
|
|
item = menu.addItem(title: displayStr, action: #selector(displayPageSize), target: self)
|
|
|
item?.representedObject = IndexSet(integer: row)
|
|
|
|
|
|
- item = menu.addItem(title: KMLocalizedString("Share", "Menu item title"), action: nil, target: self)
|
|
|
-
|
|
|
-// NSString * tName = [self fileNameWithSelectedPages:leftSideController.thumbnailTableView.selectedRowIndexes];
|
|
|
-// if (tName.length > 50) {
|
|
|
-// tName = [tName substringWithRange:NSMakeRange(0, 50)];
|
|
|
-// }
|
|
|
- let tName = self.listView.document.documentURL.lastPathComponent
|
|
|
- item?.submenu = NSSharingServicePicker.menu(forSharingItems: [self.listView.document.documentURL], subjectContext: tName, withTarget: self, selector: #selector(sharePage), serviceDelegate: nil)
|
|
|
+ if let doct = self.listView?.document {
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Share", "Menu item title"), action: nil, target: self)
|
|
|
+
|
|
|
+ var tName = self.fileNameWithSelectedPages(self.thumbnailTableView.selectedRowIndexes)
|
|
|
+ if (tName.count > 50) {
|
|
|
+ tName = tName.substring(to: 50)
|
|
|
+ }
|
|
|
+ item?.submenu = NSSharingServicePicker.menu(forSharingItems: [doct.documentURL as Any], subjectContext: tName, withTarget: self, selector: #selector(sharePage), serviceDelegate: nil)
|
|
|
+ }
|
|
|
}
|
|
|
} else if menu.isEqual(to: self.findTableView.menu) {
|
|
|
var rowIndexes = self.findTableView.selectedRowIndexes
|
|
@@ -214,136 +215,104 @@ extension KMLeftSideViewController: NSMenuDelegate {
|
|
|
if (row != -1) {
|
|
|
if rowIndexes.contains(row) == false {
|
|
|
rowIndexes = IndexSet(integer: row)
|
|
|
- items = self.noteOutlineView.itemsAtRowIndexes(rowIndexes) as NSArray
|
|
|
-
|
|
|
-// PDFAnnotation *foldNote = (PDFAnnotation *)notes[row];
|
|
|
- let foldNote = self.allAnnotations[row]
|
|
|
- var isFold = true
|
|
|
- if self.allFoldNotes.contains(foldNote) {
|
|
|
- isFold = false
|
|
|
- }
|
|
|
- item = menu.addItem(title: KMLocalizedString("Expand", nil), action: #selector(unfoldNoteAction), target: self)
|
|
|
- if (isFold) {
|
|
|
- item?.state = .off
|
|
|
- } else {
|
|
|
- item?.state = .on
|
|
|
- }
|
|
|
- item?.representedObject = items
|
|
|
- item = menu.addItem(title: KMLocalizedString("Collapse", nil), action: #selector(foldNoteAction), target: self)
|
|
|
- if (isFold) {
|
|
|
- item?.state = .on
|
|
|
- } else {
|
|
|
- item?.state = .off
|
|
|
+ }
|
|
|
+ items = self.noteOutlineView.itemsAtRowIndexes(rowIndexes) as NSArray
|
|
|
+
|
|
|
+ // PDFAnnotation *foldNote = (PDFAnnotation *)notes[row];
|
|
|
+ let foldNote = self.allAnnotations[row]
|
|
|
+ var isFold = true
|
|
|
+ if self.allFoldNotes.contains(foldNote) {
|
|
|
+ isFold = false
|
|
|
+ }
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Expand", nil), action: #selector(unfoldNoteAction), target: self)
|
|
|
+ if (isFold) {
|
|
|
+ item?.state = .off
|
|
|
+ } else {
|
|
|
+ item?.state = .on
|
|
|
+ }
|
|
|
+ item?.representedObject = items
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Collapse", nil), action: #selector(foldNoteAction), target: self)
|
|
|
+ if (isFold) {
|
|
|
+ item?.state = .on
|
|
|
+ } else {
|
|
|
+ item?.state = .off
|
|
|
+ }
|
|
|
+ item?.representedObject = items
|
|
|
+
|
|
|
+ menu.addItem(.separator())
|
|
|
+ if self.listView.hideNotes == false {
|
|
|
+ // if ([pdfView hideNotes] == NO && [items count] == 1) {
|
|
|
+ let annotation = self.noteItems(items!).lastObject as? CPDFAnnotation
|
|
|
+ if let data = annotation?.isEditable(), data {
|
|
|
+ if annotation?.type == nil {
|
|
|
+ if annotation!.isNote() {
|
|
|
+ // [NSLocalizedString(@"Edit", @"Menu item title") stringByAppendingEllipsis]
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Edit", "Menu item title"), action: #selector(editNoteTextFromTable), target: self)
|
|
|
+ item?.representedObject = annotation
|
|
|
+ }
|
|
|
+ } else if let data = self.noteOutlineView.tableColumn(withIdentifier: NSUserInterfaceItemIdentifier("note"))?.isHidden, data {
|
|
|
+// [NSLocalizedString(@"Edit", @"Menu item title") stringByAppendingEllipsis]
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Edit", "Menu item title"), action: #selector(editThisAnnotation), target: self)
|
|
|
+ item?.representedObject = annotation
|
|
|
+ } else {
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Edit", "Menu item title"), action: #selector(editNoteFromTable), target: self)
|
|
|
+ item?.representedObject = annotation
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Edit", "Menu item title"), action: #selector(editThisAnnotation), target: self)
|
|
|
+ item?.representedObject = annotation
|
|
|
+ item?.keyEquivalentModifierMask = [.option]
|
|
|
+ item?.isAlternate = true
|
|
|
+ }
|
|
|
}
|
|
|
- item?.representedObject = items
|
|
|
+ }
|
|
|
+
|
|
|
+ if menu.numberOfItems > 0 {
|
|
|
+ item = menu.addItem(title: NSLocalizedString("Export Annotations…", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+
|
|
|
+ let subMenu = NSMenu()
|
|
|
+ item?.submenu = subMenu
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("PDF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 0
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("PDF Bundle", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 1
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("PDF Reader Pro Edition Notes", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 2
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as Texts", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 3
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as RTF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 4
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as RTFD", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 5
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as FDF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 6
|
|
|
|
|
|
- //UX改版删除
|
|
|
- // if ([self outlineView:rightSideController.noteOutlineView canCopyItems:items]) {
|
|
|
- // item = [menu addItemWithTitle:NSLocalizedString(@"Copy", @"Menu item title") action:@selector(copyNotes:) target:self];
|
|
|
- // [item setRepresentedObject:items];
|
|
|
- // }
|
|
|
menu.addItem(.separator())
|
|
|
- if self.listView.hideNotes == false {
|
|
|
- // if ([pdfView hideNotes] == NO && [items count] == 1) {
|
|
|
- // PDFAnnotation *annotation = [[self noteItems:items] lastObject];
|
|
|
- // if ([annotation isEditable]) {
|
|
|
- // if ([(PDFAnnotation *)[items lastObject] type] == nil) {
|
|
|
- // if ([[(SKNoteText *)[items lastObject] note] isNote]) {
|
|
|
- // 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 {
|
|
|
- // item = [menu addItemWithTitle:NSLocalizedString(@"Edit", @"Menu item title") action:@selector(editNoteFromTable:) target:self];
|
|
|
- // [item setRepresentedObject:annotation];
|
|
|
- // 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 hideNotes] == NO && [[self pdfDocument] allowsNotes]) {
|
|
|
- // if ([pdfView activeAnnotation] == annotation) {
|
|
|
- // item = [menu addItemWithTitle:NSLocalizedString(@"Deselect", @"Menu item title") action:@selector(deselectNote:) target:self];
|
|
|
- // [item setRepresentedObject:annotation];
|
|
|
- // } else {
|
|
|
- // item = [menu addItemWithTitle:NSLocalizedString(@"Select", @"Menu item title") action:@selector(selectNote:) target:self];
|
|
|
- // [item setRepresentedObject:annotation];
|
|
|
- // }
|
|
|
- // item = [menu addItemWithTitle:NSLocalizedString(@"Show", @"Menu item title") action:@selector(revealNote:) target:self];
|
|
|
- // [item setRepresentedObject:annotation];
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if ([menu numberOfItems] > 0)
|
|
|
- // [menu addItem:[NSMenuItem separatorItem]];
|
|
|
- // item = [menu addItemWithTitle:[items count] == 1 ? NSLocalizedString(@"Auto Size Row", @"Menu item title") : NSLocalizedString(@"Auto Size Rows", @"Menu item title") action:@selector(autoSizeNoteRows:) target:self];
|
|
|
- // [item setRepresentedObject:items];
|
|
|
- // item = [menu addItemWithTitle:[items count] == 1 ? NSLocalizedString(@"Undo Auto Size Row", @"Menu item title") : NSLocalizedString(@"Undo Auto Size Rows", @"Menu item title") action:@selector(resetHeightOfNoteRows:) target:self];
|
|
|
- // [item setRepresentedObject:items];
|
|
|
- // [item setKeyEquivalentModifierMask:NSAlternateKeyMask];
|
|
|
- // [item setAlternate:YES];
|
|
|
- // [menu addItemWithTitle:NSLocalizedString(@"Auto Size All", @"Menu item title") action:@selector(autoSizeNoteRows:) target:self];
|
|
|
- // item = [menu addItemWithTitle:NSLocalizedString(@"Undo Auto Size All", @"Menu item title") action:@selector(resetHeightOfNoteRows:) target:self];
|
|
|
- // [item setKeyEquivalentModifierMask:NSAlternateKeyMask];
|
|
|
- // [item setAlternate:YES];
|
|
|
- // [menu addItemWithTitle:NSLocalizedString(@"Automatically Resize", @"Menu item title") action:@selector(toggleAutoResizeNoteRows:) target:self];
|
|
|
-
|
|
|
- if menu.numberOfItems > 0 {
|
|
|
- item = menu.addItem(title: NSLocalizedString("Export Annotations…", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
-
|
|
|
- let subMenu = NSMenu()
|
|
|
- item?.submenu = subMenu
|
|
|
- item = subMenu.addItem(title: NSLocalizedString("PDF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
- item?.tag = 0
|
|
|
- item = subMenu.addItem(title: NSLocalizedString("PDF Bundle", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
- item?.tag = 1
|
|
|
- item = subMenu.addItem(title: NSLocalizedString("PDF Reader Pro Edition Notes", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
- item?.tag = 2
|
|
|
- item = subMenu.addItem(title: NSLocalizedString("Notes as Texts", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
- item?.tag = 3
|
|
|
- item = subMenu.addItem(title: NSLocalizedString("Notes as RTF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
- item?.tag = 4
|
|
|
- item = subMenu.addItem(title: NSLocalizedString("Notes as RTFD", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
- item?.tag = 5
|
|
|
- item = subMenu.addItem(title: NSLocalizedString("Notes as FDF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
- item?.tag = 6
|
|
|
-
|
|
|
- menu.addItem(.separator())
|
|
|
- if self.outlineView(self.noteOutlineView, canDeleteItems: items as! [Any]) {
|
|
|
- item = menu.addItem(title: KMLocalizedString("Delete", "Menu item title"), action: #selector(deleteNotes), target: self)
|
|
|
- item?.representedObject = items
|
|
|
- }
|
|
|
- item = menu.addItem(title: NSLocalizedString("Remove All Annotations", tableName: "MainMenu", comment: "Menu item title"), action: #selector(removeAllAnnotations), target: self)
|
|
|
- }
|
|
|
+ if self.outlineView(self.noteOutlineView, canDeleteItems: items as! [Any]) {
|
|
|
+ item = menu.addItem(title: KMLocalizedString("Delete", "Menu item title"), action: #selector(deleteNotes), target: self)
|
|
|
+ item?.representedObject = items
|
|
|
}
|
|
|
+ item = menu.addItem(title: NSLocalizedString("Remove All Annotations", tableName: "MainMenu", comment: "Menu item title"), action: #selector(removeAllAnnotations), target: self)
|
|
|
}
|
|
|
+ } else {
|
|
|
+ let subMenu = NSMenu()
|
|
|
+ item?.submenu = subMenu
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("PDF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 0
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("PDF Bundle", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 1
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("PDF Reader Pro Edition Notes", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 2
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as Texts", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 3
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as RTF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 4
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as RTFD", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 5
|
|
|
+ item = subMenu.addItem(title: NSLocalizedString("Notes as FDF", tableName: "MainMenu", comment: "Menu item title"), action: #selector(exportAnnotationNotes), target: self)
|
|
|
+ item?.tag = 6
|
|
|
+
|
|
|
+ item = menu.addItem(title: NSLocalizedString("Remove All Annotations", tableName: "MainMenu", comment: "Menu item title"), action: #selector(removeAllAnnotations), target: self)
|
|
|
}
|
|
|
}
|
|
|
-// else {
|
|
|
-// item = [menu addItemWithTitle:NSLocalizedStringFromTable(@"Export Annotations…", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-//
|
|
|
-// NSMenu *subMenu = [NSMenu menu];
|
|
|
-// item.submenu = subMenu;
|
|
|
-// item = [subMenu addItemWithTitle:NSLocalizedStringFromTable(@"PDF", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-// item.tag = 0;
|
|
|
-// item = [subMenu addItemWithTitle:NSLocalizedStringFromTable(@"PDF Bundle", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-// item.tag = 1;
|
|
|
-// item = [subMenu addItemWithTitle:NSLocalizedStringFromTable(@"PDF Reader Pro Edition Notes", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-// item.tag = 2;
|
|
|
-// item = [subMenu addItemWithTitle:NSLocalizedStringFromTable(@"Notes as Text", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-// item.tag = 3;
|
|
|
-// item = [subMenu addItemWithTitle:NSLocalizedStringFromTable(@"Notes as RTF", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-// item.tag = 4;
|
|
|
-// item = [subMenu addItemWithTitle:NSLocalizedStringFromTable(@"Notes as RTFD", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-// item.tag = 5;
|
|
|
-// item = [subMenu addItemWithTitle:NSLocalizedStringFromTable(@"Notes as FDF", @"MainMenu", @"Menu item title") action:@selector(exportAnnotationNotes:) target:self];
|
|
|
-// item.tag = 6;
|
|
|
-//
|
|
|
-// item = [menu addItemWithTitle:NSLocalizedStringFromTable(@"Remove All Annotations", @"MainMenu", @"Menu item title") action:@selector(removeAllAnnotations:) target:self];
|
|
|
-// }
|
|
|
-// }
|
|
|
}
|
|
|
}
|
|
|
|