Browse Source

【BOTA】左边栏选中状态跟随偏好设置调整

Signed-off-by: niehaoyu <niehaoyu@kdanmobile.com>
niehaoyu 1 year ago
parent
commit
1dc18d3f12

BIN
PDF Office/PDF Office.xcodeproj/project.xcworkspace/xcuserdata/kdanmobile.xcuserdatad/UserInterfaceState.xcuserstate


+ 7 - 7
PDF Office/PDF Office.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -68,34 +68,34 @@
             landmarkType = "7">
             <Locations>
                <Location
-                  uuid = "13813B5C-3F41-4C88-9EE6-09ADD5321550 - 9e62c61c106c50e1"
+                  uuid = "13813B5C-3F41-4C88-9EE6-09ADD5321550 - 12bb2f2d58f370e8"
                   shouldBeEnabled = "Yes"
                   ignoreCount = "0"
                   continueAfterRunningActions = "No"
                   symbolName = "static PDF_Office.KMPrintWindowController.openFiles(window: __C.NSWindow, pageRange: PDF_Office.KMPrintPageRange) -&gt; ()"
                   moduleName = "PDF Office"
                   usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Office/Class/PDFTools/Print/KMPrintWindowController.swift"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Office/Class/PDFTools/Print/KMPrintWindowController.swift"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
                   startingLineNumber = "95"
                   endingLineNumber = "95"
-                  offsetFromSymbolStart = "84">
+                  offsetFromSymbolStart = "100">
                </Location>
                <Location
-                  uuid = "13813B5C-3F41-4C88-9EE6-09ADD5321550 - d5a431df5ecc376"
+                  uuid = "13813B5C-3F41-4C88-9EE6-09ADD5321550 - 8183aa2cbd73e37f"
                   shouldBeEnabled = "Yes"
                   ignoreCount = "0"
                   continueAfterRunningActions = "No"
                   symbolName = "closure #1 (__C.NSOpenPanel) -&gt; () in static PDF_Office.KMPrintWindowController.openFiles(window: __C.NSWindow, pageRange: PDF_Office.KMPrintPageRange) -&gt; ()"
                   moduleName = "PDF Office"
                   usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Office/Class/PDFTools/Print/KMPrintWindowController.swift"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Office/Class/PDFTools/Print/KMPrintWindowController.swift"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
                   startingLineNumber = "97"
                   endingLineNumber = "97"
-                  offsetFromSymbolStart = "38">
+                  offsetFromSymbolStart = "36">
                </Location>
             </Locations>
          </BreakpointContent>
@@ -112,7 +112,7 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "348"
             endingLineNumber = "348"
-            landmarkName = "menuItemAction_nextPage(_:)"
+            landmarkName = "menuItemAction_circle(_:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>

+ 4 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -355,6 +355,10 @@ extension KMLeftSideViewController: NSTableViewDelegate,NSTableViewDataSource {
                 self.delegate?.controlStateChange?(self,show:show)
                 self.leftTableview.selectRowIndexes([index], byExtendingSelection: true)
                 self.leftTableview.reloadData()
+                
+                UserDefaults.standard.set(index, forKey: "KMBOTASelectedIndexKey")
+                UserDefaults.standard.synchronize()
+                
             }
         }
         return cell

+ 27 - 2
PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -99,7 +99,7 @@ import Cocoa
                 listView.scaleFactor = 1.0
             }
         }
-        self.initPDFListView()
+        self.initPDFLeftViewVC()
         self.initRightSideView()
         self.toolbarController.listView = self.listView
     }
@@ -138,13 +138,15 @@ import Cocoa
         self.locationPageView.layer?.backgroundColor = NSColor(red: 189.0/255.0, green: 223.0/255.0, blue: 253.0/255.0, alpha: 1).cgColor
         self.tipLabel.stringValue = NSLocalizedString("Please use the scroll bar, thumbnail tool to locate the target page, click or box the area to select the target range.", comment: "")
         
+        self.checkShouldAutoOpenLeftVC()
+        
         NotificationCenter.default.addObserver(self, selector: #selector(rename(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerRename"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(showInFinder(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerShowInFinder"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(preferenceDidChangeNotification), name: Notification.Name(KMPreferenceDidChangeNotificationName), object: nil)
     }
         
     //MARK: - PDFListView
-    func initPDFListView() {
+    func initPDFLeftViewVC() {
         leftSideViewController.listView = self.listView ?? CPDFListView()
         leftSideViewController.view.frame = CGRect(x: 0, y:0 , width: self.leftView.frame.size.width, height: self.leftView.frame.size.height)
         leftSideViewController.view.autoresizingMask = [.height,.width]
@@ -193,6 +195,29 @@ import Cocoa
     
     // MARK: Private Methods
     
+    func checkShouldAutoOpenLeftVC() {
+        if (KMPreferenceManager.shared.leftSideDisplayType == 0) {
+            return
+        }
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) {
+            let selectedIndex = UserDefaults.standard.integer(forKey: "KMBOTASelectedIndexKey")
+            let thumai = KMLeftMethodMode()
+            if selectedIndex == 0 {
+                thumai.methodType = .Thumbnail
+            } else if selectedIndex == 1 {
+                thumai.methodType = .Outline
+            } else if selectedIndex == 2 {
+                thumai.methodType = .BookMark
+            } else if selectedIndex == 3 {
+                thumai.methodType = .Annotation
+            } else if selectedIndex == 4 {
+                thumai.methodType = .Search
+            }
+            var show = true
+            self.leftSideViewController.refreshMethodType(newType: thumai, show:show)
+        }
+    }
+    
     func applyLeftSideWidth(_ leftSideWidth: CGFloat, rightSideWidth: CGFloat) -> Void {
         mianSplitView.setPosition(leftSideWidth, ofDividerAt: 0)
         mianSplitView.setPosition(mianSplitView.maxPossiblePositionOfDivider(at: 1) - mianSplitView.dividerThickness - rightSideWidth, ofDividerAt: 1)