|
@@ -621,6 +621,32 @@ extension KMMainViewController {
|
|
|
sheet.pageBox.addItems(withObjectValues: pages)
|
|
|
sheet.stringValue = "\(self.listView.currentPageIndex+1)"
|
|
|
}
|
|
|
+
|
|
|
+ @IBAction func goToMarkedPage(_ sender: Any?) {
|
|
|
+ guard let pdfDoc = self.listView.document, pdfDoc.isLocked == false && pdfDoc.pageCount > 0 else {
|
|
|
+ NSSound.beep()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ guard let currentPageIndex = self.listView.currentPage()?.pageIndex() else {
|
|
|
+ NSSound.beep()
|
|
|
+ return
|
|
|
+ }
|
|
|
+// if (markedPageIndex == NSNotFound || [pdfDoc isLocked] || [pdfDoc pageCount] == 0) {
|
|
|
+// NSBeep();
|
|
|
+// } else if (beforeMarkedPageIndex != NSNotFound) {
|
|
|
+ if self.beforeMarkedPageIndex != NSNotFound {
|
|
|
+ self.listView.goToPage(at: min(UInt(self.beforeMarkedPageIndex), pdfDoc.pageCount-1), point: self.beforeMarkedPagePoint)
|
|
|
+ } else if (currentPageIndex != self.markedPageIndex) {
|
|
|
+// NSUInteger lastPageIndex = [pdfView currentPageIndexAndPoint:&beforeMarkedPagePoint rotated:NULL];
|
|
|
+ let lastPageIndex = self.listView.currentPageIndexAndPoint(&self.beforeMarkedPagePoint, rotated: nil)
|
|
|
+ self.listView.goToPage(at: min(UInt(self.markedPageIndex), pdfDoc.pageCount-1), point: self.markedPagePoint)
|
|
|
+ self.beforeMarkedPageIndex = Int(lastPageIndex)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @IBAction func markPage(_ sender: Any?) {
|
|
|
+ self.markedPageIndex = Int(self.listView.currentPageIndexAndPoint(&self.markedPagePoint, rotated: nil))
|
|
|
+ self.beforeMarkedPageIndex = NSNotFound
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// MARK: tool Menu
|