|
@@ -8,7 +8,7 @@
|
|
import Cocoa
|
|
import Cocoa
|
|
import KMComponentLibrary
|
|
import KMComponentLibrary
|
|
|
|
|
|
-let MIN_SIDE_PANE_WIDTH: CGFloat = 264.0 // 最小值
|
|
|
|
|
|
+let MIN_SIDE_PANE_WIDTH: NSNumber = 264 // 最小值
|
|
let CPDFViewIsReadModeKey = "kKMPDFViewIsReadMode"
|
|
let CPDFViewIsReadModeKey = "kKMPDFViewIsReadMode"
|
|
let CPDFViewLeftSidePaneWidthKey = "CPDFOfficeLeftSidePaneWidthKey"
|
|
let CPDFViewLeftSidePaneWidthKey = "CPDFOfficeLeftSidePaneWidthKey"
|
|
|
|
|
|
@@ -289,6 +289,8 @@ struct KMNMWCFlags {
|
|
setupData()
|
|
setupData()
|
|
|
|
|
|
setupUI()
|
|
setupUI()
|
|
|
|
+
|
|
|
|
+ loadUserDefaultsData()
|
|
}
|
|
}
|
|
|
|
|
|
override func viewDidAppear() {
|
|
override func viewDidAppear() {
|
|
@@ -326,6 +328,13 @@ struct KMNMWCFlags {
|
|
|
|
|
|
activityLoadMethod()
|
|
activityLoadMethod()
|
|
|
|
|
|
|
|
+ let readModel = UserDefaults.standard.bool(forKey: CPDFViewIsReadModeKey)
|
|
|
|
+ if readModel == true {
|
|
|
|
+ self.openPDFReadMode()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ toggleCloseLeftSide() //根据偏好设置显示左边栏状态
|
|
|
|
+
|
|
newMwcFlags.settingUpWindow = false
|
|
newMwcFlags.settingUpWindow = false
|
|
}
|
|
}
|
|
|
|
|
|
@@ -336,11 +345,6 @@ struct KMNMWCFlags {
|
|
|
|
|
|
private func loadUserDefaultsData() {
|
|
private func loadUserDefaultsData() {
|
|
applyLeftSideWidth(0, rightSideWidth: 0) //初始打开左边栏
|
|
applyLeftSideWidth(0, rightSideWidth: 0) //初始打开左边栏
|
|
-
|
|
|
|
- let readModel = UserDefaults.standard.bool(forKey: CPDFViewIsReadModeKey)
|
|
|
|
- if readModel == true {
|
|
|
|
- self.openPDFReadMode()
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func applyLeftSideWidth(_ leftSideWidth: CGFloat, rightSideWidth: CGFloat) -> Void {
|
|
func applyLeftSideWidth(_ leftSideWidth: CGFloat, rightSideWidth: CGFloat) -> Void {
|
|
@@ -585,8 +589,8 @@ struct KMNMWCFlags {
|
|
|
|
|
|
private func toggleOpenLeftSide(pdfSideBarType: KMPDFSidebarType) {
|
|
private func toggleOpenLeftSide(pdfSideBarType: KMPDFSidebarType) {
|
|
if(leftSidePaneIsOpen() == false) {
|
|
if(leftSidePaneIsOpen() == false) {
|
|
- let leftWidthNumber = UserDefaults.standard.object(forKey: CPDFViewLeftSidePaneWidthKey) as? NSNumber ?? NSNumber(value: MIN_SIDE_PANE_WIDTH)
|
|
|
|
- infoContendSplitView.setPosition(leftWidthNumber.doubleValue, ofDividerAt: 0)
|
|
|
|
|
|
+ let leftWidthNumber = UserDefaults.standard.object(forKey: CPDFViewLeftSidePaneWidthKey) as? NSNumber ?? MIN_SIDE_PANE_WIDTH
|
|
|
|
+ infoContendSplitView.setPosition(MIN_SIDE_PANE_WIDTH.doubleValue, ofDividerAt: 0) //暂时无法记录上一次打开的宽度
|
|
}
|
|
}
|
|
if pdfSideBarType == .search {
|
|
if pdfSideBarType == .search {
|
|
KMPrint(" search")
|
|
KMPrint(" search")
|
|
@@ -615,7 +619,7 @@ struct KMNMWCFlags {
|
|
if rightSideController == nil {
|
|
if rightSideController == nil {
|
|
rightSideController = KMRightSideController.init()
|
|
rightSideController = KMRightSideController.init()
|
|
}
|
|
}
|
|
- rightSideController?.view.frame = CGRectMake(0, 0, MIN_SIDE_PANE_WIDTH, 680)
|
|
|
|
|
|
+ rightSideController?.view.frame = CGRectMake(0, 0, MIN_SIDE_PANE_WIDTH.doubleValue, 680)
|
|
rightSideController?.view.autoresizingMask = [.height, .maxXMargin]
|
|
rightSideController?.view.autoresizingMask = [.height, .maxXMargin]
|
|
}
|
|
}
|
|
|
|
|
|
@@ -627,10 +631,10 @@ struct KMNMWCFlags {
|
|
@objc func toggleOpenRightSide() -> Void {
|
|
@objc func toggleOpenRightSide() -> Void {
|
|
initRightSideController()
|
|
initRightSideController()
|
|
|
|
|
|
- rightSideController?.view.frame = CGRectMake(CGRectGetWidth(bottomContendBox.frame)-MIN_SIDE_PANE_WIDTH, 0, MIN_SIDE_PANE_WIDTH, CGRectGetHeight(bottomContendBox.frame))
|
|
|
|
|
|
+ rightSideController?.view.frame = CGRectMake(CGRectGetWidth(bottomContendBox.frame)-MIN_SIDE_PANE_WIDTH.doubleValue, 0, MIN_SIDE_PANE_WIDTH.doubleValue, CGRectGetHeight(bottomContendBox.frame))
|
|
bottomContendBox.addSubview(rightSideController!.view)
|
|
bottomContendBox.addSubview(rightSideController!.view)
|
|
|
|
|
|
- infoSplitViewRightConst.constant = MIN_SIDE_PANE_WIDTH
|
|
|
|
|
|
+ infoSplitViewRightConst.constant = MIN_SIDE_PANE_WIDTH.doubleValue
|
|
|
|
|
|
rightSideController?.viewManager = self.viewManager
|
|
rightSideController?.viewManager = self.viewManager
|
|
|
|
|
|
@@ -646,7 +650,7 @@ struct KMNMWCFlags {
|
|
func updatePDFDisplaySettingView() {
|
|
func updatePDFDisplaySettingView() {
|
|
|
|
|
|
if viewManager.showDisplayView {
|
|
if viewManager.showDisplayView {
|
|
- infoSplitViewLeftConst.constant = MIN_SIDE_PANE_WIDTH
|
|
|
|
|
|
+ infoSplitViewLeftConst.constant = MIN_SIDE_PANE_WIDTH.doubleValue
|
|
} else {
|
|
} else {
|
|
infoSplitViewLeftConst.constant = 44
|
|
infoSplitViewLeftConst.constant = 44
|
|
}
|
|
}
|
|
@@ -655,7 +659,7 @@ struct KMNMWCFlags {
|
|
if displaySettingController == nil {
|
|
if displaySettingController == nil {
|
|
displaySettingController = KMNDisplayViewController.init()
|
|
displaySettingController = KMNDisplayViewController.init()
|
|
}
|
|
}
|
|
- displaySettingController?.view.frame = CGRectMake(0, 0, MIN_SIDE_PANE_WIDTH, CGRectGetHeight(bottomContendBox.frame))
|
|
|
|
|
|
+ displaySettingController?.view.frame = CGRectMake(0, 0, MIN_SIDE_PANE_WIDTH.doubleValue, CGRectGetHeight(bottomContendBox.frame))
|
|
displaySettingController?.view.autoresizingMask = [.height, .maxXMargin]
|
|
displaySettingController?.view.autoresizingMask = [.height, .maxXMargin]
|
|
bottomContendBox.addSubview(displaySettingController!.view)
|
|
bottomContendBox.addSubview(displaySettingController!.view)
|
|
displaySettingController?.pdfView = self.listView
|
|
displaySettingController?.pdfView = self.listView
|
|
@@ -1600,14 +1604,14 @@ extension KMMainViewController: NSSplitViewDelegate {
|
|
|
|
|
|
func splitView(_ splitView: NSSplitView, constrainMaxCoordinate proposedMaximumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat {
|
|
func splitView(_ splitView: NSSplitView, constrainMaxCoordinate proposedMaximumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat {
|
|
if(splitView == infoContendSplitView && dividerIndex == 1) {
|
|
if(splitView == infoContendSplitView && dividerIndex == 1) {
|
|
- return proposedMaximumPosition - MIN_SIDE_PANE_WIDTH
|
|
|
|
|
|
+ return proposedMaximumPosition - MIN_SIDE_PANE_WIDTH.doubleValue
|
|
}
|
|
}
|
|
return proposedMaximumPosition
|
|
return proposedMaximumPosition
|
|
}
|
|
}
|
|
|
|
|
|
func splitView(_ splitView: NSSplitView, constrainMinCoordinate proposedMinimumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat {
|
|
func splitView(_ splitView: NSSplitView, constrainMinCoordinate proposedMinimumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat {
|
|
if(splitView == infoContendSplitView && dividerIndex == 0) {
|
|
if(splitView == infoContendSplitView && dividerIndex == 0) {
|
|
- return proposedMinimumPosition + MIN_SIDE_PANE_WIDTH
|
|
|
|
|
|
+ return proposedMinimumPosition + MIN_SIDE_PANE_WIDTH.doubleValue
|
|
}
|
|
}
|
|
return proposedMinimumPosition
|
|
return proposedMinimumPosition
|
|
}
|
|
}
|