[Libreoffice-commits] core.git: ios/MobileLibreOffice ios/shared

Ptyl Dragon ptyl at cloudon.com
Fri Oct 18 09:07:42 PDT 2013


 ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj                                            |    5 
 ios/shared/ios_sharedlo.xcodeproj/project.pbxproj                                                            |   17 +
 ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m                                 |    1 
 ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.h                               |   20 ++
 ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTestingTileParameter.m                               |   88 ++++++++++
 ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleFactory.m                                |    2 
 ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleLoApp.m                                  |    4 
 ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.h                             |    4 
 ios/shared/ios_sharedlo/objective_c/view_controllers/role/MLOAppRoleTileTester.m                             |   32 ++-
 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.h                          |   14 +
 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTile.m                          |   64 +++++++
 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h  |    2 
 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.m  |   76 ++++++++
 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.h    |    2 
 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileRendererViewController.m    |   29 ++-
 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileSubviewControllerProtocol.h |    2 
 16 files changed, 342 insertions(+), 20 deletions(-)

New commits:
commit 4219195dec664aa03395a52168fad356840e5402
Author: Ptyl Dragon <ptyl at cloudon.com>
Date:   Fri Oct 18 18:14:03 2013 +0200

    ios tile testing app done
    
    Change-Id: I1c4a45c3f19d79b4da8cc96304e0e1802f92dff2
    Reviewed-on: https://gerrit.libreoffice.org/6320
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj b/ios/MobileLibreOffice/MobileLibreOffice.xcodeproj/project.pbxproj
index c1277b5..eebf831 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 c2f093f..4a95af1 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 97825ae..518a66e 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 0000000..2f31281
--- /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);
+
+ at class MLOTestingTileParametersViewController;
+ at interface MLOTestingTileParameter : MLOObject
+-(MLOTestingTileParameter *)initWithParams:(MLOTestingTileParametersViewController *) params label:(NSString *)label extractor:(MLOTestingTileParameterExtractor) extractor defaultValue:(NSInteger) defaultValue;
+-(void)extract;
+-(void)setParamFrame:(CGRect)  paramFrame;
+-(void)addToSuperview;
+ at 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 0000000..f286390
--- /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"
+
+ at interface MLOTestingTileParameter ()
+ at property MLOTestingTileParametersViewController * params;
+ at property (nonatomic,strong) MLOTestingTileParameterExtractor extractor;
+ at property UILabel * label;
+ at property UITextField * data;
+ at property NSInteger defaultValue;
+ at end
+
+ at 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]);
+}
+ at 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 1300021..ba27a4f 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 54fef2e..1fad45b 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 c21b332..01f121e 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"
-
+ at class MLOTestingTileRendererViewController,MLOTestingTileParametersViewController;
 @interface MLOAppRoleTileTester : MLOAppRoleBase
+ at property MLOTestingTileRendererViewController * renderer;
+ at 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 d6f71c5..743c0c1 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"
 
- at interface MLOAppRoleTileTester ()
- at property MLOTestingTileRendererViewController * renderer;
- at property MLOTestingTileParametersViewController * params;
- at 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 0000000..1bfaa8d
--- /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"
+ at class MLOAppRoleTileTester;
+ at interface MLOTestingTile : MLOSubView
+-(id)initWithTester:(MLOAppRoleTileTester *) tester;
+-(void)resize;
+ at 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 0000000..82a970f
--- /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>
+
+ at interface MLOTestingTile ()
+ at property MLOAppRoleTileTester * tester;
+ at end
+
+ at 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);
+}
+
+ at 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 82de32a..57060b7 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>
-
+ at 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 bb6c8a7..2381df9 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;
+ at property NSArray * params;
+ at 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 ad3962b..33fd647 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 7bff06b..bcc2191 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;
+ at property UIScrollView * scrollView;
+ at 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 66fc18c..9b9c977 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


More information about the Libreoffice-commits mailing list