Browse Source

【左边栏】新增协议KMImageToolTipContext

tangchao 1 year ago
parent
commit
c785e05bf0

+ 8 - 0
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -3436,6 +3436,9 @@
 		BBC28F412B0EE7D600D73206 /* KMGroupFindTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC28F402B0EE7D600D73206 /* KMGroupFindTableRowView.swift */; };
 		BBC28F422B0EE7D600D73206 /* KMGroupFindTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC28F402B0EE7D600D73206 /* KMGroupFindTableRowView.swift */; };
 		BBC28F432B0EE7D600D73206 /* KMGroupFindTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC28F402B0EE7D600D73206 /* KMGroupFindTableRowView.swift */; };
+		BBC28F462B0F352000D73206 /* KMImageToolTipContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC28F452B0F352000D73206 /* KMImageToolTipContext.swift */; };
+		BBC28F472B0F352000D73206 /* KMImageToolTipContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC28F452B0F352000D73206 /* KMImageToolTipContext.swift */; };
+		BBC28F482B0F352000D73206 /* KMImageToolTipContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC28F452B0F352000D73206 /* KMImageToolTipContext.swift */; };
 		BBC2BCC6295DA8F30036B983 /* KMCropPreviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC2BCC4295DA8F30036B983 /* KMCropPreviewController.swift */; };
 		BBC2BCC7295DA8F30036B983 /* KMCropPreviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC2BCC4295DA8F30036B983 /* KMCropPreviewController.swift */; };
 		BBC2BCC8295DA8F30036B983 /* KMCropPreviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC2BCC4295DA8F30036B983 /* KMCropPreviewController.swift */; };
@@ -5347,6 +5350,7 @@
 		BBBF687F2A3BF17F0058E14E /* KMFilePromiseProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMFilePromiseProvider.swift; sourceTree = "<group>"; };
 		BBBF68832A3C3AF10058E14E /* NSDocumentController+KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDocumentController+KMExtension.swift"; sourceTree = "<group>"; };
 		BBC28F402B0EE7D600D73206 /* KMGroupFindTableRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMGroupFindTableRowView.swift; sourceTree = "<group>"; };
+		BBC28F452B0F352000D73206 /* KMImageToolTipContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMImageToolTipContext.swift; sourceTree = "<group>"; };
 		BBC2BCC4295DA8F30036B983 /* KMCropPreviewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMCropPreviewController.swift; sourceTree = "<group>"; };
 		BBC2BCC5295DA8F30036B983 /* KMCropPreviewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMCropPreviewController.xib; sourceTree = "<group>"; };
 		BBC347FC295448DE008D2CD1 /* KMWatermarkTemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMWatermarkTemplateModel.swift; sourceTree = "<group>"; };
@@ -5866,6 +5870,7 @@
 				BB4F7E6F2B0C3DC40077EC8C /* KMButtonLayer.swift */,
 				BBD512A02B0DE86C005BFE8A /* KMBotaLeftView.swift */,
 				BB4F7E732B0C42160077EC8C /* KMPopupMenuObject.swift */,
+				BBC28F452B0F352000D73206 /* KMImageToolTipContext.swift */,
 				BB6BA4C32B0B4A0F00462CAE /* KMLeftSideEmptyFileViewController.swift */,
 				BB6BA4C72B0B4A4100462CAE /* KMLeftSideEmptyFileViewController.xib */,
 				899700F128F40308009AF911 /* Annotation */,
@@ -12533,6 +12538,7 @@
 				BBEB93EF2AD6C72C00739573 /* KMPDFMergePageRangeTabelViewCell.swift in Sources */,
 				BB897256294C559F0045787C /* KMWatermarkPropertyCreateController.swift in Sources */,
 				F35B484B29A4903300756255 /* NSPointerArray+PDFListView.m in Sources */,
