Permalink
Browse files

more concise #elif

  • Loading branch information...
davidbitton committed Mar 18, 2012
1 parent d1d1bba commit b2ad2fd24a759a5c8e9f590e18fda442710c4a2c
Showing with 15 additions and 15 deletions.
  1. +13 −13 src/FBDialog.m
  2. +1 −1 src/FBRequest.h
  3. +1 −1 src/FBRequest.m
View
@@ -23,7 +23,7 @@
#if TARGET_OS_IPHONE
int const FBFlexibleWidth = UIViewAutoresizingFlexibleWidth;
int const FBFlexibleHeight = UIViewAutoresizingFlexibleHeight;
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
int const FBFlexibleWidth = NSViewWidthSizable;
int const FBFlexibleHeight = NSViewHeightSizable;
#endif
@@ -88,7 +88,7 @@ - (void)addRoundedRectToPath:(CGContextRef)context rect:(CGRect)rect radius:(flo
- (void)drawRect:(CGRect)rect fill:(const CGFloat*)fillColors radius:(CGFloat)radius {
#if TARGET_OS_IPHONE
CGContextRef context = UIGraphicsGetCurrentContext();
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
#endif
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
@@ -111,7 +111,7 @@ - (void)drawRect:(CGRect)rect fill:(const CGFloat*)fillColors radius:(CGFloat)ra
- (void)strokeLines:(CGRect)rect stroke:(const CGFloat*)strokeColor {
#if TARGET_OS_IPHONE
CGContextRef context = UIGraphicsGetCurrentContext();
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
#endif
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
@@ -305,7 +305,7 @@ - (void)dismiss:(BOOL)animated {
[self postDismissCleanup];
#if TARGET_OS_IPHONE
}
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
[NSApp endSheet:_sheet];
#endif
}
@@ -365,7 +365,7 @@ - (id)init {
_webView = [[FBWebView alloc] initWithFrame:CGRectMake(kPadding, kPadding, 480, 480)];
#if TARGET_OS_IPHONE
_webView.delegate = self;
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
_webView.resourceLoadDelegate = self;
_webView.frameLoadDelegate = self;
#endif
@@ -404,7 +404,7 @@ - (id)init {
_spinner.autoresizingMask =
UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin
| UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
NSColor* color = [NSColor colorWithCalibratedRed:167.0/255 green:184.0/255 blue:216.0/255 alpha:1];
_closeButton = [[[NSButton alloc] init] retain];
[_closeButton setImage:closeImage];
@@ -432,7 +432,7 @@ - (id)init {
- (void)dealloc {
#if TARGET_OS_IPHONE
_webView.delegate = nil;
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
_webView.resourceLoadDelegate = nil;
[_sheet release];
#endif
@@ -503,15 +503,15 @@ - (void)showSpinner {
#if TARGET_OS_IPHONE
[_spinner startAnimating];
_spinner.center = _webView.center;
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
[_spinner startAnimation:self];
#endif
}
- (void)hideSpinner {
#if TARGET_OS_IPHONE
[_spinner stopAnimating];
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
[_spinner stopAnimation:self];
#endif
_spinner.hidden = YES;
@@ -559,7 +559,7 @@ - (BOOL)webView:(FBWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
return YES;
}
}
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
-(NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource {
return request;
}
@@ -569,7 +569,7 @@ -(void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL del
#endif
#if TARGET_OS_IPHONE
- (void)webViewDidFinishLoad:(FBWebView *)webView {
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
- (void)webView:(FBWebView *)webView resource:(id)identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource {
#endif
if (_isViewInvisible) {
@@ -588,7 +588,7 @@ - (void)webView:(FBWebView *)webView resource:(id)identifier didFinishLoadingFro
#if TARGET_OS_IPHONE
- (void)webView:(FBWebView *)webView didFailLoadWithError:(NSError *)error {
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
- (void)webView:(WebView *)webView resource:(id)identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource {
#endif
// 102 == WebKitErrorFrameLoadInterruptedByPolicyChange
@@ -703,7 +703,7 @@ - (void)loadURL:(NSString*)url get:(NSDictionary*)getParams {
#if TARGET_OS_IPHONE
[_webView loadRequest:request];
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
[[_webView mainFrame] loadRequest:request];
#endif
}
View
@@ -17,7 +17,7 @@
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
#import <AppKit/AppKit.h>
#endif
View
@@ -151,7 +151,7 @@ - (NSMutableData *)generatePostBody {
if ([dataParam isKindOfClass:[FBImage class]]) {
#if TARGET_OS_IPHONE
NSData* imageData = UIImagePNGRepresentation((FBImage*)dataParam);
-#elif TARGET_OS_MAC
+#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
NSBitmapImageRep *bits = [[(FBImage*)dataParam representations] objectAtIndex:0];
NSData* imageData = [bits representationUsingType:NSPNGFileType properties:nil];
#endif

0 comments on commit b2ad2fd

Please sign in to comment.