blob: 8daaccdbc9b1d083017b7acbd06af3eb853d6a52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
// -*- Mode: ObjC; 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 <UIKit/UIKit.h>
#include <osl/detail/ios-bootstrap.h>
#import "AppDelegate.h"
#import "ViewController.h"
#import "lo.h"
static UIView *theView;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
(void) application;
(void) launchOptions;
CGRect bounds = [[UIScreen mainScreen] bounds];
self.window = [[UIWindow alloc] initWithFrame:bounds];
self.window.backgroundColor = [UIColor whiteColor];
ViewController *vc = [[ViewController alloc] init];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
CGRect r = [self.window frame];
r.origin = CGPointMake(0, 0);
self.view = [[View alloc] initWithFrame: r];
self.view.clearsContextBeforeDrawing = NO;
vc.view = self.view;
theView = self.view;
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(tapGesture:)];
[self.window addGestureRecognizer: tapRecognizer];
lo_set_view_size(bounds.size.width, bounds.size.height);
NSThread* thread = [[NSThread alloc] initWithTarget:self
selector:@selector(threadMainMethod:)
object:nil];
[thread start];
return YES;
}
- (void)threadMainMethod:(id)argument
{
(void) argument;
@autoreleasepool {
lo_initialize();
lo_runMain();
}
}
- (void)applicationWillResignActive:(UIApplication *)application
{
(void) application;
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
(void) application;
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
(void) application;
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
(void) application;
}
- (void)applicationWillTerminate:(UIApplication *)application
{
(void) application;
}
@end
void lo_damaged(CGRect rect)
{
(void) rect;
dispatch_async(dispatch_get_main_queue(), ^{
[theView setNeedsDisplayInRect:rect];
});
// NSLog(@"lo_damaged: %dx%d@(%d,%d)", (int)rect.size.width, (int)rect.size.height, (int)rect.origin.x, (int)rect.origin.y);
}
// vim:set shiftwidth=4 softtabstop=4 expandtab:
|