+				BBC28F462B0F352000D73206 /* KMImageToolTipContext.swift in Sources */,
 				BB90E4EE2AF3546500B04B9F /* NSUserDefaultsController+KMExtension.swift in Sources */,
 				BBB14A532978DD5400936EDB /* KMRedactTools.swift in Sources */,
 				BB5F8A1129BB04F000365ADB /* GBDeviceInfo_Common.m in Sources */,
@@ -13034,6 +13040,7 @@
 				ADBC374229CAB1C300D93208 /* KMComparativeOutlineCell.swift in Sources */,
 				9F705F8A291E576D005199AD /* KMTableView.swift in Sources */,
 				BB86C1F328F54535005AD968 /* CPDFListView+KeyEvent.m in Sources */,
+				BBC28F472B0F352000D73206 /* KMImageToolTipContext.swift in Sources */,
 				BBBF68812A3BF17F0058E14E /* KMFilePromiseProvider.swift in Sources */,
 				BB897247294C19980045787C /* KMWatermarkAdjectiveListController.swift in Sources */,
 				9F02018F2A1DDAA500C9B673 /* KMAITranslationWindowController.swift in Sources */,
@@ -14434,6 +14441,7 @@
 				AD5999442AD8DC2000412F8B /* KMDynamicStampViewController.swift in Sources */,
 				BBC347FF295448DE008D2CD1 /* KMWatermarkTemplateModel.swift in Sources */,
 				BBD7FE042A13218F00F96075 /* KMWatermarkAdjectivePropertyBaseController.swift in Sources */,
+				BBC28F482B0F352000D73206 /* KMImageToolTipContext.swift in Sources */,
 				ADAC0DE72AC2B04900FD4F52 /* KMNoteTypeImageView.swift in Sources */,
 				BB853C652AF8742A009C20C1 /* KMBatchOperateRemoveWatermarkViewController.swift in Sources */,
 				9F1FE4F229406E4700E952CA /* BackgroundGradientView.m in Sources */,

+ 87 - 7
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -494,8 +494,8 @@
             filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1379"
-            endingLineNumber = "1379"
+            startingLineNumber = "1371"
+            endingLineNumber = "1371"
             landmarkName = "leftSideViewMoreButtonAction(_:)"
             landmarkType = "7">
          </BreakpointContent>
@@ -503,18 +503,98 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "7D7258B0-B3CA-4E9A-9826-D6C0BDB30C37"
+            uuid = "288CF4C2-F390-4BFB-94A3-8BF58D72D463"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMBotaTableView.swift"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMImageToolTipContext.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "167"
-            endingLineNumber = "167"
-            landmarkName = "copy(_:)"
+            startingLineNumber = "34"
+            endingLineNumber = "34"
+            landmarkName = "toolTipImage()"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "DD702D84-D6C2-401C-AF4D-009D9B821B40"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMImageToolTipContext.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "28"
+            endingLineNumber = "28"
+            landmarkName = "toolTipImage()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "EC0DC115-97D0-4963-BD9B-E98BF406BAD0"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMImageToolTipContext.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "22"
+            endingLineNumber = "22"
+            landmarkName = "toolTipImage()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "41E6AD9C-3A79-4D00-905E-BFC608331422"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMImageToolTipContext.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "16"
+            endingLineNumber = "16"
+            landmarkName = "toolTipImage()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "99BCCDA3-033B-4B2E-919A-808602778946"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1799"
+            endingLineNumber = "1799"
+            landmarkName = "tableView(_:imageContextForRow:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "B9A21403-21C1-4818-A21F-DB59426CC6CB"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "56"
+            endingLineNumber = "56"
+            landmarkName = "KMLeftSideViewController"
+            landmarkType = "3">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 19 - 14
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMBotaTableView.swift

