|
@@ -16,16 +16,10 @@ import Cocoa
|
|
@objc optional func controller(controller: KMLeftSideViewController, itemClick item: Any?, itemKey: KMItemKey, params: Any?)
|
|
@objc optional func controller(controller: KMLeftSideViewController, itemClick item: Any?, itemKey: KMItemKey, params: Any?)
|
|
|
|
|
|
@objc optional func controller(controller: KMLeftSideViewController, bookMarkDidChange bookMarks: [KMBookMarkItem])
|
|
@objc optional func controller(controller: KMLeftSideViewController, bookMarkDidChange bookMarks: [KMBookMarkItem])
|
|
-
|
|
|
|
@objc optional func controller(controller: KMLeftSideViewController, rotateType: KMRotateType)
|
|
@objc optional func controller(controller: KMLeftSideViewController, rotateType: KMRotateType)
|
|
}
|
|
}
|
|
|
|
|
|
class KMLeftSideViewController: KMSideViewController {
|
|
class KMLeftSideViewController: KMSideViewController {
|
|
-// lazy var panelSetViewController : KMPDFViewPanelSetViewController = {
|
|
|
|
-// let panelSetViewController = KMPDFViewPanelSetViewController()
|
|
|
|
-// return panelSetViewController
|
|
|
|
-// }()
|
|
|
|
-
|
|
|
|
var dataSource : [KMLeftMethodMode] = [KMLeftMethodMode]()
|
|
var dataSource : [KMLeftMethodMode] = [KMLeftMethodMode]()
|
|
|
|
|
|
var type : KMLeftMethodMode = KMLeftMethodMode()
|
|
var type : KMLeftMethodMode = KMLeftMethodMode()
|
|
@@ -54,12 +48,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
override func viewDidLoad() {
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
super.viewDidLoad()
|
|
|
|
|
|
-// self.leftBox.backgroundColor(NSColor.km_init(hex: "#F7F8FA"))
|
|
|
|
-// self.leftTableview.backgroundColor(NSColor.km_init(hex: "#F7F8FA"))
|
|
|
|
-// self.leftTableview.border(NSColor.km_init(hex: "#EDEEF0"),1 , 0)
|
|
|
|
-// self.addMenuTitle()
|
|
|
|
-// self.refreshShowMethod()
|
|
|
|
-
|
|
|
|
DistributedNotificationCenter.default().addObserver(self, selector: #selector(_themeChanged), name: NSApplication.interfaceThemeChangedNotification, object: nil)
|
|
DistributedNotificationCenter.default().addObserver(self, selector: #selector(_themeChanged), name: NSApplication.interfaceThemeChangedNotification, object: nil)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -74,11 +62,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
}
|
|
}
|
|
|
|
|
|
func refreshMethodType(methodType: BotaType) {
|
|
func refreshMethodType(methodType: BotaType) {
|
|
-// if (self.isShowPanel) {
|
|
|
|
-// self.showPanelView(show: false)
|
|
|
|
-// return
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
let newType = KMLeftMethodMode()
|
|
let newType = KMLeftMethodMode()
|
|
var show = true
|
|
var show = true
|
|
if self.type.methodType != methodType {
|
|
if self.type.methodType != methodType {
|
|
@@ -90,167 +73,11 @@ class KMLeftSideViewController: KMSideViewController {
|
|
show = false
|
|
show = false
|
|
}
|
|
}
|
|
self.type = newType;
|
|
self.type = newType;
|
|
-// self.refreshShowMethod()
|
|
|
|
self.delegate?.controlStateChange?(self,show:show)
|
|
self.delegate?.controlStateChange?(self,show:show)
|
|
}
|
|
}
|
|
|
|
|
|
-// func refreshShowMethod() {
|
|
|
|
-// self.dataSource = [KMLeftMethodMode]()
|
|
|
|
-// norImage = []
|
|
|
|
-// selectImage = []
|
|
|
|
-// if KMBOTAManagerClass.shard.getMethodShow(key: thumbnailMethodKey) {
|
|
|
|
-// let mode = KMLeftMethodMode()
|
|
|
|
-// mode.methodName = thumbnailMethodKey
|
|
|
|
-// mode.methodType = .Thumbnail
|
|
|
|
-// self.dataSource.insert(mode, at: self.dataSource.count)
|
|
|
|
-// norImage.append("KMImageNameSidebarThumbailNor")
|
|
|
|
-// selectImage.append("KMImageNameSidebarThumbailSelect")
|
|
|
|
-// }
|
|
|
|
-// if KMBOTAManagerClass.shard.getMethodShow(key: outlineMethodKey) {
|
|
|
|
-// let mode = KMLeftMethodMode()
|
|
|
|
-// mode.methodName = outlineMethodKey
|
|
|
|
-// mode.methodType = .Outline
|
|
|
|
-// self.dataSource.insert(mode, at: self.dataSource.count)
|
|
|
|
-// norImage.append("KMImageNameSidebarOutlineNor")
|
|
|
|
-// selectImage.append("KMImageNameSidebarOutlineSelect")
|
|
|
|
-// }
|
|
|
|
-// if KMBOTAManagerClass.shard.getMethodShow(key: bookMarkMethodKey) {
|
|
|
|
-// let mode = KMLeftMethodMode()
|
|
|
|
-// mode.methodName = bookMarkMethodKey
|
|
|
|
-// mode.methodType = .BookMark
|
|
|
|
-// self.dataSource.insert(mode, at: self.dataSource.count)
|
|
|
|
-// norImage.append("KMImageNameSidebarBookMarkNor")
|
|
|
|
-// selectImage.append("KMImageNameSidebarBookMarkSelect")
|
|
|
|
-// }
|
|
|
|
-// if KMBOTAManagerClass.shard.getMethodShow(key: anntationMethodKey) {
|
|
|
|
-// let mode = KMLeftMethodMode()
|
|
|
|
-// mode.methodName = anntationMethodKey
|
|
|
|
-// mode.methodType = .Annotation
|
|
|
|
-// self.dataSource.insert(mode, at: self.dataSource.count)
|
|
|
|
-// norImage.append("KMImageNameSidebarAnnotationNor")
|
|
|
|
-// selectImage.append("KMImageNameSidebarAnnotationSelect")
|
|
|
|
-// }
|
|
|
|
-// if KMBOTAManagerClass.shard.getMethodShow(key: searchMethodKey) {
|
|
|
|
-// let mode = KMLeftMethodMode()
|
|
|
|
-// mode.methodName = searchMethodKey
|
|
|
|
-// mode.methodType = .Search
|
|
|
|
-// self.dataSource.insert(mode, at: self.dataSource.count)
|
|
|
|
-// norImage.append("KMImageNameSidebarSearchNor")
|
|
|
|
-// selectImage.append("KMImageNameSidebarSearchSelect")
|
|
|
|
-// }
|
|
|
|
-//// if KMBOTAManagerClass.shard.getMethodShow(key: formMethodKey) {
|
|
|
|
-//// let mode = KMLeftMethodMode()
|
|
|
|
-//// mode.methodName = formMethodKey
|
|
|
|
-//// mode.methodType = .From
|
|
|
|
-//// self.dataSource.insert(mode, at: self.dataSource.count)
|
|
|
|
-//// }
|
|
|
|
-//// if KMBOTAManagerClass.shard.getMethodShow(key: signatureMethodKey) {
|
|
|
|
-//// let mode = KMLeftMethodMode()
|
|
|
|
-//// mode.methodName = signatureMethodKey
|
|
|
|
-//// mode.methodType = .Signature
|
|
|
|
-//// self.dataSource.insert(mode, at: self.dataSource.count)
|
|
|
|
-//// }
|
|
|
|
-// var isConstant = false
|
|
|
|
-// for source in dataSource {
|
|
|
|
-// if self.type.methodType == source.methodType {
|
|
|
|
-// isConstant = true
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// if(!isConstant) {
|
|
|
|
-// self.type = KMLeftMethodMode()
|
|
|
|
-// }
|
|
|
|
-//// self.leftTableview.reloadData()
|
|
|
|
-// var typeIndex = -1
|
|
|
|
-// for (index,value) in self.dataSource.enumerated() {
|
|
|
|
-// if value.methodType == self.type.methodType {
|
|
|
|
-// typeIndex = index
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-//// self.leftTableview.selectRowIndexes([typeIndex], byExtendingSelection: true)
|
|
|
|
-// if self.dataSource.count > 0 && typeIndex >= 0 {
|
|
|
|
-// self.type = self.dataSource[typeIndex]
|
|
|
|
-// }
|
|
|
|
-// self.updateViewButtonState()
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
- //MARK: menu
|
|
|
|
-
|
|
|
|
-// private func addMenuTitle() {
|
|
|
|
-// let menus : NSMenu = NSMenu(title: "")
|
|
|
|
-//
|
|
|
|
-// let addItem = self.menuItemWithTitle(title: NSLocalizedString("Thumbnails", comment: ""),type:thumbnailMethodKey,action: #selector(renameBookAction),tag: 1)
|
|
|
|
-// let outlineItem = self.menuItemWithTitle(title: NSLocalizedString("Outline", comment: ""),type:outlineMethodKey,action: #selector(renameBookAction),tag: 2)
|
|
|
|
-// let bookItem = self.menuItemWithTitle(title: NSLocalizedString("Bookmarks", comment: ""), type:bookMarkMethodKey,action: #selector(renameBookAction),tag: 3)
|
|
|
|
-// let annationItem = self.menuItemWithTitle(title: NSLocalizedString("Annotations", comment: ""), type:anntationMethodKey,action: #selector(renameBookAction),tag: 4)
|
|
|
|
-// let searchItem = self.menuItemWithTitle(title: NSLocalizedString("Search", comment: ""), type:searchMethodKey,action: #selector(renameBookAction),tag: 5)
|
|
|
|
-//// let formItem = self.menuItemWithTitle(title: NSLocalizedString("域", comment: ""), type:formMethodKey,action: #selector(renameBookAction),tag: 6)
|
|
|
|
-//// let signatureItem = self.menuItemWithTitle(title: NSLocalizedString("签名", comment: ""), type:signatureMethodKey,action: #selector(renameBookAction),tag: 7)
|
|
|
|
-//
|
|
|
|
-// menus.addItem(addItem)
|
|
|
|
-// menus.addItem(outlineItem)
|
|
|
|
-// menus.addItem(bookItem)
|
|
|
|
-// menus.addItem(annationItem)
|
|
|
|
-// menus.addItem(searchItem)
|
|
|
|
-//// menus.addItem(formItem)
|
|
|
|
-//// menus.addItem(signatureItem)
|
|
|
|
-//// self.leftTableview.menu = menus
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// func menuItemWithTitle(title:String,type:String,action:Selector?,tag:Int) -> NSMenuItem {
|
|
|
|
-// let menuItem = NSMenuItem.init(title: title as String, action: action, keyEquivalent: "")
|
|
|
|
-// menuItem.target = self
|
|
|
|
-// menuItem.tag = tag
|
|
|
|
-// if KMBOTAManagerClass.shard.getMethodShow(key: type) {
|
|
|
|
-// menuItem.state = NSControl.StateValue.on
|
|
|
|
-// } else {
|
|
|
|
-// menuItem.state = NSControl.StateValue.off
|
|
|
|
-// }
|
|
|
|
-// return menuItem
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// @objc func renameBookAction(menuItem:NSMenuItem) {
|
|
|
|
-// var show = true
|
|
|
|
-// if menuItem.state == NSControl.StateValue.on {
|
|
|
|
-// menuItem.state = NSControl.StateValue.off
|
|
|
|
-// show = false
|
|
|
|
-// } else {
|
|
|
|
-// menuItem.state = NSControl.StateValue.on
|
|
|
|
-// show = true
|
|
|
|
-// }
|
|
|
|
-// switch menuItem.tag {
|
|
|
|
-// case 1: do {
|
|
|
|
-// KMBOTAManagerClass.shard.setLeftMethod(show: show, key: thumbnailMethodKey)
|
|
|
|
-// }
|
|
|
|
-// case 2: do {
|
|
|
|
-// KMBOTAManagerClass.shard.setLeftMethod(show: show, key: outlineMethodKey)
|
|
|
|
-// }
|
|
|
|
-// case 3: do {
|
|
|
|
-// KMBOTAManagerClass.shard.setLeftMethod(show: show, key: bookMarkMethodKey)
|
|
|
|
-// }
|
|
|
|
-// case 4: do {
|
|
|
|
-// KMBOTAManagerClass.shard.setLeftMethod(show: show, key: anntationMethodKey)
|
|
|
|
-// }
|
|
|
|
-// case 5: do {
|
|
|
|
-// KMBOTAManagerClass.shard.setLeftMethod(show: show, key: searchMethodKey)
|
|
|
|
-// }
|
|
|
|
-// case 6: do {
|
|
|
|
-// KMBOTAManagerClass.shard.setLeftMethod(show: show, key: formMethodKey)
|
|
|
|
-// }
|
|
|
|
-// case 7: do {
|
|
|
|
-// KMBOTAManagerClass.shard.setLeftMethod(show: show, key: signatureMethodKey)
|
|
|
|
-// }
|
|
|
|
-// break
|
|
|
|
-// default:
|
|
|
|
-// break
|
|
|
|
-// }
|
|
|
|
-// self.refreshShowMethod()
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
// MARK: - New
|
|
// MARK: - New
|
|
/*
|
|
/*
|
|
- NSArrayController *thumbnailArrayController;
|
|
|
|
NSArrayController *findArrayController;
|
|
NSArrayController *findArrayController;
|
|
NSArrayController *groupedFindArrayController;
|
|
NSArrayController *groupedFindArrayController;
|
|
}
|
|
}
|
|
@@ -317,7 +144,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
var isDisplayPageSize = false
|
|
var isDisplayPageSize = false
|
|
var thumbnailCacheSize: CGFloat = 32 * 3
|
|
var thumbnailCacheSize: CGFloat = 32 * 3
|
|
var findState: KMFindState = .content
|
|
var findState: KMFindState = .content
|
|
-// var searchResults: [CPDFSelection] = []
|
|
|
|
var searchResults : [KMSearchMode] = [] {
|
|
var searchResults : [KMSearchMode] = [] {
|
|
didSet {
|
|
didSet {
|
|
self.updataLeftSideFindView()
|
|
self.updataLeftSideFindView()
|
|
@@ -422,9 +248,9 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
|
|
|
self.snapshotTableView.delegate = self
|
|
self.snapshotTableView.delegate = self
|
|
self.snapshotTableView.dataSource = self
|
|
self.snapshotTableView.dataSource = self
|
|
-// [[snapshotTableView menu] setDelegate:mainController];
|
|
|
|
-// [snapshotTableView setDoubleAction:@selector(toggleSelectedSnapshots:)];
|
|
|
|
-// [snapshotTableView setTarget:mainController];
|
|
|
|
|
|
+ self.snapshotTableView.menu?.delegate = self
|
|
|
|
+ self.snapshotTableView.doubleAction = #selector(toggleSelectedSnapshots)
|
|
|
|
+ self.snapshotTableView.target = self
|
|
self.snapshotTableView.backgroundColor = .clear
|
|
self.snapshotTableView.backgroundColor = .clear
|
|
// [snapshotTableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
|
|
// [snapshotTableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
|
|
self.snapshotLabel.stringValue = KMLocalizedString("Snapshots", nil)
|
|
self.snapshotLabel.stringValue = KMLocalizedString("Snapshots", nil)
|
|
@@ -541,9 +367,9 @@ class KMLeftSideViewController: KMSideViewController {
|
|
// _outlineSearchButton.hidden = NO;
|
|
// _outlineSearchButton.hidden = NO;
|
|
// }
|
|
// }
|
|
// };
|
|
// };
|
|
-// NSMenu *menuOutline = [NSMenu menu];
|
|
|
|
-// [menuOutline addItemWithTitle:NSLocalizedString(@"Ignore Case", @"Menu item title") action:@selector(toggleOutlineCaseInsensitiveSearch:) target:mainController];
|
|
|
|
-// [[_outlineSearchField cell] setSearchMenuTemplate:menuOutline];
|
|
|
|
|
|
+ let menuOutline = NSMenu()
|
|
|
|
+ menuOutline.addItem(title: KMLocalizedString("Ignore Case", "Menu item title"), action: #selector(toggleOutlineCaseInsensitiveSearch), target: self)
|
|
|
|
+ (self.outlineSearchField.cell as? NSSearchFieldCell)?.searchMenuTemplate = menuOutline
|
|
(self.outlineSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Outline", nil)
|
|
(self.outlineSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Outline", nil)
|
|
self.outlineSearchField.target = self
|
|
self.outlineSearchField.target = self
|
|
|
|
|
|
@@ -567,7 +393,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
self.filterButtonLayer = NSView()
|
|
self.filterButtonLayer = NSView()
|
|
self.noteFilterButton.addSubview(self.filterButtonLayer!)
|
|
self.noteFilterButton.addSubview(self.filterButtonLayer!)
|
|
self.filterButtonLayer?.frame = CGRectMake(14, 2, 8, 8)
|
|
self.filterButtonLayer?.frame = CGRectMake(14, 2, 8, 8)
|
|
-// self.filterButtonLayer?.layerType = KMNoteFilerButtonLayerType_Dot
|
|
|
|
self.filterButtonLayer?.isHidden = true
|
|
self.filterButtonLayer?.isHidden = true
|
|
self.filterButtonLayer?.wantsLayer = true
|
|
self.filterButtonLayer?.wantsLayer = true
|
|
self.filterButtonLayer?.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
|
|
self.filterButtonLayer?.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
|
|
@@ -661,7 +486,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
self.displayGroupedFindViewAnimating(false)
|
|
self.displayGroupedFindViewAnimating(false)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// [mainController bind:@"findPaneState" toObject:searchViewController.segmentedControl withKeyPath:@"selectedSegment" options:nil];
|
|
|
|
self.leftView.segmentedControl.block = { [unowned self] segIndex in
|
|
self.leftView.segmentedControl.block = { [unowned self] segIndex in
|
|
self.toolButtonBox.isHidden = false
|
|
self.toolButtonBox.isHidden = false
|
|
self.toolButtonBoxLayoutConstraint.constant = 40.0
|
|
self.toolButtonBoxLayoutConstraint.constant = 40.0
|
|
@@ -775,9 +599,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
// [[[groupedFindTableView tableColumnWithIdentifier:PAGE_COLUMNID] headerCell] setTitle:NSLocalizedString(@"Page", @"Table header title")];
|
|
// [[[groupedFindTableView tableColumnWithIdentifier:PAGE_COLUMNID] headerCell] setTitle:NSLocalizedString(@"Page", @"Table header title")];
|
|
// [[[groupedFindTableView tableColumnWithIdentifier:RELEVANCE_COLUMNID] dataCell] setEnabled:NO];
|
|
// [[[groupedFindTableView tableColumnWithIdentifier:RELEVANCE_COLUMNID] dataCell] setEnabled:NO];
|
|
|
|
|
|
-// if (RUNNING_AFTER(10_9)) {
|
|
|
|
-// [(SKSourceListTextFieldCell *)[[thumbnailTableView tableColumnWithIdentifier:PAGE_COLUMNID] dataCell] setSimulatesSourceList:YES];
|
|
|
|
-// }
|
|
|
|
self.thumbnailTableView.selectionHighlightStyle = .none
|
|
self.thumbnailTableView.selectionHighlightStyle = .none
|
|
|
|
|
|
// NSSortDescriptor *countDescriptor = [[[NSSortDescriptor alloc] initWithKey:SKGroupedSearchResultCountKey ascending:NO] autorelease];
|
|
// NSSortDescriptor *countDescriptor = [[[NSSortDescriptor alloc] initWithKey:SKGroupedSearchResultCountKey ascending:NO] autorelease];
|
|
@@ -852,7 +673,7 @@ class KMLeftSideViewController: KMSideViewController {
|
|
} else if (self.findState == .note) {
|
|
} else if (self.findState == .note) {
|
|
self.displayNoteFind()
|
|
self.displayNoteFind()
|
|
} else if (self.findState == .snapshot) {
|
|
} else if (self.findState == .snapshot) {
|
|
-// [self displaySnapshotFind];
|
|
|
|
|
|
+ self.displaySnapshotFind()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -995,8 +816,8 @@ class KMLeftSideViewController: KMSideViewController {
|
|
self.searchField = self.searchViewController.searchField
|
|
self.searchField = self.searchViewController.searchField
|
|
|
|
|
|
let menu = NSMenu()
|
|
let menu = NSMenu()
|
|
- 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)
|
|
|
|
|
|
+ _ = 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)?.searchMenuTemplate = menu
|
|
(self.searchViewController.searchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search PDF", "placeholder")
|
|
(self.searchViewController.searchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search PDF", "placeholder")
|
|
self.searchViewController.searchField.action = #selector(search)
|
|
self.searchViewController.searchField.action = #selector(search)
|
|
@@ -1053,7 +874,7 @@ class KMLeftSideViewController: KMSideViewController {
|
|
self.searchField = self.noteSearchField
|
|
self.searchField = self.noteSearchField
|
|
|
|
|
|
let menu = NSMenu()
|
|
let menu = NSMenu()
|
|
- menu.addItem(title: KMLocalizedString("Ignore Case", "Menu item title"), action: #selector(toggleCaseInsensitiveNoteSearch), target: self)
|
|
|
|
|
|
+ _ = 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)?.searchMenuTemplate = menu
|
|
(self.noteSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Notes", "placeholder")
|
|
(self.noteSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Notes", "placeholder")
|
|
self.noteSearchField.action = #selector(searchNotes)
|
|
self.noteSearchField.action = #selector(searchNotes)
|
|
@@ -1064,7 +885,7 @@ class KMLeftSideViewController: KMSideViewController {
|
|
self.searchField = self.snapshotSearchField;
|
|
self.searchField = self.snapshotSearchField;
|
|
|
|
|
|
let menu = NSMenu()
|
|
let menu = NSMenu()
|
|
- menu.addItem(title: KMLocalizedString("Ignore Case", "Menu item title"), action: #selector(toggleCaseInsensitiveNoteSearch), target: self)
|
|
|
|
|
|
+ _ = 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)?.searchMenuTemplate = menu
|
|
(self.snapshotSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Snapshots", "placeholder")
|
|
(self.snapshotSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Snapshots", "placeholder")
|
|
self.snapshotSearchField.action = #selector(searchNotes)
|
|
self.snapshotSearchField.action = #selector(searchNotes)
|
|
@@ -1073,17 +894,12 @@ class KMLeftSideViewController: KMSideViewController {
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
-
|
|
|
|
- (void)applySearchTableHeader:(NSString *)message {
|
|
- (void)applySearchTableHeader:(NSString *)message {
|
|
[[[findTableView tableColumnWithIdentifier:RESULTS_COLUMNID] headerCell] setStringValue:message];
|
|
[[[findTableView tableColumnWithIdentifier:RESULTS_COLUMNID] headerCell] setStringValue:message];
|
|
[[findTableView headerView] setNeedsDisplay:YES];
|
|
[[findTableView headerView] setNeedsDisplay:YES];
|
|
[[[groupedFindTableView tableColumnWithIdentifier:RELEVANCE_COLUMNID] headerCell] setStringValue:message];
|
|
[[[groupedFindTableView tableColumnWithIdentifier:RELEVANCE_COLUMNID] headerCell] setStringValue:message];
|
|
[[groupedFindTableView headerView] setNeedsDisplay:YES];
|
|
[[groupedFindTableView headerView] setNeedsDisplay:YES];
|
|
}
|
|
}
|
|
-
|
|
|
|
- - (void)displaySnapshotFind {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
*/
|
|
*/
|
|
|
|
|
|
@IBAction func search(_ sender: NSSearchField) {
|
|
@IBAction func search(_ sender: NSSearchField) {
|
|
@@ -1105,15 +921,12 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
|
|
|
func resetThumbnails() {
|
|
func resetThumbnails() {
|
|
// [self willChangeValueForKey:THUMBNAILS_KEY];
|
|
// [self willChangeValueForKey:THUMBNAILS_KEY];
|
|
-
|
|
|
|
// self.thumbnailCacheSize = 160
|
|
// self.thumbnailCacheSize = 160
|
|
-
|
|
|
|
self.thumbnails.removeAll()
|
|
self.thumbnails.removeAll()
|
|
let pageLabels = self.listView.document.pageLabels()
|
|
let pageLabels = self.listView.document.pageLabels()
|
|
if (pageLabels.isEmpty == false) {
|
|
if (pageLabels.isEmpty == false) {
|
|
let isLocked = self.listView.document.isLocked
|
|
let isLocked = self.listView.document.isLocked
|
|
let firstPage = self.listView.document.page(at: 0)
|
|
let firstPage = self.listView.document.page(at: 0)
|
|
- // SKPDFPage
|
|
|
|
let emptyPage = CPDFPage()
|
|
let emptyPage = CPDFPage()
|
|
let firstFrame = firstPage?.bounds(for: .cropBox) ?? .zero
|
|
let firstFrame = firstPage?.bounds(for: .cropBox) ?? .zero
|
|
let firstFrame2 = firstPage?.bounds(for: .mediaBox) ?? .zero
|
|
let firstFrame2 = firstPage?.bounds(for: .mediaBox) ?? .zero
|
|
@@ -1136,7 +949,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
}
|
|
}
|
|
pageImage?.unlockFocus()
|
|
pageImage?.unlockFocus()
|
|
|
|
|
|
-// __block typeof(self) blockSelf = self;
|
|
|
|
for (i, label) in pageLabels.enumerated() {
|
|
for (i, label) in pageLabels.enumerated() {
|
|
let firstPage = self.listView.document.page(at: UInt(i))
|
|
let firstPage = self.listView.document.page(at: UInt(i))
|
|
let size = NSMakeSize(self.thumbnailCacheSize, self.thumbnailCacheSize)
|
|
let size = NSMakeSize(self.thumbnailCacheSize, self.thumbnailCacheSize)
|
|
@@ -1457,7 +1269,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
}
|
|
}
|
|
|
|
|
|
@objc func exportAnnotationNotes(_ sender: AnyObject?) {
|
|
@objc func exportAnnotationNotes(_ sender: AnyObject?) {
|
|
-// [self.document saveDocumentTo:sender];
|
|
|
|
self.mainViewController.myDocument?.saveTo(sender)
|
|
self.mainViewController.myDocument?.saveTo(sender)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1503,12 +1314,8 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
|
|
|
let menu = NSMenu()
|
|
let menu = NSMenu()
|
|
let filterViewController = KMNoteOutlineFilterViewController()
|
|
let filterViewController = KMNoteOutlineFilterViewController()
|
|
-// let object = KMPopupMenuObject()
|
|
|
|
-// menu.delegate = object
|
|
|
|
-// object.enterControllerCallback = {
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
|
|
+ filterViewController.view.layer?.backgroundColor = .clear
|
|
|
|
+
|
|
var notes = NSMutableArray()
|
|
var notes = NSMutableArray()
|
|
for section in self._annotations {
|
|
for section in self._annotations {
|
|
if section.annotations?.count != 0 {
|
|
if section.annotations?.count != 0 {
|
|
@@ -1796,7 +1603,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
// MARK: - KMBotaTableViewDelegate
|
|
// MARK: - KMBotaTableViewDelegate
|
|
|
|
|
|
extension KMLeftSideViewController: KMBotaTableViewDelegate {
|
|
extension KMLeftSideViewController: KMBotaTableViewDelegate {
|
|
-
|
|
|
|
func tableView(_ aTableView: NSTableView, canCopyRowsWithIndexes rowIndexes: IndexSet) -> Bool {
|
|
func tableView(_ aTableView: NSTableView, canCopyRowsWithIndexes rowIndexes: IndexSet) -> Bool {
|
|
if aTableView.isEqual(to: self.thumbnailTableView) || aTableView.isEqual(to: self.findTableView) || aTableView.isEqual(to: self.groupedFindTableView) {
|
|
if aTableView.isEqual(to: self.thumbnailTableView) || aTableView.isEqual(to: self.findTableView) || aTableView.isEqual(to: self.groupedFindTableView) {
|
|
return rowIndexes.count > 0
|
|
return rowIndexes.count > 0
|
|
@@ -2024,13 +1830,11 @@ extension KMLeftSideViewController {
|
|
// 将事件传递出去
|
|
// 将事件传递出去
|
|
self.delegate?.controlStateChange?(self,show:show)
|
|
self.delegate?.controlStateChange?(self,show:show)
|
|
if (index != NSNotFound) {
|
|
if (index != NSNotFound) {
|
|
-// self.leftTableview.selectRowIndexes([index], byExtendingSelection: true)
|
|
|
|
|
|
|
|
// 记录当前选中
|
|
// 记录当前选中
|
|
UserDefaults.standard.set(index, forKey: "KMBOTASelectedIndexKey")
|
|
UserDefaults.standard.set(index, forKey: "KMBOTASelectedIndexKey")
|
|
UserDefaults.standard.synchronize()
|
|
UserDefaults.standard.synchronize()
|
|
}
|
|
}
|
|
-// self.leftTableview.reloadData()
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private func getMethodMode(_ type: BotaType) -> KMLeftMethodMode {
|
|
private func getMethodMode(_ type: BotaType) -> KMLeftMethodMode {
|
|
@@ -3228,8 +3032,8 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
|
|
|
|
if (count < 1) {
|
|
if (count < 1) {
|
|
// if (notes.count < 1) {
|
|
// if (notes.count < 1) {
|
|
-// leftSideController.noteSearchButton.enabled = NO;
|
|
|
|
-// leftSideController.noteFilterButton.enabled = NO;
|
|
|
|
|
|
+ self.noteSearchButton.isEnabled = false
|
|
|
|
+ self.noteFilterButton.isEnabled = false
|
|
// }
|
|
// }
|
|
self.noteOutlineView.usesAlternatingRowBackgroundColors = false
|
|
self.noteOutlineView.usesAlternatingRowBackgroundColors = false
|
|
let view = self.noteOutlineView.enclosingScrollView!
|
|
let view = self.noteOutlineView.enclosingScrollView!
|
|
@@ -4730,6 +4534,14 @@ extension KMLeftSideViewController {
|
|
KMPrint("KMLeftSideViewController-searchNotes...")
|
|
KMPrint("KMLeftSideViewController-searchNotes...")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func toggleSelectedSnapshots(_ sender: AnyObject?) {
|
|
|
|
+ KMPrint("KMLeftSideViewController-toggleSelectedSnapshots...")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func toggleOutlineCaseInsensitiveSearch(_ sender: AnyObject?) {
|
|
|
|
+ KMPrint("KMLeftSideViewController-toggleOutlineCaseInsensitiveSearch...")
|
|
|
|
+ }
|
|
|
|
+
|
|
private func _tableView(_ tv: NSTableView, cutRowsWithIndexes rowIndexes: IndexSet) {
|
|
private func _tableView(_ tv: NSTableView, cutRowsWithIndexes rowIndexes: IndexSet) {
|
|
// if tv.isEqual(to: self.thumbnailTableView) {
|
|
// if tv.isEqual(to: self.thumbnailTableView) {
|
|
// self._copysPages.removeAll()
|
|
// self._copysPages.removeAll()
|