[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809
dmaclach
dmaclach at 59b500cc-1b3d-0410-9834-0bbf25fbcc57
Wed Aug 4 01:31:27 UTC 2010
The following commit has been merged in the upstream branch:
commit 8674494185c1672cd5d95302a7492f6f2eb3d5cf
Author: dmaclach <dmaclach at 59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date: Mon May 10 17:44:49 2010 +0000
Fixes to get zxing compatible back to OS 3.0 as proposed by David Oster.
git-svn-id: http://zxing.googlecode.com/svn/trunk@1349 59b500cc-1b3d-0410-9834-0bbf25fbcc57
diff --git a/iphone/Classes/DecoderViewController.m b/iphone/Classes/DecoderViewController.m
index c97b162..26da41d 100644
--- a/iphone/Classes/DecoderViewController.m
+++ b/iphone/Classes/DecoderViewController.m
@@ -230,32 +230,39 @@ CGImageRef MyCGImageCopyScreenContents(void) {
// [[NSUserDefaults standardUserDefaults] boolForKey:@"allowEditing"];
BOOL isCamera = (sourceType == UIImagePickerControllerSourceTypeCamera);
- picker.allowsEditing = !isCamera;
+ if ([picker respondsToSelector:@selector(setAllowsEditing:)]) {
+ // not in 3.0
+ [picker setAllowsEditing:!isCamera];
+ }
if (isCamera) {
- picker.showsCameraControls = NO;
- UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
- NSString *cancelString =
+ if ([picker respondsToSelector:@selector(setShowsCameraControls:)]) {
+ [picker setShowsCameraControls:NO];
+ UIButton *cancelButton =
+ [UIButton buttonWithType:UIButtonTypeRoundedRect];
+ NSString *cancelString =
NSLocalizedString(@"DecoderViewController cancel button title", @"");
- CGFloat height = [UIFont systemFontSize];
- CGSize size = [cancelString sizeWithFont:[UIFont systemFontOfSize:height]];
- [cancelButton setTitle:cancelString forState:UIControlStateNormal];
- CGRect appFrame = [[UIScreen mainScreen] bounds];
- static const int kMargin = 10;
- static const int kInternalXMargin = 10;
- static const int kInternalYMargin = 10;
- CGRect frame = CGRectMake(kMargin,
- appFrame.size.height - (height + 2*kInternalYMargin + kMargin),
- 2*kInternalXMargin + size.width,
- height + 2*kInternalYMargin);
- [cancelButton setFrame:frame];
- [cancelButton addTarget:self
- action:@selector(cancel:)
- forControlEvents:UIControlEventTouchUpInside];
- picker.cameraOverlayView = cancelButton;
- // The camera takes quite a while to start up. Hence the 2 second delay.
- [self performSelector:@selector(takeScreenshot)
- withObject:nil
- afterDelay:2.0];
+ CGFloat height = [UIFont systemFontSize];
+ CGSize size =
+ [cancelString sizeWithFont:[UIFont systemFontOfSize:height]];
+ [cancelButton setTitle:cancelString forState:UIControlStateNormal];
+ CGRect appFrame = [[UIScreen mainScreen] bounds];
+ static const int kMargin = 10;
+ static const int kInternalXMargin = 10;
+ static const int kInternalYMargin = 10;
+ CGRect frame = CGRectMake(kMargin,
+ appFrame.size.height - (height + 2*kInternalYMargin + kMargin),
+ 2*kInternalXMargin + size.width,
+ height + 2*kInternalYMargin);
+ [cancelButton setFrame:frame];
+ [cancelButton addTarget:self
+ action:@selector(cancel:)
+ forControlEvents:UIControlEventTouchUpInside];
+ picker.cameraOverlayView = cancelButton;
+ // The camera takes quite a while to start up. Hence the 2 second delay.
+ [self performSelector:@selector(takeScreenshot)
+ withObject:nil
+ afterDelay:2.0];
+ }
}
// Picker is displayed asynchronously.
diff --git a/iphone/Classes/ResultParser.m b/iphone/Classes/ResultParser.m
index 0e53676..96a130a 100644
--- a/iphone/Classes/ResultParser.m
+++ b/iphone/Classes/ResultParser.m
@@ -48,7 +48,19 @@ static NSMutableSet *sResultParsers = nil;
#ifdef DEBUG
NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s);
#endif
- for (Class c in [self resultParsers]) {
+
+ // Make the parser of last resort the last parser we try.
+ NSMutableArray *resultParsers =
+ [NSMutableArray arrayWithArray:[[self resultParsers] allObjects]];
+ NSUInteger textIndex =
+ [resultParsers indexOfObject:NSClassFromString(@"TextResultParser")];
+ if (NSNotFound != textIndex) {
+ // If it is present, make sure it is last.
+ [resultParsers exchangeObjectAtIndex:textIndex
+ withObjectAtIndex:[resultParsers count] - 1];
+ }
+
+ for (Class c in resultParsers) {
#ifdef DEBUG
NSLog(@"trying %@", NSStringFromClass(c));
#endif
--
Multi-format 1D/2D barcode image processing library
More information about the Pkg-google-commits
mailing list