|
@@ -17,18 +17,18 @@ extension KMLeftSideViewController: NSMenuDelegate {
|
|
|
func menuNeedsUpdate(_ menu: NSMenu) {
|
|
|
if menu.isEqual(to: self.tocOutlineView.menu) {
|
|
|
menu.removeAllItems()
|
|
|
- var item = menu.addItem(withTitle: NSLocalizedString("Add Item", comment: ""), action: #selector(outlineContextMenuItemClicked_AddEntry), target: self, tag: KMOutlineViewMenuItemTag.addEntry.rawValue)
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Add Sub-Item", comment: ""), action: #selector(outlineContextMenuItemClicked_AddChildEntry), target: self, tag: KMOutlineViewMenuItemTag.addChild.rawValue)
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Add To A Higher Level", comment: ""), action: #selector(outlineContextMenuItemClicked_AddAuntEntry), target: self, tag: KMOutlineViewMenuItemTag.addAunt.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Add Item", comment: ""), action: #selector(outlineContextMenuItemClicked_AddEntry), target: self, tag: KMOutlineViewMenuItemTag.addEntry.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Add Sub-Item", comment: ""), action: #selector(outlineContextMenuItemClicked_AddChildEntry), target: self, tag: KMOutlineViewMenuItemTag.addChild.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Add To A Higher Level", comment: ""), action: #selector(outlineContextMenuItemClicked_AddAuntEntry), target: self, tag: KMOutlineViewMenuItemTag.addAunt.rawValue)
|
|
|
menu.addItem(.separator())
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Delete", comment: ""), action: #selector(outlineContextMenuItemClicked_RemoveEntry), target: self, tag: KMOutlineViewMenuItemTag.remove.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Delete", comment: ""), action: #selector(outlineContextMenuItemClicked_RemoveEntry), target: self, tag: KMOutlineViewMenuItemTag.remove.rawValue)
|
|
|
menu.addItem(.separator())
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Edit", comment: ""), action: #selector(outlineContextMenuItemClicked_Edit), target: self, tag: KMOutlineViewMenuItemTag.edit.rawValue)
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Change Destination", comment: ""), action: #selector(outlineContextMenuItemClicked_SetDestination), target: self, tag: KMOutlineViewMenuItemTag.setDestination.rawValue)
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Rename", comment: ""), action: #selector(outlineContextMenuItemClicked_Rename), target: self, tag: KMOutlineViewMenuItemTag.rename.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Edit", comment: ""), action: #selector(outlineContextMenuItemClicked_Edit), target: self, tag: KMOutlineViewMenuItemTag.edit.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Change Destination", comment: ""), action: #selector(outlineContextMenuItemClicked_SetDestination), target: self, tag: KMOutlineViewMenuItemTag.setDestination.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Rename", comment: ""), action: #selector(outlineContextMenuItemClicked_Rename), target: self, tag: KMOutlineViewMenuItemTag.rename.rawValue)
|
|
|
menu.addItem(.separator())
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Promote", comment: ""), action: #selector(outlineContextMenuItemClicked_Promote), target: self, tag: KMOutlineViewMenuItemTag.promote.rawValue)
|
|
|
- item = menu.addItem(withTitle: NSLocalizedString("Demote", comment: ""), action: #selector(outlineContextMenuItemClicked_Demote), target: self, tag: KMOutlineViewMenuItemTag.demote.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Promote", comment: ""), action: #selector(outlineContextMenuItemClicked_Promote), target: self, tag: KMOutlineViewMenuItemTag.promote.rawValue)
|
|
|
+ _ = menu.addItem(withTitle: NSLocalizedString("Demote", comment: ""), action: #selector(outlineContextMenuItemClicked_Demote), target: self, tag: KMOutlineViewMenuItemTag.demote.rawValue)
|
|
|
return
|
|
|
}
|
|
|
var item: NSMenuItem?
|
|
@@ -73,9 +73,9 @@ extension KMLeftSideViewController: NSMenuDelegate {
|
|
|
|
|
|
item = menu.addItem(title: KMLocalizedString("Insert", "Menu item title"), action: nil, target: self)
|
|
|
let subMenu = NSMenu()
|
|
|
- subMenu.addItem(title: KMLocalizedString("Blank Page", "Menu item title"), action: #selector(quickInsert), target: self)
|
|
|
- subMenu.addItem(title: KMLocalizedString("Blank Page - Custom...", "Menu item title"), action: #selector(insert), target: self)
|
|
|
- subMenu.addItem(title: KMLocalizedString("From PDF", "Menu item title"), action: #selector(insertPDF), target: self)
|
|
|
+ _ = subMenu.addItem(title: KMLocalizedString("Blank Page", "Menu item title"), action: #selector(quickInsert), target: self)
|
|
|
+ _ = subMenu.addItem(title: KMLocalizedString("Blank Page - Custom...", "Menu item title"), action: #selector(insert), target: self)
|
|
|
+ _ = subMenu.addItem(title: KMLocalizedString("From PDF", "Menu item title"), action: #selector(insertPDF), target: self)
|
|
|
item?.submenu = subMenu
|
|
|
item?.representedObject = IndexSet(integer: row)
|
|
|
|
|
@@ -101,12 +101,12 @@ extension KMLeftSideViewController: NSMenuDelegate {
|
|
|
// if (tName.length > 50) {
|
|
|
// tName = [tName substringWithRange:NSMakeRange(0, 50)];
|
|
|
// }
|
|
|
- var tName = self.listView.document.documentURL.lastPathComponent
|
|
|
+ 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)
|
|
|
}
|
|
|
} else if menu.isEqual(to: self.findTableView.menu) {
|
|
|
var rowIndexes = self.findTableView.selectedRowIndexes
|
|
|
- var row = self.findTableView.clickedRow
|
|
|
+ let row = self.findTableView.clickedRow
|
|
|
if (row != -1) {
|
|
|
if rowIndexes.contains(row) == false {
|
|
|
rowIndexes = IndexSet(integer: row)
|
|
@@ -134,7 +134,7 @@ extension KMLeftSideViewController: NSMenuDelegate {
|
|
|
}
|
|
|
} else if menu.isEqual(to: self.groupedFindTableView.menu) {
|
|
|
var rowIndexes = self.groupedFindTableView.selectedRowIndexes
|
|
|
- var row = self.groupedFindTableView.clickedRow
|
|
|
+ let row = self.groupedFindTableView.clickedRow
|
|
|
if (row != -1) {
|
|
|
if rowIndexes.contains(row) == false {
|
|
|
rowIndexes = IndexSet(integer: row)
|