summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2013-11-22 13:12:14 +0000
committerPaul Gardiner <paul.gardiner@artifex.com>2013-11-22 13:12:14 +0000
commit6fc675335c3403887d641cc2e7ecb35a8464dd65 (patch)
treedccb684820e210d5a11b7d3803431b62839ca6b2
parent26a6b6464c868552487acd91b3738fdee78757d3 (diff)
downloadmupdf-6fc675335c3403887d641cc2e7ecb35a8464dd65.tar.xz
iOS: support annotation deletion
-rw-r--r--platform/ios/Classes/MuAnnotSelectView.h19
-rw-r--r--platform/ios/Classes/MuAnnotSelectView.m42
-rw-r--r--platform/ios/Classes/MuAnnotation.h22
-rw-r--r--platform/ios/Classes/MuAnnotation.m35
-rw-r--r--platform/ios/Classes/MuDocumentController.h4
-rw-r--r--platform/ios/Classes/MuDocumentController.m54
-rw-r--r--platform/ios/Classes/MuPageView.h2
-rw-r--r--platform/ios/Classes/MuPageViewNormal.h4
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m115
-rw-r--r--platform/ios/Classes/MuPageViewReflow.m2
-rw-r--r--platform/ios/Classes/MuTapResult.h13
-rw-r--r--platform/ios/Classes/MuTapResult.m41
-rw-r--r--platform/ios/MuPDF.xcodeproj/project.pbxproj16
13 files changed, 359 insertions, 10 deletions
diff --git a/platform/ios/Classes/MuAnnotSelectView.h b/platform/ios/Classes/MuAnnotSelectView.h
new file mode 100644
index 00000000..3e97cf7f
--- /dev/null
+++ b/platform/ios/Classes/MuAnnotSelectView.h
@@ -0,0 +1,19 @@
+//
+// MuAnnotSelectView.h
+// MuPDF
+//
+// Created by Paul Gardiner on 21/11/2013.
+// Copyright (c) 2013 Artifex Software, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "MuAnnotation.h"
+
+@interface MuAnnotSelectView : UIView
+{
+ MuAnnotation *annot;
+ CGSize pageSize;
+ UIColor *color;
+}
+- (id) initWithAnnot:(MuAnnotation *)_annot pageSize:(CGSize)_pageSize;
+@end
diff --git a/platform/ios/Classes/MuAnnotSelectView.m b/platform/ios/Classes/MuAnnotSelectView.m
new file mode 100644
index 00000000..88087fdd
--- /dev/null
+++ b/platform/ios/Classes/MuAnnotSelectView.m
@@ -0,0 +1,42 @@
+//
+// MuAnnotSelectView.m
+// MuPDF
+//
+// Created by Paul Gardiner on 21/11/2013.
+// Copyright (c) 2013 Artifex Software, Inc. All rights reserved.
+//
+
+#import "MuAnnotSelectView.h"
+
+@implementation MuAnnotSelectView
+
+- (id)initWithAnnot:(MuAnnotation *)_annot pageSize:(CGSize)_pageSize
+{
+ self = [super initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
+ if (self)
+ {
+ [self setOpaque:NO];
+ annot = [_annot retain];
+ pageSize = _pageSize;
+ color = [[UIColor colorWithRed:0x44/255.0 green:0x44/255.0 blue:1.0 alpha:1.0] retain];
+ }
+ return self;
+}
+
+-(void) dealloc
+{
+ [annot release];
+ [color release];
+ [super dealloc];
+}
+
+- (void)drawRect:(CGRect)rect
+{
+ CGSize scale = fitPageToScreen(pageSize, self.bounds.size);
+ CGContextRef cref = UIGraphicsGetCurrentContext();
+ CGContextScaleCTM(cref, scale.width, scale.height);
+ [color set];
+ CGContextStrokeRect(cref, annot.rect);
+}
+
+@end
diff --git a/platform/ios/Classes/MuAnnotation.h b/platform/ios/Classes/MuAnnotation.h
new file mode 100644
index 00000000..0f37b9a5
--- /dev/null
+++ b/platform/ios/Classes/MuAnnotation.h
@@ -0,0 +1,22 @@
+//
+// MuAnnotation.h
+// MuPDF
+//
+// Created by Paul Gardiner on 20/11/2013.
+// Copyright (c) 2013 Artifex Software, Inc. All rights reserved.
+//
+
+#include "common.h"
+#include "mupdf/pdf.h"
+#import <Foundation/Foundation.h>
+
+@interface MuAnnotation : NSObject
+{
+ int type;
+ CGRect rect;
+}
+-(id) initFromAnnot:(fz_annot *)annot forDoc:(fz_document *)doc;
+@property(readonly) int type;
+@property(readonly) CGRect rect;
++(MuAnnotation *) annotFromAnnot:(fz_annot *)annot forDoc:(fz_document *)doc;
+@end
diff --git a/platform/ios/Classes/MuAnnotation.m b/platform/ios/Classes/MuAnnotation.m
new file mode 100644
index 00000000..92f7bb45
--- /dev/null
+++ b/platform/ios/Classes/MuAnnotation.m
@@ -0,0 +1,35 @@
+//
+// MuAnnotation.m
+// MuPDF
+//
+// Created by Paul Gardiner on 20/11/2013.
+// Copyright (c) 2013 Artifex Software, Inc. All rights reserved.
+//
+
+#import "MuAnnotation.h"
+
+@implementation MuAnnotation
+
+@synthesize type, rect;
+
+-(id) initFromAnnot:(fz_annot *)annot forDoc:(fz_document *)doc
+{
+ self = [super init];
+ if (self)
+ {
+ fz_rect frect;
+ type = pdf_annot_type((pdf_annot *)annot);
+ fz_bound_annot(doc, annot, &frect);
+ rect.origin.x = frect.x0;
+ rect.origin.y = frect.y0;
+ rect.size.width = frect.x1 - frect.x0;
+ rect.size.height = frect.y1 - frect.y0;
+ }
+ return self;
+}
+
++(MuAnnotation *) annotFromAnnot:(fz_annot *)annot forDoc:(fz_document *)doc
+{
+ return [[[MuAnnotation alloc] initFromAnnot:annot forDoc:doc] autorelease];
+}
+@end
diff --git a/platform/ios/Classes/MuDocumentController.h b/platform/ios/Classes/MuDocumentController.h
index 32bd36f4..719fcd5e 100644
--- a/platform/ios/Classes/MuDocumentController.h
+++ b/platform/ios/Classes/MuDocumentController.h
@@ -25,7 +25,8 @@ enum
BARMODE_HIGHLIGHT,
BARMODE_UNDERLINE,
BARMODE_STRIKE,
- BARMODE_INK
+ BARMODE_INK,
+ BARMODE_DELETE
};
@interface MuDocumentController : UIViewController <UIScrollViewDelegate, UIGestureRecognizerDelegate, UISearchBarDelegate, MuDialogCreator>
@@ -44,6 +45,7 @@ enum
UIBarButtonItem *highlightButton, *underlineButton, *strikeoutButton;
UIBarButtonItem *inkButton;
UIBarButtonItem *tickButton;
+ UIBarButtonItem *deleteButton;
UIBarButtonItem *reflowButton;
UIBarButtonItem *sliderWrapper;
int barmode;
diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m
index bda52900..4df7ba40 100644
--- a/platform/ios/Classes/MuDocumentController.m
+++ b/platform/ios/Classes/MuDocumentController.m
@@ -162,6 +162,7 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
strikeoutButton = [self resourceBasedButton:@"ic_strike" withAction:@selector(onStrikeout:)];
inkButton = [self resourceBasedButton:@"ic_pen" withAction:@selector(onInk:)];
tickButton = [self resourceBasedButton:@"ic_check" withAction:@selector(onTick:)];
+ deleteButton = [self resourceBasedButton:@"ic_trash" withAction:@selector(onDelete:)];
searchBar = [[UISearchBar alloc] initWithFrame: CGRectMake(0,0,50,32)];
[searchBar setPlaceholder: @"Search"];
[searchBar setDelegate: self];
@@ -198,6 +199,7 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
[strikeoutButton release]; strikeoutButton = nil;
[inkButton release]; inkButton = nil;
[tickButton release]; tickButton = nil;
+ [deleteButton release]; deleteButton = nil;
[canvas release]; canvas = nil;
[outline release];
@@ -332,6 +334,13 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
{
[[self navigationItem] setRightBarButtonItems:[NSArray arrayWithObjects:inkButton, strikeoutButton, underlineButton, highlightButton, nil]];
[[self navigationItem] setLeftBarButtonItem:cancelButton];
+
+ for (UIView<MuPageView> *view in [canvas subviews])
+ {
+ if ([view number] == current)
+ [view deselectAnnotation];
+ }
+
barmode = BARMODE_ANNOTATION;
}
@@ -368,6 +377,12 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
}
}
+- (void) deleteModeOn
+{
+ [[self navigationItem] setRightBarButtonItems:[NSArray arrayWithObject:deleteButton]];
+ barmode = BARMODE_DELETE;
+}
+
- (void) inkModeOff
{
for (UIView<MuPageView> *view in [canvas subviews])
@@ -440,6 +455,16 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
[self showAnnotationMenu];
}
+- (void) onDelete: (id)sender
+{
+ for (UIView<MuPageView> *view in [canvas subviews])
+ {
+ if ([view number] == current)
+ [view deleteSelectedAnnotation];
+ }
+ [self showAnnotationMenu];
+}
+
- (void) onCancel: (id)sender
{
switch (barmode)
@@ -459,6 +484,7 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
case BARMODE_HIGHLIGHT:
case BARMODE_UNDERLINE:
case BARMODE_STRIKE:
+ case BARMODE_DELETE:
[self showAnnotationMenu];
[self textSelectModeOff];
break;
@@ -614,6 +640,7 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
if (CGRectContainsPoint(view.bounds, pp))
{
MuTapResult *result = [view handleTap:pp];
+ __block BOOL hitAnnot = NO;
[result switchCaseInternal:^(MuTapResultInternalLink *link) {
[self gotoPage:link.pageNumber animated:NO];
tapHandled = YES;
@@ -623,7 +650,34 @@ static void flattenOutline(NSMutableArray *titles, NSMutableArray *pages, fz_out
// Not currently supported
} caseWidget:^(MuTapResultWidget *widget) {
tapHandled = YES;
+ } caseAnnotation:^(MuTapResultAnnotation *annot) {
+ hitAnnot = YES;
}];
+
+ switch (barmode)
+ {
+ case BARMODE_ANNOTATION:
+ if (hitAnnot)
+ [self deleteModeOn];
+ tapHandled = YES;
+ break;
+
+ case BARMODE_DELETE:
+ if (!hitAnnot)
+ [self showAnnotationMenu];
+ tapHandled = YES;
+ break;
+
+ default:
+ if (hitAnnot)
+ {
+ // Annotation will have been selected, which is wanted
+ // only in annotation-editing mode
+ [view deselectAnnotation];
+ }
+ break;
+ }
+
if (tapHandled)
break;
}
diff --git a/platform/ios/Classes/MuPageView.h b/platform/ios/Classes/MuPageView.h
index 58d33f75..588bc516 100644
--- a/platform/ios/Classes/MuPageView.h
+++ b/platform/ios/Classes/MuPageView.h
@@ -20,6 +20,8 @@
-(MuTapResult *) handleTap:(CGPoint)pt;
-(void) textSelectModeOn;
-(void) textSelectModeOff;
+-(void) deselectAnnotation;
+-(void) deleteSelectedAnnotation;
-(void) inkModeOn;
-(void) inkModeOff;
-(void) saveSelectionAsMarkup:(int)type;
diff --git a/platform/ios/Classes/MuPageViewNormal.h b/platform/ios/Classes/MuPageViewNormal.h
index cd442baf..cb45b560 100644
--- a/platform/ios/Classes/MuPageViewNormal.h
+++ b/platform/ios/Classes/MuPageViewNormal.h
@@ -19,6 +19,7 @@
#import "MuDialogCreator.h"
#import "MuTextSelectView.h"
#import "MuInkView.h"
+#import "MuAnnotSelectView.h"
@interface MuPageViewNormal : UIScrollView <UIScrollViewDelegate,MuPageView>
{
@@ -39,7 +40,10 @@
MuHitView *linkView;
MuTextSelectView *textSelectView;
MuInkView *inkView;
+ MuAnnotSelectView *annotSelectView;
NSArray *widgetRects;
+ NSArray *annotations;
+ int selectedAnnotationIndex;
CGSize pageSize;
CGRect tileFrame;
float tileScale;
diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m
index 9d2117fd..b01360fe 100644
--- a/platform/ios/Classes/MuPageViewNormal.m
+++ b/platform/ios/Classes/MuPageViewNormal.m
@@ -9,6 +9,7 @@
#include "mupdf/pdf.h"
#import "MuWord.h"
#import "MuTextFieldController.h"
+#import "MuAnnotation.h"
#import "MuPageViewNormal.h"
@@ -78,6 +79,18 @@ static NSArray *enumerateWidgetRects(fz_document *doc, fz_page *page)
return [arr retain];
}
+static NSArray *enumerateAnnotations(fz_document *doc, fz_page *page)
+{
+ pdf_document *idoc = pdf_specifics(doc);
+ fz_annot *annot;
+ NSMutableArray *arr = [NSMutableArray arrayWithCapacity:10];
+
+ for (annot = fz_first_annot(doc, page); annot; annot = fz_next_annot(doc, annot))
+ [arr addObject:[MuAnnotation annotFromAnnot:annot forDoc:doc]];
+
+ return [arr retain];
+}
+
static NSArray *enumerateWords(fz_document *doc, fz_page *page)
{
fz_text_sheet *sheet = NULL;
@@ -315,6 +328,28 @@ static void addInkAnnot(fz_document *doc, fz_page *page, NSArray *curves)
}
}
+static void deleteAnnotation(fz_document *doc, fz_page *page, int index)
+{
+ pdf_document *idoc = pdf_specifics(doc);
+ if (!idoc)
+ return;
+
+ fz_try(ctx)
+ {
+ int i;
+ fz_annot *annot = fz_first_annot(doc, page);
+ for (i = 0; i < index && annot; i++)
+ annot = fz_next_annot(doc, annot);
+
+ if (annot)
+ pdf_delete_annot(idoc, (pdf_page *)page, (pdf_annot *)annot);
+ }
+ fz_catch(ctx)
+ {
+ printf("Annotation deletion failed\n");
+ }
+}
+
static int setFocussedWidgetText(fz_document *doc, fz_page *page, const char *text)
{
int accepted;
@@ -617,6 +652,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
number = aNumber;
cancel = NO;
dialogCreator = dia;
+ selectedAnnotationIndex = -1;
[self setShowsVerticalScrollIndicator: NO];
[self setShowsHorizontalScrollIndicator: NO];
@@ -671,6 +707,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
[hitView release];
[textSelectView release];
[inkView release];
+ [annotSelectView release];
[tileView release];
[loadingView release];
[imageView release];
@@ -790,6 +827,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
addMarkupAnnot(doc, page, type, rects);
[rects release];
[self updatePageAndTileWithTileFrame:tframe tileScale:tscale viewFrame:vframe];
+ [self loadAnnotations];
});
[self textSelectModeOff];
}
@@ -812,10 +850,48 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
addInkAnnot(doc, page, curves);
[curves release];
[self updatePageAndTileWithTileFrame:tframe tileScale:tscale viewFrame:vframe];
+ [self loadAnnotations];
});
[self inkModeOff];
}
+-(void) selectAnnotation:(int)i
+{
+ selectedAnnotationIndex = i;
+ [annotSelectView removeFromSuperview];
+ [annotSelectView release];
+ annotSelectView = [[MuAnnotSelectView alloc] initWithAnnot:[annotations objectAtIndex:i] pageSize:pageSize];
+ [self addSubview:annotSelectView];
+}
+
+-(void) deselectAnnotation
+{
+ selectedAnnotationIndex = -1;
+ [annotSelectView removeFromSuperview];
+ [annotSelectView release];
+ annotSelectView = nil;
+}
+
+-(void) deleteSelectedAnnotation
+{
+ CGRect tframe = tileFrame;
+ float tscale = tileScale;
+ CGRect vframe = tframe;
+ vframe.origin.x -= imageView.frame.origin.x;
+ vframe.origin.y -= imageView.frame.origin.y;
+
+ int index = selectedAnnotationIndex;
+ if (index >= 0)
+ {
+ dispatch_async(queue, ^{
+ deleteAnnotation(doc, page, index);
+ [self updatePageAndTileWithTileFrame:tframe tileScale:tscale viewFrame:vframe];
+ [self loadAnnotations];
+ });
+ }
+ [self deselectAnnotation];
+}
+
- (void) resetZoomAnimated: (BOOL)animated
{
// discard tile and any pending tile jobs
@@ -838,6 +914,18 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
[super removeFromSuperview];
}
+- (void) loadAnnotations
+{
+ if (number < 0 || number >= fz_count_pages(doc))
+ return;
+
+ NSArray *annots = enumerateAnnotations(doc, page);
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [annotations release];
+ annotations = annots;
+ });
+}
+
- (void) loadPage
{
if (number < 0 || number >= fz_count_pages(doc))
@@ -853,6 +941,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
imageData = wrapPixmap(image_pix);
UIImage *image = newImageWithPixmap(image_pix, imageData);
widgetRects = enumerateWidgetRects(doc, page);
+ [self loadAnnotations];
dispatch_async(dispatch_get_main_queue(), ^{
[self displayImage: image];
[image release];
@@ -884,6 +973,8 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
[self bringSubviewToFront:textSelectView];
if (inkView)
[self bringSubviewToFront:inkView];
+ if (annotSelectView)
+ [self bringSubviewToFront:annotSelectView];
} else {
[imageView setImage: image];
}
@@ -970,6 +1061,9 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
if (inkView)
[inkView setFrame:frm];
+
+ if (annotSelectView)
+ [annotSelectView setFrame:frm];
}
}
@@ -1036,6 +1130,8 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
[self bringSubviewToFront:textSelectView];
if (inkView)
[self bringSubviewToFront:inkView];
+ if (annotSelectView)
+ [self bringSubviewToFront:annotSelectView];
} else {
printf("discard tile\n");
}
@@ -1084,6 +1180,9 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
if (inkView)
[inkView setFrame:frm];
+
+ if (annotSelectView)
+ [annotSelectView setFrame:frm];
}
}
@@ -1247,10 +1346,24 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
{
CGPoint ipt = [self convertPoint:pt toView:imageView];
CGSize scale = fitPageToScreen(pageSize, imageView.bounds.size);
+ int i;
ipt.x /= scale.width;
ipt.y /= scale.height;
- for (int i = 0; i < widgetRects.count; i++)
+
+ for (i = 0; i < annotations.count; i++)
+ {
+ MuAnnotation *annot = [annotations objectAtIndex:i];
+ if (annot.type != FZ_ANNOT_WIDGET && CGRectContainsPoint(annot.rect, ipt))
+ {
+ [self selectAnnotation:i];
+ return [[[MuTapResultAnnotation alloc] initWithAnnotation:annot] autorelease];
+ }
+ }
+
+ [self deselectAnnotation];
+
+ for (i = 0; i < widgetRects.count; i++)
{
CGRect r = [[widgetRects objectAtIndex:i] CGRectValue];
if (CGRectContainsPoint(r, ipt))
diff --git a/platform/ios/Classes/MuPageViewReflow.m b/platform/ios/Classes/MuPageViewReflow.m
index 4c4bd445..feb64225 100644
--- a/platform/ios/Classes/MuPageViewReflow.m
+++ b/platform/ios/Classes/MuPageViewReflow.m
@@ -128,6 +128,8 @@ NSString *textAsHtml(fz_document *doc, int pageNum)
-(void) inkModeOff {}
-(void) saveSelectionAsMarkup:(int)type {}
-(void) saveInk {}
+-(void) deselectAnnotation {}
+-(void) deleteSelectedAnnotation {}
-(void) resetZoomAnimated: (BOOL)animated
{
diff --git a/platform/ios/Classes/MuTapResult.h b/platform/ios/Classes/MuTapResult.h
index 3271772f..644bad5e 100644
--- a/platform/ios/Classes/MuTapResult.h
+++ b/platform/ios/Classes/MuTapResult.h
@@ -6,17 +6,20 @@
//
#import <Foundation/Foundation.h>
+#import "MuAnnotation.h"
@class MuTapResultInternalLink;
@class MuTapResultExternalLink;
@class MuTapResultRemoteLink;
@class MuTapResultWidget;
+@class MuTapResultAnnotation;
@interface MuTapResult : NSObject
-(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock
caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock
caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock
- caseWidget:(void (^)(MuTapResultWidget *))widgetBlock;
+ caseWidget:(void (^)(MuTapResultWidget *))widgetBlock
+ caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock;
@end
@interface MuTapResultInternalLink : MuTapResult
@@ -49,3 +52,11 @@
@interface MuTapResultWidget : MuTapResult
@end
+
+@interface MuTapResultAnnotation : MuTapResult
+{
+ MuAnnotation *annot;
+}
+@property(readonly) MuAnnotation *annot;
+-(id)initWithAnnotation:(MuAnnotation *)aAnnot;
+@end
diff --git a/platform/ios/Classes/MuTapResult.m b/platform/ios/Classes/MuTapResult.m
index c7f4d755..9b684162 100644
--- a/platform/ios/Classes/MuTapResult.m
+++ b/platform/ios/Classes/MuTapResult.m
@@ -8,8 +8,7 @@
#import "MuTapResult.h"
@implementation MuTapResult
-
--(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock {}
+-(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock {}
@end
@@ -27,7 +26,7 @@
return self;
}
--(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock
+-(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock
{
internalLinkBlock(self);
}
@@ -55,7 +54,7 @@
[super dealloc];
}
--(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock
+-(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock
{
externalLinkBlock(self);
}
@@ -85,7 +84,7 @@
[super dealloc];
}
--(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock
+-(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock
{
remoteLinkBlock(self);
}
@@ -95,9 +94,37 @@
@implementation MuTapResultWidget
--(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock
+-(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock
{
widgetBlock(self);
}
-@end \ No newline at end of file
+@end
+
+
+@implementation MuTapResultAnnotation
+
+@synthesize annot;
+
+-(id) initWithAnnotation:(MuAnnotation *)aAnnot
+{
+ self = [super init];
+ if (self)
+ {
+ annot = [aAnnot retain];
+ }
+ return self;
+}
+
+-(void) dealloc
+{
+ [annot release];
+ [super dealloc];
+}
+
+-(void) switchCaseInternal:(void (^)(MuTapResultInternalLink *))internalLinkBlock caseExternal:(void (^)(MuTapResultExternalLink *))externalLinkBlock caseRemote:(void (^)(MuTapResultRemoteLink *))remoteLinkBlock caseWidget:(void (^)(MuTapResultWidget *))widgetBlock caseAnnotation:(void (^)(MuTapResultAnnotation *))annotationBlock
+{
+ annotationBlock(self);
+}
+
+@end
diff --git a/platform/ios/MuPDF.xcodeproj/project.pbxproj b/platform/ios/MuPDF.xcodeproj/project.pbxproj
index b805f3f3..1bbc8a0b 100644
--- a/platform/ios/MuPDF.xcodeproj/project.pbxproj
+++ b/platform/ios/MuPDF.xcodeproj/project.pbxproj
@@ -53,11 +53,14 @@
DABF8CC3180C28E60069CB6D /* MuChoiceFieldController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DABF8CC2180C28E60069CB6D /* MuChoiceFieldController.xib */; };
DABF8CC6180C2C650069CB6D /* MuChoiceFieldController.m in Sources */ = {isa = PBXBuildFile; fileRef = DABF8CC5180C2C640069CB6D /* MuChoiceFieldController.m */; };
DACD12271833CDA600D4B9C5 /* ic_check.png in Resources */ = {isa = PBXBuildFile; fileRef = DACD12261833CDA600D4B9C5 /* ic_check.png */; };
+ DAD10489183D0A2900960F4C /* MuAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD10488183D0A2900960F4C /* MuAnnotation.m */; };
DAD2BA821835064E00E7C49D /* MuTextSelectView.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD2BA811835064E00E7C49D /* MuTextSelectView.m */; };
DAD47D2A1832475C00E173A0 /* ic_more.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D291832475C00E173A0 /* ic_more.png */; };
DAD47D2E1832615900E173A0 /* ic_highlight.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D2B1832615900E173A0 /* ic_highlight.png */; };
DAD47D2F1832615900E173A0 /* ic_strike.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D2C1832615900E173A0 /* ic_strike.png */; };
DAD47D301832615900E173A0 /* ic_underline.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD47D2D1832615900E173A0 /* ic_underline.png */; };
+ DAD72802183E53F0005C14FA /* MuAnnotSelectView.m in Sources */ = {isa = PBXBuildFile; fileRef = DAD72801183E53F0005C14FA /* MuAnnotSelectView.m */; };
+ DAD72804183E6F33005C14FA /* ic_trash.png in Resources */ = {isa = PBXBuildFile; fileRef = DAD72803183E6F33005C14FA /* ic_trash.png */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -134,12 +137,17 @@
DABF8CC4180C2C640069CB6D /* MuChoiceFieldController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuChoiceFieldController.h; path = Classes/MuChoiceFieldController.h; sourceTree = "<group>"; };
DABF8CC5180C2C640069CB6D /* MuChoiceFieldController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuChoiceFieldController.m; path = Classes/MuChoiceFieldController.m; sourceTree = "<group>"; };
DACD12261833CDA600D4B9C5 /* ic_check.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_check.png; path = "../android/res/drawable-ldpi/ic_check.png"; sourceTree = "<group>"; };
+ DAD10487183D0A2900960F4C /* MuAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuAnnotation.h; path = Classes/MuAnnotation.h; sourceTree = "<group>"; };
+ DAD10488183D0A2900960F4C /* MuAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuAnnotation.m; path = Classes/MuAnnotation.m; sourceTree = "<group>"; };
DAD2BA801835064E00E7C49D /* MuTextSelectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuTextSelectView.h; path = Classes/MuTextSelectView.h; sourceTree = "<group>"; };
DAD2BA811835064E00E7C49D /* MuTextSelectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuTextSelectView.m; path = Classes/MuTextSelectView.m; sourceTree = "<group>"; };
DAD47D291832475C00E173A0 /* ic_more.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_more.png; path = "../android/res/drawable-ldpi/ic_more.png"; sourceTree = "<group>"; };
DAD47D2B1832615900E173A0 /* ic_highlight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_highlight.png; path = "../android/res/drawable-ldpi/ic_highlight.png"; sourceTree = "<group>"; };
DAD47D2C1832615900E173A0 /* ic_strike.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_strike.png; path = "../android/res/drawable-ldpi/ic_strike.png"; sourceTree = "<group>"; };
DAD47D2D1832615900E173A0 /* ic_underline.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_underline.png; path = "../android/res/drawable-ldpi/ic_underline.png"; sourceTree = "<group>"; };
+ DAD72800183E53F0005C14FA /* MuAnnotSelectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuAnnotSelectView.h; path = Classes/MuAnnotSelectView.h; sourceTree = "<group>"; };
+ DAD72801183E53F0005C14FA /* MuAnnotSelectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuAnnotSelectView.m; path = Classes/MuAnnotSelectView.m; sourceTree = "<group>"; };
+ DAD72803183E6F33005C14FA /* ic_trash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_trash.png; path = "../android/res/drawable-ldpi/ic_trash.png"; sourceTree = "<group>"; };
DADD8D6917EB24C000C49E0B /* MuPageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuPageView.h; path = Classes/MuPageView.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -205,6 +213,7 @@
968E1E461779A54F0050CEA3 /* Resources */ = {
isa = PBXGroup;
children = (
+ DAD72803183E6F33005C14FA /* ic_trash.png */,
DACD12261833CDA600D4B9C5 /* ic_check.png */,
DAD47D2B1832615900E173A0 /* ic_highlight.png */,
DAD47D2C1832615900E173A0 /* ic_strike.png */,
@@ -246,8 +255,12 @@
DAD2BA811835064E00E7C49D /* MuTextSelectView.m */,
DA442E2E183B9F13008EF49B /* MuInkView.h */,
DA442E2F183B9F13008EF49B /* MuInkView.m */,
+ DAD72800183E53F0005C14FA /* MuAnnotSelectView.h */,
+ DAD72801183E53F0005C14FA /* MuAnnotSelectView.m */,
DAB067A41831225D00DDA774 /* MuWord.h */,
DAB067A51831225D00DDA774 /* MuWord.m */,
+ DAD10487183D0A2900960F4C /* MuAnnotation.h */,
+ DAD10488183D0A2900960F4C /* MuAnnotation.m */,
DA1C68A417E863C70061F586 /* MuPageViewNormal.h */,
DA1C68A517E863C70061F586 /* MuPageViewNormal.m */,
DA1C68A617E864180061F586 /* MuDocumentController.h */,
@@ -369,6 +382,7 @@
DAD47D301832615900E173A0 /* ic_underline.png in Resources */,
DACD12271833CDA600D4B9C5 /* ic_check.png in Resources */,
DA442E2D183B796F008EF49B /* ic_pen.png in Resources */,
+ DAD72804183E6F33005C14FA /* ic_trash.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -418,6 +432,8 @@
DAB067A61831225D00DDA774 /* MuWord.m in Sources */,
DAD2BA821835064E00E7C49D /* MuTextSelectView.m in Sources */,
DA442E30183B9F13008EF49B /* MuInkView.m in Sources */,
+ DAD10489183D0A2900960F4C /* MuAnnotation.m in Sources */,
+ DAD72802183E53F0005C14FA /* MuAnnotSelectView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};