diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2013-11-22 13:12:14 +0000 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2013-11-22 13:12:14 +0000 |
commit | 6fc675335c3403887d641cc2e7ecb35a8464dd65 (patch) | |
tree | dccb684820e210d5a11b7d3803431b62839ca6b2 /platform/ios/Classes | |
parent | 26a6b6464c868552487acd91b3738fdee78757d3 (diff) | |
download | mupdf-6fc675335c3403887d641cc2e7ecb35a8464dd65.tar.xz |
iOS: support annotation deletion
Diffstat (limited to 'platform/ios/Classes')
-rw-r--r-- | platform/ios/Classes/MuAnnotSelectView.h | 19 | ||||
-rw-r--r-- | platform/ios/Classes/MuAnnotSelectView.m | 42 | ||||
-rw-r--r-- | platform/ios/Classes/MuAnnotation.h | 22 | ||||
-rw-r--r-- | platform/ios/Classes/MuAnnotation.m | 35 | ||||
-rw-r--r-- | platform/ios/Classes/MuDocumentController.h | 4 | ||||
-rw-r--r-- | platform/ios/Classes/MuDocumentController.m | 54 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageView.h | 2 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewNormal.h | 4 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewNormal.m | 115 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewReflow.m | 2 | ||||
-rw-r--r-- | platform/ios/Classes/MuTapResult.h | 13 | ||||
-rw-r--r-- | platform/ios/Classes/MuTapResult.m | 41 |
12 files changed, 343 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 |