summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2014-01-10 14:56:45 +0000
committerPaul Gardiner <paul.gardiner@artifex.com>2014-01-10 14:57:23 +0000
commit23e4c17ed59124765161702520dfc346af5702af (patch)
tree4c0807d9babc2f45b809b704d889e7def0bbfb34 /platform
parent0b7ba1c2239da6400d18d2e17e33c94bb0addd42 (diff)
downloadmupdf-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')
-rw-r--r--platform/ios/Classes/MuDocumentController.h3
-rw-r--r--platform/ios/Classes/MuDocumentController.m8
-rw-r--r--platform/ios/Classes/MuPageView.h1
-rw-r--r--platform/ios/Classes/MuPageViewNormal.h4
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m9
-rw-r--r--platform/ios/Classes/MuPageViewReflow.m1
-rw-r--r--platform/ios/Classes/MuUpdater.h5
-rw-r--r--platform/ios/MuPDF.xcodeproj/project.pbxproj2
8 files changed, 26 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
diff --git a/platform/ios/MuPDF.xcodeproj/project.pbxproj b/platform/ios/MuPDF.xcodeproj/project.pbxproj
index 492ea205..bb5f7a46 100644
--- a/platform/ios/MuPDF.xcodeproj/project.pbxproj
+++ b/platform/ios/MuPDF.xcodeproj/project.pbxproj
@@ -99,6 +99,7 @@
96E1CDEB1779A60700FCF717 /* iTunesArtwork.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = iTunesArtwork.png; sourceTree = "<group>"; };
96E1CDEC1779A60700FCF717 /* x_alt_blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = x_alt_blue.png; sourceTree = "<group>"; };
96E1CDED1779A60700FCF717 /* x_alt_blue@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "x_alt_blue@2x.png"; sourceTree = "<group>"; };
+ DA012CA218803D1C00E47712 /* MuUpdater.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MuUpdater.h; path = Classes/MuUpdater.h; sourceTree = "<group>"; };
DA1C689817E85E8E0061F586 /* MuLibraryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuLibraryController.h; path = Classes/MuLibraryController.h; sourceTree = "<group>"; };
DA1C689917E85E8E0061F586 /* MuLibraryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MuLibraryController.m; path = Classes/MuLibraryController.m; sourceTree = "<group>"; };
DA1C689C17E861020061F586 /* MuOutlineController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MuOutlineController.h; path = Classes/MuOutlineController.h; sourceTree = "<group>"; };
@@ -290,6 +291,7 @@
DAFF997A187C12430081C756 /* MuChoiceFieldController.xib */,
DAF81D5918800D1800B0F028 /* TapImage.h */,
DAF81D5A18800D1800B0F028 /* TapImage.m */,
+ DA012CA218803D1C00E47712 /* MuUpdater.h */,
);
name = Classes;
sourceTree = "<group>";