ソースを参照

[幻灯片设置] - 顶部菜单栏,幻灯片设置页优化

liujiajie 6 ヶ月 前
コミット
d84820c18e

+ 46 - 20
PDF Office/PDF Master/Class/PDFWindowController/MainWindowController/SKPresentationOptionsSheetController.swift

@@ -106,7 +106,9 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
     required init?(coder: NSCoder) {
         super.init(coder: coder)
     }
-    
+    deinit {
+        NSLog("===SKPresentationOptionsSheetController==")
+    }
     override func windowDidLoad() {
         super.windowDidLoad()
         
@@ -265,8 +267,8 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
                 info.label = "\(tn?.label ?? "")"+"→"+"\(next.label)"
                 info.properties = ((ptEnum?.nextObject()) != nil) ? ptEnum?.nextObject() as? NSDictionary : dictionary
                 array.append(info)
-                (cell as AnyObject).setStringValue(info.label)
-                labelWidth = max(labelWidth, ceil(((cell as AnyObject).cellSize?.width) ?? 0))
+//                (cell as AnyObject).setStringValue(info.label)
+//                labelWidth = max(labelWidth, ceil(((cell as AnyObject).cellSize?.width) ?? 0))
             }
             tn = next
         }
@@ -606,27 +608,51 @@ extension SKPresentationOptionsSheetController: NSTableViewDelegate, NSTableView
         return self.transitions?.count ?? 0
     }
     
-    func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
+//    func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
+//        let identifier = tableColumn?.identifier
+//        let info = transitions?[row] as? KMTransitionInfo
+//
+//        if let id = identifier?.rawValue, id == PAGE_COLUMNID {
+//            let cell = tableColumn?.dataCell as? NSTextFieldCell
+//            cell?.stringValue = info?.label ?? ""
+//            return info?.label ?? ""
+//        } else if let id = identifier?.rawValue, id == IMAGE_COLUMNID {
+//            let cell = tableColumn?.dataCell as? NSImageCell
+//            let page = self.controller?.listView.document.page(at: UInt(info?.thumbnail?.pageIndex ?? 0))
+//            let image = page?.thumbnail(of: page?.bounds.size ?? .zero)
+//            
+////            cell?.image = image
+//            return image
+////            if let data = page?.PDFListViewTIFFData(for: page?.bounds ?? .zero) {
+////                let image = NSImage(data: data)
+////                cell?.image = image
+////                return image
+////            }
+//        }
+//        return nil
+//    }
+//    
+    func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
         let identifier = tableColumn?.identifier
         let info = transitions?[row] as? KMTransitionInfo
-
-        if let id = identifier?.rawValue, id == PAGE_COLUMNID {
-            let cell = tableColumn?.dataCell as? NSTextFieldCell
-            cell?.stringValue = info?.label ?? ""
-            return info?.label ?? ""
-        } else if let id = identifier?.rawValue, id == IMAGE_COLUMNID {
-            let cell = tableColumn?.dataCell as? NSImageCell
+        
+        var cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("KMPresentTableViewCell"), owner: self)
+        if cell == nil {
+            cell = KMPresentTableViewCell(type: .text)
+        }
+        let myCellView: KMPresentTableViewCell = cell! as! KMPresentTableViewCell
+//        if let id = identifier?.rawValue, id == PAGE_COLUMNID {
+//            let cellView = KMPresentTableViewCell(type: .text)
+        myCellView.label?.stringValue = info?.label ?? ""
+//            return cellView
+//        } else if let id = identifier?.rawValue, id == IMAGE_COLUMNID {
+//            let cellView = KMPresentTableViewCell(type: .img)
             let page = self.controller?.listView.document.page(at: UInt(info?.thumbnail?.pageIndex ?? 0))
             let image = page?.thumbnail(of: page?.bounds.size ?? .zero)
