|
@@ -514,6 +514,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_cutAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override func oem_cutAction() {
|
|
|
let pageCnt = self.pdfDocument?.pageCount ?? 0
|
|
|
if (self.thumbnailView.selectionIndexPaths.count == pageCnt) {
|
|
|
self._progressHUD(message: NSLocalizedString("Can not delete all pages.", comment: ""))
|
|
@@ -540,6 +553,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_deleteAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_deleteAction() {
|
|
|
if self.isEmptySelection() {
|
|
|
self._progressHUD(message: KMLocalizedString(Self.kNoPagesSelectedTipMessage))
|
|
|
return
|
|
@@ -579,7 +605,18 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_leftRotateAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_leftRotateAction() {
|
|
|
self.trackEvent(type: .leftRotate)
|
|
|
|
|
|
super.leftRotateAction()
|
|
@@ -607,6 +644,20 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_rightRotateAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_rightRotateAction() {
|
|
|
+
|
|
|
if self.isEmptySelection() {
|
|
|
self._progressHUD(message: KMLocalizedString(Self.kNoPagesSelectedTipMessage))
|
|
|
return
|
|
@@ -643,6 +694,18 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_pasteAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override func oem_pasteAction() {
|
|
|
if (self.canPaste()) {
|
|
|
super.pasteAction()
|
|
|
|
|
@@ -671,7 +734,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_pastePage(at: index)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_pastePage(at index: Int) {
|
|
|
super.pastePage(at: index)
|
|
|
}
|
|
|
|
|
@@ -686,6 +761,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_extractAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_extractAction() {
|
|
|
|
|
|
if self.isEmptySelection() {
|
|
|
self._progressHUD(message: KMLocalizedString(Self.kNoPagesSelectedTipMessage))
|
|
@@ -712,7 +800,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.replaceAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override func oem_replaceAction() {
|
|
|
if self.isEmptySelection() {
|
|
|
self._progressHUD(message: KMLocalizedString(Self.kNoPagesSelectedTipMessage))
|
|
|
return
|
|
@@ -754,7 +854,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_splitAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ func oem_splitAction() {
|
|
|
if self.isEmptySelection() {
|
|
|
self._progressHUD(message: KMLocalizedString(Self.kNoPagesSelectedTipMessage))
|
|
|
return
|
|
@@ -777,7 +889,18 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_splitMethod(windowC: windowC, model: model, limit: limit)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_splitMethod(windowC: KMPageEditSplitWindowController, model: KMPageEditSplitSettingModel, limit: Bool = false) {
|
|
|
if self.isEmptySelection() {
|
|
|
self._progressHUD(message: KMLocalizedString(Self.kNoPagesSelectedTipMessage))
|
|
|
return
|
|
@@ -787,15 +910,15 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
}
|
|
|
|
|
|
func splitMenuAction() {
|
|
|
-// if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
|
|
|
-// #if VERSION_DMG
|
|
|
-// [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
|
|
|
-// #else
|
|
|
-// KMToolCompareWindowController * vc = [KMToolCompareWindowController toolCompareWithType:KMCompareWithToolType_PageEdit setSelectIndex:1];
|
|
|
-// [vc startModal:nil];
|
|
|
-// #endif
|
|
|
-// return;
|
|
|
-// }
|
|
|
+ // if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
|
|
|
+ // #if VERSION_DMG
|
|
|
+ // [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
|
|
|
+ // #else
|
|
|
+ // KMToolCompareWindowController * vc = [KMToolCompareWindowController toolCompareWithType:KMCompareWithToolType_PageEdit setSelectIndex:1];
|
|
|
+ // [vc startModal:nil];
|
|
|
+ // #endif
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
if IAPProductsManager.default().isAvailableAllFunction() == false {
|
|
|
let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
if self.kEventTag == 1 {
|
|
@@ -806,6 +929,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_splitMenuAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_splitMenuAction() {
|
|
|
|
|
|
let pdf = self.thumbnailView.document
|
|
|
let pages = self.thumbnailView.selectionIndexPaths
|
|
@@ -887,6 +1023,20 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_reverseAction()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_reverseAction() {
|
|
|
+
|
|
|
|
|
|
let cnt = self.thumbnailView.selectionIndexPaths.count
|
|
|
if cnt < 2 {
|
|
@@ -1379,6 +1529,19 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_item_insertCustomPage(sender: sender)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_item_insertCustomPage(sender: NSMenuItem?) {
|
|
|
|
|
|
guard let doc = self.pdfDocument else {
|
|
|
NSSound.beep()
|
|
@@ -1440,6 +1603,20 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_item_insertFromImage(sender: sender)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_item_insertFromImage(sender: NSMenuItem?) {
|
|
|
|
|
|
let openPanel = NSOpenPanel()
|
|
|
openPanel.allowedFileTypes = KMImageToPDFMethod.supportedImageTypes()
|
|
@@ -1502,6 +1679,20 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance { can, err in
|
|
|
+ if can {
|
|
|
+ self.oem_item_insertFromClipboard(sender: sender)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ KMMainThreadExecute {
|
|
|
+ let winC = KMPurchaseCompareWindowController.sharedInstance()
|
|
|
+ winC?.showWindow(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_item_insertFromClipboard(sender: NSMenuItem?) {
|
|
|
+
|
|
|
// self.choosePositionWindow {[weak self] index in
|
|
|
/// 插入位置
|
|
|
var error: NSError?
|
|
@@ -1529,6 +1720,15 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ AccountTools.canUseAdvance_success { can in
|
|
|
+ if can {
|
|
|
+ self.oem_item_insertFromScanner(sender: sender)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_item_insertFromScanner(sender: NSMenuItem?) {
|
|
|
+
|
|
|
let vc = KMDeviceBrowserWindowController.shared
|
|
|
vc.type = .scanner
|
|
|
vc.importScannerFileCallback = { [weak self](url: NSURL) -> Void in
|
|
@@ -1606,6 +1806,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
|
|
|
winC?.showWindow(nil)
|
|
|
return
|
|
|
}
|
|
|
+ AccountTools.canUseAdvance_success { can in
|
|
|
+ if can {
|
|
|
+ self.oem_extractSelectPageItemAction()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func oem_extractSelectPageItemAction() {
|
|
|
|
|
|
let indexs = self.thumbnailView.selectionIndexPaths
|
|
|
if indexs.isEmpty {
|