shorten the portait orientation check
authorkoda
Sun, 12 Feb 2012 10:08:58 +0100
changeset 6671 5532d5f6285c
parent 6670 d57fa21781ea
child 6672 4f728ccdd06b
shorten the portait orientation check
project_files/HedgewarsMobile/Classes/DefinesAndMacros.h
project_files/HedgewarsMobile/Classes/ExtraCategories.m
project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
project_files/HedgewarsMobile/Classes/WeaponCellView.m
--- a/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Sat Feb 11 19:24:09 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Sun Feb 12 10:08:58 2012 +0100
@@ -75,6 +75,7 @@
 #define MSG_DIDUNLOAD()         DLog(@"unloaded");
 
 #define IS_IPAD()               (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+#define IS_ON_PORTRAIT()        (IS_IPAD() && UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
 #define IS_NOT_POWERFUL(x)      ([x hasPrefix:@"iPhone1"] || [x hasPrefix:@"iPod1,1"] || [x hasPrefix:@"iPod2,1"])
 #define IS_NOT_VERY_POWERFUL(x) ([x hasPrefix:@"iPad1"] || [x hasPrefix:@"iPhone2"] || [x hasPrefix:@"iPod3"] || [x hasPrefix:@"iPod4"])
 #define IS_VERY_POWERFUL(x)     (IS_NOT_POWERFUL(x) == NO && IS_NOT_VERY_POWERFUL(x) == NO)
--- a/project_files/HedgewarsMobile/Classes/ExtraCategories.m	Sat Feb 11 19:24:09 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/ExtraCategories.m	Sun Feb 12 10:08:58 2012 +0100
@@ -36,7 +36,7 @@
 
 -(CGRect) safeBounds {
     CGRect original = [self bounds];
-    if (IS_IPAD() && UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
+    if (IS_ON_PORTRAIT())
         return original;
     else
         return CGRectMake(original.origin.x, original.origin.y, original.size.height, original.size.width);
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Sat Feb 11 19:24:09 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Sun Feb 12 10:08:58 2012 +0100
@@ -189,7 +189,7 @@
     if (0 == [indexPath section])
         return aTableView.rowHeight;
     else
-        return UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ? 208 : 120;
+        return IS_ON_PORTRAIT() ? 208 : 120;
 }
 
 -(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
--- a/project_files/HedgewarsMobile/Classes/WeaponCellView.m	Sat Feb 11 19:24:09 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/WeaponCellView.m	Sun Feb 12 10:08:58 2012 +0100
@@ -220,19 +220,19 @@
             str = NSLocalizedString(@"Initial quantity",@"ammo selection");
             break;
         case 200:
-            if (IS_IPAD() && (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])))
+            if (IS_ON_PORTRAIT())
                 str = NSLocalizedString(@"Probability in crates",@"ammo selection");
             else
                 str = NSLocalizedString(@"Presence probability in crates",@"ammo selection");
             break;
         case 300:
-            if (IS_IPAD() && (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])))
+            if (IS_ON_PORTRAIT())
                 str = NSLocalizedString(@"Weapon delay",@"ammo selection");
             else
                 str = NSLocalizedString(@"Turns before this weapon becomes usable",@"ammo selection");
             break;
         case 400:
-            if (IS_IPAD() && (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])))
+            if (IS_ON_PORTRAIT())
                 str = NSLocalizedString(@"Quantity per crate",@"ammo selection");
             else
                 str = NSLocalizedString(@"Quantity you will find in a crate",@"ammo selection");