-            cell?.image = image
-            return image
-//            if let data = page?.PDFListViewTIFFData(for: page?.bounds ?? .zero) {
-//                let image = NSImage(data: data)
-//                cell?.image = image
-//                return image
-//            }
-        }
-        return nil
+        myCellView.iv?.image = image
+//            return cellView
+//        }
+        return myCellView;
     }
     
     func tableViewSelectionDidChange(_ notification: Notification) {

+ 25 - 17
PDF Office/PDF Master/Class/PDFWindowController/MainWindowController/TransitionSheet.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment version="1060" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -32,7 +32,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="282" y="439" width="426" height="280"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="213" height="107"/>
             <view key="contentView" id="8">
                 <rect key="frame" x="0.0" y="0.0" width="426" height="280"/>
@@ -203,31 +203,39 @@ Gw
                             <rect key="frame" x="1" y="1" width="85" height="238"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="32" id="279" customClass="KMBotaTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="32" rowSizeStyle="automatic" viewBased="YES" id="279" customClass="KMBotaTableView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                     <rect key="frame" x="0.0" y="0.0" width="85" height="238"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <size key="intercellSpacing" width="3" height="2"/>
                                     <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                     <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                     <tableColumns>
-                                        <tableColumn identifier="image" editable="NO" width="32" minWidth="32" maxWidth="32" id="280">
+                                        <tableColumn identifier="image" editable="NO" width="64" minWidth="64" maxWidth="64" id="280">
                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                 <color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
                                             </tableHeaderCell>
                                             <imageCell key="dataCell" controlSize="small" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="283"/>
-                                        </tableColumn>
-                                        <tableColumn identifier="page" editable="NO" width="10" minWidth="10" maxWidth="1000" id="281">
-                                            <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
-                                                <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
-                                                <color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
-                                            </tableHeaderCell>
-                                            <textFieldCell key="dataCell" controlSize="small" lineBreakMode="truncatingTail" alignment="left" id="282">
-                                                <font key="font" metaFont="smallSystem"/>
-                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                                <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                            </textFieldCell>
-                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
+                                            <prototypeCellViews>
+                                                <tableCellView id="ReJ-73-Njm">
+                                                    <rect key="frame" x="1" y="1" width="73" height="32"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="G0p-F2-AHf">
+                                                            <rect key="frame" x="0.0" y="8" width="73" height="16"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+                                                            <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="Ip4-Cx-pHm">
+                                                                <font key="font" usesAppearanceFont="YES"/>
+                                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            </textFieldCell>
+                                                        </textField>
+                                                    </subviews>
+                                                    <connections>
+                                                        <outlet property="textField" destination="G0p-F2-AHf" id="bjW-bA-OEQ"/>
+                                                    </connections>
+                                                </tableCellView>
+                                            </prototypeCellViews>
                                         </tableColumn>
                                     </tableColumns>
                                     <connections>

+ 94 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMPresentTableViewCell.swift

@@ -0,0 +1,94 @@
+//
+//  KMPresentTableViewCell.swift
+//  PDF Reader Pro
+//
+//  Created by liujiajie on 5/14/24.
+//
+
+import Cocoa
+
+
+@objc enum KMPresentTableViewCellType: Int {
+    case img = 0
+    case text
+}
+
+class KMPresentTableViewCell: NSTableCellView{
+ 
+    var contentView: NSView?
+    var iv: NSImageView?
+    var label: NSTextField?
+    var type: KMPresentTableViewCellType?
+    
+    convenience init(type: KMPresentTableViewCellType) {
+        self.init()
+//        switch type {
+//        case .img:
+//            configuUIForImg()
+//        case .text:
+//            configuUIForText()
+//        default:
+//            break
+//        }
+        configuUi()
+        self.type = type
+    }
+//    convenience init() {
+//        self.init()
+//        configuUi()
+//    }
+    func configuUIForImg() {
+        self.iv = NSImageView(frame: .zero)
+        self.addSubview(self.iv!)
+        
+        self.iv?.mas_makeConstraints({ make in
+            make?.edges.equalTo()(self)
+//            make?.left.equalTo()(self)
+//            make?.top.equalTo()(self)?.offset()(12)
+//            make?.width.equalTo()(16)
+//            make?.height.equalTo()(16)
+        })
+    }
+    func configuUIForText() {
+        let tf = NSTextField(frame: .zero)
+        self.label = tf
+        self.label?.isBordered = false
+        self.label?.drawsBackground = true
+        self.label?.backgroundColor = NSColor.clear
+        self.label?.isEditable = false
+        self.addSubview(self.label!)
+        self.label?.mas_makeConstraints({ make in
+            make?.top.equalTo()(self)?.offset()(13)
+            make?.left.equalTo()(self)
+            
+        })
+        self.label?.textColor = KMAppearance.Layout.h0Color()
+        self.label?.font = NSFont.systemFont(ofSize: 12)
+    }
+    func configuUi() {
+        self.iv = NSImageView(frame: .zero)
+        self.addSubview(self.iv!)
+        self.iv?.mas_makeConstraints({ make in
+            make?.left.equalTo()(0)
+            make?.top.equalTo()(0)
+            make?.width.equalTo()(32)
+            make?.bottom.equalTo()(0)
+        })
+        let tf = NSTextField(frame: .zero)
+        self.label = tf
+        self.label?.isBordered = false
+        self.label?.drawsBackground = true
+        self.label?.backgroundColor = NSColor.clear
+        self.label?.isEditable = false
+        self.addSubview(self.label!)
+        self.label?.mas_makeConstraints({ make in
+//            make?.top.equalTo()(self)?.offset()(13)
+            make?.left.equalTo()(self.iv?.mas_right)
+            make?.right.equalTo()(self)
+            make?.centerY.equalTo()(self)
+        })
+        self.label?.textColor = KMAppearance.Layout.h0Color()
+        self.label?.font = NSFont.systemFont(ofSize: 12)
+        self.label?.maximumNumberOfLines = 1
+    }
+}

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift

@@ -343,10 +343,10 @@ extension KMMainViewController {
     @IBAction func chooseTransition(_ sender: Any?) {
         let presentationSheetController = SKPresentationOptionsSheetController()
         presentationSheetController.controller = self
-        let window = NSWindow.currentWindow()
-        window.km_beginSheet(windowC: presentationSheetController)
-        presentationSheetController.closeCallBack = { vc in
-            window.km_quick_endSheet()
+//        let window = NSWindow.currentWindow()
+        self.km_beginSheet(windowC: presentationSheetController)
+        presentationSheetController.closeCallBack = {[weak self] vc in
+            self?.km_quick_endSheet()
         }
     }
     

+ 8 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -4784,6 +4784,9 @@
 		BBDA8A6D2A31F9A6006A2C4E /* KMDesignStepperView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBDA8A6C2A31F9A6006A2C4E /* KMDesignStepperView.swift */; };
 		BBDA8A6E2A31F9A6006A2C4E /* KMDesignStepperView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBDA8A6C2A31F9A6006A2C4E /* KMDesignStepperView.swift */; };
 		BBDA8A6F2A31F9A6006A2C4E /* KMDesignStepperView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBDA8A6C2A31F9A6006A2C4E /* KMDesignStepperView.swift */; };
