3 次代碼提交 222ca8d815 ... ccfb407a2b

作者 SHA1 備註 提交日期
  liaoxiaoyue ccfb407a2b Merge branch 'develop' of http://git.kdan.cc:8865/Mac_PDF/PDF_Office into develop 1 年之前
  liaoxiaoyue 8104ffc622 【属性面板】- 图章模式下添加图章,再点击空白区域,显示图章列表 1 年之前
  liaoxiaoyue 513382de4b 【工具栏】- 手动输入缩放比例,回车生效 1 年之前

+ 5 - 0
PDF Office/PDF Office/Class/PDFWindowController/Toolbar/KMToolbarController.swift

@@ -19,6 +19,7 @@ import Cocoa
     @objc optional func changePDFViewGoToPreviousPageAction()
     @objc optional func showPDFViewPrintViewController()
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomModel selectedTag:Int)
+    @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomSting : String)
     @objc optional func mainToolDidClicked(_ toolController: KMToolbarController, _ type: KMToolbarViewType, _ item: KMToolBoxItem)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, shareDocument item:NSMenuItem)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, shareFlatten item:NSMenuItem)
@@ -392,6 +393,10 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
     func toolbarViewController(_ viewController: KMToolbarViewController, zoomModel selectedTag: Int) {
         self.delegate?.toolbarViewController?(viewController, zoomModel: selectedTag)
     }
+
+    func toolbarViewController(_ viewController:KMToolbarViewController, zoomSting : String) {
+        self.delegate?.toolbarViewController?(viewController, zoomSting: zoomSting)
+    }
     
     func changePDFViewZoomInAction() {
         self.delegate?.changePDFViewZoomInAction?()

+ 10 - 1
PDF Office/PDF Office/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -58,6 +58,7 @@ import Cocoa
     @objc optional func changePDFViewGotoNextPageAction()
     @objc optional func changePDFViewGoToPreviousPageAction()
     @objc optional func showPDFViewPrintViewController()
+    @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomSting : String)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomModel selectedTag:Int)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, shareDocument item:NSMenuItem)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, shareFlatten item:NSMenuItem)
@@ -68,7 +69,7 @@ import Cocoa
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, rightPanel toolbarItem: KMToolBoxItem)
 }
 
-class KMToolbarViewController: NSViewController {
+class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
 
     var toolbar : KMToolbar!
     var toolbarType : KMToolbarViewType = KMToolbarViewType.None
@@ -83,6 +84,7 @@ class KMToolbarViewController: NSViewController {
     var shareButton = KMToolbarClickButton()
     override func viewDidLoad() {
         super.viewDidLoad()
+        self.zoomTextField.delegate = self
         NotificationCenter.default.addObserver(self, selector: #selector(listViewAnnotationTypeChangeNotification), name: Notification.Name("CPDFListViewAnnotationTypeChangeNotification"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(listViewAnnotationTypeChangeNotification), name: Notification.Name("CPDFListViewToolModeChangeNotification"), object: nil)
     }
@@ -267,6 +269,13 @@ class KMToolbarViewController: NSViewController {
         }
         return KMToolBoxItem()
     }
+    
+    func controlTextDidEndEditing(_ obj: Notification) {
+        let textField = obj.object as? NSTextField
+        if textField == self.zoomTextField {
+            self.delegate?.toolbarViewController?(self, zoomSting: self.zoomTextField.stringValue)
+        }
+    }
 }
 
 extension KMToolbarViewController : KMNewToolbarDelegate,NSToolbarItemValidation {

+ 6 - 1
PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -1157,7 +1157,7 @@ extension KMMainViewController {
     
     // 开启/关闭右边栏
     @objc func toggleRightPane() -> Void {
-        if lastRightPanWidth > 1 {
+        if lastRightPanWidth > 5 {
             applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: 0)
         } else {
             applyLeftSideWidth(lastLeftPanWidth, rightSideWidth: defaultRightWidth)
@@ -1362,6 +1362,11 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
        viewController.zoomTextField.stringValue =  "\(Int(self.listView.scaleFactor*100))%"
     }
     
+    func toolbarViewController(_ viewController: KMToolbarViewController, zoomSting: String) {
+        self.listView.scaleFactor = CGFloat((NSString(string: zoomSting)).floatValue / 100.0)
+        viewController.zoomTextField.stringValue =  "\(Int(self.listView.scaleFactor*100))%"
+    }
+    
     func changePDFViewZoomInAction() {
         self.listView.zoomIn(nil)
         self.updateZoomInOutButtonState()

+ 8 - 3
PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -736,9 +736,14 @@ import Cocoa
                 self.rightSideViewController?.reloadDataWithPDFView(pdfView: pdfListView, isShow: true)
                 self.openRightPane()
             }
-        } else if (annotations.count == 0 && pdfListView.annotationType == .unkown){
-            self.rightSideViewController?.reloadDataWithPDFView(pdfView: pdfListView, isShow: false)
-            self.closeRightPane()
+        } else if (annotations.count == 0){
+            if  pdfListView.annotationType == .unkown {
+                self.rightSideViewController?.reloadDataWithPDFView(pdfView: pdfListView, isShow: false)
+                self.closeRightPane()
+            } else {
+                self.rightSideViewController?.reloadDataWithPDFView(pdfView: pdfListView, isShow: true)
+                self.openRightPane()
+            }
         }
     }