|
@@ -817,6 +817,7 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
|
|
|
func displayNoteViewAnimating(_ animate: Bool) {
|
|
|
self.reloadAnnotation()
|
|
|
+ self.annotationSort(sortArray: [])
|
|
|
|
|
|
self.searchViewController.contentView = nil
|
|
|
self.replaceSideView(self.noteOutlineView.enclosingScrollView!, animate: animate)
|
|
@@ -1529,6 +1530,141 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
authorArr = NSKeyedUnarchiver.unarchiveObject(with: authorData!) as! [Any]
|
|
|
}
|
|
|
|
|
|
+ var colorMutableArray = NSMutableArray()
|
|
|
+ var typeMutableArray = NSMutableArray()
|
|
|
+ var authorMutableArray = NSMutableArray()
|
|
|
+ for annotation in self.allAnnotations {
|
|
|
+ if annotation.isKind(of: CPDFInkAnnotation.self) == false &&
|
|
|
+ annotation.isKind(of: CPDFTextWidgetAnnotation.self) == false &&
|
|
|
+ annotation.isKind(of: CPDFButtonWidgetAnnotation.self) == false &&
|
|
|
+ annotation.isKind(of: CPDFChoiceWidgetAnnotation.self) == false
|
|
|
+// ![annotation.widgetFieldType isEqualToString:PDFAnnotationWidgetSubtypeSignature] &&
|
|
|
+// ![annotation.widgetFieldType isEqualToString:PDFAnnotationWidgetSubtypeText] &&
|
|
|
+// ![annotation.widgetFieldType isEqualToString:PDFAnnotationWidgetSubtypeButton] &&
|
|
|
+// ![annotation.widgetFieldType isEqualToString:PDFAnnotationWidgetSubtypeChoice])
|
|
|
+ {
|
|
|
+ let noteColor = annotation.color ?? .clear
|
|
|
+ let noteType = annotation.type ?? ""
|
|
|
+ let authorString = annotation.userName() ?? ""
|
|
|
+
|
|
|
+ if (noteColor != nil) {
|
|
|
+ if (colorMutableArray.count > 0) {
|
|
|
+ if colorMutableArray.contains(noteColor) == false {
|
|
|
+ colorMutableArray.add(noteColor)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ colorMutableArray.add(noteColor)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if noteType.isEmpty == false {
|
|
|
+ if (typeMutableArray.count > 0) {
|
|
|
+ if typeMutableArray.contains(noteType) == false {
|
|
|
+ typeMutableArray.add(noteType)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ typeMutableArray.add(noteType)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if authorString.isEmpty == false {
|
|
|
+ if (authorMutableArray.count > 0) {
|
|
|
+ if authorMutableArray.contains(authorString) == false {
|
|
|
+ authorMutableArray.add(authorString)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ authorMutableArray.add(authorString)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var temporaryArr1 = NSMutableArray()
|
|
|
+ var temporaryArr2 = NSMutableArray()
|
|
|
+ var temporaryArr3 = NSMutableArray()
|
|
|
+ if typeArr.isEmpty == false {
|
|
|
+ for type in typeArr {
|
|
|
+ if typeMutableArray.contains(type) == false {
|
|
|
+ temporaryArr1.add(type)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if colorArr.isEmpty == false {
|
|
|
+ for color in colorArr {
|
|
|
+ if colorMutableArray.contains(color) == false {
|
|
|
+ temporaryArr2.add(type)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if authorArr.isEmpty == false {
|
|
|
+ for author in authorArr {
|
|
|
+ if authorMutableArray.contains(author) == false {
|
|
|
+ temporaryArr3.add(type)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (temporaryArr1.count > 0) {
|
|
|
+ for type in temporaryArr1 {
|
|
|
+ guard let typeS = type as? String else {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+// [typeArr removeObject:type];
|
|
|
+
|
|
|
+ var flag = -1
|
|
|
+ for (i, data) in typeArr.enumerated() {
|
|
|
+ if data as! String == typeS {
|
|
|
+ flag = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if flag != -1 {
|
|
|
+ typeArr.remove(at: flag)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (temporaryArr2.count > 0) {
|
|
|
+// for (NSColor *color in temporaryArr2) {
|
|
|
+// [colorArr removeObject:color];
|
|
|
+// }
|
|
|
+// }
|
|
|
+ for color in temporaryArr2 {
|
|
|
+ guard let colorT = color as? NSColor else {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+// [typeArr removeObject:type];
|
|
|
+
|
|
|
+ var flag = -1
|
|
|
+ for (i, data) in colorArr.enumerated() {
|
|
|
+ if data as! NSColor == colorT {
|
|
|
+ flag = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if flag != -1 {
|
|
|
+ colorArr.remove(at: flag)
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (temporaryArr3.count > 0) {
|
|
|
+// for (NSColor *author in temporaryArr3) {
|
|
|
+// [authorArr removeObject:author];
|
|
|
+// }
|
|
|
+// }
|
|
|
+ for author in temporaryArr3 {
|
|
|
+ guard let authorS = author as? NSColor else {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+// [typeArr removeObject:type];
|
|
|
+
|
|
|
+ var flag = -1
|
|
|
+ for (i, data) in authorArr.enumerated() {
|
|
|
+ if data as! NSColor == authorS {
|
|
|
+ flag = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if flag != -1 {
|
|
|
+ authorArr.remove(at: flag)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if typeArr.count == 0 && colorArr.count == 0 && authorArr.count == 0 {
|
|
|
// self.filtrateButton.image = NSImage(named: "KMImageNameAnnotationsFiltrate")
|
|
|
self.reloadAnnotation()
|
|
@@ -4294,6 +4430,7 @@ extension KMLeftSideViewController: KMCustomOutlineViewDelegate, KMCustomOutline
|
|
|
self.listView.undoManager?.setActionName(KMLocalizedString("Remove Note", "Undo action name"))
|
|
|
|
|
|
self.reloadAnnotation()
|
|
|
+ self.annotationSort(sortArray: [])
|
|
|
self.noteOutlineView.reloadData()
|
|
|
} else if anOutlineView.isEqual(to: self.tocOutlineView) {
|
|
|
self.outlineContextMenuItemClicked_RemoveEntry(nil)
|