@@ -10,8 +10,6 @@ import Cocoa
 /*
  @protocol SKTableViewDelegate <NSTableViewDelegate>
 
- - (id <SKImageToolTipContext>)tableView:(NSTableView *)aTableView imageContextForRow:(NSInteger)rowIndex;
-
  - (NSArray *)tableView:(NSTableView *)aTableView typeSelectHelperSelectionStrings:(SKTypeSelectHelper *)aTypeSelectHelper;
  - (void)tableView:(NSTableView *)aTableView typeSelectHelper:(SKTypeSelectHelper *)aTypeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString;
  - (void)tableView:(NSTableView *)aTableView typeSelectHelper:(SKTypeSelectHelper *)aTypeSelectHelper updateSearchString:(NSString *)searchString;
@@ -31,6 +29,8 @@ import Cocoa
     
     @objc optional func tableViewMoveLeft(_ aTableView: NSTableView)
     @objc optional func tableViewMoveRight(_ aTableView: NSTableView)
+    
+    @objc optional func tableView(_ aTableView: NSTableView, imageContextForRow rowIndex: Int) -> AnyObject?
 }
 
 class KMBotaTableView: NSTableView {
@@ -100,13 +100,13 @@ class KMBotaTableView: NSTableView {
             return
         }
         
-        let userInfo = event.userData
-//        NSNumber *rowNumber = [userInfo objectForKey:@"row"];
-//        if (rowNumber) {
-//            id <SKImageToolTipContext> context = [[self delegate] tableView:self imageContextForRow:[rowNumber integerValue]];
-//            if (context)
+//        let userInfo = event.userData as? [String : Any]
+        let userInfo = event.trackingArea?.userInfo as? [String : Any]
+        let row = userInfo?["row"] as? Int
+        if row != nil {
+            let context = self.botaDelegate?.tableView?(self, imageContextForRow: row!)
 //                [[SKImageToolTipWindow sharedToolTipWindow] showForImageContext:context atPoint:NSZeroPoint];
-//        }
+        }
     }
     
     override func mouseExited(with event: NSEvent) {
@@ -114,9 +114,11 @@ class KMBotaTableView: NSTableView {
             return
         }
         
-//                NSDictionary *userInfo = [theEvent userData];
-        //        if ([userInfo objectForKey:@"row"])
-        //            [[SKImageToolTipWindow sharedToolTipWindow] fadeOut];
+        let userInfo = event.userData as? [String : Any]
+        let row = userInfo?["row"] as? Int
+        if row != nil {
+//            [[SKImageToolTipWindow sharedToolTipWindow] fadeOut];
+        }
     }
     
     func scrollToBeginningOfDocument(_ sender: AnyObject?) {
@@ -285,14 +287,17 @@ class KMBotaTableView: NSTableView {
 
 extension KMBotaTableView {
     private func _rebuildTrackingAreas() {
-//        if (self.trackingAreas == nil || [[self delegate] respondsToSelector:@selector(tableView:imageContextForRow:)] == NO)
-//            return;
         if self.kmTrackingAreas == nil {
             return
         }
         
-        self._removeTrackingAreas()
+        let context = self.botaDelegate?.tableView?(self, imageContextForRow: 0)
+        if context == nil {
+            return
+        }
         
+        self._removeTrackingAreas()
+        self._areaCache.removeAll()
         if self.window != nil {
             let visibleRect = self.visibleRect
             let rowRange = self.rows(in: visibleRect)

+ 36 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMImageToolTipContext.swift

@@ -0,0 +1,36 @@
+//
+//  KMImageToolTipContext.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/11/23.
+//
+
+import Foundation
+
+protocol KMImageToolTipContext: NSObjectProtocol {
+    func toolTipImage() -> NSImage?
+}
+
+extension NSAttributedString: KMImageToolTipContext {
+    func toolTipImage() -> NSImage? {
+        return nil
+    }
+}
+
+extension CPDFDestination: KMImageToolTipContext {
+    func toolTipImage() -> NSImage? {
+        return nil
+    }
+}
+
+extension CPDFAnnotation: KMImageToolTipContext {
+    func toolTipImage() -> NSImage? {
+        return nil
+    }
+}
+
+extension CPDFPage: KMImageToolTipContext {
+    func toolTipImage() -> NSImage? {
+        return nil
+    }
+}

+ 81 - 59
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -318,7 +318,6 @@ class KMLeftSideViewController: KMSideViewController {
          NSArrayController *groupedFindArrayController;
      }
      - (void)applySearchTableHeader:(NSString *)message;
-     - (void)displayFindState;
      */
     
     @IBOutlet var segmentedControl: KMSegmentedControl!
