|
@@ -415,6 +415,8 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
|
|
|
var tocType: KMFoldType = .none
|
|
var tocType: KMFoldType = .none
|
|
|
|
|
|
|
|
+ var snapshots: [Any] = []
|
|
|
|
+
|
|
private var _noteSortType: KMNoteSortType = .none
|
|
private var _noteSortType: KMNoteSortType = .none
|
|
var noteSortType: KMNoteSortType {
|
|
var noteSortType: KMNoteSortType {
|
|
get {
|
|
get {
|
|
@@ -485,33 +487,33 @@ class KMLeftSideViewController: KMSideViewController {
|
|
// [snapshotTableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
|
|
// [snapshotTableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
|
|
self.snapshotLabel.stringValue = KMLocalizedString("Snapshots", nil)
|
|
self.snapshotLabel.stringValue = KMLocalizedString("Snapshots", nil)
|
|
self.snapshotLabel.textColor = KMAppearance.Layout.h0Color()
|
|
self.snapshotLabel.textColor = KMAppearance.Layout.h0Color()
|
|
-// [_snapshotNormalZoomInButton setAction:@selector(thumbnailSizeScaling:)];
|
|
|
|
-// [_snapshotNormalZoomInButton setTarget:mainController];
|
|
|
|
-// _snapshotNormalZoomInButton.tag = 2;
|
|
|
|
-// [_snapshotNormalZoomOutButton setAction:@selector(thumbnailSizeScaling:)];
|
|
|
|
-// [_snapshotNormalZoomOutButton setTarget:mainController];
|
|
|
|
-// _snapshotNormalZoomOutButton.tag = 3;
|
|
|
|
|
|
+ self.snapshotNormalZoomInButton.action = #selector(thumbnailSizeScaling)
|
|
|
|
+ self.snapshotNormalZoomInButton.target = self
|
|
|
|
+ self.snapshotNormalZoomInButton.tag = 2
|
|
|
|
+ self.snapshotNormalZoomOutButton.action = #selector(thumbnailSizeScaling)
|
|
|
|
+ self.snapshotNormalZoomOutButton.target = self
|
|
|
|
+ self.snapshotNormalZoomOutButton.tag = 3
|
|
self.snapshotNormalSearchButton.toolTip = KMLocalizedString("Search", nil)
|
|
self.snapshotNormalSearchButton.toolTip = KMLocalizedString("Search", nil)
|
|
-// [_snapshotNormalMoreButton setAction:@selector(leftSideViewMoreButtonAction:)];
|
|
|
|
-// [_snapshotNormalMoreButton setTarget:mainController];
|
|
|
|
-// [_snapshotNormalMoreButton setTag:300];
|
|
|
|
|
|
+ self.snapshotNormalMoreButton.action = #selector(leftSideViewMoreButtonAction)
|
|
|
|
+ self.snapshotNormalMoreButton.target = self
|
|
|
|
+ self.snapshotNormalMoreButton.tag = 300
|
|
|
|
|
|
-// [_snapshotSearchZoomInButton setAction:@selector(thumbnailSizeScaling:)];
|
|
|
|
-// [_snapshotSearchZoomInButton setTarget:mainController];
|
|
|
|
-// _snapshotSearchZoomInButton.tag = 2;
|
|
|
|
-// [_snapshotSearchZoomOutButton setAction:@selector(thumbnailSizeScaling:)];
|
|
|
|
-// [_snapshotSearchZoomOutButton setTarget:mainController];
|
|
|
|
-// _snapshotSearchZoomOutButton.tag = 3;
|
|
|
|
|
|
+ self.snapshotSearchZoomInButton.action = #selector(thumbnailSizeScaling)
|
|
|
|
+ self.snapshotSearchZoomInButton.target = self
|
|
|
|
+ self.snapshotSearchZoomInButton.tag = 2
|
|
|
|
+ self.snapshotSearchZoomOutButton.action = #selector(thumbnailSizeScaling)
|
|
|
|
+ self.snapshotSearchZoomOutButton.target = self
|
|
|
|
+ self.snapshotSearchZoomOutButton.tag = 3
|
|
self.snapshotDoneButton.title = KMLocalizedString("Done", nil)
|
|
self.snapshotDoneButton.title = KMLocalizedString("Done", nil)
|
|
self.snapshotDoneButton.toolTip = KMLocalizedString("Done", nil)
|
|
self.snapshotDoneButton.toolTip = KMLocalizedString("Done", nil)
|
|
self.snapshotDoneButton.setTitleColor(KMAppearance.Layout.w0Color())
|
|
self.snapshotDoneButton.setTitleColor(KMAppearance.Layout.w0Color())
|
|
self.snapshotDoneButton.wantsLayer = true
|
|
self.snapshotDoneButton.wantsLayer = true
|
|
self.snapshotDoneButton.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
|
|
self.snapshotDoneButton.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
|
|
self.snapshotDoneButton.layer?.cornerRadius = 4.0
|
|
self.snapshotDoneButton.layer?.cornerRadius = 4.0
|
|
-// [self.snapshotDoneButton setAction:@selector(leftSideViewDoneButtonAction:)];
|
|
|
|
-// [self.snapshotDoneButton setTarget:mainController];
|
|
|
|
-// [self.snapshotDoneButton setTag:312];
|
|
|
|
-// self.snapshotDoneButton.hidden = YES;
|
|
|
|
|
|
+ self.snapshotDoneButton.action = #selector(leftSideViewDoneButtonAction)
|
|
|
|
+ self.snapshotDoneButton.target = self
|
|
|
|
+ self.snapshotDoneButton.tag = 312
|
|
|
|
+ self.snapshotDoneButton.isHidden = true
|
|
|
|
|
|
// [noteOutlineView setAutoresizesOutlineColumn: NO];
|
|
// [noteOutlineView setAutoresizesOutlineColumn: NO];
|
|
|
|
|
|
@@ -738,6 +740,7 @@ class KMLeftSideViewController: KMSideViewController {
|
|
} else if (segIndex == 3) {
|
|
} else if (segIndex == 3) {
|
|
self.toolButtonBox.contentView = self.snapshotNormalView
|
|
self.toolButtonBox.contentView = self.snapshotNormalView
|
|
self.displaySnapshotViewAnimating(false)
|
|
self.displaySnapshotViewAnimating(false)
|
|
|
|
+ self.updataLeftSideSnapView()
|
|
} else if (segIndex == 4) {
|
|
} else if (segIndex == 4) {
|
|
self.toolButtonBox.isHidden = true
|
|
self.toolButtonBox.isHidden = true
|
|
self.toolButtonBoxLayoutConstraint.constant = 0
|
|
self.toolButtonBoxLayoutConstraint.constant = 0
|
|
@@ -856,7 +859,7 @@ class KMLeftSideViewController: KMSideViewController {
|
|
self.snapshotTableView.enclosingScrollView?.frame = frame
|
|
self.snapshotTableView.enclosingScrollView?.frame = frame
|
|
self.leftSideEmptyVC.emptySnapView.removeFromSuperview()
|
|
self.leftSideEmptyVC.emptySnapView.removeFromSuperview()
|
|
|
|
|
|
-// [self updataLeftSideSnapView];
|
|
|
|
|
|
+ self.updataLeftSideSnapView()
|
|
}
|
|
}
|
|
|
|
|
|
func displayFindState() {
|
|
func displayFindState() {
|
|
@@ -868,6 +871,39 @@ class KMLeftSideViewController: KMSideViewController {
|
|
// [self displaySnapshotFind];
|
|
// [self displaySnapshotFind];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ func updataLeftSideSnapView() {
|
|
|
|
+ if (snapshots.count < 1) {
|
|
|
|
+ self.snapshotNormalSearchButton.isEnabled = false
|
|
|
|
+ // leftSideController.snapshotSearchZoomOutButton.enabled = NO;
|
|
|
|
+ self.snapshotNormalZoomOutButton.isEnabled = false
|
|
|
|
+ // leftSideController.snapshotSearchZoomInButton.enabled = NO;
|
|
|
|
+ self.snapshotNormalZoomInButton.isEnabled = false
|
|
|
|
+ self.snapshotNormalMoreButton.isEnabled = false
|
|
|
|
+
|
|
|
|
+ self.leftSideEmptyVC.deleteSnapBtn.isEnabled = false
|
|
|
|
+ self.leftSideEmptyVC.exportSnapBtn.isEnabled = false
|
|
|
|
+ self.leftSideEmptyVC.printSnapBtn.isEnabled = false
|
|
|
|
+ self.snapshotTableView.usesAlternatingRowBackgroundColors = false
|
|
|
|
+ let view = self.snapshotTableView.enclosingScrollView!
|
|
|
|
+ let emptyVcSize = self.leftSideEmptyVC.emptySnapView.frame.size
|
|
|
|
+ self.leftSideEmptyVC.emptySnapView.frame = NSMakeRect((view.frame.size.width-emptyVcSize.width)/2.0,(view.frame.size.height-emptyVcSize.height)/2.0, emptyVcSize.width, emptyVcSize.height);
|
|
|
|
+ self.leftSideEmptyVC.emptySnapView.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
|
|
|
|
+ self.snapshotTableView.enclosingScrollView?.documentView?.addSubview(self.leftSideEmptyVC.emptySnapView)
|
|
|
|
+ } else {
|
|
|
|
+ self.snapshotNormalSearchButton.isEnabled = true
|
|
|
|
+ // leftSideController.snapshotSearchZoomOutButton.enabled = YES;
|
|
|
|
+ self.snapshotNormalZoomOutButton.isEnabled = true
|
|
|
|
+ // leftSideController.snapshotSearchZoomInButton.enabled = YES;
|
|
|
|
+ self.snapshotNormalZoomInButton.isEnabled = true
|
|
|
|
+ self.snapshotNormalMoreButton.isEnabled = true
|
|
|
|
+
|
|
|
|
+ self.leftSideEmptyVC.emptySnapView.removeFromSuperview()
|
|
|
|
+ self.leftSideEmptyVC.deleteSnapBtn.isEnabled = true
|
|
|
|
+ self.leftSideEmptyVC.exportSnapBtn.isEnabled = true
|
|
|
|
+ self.leftSideEmptyVC.printSnapBtn.isEnabled = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
/*
|
|
/*
|
|
|
|
|
|
- (void) {
|
|
- (void) {
|
|
@@ -1058,24 +1094,20 @@ class KMLeftSideViewController: KMSideViewController {
|
|
[self.snapshotSearchField setTarget:mainController];
|
|
[self.snapshotSearchField setTarget:mainController];
|
|
[self.snapshotSearchField setDelegate:mainController];
|
|
[self.snapshotSearchField setDelegate:mainController];
|
|
}
|
|
}
|
|
-
|
|
|
|
- #pragma mark - UI Action
|
|
|
|
-
|
|
|
|
- - (IBAction)snapshotNormalSearchButtonAction:(NSButton *)sender {
|
|
|
|
- _snapshotSearchField.hidden = NO;
|
|
|
|
- // _snapshotSearchZoomOutButton.hidden = YES;
|
|
|
|
- _snapshotSearchZoomInButton.hidden = YES;
|
|
|
|
- _snapshotNormalSearchButton.hidden = YES;
|
|
|
|
- _snapshotDoneButton.hidden = NO;
|
|
|
|
- _snapshotLabel.hidden = YES;
|
|
|
|
- _snapshotNormalZoomOutButton.hidden = YES;
|
|
|
|
- _snapshotNormalZoomInButton.hidden = YES;
|
|
|
|
-
|
|
|
|
- [_snapshotSearchField becomeFirstResponder];
|
|
|
|
- }
|
|
|
|
*/
|
|
*/
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @IBAction func snapshotNormalSearchButtonAction(_ sender: NSButton) {
|
|
|
|
+ self.snapshotSearchField.isHidden = false
|
|
|
|
+ // _snapshotSearchZoomOutButton.hidden = YES;
|
|
|
|
+ self.snapshotSearchZoomInButton.isHidden = true
|
|
|
|
+ self.snapshotNormalSearchButton.isHidden = true
|
|
|
|
+ self.snapshotDoneButton.isHidden = false
|
|
|
|
+ self.snapshotLabel.isHidden = true
|
|
|
|
+ self.snapshotNormalZoomOutButton.isHidden = true
|
|
|
|
+ self.snapshotNormalZoomInButton.isHidden = true
|
|
|
|
+
|
|
|
|
+ self.snapshotSearchField.becomeFirstResponder()
|
|
|
|
+ }
|
|
|
|
|
|
func resetThumbnails() {
|
|
func resetThumbnails() {
|
|
// [self willChangeValueForKey:THUMBNAILS_KEY];
|
|
// [self willChangeValueForKey:THUMBNAILS_KEY];
|
|
@@ -1601,6 +1633,46 @@ class KMLeftSideViewController: KMSideViewController {
|
|
// [self removeAllOutline:item];
|
|
// [self removeAllOutline:item];
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @IBAction func thumbnailSizeScaling(_ sender: NSButton) {
|
|
|
|
+ let sud = UserDefaults.standard
|
|
|
|
+
|
|
|
|
+ let tag = sender.tag
|
|
|
|
+ if (tag == 0 || tag == 1) {
|
|
|
|
+ var scaling = sud.float(forKey: "KMThumbnailSizeScalingKey")
|
|
|
|
+ if (scaling <= 0) {
|
|
|
|
+ scaling = 1
|
|
|
|
+ }
|
|
|
|
+ if (tag == 0) { // thumbnail Zoom In
|
|
|
|
+ scaling += 0.1
|
|
|
|
+ } else if (tag == 1) { // thumbnail Zoom Out
|
|
|
|
+ scaling -= 0.1
|
|
|
|
+ }
|
|
|
|
+ sud.setValue(scaling, forKey: "KMThumbnailSizeScalingKey")
|
|
|
|
+
|
|
|
|
+ let selectRow = self.thumbnailTableView.selectedRow
|
|
|
|
+ self.thumbnailTableView.reloadData()
|
|
|
|
+
|
|
|
|
+ self.thumbnailTableView.selectRowIndexes(IndexSet(integer: selectRow), byExtendingSelection: false)
|
|
|
|
+ } else if (tag == 2 || tag == 3) {
|
|
|
|
+ var scaling = sud.float(forKey: "KMSnapshotSizeScalingKey")
|
|
|
|
+ if (scaling <= 0) {
|
|
|
|
+ scaling = 1
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (tag == 2) { // snapshot Zoom In
|
|
|
|
+ scaling += 0.1
|
|
|
|
+ } else if (tag == 3) { // snapshot Zoom Out
|
|
|
|
+ scaling -= 0.1
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sud.setValue(scaling, forKey: "KMSnapshotSizeScalingKey")
|
|
|
|
+
|
|
|
|
+ let selectRow = self.snapshotTableView.selectedRow
|
|
|
|
+ self.snapshotTableView.reloadData()
|
|
|
|
+ self.snapshotTableView.selectRowIndexes(IndexSet(integer: selectRow), byExtendingSelection: false)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//MARK: NSTableViewDelegate,NSTableViewDataSource
|
|
//MARK: NSTableViewDelegate,NSTableViewDataSource
|