|
@@ -256,10 +256,12 @@ extension KMMainViewController {
|
|
|
let outline = NSMenuItem(title: NSLocalizedString("Add outline", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 9)!
|
|
|
// let tts = NSMenuItem(title: NSLocalizedString("TTS", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 10)!
|
|
|
menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
|
|
|
- menu.insertItem(height, at: menu.items.count)
|
|
|
- menu.insertItem(underline, at: menu.items.count)
|
|
|
- menu.insertItem(strickout, at: menu.items.count)
|
|
|
- menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
|
|
|
+ if listView.currentSelection.selectionType() != .image {
|
|
|
+ menu.insertItem(height, at: menu.items.count)
|
|
|
+ menu.insertItem(underline, at: menu.items.count)
|
|
|
+ menu.insertItem(strickout, at: menu.items.count)
|
|
|
+ menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
|
|
|
+ }
|
|
|
menu.insertItem(text, at: menu.items.count)
|
|
|
menu.insertItem(note, at: menu.items.count)
|
|
|
menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
|
|
@@ -435,22 +437,24 @@ extension KMMainViewController {
|
|
|
case 8:
|
|
|
annotationType = .link
|
|
|
case 9:
|
|
|
- var newOutline : CPDFOutline = CPDFOutline()
|
|
|
- newOutline.label = "11111111"
|
|
|
- let des = self.listView.currentDestination
|
|
|
- if "\(des?.point.x ?? 0)" != "nan" {
|
|
|
- newOutline.destination = self.listView.currentDestination
|
|
|
- } else {
|
|
|
- let destination : CPDFDestination = CPDFDestination(document: self.listView.document, pageIndex: self.listView.currentPageIndex, at: CGPoint(x: 0, y: 0), zoom: self.listView.scaleFactor)
|
|
|
- newOutline.destination = destination
|
|
|
- }
|
|
|
- let current = self.listView.document.outlineRoot().insertChild(at: 0) ?? CPDFOutline()
|
|
|
- let parent = current.parent ?? CPDFOutline()
|
|
|
- let index = current.index + 1
|
|
|
- parent.insertChild(newOutline, at: index)
|
|
|
- if self.leftSideViewController.type.methodType == .Outline {
|
|
|
- self.leftSideViewController.outlineViewController.reloadData()
|
|
|
+// var newOutline : CPDFOutline = CPDFOutline()
|
|
|
+// newOutline.label = "11111111"
|
|
|
+// let des = self.listView.currentDestination
|
|
|
+// if "\(des?.point.x ?? 0)" != "nan" {
|
|
|
+// newOutline.destination = self.listView.currentDestination
|
|
|
+// } else {
|
|
|
+// let destination : CPDFDestination = CPDFDestination(document: self.listView.document, pageIndex: self.listView.currentPageIndex, at: CGPoint(x: 0, y: 0), zoom: self.listView.scaleFactor)
|
|
|
+// newOutline.destination = destination
|
|
|
+// }
|
|
|
+// let current = self.listView.document.outlineRoot().insertChild(at: 0) ?? CPDFOutline()
|
|
|
+// let parent = current.parent ?? CPDFOutline()
|
|
|
+// let index = current.index + 1
|
|
|
+// parent.insertChild(newOutline, at: index)
|
|
|
+ if self.leftPanelOpen == false || self.leftSideViewController.type.methodType != .Outline {
|
|
|
+ self.leftSideViewController.refreshMethodType(methodType: .Outline)
|
|
|
}
|
|
|
+ self.leftSideViewController.outlineViewController.addPDFOutlineCurrentSelections()
|
|
|
+ return
|
|
|
case 10:
|
|
|
annotationType = .unkown
|
|
|
default:
|
|
@@ -1165,13 +1169,13 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
@objc func openRightPane() -> Void {
|
|
|
- if KMPreferenceManager.shared.showOutlineList == false {
|
|
|
+ if KMPreferenceManager.shared.leftSideExpandType == 0 {
|
|
|
applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: defaultRightWidth)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@objc func closeRightPane() -> Void {
|
|
|
- if KMPreferenceManager.shared.showOutlineList == false {
|
|
|
+ if KMPreferenceManager.shared.leftSideExpandType == 0 {
|
|
|
applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: 0)
|
|
|
}
|
|
|
}
|