|
@@ -341,13 +341,6 @@ class KMOutlineViewController: NSViewController,NSMenuItemValidation {
|
|
|
self.renameTextField.becomeFirstResponder()
|
|
|
}
|
|
|
|
|
|
- func movePDFOutline(outline : CPDFOutline! , toIndex index : NSInteger , atParent parent : CPDFOutline!) {
|
|
|
- outline.removeFromParent()
|
|
|
- parent.insertChild(outline, at: UInt(index))
|
|
|
- self.outlineView.reloadData()
|
|
|
- self.outlineView.expandItem(parent)
|
|
|
- }
|
|
|
-
|
|
|
func addPDFOutlineCurrentSelections() {
|
|
|
var string : String = ""
|
|
|
if self.listView.currentSelection.selectionsByLine != nil {
|
|
@@ -776,7 +769,22 @@ extension KMOutlineViewController : NSPopoverDelegate {
|
|
|
|
|
|
//MARK: undoRedo
|
|
|
extension KMOutlineViewController {
|
|
|
+ func movePDFOutline(outline : CPDFOutline! , toIndex index : NSInteger , atParent parent : CPDFOutline!) {
|
|
|
+ self.view.window?.makeFirstResponder(self.outlineView)
|
|
|
+ let indexTemp = outline.index
|
|
|
+ let parentTemp = outline.parent
|
|
|
+ outline.removeFromParent()
|
|
|
+ parent.insertChild(outline, at: UInt(index))
|
|
|
+ self.outlineView.reloadData()
|
|
|
+ self.outlineView.expandItem(parent)
|
|
|
+
|
|
|
+ self.undoRedoManager.registerUndo(withTarget: self) { targetType in
|
|
|
+ self.movePDFOutline(outline: outline, toIndex: NSInteger(indexTemp), atParent: parentTemp)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
func changeLocation(outline: CPDFOutline, destination: CPDFDestination) {
|
|
|
+ self.view.window?.makeFirstResponder(self.outlineView)
|
|
|
let temp = CPDFDestination(document: outline.destination.document, pageIndex: outline.destination.pageIndex, at: outline.destination.point, zoom: outline.destination.zoom)
|
|
|
|
|
|
outline.destination = destination
|
|
@@ -788,6 +796,7 @@ extension KMOutlineViewController {
|
|
|
}
|
|
|
|
|
|
func renamePDFOutline(outline: CPDFOutline!, label: String) {
|
|
|
+ self.view.window?.makeFirstResponder(self.outlineView)
|
|
|
self.renameTextField.isEditable = false
|
|
|
if outline.label == label {
|
|
|
return
|
|
@@ -806,6 +815,7 @@ extension KMOutlineViewController {
|
|
|
}
|
|
|
|
|
|
func deleteOutline(outlineItems: [KMOutlineItem]) {
|
|
|
+ self.view.window?.makeFirstResponder(self.outlineView)
|
|
|
for outlineItem in outlineItems {
|
|
|
outlineItem.outline.removeFromParent()
|
|
|
self.outlineView.reloadData()
|