+		BBDE52BB2BF3676C000545B2 /* KMPresentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBDE52BA2BF3676C000545B2 /* KMPresentTableViewCell.swift */; };
+		BBDE52BC2BF3676C000545B2 /* KMPresentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBDE52BA2BF3676C000545B2 /* KMPresentTableViewCell.swift */; };
+		BBDE52BD2BF3676C000545B2 /* KMPresentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBDE52BA2BF3676C000545B2 /* KMPresentTableViewCell.swift */; };
 		BBE0BDF329A22EF300440583 /* KMMainViewController+MenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBE0BDF229A22EF300440583 /* KMMainViewController+MenuAction.swift */; };
 		BBE0BDF429A22EF300440583 /* KMMainViewController+MenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBE0BDF229A22EF300440583 /* KMMainViewController+MenuAction.swift */; };
 		BBE0BDF529A22EF300440583 /* KMMainViewController+MenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBE0BDF229A22EF300440583 /* KMMainViewController+MenuAction.swift */; };
@@ -7194,6 +7197,7 @@
 		BBD922392B50D6D600DB9585 /* rate_pic_free.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = rate_pic_free.pdf; sourceTree = "<group>"; };
 		BBDA8A682A31B50C006A2C4E /* KMCustomStepperView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMCustomStepperView.swift; sourceTree = "<group>"; };
 		BBDA8A6C2A31F9A6006A2C4E /* KMDesignStepperView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMDesignStepperView.swift; sourceTree = "<group>"; };
+		BBDE52BA2BF3676C000545B2 /* KMPresentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPresentTableViewCell.swift; sourceTree = "<group>"; };
 		BBE0BDF229A22EF300440583 /* KMMainViewController+MenuAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KMMainViewController+MenuAction.swift"; sourceTree = "<group>"; };
 		BBE66D082B55467C009343FA /* repeatTrialAlert_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = repeatTrialAlert_icon.png; sourceTree = "<group>"; };
 		BBE78F1A2B36F69F0071AC1A /* KMLeftSideViewController+Note.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KMLeftSideViewController+Note.swift"; sourceTree = "<group>"; };
@@ -12648,6 +12652,7 @@
 			children = (
 				BBA00AC32B157C880043D903 /* KMToolbarZoomItemView.swift */,
 				BBD3C8B52B2C438F00EB0867 /* KMToolbarPreviousNextItemView.swift */,
