summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-10-13 20:45:16 +0300
committerTor Lillqvist <tml@collabora.com>2013-10-13 23:17:38 +0300
commite9f260b38076ce56f131914cfb5ece242eb1225c (patch)
treedb04b616a00931ab15cee70975738191bbdafca1 /ios
parent2b1329663a2034bfd622d9227573421b10bdad15 (diff)
Minor refactoring of iOS code
Rename functions so that functions called by the UI layer for actions to happen in the LO layer and functions called by the LO layer for things to happen in the UI layer use different prefixes. Move declarations to the generic <touch/touch.h> and avoid iOS-specific types in the API. Change-Id: Ieb8979065e02a87c4a415c934163265f2790d011
Diffstat (limited to 'ios')
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/AppDelegate.m25
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/View.h1
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/View.m18
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/ViewController.m2
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/lo.mm3
5 files changed, 24 insertions, 25 deletions
diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
index 7e3a0a900c57..dddf3acd458b 100644
--- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
+++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
@@ -8,7 +8,6 @@
#import <UIKit/UIKit.h>
-#include <osl/detail/ios-bootstrap.h>
#include <touch/touch.h>
#import "AppDelegate.h"
@@ -69,9 +68,9 @@ static View *theView;
NSLog(@"statusBarOrientation: %ld", (long) [[UIApplication sharedApplication] statusBarOrientation]);
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
- lo_set_view_size(applicationFrame.size.height, applicationFrame.size.width);
+ touch_lo_set_view_size(applicationFrame.size.height, applicationFrame.size.width);
else
- lo_set_view_size(applicationFrame.size.width, applicationFrame.size.height);
+ touch_lo_set_view_size(applicationFrame.size.width, applicationFrame.size.height);
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];
@@ -90,7 +89,7 @@ static View *theView;
@autoreleasepool {
lo_initialize();
- lo_runMain();
+ touch_lo_runMain();
}
}
@@ -100,7 +99,7 @@ static View *theView;
assert(textView == theView->textView);
for (NSUInteger i = 0; i < [text length]; i++)
- lo_keyboard_input([text characterAtIndex: i]);
+ touch_lo_keyboard_input([text characterAtIndex: i]);
return NO;
}
@@ -142,9 +141,9 @@ static View *theView;
NSLog(@"statusBarOrientation: %ld", (long) [[UIApplication sharedApplication] statusBarOrientation]);
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
- lo_set_view_size(applicationFrame.size.height, applicationFrame.size.width);
+ touch_lo_set_view_size(applicationFrame.size.height, applicationFrame.size.width);
else
- lo_set_view_size(applicationFrame.size.width, applicationFrame.size.height);
+ touch_lo_set_view_size(applicationFrame.size.width, applicationFrame.size.height);
}
- (void)keyboardWillShow:(NSNotification *)note
@@ -167,7 +166,7 @@ static View *theView;
NSLog(@"keyboardDidHide");
- lo_keyboard_did_hide();
+ touch_lo_keyboard_did_hide();
}
@end
@@ -176,23 +175,23 @@ static View *theView;
// CocoaTouch activity to happen on the GUI thread. Use
// dispatch_async() consistently.
-void lo_damaged(CGRect rect)
+void touch_ui_damaged(int minX, int minY, int width, int height)
{
- (void) rect;
+ CGRect rect = CGRectMake(minX, minY, width, height);
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);
+ // NSLog(@"lo_damaged: %dx%d@(%d,%d)", width, height, minX, minY);
}
-void lo_show_keyboard()
+void touch_ui_show_keyboard()
{
dispatch_async(dispatch_get_main_queue(), ^{
[theView->textView becomeFirstResponder];
});
}
-void lo_hide_keyboard()
+void touch_ui_hide_keyboard()
{
dispatch_async(dispatch_get_main_queue(), ^{
[theView->textView resignFirstResponder];
diff --git a/ios/experimental/LibreOffice/LibreOffice/View.h b/ios/experimental/LibreOffice/LibreOffice/View.h
index 7fd47d1250c1..f036c488c338 100644
--- a/ios/experimental/LibreOffice/LibreOffice/View.h
+++ b/ios/experimental/LibreOffice/LibreOffice/View.h
@@ -19,7 +19,6 @@
- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer;
- (void)longPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer;
-
@end
// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/experimental/LibreOffice/LibreOffice/View.m b/ios/experimental/LibreOffice/LibreOffice/View.m
index 99d57e97cc49..baab0a6d29d0 100644
--- a/ios/experimental/LibreOffice/LibreOffice/View.m
+++ b/ios/experimental/LibreOffice/LibreOffice/View.m
@@ -8,7 +8,7 @@
#import "View.h"
-#include <osl/detail/ios-bootstrap.h>
+#include <touch/touch.h>
@implementation View
@@ -40,10 +40,10 @@
CGContextScaleCTM(context, 1, -1);
break;
}
- lo_render_windows(context, rect);
+ touch_lo_render_windows(context, rect.origin.y, rect.origin.y, rect.size.width, rect.size.height);
CGContextRestoreGState(context);
- // NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: startDate]);
+ // NSLog(@"drawRect: touch_lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: startDate]);
}
- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer
@@ -53,7 +53,7 @@
NSLog(@"tapGesture: at: (%d,%d)", (int)location.x, (int)location.y);
- lo_tap(location.x, location.y);
+ touch_lo_tap(location.x, location.y);
[self->textView becomeFirstResponder];
} else {
@@ -73,7 +73,7 @@
NSLog(@"panGesture: pan (delta): (%d,%d)", deltaX, deltaY);
- lo_pan(deltaX, deltaY);
+ touch_lo_pan(deltaX, deltaY);
}
previousX = translation.x;
@@ -87,11 +87,11 @@
NSLog(@"pinchGesture: pinch: (%f) cords (%d,%d)", (float)scale, (int)location.x, (int)location.y );
- lo_zoom((int)location.x, (int)location.y, (float)scale);
+ touch_lo_zoom((int)location.x, (int)location.y, (float)scale);
// to reset the gesture scaling
if (gestureRecognizer.state==UIGestureRecognizerStateEnded) {
- lo_zoom(1, 1, 0.0f);
+ touch_lo_zoom(1, 1, 0.0f);
}
}
@@ -104,8 +104,8 @@
NSLog(@"longPressGesture: state %d cords (%d,%d)",state ,(int)point.x,(int)point.y);
if (state == UIGestureRecognizerStateEnded) {
- lo_tap(point.x, point.y);
- lo_tap(point.x, point.y);
+ touch_lo_tap(point.x, point.y);
+ touch_lo_tap(point.x, point.y);
}
}
diff --git a/ios/experimental/LibreOffice/LibreOffice/ViewController.m b/ios/experimental/LibreOffice/LibreOffice/ViewController.m
index a7977af92d5a..a79c6007c6b9 100644
--- a/ios/experimental/LibreOffice/LibreOffice/ViewController.m
+++ b/ios/experimental/LibreOffice/LibreOffice/ViewController.m
@@ -9,7 +9,7 @@
#import "ViewController.h"
-#include <osl/detail/ios-bootstrap.h>
+#include <touch/touch.h>
#import "lo.h"
diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm
index f65c532f70c6..d1c0f2dead58 100644
--- a/ios/experimental/LibreOffice/LibreOffice/lo.mm
+++ b/ios/experimental/LibreOffice/LibreOffice/lo.mm
@@ -12,8 +12,9 @@
#import <UIKit/UIKit.h>
#include <postmac.h>
-#include <osl/detail/ios-bootstrap.h>
+#include <osl/detail/component-mapping.h>
#include <osl/process.h>
+#include <touch/touch.h>
extern "C" {
extern void * analysis_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );