added for infrastructure for ios tile testing app

Change-Id: Ie8ac64769c01c5e967a56844a69747ef4d4f20af
This commit is contained in:
Ptyl Dragon 2013-10-17 17:01:35 +02:00 committed by Jan Holesovsky
parent ae549ad1e6
commit 76a9ae801b
18 changed files with 478 additions and 0 deletions

View File

@ -0,0 +1,18 @@
// -*- 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

View File

@ -0,0 +1,22 @@
// -*- 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_Friend.h"
@class MLOAppRoleBase,MLOToolbarButton,MLOTopbarViewController,MLOToolbarViewController;
@interface MLOMainViewController ()
@property BOOL focused;
@property CGFloat topBarHeight;
@property UIView * flasher;
@property MLOTopbarViewController * topbar;
@property MLOToolbarViewController * toolbar;
@property MLOAppRoleBase * role;
-(void)resize;
-(void)resetSubviews;
@end

View File

@ -0,0 +1,16 @@
// -*- 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 "MLOViewController.h"
#import "MLOAppRoleProtocol.h"
@class MLOMainViewController,MLOAppRoleBase;
@interface MLOAppRoleBase : MLOViewController<MLOAppRoleProtocol>
@property MLOMainViewController * mainViewController;
@end

View File

@ -0,0 +1,13 @@
// -*- 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 "MLOAppRoleBase.h"
@implementation MLOAppRoleBase
@end

View File

@ -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 "MLOObject.h"
@class MLOAppRoleBase,MLOMainViewController;
@interface MLOAppRoleFactory : MLOObject
+(MLOAppRoleBase *) getInstanceWithMainViewController:(MLOMainViewController *) mainViewController;
@end

View File

@ -0,0 +1,35 @@
// -*- 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 "MLOAppRoleFactory.h"
#import "MLOAppRoleLoApp.h"
#import "MLOAppRoleTileTester.h"
#import "MLOMainViewController.h"
@implementation MLOAppRoleFactory
+(MLOAppRoleBase *) getInstanceWithMainViewController:(MLOMainViewController *) mainViewController{
MLOAppRoleBase * role;
switch (APP_ROLE) {
case LO_APP:
{
role = [MLOAppRoleLoApp new];
break;
}
case TILE_TESTER:
{
role= [MLOAppRoleTileTester new];
break;
}
}
role.mainViewController = mainViewController;
return role;
}
@end

View File

@ -0,0 +1,13 @@
// -*- 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 "MLOAppRoleBase.h"
@interface MLOAppRoleLoApp : MLOAppRoleBase
@end

View File

@ -0,0 +1,107 @@
// -*- 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 "MLOAppRoleLoApp.h"
#import "MLOMainViewController_Private.h"
#import "MLORenderManager.h"
#import "MLOGestureEngine.h"
#import "MLOToolbarViewController.h"
#import "MLOSelectionViewController.h"
#import "MLOScrollerViewController.h"
#import "MLOTopbarViewController.h"
#import "MLOKeyboardManager.h"
static const NSTimeInterval ROTATE_FLASH_DURATION=0.5f;
@implementation MLOAppRoleLoApp
-(void)initSubviews{
MLOMainViewController * main = [self mainViewController];
main.scroller = [[MLOScrollerViewController alloc] initWithMainViewController:main];
main.selection = [[MLOSelectionViewController alloc] initWithMainViewController: main];
main.toolbar = [[MLOToolbarViewController alloc] initWithMainViewController:main];
main.keyboard = [[MLOKeyboardManager alloc]initWithMainViewController:main];
main.flasher =[[UIView alloc] initWithFrame:CGRECT_ZERO];
main.flasher.alpha = 0.0f;
main.flasher.backgroundColor = [UIColor whiteColor];
main.gestureEngine = nil;
}
-(void)setWidth:(CGFloat) width height:(CGFloat) height{
[[self mainViewController].renderManager setWidth:width height:height];
}
-(void)addSubviews{
MLOMainViewController * main = [self mainViewController];
main.renderManager = [MLORenderManager getInstance];
[main resize];
[main.canvas addSubview: main.renderManager.view];
main.gestureEngine = [[MLOGestureEngine alloc] initWithMainViewController:main];
[main.toolbar addToMainViewController];
[main.scroller addToMainViewController];
[main.selection addToMainViewController];
[main.keyboard addToMainViewController];
}
-(void)rotate{
MLOMainViewController * main = self.mainViewController;
NSLog(@"MLO rotate");
main.renderManager.view.alpha= 0.0f;
[main resize];
[main.gestureEngine onRotate];
[main.topbar onRotate];
[main.scroller reset];
[main.scroller showLibreOffice];
[main.selection onRotate];
[main.toolbar onRotate];
[UIView animateWithDuration:ROTATE_FLASH_DURATION animations:^(void){
main.renderManager.view.alpha=1.0f;
}];
}
-(void)showLibreOffice{
[self.mainViewController.toolbar showLibreOffice];
}
-(void)hideLibreOffice{
MLOMainViewController * main = self.mainViewController;
[main.toolbar hideLibreOffice];
[main resetSubviews];
[main.gestureEngine hideLibreOffice];
[main.scroller hideLibreOffice];
[main.selection reset];
[main.keyboard hide];
}
-(void)initWindow:(UIWindow *) window{
MLOMainViewController * main = self.mainViewController;
[main.renderManager setWidth:main.view.frame.size.width height:main.view.frame.size.height];
[main.gestureEngine showLibreOffice:window];
}
@end

