|
@@ -100,7 +100,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[(KMTableAnnotation*)self.activeAnnotation completeEditCellText];
|
|
|
[self setNeedsDisplayAnnotation:self.activeAnnotation];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
CPDFAreaOfInterest area = [self areaOfInterestForMouse:theEvent];
|
|
|
NSPoint newpoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
|
|
area = [self areaOfInterestForPoint:newpoint];
|
|
@@ -164,7 +164,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[self doDragTableAnnotationWithEvent:theEvent forAnnotation:newActiveAnnotation];
|
|
|
} else if ([self consistentTypeWithAnnotation:newActiveAnnotation]) {
|
|
|
[self doDragAnnotationWithEvent:theEvent forAnnotation:newActiveAnnotation];
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
} else if (self.isTakeSnapeSelectConetent) {
|
|
@@ -233,7 +233,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
}
|
|
|
} else if ((CNoteToolMode == self.toolMode && ![CPDFListView isMarkupAnnotationType:self.annotationType] && CAnnotationTypeUnkown != self.annotationType) ||
|
|
|
- CFormToolMode == self.toolMode) {
|
|
|
+ CFormToolMode == self.toolMode) {
|
|
|
if (CAnnotationTypeEraser == self.annotationType) {
|
|
|
[self doEraseAnnotationsWithEvent:theEvent];
|
|
|
} else if (CAnnotationTypeInk == self.annotationType) {
|
|
@@ -568,7 +568,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[self setNeedsDisplayAnnotationViewForPage:page];
|
|
|
}
|
|
|
} else if((clickNewActiveAnnotation &&
|
|
|
- (![self.activeAnnotations containsObject:clickNewActiveAnnotation] || [clickNewActiveAnnotation isKindOfClass:[CPDFRedactAnnotation class]]))) {
|
|
|
+ (![self.activeAnnotations containsObject:clickNewActiveAnnotation] || [clickNewActiveAnnotation isKindOfClass:[CPDFRedactAnnotation class]]))) {
|
|
|
self.hoverAnnotation = newActiveAnnotation;
|
|
|
[self setNeedsDisplayAnnotationViewForPage:page];
|
|
|
} else if (!clickNewActiveAnnotation && self.hoverAnnotation) {
|
|
@@ -666,7 +666,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
[self endMeasureModeAddAnnotation];
|
|
|
if (self.annotationType == CAnnotationTypeInk || self.annotationType == CAnnotationTypeEraser) {
|
|
|
return nil;
|
|
@@ -677,7 +677,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[menu removeAllItems];
|
|
|
NSMenuItem * deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Delete", @"PDFListView") action:@selector(delete:) keyEquivalent:@""];
|
|
|
[menu insertItem:deleteItem atIndex:0];
|
|
|
-
|
|
|
+
|
|
|
BOOL hasMarkup = false;
|
|
|
for (CPDFAnnotation *anno in self.activeAnnotations) {
|
|
|
if ([anno isKindOfClass:[CPDFMarkupAnnotation class]]) {
|
|
@@ -701,7 +701,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
|
|
|
return menu;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
NSMenu *menu = [super menuForEvent:event];
|
|
|
if(!menu)
|
|
|
menu = [[NSMenu alloc] init];
|
|
@@ -719,7 +719,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if(CRedactToolMode != self.toolMode && [annotationSel isKindOfClass:[CPDFRedactAnnotation class]]) {
|
|
|
return nil;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
NSMenuItem * copyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"PDFListView") action:@selector(copy:) keyEquivalent:@"c"];
|
|
|
|
|
|
NSMenuItem * pasteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Paste", @"PDFListView") action:@selector(menuItemClick_Paste:) keyEquivalent:@"v"];
|
|
@@ -747,7 +747,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[self toolMode] == CNoteToolMode ||
|
|
|
[self toolMode] == CFormToolMode ||
|
|
|
[self toolMode] == CRedactToolMode) &&
|
|
|
- [self hideNotes] == NO) {
|
|
|
+ [self hideNotes] == NO) {
|
|
|
|
|
|
for (CPDFAnnotation *tAnnotation in page.annotations) {
|
|
|
if ([tAnnotation hitTest:pagePoint]) {
|
|
@@ -902,7 +902,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
menu = [self tableMenu:menu withTable:(KMTableAnnotation*)self.activeAnnotation point:pagePoint];
|
|
|
return menu;
|
|
|
} else {
|
|
|
-
|
|
|
+
|
|
|
if (annotationSel && self.activeAnnotations.count > 0) {
|
|
|
NSDictionary *dictPresentObject = @{@"page":page,@"annotation":annotationSel};
|
|
|
bringForwardItem.representedObject = dictPresentObject;
|
|
@@ -1124,7 +1124,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
annotation.rotation = rotation;
|
|
|
[self setNeedsDisplay:true];
|
|
|
-
|
|
|
+
|
|
|
[[[self undoManager] prepareWithInvocationTarget:self] rotateRightForStampAnnotation:annotation];
|
|
|
}
|
|
|
|
|
@@ -1318,8 +1318,8 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
#pragma mark - Edit
|
|
|
- (NSMenuItem *)fontColorMenuItem {
|
|
|
NSMenuItem *fontColorItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Text Color", nil)
|
|
|
- action:@selector(menuItemEditingClick_FontColor:)
|
|
|
- keyEquivalent:@""];
|
|
|
+ action:@selector(menuItemEditingClick_FontColor:)
|
|
|
+ keyEquivalent:@""];
|
|
|
fontColorItem.target = self;
|
|
|
return fontColorItem;
|
|
|
}
|
|
@@ -1331,8 +1331,8 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
for (NSUInteger i=0; i<fontSizes.count; i++) {
|
|
|
CGFloat fontSize = [[[self fontSizes] objectAtIndex:i] floatValue];
|
|
|
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%d pt", (int)fontSize]
|
|
|
- action:@selector(menuItemEditingClick_FontSize:)
|
|
|
- keyEquivalent:@""];
|
|
|
+ action:@selector(menuItemEditingClick_FontSize:)
|
|
|
+ keyEquivalent:@""];
|
|
|
item.target = self;
|
|
|
item.tag = i;
|
|
|
[submenu addItem:item];
|
|
@@ -1360,8 +1360,8 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
|
|
|
- (void)menuItemEditingClick_FontColor:(NSMenuItem *)item {
|
|
|
#warning ---zhuyi
|
|
|
-// [self endEditIsRemoveBlock];
|
|
|
-
|
|
|
+ // [self endEditIsRemoveBlock];
|
|
|
+
|
|
|
NSColor *color = [self editingSelectionFontColorWithTextArea:self.editingAreas.firstObject];
|
|
|
[[NSColorPanel sharedColorPanel] orderFront:nil];
|
|
|
[[NSColorPanel sharedColorPanel] setTarget:self];
|
|
@@ -1372,7 +1372,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
|
|
|
- (void)fontColorChangeAction:(id)sender {
|
|
|
[self setEditingSelectionFontColor:[NSColorPanel sharedColorPanel].color withTextArea:self.editingAreas.firstObject];
|
|
|
-
|
|
|
+
|
|
|
if ([[self pdfListViewDelegate] respondsToSelector:@selector(PDFListViewDidTextColorChanged:withColor:)]){
|
|
|
[[self pdfListViewDelegate] PDFListViewDidTextColorChanged:self withColor:[NSColorPanel sharedColorPanel].color];
|
|
|
}
|
|
@@ -1424,14 +1424,14 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
// 创建拖拽图像
|
|
|
NSImage *dragImage = [NSImage bitmapPDFListViewImageWithSize:NSMakeSize(32.0, 32.0)
|
|
|
scale:[self backingScale]
|
|
|
- drawingHandler:^(NSRect rect) {
|
|
|
+ drawingHandler:^(NSRect rect) {
|
|
|
[[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kClippingTextType)]
|
|
|
- drawInRect:rect
|
|
|
- fromRect:NSZeroRect
|
|
|
- operation:NSCompositingOperationCopy
|
|
|
- fraction:0.9
|
|
|
- respectFlipped:YES
|
|
|
- hints:nil];
|
|
|
+ drawInRect:rect
|
|
|
+ fromRect:NSZeroRect
|
|
|
+ operation:NSCompositingOperationCopy
|
|
|
+ fraction:0.9
|
|
|
+ respectFlipped:YES
|
|
|
+ hints:nil];
|
|
|
}];
|
|
|
|
|
|
// 清空粘贴板内容并写入当前选中的富文本内容
|
|
@@ -1849,10 +1849,10 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[self.pdfListViewDelegate PDFListViewDidSelectionEnd:self];
|
|
|
}
|
|
|
|
|
|
-// if (!NSIsEmptyRect(self.selectionRect)) {
|
|
|
-// [NSMenu popUpContextMenu:[self menuForEvent:theEvent] withEvent:theEvent forView:self];
|
|
|
-// }
|
|
|
-//
|
|
|
+ // if (!NSIsEmptyRect(self.selectionRect)) {
|
|
|
+ // [NSMenu popUpContextMenu:[self menuForEvent:theEvent] withEvent:theEvent forView:self];
|
|
|
+ // }
|
|
|
+ //
|
|
|
if(CGPointEqualToPoint(curPoint, initialPoint) &&
|
|
|
!CGRectContainsPoint(self.selectionRect,curPoint) &&
|
|
|
!CGRectEqualToRect(self.selectionRect, CGRectZero)) {
|
|
@@ -2465,14 +2465,14 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[layer setLineJoin:kCALineJoinRound];
|
|
|
[layer setLineCap:kCALineCapRound];
|
|
|
|
|
|
- CPDFAnnotationModel *annotationModel = [[CPDFAnnotationModel alloc]initWithAnnotationType:CAnnotationTypeInk];
|
|
|
+ CPDFInkAnnotation *defaultAnnot = [[CPDFInkAnnotation alloc] initWithKMNoteBounds:CGRectZero];
|
|
|
CGFloat red,green,blue,alpha;
|
|
|
- [[annotationModel.color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
|
|
|
+ [[defaultAnnot.color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
|
|
|
|
|
|
- [layer setStrokeColor:[[NSColor colorWithRed:red green:green blue:blue alpha:annotationModel.opacity] CGColor]];
|
|
|
- [layer setLineWidth:annotationModel.lineWidth];
|
|
|
- if (annotationModel.style == CPDFBorderStyleDashed) {
|
|
|
- [layer setLineDashPattern:annotationModel.dashPattern];
|
|
|
+ [layer setStrokeColor:[[NSColor colorWithRed:red green:green blue:blue alpha:defaultAnnot.opacity] CGColor]];
|
|
|
+ [layer setLineWidth:defaultAnnot.lineWidth];
|
|
|
+ if (defaultAnnot.border.style == CPDFBorderStyleDashed) {
|
|
|
+ [layer setLineDashPattern:defaultAnnot.border.dashPattern];
|
|
|
[layer setLineCap:kCALineCapButt];
|
|
|
}
|
|
|
|
|
@@ -2549,7 +2549,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if (points.count>0) {
|
|
|
NSMutableArray *paths = [[NSMutableArray alloc] init];
|
|
|
[paths addObject:bezierPath];
|
|
|
- CPDFInkAnnotation *annotation = [[CPDFInkAnnotation alloc]initWithPDFListViewNoteWith:self.document];
|
|
|
+ CPDFInkAnnotation *annotation = [[CPDFInkAnnotation alloc] initWithPDFListViewNoteWith:self.document];
|
|
|
annotation.paths = @[points];
|
|
|
if(annotation) {
|
|
|
[self addAnnotation:annotation toPage:page];
|
|
@@ -2908,7 +2908,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMobileAnnotationBegan:forPDFListView:forActiveAnnotations:)]) {
|
|
|
[self.pdfListViewDelegate PDFListViewMobileAnnotationBegan:pagePoint forPDFListView:self forActiveAnnotations:self.activeAnnotations];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
while (YES) {
|
|
|
theEvent = [[self window] nextEventMatchingMask:eventMask];
|
|
|
if ([theEvent type] == NSEventTypeLeftMouseUp) {
|
|
@@ -2970,7 +2970,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if (page == self.clickLineAnnotation.page) {
|
|
|
[self.clickLineAnnotation setObservedEndPoint:pagePoint];
|
|
|
annotation = self.clickLineAnnotation;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
self.clickLineAnnotation = nil;
|
|
|
if(annotation) {
|
|
@@ -3124,7 +3124,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if (draggedAnnotation == false) { // 当前只处理拖拽场景
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewAnnotationsAttributeHasChangeNotification object:@{@"keyPath": CPDFAnnotationBoundsKey, @"object": annotation, @"didEnd" : @true}];
|
|
|
});
|
|
@@ -3132,7 +3132,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMobileAnnotationEnd:forPDFListView:forActiveAnnotations:)]) {
|
|
|
[self.pdfListViewDelegate PDFListViewMobileAnnotationEnd:pagePoint forPDFListView:self forActiveAnnotations:self.activeAnnotations];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
} else if ([theEvent type] == NSEventTypeLeftMouseDragged) {
|
|
|
if(self.clickLineAnnotation && self.isClickDoubleCreatLine) continue;
|
|
@@ -3452,7 +3452,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
CRectEdges resizeHandle = *resizeHandlePtr;
|
|
|
//上下图片的高度为16.0
|
|
|
CGFloat offset = 16.0;
|
|
|
-
|
|
|
+
|
|
|
if (!CGRectEqualToRect(table.drawRect, CGRectZero)) {
|
|
|
[table moveLineFromPoint:self.dragTablePoint toPoint:currentPagePoint];
|
|
|
[table afreshDrawLine];
|
|
@@ -3476,7 +3476,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[table setBounds:newBounds];
|
|
|
} else if ((resizeHandle & CMinXEdgeMask) && (resizeHandle & CMinYEdgeMask)){
|
|
|
NSInteger index = [table rowNumber] - 1;
|
|
|
-
|
|
|
+
|
|
|
if (table.bounds.origin.y - currentPagePoint.y > 20) {
|
|
|
NSRect rect1 = [[table.crossLines objectAtIndex:table.rowNumber-index] bounds];
|
|
|
NSRect rect2 = [[table.crossLines objectAtIndex:table.rowNumber-index-1] bounds];
|
|
@@ -3498,14 +3498,14 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[self.tableTextField setStringValue:string];
|
|
|
NSRect rect = [self convertRect:table.bounds fromPage:page];
|
|
|
self.tableTextField.frame = NSRectFromCGRect(CGRectMake(rect.origin.x,
|
|
|
- rect.origin.y,
|
|
|
+ rect.origin.y,
|
|
|
self.tableTextField.frame.size.width,
|
|
|
self.tableTextField.frame.size.height));
|
|
|
-
|
|
|
+
|
|
|
[self addSubview:self.tableTextField];
|
|
|
} else if ((resizeHandle & CMaxXEdgeMask) && (resizeHandle & CMaxYEdgeMask)) {
|
|
|
NSInteger index = [table columnNumber] - 1;
|
|
|
-
|
|
|
+
|
|
|
if (currentPagePoint.x-table.bounds.origin.x-table.bounds.size.width>20) {
|
|
|
NSRect rect1 = [[table.verticalLines objectAtIndex:index] bounds];
|
|
|
NSRect rect2 = [[table.verticalLines objectAtIndex:index+ 1] bounds];
|
|
@@ -3527,7 +3527,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[self.tableTextField setStringValue:string];
|
|
|
NSRect rect = [self convertRect:table.bounds fromPage:page];
|
|
|
self.tableTextField.frame = NSRectFromCGRect(CGRectMake(rect.origin.x+rect.size.width-30,
|
|
|
- rect.origin.y+rect.size.height+10,
|
|
|
+ rect.origin.y+rect.size.height+10,
|
|
|
self.tableTextField.frame.size.width,
|
|
|
self.tableTextField.frame.size.height));
|
|
|
[self addSubview:self.tableTextField];
|
|
@@ -3817,7 +3817,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// newBounds = [self adjustFreetText:activeAnnotation rect:newBounds];
|
|
|
+ // newBounds = [self adjustFreetText:activeAnnotation rect:newBounds];
|
|
|
} else {
|
|
|
CGFloat minWidth = MIN_NOTE_SIZE;
|
|
|
CGFloat minHeight = MIN_NOTE_SIZE;
|
|
@@ -3879,7 +3879,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
} else {
|
|
|
[activeAnnotation setBounds:NSIntegralRect(newBounds)];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([activeAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
|
|
|
[self updateAnnotationFreeTextBounds:(CPDFFreeTextAnnotation *)activeAnnotation];
|
|
|
}
|
|
@@ -4227,7 +4227,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
{
|
|
|
NSValue *value = [sender representedObject];
|
|
|
NSPoint point = value.pointValue;
|
|
|
-
|
|
|
+
|
|
|
if ([self.activeAnnotation isKindOfClass:[KMTableAnnotation class]]) {
|
|
|
KMTableAnnotation *table = (KMTableAnnotation*)self.activeAnnotation;
|
|
|
[[table getCellDataWithRow:table.currentCell.row andColumn:table.currentCell.column] setString:self.cellCopyData.string];
|
|
@@ -4271,7 +4271,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if (self.annotationType == CAnnotationTypeRadioButton ||
|
|
|
self.annotationType == CAnnotationTypeCheckBox) {
|
|
|
[self updateActiveAnnotations:@[]];
|
|
|
-
|
|
|
+
|
|
|
NSPoint pagePoint = NSZeroPoint;
|
|
|
CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
|
|
|
NSUInteger eventMask = NSLeftMouseUpMask;
|
|
@@ -4294,7 +4294,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
NSPoint pagePoint = NSZeroPoint;
|
|
|
CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
|
|
|
BOOL shouldAddAnnotation = self.activeAnnotation == nil;
|
|
|
-
|
|
|
+
|
|
|
// Hit-test for resize box.
|
|
|
CRectEdges resizeHandle = [self.activeAnnotation resizeHandleForPoint:pagePoint scaleFactor:[self scaleFactor]];
|
|
|
if (shouldAddAnnotation) {
|
|
@@ -4315,7 +4315,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if ([theEvent type] == NSLeftMouseUp) {
|
|
|
NSPoint point = NSZeroPoint;
|
|
|
[self pageAndPoint:&point forEvent:theEvent nearest:YES];
|
|
|
-
|
|
|
+
|
|
|
if (!draggedAnnotation) {
|
|
|
if (annotation) {
|
|
|
if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMobileAnnotationEnd:forPDFListView:forActiveAnnotations:)]) {
|
|
@@ -4351,11 +4351,11 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMobileAnnotationEnd:forPDFListView:forActiveAnnotations:)]) {
|
|
|
[self.pdfListViewDelegate PDFListViewMobileAnnotationEnd:point forPDFListView:self forActiveAnnotations:self.activeAnnotations];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
} else if ([theEvent type] == NSLeftMouseDragged){
|
|
|
if (self.activeAnnotation == nil) {
|
|
|
- annotation = [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:SKRectFromCenterAndSquareSize(originalBounds.origin, 0.0)];
|
|
|
+ annotation = [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:SKRectFromCenterAndSquareSize(originalBounds.origin, 0.0)];
|
|
|
}
|
|
|
lastMouseEvent = theEvent;
|
|
|
draggedAnnotation = YES;
|
|
@@ -4379,7 +4379,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
|
|
|
NSPoint newPoint = NSZeroPoint;
|
|
|
[self pageAndPoint:&newPoint forEvent:theEvent nearest:YES];
|
|
|
-
|
|
|
+
|
|
|
if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMobileAnnotationMove:forPDFListView:forActiveAnnotations:)]) {
|
|
|
[self.pdfListViewDelegate PDFListViewMobileAnnotationMove:newPoint forPDFListView:self forActiveAnnotations:self.activeAnnotations];
|
|
|
}
|
|
@@ -4440,7 +4440,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
NSPoint newPoint = NSZeroPoint;
|
|
|
[self pageAndPoint:&newPoint forEvent:theEvent nearest:YES];
|
|
|
-
|
|
|
+
|
|
|
if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMobileAnnotationEnd:forPDFListView:forActiveAnnotations:)]) {
|
|
|
[self.pdfListViewDelegate PDFListViewMobileAnnotationEnd:newPoint forPDFListView:self forActiveAnnotations:self.activeAnnotations];
|
|
|
}
|
|
@@ -4454,7 +4454,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
|
|
|
NSPoint newPoint = NSZeroPoint;
|
|
|
[self pageAndPoint:&newPoint forEvent:theEvent nearest:YES];
|
|
|
-
|
|
|
+
|
|
|
if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMobileAnnotationMove:forPDFListView:forActiveAnnotations:)]) {
|
|
|
[self.pdfListViewDelegate PDFListViewMobileAnnotationMove:newPoint forPDFListView:self forActiveAnnotations:self.activeAnnotations];
|
|
|
}
|
|
@@ -4499,7 +4499,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
newAnnotation = [[CPDFButtonWidgetAnnotation alloc] initWithPDFListViewNoteWith:self.document bounds:bounds controlType:CPDFWidgetRadioButtonControl];
|
|
|
}
|
|
|
break;
|
|
|
- case CAnnotationTypeCheckBox:
|
|
|
+ case CAnnotationTypeCheckBox:
|
|
|
{
|
|
|
newAnnotation = [[CPDFButtonWidgetAnnotation alloc] initWithPDFListViewNoteWith:self.document bounds:bounds controlType:CPDFWidgetCheckBoxControl];
|
|
|
}
|
|
@@ -4524,7 +4524,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
break;
|
|
|
case CAnnotationTypeTextField:{
|
|
|
CPDFTextWidgetAnnotation *textWidget = [[CPDFTextWidgetAnnotation alloc] initWithKMNoteBounds:bounds document:self.document];
|
|
|
-
|
|
|
+
|
|
|
newAnnotation = textWidget;
|
|
|
}
|
|
|
break;
|
|
@@ -4578,9 +4578,9 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
}
|
|
|
NSString *annotationField = [NSString stringWithFormat:@"%@_AddText", fieldString];
|
|
|
-// CPDFFreeTextAnnotation *freeText = [self addWidgetRelatedAnnotationFreeText:annotationField];
|
|
|
-// [freeText setFontColor:addFreeTextFontColor];
|
|
|
-// [freeText setFont:addFreeTextFont];
|
|
|
+ // CPDFFreeTextAnnotation *freeText = [self addWidgetRelatedAnnotationFreeText:annotationField];
|
|
|
+ // [freeText setFontColor:addFreeTextFontColor];
|
|
|
+ // [freeText setFont:addFreeTextFont];
|
|
|
}
|
|
|
return newAnnotation;
|
|
|
} else {
|
|
@@ -4714,7 +4714,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
|
|
|
startPoint = CPDFListViewIntegralPoint(CPDFListViewAddPoints(startPoint, offset));
|
|
|
endPoint = CPDFListViewIntegralPoint(CPDFListViewAddPoints(endPoint, offset));
|
|
|
-
|
|
|
+
|
|
|
CGRect boderRect = [self borderRecctForSavePoints:[line pointsFromMeasureWithStartPoint:startPoint endPoint:endPoint]];
|
|
|
BOOL isContant = CGRectContainsRect([activeAnnotation.page boundsForBox:[self displayBox]], boderRect);
|
|
|
if (isContant) {
|
|
@@ -4800,7 +4800,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
NSPoint startPoint = [line startPoint];
|
|
|
NSPoint endPoint = [line endPoint];
|
|
|
CPDFDistanceMeasureInfo *me = [line measureInfo];
|
|
|
-
|
|
|
+
|
|
|
startPoint = CPDFListViewIntegralPoint(CPDFListViewAddPoints(startPoint, offset));
|
|
|
endPoint = CPDFListViewIntegralPoint(CPDFListViewAddPoints(endPoint, offset));
|
|
|
|
|
@@ -4977,7 +4977,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
maxY = scale * newBounds.size.height;
|
|
|
|
|
|
rect = CGRectMake(minX, minY, maxX - minX, maxY - minY);
|
|
|
-
|
|
|
+
|
|
|
dragAnnotation.bounds = CGRectMake(rect.origin.x + newBounds.origin.x, rect.origin.y + newBounds.origin.y, rect.size.width, rect.size.height);
|
|
|
if ([dragAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]])
|
|
|
[self updateAnnotationFreeTextBounds:(CPDFFreeTextAnnotation *)dragAnnotation];
|
|
@@ -5047,8 +5047,8 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
NSPoint point = NSZeroPoint;
|
|
|
CPDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
|
|
|
|
|
|
-// [[NSNotificationCenter defaultCenter] postNotificationName:KMPDFViewTableAnnotationDidChangeNotification object:self userInfo:@{@"point":[NSValue valueWithPoint:point]}];
|
|
|
-
|
|
|
+ // [[NSNotificationCenter defaultCenter] postNotificationName:KMPDFViewTableAnnotationDidChangeNotification object:self userInfo:@{@"point":[NSValue valueWithPoint:point]}];
|
|
|
+
|
|
|
[annotattion drawLine:point];
|
|
|
|
|
|
CGRect rect = [annotattion isInCellWithPoint:point];
|
|
@@ -5058,7 +5058,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[annotattion writeFormDataToContents];
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
NSRect originalBounds = [annotattion bounds];
|
|
|
|
|
|
CRectEdges resizeHandle = [annotattion resizeHandleForPoint:point scaleFactor:[self scaleFactor]];
|
|
@@ -5088,7 +5088,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if (draggedAnnotation) {
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ((resizeHandle & CMinXEdgeMask) && (resizeHandle & CMinYEdgeMask)){
|
|
|
NSInteger index = [annotattion rowNumber] - 1;
|
|
|
|
|
@@ -5103,7 +5103,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
} else if ((resizeHandle & CMaxXEdgeMask) && (resizeHandle & CMaxYEdgeMask)) {
|
|
|
NSRect pageBounds = [page boundsForBox:[self displayBox]];
|
|
|
-
|
|
|
+
|
|
|
NSInteger index = [annotattion columnNumber] - 1;
|
|
|
|
|
|
NSRect rect1 = [[annotattion.verticalLines objectAtIndex:index] bounds];
|
|
@@ -5135,7 +5135,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if (draggedAnnotation)
|
|
|
[annotattion autoUpdateString];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// ??? PDFView's delayed layout seems to reset the cursor to an arrow
|
|
|
[self performSelector:@selector(setCursorForMouse:) withObject:theEvent afterDelay:0];
|
|
|
}
|
|
@@ -5180,7 +5180,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
NSPoint translatedOriginalStartPoint = NSZeroPoint;
|
|
|
NSPoint translatedOriginalEndPoint = NSZeroPoint;
|
|
|
NSArray<NSValue *> *savePoints = [NSArray array];
|
|
|
-
|
|
|
+
|
|
|
CRectEdges resizeHandle = [newActiveAnnotation resizeHandleForPoint:pagePoint scaleFactor:[self scaleFactor]];
|
|
|
NSUInteger polylineIndex = [CPDFListViewConfig defaultManager].polylineSelectIndex;
|
|
|
NSUInteger polygonIndex = [CPDFListViewConfig defaultManager].polygonSelectIndex;
|
|
@@ -5244,7 +5244,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if ([theEvent type] == NSEventTypeLeftMouseUp) {
|
|
|
NSPoint point = NSZeroPoint;
|
|
|
[self pageAndPoint:&point forEvent:theEvent nearest:YES];
|
|
|
-
|
|
|
+
|
|
|
if(draggedAnnotation) {
|
|
|
[self removeShapeLayer];
|
|
|
if (!isContains)
|
|
@@ -5290,9 +5290,9 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[newActiveAnnotation isKindOfClass:[CPDFPolygonAnnotation class]]){
|
|
|
|
|
|
} else if ([theEvent clickCount] == 2) {
|
|
|
-// if (![newActiveAnnotation isKindOfClass:[CPDFTextAnnotation class]]) {
|
|
|
- [self editAnnotation:newActiveAnnotation];
|
|
|
-// }
|
|
|
+ // if (![newActiveAnnotation isKindOfClass:[CPDFTextAnnotation class]]) {
|
|
|
+ [self editAnnotation:newActiveAnnotation];
|
|
|
+ // }
|
|
|
}
|
|
|
}
|
|
|
[self setNeedsDisplayAnnotationViewForPage:page];
|
|
@@ -5318,7 +5318,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
NSPoint currentPoint = NSZeroPoint;
|
|
|
[self pageAndPoint:¤tPoint forEvent:theEvent nearest:YES];
|
|
|
CGPoint offsetPoint = CGPointMake(currentPoint.x - pagePoint.x, currentPoint.y - pagePoint.y);
|
|
|
-
|
|
|
+
|
|
|
if(!isContains) {
|
|
|
|
|
|
CGRect borderRect = [newActiveAnnotation borderRecctForView:self];
|
|
@@ -5358,7 +5358,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
} else if (isPolyline || isPolygon || isSquarePolygon) {
|
|
|
[self doMoveAnnotation:newActiveAnnotation withEvent:theEvent boundOffset:offset offset:offsetPoint];
|
|
|
-
|
|
|
+
|
|
|
if (isMeasure) {
|
|
|
|
|
|
if (self.pdfListViewDelegate && [self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewAnnotationMeasureInfoChange:withAnnotation:)]) {
|
|
@@ -5369,7 +5369,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[self doMoveAnnotation:newActiveAnnotation withEvent:theEvent boundOffset:offset offset:offsetPoint];
|
|
|
}
|
|
|
pagePoint = currentPoint;
|
|
|
-
|
|
|
+
|
|
|
} else if (isLine) {
|
|
|
if (isMeasure) {
|
|
|
[self doResizeMeasureLineAnnotationWithEvent:lastMouseEvent fromPoint:pagePoint originalStartPoint:originalStartPoint originalEndPoint:originalEndPoint translatedOriginalStartPoint:translatedOriginalStartPoint translatedOriginalEndPoint:translatedOriginalEndPoint resizeHandle:resizeHandle];
|
|
@@ -5665,9 +5665,9 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
if ([(CPDFListStampAnnotation*)an stamp] != nil) {
|
|
|
[(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithStamp:[(CPDFListStampAnnotation*)an stamp]];
|
|
|
}
|
|
|
-// if ([(CPDFListStampAnnotation *)an stamp].stampCategoryType == 7) {
|
|
|
- [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithImage:[(CPDFListStampAnnotation*)an pImage]];
|
|
|
-// }
|
|
|
+ // if ([(CPDFListStampAnnotation *)an stamp].stampCategoryType == 7) {
|
|
|
+ [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithImage:[(CPDFListStampAnnotation*)an pImage]];
|
|
|
+ // }
|
|
|
} else if ([(CPDFListStampAnnotation*)an stamp]) {
|
|
|
CStampSignatureObject *stamp = [(CPDFListStampAnnotation*)an stamp];
|
|
|
if (CPDFStampTypeStandard == stamp.stampCategoryType) {
|
|
@@ -5687,7 +5687,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
} else if (((CPDFStampAnnotation*)an).stampImage) {
|
|
|
newAnnotation = [[CPDFListStampAnnotation alloc] initWithDocument:self.document image:((CPDFStampAnnotation*)an).stampImage];
|
|
|
newAnnotation.bounds = CGRectMake(an.bounds.origin.x + 10, an.bounds.origin.y - 10, an.bounds.size.width, an.bounds.size.height);
|
|
|
-// [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithStamp:((CPDFStampAnnotation*)an).stampImage];
|
|
|
+ // [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithStamp:((CPDFStampAnnotation*)an).stampImage];
|
|
|
}
|
|
|
|
|
|
[self addAnnotation:newAnnotation toPage:page];
|
|
@@ -6239,30 +6239,30 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
|
|
|
-(BOOL)km_insertPdf: (CPDFDocument *)pdf withImage:(NSImage *)image pageSize:(NSSize)pageSize atIndex:(NSUInteger)index {
|
|
|
-// NSData *jpgData = [image jpgData];
|
|
|
-// NSString *appID = [[NSBundle mainBundle] bundleIdentifier];
|
|
|
-// NSString *directory = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject] ?: @"";
|
|
|
-// NSString *folderPath = [[directory stringByAppendingPathComponent:appID ?: @"PDF Reader Pro bundleIdentifier"] stringByAppendingPathComponent:@"KMTemp"];
|
|
|
-// if (![[NSFileManager defaultManager] fileExistsAtPath:folderPath]) {
|
|
|
-// [[NSFileManager defaultManager] createDirectoryAtPath:folderPath withIntermediateDirectories:YES attributes:nil error:nil];
|
|
|
-// }
|
|
|
-// NSString *filePath = [folderPath stringByAppendingPathComponent:@"temp_saveDocumentForCPDFDocumentInsertImage.jpg"];
|
|
|
+ // NSData *jpgData = [image jpgData];
|
|
|
+ // NSString *appID = [[NSBundle mainBundle] bundleIdentifier];
|
|
|
+ // NSString *directory = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject] ?: @"";
|
|
|
+ // NSString *folderPath = [[directory stringByAppendingPathComponent:appID ?: @"PDF Reader Pro bundleIdentifier"] stringByAppendingPathComponent:@"KMTemp"];
|
|
|
+ // if (![[NSFileManager defaultManager] fileExistsAtPath:folderPath]) {
|
|
|
+ // [[NSFileManager defaultManager] createDirectoryAtPath:folderPath withIntermediateDirectories:YES attributes:nil error:nil];
|
|
|
+ // }
|
|
|
+ // NSString *filePath = [folderPath stringByAppendingPathComponent:@"temp_saveDocumentForCPDFDocumentInsertImage.jpg"];
|
|
|
BOOL result = NO;
|
|
|
-// NSSize _pageSize = pageSize;
|
|
|
-// if (NSEqualSizes(_pageSize, NSZeroSize)) {
|
|
|
-// _pageSize = image.size;
|
|
|
-// }
|
|
|
-// @try { // Save image data to temporary path
|
|
|
-// [jpgData writeToFile:filePath atomically:YES];
|
|
|
-// // Convert and insert after
|
|
|
-// result = [pdf insertPage:_pageSize withImage:filePath atIndex:index];
|
|
|
-// } @catch (NSException *exception) {
|
|
|
-// // nothing
|
|
|
-// }
|
|
|
-// // Clear temporary data
|
|
|
-// if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
|
|
|
-// [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
|
|
|
-// }
|
|
|
+ // NSSize _pageSize = pageSize;
|
|
|
+ // if (NSEqualSizes(_pageSize, NSZeroSize)) {
|
|
|
+ // _pageSize = image.size;
|
|
|
+ // }
|
|
|
+ // @try { // Save image data to temporary path
|
|
|
+ // [jpgData writeToFile:filePath atomically:YES];
|
|
|
+ // // Convert and insert after
|
|
|
+ // result = [pdf insertPage:_pageSize withImage:filePath atIndex:index];
|
|
|
+ // } @catch (NSException *exception) {
|
|
|
+ // // nothing
|
|
|
+ // }
|
|
|
+ // // Clear temporary data
|
|
|
+ // if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
|
|
|
+ // [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
|
|
|
+ // }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -6275,7 +6275,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[[NSFontManager sharedFontManager] orderFrontFontPanel:sender];
|
|
|
[[NSFontManager sharedFontManager] setTarget:self];
|
|
|
[[NSFontManager sharedFontManager] setAction:@selector(changeFontPanel:)];
|
|
|
-// [[NSFontManager sharedFontManager] orderFrontFontPanel:self];
|
|
|
+ // [[NSFontManager sharedFontManager] orderFrontFontPanel:self];
|
|
|
}
|
|
|
|
|
|
- (void)changeFontPanel:(id)sender {
|
|
@@ -6402,7 +6402,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
|
|
|
- (IBAction)menuItemClick_FitWidth:(id)sender {
|
|
|
-// self.autoScales = YES;
|
|
|
+ // self.autoScales = YES;
|
|
|
[self setAutoScales:[self autoScales] == NO];
|
|
|
// self.autoScales = NO;
|
|
|
}
|