Procházet zdrojové kódy

【综合】右边栏密文UI处理

niehaoyu před 2 roky
rodič
revize
03e30656bb

+ 16 - 0
PDF Office/PDF Office.xcodeproj/project.pbxproj

@@ -152,6 +152,12 @@
 		BB2C6AD128F445B600478A33 /* ComPDFKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BB2C6A7828F26A1500478A33 /* ComPDFKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		BB2C6AD328F445B900478A33 /* ComPDFKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB2C6A7828F26A1500478A33 /* ComPDFKit.framework */; };
 		BB2C6AD428F445B900478A33 /* ComPDFKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BB2C6A7828F26A1500478A33 /* ComPDFKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+		BB4BD9CC2909026500A66A65 /* KMRightSideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4BD9CA2909026500A66A65 /* KMRightSideViewController.swift */; };
+		BB4BD9CD2909026500A66A65 /* KMRightSideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4BD9CA2909026500A66A65 /* KMRightSideViewController.swift */; };
+		BB4BD9CE2909026500A66A65 /* KMRightSideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4BD9CA2909026500A66A65 /* KMRightSideViewController.swift */; };
+		BB4BD9CF2909026500A66A65 /* KMRightSideViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB4BD9CB2909026500A66A65 /* KMRightSideViewController.xib */; };
+		BB4BD9D02909026500A66A65 /* KMRightSideViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB4BD9CB2909026500A66A65 /* KMRightSideViewController.xib */; };
+		BB4BD9D12909026500A66A65 /* KMRightSideViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB4BD9CB2909026500A66A65 /* KMRightSideViewController.xib */; };
 		BB86C1ED28F544F4005AD968 /* CPDFListView+MouseEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C1EC28F544F4005AD968 /* CPDFListView+MouseEvent.m */; };
 		BB86C1EE28F544F4005AD968 /* CPDFListView+MouseEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C1EC28F544F4005AD968 /* CPDFListView+MouseEvent.m */; };
 		BB86C1EF28F544F4005AD968 /* CPDFListView+MouseEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C1EC28F544F4005AD968 /* CPDFListView+MouseEvent.m */; };