View File

@ -0,0 +1,21 @@
// -*- 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 <Foundation/Foundation.h>
@protocol MLOAppRoleProtocol <NSObject>
@optional
-(void)initSubviews;
-(void)setWidth:(CGFloat) width height:(CGFloat) height;
-(void)addSubviews;
-(void)rotate;
-(void)initWindow:(UIWindow *) window;
-(void)showLibreOffice;
-(void)hideLibreOffice;
@end

View File

@ -0,0 +1,13 @@
// -*- 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 "MLOAppRoleBase.h"
@interface MLOAppRoleTileTester : MLOAppRoleBase
@end

View File

@ -0,0 +1,70 @@
// -*- 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 "MLOAppRoleTileTester.h"
#import "MLOMainViewController_Private.h"
#import "MLOTopbarViewController.h"
#import "MLOTestingTileRendererViewController.h"
#import "MLOTestingTileParametersViewController.h"
@interface MLOAppRoleTileTester ()
@property MLOTestingTileRendererViewController * renderer;
@property MLOTestingTileParametersViewController * params;
@end
@implementation MLOAppRoleTileTester
-(void)initSubviews{
self.renderer = [[MLOTestingTileRendererViewController alloc] initWithTester:self];
self.params = [[MLOTestingTileParametersViewController alloc] initWithTester:self];
}
-(void)setWidth:(CGFloat) width height:(CGFloat) height{
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.renderer resize];
[self.params resize];
}
-(void)addSubviews{
[self.renderer addToMainViewController];
[self.params addToMainViewController];
[self.mainViewController resize];
}
-(void)rotate{
MLOMainViewController * main = [self mainViewController];
[main resize];
[main.topbar onRotate];
}
-(void)showLibreOffice{
}
-(void)hideLibreOffice{
}
-(void)initWindow:(UIWindow *) window{
}
@end

View File

@ -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 "MLOViewController.h"
#import "MLOTestingTileSubviewControllerProtocol.h"
@interface MLOTestingTileParametersViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
@end

View File

@ -0,0 +1,31 @@
// -*- 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 "MLOTestingTileParametersViewController.h"
@interface MLOTestingTileParametersViewController ()
@property MLOAppRoleTileTester * tester;
@end
@implementation MLOTestingTileParametersViewController
-(id)initWithTester:(MLOAppRoleTileTester *)tester{
self = [self init];
if(self){
self.tester = tester;
}
return self;
}
-(void)resize{
}
-(void)addToMainViewController{
}
@end

View File

@ -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 "MLOViewController.h"
#import "MLOTestingTileSubviewControllerProtocol.h"
@interface MLOTestingTileRendererViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
@end

View File

@ -0,0 +1,32 @@
// -*- 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 "MLOTestingTileRendererViewController.h"
#import "MLOAppRoleTileTester.h"
@interface MLOTestingTileRendererViewController ()
@property MLOAppRoleTileTester * tester;
@end
@implementation MLOTestingTileRendererViewController
-(id)initWithTester:(MLOAppRoleTileTester *)tester{
self = [self init];
if(self){
self.tester = tester;
}
return self;
}
-(void)resize{
}
-(void)addToMainViewController{
}
@end

View File

@ -0,0 +1,16 @@
// -*- 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 <Foundation/Foundation.h>
@class MLOAppRoleTileTester;
@protocol MLOTestingTileSubviewControllerProtocol <NSObject>
-(id)initWithTester:(MLOAppRoleTileTester *)tester;
-(void)addToMainViewController;
-(void)resize;
@end

View File

@ -0,0 +1,15 @@
//
// MLOTestingTileSubviewViewController.h
// ios_sharedlo
//
// Created by ptyl on 10/17/13.
// Copyright (c) 2013 LibreOffice.org. All rights reserved.
//
#import "MLOViewController.h"
@class MLOAppRoleTileTester;
@interface MLOTestingTileSubviewViewController : MLOViewController
@property MLOAppRoleTileTester * tester;
@end

View File

@ -0,0 +1,14 @@
//
// MLOTestingTileSubviewViewController.m
// ios_sharedlo
//
// Created by ptyl on 10/17/13.
// Copyright (c) 2013 LibreOffice.org. All rights reserved.
//
#import "MLOTestingTileSubviewViewController.h"
@implementation MLOTestingTileSubviewViewController
@end