|
@@ -1105,6 +1105,8 @@ struct KMNMWCFlags {
|
|
|
updatePDFDisplaySettingView()
|
|
|
}
|
|
|
|
|
|
+ UserDefaults.setDefaultBoolValue(true, toKey: CPDFViewIsReadModeKey)
|
|
|
+
|
|
|
if infoSplitViewLeftConst.constant != 0 {
|
|
|
infoSplitViewLeftConst.constant = 0
|
|
|
|
|
@@ -1153,6 +1155,8 @@ struct KMNMWCFlags {
|
|
|
UserDefaults.setDefaultBoolValue(false, toKey: "ShowDisplayViewWhenExitPDFReadMode")
|
|
|
}
|
|
|
|
|
|
+ UserDefaults.setDefaultBoolValue(false, toKey: CPDFViewIsReadModeKey)
|
|
|
+
|
|
|
if let index = UserDefaults.getDefaultIntValue(forKey: "viewManagerPdfSideBarTypeRawValue") {
|
|
|
let type = KMPDFSidebarType(rawValue: index) ?? .none
|
|
|
viewManager.pdfSideBarType = type
|
|
@@ -5902,7 +5906,7 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
var pagePoint = CGPoint.zero
|
|
|
let point = self.view.convert(theEvent.locationInWindow, from: nil)
|
|
|
|
|
|
- let isShowPopUI:Bool = !SettingsManager.sharedInstance.showQuickActionBar
|
|
|
+ let isShowPopUI:Bool = true
|
|
|
|
|
|
if let page = pdfListView.pageAndPoint(&pagePoint, for: theEvent, nearest: false) {
|
|
|
if view.window?.interactionMode == .presentation {
|
|
@@ -5921,10 +5925,17 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
var isSameAnnotation = true
|
|
|
let firstAnnotation = activeAnnotations?.first
|
|
|
|
|
|
+ var isContainMark = false
|
|
|
+ if firstAnnotation?.isKind(of: CPDFMarkupAnnotation.self) == true {
|
|
|
+ isContainMark = true
|
|
|
+ }
|
|
|
for i in 1..<(activeAnnotations?.count ?? 1) {
|
|
|
+ //Form 注释不能用这个判断
|
|
|
if firstAnnotation?.type != activeAnnotations?[i].type {
|
|
|
isSameAnnotation = false
|
|
|
- break
|
|
|
+ }
|
|
|
+ if activeAnnotations?[i].isKind(of: CPDFMarkupAnnotation.self) == true {
|
|
|
+ isContainMark = true
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5933,6 +5944,10 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_CopyText)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ if(isShowPopUI){
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_ShowPopUI)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ }
|
|
|
} else if firstAnnotation?.isKind(of: CPDFRedactAnnotation.self) == true {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
@@ -5942,17 +5957,22 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Copy)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Cut)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
- }
|
|
|
-
|
|
|
- if(isShowPopUI){
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_ShowPopUI)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+
|
|
|
+ if firstAnnotation?.isKind(of: CPDFLinkAnnotation.self) == true {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if(isShowPopUI){
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_ShowPopUI)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if firstAnnotation?.isKind(of: CPDFRedactAnnotation.self) == true {
|
|
|
|
|
|
} else {
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_SortAnnotation)
|
|
|
}
|
|
|
|
|
@@ -5962,7 +5982,9 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
}
|
|
|
} else {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Copy)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_Cut)
|
|
|
+ if isContainMark == false {
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_Cut)
|
|
|
+ }
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_SortAnnotation)
|
|
@@ -5971,16 +5993,20 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
}
|
|
|
}
|
|
|
} else if activeAnnotations?.count == 1 {
|
|
|
- if pdfListView.activeAnnotation.isKind(of: CPDFMarkupAnnotation.self) {
|
|
|
+ let activeAnnotation = pdfListView.activeAnnotation!
|
|
|
+ if activeAnnotation.isKind(of: CPDFMarkupAnnotation.self) {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_CopyText)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_Content)
|
|
|
if(isShowPopUI){
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_ShowPopUI)
|
|
|
}
|
|
|
+
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_SortAnnotation)
|
|
|
- } else if pdfListView.activeAnnotation.isKind(of: CPDFRedactAnnotation.self) {
|
|
|
+ } else if activeAnnotation.isKind(of: CPDFRedactAnnotation.self) {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Redact_Apply)
|
|
@@ -5988,8 +6014,8 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_RedactProperties)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Redact_Default)
|
|
|
- } else if listView.activeAnnotation.isKind(of: CPDFLinkAnnotation.self) {
|
|
|
- let link = listView.activeAnnotation as? CPDFLinkAnnotation
|
|
|
+ } else if activeAnnotation.isKind(of: CPDFLinkAnnotation.self) {
|
|
|
+ let link = activeAnnotation as? CPDFLinkAnnotation
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Copy)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Cut)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
@@ -5997,24 +6023,23 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_ShowPopUI)
|
|
|
}
|
|
|
- } else if pdfListView.activeAnnotation.isKind(of: CPDFWidgetAnnotation.self) {
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_Copy)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_Cut)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
- if(isShowPopUI){
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_ShowPopUI)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
- }
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_SortAnnotation)
|
|
|
} else {
|
|
|
+ if activeAnnotation.isKind(of: CPDFSignatureWidgetAnnotation.self) {
|
|
|
+ let signatureWidgetAnnotation = activeAnnotation as? CPDFSignatureWidgetAnnotation
|
|
|
+ if(signatureWidgetAnnotation?.isSigned() == true) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Copy)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Cut)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Delete)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
|
|
|
- if pdfListView.activeAnnotation.isKind(of: CPDFTextAnnotation.self) ||
|
|
|
- pdfListView.activeAnnotation.isKind(of: CPDFFreeTextAnnotation.self) {
|
|
|
+ if activeAnnotation.isKind(of: CPDFTextAnnotation.self) ||
|
|
|
+ activeAnnotation.isKind(of: CPDFFreeTextAnnotation.self) ||
|
|
|
+ activeAnnotation.isKind(of: CSelfSignAnnotation.self) ||
|
|
|
+ activeAnnotation.isKind(of: CPDFWidgetAnnotation.self) {
|
|
|
|
|
|
} else {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_Content)
|
|
@@ -6129,10 +6154,10 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_AddBook)
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_ViewTools)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
}
|
|
|
}
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_ViewTools)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
|
|
|
menuStringArr.append(PDFViewMenuIdentifier_Normal_PageView)
|
|
|
if(listView.viewSplitMode != .disable) {
|
|
@@ -6169,14 +6194,30 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
}
|
|
|
} else {
|
|
|
var menuStringArr: [String] = []
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_PageView)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_ReadMode)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_Scale)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_HightLink)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_HightForm)
|
|
|
- menuStringArr.append(PDFViewMenuIdentifier_Normal_RestForm)
|
|
|
+ if(listView.viewSplitMode != .disable) {
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Split_ViewMode)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Split_Sync)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Split_ShowBar)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_PageView)
|
|
|
+
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_Scale)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_HightLink)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_HightForm)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_RestForm)
|
|
|
+ } else {
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_PageView)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_ReadMode)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_Scale)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Space)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_HightLink)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_HightForm)
|
|
|
+ menuStringArr.append(PDFViewMenuIdentifier_Normal_RestForm)
|
|
|
+ }
|
|
|
let menuStruct = KMPDFMenuConfig.clickMenuUI(items: menuStringArr, theEvent: theEvent, listView: pdfListView)
|
|
|
groupListMenuGroup?.pagePoint = pagePoint
|
|
|
groupListMenuGroup?.groupDelegate = self
|
|
@@ -6485,6 +6526,10 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
|
|
|
return viewManager.splitShowBottomBar
|
|
|
}
|
|
|
|
|
|
+ func pdfListViewSyncSplitView() -> Bool {
|
|
|
+ return viewManager.splitShowBottomBar
|
|
|
+ }
|
|
|
+
|
|
|
func pdfListViewEndEditMode(_ pdfListView: CPDFListView!) {
|
|
|
let document = listView.document
|
|
|
if(document != nil) {
|
|
@@ -6929,38 +6974,38 @@ extension KMMainViewController: ComponentGroupDelegate {
|
|
|
listView.toolMode = .CMoveToolMode
|
|
|
listView.annotationType = .unkown
|
|
|
viewManager.viewToolsType = .Scroll
|
|
|
- pdfToolbarController?.reloadToolsView()
|
|
|
|
|
|
pdfToolbarController?.viewManager?.toolMode = .None
|
|
|
pdfToolbarController?.viewManager?.subToolMode = .None
|
|
|
refreshToolbarViewHeightInfo()
|
|
|
+ pdfToolbarController?.reloadData()
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_SelectTool) {
|
|
|
listView.toolMode = .CSelectToolMode
|
|
|
listView.annotationType = .unkown
|
|
|
viewManager.viewToolsType = .Content_Selection
|
|
|
- pdfToolbarController?.reloadToolsView()
|
|
|
|
|
|
pdfToolbarController?.viewManager?.toolMode = .None
|
|
|
pdfToolbarController?.viewManager?.subToolMode = .None
|
|
|
refreshToolbarViewHeightInfo()
|
|
|
+ pdfToolbarController?.reloadData()
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_MagnifyTool) {
|
|
|
listView.toolMode = .CMagnifyToolMode
|
|
|
listView.annotationType = .unkown
|
|
|
viewManager.viewToolsType = .Magnify
|
|
|
- pdfToolbarController?.reloadToolsView()
|
|
|
|
|
|
pdfToolbarController?.viewManager?.toolMode = .None
|
|
|
pdfToolbarController?.viewManager?.subToolMode = .None
|
|
|
refreshToolbarViewHeightInfo()
|
|
|
+ pdfToolbarController?.reloadData()
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_SelectZoomTool) {
|
|
|
listView.toolMode = .CSelectZoomToolMode
|
|
|
listView.annotationType = .unkown
|
|
|
viewManager.viewToolsType = .AreaZoom
|
|
|
- pdfToolbarController?.reloadToolsView()
|
|
|
|
|
|
pdfToolbarController?.viewManager?.toolMode = .None
|
|
|
pdfToolbarController?.viewManager?.subToolMode = .None
|
|
|
refreshToolbarViewHeightInfo()
|
|
|
+ pdfToolbarController?.reloadData()
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_Single) {
|
|
|
if let objectListView = menuItemProperty?.representedObject as? CPDFListView {
|
|
|
objectListView.menuItemClick_SinglePage(nil)
|
|
@@ -7068,14 +7113,14 @@ extension KMMainViewController: ComponentGroupDelegate {
|
|
|
gotoPage(nil)
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_PageBack) {
|
|
|
if let objectListView = menuItemProperty?.representedObject as? CPDFListView {
|
|
|
- if(objectListView.km_canGoForward() == true) {
|
|
|
- objectListView.km_goForward(nil)
|
|
|
+ if(objectListView.km_canGoBack() == true) {
|
|
|
+ objectListView.km_goBack(nil)
|
|
|
}
|
|
|
}
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_PageForward) {
|
|
|
if let objectListView = menuItemProperty?.representedObject as? CPDFListView {
|
|
|
- if(objectListView.km_canGoBack() == true) {
|
|
|
- objectListView.km_goBack(nil)
|
|
|
+ if(objectListView.km_canGoForward() == true) {
|
|
|
+ objectListView.km_goForward(nil)
|
|
|
}
|
|
|
}
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_AutoScroll) {
|
|
@@ -7265,8 +7310,10 @@ extension KMMainViewController: ComponentGroupDelegate {
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Redact_Apply) {
|
|
|
redactApplyAction()
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Redact_Multipage) {
|
|
|
- if let redactAnnotation = listView.activeAnnotation as? CPDFRedactAnnotation {
|
|
|
- redactMultipageAction(redactAnnotation: redactAnnotation)
|
|
|
+ for activeAnnotation in listView.activeAnnotations {
|
|
|
+ if let redactAnnotation = activeAnnotation as? CPDFRedactAnnotation {
|
|
|
+ redactMultipageAction(redactAnnotation: redactAnnotation)
|
|
|
+ }
|
|
|
}
|
|
|
} else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Redact_Default) {
|
|
|
if let redactAnnotation = listView.activeAnnotation as? CPDFRedactAnnotation {
|