summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorPtyl Dragon <ptyl@cloudon.com>2013-10-18 18:14:03 +0200
committerTor Lillqvist <tml@collabora.com>2013-10-18 16:07:19 +0000
commit4219195dec664aa03395a52168fad356840e5402 (patch)
tree0034f2525d6dbabc06643a214c0120a6f478f6d0 /ios
parent4d8f12f57b0f02d3610269eae7b5981010dc7e98 (diff)
ios tile testing app done
Change-Id: I1c4a45c3f19d79b4da8cc96304e0e1802f92dff2 Reviewed-on: https://gerrit.libreoffice.org/6320 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'ios')
-rw-r--r--ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj5
-rw-r--r--ios/shared/ios_sharedlo.xcodeproj/project.pbxproj17
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m1
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.h20
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m88
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleFactory.m2
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleLoApp.m4
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.h4
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.m32
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.h14
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.m64
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h2
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m76
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.h2
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.m29
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileSubviewControllerProtocol.h2
16 files changed, 342 insertions, 20 deletions
diff --git a/ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj b/ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj
index c1277b537689..eebf831c89e0 100644
--- a/ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj
+++ b/ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj
@@ -1542,6 +1542,7 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = armv7;
};
@@ -1582,6 +1583,7 @@
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = armv7;
@@ -1591,6 +1593,7 @@
689EBB0E18069FB8002F1CD7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_DYNAMIC_NO_PIC = NO;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -1669,6 +1672,7 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = armv7;
};
@@ -1677,6 +1681,7 @@
88A13310181023A40091F25E /* Debug_tile_tester */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_DYNAMIC_NO_PIC = NO;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
diff --git a/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj b/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj
index c2f093f08d19..4a95af137338 100644
--- a/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj
+++ b/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj
@@ -48,9 +48,11 @@
889B7929180FF928005A3149 /* MLOAppRoleLoApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 889B7928180FF928005A3149 /* MLOAppRoleLoApp.m */; };
889B792C180FF967005A3149 /* MLOAppRoleTileTester.m in Sources */ = {isa = PBXBuildFile; fileRef = 889B792B180FF967005A3149 /* MLOAppRoleTileTester.m */; };
889B7930180FFBA5005A3149 /* MLOAppRoleBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 889B792F180FFBA5005A3149 /* MLOAppRoleBase.m */; };
+ 88A083BA18115E8D009C75BE /* MLOTestingTile.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A083B918115E8D009C75BE /* MLOTestingTile.m */; };
88A132FC181020320091F25E /* MLOTestingTileRendererViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A132FB181020320091F25E /* MLOTestingTileRendererViewController.m */; };
88A132FF1810204E0091F25E /* MLOTestingTileParametersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A132FE1810204E0091F25E /* MLOTestingTileParametersViewController.m */; };
88A1330B1810213F0091F25E /* MLOAppRoleFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A1330A1810213E0091F25E /* MLOAppRoleFactory.m */; };
+ 88A13318181040BC0091F25E /* MLOTestingTileParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A13317181040BC0091F25E /* MLOTestingTileParameter.m */; };
88A2ED23180D4D7C009F39C0 /* MLOKeyboardManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A2ED22180D4D7C009F39C0 /* MLOKeyboardManager.m */; };
/* End PBXBuildFile section */
@@ -157,6 +159,8 @@
889B792E180FFBA5005A3149 /* MLOAppRoleBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleBase.h; path = role/MLOAppRoleBase.h; sourceTree = "<group>"; };
889B792F180FFBA5005A3149 /* MLOAppRoleBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOAppRoleBase.m; path = role/MLOAppRoleBase.m; sourceTree = "<group>"; };
889B793618101709005A3149 /* MLOAppRoleProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleProtocol.h; path = role/MLOAppRoleProtocol.h; sourceTree = "<group>"; };
+ 88A083B818115E8D009C75BE /* MLOTestingTile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOTestingTile.h; path = testing_tiles/MLOTestingTile.h; sourceTree = "<group>"; };
+ 88A083B918115E8D009C75BE /* MLOTestingTile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOTestingTile.m; path = testing_tiles/MLOTestingTile.m; sourceTree = "<group>"; };
88A132FA181020320091F25E /* MLOTestingTileRendererViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOTestingTileRendererViewController.h; path = testing_tiles/MLOTestingTileRendererViewController.h; sourceTree = "<group>"; };
88A132FB181020320091F25E /* MLOTestingTileRendererViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOTestingTileRendererViewController.m; path = testing_tiles/MLOTestingTileRendererViewController.m; sourceTree = "<group>"; };
88A132FD1810204E0091F25E /* MLOTestingTileParametersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOTestingTileParametersViewController.h; path = testing_tiles/MLOTestingTileParametersViewController.h; sourceTree = "<group>"; };
@@ -164,6 +168,8 @@
88A13300181020E40091F25E /* MLOTestingTileSubviewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MLOTestingTileSubviewControllerProtocol.h; path = testing_tiles/MLOTestingTileSubviewControllerProtocol.h; sourceTree = "<group>"; };
88A133091810213E0091F25E /* MLOAppRoleFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleFactory.h; path = role/MLOAppRoleFactory.h; sourceTree = "<group>"; };
88A1330A1810213E0091F25E /* MLOAppRoleFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOAppRoleFactory.m; path = role/MLOAppRoleFactory.m; sourceTree = "<group>"; };
+ 88A13316181040BC0091F25E /* MLOTestingTileParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOTestingTileParameter.h; sourceTree = "<group>"; };
+ 88A13317181040BC0091F25E /* MLOTestingTileParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLOTestingTileParameter.m; sourceTree = "<group>"; };
88A2ED21180D4D7C009F39C0 /* MLOKeyboardManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOKeyboardManager.h; sourceTree = "<group>"; };
88A2ED22180D4D7C009F39C0 /* MLOKeyboardManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLOKeyboardManager.m; sourceTree = "<group>"; };
88E94760180D4E9800771808 /* MLOToolbarViewController_Impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MLOToolbarViewController_Impl.h; sourceTree = "<group>"; };
@@ -405,8 +411,12 @@
children = (
88A132FA181020320091F25E /* MLOTestingTileRendererViewController.h */,
88A132FB181020320091F25E /* MLOTestingTileRendererViewController.m */,
+ 88A083B818115E8D009C75BE /* MLOTestingTile.h */,
+ 88A083B918115E8D009C75BE /* MLOTestingTile.m */,
88A132FD1810204E0091F25E /* MLOTestingTileParametersViewController.h */,
88A132FE1810204E0091F25E /* MLOTestingTileParametersViewController.m */,
+ 88A13316181040BC0091F25E /* MLOTestingTileParameter.h */,
+ 88A13317181040BC0091F25E /* MLOTestingTileParameter.m */,
88A13300181020E40091F25E /* MLOTestingTileSubviewControllerProtocol.h */,
);
name = testing_tiles;
@@ -504,6 +514,8 @@
88A132FC181020320091F25E /* MLOTestingTileRendererViewController.m in Sources */,
88A132FF1810204E0091F25E /* MLOTestingTileParametersViewController.m in Sources */,
88A1330B1810213F0091F25E /* MLOAppRoleFactory.m in Sources */,
+ 88A13318181040BC0091F25E /* MLOTestingTileParameter.m in Sources */,
+ 88A083BA18115E8D009C75BE /* MLOTestingTile.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -524,6 +536,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -547,6 +560,7 @@
LLVM_LTO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
};
name = Debug;
};
@@ -581,6 +595,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
LLVM_LTO = YES;
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -633,6 +648,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -656,6 +672,7 @@
LLVM_LTO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
};
name = Debug_tile_tester;
};
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m
index 97825ae9a52b..518a66e12505 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m
@@ -82,6 +82,7 @@ static const CGFloat
self.view.frame.size.width,
self.view.frame.size.height - TOP_BAR_HEIGHT);
self.canvas = [[UIView alloc] initWithFrame:canvasRect];
+ self.role.view = self.canvas;
self.canvas.clipsToBounds = YES;
self.canvas.backgroundColor = [UIColor whiteColor];
}
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.h
new file mode 100644
index 000000000000..2f31281dcb04
--- /dev/null
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.h
@@ -0,0 +1,20 @@
+// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#import "MLOObject.h"
+
+
+typedef void (^MLOTestingTileParameterExtractor)(CGFloat value);
+
+@class MLOTestingTileParametersViewController;
+@interface MLOTestingTileParameter : MLOObject
+-(MLOTestingTileParameter *)initWithParams:(MLOTestingTileParametersViewController *) params label:(NSString *)label extractor:(MLOTestingTileParameterExtractor) extractor defaultValue:(NSInteger) defaultValue;
+-(void)extract;
+-(void)setParamFrame:(CGRect) paramFrame;
+-(void)addToSuperview;
+@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m
new file mode 100644
index 000000000000..f286390caf34
--- /dev/null
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m
@@ -0,0 +1,88 @@
+// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#import "MLOTestingTileParameter.h"
+#import "MLOTestingTileParametersViewController.h"
+
+@interface MLOTestingTileParameter ()
+@property MLOTestingTileParametersViewController * params;
+@property (nonatomic,strong) MLOTestingTileParameterExtractor extractor;
+@property UILabel * label;
+@property UITextField * data;
+@property NSInteger defaultValue;
+@end
+
+@implementation MLOTestingTileParameter
+
+-(MLOTestingTileParameter *)initWithParams:(MLOTestingTileParametersViewController *) params label:(NSString *)label extractor:(MLOTestingTileParameterExtractor) extractor defaultValue:(NSInteger) defaultValue{
+ NSLog(@"Creating tile testing param %@ with default value %d",label,defaultValue);
+ self = [self init];
+ if(self){
+ self.params = params;
+ self.extractor = extractor;
+ self.defaultValue = defaultValue;
+
+ [self initLabel:label];
+ [self initTextField];
+ }
+ return self;
+}
+
+-(NSString *)description{
+ return [@"MLOTestingTileParameter: " stringByAppendingString:self.label.text];
+}
+
+-(void) initLabel:(NSString *) label{
+ self.label =[[UILabel alloc] initWithFrame:CGRECT_ZERO];
+ self.label.text = label;
+ self.label.textAlignment = NSTextAlignmentRight;
+}
+
+-(void) initTextField{
+ self.data = [[UITextField alloc] initWithFrame:CGRECT_ZERO];
+ [self.data setKeyboardType:UIKeyboardTypeNumberPad];
+ self.data.textAlignment = NSTextAlignmentLeft;
+ [self resetValue];
+}
+
+-(void)resetValue{
+
+ self.data.text = [NSString stringWithFormat:@"%d",self.defaultValue];
+}
+
+-(void)setParamFrame:(CGRect) paramFrame{
+ NSLog(@"%@ setParamFrame",self);
+
+ self.label.frame=CGRectMake(paramFrame.origin.x,
+ paramFrame.origin.y,
+ paramFrame.size.width/2.0f,
+ paramFrame.size.height);
+ self.data.frame =CGRectMake(paramFrame.origin.x + paramFrame.size.width/2.0f,
+ paramFrame.origin.y,
+ paramFrame.size.width/2.0f,
+ paramFrame.size.height);
+}
+
+-(void)addToSuperview{
+ NSLog(@"%@ addToSuperview",self);
+ [self.params.view addSubview:self.label];
+ [self.params.view addSubview:self.data];
+}
+
+-(void)extract{
+ NSLog(@"%@ extract",self);
+
+ if([[NSNumberFormatter new]numberFromString:self.data.text] == nil){
+
+ NSLog(@"%@ got illegal value: %@, reseting to %d",self,self.data.text,self.defaultValue);
+
+ [self resetValue];
+ }
+ self.extractor([self.data.text floatValue]);
+}
+@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleFactory.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleFactory.m
index 130002120bce..ba27a4f36320 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleFactory.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleFactory.m
@@ -16,6 +16,8 @@
+(MLOAppRoleBase *) getInstanceWithMainViewController:(MLOMainViewController *) mainViewController{
MLOAppRoleBase * role;
+ NSLog(@"Creating app role: %@",MLOAppRoleString(APP_ROLE));
+
switch (APP_ROLE) {
case LO_APP:
{
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleLoApp.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleLoApp.m
index 54fef2ef71ef..1fad45bcec94 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleLoApp.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleLoApp.m
@@ -20,6 +20,10 @@ static const NSTimeInterval ROTATE_FLASH_DURATION=0.5f;
@implementation MLOAppRoleLoApp
+-(NSString *)description{
+ return @"MLOAppRoleLoApp";
+}
+
-(void)initSubviews{
MLOMainViewController * main = [self mainViewController];
main.scroller = [[MLOScrollerViewController alloc] initWithMainViewController:main];
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.h
index c21b33244924..01f121ee2d40 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.h
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.h
@@ -7,7 +7,9 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOAppRoleBase.h"
-
+@class MLOTestingTileRendererViewController,MLOTestingTileParametersViewController;
@interface MLOAppRoleTileTester : MLOAppRoleBase
+@property MLOTestingTileRendererViewController * renderer;
+@property MLOTestingTileParametersViewController * params;
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.m
index d6f71c5d31c0..743c0c113cde 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.m
@@ -12,59 +12,67 @@
#import "MLOTestingTileRendererViewController.h"
#import "MLOTestingTileParametersViewController.h"
-@interface MLOAppRoleTileTester ()
-@property MLOTestingTileRendererViewController * renderer;
-@property MLOTestingTileParametersViewController * params;
-@end
@implementation MLOAppRoleTileTester
-(void)initSubviews{
-
+ NSLog(@"%@ initSubviews",self);
self.renderer = [[MLOTestingTileRendererViewController alloc] initWithTester:self];
self.params = [[MLOTestingTileParametersViewController alloc] initWithTester:self];
-
+
+}
+
+-(NSString *)description{
+ return @"MLOAppRoleTileTester";
}
-(void)setWidth:(CGFloat) width height:(CGFloat) height{
+ NSLog(@"%@ setWidth:height",self);
if(width > height){
CGFloat halfWidth = width/2.0f;
self.renderer.view.frame =CGRectMake(0, 0, halfWidth, height);
self.params.view.frame =CGRectMake(halfWidth,0, halfWidth, height);
}else{
CGFloat halfHeight = height/2.0f;
- self.renderer.view.frame =CGRectMake(0, 0, width, halfHeight);
- self.params.view.frame =CGRectMake(width,halfHeight, width, halfHeight);
+ self.params.view.frame =CGRectMake(0, 0, width, halfHeight);
+ self.renderer.view.frame =CGRectMake(0,halfHeight, width, halfHeight);
}
[self.renderer resize];
[self.params resize];
+
}
-(void)addSubviews{
+ NSLog(@"%@ addSubviews",self);
- [self.renderer addToMainViewController];
- [self.params addToMainViewController];
+ [self.renderer addToSuperview];
+ [self.params addToSuperview];
[self.mainViewController resize];
}
-(void)rotate{
-
+ NSLog(@"%@ rotate",self);
MLOMainViewController * main = [self mainViewController];
[main resize];
[main.topbar onRotate];
+
+ [self.renderer resize];
+ [self.params resize];
}
-(void)showLibreOffice{
-
+ NSLog(@"%@ showLibreOffice",self);
}
-(void)hideLibreOffice{
+ NSLog(@"%@ hideLibreOffice",self);
}
-(void)initWindow:(UIWindow *) window{
+ NSLog(@"%@ initWindow",self);
}
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.h
new file mode 100644
index 000000000000..1bfaa8d87df6
--- /dev/null
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.h
@@ -0,0 +1,14 @@
+// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#import "MLOSubView.h"
+@class MLOAppRoleTileTester;
+@interface MLOTestingTile : MLOSubView
+-(id)initWithTester:(MLOAppRoleTileTester *) tester;
+-(void)resize;
+@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.m
new file mode 100644
index 000000000000..82a970f0fe2e
--- /dev/null
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.m
@@ -0,0 +1,64 @@
+// -*- Mode: Objective-C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#import "MLOTestingTile.h"
+#import "MLOTestingTileParametersViewController.h"
+#import "MLOTestingTileRendererViewController.h"
+#import "MLOAppRoleTileTester.h"
+#include <touch/touch.h>
+
+@interface MLOTestingTile ()
+@property MLOAppRoleTileTester * tester;
+@end
+
+@implementation MLOTestingTile
+
+
+-(id)initWithTester:(MLOAppRoleTileTester *)tester{
+
+ self = [self initWithFrame:[MLOTestingTile resized:tester]];
+ if(self){
+ self.tester =tester;
+ self.backgroundColor =[UIColor greenColor];
+ }
+ return self;
+
+}
+
++(CGRect)resized:(MLOAppRoleTileTester *)tester{
+ return CGRectMake( (tester.renderer.view.frame.size.width -tester.params.contextWidth)/2.0f,
+ (tester.renderer.view.frame.size.height -tester.params.contextHeight)/2.0f,
+ tester.params.contextWidth,
+ tester.params.contextHeight);
+}
+
+-(void)resize{
+ self.frame = [MLOTestingTile resized:self.tester];
+}
+
+- (void)drawRect:(CGRect)rect
+{
+ CGContextRef context = UIGraphicsGetCurrentContext();
+
+ CGContextSaveGState(context);
+ CGContextTranslateCTM(context, 0, self.tester.params.contextHeight);
+ CGContextScaleCTM(context, 1, -1);
+ CGContextScaleCTM(context, 1, 1);
+
+ touch_lo_draw_tile(context,
+ self.tester.params.contextWidth,
+ self.tester.params.contextHeight,
+ self.tester.params.tilePosX,
+ self.tester.params.tilePosY,
+ self.tester.params.tileWidth,
+ self.tester.params.tileHeight);
+
+ CGContextRestoreGState(context);
+}
+
+@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
index 82de32a5642f..57060b7584f3 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
@@ -10,5 +10,5 @@
#import "MLOTestingTileSubviewControllerProtocol.h"
@interface MLOTestingTileParametersViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
-
+@property CGFloat contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight;
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m
index bb6c8a7f6faa..2381df97de93 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m
@@ -7,9 +7,16 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "MLOTestingTileParametersViewController.h"
+#import "MLOTestingTileParameter.h"
+#import "MLOAppRoleTileTester.h"
+#import "MLOTestingTileRendererViewController.h"
+
+static const CGFloat RENDER_BUTTON_HEIGHT = 50.0f;
@interface MLOTestingTileParametersViewController ()
@property MLOAppRoleTileTester * tester;
+@property NSArray * params;
+@property UIButton * renderButton;
@end
@implementation MLOTestingTileParametersViewController
@@ -18,14 +25,81 @@
self = [self init];
if(self){
self.tester = tester;
+ [self initParams];
+ [self initRenderButton];
}
+
+ NSLog(@"%@ initWithTester",self);
return self;
}
+
+-(NSString *)description{
+ return @"MLOTestingTileParametersViewController";
+}
+
+-(void)initParams{
+ self.params = @[[self createParam:@"contextWidth" extractor:^(CGFloat value){self.contextWidth = value;} value:100],
+ [self createParam:@"contextHeight" extractor:^(CGFloat value){self.contextHeight = value;} value:100],
+ [self createParam:@"tilePosX" extractor:^(CGFloat value){self.tilePosX = value;} value:0],
+ [self createParam:@"tilePosY" extractor:^(CGFloat value){self.tilePosY = value;} value:0],
+ [self createParam:@"tileWidth" extractor:^(CGFloat value){self.tileWidth = value;} value:100],
+ [self createParam:@"tileHeight" extractor:^(CGFloat value){self.tileHeight = value;} value:100]
+ ];
+}
+
+-(void)initRenderButton{
+ UIButton * button =[UIButton buttonWithType:UIButtonTypeRoundedRect];
+ [button addTarget:self action:@selector(renderTile) forControlEvents:UIControlEventTouchDown];
+ [button setTitle:@"Render Tile" forState:UIControlStateNormal];
+ self.renderButton =button;
+}
+
+
+-(MLOTestingTileParameter *) createParam:(NSString *)name extractor:(MLOTestingTileParameterExtractor) extractor value:(CGFloat)defaultValue{
+ return [[MLOTestingTileParameter alloc] initWithParams:self label:name extractor:extractor defaultValue:defaultValue];
+}
+
+
-(void)resize{
+ NSLog(@"%@ resize",self);
+ CGFloat height = self.view.frame.size.height;
+ CGFloat width = self.view.frame.size.width;
+ if(width<height){
+ height = height/2.0f;
+ }
+ CGFloat heightWithoutButton = height - RENDER_BUTTON_HEIGHT;
+ CGFloat paramHeight = heightWithoutButton / [self.params count];
+ CGFloat originY = 0;
+ for (MLOTestingTileParameter * param in self.params) {
+ [param setParamFrame:CGRectMake(0,
+ originY,
+ width,
+ paramHeight)];
+ originY+=paramHeight;
+ }
+ self.renderButton.frame = CGRectMake(0,
+ originY,
+ width,
+ RENDER_BUTTON_HEIGHT);
}
--(void)addToMainViewController{
+-(void)addToSuperview{
+ NSLog(@"%@ addToSuperview",self);
+ [self.tester.view addSubview:self.view];
+ for (MLOTestingTileParameter * param in self.params) {
+ [param addToSuperview];
+ }
+
+ [self.view addSubview:self.renderButton];
+
}
+-(void)renderTile{
+ NSLog(@"%@ renderTile",self);
+ for (MLOTestingTileParameter * param in self.params) {
+ [param extract];
+ }
+ [self.tester.renderer render];
+}
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.h
index ad3962b76550..33fd647d7386 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.h
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.h
@@ -10,5 +10,5 @@
#import "MLOTestingTileSubviewControllerProtocol.h"
@interface MLOTestingTileRendererViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
-
+-(void)render;
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.m
index 7bff06b5aa37..bcc2191f58dc 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.m
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.m
@@ -8,9 +8,12 @@
#import "MLOTestingTileRendererViewController.h"
#import "MLOAppRoleTileTester.h"
+#import "MLOTestingTile.h"
@interface MLOTestingTileRendererViewController ()
@property MLOAppRoleTileTester * tester;
+@property UIScrollView * scrollView;
+@property MLOTestingTile * tile;
@end
@implementation MLOTestingTileRendererViewController
@@ -19,14 +22,34 @@
self = [self init];
if(self){
self.tester = tester;
-
+ [self initScrollView];
}
+ NSLog(@"%@ initWithTester",self);
return self;
}
+
+-(void)initScrollView{
+ self.scrollView = [UIScrollView new];
+ self.view = self.scrollView;
+}
-(void)resize{
-
+ NSLog(@"%@ resize",self);
+ [self.tile resize];
}
--(void)addToMainViewController{
+-(NSString *)description{
+ return @"MLOAppRoleTileTester";
+}
+-(void)addToSuperview{
+ NSLog(@"%@ addToSuperview",self);
+
+ [self.tester.view addSubview:self.view];
+}
+-(void)render{
+ [self.tile removeFromSuperview];
+ self.tile = [[MLOTestingTile alloc] initWithTester:self.tester];
+ [self.scrollView addSubview:self.tile];
+ self.scrollView.contentSize = self.tile.frame.size;
+
}
@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileSubviewControllerProtocol.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileSubviewControllerProtocol.h
index 66fc18cb8149..9b9c977cdfab 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileSubviewControllerProtocol.h
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileSubviewControllerProtocol.h
@@ -11,6 +11,6 @@
@class MLOAppRoleTileTester;
@protocol MLOTestingTileSubviewControllerProtocol <NSObject>
-(id)initWithTester:(MLOAppRoleTileTester *)tester;
--(void)addToMainViewController;
+-(void)addToSuperview;
-(void)resize;
@end