|
@@ -392,7 +392,14 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
menu = [[NSMenu alloc] init];
|
|
|
|
|
|
NSPoint pagePoint = NSZeroPoint;
|
|
|
+ CPDFAnnotation *annotationSel = nil;
|
|
|
CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:event nearest:YES];
|
|
|
+ if (page) {
|
|
|
+ annotationSel = [page annotationAtPoint:pagePoint];
|
|
|
+ if (annotationSel.type) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
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"];
|
|
@@ -405,10 +412,6 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
NSMenuItem * arrangementItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Arrangement", @"PDFListView") action:nil keyEquivalent:@""];
|
|
|
subMenu = [[NSMenu alloc] init];
|
|
|
|
|
|
- NSMenuItem * bringForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring Forward", @"PDFListView") action:@selector(menuItemClick_BringForward:) keyEquivalent:@""];
|
|
|
- NSMenuItem * sendBackForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send Backward", @"PDFListView") action:@selector(menuItemClick_SendBackward:) keyEquivalent:@""];
|
|
|
- NSMenuItem * bringFrontItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring to Front", @"PDFListView") action:@selector(menuItemClick_BringFront:) keyEquivalent:@""];
|
|
|
- NSMenuItem * sendBackItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send to Back", @"PDFListView") action:@selector(menuItemClick_SendBack:) keyEquivalent:@""];
|
|
|
// [subMenu addItem:bringForwardItem];
|
|
|
// [subMenu addItem:sendBackForwardItem];
|
|
|
// [subMenu addItem:bringFrontItem];
|
|
@@ -537,12 +540,24 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
[menu insertItem:zoomOutItem atIndex:0];
|
|
|
[menu insertItem:zoomInItem atIndex:0];
|
|
|
[menu insertItem:fitWidthItem atIndex:0];
|
|
|
-
|
|
|
- if (self.currentSelection.selectionType == CPDFSelectionTypeImage) {
|
|
|
+
|
|
|
+ NSMenuItem * sendBackItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send to Back", @"PDFListView") action:@selector(menuItemClick_SendBack:) keyEquivalent:@""];
|
|
|
+ NSMenuItem * sendBackForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send Backward", @"PDFListView") action:@selector(menuItemClick_SendBackward:) keyEquivalent:@""];
|
|
|
+
|
|
|
+ NSMenuItem * bringFrontItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring to Front", @"PDFListView") action:@selector(menuItemClick_BringFront:) keyEquivalent:@""];
|
|
|
+ NSMenuItem * bringForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring Forward", @"PDFListView") action:@selector(menuItemClick_BringForward:) keyEquivalent:@""];
|
|
|
+
|
|
|
+ if (annotationSel) {
|
|
|
+ NSDictionary *dictPresentObject = @{@"page":page,@"annotation":annotationSel};
|
|
|
+ bringForwardItem.representedObject = dictPresentObject;
|
|
|
+ bringFrontItem.representedObject = dictPresentObject;
|
|
|
+ sendBackForwardItem.representedObject = dictPresentObject;
|
|
|
+ sendBackItem.representedObject = dictPresentObject;
|
|
|
+
|
|
|
[menu insertItem:[NSMenuItem separatorItem] atIndex:0];
|
|
|
[menu insertItem:bringForwardItem atIndex:0];
|
|
|
- [menu insertItem:sendBackForwardItem atIndex:0];
|
|
|
[menu insertItem:bringFrontItem atIndex:0];
|
|
|
+ [menu insertItem:sendBackForwardItem atIndex:0];
|
|
|
[menu insertItem:sendBackItem atIndex:0];
|
|
|
}
|
|
|
|
|
@@ -3737,32 +3752,49 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-- (IBAction)menuItemClick_BringForward:(id)sender {
|
|
|
- for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
- CPDFPage *page = annotation.page;
|
|
|
- [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] + 1];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (IBAction)menuItemClick_SendBackward:(id)sender {
|
|
|
- for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
- CPDFPage *page = annotation.page;
|
|
|
- [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] - 1];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (IBAction)menuItemClick_BringFront:(id)sender {
|
|
|
- for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
- CPDFPage *page = annotation.page;
|
|
|
- [self moveAnnotationOnPage:page annotation:annotation newIndex:page.annotations.count -1];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (IBAction)menuItemClick_SendBack:(id)sender {
|
|
|
- for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
- CPDFPage *page = annotation.page;
|
|
|
- [self moveAnnotationOnPage:page annotation:annotation newIndex:0];
|
|
|
- }
|
|
|
+- (IBAction)menuItemClick_BringForward:(NSMenuItem *)sender {
|
|
|
+
|
|
|
+// for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
+// CPDFPage *page = annotation.page;
|
|
|
+// [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] + 1];
|
|
|
+// }
|
|
|
+ NSDictionary *dict = sender.representedObject;
|
|
|
+ CPDFPage *page = dict[@"page"];
|
|
|
+ CPDFAnnotation *annotation = dict[@"annotation"];
|
|
|
+ [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] + 1];
|
|
|
+}
|
|
|
+
|
|
|
+- (IBAction)menuItemClick_SendBackward:(NSMenuItem *)sender {
|
|
|
+// for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
+// CPDFPage *page = annotation.page;
|
|
|
+// [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] - 1];
|
|
|
+// }
|
|
|
+ NSDictionary *dict = sender.representedObject;
|
|
|
+ CPDFPage *page = dict[@"page"];
|
|
|
+ CPDFAnnotation *annotation = dict[@"annotation"];
|
|
|
+ [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] - 1];
|
|
|
+}
|
|
|
+
|
|
|
+- (IBAction)menuItemClick_BringFront:(NSMenuItem *)sender {
|
|
|
+// for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
+// CPDFPage *page = annotation.page;
|
|
|
+// [self moveAnnotationOnPage:page annotation:annotation newIndex:page.annotations.count -1];
|
|
|
+// }
|
|
|
+ NSDictionary *dict = sender.representedObject;
|
|
|
+ CPDFPage *page = dict[@"page"];
|
|
|
+ CPDFAnnotation *annotation = dict[@"annotation"];
|
|
|
+ [self moveAnnotationOnPage:page annotation:annotation newIndex:page.annotations.count -1];
|
|
|
+}
|
|
|
+
|
|
|
+- (IBAction)menuItemClick_SendBack:(NSMenuItem *)sender {
|
|
|
+// for (CPDFAnnotation *annotation in self.activeAnnotations) {
|
|
|
+// CPDFPage *page = annotation.page;
|
|
|
+// [self moveAnnotationOnPage:page annotation:annotation newIndex:0];
|
|
|
+// }
|
|
|
+ NSDictionary *dict = sender.representedObject;
|
|
|
+ CPDFPage *page = dict[@"page"];
|
|
|
+ CPDFAnnotation *annotation = dict[@"annotation"];
|
|
|
+ [self moveAnnotationOnPage:page annotation:annotation newIndex:0];
|
|
|
}
|
|
|
|
|
|
- (IBAction)menuItemClick_EditNote:(id)sender {
|