@@ -393,6 +399,8 @@
 		BB2C6AC728F4085200478A33 /* CPDFListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFListView.h; sourceTree = "<group>"; };
 		BB2C6AC828F4085200478A33 /* CPDFListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFListView.m; sourceTree = "<group>"; };
 		BB2C6ACA28F40A5600478A33 /* CPDFListViewConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFListViewConfig.h; sourceTree = "<group>"; };
+		BB4BD9CA2909026500A66A65 /* KMRightSideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMRightSideViewController.swift; sourceTree = "<group>"; };
+		BB4BD9CB2909026500A66A65 /* KMRightSideViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMRightSideViewController.xib; sourceTree = "<group>"; };
 		BB86C1EB28F544F4005AD968 /* CPDFListView+MouseEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CPDFListView+MouseEvent.h"; sourceTree = "<group>"; };
 		BB86C1EC28F544F4005AD968 /* CPDFListView+MouseEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CPDFListView+MouseEvent.m"; sourceTree = "<group>"; };
 		BB86C1F028F54535005AD968 /* CPDFListView+KeyEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CPDFListView+KeyEvent.h"; sourceTree = "<group>"; };
@@ -870,6 +878,8 @@
 		BB8B172F2907A81E001C5EA5 /* RightSide */ = {
 			isa = PBXGroup;
 			children = (
+				BB4BD9CA2909026500A66A65 /* KMRightSideViewController.swift */,
+				BB4BD9CB2909026500A66A65 /* KMRightSideViewController.xib */,
 				BB8B17302907B48E001C5EA5 /* CipherTextView */,
 			);
 			path = RightSide;
@@ -1270,6 +1280,7 @@
 				9FBA0EE428FEC253001117AF /* KMProductPromotionViewController.xib in Resources */,
 				8997011928F40898009AF911 /* KMThumbnailViewController.xib in Resources */,
 				9FA607E128FD4C9F00B46586 /* KMHomePopViewController.xib in Resources */,
+				BB4BD9CF2909026500A66A65 /* KMRightSideViewController.xib in Resources */,
 				8997012E28F42F15009AF911 /* Biochemistry.pdf in Resources */,
 				9F78EFBE28F7C1CC001E66F4 /* KMHomeViewController.xib in Resources */,
 				899700E228F3A9F2009AF911 /* KMHomeWindowController.xib in Resources */,
@@ -1313,6 +1324,7 @@
 				8997010228F40710009AF911 /* KMBookMarkViewController.xib in Resources */,
 				89D9897028FD50EF003A3E87 /* KMAnnotationCollectionViewItem.xib in Resources */,
 				9FBA0EEA28FFC2FE001117AF /* Image.xcassets in Resources */,
+				BB4BD9D02909026500A66A65 /* KMRightSideViewController.xib in Resources */,
 				8997012F28F42F15009AF911 /* Biochemistry.pdf in Resources */,
 				BBFBE74D28DD7DE8008B2335 /* Assets.xcassets in Resources */,
 				8997010A28F4082C009AF911 /* KMFromViewController.xib in Resources */,
@@ -1358,6 +1370,7 @@
 				8997011328F40842009AF911 /* KMOutlineViewController.xib in Resources */,
 				9FBA0EE628FEC253001117AF /* KMProductPromotionViewController.xib in Resources */,
 				9FA607E328FD4C9F00B46586 /* KMHomePopViewController.xib in Resources */,
+				BB4BD9D12909026500A66A65 /* KMRightSideViewController.xib in Resources */,
 				8997013028F42F15009AF911 /* Biochemistry.pdf in Resources */,
 				9FBA0EF328FFC716001117AF /* KMHomeFastToolViewController.xib in Resources */,
 				89D9897128FD50EF003A3E87 /* KMAnnotationCollectionViewItem.xib in Resources */,
@@ -1397,6 +1410,7 @@
 				9FBA0EFE29015A82001117AF /* KMFastToolCollectionViewItem.swift in Sources */,
 				BB86C21E28F561F8005AD968 /* SKRuntime.m in Sources */,
 				9FA607DE28FD4C9F00B46586 /* KMHomePopViewController.swift in Sources */,
+				BB4BD9CC2909026500A66A65 /* KMRightSideViewController.swift in Sources */,
 				899700F628F4051B009AF911 /* KMAnnotationViewController.swift in Sources */,
 				899700DF28F3A9F2009AF911 /* KMHomeWindowController.swift in Sources */,
 				BB8B17322907B63D001C5EA5 /* CipherTextView.swift in Sources */,
@@ -1476,6 +1490,7 @@
 				9FBA0EFF29015A82001117AF /* KMFastToolCollectionViewItem.swift in Sources */,
 				BB86C21F28F561F8005AD968 /* SKRuntime.m in Sources */,
 				9FA607DF28FD4C9F00B46586 /* KMHomePopViewController.swift in Sources */,
+				BB4BD9CD2909026500A66A65 /* KMRightSideViewController.swift in Sources */,
 				899700F728F4051B009AF911 /* KMAnnotationViewController.swift in Sources */,
 				899700E028F3A9F2009AF911 /* KMHomeWindowController.swift in Sources */,
 				BB8B17332907B63D001C5EA5 /* CipherTextView.swift in Sources */,
@@ -1555,6 +1570,7 @@
 				9FBA0F0029015A82001117AF /* KMFastToolCollectionViewItem.swift in Sources */,
 				BB86C22028F561F8005AD968 /* SKRuntime.m in Sources */,
 				9FA607E028FD4C9F00B46586 /* KMHomePopViewController.swift in Sources */,
+				BB4BD9CE2909026500A66A65 /* KMRightSideViewController.swift in Sources */,
 				899700F828F4051B009AF911 /* KMAnnotationViewController.swift in Sources */,
 				899700E128F3A9F2009AF911 /* KMHomeWindowController.swift in Sources */,
 				BB8B17342907B63D001C5EA5 /* CipherTextView.swift in Sources */,

binární
PDF Office/PDF Office.xcodeproj/project.xcworkspace/xcuserdata/kdanmobile.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 3
PDF Office/PDF Office.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,17 +7,17 @@
 		<key>PDF Office DMG.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>0</integer>
 		</dict>
 		<key>PDF Office Pro.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>2</integer>
+			<integer>1</integer>
 		</dict>
 		<key>PDF Office.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>0</integer>
+			<integer>2</integer>
 		</dict>
 	</dict>
 </dict>

+ 2 - 2
PDF Office/PDF Office/Class/Home/ViewController/KMHomeViewController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21219" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21219"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

+ 7 - 8
PDF Office/PDF Office/Class/PDFWindowController/MainWindowController/MainWindowController.swift

@@ -13,8 +13,8 @@ class MainWindowController: NSWindowController,CPDFViewDelegate,CPDFListViewDele
     
     var listView: CPDFListView!
     var leftSideViewController : KMLeftSideViewController = KMLeftSideViewController.init(type: .Thumbnail)
+    var rightSideViewController : KMRightSideViewController!
     
-    var cipherTextView : CipherTextView!
     
     override func windowDidLoad() {
         super.windowDidLoad()
@@ -53,13 +53,12 @@ class MainWindowController: NSWindowController,CPDFViewDelegate,CPDFListViewDele
     
     func initRightSideView() {
 
-        self.cipherTextView = CipherTextView.createFromNib()
-        self.cipherTextView.frame = CGRect(x: 500, y: 0, width: 300, height: 300)
-//        self.cipherTextView = CipherTextView.init(frame: CGRect(x: 500, y: 0, width: 300, height: 300));
-        self.cipherTextView.autoresizingMask = [.height]
-        self.cipherTextView.setUp()
-        self.window?.contentView?.addSubview(self.cipherTextView)
-
+        self.rightSideViewController = KMRightSideViewController.init()
+        self.rightSideViewController.view.frame = CGRect(x: 600, y: 0, width: 300, height: (self.window?.contentView?.frame.size.height)!)
+        self.rightSideViewController.view.autoresizingMask = [.height,.maxXMargin]
+        self.rightSideViewController.subViewType = RightSubViewType.CipherTextType
+        self.window?.contentView?.addSubview(self.rightSideViewController.view)
+        
     }
     
     

+ 22 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/RightSide/CipherTextView/CipherTextView.swift

@@ -9,6 +9,12 @@ import Cocoa
 
 class CipherTextView: NSView,NibLoadable {
 
+    @IBOutlet var cipherTextBtn: NSButton!
+    @IBOutlet var pageCipherTextBtn: NSButton!
+    @IBOutlet var settingBtn: NSButton!
+    
+    let cipherTextDelegate:CipherTextViewDelegate! = nil
+    
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
 
@@ -20,4 +26,20 @@ class CipherTextView: NSView,NibLoadable {
 //        self.layer?.backgroundColor = NSColor.red.cgColor
     }
       
+    @IBAction func buttonAction(_ sender: NSButton) {
+        if sender == self.settingBtn {
+            print("setting")
+//            if self.cipherTextDelegate && self.cipherTextDelegate resp
+            if self.cipherTextDelegate != nil {
+                self.cipherTextDelegate.cipherTextViewButtonClicked(textView: self, buttonIndex: 0)
+                
+            }
+        }
+    }
+    
+    
+}
+
+protocol CipherTextViewDelegate {
+    func cipherTextViewButtonClicked(textView:CipherTextView,buttonIndex:Int)
 }

+ 29 - 5
PDF Office/PDF Office/Class/PDFWindowController/Side/RightSide/CipherTextView/CipherTextView.xib

@@ -18,20 +18,44 @@
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                     <subviews>
                         <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yE1-PU-LB7">
-                            <rect key="frame" x="97" y="328" width="75" height="32"/>
+                            <rect key="frame" x="212" y="353" width="75" height="32"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                             <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="sbO-1X-RD7">
                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                 <font key="font" metaFont="system"/>
                             </buttonCell>
+                            <connections>
+                                <action selector="buttonAction:" target="c22-O7-iKe" id="4sz-3X-xKA"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yjf-cp-69Y">
+                            <rect key="frame" x="105" y="264" width="75" height="32"/>
+                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="t98-sr-9zN">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                        </button>
+                        <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vk7-2o-4CH">
+                            <rect key="frame" x="0.0" y="0.0" width="300" height="242"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        </customView>
+                        <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h4b-jK-bhv">
+                            <rect key="frame" x="105" y="310" width="75" height="32"/>
+                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="23a-z1-AiH">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
                         </button>
                     </subviews>
                 </customView>
-                <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vk7-2o-4CH">
-                    <rect key="frame" x="0.0" y="0.0" width="300" height="305"/>
-                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                </customView>
             </subviews>
+            <connections>
+                <outlet property="cipherTextBtn" destination="yjf-cp-69Y" id="OwF-8T-PVX"/>
+                <outlet property="pageCipherTextBtn" destination="h4b-jK-bhv" id="yuG-6D-K5R"/>
+                <outlet property="settingBtn" destination="yE1-PU-LB7" id="3iw-fB-a3l"/>
+            </connections>
             <point key="canvasLocation" x="29" y="200"/>
         </customView>
     </objects>

+ 69 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.swift

@@ -0,0 +1,69 @@
+//
+//  KMRightSideViewController.swift
+//  PDF Office
+//
+//  Created by Niehaoyu on 2022/10/26.
+//
+
+import Cocoa
+
+enum RightSubViewType : Int {
+    case None
+    case CipherTextType
+
+}
+
+class KMRightSideViewController: NSViewController,CipherTextViewDelegate {
+
+    var cipherTextView : CipherTextView!
+    
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.view.wantsLayer = true
+        self.view.layer?.backgroundColor = NSColor.red.cgColor
+        
+        
+        
+    }
+    
+    //MARK: Setter
+    var subViewType : RightSubViewType? {
+        willSet {
+            
+        }
+        didSet {
+            if subViewType == RightSubViewType.CipherTextType {
+                self.initCipherTextView()
+            } else {
+                
+            }
+            
+            
+        }
+    }
+    
+    //MARK: InitSubViews
+    func removeSubViews() {
+        
+    }
+    
+    func initCipherTextView() {
+        
+        self.cipherTextView = CipherTextView.createFromNib()
+        self.cipherTextView.frame = self.view.bounds
+        self.cipherTextView.autoresizingMask = [.height]
+        self.cipherTextView.setUp()
+        self.view.addSubview(self.cipherTextView)
+    }
+    
+    //MARK: CipherTextViewDelegate
+    func cipherTextViewButtonClicked(textView: CipherTextView, buttonIndex: Int) {
+        if buttonIndex == 0 {
+            
+        }
+    }
+    
+}

+ 22 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/RightSide/KMRightSideViewController.xib

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMRightSideViewController" customModule="PDF_Office" customModuleProvider="target">
+            <connections>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <point key="canvasLocation" x="132" y="-72"/>
+        </customView>
+    </objects>
+</document>