diff options
author | Ptyl Dragon <ptyl@cloudon.com> | 2013-10-17 17:00:02 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-10-17 17:02:43 +0200 |
commit | ae549ad1e66283b641e27c3a3743b468b9ff1c43 (patch) | |
tree | f0eeba36476a883df38fe4f52108f96029317f5d /ios/shared | |
parent | 647d766c328668a1ab404fb464970647a3916e28 (diff) |
infrastructure for ios tile testing app
Change-Id: I1a3d10b7fb61b19664b383d29c6e607c01b90a71
Diffstat (limited to 'ios/shared')
20 files changed, 263 insertions, 238 deletions
diff --git a/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj b/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj index 9c5d25ad0f12..c2f093f08d19 100644 --- a/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj +++ b/ios/shared/ios_sharedlo.xcodeproj/project.pbxproj @@ -45,6 +45,12 @@ 689EBBA31806D22D002F1CD7 /* MLOToolbarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 689EBB851806D22D002F1CD7 /* MLOToolbarViewController.m */; }; 68FDBE2E18053A140064DD74 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68FDBE2D18053A140064DD74 /* Foundation.framework */; }; 68FDBE3518053A140064DD74 /* ios_sharedlo.m in Sources */ = {isa = PBXBuildFile; fileRef = 68FDBE3418053A140064DD74 /* ios_sharedlo.m */; }; + 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 */; }; + 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 */; }; 88A2ED23180D4D7C009F39C0 /* MLOKeyboardManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 88A2ED22180D4D7C009F39C0 /* MLOKeyboardManager.m */; }; /* End PBXBuildFile section */ @@ -110,7 +116,7 @@ 689EBB621806D22C002F1CD7 /* NSObject+MLOUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+MLOUtils.m"; sourceTree = "<group>"; }; 689EBB641806D22C002F1CD7 /* MLOMainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOMainViewController.h; sourceTree = "<group>"; }; 689EBB651806D22C002F1CD7 /* MLOMainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLOMainViewController.m; sourceTree = "<group>"; }; - 689EBB661806D22C002F1CD7 /* MLOMainViewController_Impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOMainViewController_Impl.h; sourceTree = "<group>"; }; + 689EBB661806D22C002F1CD7 /* MLOMainViewController_Friend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOMainViewController_Friend.h; sourceTree = "<group>"; }; 689EBB681806D22C002F1CD7 /* MLOTopbarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOTopbarViewController.h; sourceTree = "<group>"; }; 689EBB691806D22C002F1CD7 /* MLOTopbarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLOTopbarViewController.m; sourceTree = "<group>"; }; 689EBB6B1806D22C002F1CD7 /* MLOScrollerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLOScrollerData.h; sourceTree = "<group>"; }; @@ -143,6 +149,21 @@ 68FDBE3118053A140064DD74 /* ios_sharedlo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ios_sharedlo-Prefix.pch"; sourceTree = "<group>"; }; 68FDBE3218053A140064DD74 /* ios_sharedlo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ios_sharedlo.h; path = ../ios_sharedlo.h; sourceTree = "<group>"; }; 68FDBE3418053A140064DD74 /* ios_sharedlo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ios_sharedlo.m; path = ../ios_sharedlo.m; sourceTree = "<group>"; }; + 889B7927180FF928005A3149 /* MLOAppRoleLoApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleLoApp.h; path = role/MLOAppRoleLoApp.h; sourceTree = "<group>"; }; + 889B7928180FF928005A3149 /* MLOAppRoleLoApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOAppRoleLoApp.m; path = role/MLOAppRoleLoApp.m; sourceTree = "<group>"; }; + 889B792A180FF967005A3149 /* MLOAppRoleTileTester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MLOAppRoleTileTester.h; path = role/MLOAppRoleTileTester.h; sourceTree = "<group>"; }; + 889B792B180FF967005A3149 /* MLOAppRoleTileTester.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOAppRoleTileTester.m; path = role/MLOAppRoleTileTester.m; sourceTree = "<group>"; }; + 889B792D180FF9E2005A3149 /* MLOMainViewController_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MLOMainViewController_Private.h; sourceTree = "<group>"; }; + 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>"; }; + 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>"; }; + 88A132FE1810204E0091F25E /* MLOTestingTileParametersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MLOTestingTileParametersViewController.m; path = testing_tiles/MLOTestingTileParametersViewController.m; sourceTree = "<group>"; }; + 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>"; }; 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>"; }; @@ -257,9 +278,12 @@ 689EBB631806D22C002F1CD7 /* view_controllers */ = { isa = PBXGroup; children = ( + 889B7926180FF8DF005A3149 /* role */, + 889EBEC0180F04A300A34A68 /* testing_tiles */, 689EBB641806D22C002F1CD7 /* MLOMainViewController.h */, + 689EBB661806D22C002F1CD7 /* MLOMainViewController_Friend.h */, + 889B792D180FF9E2005A3149 /* MLOMainViewController_Private.h */, 689EBB651806D22C002F1CD7 /* MLOMainViewController.m */, - 689EBB661806D22C002F1CD7 /* MLOMainViewController_Impl.h */, 689EBB681806D22C002F1CD7 /* MLOTopbarViewController.h */, 689EBB691806D22C002F1CD7 /* MLOTopbarViewController.m */, 689EBB6A1806D22C002F1CD7 /* scroller */, @@ -360,6 +384,34 @@ name = "Supporting Files"; sourceTree = "<group>"; }; + 889B7926180FF8DF005A3149 /* role */ = { + isa = PBXGroup; + children = ( + 889B7927180FF928005A3149 /* MLOAppRoleLoApp.h */, + 889B7928180FF928005A3149 /* MLOAppRoleLoApp.m */, + 889B792A180FF967005A3149 /* MLOAppRoleTileTester.h */, + 889B792B180FF967005A3149 /* MLOAppRoleTileTester.m */, + 889B792E180FFBA5005A3149 /* MLOAppRoleBase.h */, + 889B792F180FFBA5005A3149 /* MLOAppRoleBase.m */, + 88A133091810213E0091F25E /* MLOAppRoleFactory.h */, + 88A1330A1810213E0091F25E /* MLOAppRoleFactory.m */, + 889B793618101709005A3149 /* MLOAppRoleProtocol.h */, + ); + name = role; + sourceTree = "<group>"; + }; + 889EBEC0180F04A300A34A68 /* testing_tiles */ = { + isa = PBXGroup; + children = ( + 88A132FA181020320091F25E /* MLOTestingTileRendererViewController.h */, + 88A132FB181020320091F25E /* MLOTestingTileRendererViewController.m */, + 88A132FD1810204E0091F25E /* MLOTestingTileParametersViewController.h */, + 88A132FE1810204E0091F25E /* MLOTestingTileParametersViewController.m */, + 88A13300181020E40091F25E /* MLOTestingTileSubviewControllerProtocol.h */, + ); + name = testing_tiles; + sourceTree = "<group>"; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -446,6 +498,12 @@ 689EBBA21806D22D002F1CD7 /* MLOToolbarButton.m in Sources */, 689EBBA31806D22D002F1CD7 /* MLOToolbarViewController.m in Sources */, 88A2ED23180D4D7C009F39C0 /* MLOKeyboardManager.m in Sources */, + 889B7929180FF928005A3149 /* MLOAppRoleLoApp.m in Sources */, + 889B792C180FF967005A3149 /* MLOAppRoleTileTester.m in Sources */, + 889B7930180FFBA5005A3149 /* MLOAppRoleBase.m in Sources */, + 88A132FC181020320091F25E /* MLOTestingTileRendererViewController.m in Sources */, + 88A132FF1810204E0091F25E /* MLOTestingTileParametersViewController.m in Sources */, + 88A1330B1810213F0091F25E /* MLOAppRoleFactory.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -470,8 +528,8 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + "MLO_APP_ROLE=LO_APP", "DEBUG=1", - "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -508,6 +566,7 @@ COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_PREPROCESSOR_DEFINITIONS = "MLO_APP_ROLE=LO_APP"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -560,6 +619,63 @@ }; name = Release; }; + 88A1331218102A8F0091F25E /* Debug_tile_tester */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 689EBADD1806975D002F1CD7 /* lo.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = armv7; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "MLO_APP_ROLE=TILE_TESTER", + "DEBUG=1", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(LO_BUILDDIR)/config_host", + "$(LO_SRCDIR)/include", + "$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive", + "$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive", + ); + IPHONEOS_DEPLOYMENT_TARGET = 6.1; + LD_NO_PIE = NO; + LINK_WITH_STANDARD_LIBRARIES = NO; + LLVM_LTO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug_tile_tester; + }; + 88A1331318102A8F0091F25E /* Debug_tile_tester */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/ios_sharedlo.dst; + GCC_DYNAMIC_NO_PIC = NO; + GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ios_sharedlo/ios_sharedlo-Prefix.pch"; + LD_NO_PIE = NO; + LINK_WITH_STANDARD_LIBRARIES = NO; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + VALID_ARCHS = armv7; + }; + name = Debug_tile_tester; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -567,6 +683,7 @@ isa = XCConfigurationList; buildConfigurations = ( 68FDBE3618053A140064DD74 /* Debug */, + 88A1331218102A8F0091F25E /* Debug_tile_tester */, 68FDBE3718053A140064DD74 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -576,6 +693,7 @@ isa = XCConfigurationList; buildConfigurations = ( 68FDBE3918053A140064DD74 /* Debug */, + 88A1331318102A8F0091F25E /* Debug_tile_tester */, 68FDBE3A18053A140064DD74 /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/ios/shared/ios_sharedlo/objective_c/MLOManager.h b/ios/shared/ios_sharedlo/objective_c/MLOManager.h index 04df67703883..fbdc96ff4b63 100644 --- a/ios/shared/ios_sharedlo/objective_c/MLOManager.h +++ b/ios/shared/ios_sharedlo/objective_c/MLOManager.h @@ -10,12 +10,11 @@ #import "MLOInvoker.h" @class MLOMainViewController; -@interface MLOManager : UIResponder <UIApplicationDelegate,UITextViewDelegate> -@property (strong,nonatomic) MLOMainViewController * mainViewController; +@interface MLOManager : UIResponder <UIApplicationDelegate> +@property MLOMainViewController * mainViewController; +(MLOManager *) getInstance; --(BOOL) textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; -(void)openInLibreOfficeFilePath:(NSString *) filePath fileNameWithExtension:(NSString *) fileName superView:(UIView *) superview window:(UIWindow *) window invoker:(NSObject<MLOInvoker> *) invoker; -(void)openInLibreOfficeFilePath:(NSString *) filePath superView:(UIView *) superview window:(UIWindow *) window invoker:(NSObject<MLOInvoker> *) invoker; -(void) hideLibreOffice; @@ -23,5 +22,4 @@ -(NSString *)extension; -(CGRect)bounds; -(void)start; - @end diff --git a/ios/shared/ios_sharedlo/objective_c/MLOManager.m b/ios/shared/ios_sharedlo/objective_c/MLOManager.m index a422731ee559..e9d4b5ffb812 100644 --- a/ios/shared/ios_sharedlo/objective_c/MLOManager.m +++ b/ios/shared/ios_sharedlo/objective_c/MLOManager.m @@ -136,23 +136,6 @@ static const NSTimeInterval FADE_IN_DURATION = 0.3; } } - -- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text -{ - NSLog(@"textView: %@ shouldChangeTextInRange:[%u,%u] replacementText:%@", textView, range.location, range.length, text); - - int length =[text length]; - - for (NSUInteger i = 0; i < length; i++){ - - touch_lo_keyboard_input([text characterAtIndex: i]); - } - if(length>0){ - [self.mainViewController onTextEdit]; - } - - return NO; -} -(void) hideLibreOffice{ [self.invoker willHideLibreOffice]; diff --git a/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureEngine.m b/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureEngine.m index ea81427688b3..85ed9cf2943b 100644 --- a/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureEngine.m +++ b/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureEngine.m @@ -7,7 +7,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #import "MLOAnimation.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLORenderManager_Impl.h" #import "MLOSelectionViewController.h" #import "MLOScrollerViewController.h" diff --git a/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureLimiter.m b/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureLimiter.m index 9b94ad7feca3..d72c5ff765a6 100644 --- a/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureLimiter.m +++ b/ios/shared/ios_sharedlo/objective_c/gestures/MLOGestureLimiter.m @@ -8,7 +8,7 @@ #import "MLOGestureLimiter.h" #import "MLOGestureEngine_Impl.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOScrollerData.h" #import "MLOScrollerViewController.h" #import "MLORenderManager_Impl.h" diff --git a/ios/shared/ios_sharedlo/objective_c/gestures/MLOKeyboardManager.m b/ios/shared/ios_sharedlo/objective_c/gestures/MLOKeyboardManager.m index c9c0b7a5d385..bbc81d7fba1a 100644 --- a/ios/shared/ios_sharedlo/objective_c/gestures/MLOKeyboardManager.m +++ b/ios/shared/ios_sharedlo/objective_c/gestures/MLOKeyboardManager.m @@ -7,7 +7,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #import "MLOKeyboardManager.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOManager.h" #import "MLOGestureEngine_Impl.h" #include <touch/touch.h> @@ -64,10 +64,16 @@ -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { NSLog(@"textView: %@ shouldChangeTextInRange:[%u,%u] replacementText:%@", textView, range.location, range.length, text); + + NSInteger length = [text length]; - for (NSUInteger i = 0; i < [text length]; i++){ + for (NSUInteger i = 0; i < length; i++){ touch_lo_keyboard_input([text characterAtIndex: i]); } + + if(length>0){ + [self.mainViewController onTextEdit]; + } return NO; } diff --git a/ios/shared/ios_sharedlo/objective_c/render/MLORenderBuffer.m b/ios/shared/ios_sharedlo/objective_c/render/MLORenderBuffer.m index a06f91d8fecb..f598220a73ab 100644 --- a/ios/shared/ios_sharedlo/objective_c/render/MLORenderBuffer.m +++ b/ios/shared/ios_sharedlo/objective_c/render/MLORenderBuffer.m @@ -53,45 +53,46 @@ static CGFloat averageFps,maxFps; - (void)drawRect:(CGRect)rect { + if(ENABLE_LO_DESKTOP){ + CGContextRef context = UIGraphicsGetCurrentContext(); + + //rect = self.frame; + LOG_RECT(rect, @"drawRect"); + + CGContextSaveGState(context); + CGContextSetFillColorWithColor(context,[UIColor whiteColor].CGColor); + CGContextTranslateCTM(context, 0, _manager.bufferFrame.size.height); + CGContextScaleCTM(context, 1, -1); + CGContextScaleCTM(context, 1, 1); + NSDate *startDate = [NSDate date]; + + [_manager loRenderWillBegin]; + + touch_lo_render_windows(context, rect.origin.y, rect.origin.y, rect.size.width, rect.size.height); - CGContextRef context = UIGraphicsGetCurrentContext(); - - //rect = self.frame; - LOG_RECT(rect, @"drawRect"); - - CGContextSaveGState(context); - CGContextSetFillColorWithColor(context,[UIColor whiteColor].CGColor); - CGContextTranslateCTM(context, 0, _manager.bufferFrame.size.height); - CGContextScaleCTM(context, 1, -1); - CGContextScaleCTM(context, 1, 1); - NSDate *startDate = [NSDate date]; - - [_manager loRenderWillBegin]; - - touch_lo_render_windows(context, rect.origin.y, rect.origin.y, rect.size.width, rect.size.height); - - CGContextRestoreGState(context); - - CGFloat duration = [[NSDate date] timeIntervalSinceDate: startDate]; - - maxFps = max(maxFps,1.0f/duration); - - static float totalTime = 0,counter = 0; - - totalTime +=duration; - counter++; - - CGFloat averageTime = totalTime / counter; - if(averageTime >MIN_AVERAGE_RENDER_TIME_THRESHOLD){ - averageFps = 1.0f/ averageTime; - } - - if(LOG_DRAW_RECT){ - NSLog(@"drawRect: lo_render_windows: time=%f sec, average=%f sec, fps=%f", - duration, averageTime, averageFps); - } - if(_manager.currentGesture != PINCH){ - [_manager swapPreviousBuffer:_previous withNextBuffer:self]; + CGContextRestoreGState(context); + + CGFloat duration = [[NSDate date] timeIntervalSinceDate: startDate]; + + maxFps = max(maxFps,1.0f/duration); + + static float totalTime = 0,counter = 0; + + totalTime +=duration; + counter++; + + CGFloat averageTime = totalTime / counter; + if(averageTime >MIN_AVERAGE_RENDER_TIME_THRESHOLD){ + averageFps = 1.0f/ averageTime; + } + + if(LOG_DRAW_RECT){ + NSLog(@"drawRect: lo_render_windows: time=%f sec, average=%f sec, fps=%f", + duration, averageTime, averageFps); + } + if(_manager.currentGesture != PINCH){ + [_manager swapPreviousBuffer:_previous withNextBuffer:self]; + } } } diff --git a/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.h b/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.h index 75eb67ef6838..86830016111a 100644 --- a/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.h +++ b/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.h @@ -22,7 +22,7 @@ static const BOOL ENABLE_PINCH_RENDERING_VIA_IOS = YES; -(void) panDeltaX:(CGFloat) deltaX deltaY:(CGFloat) deltaY; -(void) pinchDeltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY scale:(CGFloat)scale; -(void) endGestures; --(void)setWidth:(NSInteger) width height:(NSInteger) height; +-(void) setWidth:(NSInteger) width height:(NSInteger) height; -(void) renderInContext:(CGContextRef) context; -(CGPoint) getShiftFromCanvasCenter; -(void)renderNow; diff --git a/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.m b/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.m index 9c428b27146c..8deca8cbfdb8 100644 --- a/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.m +++ b/ios/shared/ios_sharedlo/objective_c/render/MLORenderManager.m @@ -249,42 +249,45 @@ typedef enum {X,Y,Z} MLOGestureDirection; } -(void) renderWithRect:(CGRect) rect{ + + if(ENABLE_LO_DESKTOP){ - switch(self.currentGesture){ - case PAN: - { - NSTimeInterval now = CACurrentMediaTime(); - - NSTimeInterval delta = LO_RENDER_BACKOFF_MIN + - LO_RENDER_BACK_OFF_MAX_DELTA * [self currentZoomRatio]; - - NSTimeInterval releaseTime = now + delta; - - NSTimeInterval currentReleaseTime = self.renderBlockReleaseTime; - - NSInteger currentFrameId = self.frameIdCounter++; - - if(now > currentReleaseTime){ - - [self pereodicRender:rect releaseTime:releaseTime]; - - }else{ + switch(self.currentGesture){ + case PAN: + { + NSTimeInterval now = CACurrentMediaTime(); + + NSTimeInterval delta = LO_RENDER_BACKOFF_MIN + + LO_RENDER_BACK_OFF_MAX_DELTA * [self currentZoomRatio]; - [self performBlock:^{ + NSTimeInterval releaseTime = now + delta; + + NSTimeInterval currentReleaseTime = self.renderBlockReleaseTime; + + NSInteger currentFrameId = self.frameIdCounter++; + + if(now > currentReleaseTime){ + + [self pereodicRender:rect releaseTime:releaseTime]; + + }else{ - if((self.renderBlockReleaseTime == currentReleaseTime) - && (currentFrameId==0)){ - - [self pereodicRender:rect releaseTime:releaseTime]; - } - }afterDelay:delta]; + [self performBlock:^{ + + if((self.renderBlockReleaseTime == currentReleaseTime) + && (currentFrameId==0)){ + + [self pereodicRender:rect releaseTime:releaseTime]; + } + }afterDelay:delta]; + } } - } + break; + case PINCH: + case NO_GESTURE: + [[self getNextBuffer] setNeedsDisplayInRect:rect]; break; - case PINCH: - case NO_GESTURE: - [[self getNextBuffer] setNeedsDisplayInRect:rect]; - break; + } } } diff --git a/ios/shared/ios_sharedlo/objective_c/utils/MLOCommon.h b/ios/shared/ios_sharedlo/objective_c/utils/MLOCommon.h index fb14eabc1a5e..2d6fadba3b8b 100644 --- a/ios/shared/ios_sharedlo/objective_c/utils/MLOCommon.h +++ b/ios/shared/ios_sharedlo/objective_c/utils/MLOCommon.h @@ -9,6 +9,11 @@ #ifndef __Mobile_LibreOffice_MLOCommon_h__ #define __Mobile_LibreOffice_MLOCommon_h__ +typedef enum { LO_APP, TILE_TESTER} MLOAppRole; +#define MLOAppRoleString(enum) [@[@"LO_APP",@"RENDER_TILE_TESTER"] objectAtIndex:enum] +static const MLOAppRole APP_ROLE = MLO_APP_ROLE; +static const BOOL ENABLE_LO_DESKTOP = APP_ROLE == LO_APP; + static const BOOL LOG_DRAW_RECT = NO, LOG_GET_VIEW_DATA = YES, 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 cb29994a7a09..cb34bc61e138 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController.m @@ -16,24 +16,15 @@ #import "MLORenderManager.h" #import "NSObject+MLOUtils.h" #import "MLOTopbarViewController.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Private.h" #import "MLOKeyboardManager.h" +#import "MLOAppRoleFactory.h" +#import "MLOAppRoleBase.h" #import "mlo_uno.h" -@interface MLOMainViewController () - -@property BOOL focused; -@property CGFloat topBarHeight; -@property UIView * flasher; -@property MLOTopbarViewController * topbar; -@property MLOToolbarViewController * toolbar; - -@end - static const CGFloat FLASH_DURATION= 0.2f, - EXPAND_DURATION=0.5f, - ROTATE_FLASH_DURATION=0.5f; + EXPAND_DURATION=0.5f; @implementation MLOMainViewController @@ -47,19 +38,19 @@ static const CGFloat -(void)showLibreOffice:(UIWindow *) window{ - _topBarHeight = TOP_BAR_HEIGHT; + self.topBarHeight = TOP_BAR_HEIGHT; + [[UIApplication sharedApplication]setStatusBarHidden:YES]; self.view.bounds = self.view.frame = [self getFullFrameForRect:self.view.frame]; - - [_renderManager setWidth:self.view.frame.size.width height:self.view.frame.size.height]; - - [_gestureEngine showLibreOffice:window]; + [self.role initWindow:window]; + [self onStart]; - [_topbar showLibreOffice]; - [_toolbar showLibreOffice]; + [self.topbar showLibreOffice]; + + [self.role showLibreOffice]; } @@ -72,21 +63,12 @@ static const CGFloat if(self.focused){ self.focused = NO; + [self.topbar hideLibreOffice]; - [self.toolbar hideLibreOffice]; - - [self resetSubviews]; - + [[UIApplication sharedApplication]setStatusBarHidden:NO]; - - [self.gestureEngine hideLibreOffice]; - - [self.scroller hideLibreOffice]; - - [self.selection reset]; - - [self.keyboard hide]; - + + [self.role hideLibreOffice]; [self.view removeFromSuperview]; [[MLOManager getInstance] hideLibreOffice]; @@ -94,14 +76,12 @@ static const CGFloat } -(void)initCanvas{ - self.view.frame = self.view.bounds =[self getFullFrameForRect:[[MLOManager getInstance] bounds]]; - - self.canvas = [[UIView alloc] - initWithFrame:CGRectMake(0, - TOP_BAR_HEIGHT, - self.view.frame.size.width, - self.view.frame.size.height - TOP_BAR_HEIGHT)]; + CGRect canvasRect = CGRectMake(0, + TOP_BAR_HEIGHT, + self.view.frame.size.width, + self.view.frame.size.height - TOP_BAR_HEIGHT); + self.canvas = [[UIView alloc] initWithFrame:canvasRect]; self.canvas.clipsToBounds = YES; self.canvas.backgroundColor = [UIColor whiteColor]; } @@ -109,43 +89,33 @@ static const CGFloat - (id) init{ self = [super init]; if(self){ - - [self initCanvas]; - - self.scroller = [[MLOScrollerViewController alloc] initWithMainViewController:self]; - self.selection = [[MLOSelectionViewController alloc] initWithMainViewController: self]; + self.role = [MLOAppRoleFactory getInstanceWithMainViewController:self]; - self.toolbar = [[MLOToolbarViewController alloc] initWithMainViewController:self]; + [self initCanvas]; + + [self.role initSubviews]; self.topbar = [[MLOTopbarViewController alloc] initWithMainViewController:self]; - self.flasher =[[UIView alloc] initWithFrame:CGRECT_ZERO]; - - self.keyboard = [[MLOKeyboardManager alloc]initWithMainViewController:self]; - - _flasher.alpha = 0.0f; - _flasher.backgroundColor = [UIColor whiteColor]; - - self.gestureEngine = nil; [self addSubviews]; [self onStart]; - _focused =NO; - _topBarHeight = TOP_BAR_HEIGHT; + self.focused = NO; + self.topBarHeight = TOP_BAR_HEIGHT; } return self; } -(void) flash{ - _flasher.frame =self.view.frame; - _flasher.alpha = 1.0f; + self.flasher.frame =self.view.frame; + self.flasher.alpha = 1.0f; [self.view addSubview:_flasher]; [UIView animateWithDuration:FLASH_DURATION animations:^{ - _flasher.alpha=0.0f; + self.flasher.alpha=0.0f; } completion:^(BOOL finished) { - [_flasher removeFromSuperview]; + [self.flasher removeFromSuperview]; }]; } @@ -155,91 +125,50 @@ static const CGFloat [UIView animateWithDuration:EXPAND_DURATION animations:^(void){ - _canvas.frame = CGRectMake(0, targetHeight, mainFrame.size.width, mainFrame.size.height - targetHeight); - _renderManager.view.alpha= 0.0f; + self.canvas.frame = CGRectMake(0, targetHeight, mainFrame.size.width, mainFrame.size.height - targetHeight); + self.renderManager.view.alpha= 0.0f; } completion:^(BOOL completed){ - _topBarHeight = targetHeight; + self.topBarHeight = targetHeight; [self rotate]; - [_toolbar expandDidToggle]; + [self.toolbar expandDidToggle]; }]; } -(void)resize{ CGRect mainViewRect = [self getFullFrameForRect:self.view.bounds]; - LOG_RECT(mainViewRect, @"MLO Resize: main view"); self.view.bounds = self.view.frame = mainViewRect; CGFloat width = self.view.frame.size.width; - CGFloat height = self.view.frame.size.height - _topBarHeight; + CGFloat height = self.view.frame.size.height - self.topBarHeight; CGRect canvasRect =CGRectMake(0, _topBarHeight, width, height); - - _canvas.frame = canvasRect; - - [_renderManager setWidth:width height:height]; + self.canvas.frame = canvasRect; + [self.role setWidth:width height:height]; LOG_RECT(canvasRect, @"MLO Resize: canvas"); - - } -(void) addSubviews{ - [_topbar addToMainViewController]; - - [self.view addSubview:_canvas]; - + [self.topbar addToMainViewController]; + [self.view addSubview:self.canvas]; self.view.backgroundColor = [UIColor whiteColor]; - self.renderManager = [MLORenderManager getInstance]; - - [self resize]; - - [self.canvas addSubview: _renderManager.view]; - - self.gestureEngine = [[MLOGestureEngine alloc] initWithMainViewController:self]; - [_toolbar addToMainViewController]; - [_scroller addToMainViewController]; - [_selection addToMainViewController]; - [_keyboard addToMainViewController]; + [self.role addSubviews]; } -(void)rotate{ - if(_focused){ - - NSLog(@"MLO rotate"); - - _renderManager.view.alpha= 0.0f; - - [self resize]; - - [_gestureEngine onRotate]; - - [_topbar onRotate]; - - [_scroller reset]; - - [_scroller showLibreOffice]; - - [_selection onRotate]; - - [_toolbar onRotate]; - - - [UIView animateWithDuration:ROTATE_FLASH_DURATION animations:^(void){ - _renderManager.view.alpha=1.0f; - }]; - + if(self.focused){ + [self.role rotate]; } } - - -(void)resetSubviews{ + [_gestureEngine reset]; [_scroller reset]; [_selection reset]; diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController_Impl.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController_Impl.h deleted file mode 100644 index fbb5af8bd501..000000000000 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOMainViewController_Impl.h +++ /dev/null @@ -1,18 +0,0 @@ -// -*- 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 "MLOMainViewController.h" - -static const CGFloat TOP_BAR_HEIGHT =40.0f; - -@class MLOGestureEngine,MLORenderManager; -@interface MLOMainViewController () -@property MLOGestureEngine * gestureEngine; -@property MLORenderManager * renderManager; --(void) toggleExpand; -@end diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTopbarViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTopbarViewController.m index 0f5fe220a6df..03e8ec92d022 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTopbarViewController.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/MLOTopbarViewController.m @@ -7,7 +7,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #import "MLOTopbarViewController.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOMainViewController.h" #import "MLOButton.h" #import "MLOResourceImage.h" diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m index 28ca6357514f..45a4168fb692 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m @@ -7,7 +7,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #import "MLOScrollerData.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOGestureEngine_Impl.h" #import "MLOScrollerGridViewController.h" #import "MLOScrollerTooltip.h" diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOMagnifier.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOMagnifier.m index 3b7fbba593eb..18c39f6b9f8a 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOMagnifier.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOMagnifier.m @@ -6,7 +6,7 @@ // 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 "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOMagnifier.h" #import "MLOResourceImage.h" #import "MLORenderManager.h" diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionHandle.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionHandle.m index 30e60f84f870..56186676c456 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionHandle.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionHandle.m @@ -7,7 +7,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #import "MLOSelectionHandle.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOSelectionViewController_Impl.h" #import "MLOGestureEngine_Impl.h" #import "MLOResourceImage.h" diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionViewController.m index 84b2be0aba56..8e676c84da7d 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionViewController.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOSelectionViewController.m @@ -6,7 +6,7 @@ // 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 "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOSelectionViewController_Impl.h" #import "MLOContextualMenuFocus.h" #import "MLOSelectionHandle.h" diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOThesaurusViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOThesaurusViewController.m index 506e58654ddf..9ac21f8186dd 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOThesaurusViewController.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/selection/MLOThesaurusViewController.m @@ -8,7 +8,7 @@ #import "MLOThesaurusViewController.h" #import "MLOSelectionViewController_Impl.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOGestureEngine_Impl.h" static const CGFloat THESAURUS_PADDING = 100.0f; diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOFinder.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOFinder.m index 37d7887cbc64..a825e72b9e6c 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOFinder.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOFinder.m @@ -9,7 +9,7 @@ #import "MLOFinder.h" #import "MLOToolbarButton.h" #import "MLOButton.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOGestureEngine_Impl.h" #import "MLORenderManager.h" #import "MLOSubView.h" diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOToolbarViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOToolbarViewController.m index 65b17b19057e..4d8e7cca44eb 100644 --- a/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOToolbarViewController.m +++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/toolbar/MLOToolbarViewController.m @@ -11,7 +11,7 @@ #import "MLOToolbarButton.h" #import "MLOFinder.h" #import "MLOToolbarViewController_Impl.h" -#import "MLOMainViewController_Impl.h" +#import "MLOMainViewController_Friend.h" #import "MLOResourceImage.h" #import "MLOTopbarViewController.h" #import "MLOKeyboardManager.h" |