Browse Source

【2025】【Toolbar】二级工具栏增加刷新方法

niehaoyu 4 months ago
parent
commit
0ef2b511c8

+ 27 - 7
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFSecToolbarController.swift

@@ -50,28 +50,28 @@ class KMPDFSecToolbarController: NSViewController {
     
     
     
-    //MARK: - refresh
-    public func refreshPropertys(_ arr: [Any]) {
+    //MARK: - reload
+    public func reloadMainPropertys(_ arr: [Any]) {
         propertys.removeAll()
         
         for item in arr {
             propertys.append(item)
         }
         
-        reloadData()
+        reloadMainView()
     }
     
-    public func refreshRightPropertys(_ arr: [Any]) {
+    public func reloadRightPropertys(_ arr: [Any]) {
         rightPropertys.removeAll()
         
         for item in arr {
             rightPropertys.append(item)
         }
         
-        reloadRightViewData()
+        reloadRightView()
     }
     
-    func reloadData() {
+    func reloadMainView() {
         let subviews = infoContendView.subviews
         for view in subviews {
             view.removeFromSuperview()
@@ -121,7 +121,7 @@ class KMPDFSecToolbarController: NSViewController {
          
     }
     
-    func reloadRightViewData() {
+    func reloadRightView() {
         let subviews = rightContendView.subviews
         for view in subviews {
             view.removeFromSuperview()
@@ -161,6 +161,26 @@ class KMPDFSecToolbarController: NSViewController {
          
     }
     
+    func refreshMainview() {
+        let subviews = infoContendView.subviews
+        for view in subviews {
+            if view is ComponentButton {
+                (view as! ComponentButton).reloadData()
+            } else if view is ComponentDropdownTool {
+                (view as! ComponentDropdownTool).reloadData()
+            }
+        }
+    }
+    
+    func refreshRightview() {
+        let subviews = rightContendView.subviews
+        for view in subviews {
+            if view is ComponentButton {
+                (view as! ComponentButton).reloadData()
+            }
+        }
+    }
+    
     
     //MARK: -
     @objc func buttonClicked(_ sender: ComponentButton) {

+ 13 - 4
PDF Office/PDF Master/KMClass/KMPDFViewController/PDFView/Toolbar/KMPDFToolbarController.swift

@@ -26,6 +26,8 @@ class KMPDFToolbarController: NSViewController {
     
     @IBOutlet var secondContendView: NSView!
     
+    var pdfView: CPDFListView?
+    
     var secondToolBar: KMPDFSecToolbarController = KMPDFSecToolbarController.init()
     
     weak open var delegate: KMPDFToolbarControllerDelegate?
@@ -118,14 +120,21 @@ class KMPDFToolbarController: NSViewController {
     func reloadSecondToolbar() {
         let _manager = KMPDFToolbarManager.manager
         if KMPDFManager.manager.isPageEditMode {
-            secondToolBar.refreshPropertys(_manager.getSubToolbarItems(isPageEditMode: true))
-            secondToolBar.refreshRightPropertys([_manager.page_Reduce_Property, _manager.page_Increase_Property])
+            secondToolBar.reloadMainPropertys(_manager.getSubToolbarItems(isPageEditMode: true))
+            secondToolBar.reloadRightPropertys([_manager.page_Reduce_Property, _manager.page_Increase_Property])
         } else {
-            secondToolBar.refreshPropertys(_manager.getSubToolbarItems(KMPDFManager.manager.toolMode))
-            secondToolBar.refreshRightPropertys([])
+            secondToolBar.reloadMainPropertys(_manager.getSubToolbarItems(KMPDFManager.manager.toolMode))
+            secondToolBar.reloadRightPropertys([])
         }
     }
     
+    //只刷新Item状态
+    func refreshSecondToolbarItemsState() {
+        secondToolBar.refreshMainview()
+        
+        secondToolBar.refreshRightview()
+    }
+    
     func reloadData() {
         reloadLeftIconView()
         

+ 17 - 98
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -4,102 +4,6 @@
    type = "1"
    version = "2.0">
    <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "CEE492D2-2BA3-4390-96BB-58A4EB4B43A7"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "252"
-            endingLineNumber = "252"
-            landmarkName = "previousButtonClicked(_:)"
-            landmarkType = "7">
-            <Locations>
-               <Location
-                  uuid = "CEE492D2-2BA3-4390-96BB-58A4EB4B43A7 - b7c1748d1b4c7c4f"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "KMComponentLibrary.ComponentSidebarPageTurner.previousButtonClicked(KMComponentLibrary.ComponentButton) -&gt; ()"
-                  moduleName = "KMComponentLibrary"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "252"
-                  endingLineNumber = "252"
-                  offsetFromSymbolStart = "548">
-               </Location>
-               <Location
-                  uuid = "CEE492D2-2BA3-4390-96BB-58A4EB4B43A7 - b7c1748d1b4c7c4f"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "KMComponentLibrary.ComponentSidebarPageTurner.previousButtonClicked(KMComponentLibrary.ComponentButton) -&gt; ()"
-                  moduleName = "KMComponentLibrary"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "252"
-                  endingLineNumber = "252"
-                  offsetFromSymbolStart = "56">
-               </Location>
-            </Locations>
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "D0042A5D-F833-4B8D-9CCC-70C173BC0C9E"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "263"
-            endingLineNumber = "263"
-            landmarkName = "nextButtonClicked(_:)"
-            landmarkType = "7">
-            <Locations>
-               <Location
-                  uuid = "D0042A5D-F833-4B8D-9CCC-70C173BC0C9E - d65d1035a6ce3128"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "KMComponentLibrary.ComponentSidebarPageTurner.nextButtonClicked(KMComponentLibrary.ComponentButton) -&gt; ()"
-                  moduleName = "KMComponentLibrary"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "263"
-                  endingLineNumber = "263"
-                  offsetFromSymbolStart = "548">
-               </Location>
-               <Location
-                  uuid = "D0042A5D-F833-4B8D-9CCC-70C173BC0C9E - d65d1035a6ce3128"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "KMComponentLibrary.ComponentSidebarPageTurner.nextButtonClicked(KMComponentLibrary.ComponentButton) -&gt; ()"
-                  moduleName = "KMComponentLibrary"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/KMComponentLibrary/KMComponentLibrary/View/SideBar/SideBarItem/PageTurner/ComponentSidebarPageTurner.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "263"
-                  endingLineNumber = "263"
-                  offsetFromSymbolStart = "56">
-               </Location>
-            </Locations>
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -112,8 +16,8 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "166"
             endingLineNumber = "166"
-            landmarkName = "pdfViewDocumentDidLoaded(_:)"
-            landmarkType = "7">
+            landmarkName = "unknown"
+            landmarkType = "0">
             <Locations>
                <Location
                   uuid = "E10380B2-D370-4BFB-AF3B-7589CF50C78F - af4556db9bd7fd42"
@@ -145,6 +49,21 @@
                   endingLineNumber = "166"
                   offsetFromSymbolStart = "52">
                </Location>
+               <Location
+                  uuid = "E10380B2-D370-4BFB-AF3B-7589CF50C78F - 564f5fa2731a4b73"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMPDFViewController.kmPDFSideBarControllerDidGotoPage(PDF_Reader_Pro.KMPDFSideBarController, Swift.Int) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMPDFViewController/KMPDFViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "166"
+                  endingLineNumber = "166"
+                  offsetFromSymbolStart = "272">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>