+				BBDE52BA2BF3676C000545B2 /* KMPresentTableViewCell.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -16368,6 +16373,7 @@
 				BB2F9AAB2AFCADA900F9DD93 /* KMProfileCellView.swift in Sources */,
 				BB49ED15293F489500C82CA2 /* KMConvertImageSettingView.swift in Sources */,
 				ADBC375D29CC61E100D93208 /* KMReadModelView.swift in Sources */,
+				BBDE52BB2BF3676C000545B2 /* KMPresentTableViewCell.swift in Sources */,
 				BB0FE0372B734DD1001E0F88 /* AIConfigWindowController.swift in Sources */,
 				AD7D5CE42B96B394006562CD /* KMBookmarkOutlineSeparatorCellView.swift in Sources */,
 				BB6013902AD3AFF000A76FB2 /* NSPopover+KMExtension.swift in Sources */,
@@ -17595,6 +17601,7 @@
 				BBC347FE295448DE008D2CD1 /* KMWatermarkTemplateModel.swift in Sources */,
 				ADFA8EFE2B5649AE002595A4 /* KMAutoFlowOptionsSheetController.swift in Sources */,
 				9FB220F82B186C9800A5B208 /* KMAnnotationGeneralViewController.swift in Sources */,
+				BBDE52BC2BF3676C000545B2 /* KMPresentTableViewCell.swift in Sources */,
 				BB88107D2B4F7A1F00AFA63E /* KMActivityALertViewController.m in Sources */,
 				BB6B436C2A04935000E02B54 /* KMPDFThumbViewBaseController.swift in Sources */,
 				ADE3C1FA29A5C42300793B13 /* KMLightMemberUserInfo.swift in Sources */,
@@ -18756,6 +18763,7 @@
 				BB49ED08293F461500C82CA2 /* KMConvertCSVWindowController.swift in Sources */,
 				ADE8BC4029F9458700570F89 /* KMRecommondInfo.m in Sources */,
 				BB27BF3E2B33E85200A0BAAE /* CPDFView+KMExtension.swift in Sources */,
+				BBDE52BD2BF3676C000545B2 /* KMPresentTableViewCell.swift in Sources */,
 				ADB2D6E8294740F30029D2B3 /* KMPrintPaperSetWindowController.swift in Sources */,
 				AD867FC329DFC39400F00440 /* KMBOTAAnnotationItem.swift in Sources */,
 				ADDF83432B391A5C00A81A4E /* DSignatureConfigWindowController.swift in Sources */,