|
@@ -52,7 +52,7 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
|
|
|
|
@IBOutlet weak var pdfView: CPDFListView!
|
|
@IBOutlet weak var pdfView: CPDFListView!
|
|
var readerModeBlock: ReaderModeCallBack?
|
|
var readerModeBlock: ReaderModeCallBack?
|
|
- @IBOutlet weak var mainController: KMMainViewController!
|
|
|
|
|
|
+ @IBOutlet weak var mainController: KMMainViewController?
|
|
|
|
|
|
@IBOutlet private var pageLayoutLabel: NSTextField!
|
|
@IBOutlet private var pageLayoutLabel: NSTextField!
|
|
@IBOutlet private var singlePageButton: KMPageDisplayPropertiesButton!
|
|
@IBOutlet private var singlePageButton: KMPageDisplayPropertiesButton!
|
|
@@ -151,7 +151,7 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
horizontalScreenButton.image = NSImage(named: KMImageNameUXIconPropertybarViewSplitscreenhorNor)
|
|
horizontalScreenButton.image = NSImage(named: KMImageNameUXIconPropertybarViewSplitscreenhorNor)
|
|
horizontalScreenButton.wantsLayer = true
|
|
horizontalScreenButton.wantsLayer = true
|
|
|
|
|
|
- if let documentPath = self.mainController.secondaryPdfView.document?.documentURL?.path {
|
|
|
|
|
|
+ if let documentPath = self.mainController?.secondaryPdfView.document?.documentURL?.path {
|
|
replaceView.isHidden = false
|
|
replaceView.isHidden = false
|
|
} else {
|
|
} else {
|
|
replaceView.isHidden = true
|
|
replaceView.isHidden = true
|
|
@@ -188,7 +188,7 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
if downEntered {
|
|
if downEntered {
|
|
self.counterclockwiseRotationBox.fillColor = KMAppearance.Status.selColor()
|
|
self.counterclockwiseRotationBox.fillColor = KMAppearance.Status.selColor()
|
|
self.counterclockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateCounterclockwisePre)
|
|
self.counterclockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateCounterclockwisePre)
|
|
- self.mainController.menuItemAction_rotateLeft((Any).self)
|
|
|
|
|
|
+ self.mainController?.menuItemAction_rotateLeft((Any).self)
|
|
} else {
|
|
} else {
|
|
self.counterclockwiseRotationBox.fillColor = KMAppearance.Layout.l1Color()
|
|
self.counterclockwiseRotationBox.fillColor = KMAppearance.Layout.l1Color()
|
|
self.counterclockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateCounterclockwiseNor)
|
|
self.counterclockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateCounterclockwiseNor)
|
|
@@ -207,7 +207,7 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
if downEntered {
|
|
if downEntered {
|
|
self.clockwiseRotationBox.fillColor = KMAppearance.Status.selColor()
|
|
self.clockwiseRotationBox.fillColor = KMAppearance.Status.selColor()
|
|
self.clockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateClockwisePre)
|
|
self.clockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateClockwisePre)
|
|
- self.mainController.menuItemAction_rotateRight((Any).self)
|
|
|
|
|
|
+ self.mainController?.menuItemAction_rotateRight((Any).self)
|
|
} else {
|
|
} else {
|
|
self.clockwiseRotationBox.fillColor = KMAppearance.Layout.l1Color()
|
|
self.clockwiseRotationBox.fillColor = KMAppearance.Layout.l1Color()
|
|
self.clockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateClockwiseNor)
|
|
self.clockwiseRotationImageView.image = NSImage(named: KMImageNameUXIconPropertybarRotateClockwiseNor)
|
|
@@ -296,7 +296,7 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
}
|
|
}
|
|
|
|
|
|
private func reloadReplaceView() {
|
|
private func reloadReplaceView() {
|
|
- if let documentPath = mainController.secondaryPdfView.document?.documentURL?.path {
|
|
|
|
|
|
+ if let documentPath = mainController?.secondaryPdfView.document?.documentURL?.path {
|
|
replaceFileButton.title = NSLocalizedString("Replace File", comment: "")
|
|
replaceFileButton.title = NSLocalizedString("Replace File", comment: "")
|
|
replaceFileButton.toolTip = NSLocalizedString("Replace File", comment: "")
|
|
replaceFileButton.toolTip = NSLocalizedString("Replace File", comment: "")
|
|
replaceFileNameLabel.attributedStringValue = replaceFileName(withFilePath: (documentPath as NSString).lastPathComponent)
|
|
replaceFileNameLabel.attributedStringValue = replaceFileName(withFilePath: (documentPath as NSString).lastPathComponent)
|
|
@@ -346,10 +346,10 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
pageBreaksButton.state = .off
|
|
pageBreaksButton.state = .off
|
|
}
|
|
}
|
|
|
|
|
|
- if !(mainController.secondaryPdfView.window != nil) {
|
|
|
|
|
|
+ if !(mainController?.secondaryPdfView.window != nil) {
|
|
setSplitViewType(.singleScreen)
|
|
setSplitViewType(.singleScreen)
|
|
} else {
|
|
} else {
|
|
- if mainController.pdfSplitView.isVertical {
|
|
|
|
|
|
+ if let data = mainController?.pdfSplitView.isVertical, data {
|
|
setSplitViewType(.verticalScreen)
|
|
setSplitViewType(.verticalScreen)
|
|
} else {
|
|
} else {
|
|
setSplitViewType(.horizontalScreen)
|
|
setSplitViewType(.horizontalScreen)
|
|
@@ -475,16 +475,16 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
switch sender.tag {
|
|
switch sender.tag {
|
|
case 0:
|
|
case 0:
|
|
setDisplayMode(.singlePage)
|
|
setDisplayMode(.singlePage)
|
|
- mainController.selectDisplay(display: isContinuPage ? .singlePageContinuous : .singlePage, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: isContinuPage ? .singlePageContinuous : .singlePage, viewSettingIsReload: false)
|
|
case 1:
|
|
case 1:
|
|
setDisplayMode(.twoPages)
|
|
setDisplayMode(.twoPages)
|
|
- mainController.selectDisplay(display: isContinuPage ? .twoUpContinuous : .twoUp, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: isContinuPage ? .twoUpContinuous : .twoUp, viewSettingIsReload: false)
|
|
case 2:
|
|
case 2:
|
|
setDisplayMode(.coverPage)
|
|
setDisplayMode(.coverPage)
|
|
- mainController.selectDisplay(display: isContinuPage ? .bookContinuous : .bookMode, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: isContinuPage ? .bookContinuous : .bookMode, viewSettingIsReload: false)
|
|
case 3:
|
|
case 3:
|
|
// readerModeBlock?(isReaderMode)
|
|
// readerModeBlock?(isReaderMode)
|
|
- mainController.selectDisplay(display: isContinuPage ? .readContinuous : .readModel, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: isContinuPage ? .readContinuous : .readModel, viewSettingIsReload: false)
|
|
default:
|
|
default:
|
|
break
|
|
break
|
|
}
|
|
}
|
|
@@ -495,15 +495,15 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
|
|
|
|
if isContinuPage {
|
|
if isContinuPage {
|
|
if displayMode == KMDisplayModeType.singlePage {
|
|
if displayMode == KMDisplayModeType.singlePage {
|
|
- mainController.selectDisplay(display: .singlePageContinuous, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: .singlePageContinuous, viewSettingIsReload: false)
|
|
} else {
|
|
} else {
|
|
- mainController.selectDisplay(display: .twoUpContinuous, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: .twoUpContinuous, viewSettingIsReload: false)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if displayMode == KMDisplayModeType.singlePage {
|
|
if displayMode == KMDisplayModeType.singlePage {
|
|
- mainController.selectDisplay(display: .singlePage, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: .singlePage, viewSettingIsReload: false)
|
|
} else {
|
|
} else {
|
|
- mainController.selectDisplay(display: .twoUp, viewSettingIsReload: false)
|
|
|
|
|
|
+ self.mainController?.selectDisplay(display: .twoUp, viewSettingIsReload: false)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -514,7 +514,9 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
}
|
|
}
|
|
|
|
|
|
@IBAction private func splitViewButtonAction(_ sender: KMPageDisplayPropertiesButton) {
|
|
@IBAction private func splitViewButtonAction(_ sender: KMPageDisplayPropertiesButton) {
|
|
-// if sender.tag > 0 && !IAPProductsManager.defaultManager().isAvailableAllFunction {
|
|
|
|
|
|
+// [[FMTrackEventManager manager] trackEvent:@"SubTbr_PageDisplay" withProperties:@{@"SubTbr_Btn":@"Btn_SubTbr_PageDisplay_ViewSetting_SplitView"}];
|
|
|
|
+
|
|
|
|
+// if sender.tag > 0 && IAPProductsManager.default().isAvailableAllFunction() == false {
|
|
// KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
// KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
// return
|
|
// return
|
|
// }
|
|
// }
|
|
@@ -528,13 +530,13 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
case 1:
|
|
case 1:
|
|
setSplitViewType(.verticalScreen)
|
|
setSplitViewType(.verticalScreen)
|
|
menuItem.tag = 1
|
|
menuItem.tag = 1
|
|
- if let documentPath = mainController.secondaryPdfView.document?.documentURL?.path, !documentPath.isEmpty {
|
|
|
|
|
|
+ if let documentPath = self.mainController?.secondaryPdfView.document?.documentURL?.path, !documentPath.isEmpty {
|
|
replaceView.isHidden = false
|
|
replaceView.isHidden = false
|
|
}
|
|
}
|
|
case 2:
|
|
case 2:
|
|
setSplitViewType(.horizontalScreen)
|
|
setSplitViewType(.horizontalScreen)
|
|
menuItem.tag = 0
|
|
menuItem.tag = 0
|
|
- if let documentPath = mainController.secondaryPdfView.document?.documentURL?.path, !documentPath.isEmpty {
|
|
|
|
|
|
+ if let documentPath = self.mainController?.secondaryPdfView.document?.documentURL?.path, !documentPath.isEmpty {
|
|
replaceView.isHidden = false
|
|
replaceView.isHidden = false
|
|
}
|
|
}
|
|
default:
|
|
default:
|
|
@@ -543,6 +545,7 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
|
|
|
|
// mainController.toggleSplitPDF(menuItem)
|
|
// mainController.toggleSplitPDF(menuItem)
|
|
|
|
|
|
|
|
+
|
|
if !replaceView.isHidden {
|
|
if !replaceView.isHidden {
|
|
reloadReplaceView()
|
|
reloadReplaceView()
|
|
replaceFileButton.setTitleColor(KMAppearance.Layout.w0Color())
|
|
replaceFileButton.setTitleColor(KMAppearance.Layout.w0Color())
|
|
@@ -552,8 +555,8 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
}
|
|
}
|
|
|
|
|
|
@IBAction private func replaceFileButtonAction(_ sender: Any) {
|
|
@IBAction private func replaceFileButtonAction(_ sender: Any) {
|
|
- if let document = mainController.secondaryPdfView.document {
|
|
|
|
- mainController.changePDFDocument(isChange: false) { [weak self] filePath in
|
|
|
|
|
|
+ if let document = self.mainController?.secondaryPdfView.document {
|
|
|
|
+ self.mainController?.changePDFDocument(isChange: false) { [weak self] filePath in
|
|
self!.replaceFileNameLabel.attributedStringValue = self!.replaceFileName(withFilePath: (filePath as NSString).lastPathComponent)
|
|
self!.replaceFileNameLabel.attributedStringValue = self!.replaceFileName(withFilePath: (filePath as NSString).lastPathComponent)
|
|
self!.replaceFileNameLabel.isHidden = false
|
|
self!.replaceFileNameLabel.isHidden = false
|
|
if self!.replaceFileButton.title == NSLocalizedString("Select File", comment: "") {
|
|
if self!.replaceFileButton.title == NSLocalizedString("Select File", comment: "") {
|
|
@@ -563,7 +566,7 @@ class KMPageDisplayPropertiesButton: NSButton {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- mainController.changePDFDocument(isChange: true) { [weak self] filePath in
|
|
|
|
|
|
+ self.mainController?.changePDFDocument(isChange: true) { [weak self] filePath in
|
|
self!.replaceFileNameLabel.attributedStringValue = self!.replaceFileName(withFilePath: (filePath as NSString).lastPathComponent)
|
|
self!.replaceFileNameLabel.attributedStringValue = self!.replaceFileName(withFilePath: (filePath as NSString).lastPathComponent)
|
|
self!.replaceFileNameLabel.isHidden = false
|
|
self!.replaceFileNameLabel.isHidden = false
|
|
if self!.replaceFileButton.title == NSLocalizedString("Select File", comment: "") {
|
|
if self!.replaceFileButton.title == NSLocalizedString("Select File", comment: "") {
|
|
@@ -623,11 +626,11 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
|
|
UserDefaults.standard.synchronize()
|
|
UserDefaults.standard.synchronize()
|
|
}
|
|
}
|
|
|
|
|
|
-// if !IAPProductsManager.defaultManager.isAvailableAllFunction {
|
|
|
|
-// item.vipImageView.isHidden = indexPath.item == 0 ? true : false
|
|
|
|
-// } else {
|
|
|
|
-// item.vipImageView.isHidden = true
|
|
|
|
-// }
|
|
|
|
|
|
+ if IAPProductsManager.default().isAvailableAllFunction() == false {
|
|
|
|
+ item.vipImageView.isHidden = indexPath.item == 0 ? true : false
|
|
|
|
+ } else {
|
|
|
|
+ item.vipImageView.isHidden = true
|
|
|
|
+ }
|
|
|
|
|
|
return item
|
|
return item
|
|
} else {
|
|
} else {
|
|
@@ -656,11 +659,11 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
|
|
UserDefaults.standard.synchronize()
|
|
UserDefaults.standard.synchronize()
|
|
}
|
|
}
|
|
|
|
|
|
-// if !IAPProductsManager.defaultManager.isAvailableAllFunction {
|
|
|
|
-// item.vipImageView.isHidden = false
|
|
|
|
-// } else {
|
|
|
|
-// item.vipImageView.isHidden = true
|
|
|
|
-// }
|
|
|
|
|
|
+ if IAPProductsManager.default().isAvailableAllFunction() == false {
|
|
|
|
+ item.vipImageView.isHidden = false
|
|
|
|
+ } else {
|
|
|
|
+ item.vipImageView.isHidden = true
|
|
|
|
+ }
|
|
|
|
|
|
return item
|
|
return item
|
|
} else {
|
|
} else {
|
|
@@ -681,11 +684,11 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
|
|
UserDefaults.standard.synchronize()
|
|
UserDefaults.standard.synchronize()
|
|
}
|
|
}
|
|
|
|
|
|
-// if !IAPProductsManager.defaultManager.isAvailableAllFunction {
|
|
|
|
-// item.vipImageView.isHidden = indexPath.item == 0 ? true : false
|
|
|
|
-// } else {
|
|
|
|
-// item.vipImageView.isHidden = true
|
|
|
|
-// }
|
|
|
|
|
|
+ if IAPProductsManager.default().isAvailableAllFunction() == false {
|
|
|
|
+ item.vipImageView.isHidden = indexPath.item == 0 ? true : false
|
|
|
|
+ } else {
|
|
|
|
+ item.vipImageView.isHidden = true
|
|
|
|
+ }
|
|
|
|
|
|
return item
|
|
return item
|
|
}
|
|
}
|
|
@@ -704,12 +707,12 @@ extension KMPageDisplayPropertiesViewController: NSCollectionViewDelegate, NSCol
|
|
func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set<IndexPath>) {
|
|
func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set<IndexPath>) {
|
|
let indexPathArr = Array(indexPaths)
|
|
let indexPathArr = Array(indexPaths)
|
|
for indexPath in indexPathArr {
|
|
for indexPath in indexPathArr {
|
|
-// if !IAPProductsManager.defaultManager.isAvailableAllFunction {
|
|
|
|
-// if indexPath.item > 0 {
|
|
|
|
-// KMPurchaseCompareWindowController.sharedInstance.showWindow(nil)
|
|
|
|
-// return
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ if IAPProductsManager.default().isAvailableAllFunction() == false {
|
|
|
|
+ if indexPath.item > 0 {
|
|
|
|
+ KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
pdfView.setPageBackgroundColorWith(themesArray[indexPath.item], viewMode: KMPDFViewMode(rawValue: UInt(indexPath.item))!)
|
|
pdfView.setPageBackgroundColorWith(themesArray[indexPath.item], viewMode: KMPDFViewMode(rawValue: UInt(indexPath.item))!)
|
|
reloadData()
|
|
reloadData()
|
|
}
|
|
}
|