|
@@ -642,7 +642,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
return menu;
|
|
return menu;
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- if (annotationSel) {
|
|
|
|
|
|
+ if (annotationSel && self.activeAnnotations.count > 0) {
|
|
NSDictionary *dictPresentObject = @{@"page":page,@"annotation":annotationSel};
|
|
NSDictionary *dictPresentObject = @{@"page":page,@"annotation":annotationSel};
|
|
bringForwardItem.representedObject = dictPresentObject;
|
|
bringForwardItem.representedObject = dictPresentObject;
|
|
bringFrontItem.representedObject = dictPresentObject;
|
|
bringFrontItem.representedObject = dictPresentObject;
|
|
@@ -689,6 +689,36 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]] ||
|
|
if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]] ||
|
|
[self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
|
|
[self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
|
|
[menu insertItem:editNoteItem atIndex:0];
|
|
[menu insertItem:editNoteItem atIndex:0];
|
|
|
|
+ __block typeof(self) blockSelf = self;
|
|
|
|
+ if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
|
|
|
|
+// [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
|
|
|
|
+ NSArray *colors = @[[NSColor colorWithRed:255.0/255.0 green:254.0/255.0 blue:84.0/255.0 alpha:1.0],
|
|
|
|
+ [NSColor colorWithRed:234.0/255.0 green:51.0/255.0 blue:35.0/255.0 alpha:1.0],
|
|
|
|
+ [NSColor colorWithRed:239.0/255.0 green:134.0/255.0 blue:51.0/255.0 alpha:1.0],
|
|
|
|
+ [NSColor colorWithRed:117.0/255.0 green:250.0/255.0 blue:76.0/255.0 alpha:1.0]];
|
|
|
|
+ if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewEventMarkupColorWithAnnotation:)]) {
|
|
|
|
+ colors = [self.pdfListViewDelegate PDFListViewEventMarkupColorWithAnnotation:self.activeAnnotation];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CPDFListViewColorMenuItemView *itemView = [[CPDFListViewColorMenuItemView alloc] initWithTitle:nil
|
|
|
|
+ colorArray:colors
|
|
|
|
+ needsColorWheel:NO
|
|
|
|
+ completeHandler:^(NSColor *color) {
|
|
|
|
+ CGFloat red,green,blue,alpha;
|
|
|
|
+ if (color) {
|
|
|
|
+ [[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
|
|
|
|
+ }
|
|
|
|
+ CPDFAnnotationModel *annotationModel = [[CPDFAnnotationModel alloc]initWithPDFAnnotations:blockSelf.activeAnnotations];;
|
|
|
|
+ annotationModel.color = color;
|
|
|
|
+ annotationModel.opacity = alpha;
|
|
|
|
+ [blockSelf setNeedsDisplayAnnotation:blockSelf.activeAnnotation];
|
|
|
|
+ [menu cancelTracking];
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ NSMenuItem * colorItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Highlight", @"Menu item title") action:nil keyEquivalent:@""];
|
|
|
|
+ colorItem.view = itemView;
|
|
|
|
+ [menu insertItem:colorItem atIndex:0];
|
|
|
|
+ }
|
|
} else if ([self.activeAnnotation isKindOfClass:[CPDFStampAnnotation class]]) {
|
|
} else if ([self.activeAnnotation isKindOfClass:[CPDFStampAnnotation class]]) {
|
|
[menu insertItem:editNoteItem atIndex:0];
|
|
[menu insertItem:editNoteItem atIndex:0];
|
|
if ([self.activeAnnotation isKindOfClass:[CPDFListStampAnnotation class]]) {
|
|
if ([self.activeAnnotation isKindOfClass:[CPDFListStampAnnotation class]]) {
|
|
@@ -758,45 +788,19 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
}
|
|
}
|
|
[menu insertItem:cutItem atIndex:0];
|
|
[menu insertItem:cutItem atIndex:0];
|
|
}
|
|
}
|
|
|
|
+ if ([self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
|
|
|
|
+ [menu insertItem:pasteItem atIndex:0];
|
|
|
|
+ }
|
|
[menu insertItem:copyItem atIndex:0];
|
|
[menu insertItem:copyItem atIndex:0];
|
|
- __block typeof(self) blockSelf = self;
|
|
|
|
|
|
|
|
- if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
|
|
|
|
- [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
|
|
|
|
- NSArray *colors = @[[NSColor colorWithRed:255.0/255.0 green:254.0/255.0 blue:84.0/255.0 alpha:1.0],
|
|
|
|
- [NSColor colorWithRed:234.0/255.0 green:51.0/255.0 blue:35.0/255.0 alpha:1.0],
|
|
|
|
- [NSColor colorWithRed:239.0/255.0 green:134.0/255.0 blue:51.0/255.0 alpha:1.0],
|
|
|
|
- [NSColor colorWithRed:117.0/255.0 green:250.0/255.0 blue:76.0/255.0 alpha:1.0]];
|
|
|
|
- if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewEventMarkupColorWithAnnotation:)]) {
|
|
|
|
- colors = [self.pdfListViewDelegate PDFListViewEventMarkupColorWithAnnotation:self.activeAnnotation];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- CPDFListViewColorMenuItemView *itemView = [[CPDFListViewColorMenuItemView alloc] initWithTitle:nil
|
|
|
|
- colorArray:colors
|
|
|
|
- needsColorWheel:NO
|
|
|
|
- completeHandler:^(NSColor *color) {
|
|
|
|
- CGFloat red,green,blue,alpha;
|
|
|
|
- if (color) {
|
|
|
|
- [[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
|
|
|
|
- }
|
|
|
|
- CPDFAnnotationModel *annotationModel = [[CPDFAnnotationModel alloc]initWithPDFAnnotations:blockSelf.activeAnnotations];;
|
|
|
|
- annotationModel.color = color;
|
|
|
|
- annotationModel.opacity = alpha;
|
|
|
|
- [blockSelf setNeedsDisplayAnnotation:blockSelf.activeAnnotation];
|
|
|
|
- [menu cancelTracking];
|
|
|
|
- }];
|
|
|
|
-
|
|
|
|
- NSMenuItem * colorItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Highlight", @"Menu item title") action:nil keyEquivalent:@""];
|
|
|
|
- colorItem.view = itemView;
|
|
|
|
- [menu insertItem:colorItem atIndex:0];
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (self.currentSelection) {
|
|
if (self.currentSelection) {
|
|
if(CPDFSelectionTypeImage == [self.currentSelection selectionType]) {
|
|
if(CPDFSelectionTypeImage == [self.currentSelection selectionType]) {
|
|
-
|
|
|
|
- NSMenuItem * exportImageItem = [self creatExportItem];
|
|
|
|
- [menu insertItem:exportImageItem atIndex:0];
|
|
|
|
|
|
+ if (self.activeAnnotations.count < 1) {
|
|
|
|
+ NSMenuItem * exportImageItem = [self creatExportItem];
|
|
|
|
+ [menu insertItem:exportImageItem atIndex:0];
|
|
|
|
+ }
|
|
// [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
|
|
// [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
|
|
}
|
|
}
|
|
if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
|
|
if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
|