Kaynağa Gözat

【页面编辑】拆分新增页面范围的容错处理

tangchao 1 yıl önce
ebeveyn
işleme
a8a6cc5ab2

+ 22 - 0
PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/KMPageEditSplitWindowController.swift

@@ -129,4 +129,26 @@ class KMPageEditSplitWindowController: KMPageEditSettingBaseWindowController {
         self.funcVC?.stringValue = NSLocalizedString("Split", comment: "")
         self.funcVC?.updateUI()
     }
+    
+    override func funcButtonAction() {
+        guard let _model = self.model as? KMPageEditSplitSettingModel else {
+            super.funcButtonAction()
+            return
+        }
+        
+        if (_model.pageRangeType == 2) {
+            let pages = KMPageRangeTools.findSelectPage(pageRangeString: _model.pageRangeString, pageCount: _model.pageCount)
+            if (pages.isEmpty) {
+                let alert = NSAlert()
+                alert.messageText = NSLocalizedString("Value must be between 1 and \(_model.pageCount)", comment: "")
+                alert.informativeText = NSLocalizedString("Values cannot exceed the page range.", comment: "")
+                alert.runModal()
+                (self.settingView as? KMPageEditSplitSettingView)?.setPageRangeString("1")
+                
+                _model.pageRangeString = "1"
+                return
+            }
+        }
+        super.funcButtonAction()
+    }
 }