diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2014-01-10 14:56:45 +0000 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2014-01-10 14:57:23 +0000 |
commit | 23e4c17ed59124765161702520dfc346af5702af (patch) | |
tree | 4c0807d9babc2f45b809b704d889e7def0bbfb34 /platform/ios/Classes | |
parent | 0b7ba1c2239da6400d18d2e17e33c94bb0addd42 (diff) | |
download | mupdf-23e4c17ed59124765161702520dfc346af5702af.tar.xz |
iOS: correctly handle document changes that may affect several pages
Interaction with forms may change several pages, so all pages currently
represented by view need updating.
Diffstat (limited to 'platform/ios/Classes')
-rw-r--r-- | platform/ios/Classes/MuDocumentController.h | 3 | ||||
-rw-r--r-- | platform/ios/Classes/MuDocumentController.m | 8 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageView.h | 1 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewNormal.h | 4 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewNormal.m | 9 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewReflow.m | 1 | ||||
-rw-r--r-- | platform/ios/Classes/MuUpdater.h | 5 |
7 files changed, 24 insertions, 7 deletions
diff --git a/platform/ios/Classes/MuDocumentController.h b/platform/ios/Classes/MuDocumentController.h index bc2959e1..4abacc42 100644 --- a/platform/ios/Classes/MuDocumentController.h +++ b/platform/ios/Classes/MuDocumentController.h @@ -9,6 +9,7 @@ #import "MuOutlineController.h" #import "MuDocRef.h" #import "MuDialogCreator.h" +#import "MuUpdater.h" enum { @@ -22,7 +23,7 @@ enum BARMODE_DELETE }; -@interface MuDocumentController : UIViewController <UIScrollViewDelegate, UIGestureRecognizerDelegate, UISearchBarDelegate, MuDialogCreator> +@interface MuDocumentController : UIViewController <UIScrollViewDelegate, UIGestureRecognizerDelegate, UISearchBarDelegate, MuDialogCreator, MuUpdater> { fz_document *doc; MuDocRef *docRef; diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m index 962403ec..0e3beb1e 100644 --- a/platform/ios/Classes/MuDocumentController.m +++ b/platform/ios/Classes/MuDocumentController.m @@ -433,6 +433,12 @@ static void saveDoc(char *current_path, fz_document *doc) barmode = BARMODE_ANNOTATION; } +- (void) update +{ + for (UIView<MuPageView> *view in [canvas subviews]) + [view update]; +} + - (void) onMore: (id)sender { [self showAnnotationMenu]; @@ -887,7 +893,7 @@ static void saveDoc(char *current_path, fz_document *doc) UIView<MuPageView> *view = reflowMode ? [[MuPageViewReflow alloc] initWithFrame:CGRectMake(number * width, 0, width-GAP, height) document:docRef page:number] - : [[MuPageViewNormal alloc] initWithFrame:CGRectMake(number * width, 0, width-GAP, height) dialogCreator:self document:docRef page:number]; + : [[MuPageViewNormal alloc] initWithFrame:CGRectMake(number * width, 0, width-GAP, height) dialogCreator:self updater:self document:docRef page:number]; [view setScale:scale]; [canvas addSubview: view]; if (showLinks) diff --git a/platform/ios/Classes/MuPageView.h b/platform/ios/Classes/MuPageView.h index 89ce0aca..e3c26549 100644 --- a/platform/ios/Classes/MuPageView.h +++ b/platform/ios/Classes/MuPageView.h @@ -19,4 +19,5 @@ -(void) inkModeOff; -(void) saveSelectionAsMarkup:(int)type; -(void) saveInk; +-(void) update; @end diff --git a/platform/ios/Classes/MuPageViewNormal.h b/platform/ios/Classes/MuPageViewNormal.h index 8378ca74..ce42991a 100644 --- a/platform/ios/Classes/MuPageViewNormal.h +++ b/platform/ios/Classes/MuPageViewNormal.h @@ -13,6 +13,7 @@ #import "MuTextSelectView.h" #import "MuInkView.h" #import "MuAnnotSelectView.h" +#import "MuUpdater.h" @interface MuPageViewNormal : UIScrollView <UIScrollViewDelegate,MuPageView> { @@ -42,8 +43,9 @@ float tileScale; BOOL cancel; id<MuDialogCreator> dialogCreator; + id<MuUpdater> updater; } -- (id) initWithFrame: (CGRect)frame dialogCreator:(id<MuDialogCreator>)dia document: (MuDocRef *)aDoc page: (int)aNumber; +- (id) initWithFrame: (CGRect)frame dialogCreator:(id<MuDialogCreator>)dia updater:(id<MuUpdater>)upd document: (MuDocRef *)aDoc page: (int)aNumber; - (void) displayImage: (UIImage*)image; - (void) resizeImage; - (void) loadPage; diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m index 49c07eaf..8c67dc4e 100644 --- a/platform/ios/Classes/MuPageViewNormal.m +++ b/platform/ios/Classes/MuPageViewNormal.m @@ -631,7 +631,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa annot_list = create_annot_list(doc, page); } --(id) initWithFrame:(CGRect)frame dialogCreator:(id<MuDialogCreator>)dia document:(MuDocRef *)aDoc page:(int)aNumber +-(id) initWithFrame:(CGRect)frame dialogCreator:(id<MuDialogCreator>)dia updater:(id<MuUpdater>)upd document:(MuDocRef *)aDoc page:(int)aNumber { self = [super initWithFrame: frame]; if (self) { @@ -640,6 +640,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa number = aNumber; cancel = NO; dialogCreator = dia; + updater = upd; selectedAnnotationIndex = -1; [self setShowsVerticalScrollIndicator: NO]; @@ -1212,7 +1213,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa if (accepted) { dispatch_async(dispatch_get_main_queue(), ^{ - [self update]; + [updater update]; }); } else @@ -1233,7 +1234,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa if (accepted) { dispatch_async(dispatch_get_main_queue(), ^{ - [self update]; + [updater update]; }); } else @@ -1360,7 +1361,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa int changed = [self passTapToPage:ipt]; if (changed) dispatch_async(dispatch_get_main_queue(), ^{ - [self update]; + [updater update]; }); }); return [[[MuTapResultWidget alloc] init] autorelease]; diff --git a/platform/ios/Classes/MuPageViewReflow.m b/platform/ios/Classes/MuPageViewReflow.m index 523a73e1..4a60df00 100644 --- a/platform/ios/Classes/MuPageViewReflow.m +++ b/platform/ios/Classes/MuPageViewReflow.m @@ -123,6 +123,7 @@ NSString *textAsHtml(fz_document *doc, int pageNum) -(void) saveInk {} -(void) deselectAnnotation {} -(void) deleteSelectedAnnotation {} +-(void) update {} -(void) resetZoomAnimated: (BOOL)animated { diff --git a/platform/ios/Classes/MuUpdater.h b/platform/ios/Classes/MuUpdater.h new file mode 100644 index 00000000..0291f821 --- /dev/null +++ b/platform/ios/Classes/MuUpdater.h @@ -0,0 +1,5 @@ +#import <Foundation/Foundation.h> + +@protocol MuUpdater <NSObject> +- (void)update; +@end |