@@ -398,6 +397,7 @@ class KMLeftSideViewController: KMSideViewController {
     var foldType: KMFoldAllAnnotationType = .none
     private let KMLeftSideViewNoteSortTypeKey = "KMLeftSideViewNoteSortTypeKey"
     private let KMLeftSideViewAscendSortBoolKey = "KMLeftSideViewAscendSortBoolKey"
+    private let SKDisableTableToolTipsKey = "SKDisableTableToolTips"
     
     var tocType: KMFoldType = .none
     
@@ -805,6 +805,7 @@ class KMLeftSideViewController: KMSideViewController {
         self.thumbnailTableView.allowsMultipleSelection = true
         self.findTableView.delegate = self
         self.findTableView.dataSource = self
+        self.findTableView.botaDelegate = self
         self.groupedFindTableView.delegate = self
         self.groupedFindTableView.dataSource = self
         self.groupedFindTableView.botaDelegate = self
@@ -838,12 +839,12 @@ class KMLeftSideViewController: KMSideViewController {
 //
         self.thumbnailTableView.setDraggingSourceOperationMask(.every, forLocal: false)
         
-//        if (NO == [[NSUserDefaults standardUserDefaults] boolForKey:SKDisableTableToolTipsKey]) {
+        if UserDefaults.standard.bool(forKey: SKDisableTableToolTipsKey) == false {
 //            [tocOutlineView setHasImageToolTips:YES];
-//            [findTableView setHasImageToolTips:YES];
-//            [groupedFindTableView setHasImageToolTips:YES];
-//        }
-//        [self updateViewColor];
+            self.findTableView.hasImageToolTips = true
+            self.groupedFindTableView.hasImageToolTips = true
+        }
+        self._updateViewColor()
     }
     
     func displayThumbnailViewAnimating(_ animate: Bool) {
@@ -903,7 +904,7 @@ class KMLeftSideViewController: KMSideViewController {
         if (self.findState == .content) {
             self.displayFind()
         } else if (self.findState == .note) {
-//            [self displayNoteFind];
+            self.displayNoteFind()
         } else if (self.findState == .snapshot) {
 //            [self displaySnapshotFind];
         }
@@ -1046,14 +1047,12 @@ class KMLeftSideViewController: KMSideViewController {
         self.searchField = self.searchViewController.searchField
         
         let menu = NSMenu()
-//        menu.addItem(title: <#T##String#>, action: <#T##Selector?#>, target: <#T##AnyObject?#>)
-//        [menu addItemWithTitle:NSLocalizedString(@"Whole Words Only", @"Menu item title") action:@selector(toggleWholeWordSearch:) target:mainController];
-//        [menu addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleCaseInsensitiveSearch:) target:mainController];
-//        [[searchViewController.searchField cell] setSearchMenuTemplate:menu];
+        menu.addItem(title: KMLocalizedString("Whole Words Only", "Menu item title"), action: #selector(toggleWholeWordSearch), target: self)
+        menu.addItem(title: KMLocalizedString("Ignore Case", "Menu item title"), action: #selector(toggleCaseInsensitiveSearch), target: self)
+        (self.searchViewController.searchField.cell as? NSSearchFieldCell)?.searchMenuTemplate = menu
         (self.searchViewController.searchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search PDF", "placeholder")
-//        self.searchViewController.searchField.target =
-//        [searchViewController.searchField setAction:@selector(search:)];
-//        [searchViewController.searchField setTarget:mainController];
+        self.searchViewController.searchField.action = #selector(search)
+        self.searchViewController.searchField.target = self
 
         if (self.findPaneState == .singular) {
             self.searchViewController.contentView = self.findTableView.enclosingScrollView
@@ -1097,11 +1096,35 @@ class KMLeftSideViewController: KMSideViewController {
         
         self.leftSideEmptyVC.emptyOutlineView.frame = NSMakeRect((view.frame.size.width-emptyVcSize.width)/2.0,(view.frame.size.height-emptyVcSize.height)/2.0, emptyVcSize.width, emptyVcSize.height);
     }
+    
+    override func requiresAlternateButton(forView aview: NSView?) -> Bool {
+        return false
+    }
+    
+    func displayNoteFind() {
+        self.searchField = self.noteSearchField
+        
+        let menu = NSMenu()
+        menu.addItem(title: KMLocalizedString("Ignore Case", "Menu item title"), action: #selector(toggleCaseInsensitiveNoteSearch), target: self)
+        (self.noteSearchField.cell as? NSSearchFieldCell)?.searchMenuTemplate = menu
+        (self.noteSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Notes", "placeholder")
+        self.noteSearchField.action = #selector(searchNotes)
+        self.noteSearchField.target = self
+    }
+    
+    func displaySnapshotFind() {
+        self.searchField = self.snapshotSearchField;
+        
+        let menu = NSMenu()
+        menu.addItem(title: KMLocalizedString("Ignore Case", "Menu item title"), action: #selector(toggleCaseInsensitiveNoteSearch), target: self)
+        (self.snapshotSearchField.cell as? NSSearchFieldCell)?.searchMenuTemplate = menu
+        (self.snapshotSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Snapshots", "placeholder")
+        self.snapshotSearchField.action = #selector(searchNotes)
+        self.snapshotSearchField.target = self
+        self.snapshotSearchField.delegate = self
+    }
+    
     /*
-     - (BOOL)requiresAlternateButtonForView:(NSView *)aView {
-         return NO;
-         return [findTableView isDescendantOf:aView] || [groupedFindTableView isDescendantOf:aView];
-     }
 
      - (void)applySearchTableHeader:(NSString *)message {
          [[[findTableView tableColumnWithIdentifier:RESULTS_COLUMNID] headerCell] setStringValue:message];
@@ -1110,39 +1133,8 @@ class KMLeftSideViewController: KMSideViewController {
          [[groupedFindTableView headerView] setNeedsDisplay:YES];
      }
 
-     - (void)displayFindState {
-         if (mainController.findState == SKFindStateContent) {
-             [self displayFind];
-         } else if (mainController.findState == SKFindStateNote) {
-             [self displayNoteFind];
-         } else if (mainController.findState == SKFindStateSnapshot) {
-             [self displaySnapshotFind];
-         }
-     }
-
-
-
-     - (void)displayNoteFind {
-         mainController.rightSideController.searchField = self.noteSearchField;
-         
-         NSMenu *menu = [NSMenu menu];
-         [menu addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleCaseInsensitiveNoteSearch:) target:mainController];
-         [[self.noteSearchField cell] setSearchMenuTemplate:menu];
-         [[self.noteSearchField cell] setPlaceholderString:NSLocalizedString(@"Search Notes", @"placeholder")];
-         [self.noteSearchField setAction:@selector(searchNotes:)];
-         [self.noteSearchField setTarget:mainController];
-     }
-
      - (void)displaySnapshotFind {
-         mainController.rightSideController.searchField = self.snapshotSearchField;
-         
-         NSMenu *menu = [NSMenu menu];
-         [menu addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleCaseInsensitiveNoteSearch:) target:mainController];
-         [[self.snapshotSearchField cell] setSearchMenuTemplate:menu];
-         [[self.snapshotSearchField cell] setPlaceholderString:NSLocalizedString(@"Search Snapshots", @"placeholder")];
-         [self.snapshotSearchField setAction:@selector(searchNotes:)];
-         [self.snapshotSearchField setTarget:mainController];
-         [self.snapshotSearchField setDelegate:mainController];
+
      }
      */
     
@@ -1791,6 +1783,26 @@ extension KMLeftSideViewController: KMBotaTableViewDelegate {
         }
     }
     
+    func tableView(_ aTableView: NSTableView, imageContextForRow rowIndex: Int) -> AnyObject? {
+        if aTableView.isEqual(to: self.findTableView) {
+            if rowIndex >= self.searchResults.count {
+                return nil
+            }
+            let model = self.searchResults[rowIndex]
+            let selection = model.selection
+            let point = NSPoint(x: NSWidth(selection.bounds) * 0.5, y: NSHeight(selection.bounds) * 0.5)
+            return CPDFDestination(document: self.listView.document, pageIndex: Int(selection.page.pageIndex()), at: point, zoom: self.listView.scaleFactor)
+        } else if aTableView.isEqual(to: self.groupedFindTableView) {
+            if rowIndex >= self.groupSearchResults.count {
+                return nil
+            }
+            let model = self.groupSearchResults[rowIndex]
+            let selection = model.selection
+            let point = NSPoint(x: NSWidth(selection.bounds) * 0.5, y: NSHeight(selection.bounds) * 0.5)
+            return CPDFDestination(document: self.listView.document, pageIndex: Int(selection.page.pageIndex()), at: point, zoom: self.listView.scaleFactor)
+        }
+        return nil
+    }
     
     /*
 
@@ -1805,15 +1817,6 @@ extension KMLeftSideViewController: KMBotaTableViewDelegate {
          return NSNotFound;
      }
 
-
-     - (id <SKImageToolTipContext>)tableView:(NSTableView *)tv imageContextForRow:(NSInteger)row {
-         if ([tv isEqual:leftSideController.findTableView])
-             return [[[leftSideController.findArrayController arrangedObjects] objectAtIndex:row] destination];
-         else if ([tv isEqual:leftSideController.groupedFindTableView])
-             return [[[[[leftSideController.groupedFindArrayController arrangedObjects] objectAtIndex:row] matches] objectAtIndex:0] destination];
-         return nil;
-     }
-
      - (NSArray *)tableView:(NSTableView *)tv typeSelectHelperSelectionStrings:(SKTypeSelectHelper *)typeSelectHelper {
          if ([tv isEqual:leftSideController.thumbnailTableView]) {
              return pageLabels;
@@ -4333,6 +4336,10 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
      */
 }
 
+extension KMLeftSideViewController: NSSearchFieldDelegate {
+    
+}
+
 extension KMLeftSideViewController: NSMenuDelegate {
     func menuNeedsUpdate(_ menu: NSMenu) {
         if menu.isEqual(to: self.tocOutlineView.menu) {
@@ -4732,6 +4739,21 @@ extension KMLeftSideViewController {
         KMPrint("KMLeftSideViewController-selectSelections...")
     }
     
+    @objc func toggleWholeWordSearch(_ sender: AnyObject?) {
+        KMPrint("KMLeftSideViewController-toggleWholeWordSearch...")
+    }
+    
+    @objc func toggleCaseInsensitiveSearch(_ sender: AnyObject?) {
+        KMPrint("KMLeftSideViewController-toggleCaseInsensitiveSearch...")
+    }
+    
+    @objc func toggleCaseInsensitiveNoteSearch(_ sender: AnyObject?) {
+        KMPrint("KMLeftSideViewController-toggleCaseInsensitiveNoteSearch...")
+    }
+    
+    @objc func searchNotes(_ sender: AnyObject?) {
+        KMPrint("KMLeftSideViewController-searchNotes...")
+    }
     
     private func _tableView(_ tv: NSTableView, cutRowsWithIndexes rowIndexes: IndexSet) {
 //        if tv.isEqual(to: self.thumbnailTableView) {