|
@@ -484,109 +484,109 @@ typedef NS_ENUM(NSUInteger, KMAnnotationLinkType) {
|
|
|
|
|
|
#pragma mark - NSTextFieldDelegate Methods
|
|
#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];
|
|
[(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
|
|
@end
|