|
@@ -2658,16 +2658,26 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
}
|
|
}
|
|
return Int((item as? CPDFOutline)?.numberOfChildren ?? 0)
|
|
return Int((item as? CPDFOutline)?.numberOfChildren ?? 0)
|
|
} else if outlineView.isEqual(to: self.noteOutlineView) {
|
|
} else if outlineView.isEqual(to: self.noteOutlineView) {
|
|
|
|
+ var count = 0
|
|
|
|
+ for section in self.annotationViewController.annotations {
|
|
|
|
+ if section.annotations?.count != 0 {
|
|
|
|
+ count += section.annotations!.count
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+// return count
|
|
|
|
+
|
|
|
|
+
|
|
// if (item == nil){
|
|
// if (item == nil){
|
|
// NSInteger count = [[rightSideController.noteArrayController arrangedObjects] count];
|
|
// NSInteger count = [[rightSideController.noteArrayController arrangedObjects] count];
|
|
-// if (count < 1) {
|
|
|
|
|
|
+
|
|
|
|
+ if (count < 1) {
|
|
// if (notes.count < 1) {
|
|
// if (notes.count < 1) {
|
|
// leftSideController.noteSearchButton.enabled = NO;
|
|
// leftSideController.noteSearchButton.enabled = NO;
|
|
// leftSideController.noteFilterButton.enabled = NO;
|
|
// leftSideController.noteFilterButton.enabled = NO;
|
|
// }
|
|
// }
|
|
//
|
|
//
|
|
-// rightSideController.noteOutlineView.usesAlternatingRowBackgroundColors = NO;
|
|
|
|
-// NSView *view = rightSideController.noteOutlineView.enclosingScrollView;
|
|
|
|
|
|
+ self.noteOutlineView.usesAlternatingRowBackgroundColors = false
|
|
|
|
+ let view = self.noteOutlineView.enclosingScrollView
|
|
// CGSize emptyVcSize = self.leftSideEmptyVC.emptyAnnotationView.frame.size;
|
|
// CGSize emptyVcSize = self.leftSideEmptyVC.emptyAnnotationView.frame.size;
|
|
// self.leftSideEmptyVC.emptyAnnotationView.frame = NSMakeRect((view.frame.size.width-emptyVcSize.width)/2.0,(view.frame.size.height-emptyVcSize.height)/2.0, emptyVcSize.width, emptyVcSize.height);
|
|
// self.leftSideEmptyVC.emptyAnnotationView.frame = NSMakeRect((view.frame.size.width-emptyVcSize.width)/2.0,(view.frame.size.height-emptyVcSize.height)/2.0, emptyVcSize.width, emptyVcSize.height);
|
|
// self.leftSideEmptyVC.emptyAnnotationView.autoresizingMask = NSViewMinXMargin | NSViewMaxXMargin | NSViewMaxYMargin | NSViewMinYMargin;
|
|
// self.leftSideEmptyVC.emptyAnnotationView.autoresizingMask = NSViewMinXMargin | NSViewMaxXMargin | NSViewMaxYMargin | NSViewMinYMargin;
|
|
@@ -2675,43 +2685,29 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
// self.leftSideEmptyVC.exportAnnotationBtn.enabled = NO;
|
|
// self.leftSideEmptyVC.exportAnnotationBtn.enabled = NO;
|
|
// self.leftSideEmptyVC.deleteAnnotationBtn.enabled = NO;
|
|
// self.leftSideEmptyVC.deleteAnnotationBtn.enabled = NO;
|
|
//
|
|
//
|
|
-// if (leftSideController.segmentedControl.selectedSegment == KMSelectedSegmentType_Annotation) {
|
|
|
|
-// leftSideController.noteHeaderView.hidden = YES;
|
|
|
|
-// leftSideController.toolButtonBoxLayoutConstraint.constant = 40.0;
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// leftSideController.noteSearchButton.enabled = YES;
|
|
|
|
-// leftSideController.noteFilterButton.enabled = YES;
|
|
|
|
-//
|
|
|
|
-// rightSideController.noteOutlineView.usesAlternatingRowBackgroundColors = NO;
|
|
|
|
-//
|
|
|
|
|
|
+ if (self.segmentedControl.selectedSegment == KMSelectedSegmentType.annotation.rawValue) {
|
|
|
|
+ self.noteHeaderView.isHidden = true
|
|
|
|
+ self.toolButtonBoxLayoutConstraint.constant = 40.0
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ self.noteSearchButton.isEnabled = true
|
|
|
|
+ self.noteFilterButton.isEnabled = true
|
|
|
|
+
|
|
|
|
+ self.noteOutlineView.usesAlternatingRowBackgroundColors = false
|
|
|
|
+
|
|
// [self.leftSideEmptyVC.emptyAnnotationView removeFromSuperview];
|
|
// [self.leftSideEmptyVC.emptyAnnotationView removeFromSuperview];
|
|
// self.leftSideEmptyVC.exportAnnotationBtn.enabled = YES;
|
|
// self.leftSideEmptyVC.exportAnnotationBtn.enabled = YES;
|
|
// self.leftSideEmptyVC.deleteAnnotationBtn.enabled = YES;
|
|
// self.leftSideEmptyVC.deleteAnnotationBtn.enabled = YES;
|
|
//
|
|
//
|
|
-// if (leftSideController.segmentedControl.selectedSegment == KMSelectedSegmentType_Annotation) {
|
|
|
|
-// leftSideController.noteHeaderView.hidden = NO;
|
|
|
|
-// leftSideController.toolButtonBoxLayoutConstraint.constant = 64.0;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// return count;
|
|
|
|
-// } else {
|
|
|
|
- // return [item hasNoteText];
|
|
|
|
-// }
|
|
|
|
- if item is KMBOTAAnnotationSection {
|
|
|
|
- let section = item as? KMBOTAAnnotationSection
|
|
|
|
- return section!.annotations?.count ?? 0
|
|
|
|
- } else if item is KMBOTAAnnotationItem {
|
|
|
|
- return 1
|
|
|
|
- } else {
|
|
|
|
- var count = 0
|
|
|
|
- for section in self.annotationViewController.annotations {
|
|
|
|
- if section.annotations?.count != 0 {
|
|
|
|
- count += 1
|
|
|
|
|
|
+ if (self.segmentedControl.selectedSegment == KMSelectedSegmentType.annotation.rawValue) {
|
|
|
|
+ self.noteHeaderView.isHidden = false
|
|
|
|
+ self.toolButtonBoxLayoutConstraint.constant = 64.0
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return count
|
|
|
|
- }
|
|
|
|
|
|
+ return count;
|
|
|
|
+// } else {
|
|
|
|
+// return [item hasNoteText];
|
|
|
|
+// }
|
|
}
|
|
}
|
|
return 0
|
|
return 0
|
|
}
|
|
}
|
|
@@ -2745,21 +2741,15 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
// }
|
|
// }
|
|
// else
|
|
// else
|
|
// return [item noteText];
|
|
// return [item noteText];
|
|
- if item is KMBOTAAnnotationSection {
|
|
|
|
- let section = item as? KMBOTAAnnotationSection
|
|
|
|
- return section!.annotations?[index] as Any
|
|
|
|
- } else if item is KMBOTAAnnotationItem {
|
|
|
|
- return item as Any
|
|
|
|
- } else {
|
|
|
|
- var tempArray: [KMBOTAAnnotationSection] = []
|
|
|
|
- for temp in self.annotationViewController.annotations {
|
|
|
|
- if temp.annotations?.count != 0 {
|
|
|
|
- tempArray.append(temp)
|
|
|
|
|
|
+ var tempArray: [KMBOTAAnnotationItem] = []
|
|
|
|
+ for secion in self.annotationViewController.annotations {
|
|
|
|
+ if secion.annotations?.count != 0 {
|
|
|
|
+ for _item in secion.annotations! {
|
|
|
|
+ tempArray.append(_item)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- let section = tempArray[index]
|
|
|
|
- return section as Any
|
|
|
|
}
|
|
}
|
|
|
|
+ return tempArray[index] as Any
|
|
}
|
|
}
|
|
return item
|
|
return item
|
|
}
|
|
}
|
|
@@ -2874,21 +2864,6 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
// }
|
|
// }
|
|
return cell
|
|
return cell
|
|
} else if outlineView.isEqual(to: self.noteOutlineView) {
|
|
} else if outlineView.isEqual(to: self.noteOutlineView) {
|
|
- if item is KMBOTAAnnotationItem {
|
|
|
|
-// let cell : KMAnnotationOutlineCellView = KMAnnotationOutlineCellView.init()
|
|
|
|
-// cell.delegate = self
|
|
|
|
-// cell.model = item as? KMBOTAAnnotationItem
|
|
|
|
-// return cell
|
|
|
|
- } else if item is KMBOTAAnnotationSection {
|
|
|
|
-// let section = item as? KMBOTAAnnotationSection
|
|
|
|
-//
|
|
|
|
-// let cell : KMAnnotationOutlineSectionView = KMAnnotationOutlineSectionView.init()
|
|
|
|
-// cell.model = section
|
|
|
|
-// return cell
|
|
|
|
- return nil
|
|
|
|
- }
|
|
|
|
-// return NSTableCellView()
|
|
|
|
-
|
|
|
|
let note = (item as! KMBOTAAnnotationItem).annotation!
|
|
let note = (item as! KMBOTAAnnotationItem).annotation!
|
|
let cell = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMNoteTableViewCell"), owner: self) as! KMNoteTableViewCell
|
|
let cell = outlineView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMNoteTableViewCell"), owner: self) as! KMNoteTableViewCell
|
|
cell.cellNote = note
|
|
cell.cellNote = note
|
|
@@ -3174,20 +3149,26 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
func outlineView(_ outlineView: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {
|
|
func outlineView(_ outlineView: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {
|
|
if item is KMBOTAAnnotationItem {
|
|
if item is KMBOTAAnnotationItem {
|
|
return KMBOTAAnnotationTool.fetchCellHeight(annotation: (item as? KMBOTAAnnotationItem)!.annotation!, maxSize: CGSize(width: 260+40 - 16, height: 1000))
|
|
return KMBOTAAnnotationTool.fetchCellHeight(annotation: (item as? KMBOTAAnnotationItem)!.annotation!, maxSize: CGSize(width: 260+40 - 16, height: 1000))
|
|
- } else if item is KMBOTAAnnotationSection {
|
|
|
|
- return 40
|
|
|
|
- } else {
|
|
|
|
- return 30
|
|
|
|
}
|
|
}
|
|
|
|
+ return 30
|
|
}
|
|
}
|
|
|
|
|
|
func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {
|
|
func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {
|
|
-// if item is KMBOTAAnnotationItem {
|
|
|
|
-// return false
|
|
|
|
-// } else if item is KMBOTAAnnotationSection {
|
|
|
|
-// let section = item as? KMBOTAAnnotationSection
|
|
|
|
-// return section!.annotations?.count ?? 0 > 0
|
|
|
|
-// }
|
|
|
|
|
|
+// if ([ov isEqual:leftSideController.tocOutlineView]) {
|
|
|
|
+// if (item == nil && [[pdfView document] isLocked] == NO)
|
|
|
|
+// item = [[pdfView document] outlineRoot];
|
|
|
|
+//
|
|
|
|
+// if (self.isSearchOutlineMode) {
|
|
|
|
+// return [self subOutLineContainString:self.leftSideController.outlineSearchField.stringValue rootOutline:(PDFOutline *)item];
|
|
|
|
+// } else {
|
|
|
|
+// return ([(PDFOutline *)item numberOfChildren] > 0);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// } else
|
|
|
|
+ if outlineView.isEqual(to: self.noteOutlineView) {
|
|
|
|
+ // return [item hasNoteText];
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3195,21 +3176,7 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
#pragma mark NSOutlineView datasource protocol
|
|
#pragma mark NSOutlineView datasource protocol
|
|
|
|
|
|
- (BOOL)outlineView:(NSOutlineView *)ov isItemExpandable:(id)item{
|
|
- (BOOL)outlineView:(NSOutlineView *)ov isItemExpandable:(id)item{
|
|
- if ([ov isEqual:leftSideController.tocOutlineView]) {
|
|
|
|
- if (item == nil && [[pdfView document] isLocked] == NO)
|
|
|
|
- item = [[pdfView document] outlineRoot];
|
|
|
|
-
|
|
|
|
- if (self.isSearchOutlineMode) {
|
|
|
|
- return [self subOutLineContainString:self.leftSideController.outlineSearchField.stringValue rootOutline:(PDFOutline *)item];
|
|
|
|
- } else {
|
|
|
|
- return ([(PDFOutline *)item numberOfChildren] > 0);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if ([ov isEqual:rightSideController.noteOutlineView]) {
|
|
|
|
- // return [item hasNoteText];
|
|
|
|
- return NO;
|
|
|
|
- }
|
|
|
|
- return NO;
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
|
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|