2 Commity ff422a5070 ... f1b8e296e0

Autor SHA1 Wiadomość Data
  liaoxiaoyue f1b8e296e0 【链接注释】- 多次添加注释属性压制修改 1 rok temu
  liaoxiaoyue b74b567510 【BOTA】- 打开上一次的BOTA位置方法修改 1 rok temu

+ 1 - 1
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -97,7 +97,7 @@ class KMLeftSideViewController: NSViewController, KMThumbnailViewControllerDeleg
         let newType = KMLeftMethodMode()
         var show = true
         if self.type.methodType != methodType {
-            newType.methodType = .Annotation
+            newType.methodType = methodType
         }
         if self.type.methodType == methodType {
             show = false

+ 96 - 96
PDF Office/PDF Office/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationLinkViewController.m

@@ -484,109 +484,109 @@ typedef NS_ENUM(NSUInteger, KMAnnotationLinkType) {
 
 #pragma mark - NSTextFieldDelegate Methods
 
-//- (void)controlTextDidChange:(NSNotification *)obj {
-//    NSTextField *textField = (NSTextField *)obj.object;
-//
-//    _errorLabel.hidden = YES;
-//    if ([_mouseDownBox isEqual:_linkPageBox]) {
-//        _pageRecord = textField.stringValue;
-//    } else if ([_mouseDownBox isEqual:_linkUrlBox]) {
-//        _urlRecord = textField.stringValue;
-//    } else if ([_mouseDownBox isEqual:_linkEmailBox]) {
-//        _emailRecord = textField.stringValue;
-//    }
-//
-//    if (_linkType == KMAnnotationLinkType_Page) {
-//        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:nil];
-//
-//        NSUInteger dexPage = [self.inputUrlTextField.stringValue integerValue];
-//
-//        if ((dexPage < 1 || dexPage > _pageCount) && _pageRecord.length > 0) {
-//            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
-//            _errorLabel.hidden = NO;
-//            return;
-//        } else if(_pageRecord.length > 0){
-//            _errorLabel.hidden = YES;
-//        }
-//
-//        CPDFDestination *destination = [[CPDFDestination alloc] initWithDocument:_pdfview.document pageIndex:(dexPage-1)];
-//
-//        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:destination];
-//        [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
-//    } else if (_linkType == KMAnnotationLinkType_URL) {
-//        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
-////        NSString *linkUrlPath = [self judgeWebURL:_urlRecord];
-//        NSString *linkUrlPath = _urlRecord;
-//        if ([linkUrlPath isEqualToString:@""]) {
-//            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:nil];
-//        } else {
-//            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
-//        }
-//        [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
-//
-//    } else if (_linkType == KMAnnotationLinkType_Email) {
-//        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
-//        NSString *linkUrlPath = [self judgeEmailURL:_emailRecord];
-//        if ([linkUrlPath isEqualToString:@""]) {
-//            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:nil];
-//        } else {
-//            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
-//        }
-//        [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
-//    }
-//}
+- (void)controlTextDidChange:(NSNotification *)obj {
+    NSTextField *textField = (NSTextField *)obj.object;
+
+    _errorLabel.hidden = YES;
+    if ([_mouseDownBox isEqual:_linkPageBox]) {
+        _pageRecord = textField.stringValue;
+    } else if ([_mouseDownBox isEqual:_linkUrlBox]) {
+        _urlRecord = textField.stringValue;
+    } else if ([_mouseDownBox isEqual:_linkEmailBox]) {
+        _emailRecord = textField.stringValue;
+    }
 
-- (void)controlTextDidEndEditing:(NSNotification *)obj {
-    switch (_linkType) {
-        case KMAnnotationLinkType_Page: {
-            NSUInteger dexPage = [self.inputUrlTextField.stringValue integerValue];
-            if ((dexPage <0 || dexPage > _pageCount) && _pageRecord.length > 0) {
-                self.errorLabel.hidden = NO;
-            } else {
-                self.errorLabel.hidden = YES;
-                NSInteger goPage = [self.inputUrlTextField.stringValue integerValue];
-                CPDFDestination *destination = [[CPDFDestination alloc] initWithDocument:_pdfview.document pageIndex:(goPage-1)];
-                
-                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:destination];
-                [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
-            }
-            self.goButton.hidden = YES;
+    if (_linkType == KMAnnotationLinkType_Page) {
+        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:nil];
+
+        NSUInteger dexPage = [self.inputUrlTextField.stringValue integerValue];
+
+        if ((dexPage < 1 || dexPage > _pageCount) && _pageRecord.length > 0) {
+            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
+            _errorLabel.hidden = NO;
+            return;
+        } else if(_pageRecord.length > 0){
+            _errorLabel.hidden = YES;
         }
-            break;
-        case KMAnnotationLinkType_URL:
-        {
-            if (self.urlRecord.length > 0) {
-                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
 
-                NSString *linkUrlPath = [self judgeWebURL:self.urlRecord];
-                
-                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
-                [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
-                self.goButton.hidden = NO;
-            } else {
-                self.goButton.hidden = YES;
-            }
+        CPDFDestination *destination = [[CPDFDestination alloc] initWithDocument:_pdfview.document pageIndex:(dexPage-1)];
+
+        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:destination];
+        [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
+    } else if (_linkType == KMAnnotationLinkType_URL) {
+        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
+//        NSString *linkUrlPath = [self judgeWebURL:_urlRecord];
+        NSString *linkUrlPath = _urlRecord;
+        if ([linkUrlPath isEqualToString:@""]) {
+            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:nil];
+        } else {
+            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
         }
-            break;
-        case KMAnnotationLinkType_Email:
-        {
-            if (self.emailRecord.length == 0) return;
-            if (![self isValidateEmail:self.emailRecord]) {
-                self.errorLabel.hidden = NO;
-                self.goButton.hidden = YES;
-                return;
-            }
-            self.errorLabel.hidden = YES;
-            self.goButton.hidden = NO;
-            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
-            NSString *linkUrlPath = [self judgeEmailURL:self.emailRecord];
+        [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
+
+    } else if (_linkType == KMAnnotationLinkType_Email) {
+        [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
+        NSString *linkUrlPath = [self judgeEmailURL:_emailRecord];
+        if ([linkUrlPath isEqualToString:@""]) {
+            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:nil];
+        } else {
             [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
-            [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
         }
-            break;
-        default:
-            break;
+        [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
     }
 }
 
+//- (void)controlTextDidEndEditing:(NSNotification *)obj {
+//    switch (_linkType) {
+//        case KMAnnotationLinkType_Page: {
+//            NSUInteger dexPage = [self.inputUrlTextField.stringValue integerValue];
+//            if ((dexPage <0 || dexPage > _pageCount) && _pageRecord.length > 0) {
+//                self.errorLabel.hidden = NO;
+//            } else {
+//                self.errorLabel.hidden = YES;
+//                NSInteger goPage = [self.inputUrlTextField.stringValue integerValue];
+//                CPDFDestination *destination = [[CPDFDestination alloc] initWithDocument:_pdfview.document pageIndex:(goPage-1)];
+//                
+//                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:destination];
+//                [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
+//            }
+//            self.goButton.hidden = YES;
+//        }
+//            break;
+//        case KMAnnotationLinkType_URL:
+//        {
+//            if (self.urlRecord.length > 0) {
+//                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
+//
+//                NSString *linkUrlPath = [self judgeWebURL:self.urlRecord];
+//                
+//                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
+//                [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
+//                self.goButton.hidden = NO;
+//            } else {
+//                self.goButton.hidden = YES;
+//            }
+//        }
+//            break;
+//        case KMAnnotationLinkType_Email:
+//        {
+//            if (self.emailRecord.length == 0) return;
+//            if (![self isValidateEmail:self.emailRecord]) {
+//                self.errorLabel.hidden = NO;
+//                self.goButton.hidden = YES;
+//                return;
+//            }
+//            self.errorLabel.hidden = YES;
+//            self.goButton.hidden = NO;
+//            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
+//            NSString *linkUrlPath = [self judgeEmailURL:self.emailRecord];
+//            [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
+//            [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
+//        }
+//            break;
+//        default:
+//            break;
+//    }
+//}
+
 @end

+ 2 - 2
PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -213,8 +213,8 @@ import Cocoa
             } else if selectedIndex == 4 {
                 thumai.methodType = .Search
             }
-            var show = true
-            self.leftSideViewController.refreshMethodType(newType: thumai, show:show)
+          
+            self.leftSideViewController.refreshMethodType(methodType: thumai.methodType)
         }
     }