Przeglądaj źródła

【综合】整理代码

tangchao 3 miesięcy temu
rodzic
commit
184482b9ef

+ 21 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Outline/KMImageNameOutlineMore.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "icon_prefix.pdf",
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 83 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/Outline/KMImageNameOutlineMore.imageset/icon_prefix.pdf

@@ -0,0 +1,83 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 2.000000 6.667969 cm
+0.250980 0.274510 0.325490 scn
+0.000000 1.332682 m
+0.000000 2.069062 0.596954 2.666016 1.333333 2.666016 c
+2.069713 2.666016 2.666667 2.069062 2.666667 1.332682 c
+2.666667 0.596303 2.069713 -0.000651 1.333333 -0.000651 c
+0.596954 -0.000651 0.000000 0.596303 0.000000 1.332682 c
+h
+4.666667 1.332682 m
+4.666667 2.069062 5.263620 2.666016 6.000000 2.666016 c
+6.736380 2.666016 7.333333 2.069062 7.333333 1.332682 c
+7.333333 0.596303 6.736380 -0.000651 6.000000 -0.000651 c
+5.263620 -0.000651 4.666667 0.596303 4.666667 1.332682 c
+h
+9.333334 1.332682 m
+9.333334 2.069062 9.930287 2.666016 10.666667 2.666016 c
+11.403046 2.666016 12.000000 2.069062 12.000000 1.332682 c
+12.000000 0.596303 11.403048 -0.000651 10.666667 -0.000651 c
+9.930287 -0.000651 9.333334 0.596303 9.333334 1.332682 c
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  880
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000970 00000 n
+0000000992 00000 n
+0000001165 00000 n
+0000001239 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1298
+%%EOF

+ 9 - 4
PDF Office/PDF Master/KMClass/Left/Outline/Controller/KMOutlineViewController.swift

@@ -48,9 +48,10 @@ class KMOutlineViewController: KMNBaseViewController {
         return view
     }()
     
-    private lazy var moreDropdown_: ComponentDropdown = {
-        let view = ComponentDropdown()
-        view.properties = ComponentDropdownProperty(type: .split_primary, size: .xxs, state: .normal, split: false, disabled: false)
+    private lazy var moreDropdown_: ComponentButton = {
+        let view = ComponentButton()
+//        view.properties = ComponentDropdownProperty(type: .split_primary, size: .xxs, state: .normal, split: false, disabled: false)
+        view.properties = ComponentButtonProperty(type: .text_gray, size: .xxs, state: .normal, isDisable: false, onlyIcon: true, icon: NSImage(named: "KMImageNameOutlineMore"))
         return view
     }()
     
@@ -104,7 +105,7 @@ class KMOutlineViewController: KMNBaseViewController {
         moreDropdown_.km_add_size_constraint(size: NSMakeSize(24, 24))
         moreDropdown_.km_add_centerX_constraint()
         moreDropdown_.km_add_centerY_constraint()
-        moreDropdown_.componentDelegate = self
+        moreDropdown_.setTarget(self, action: #selector(_moreAction))
         
         if let data = headerSearchView_ {
             topView.addSubview(data)
@@ -362,6 +363,10 @@ class KMOutlineViewController: KMNBaseViewController {
         headerSearchView_?.isHidden = true
     }
     
+    @objc private func _moreAction() {
+        self.showGroupView()
+    }
+    
     //MARK: - GroupView
     
     func showGroupView() {

+ 14 - 0
PDF Office/PDF Master/KMClass/Left/Outline/View/KMBOTAOutlineView.swift

@@ -55,6 +55,8 @@ class KMBOTAOutlineView: BaseXibView {
         self.outlineView.selectionHighlightStyle = NSTableView.SelectionHighlightStyle.none;
         self.outlineView.allowsMultipleSelection = true
 //        self.outlineView.indentationPerLevel = 0
+        outlineView.tocDelegate = self
+        outlineView.hasImageToolTips = true
     }
     
     func reloadData(expandItemType: KMOutlineViewExpandItemType = .none) {
@@ -244,6 +246,18 @@ extension KMBOTAOutlineView : NSOutlineViewDataSource,NSOutlineViewDelegate {
     }
 }
 
+extension KMBOTAOutlineView: KMTocOutlineViewDelegate {
+    func outlineView(_ anOutlineView: NSOutlineView, imageContextForItem item: Any?) -> AnyObject? {
+        if item == nil {
+            return true as AnyObject
+        }
+        if let data = item as? KMBOTAOutlineItem {
+            return data.outline.destination
+        }
+        return nil
+    }
+}
+
 //MARK: Action
 extension KMBOTAOutlineView {
     @objc func expandAllComments(item: NSMenuItem) {

+ 1 - 1
PDF Office/PDF Master/KMClass/Left/Outline/View/KMOutlineView.swift

@@ -13,7 +13,7 @@ enum KMOutlineViewExpandItemType: Int {
     case collapse
 }
 
-class KMOutlineView: NSOutlineView {
+class KMOutlineView: KMTocOutlineView {
     
     override func makeView(withIdentifier identifier: NSUserInterfaceItemIdentifier, owner: Any?) -> NSView? {
         let view = super.makeView(withIdentifier: identifier, owner: owner)

+ 2 - 2
PDF Office/PDF Master/KMClass/Left/Outline/View/KMTocOutlineView.swift

@@ -212,9 +212,9 @@ extension KMTocOutlineView {
             self._handleHighlightsChanged()
         } else {
             if let win = self.window, win.isMainWindow || win.isKeyWindow {
-                self.backgroundColor = NSColor(calibratedRed: 0.839216, green: 0.866667, blue: 0.898039, alpha: 1)
+//                self.backgroundColor = NSColor(calibratedRed: 0.839216, green: 0.866667, blue: 0.898039, alpha: 1)
             } else {
-                self.backgroundColor = .controlColor
+//                self.backgroundColor = .controlColor
             }
             self.needsDisplay = true
         }