# HG changeset patch # User koda # Date 1318207801 -7200 # Node ID 485cfecadc9aa72cb2d30c9700781317744577a6 # Parent 443cce9e060f317fd62b4174cc147dd32a25fc4f HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/GameConfigViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPad.xib Mon Oct 10 02:50:01 2011 +0200 @@ -0,0 +1,1105 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 292 + {1024, 768} + + NO + YES + NO + IBIPadFramework + + NSImage + background.png + + + + + 292 + {{357, 17}, {309, 165}} + + NO + NO + IBIPadFramework + + NSImage + title~iphone.png + + + + + 292 + {{441, 702}, {142, 64}} + + NO + 1 + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + NSImage + startGameButton.png + + + + + 292 + {{20, 693}, {64, 64}} + + NO + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + backButton.png + + + + + 292 + {{940, 693}, {64, 64}} + + NO + 2 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + helpButton.png + + + + + 278 + {{0, 60}, {320, 620}} + + + 3 + MCAwAA + + NO + YES + IBIPadFramework + + + + 277 + {{337, 187}, {350, 505}} + + + NO + YES + IBIPadFramework + + + + 292 + {{269, 724}, {150, 23}} + + NO + IBIPadFramework + 0 + 0 + 0.05000000074505806 + 0.05000000074505806 + + + + 292 + {{121, 720}, {148, 30}} + + NO + YES + 7 + NO + IBIPadFramework + Label + + Helvetica-Oblique + 18 + 16 + + + 3 + MQA + + 2 + + + + 1 + 10 + 1 + + + {1024, 768} + + + YES + + 3 + + IBIPadFramework + + + NO + + 3 + + IBIPadFramework + YES + + + NO + + IBIPadFramework + YES + + + NO + MapConfigViewController-iPad + + IBIPadFramework + YES + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + 7 + + 35 + + + + buttonPressed: + + + 7 + + 36 + + + + buttonPressed: + + + 7 + + 37 + + + + teamConfigViewController + + + + 45 + + + + view + + + + 47 + + + + view + + + + 50 + + + + schemeWeaponConfigViewController + + + + 51 + + + + mapConfigViewController + + + + 57 + + + + slider + + + + 61 + + + + sizeLabel + + + + 65 + + + + sliderChanged: + + + 13 + + 66 + + + + sliderEndedChanging: + + + 7 + + 67 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + + + + + + + + 30 + + + Background + + + 31 + + + Title + + + 32 + + + Start Button + + + 33 + + + Back Button + + + 34 + + + Help Button + + + 44 + + + YES + + + + + 46 + + + YES + + + TeamConfigViewController View + + + 48 + + + + + 49 + + + SchemeWeaponConfigViewController View + + + 55 + + + + + 60 + + + Filter Slider + + + 64 + + + Filter Label + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 30.IBPluginDependency + 30.IBViewBoundsToFrameTransform + 31.IBPluginDependency + 31.IBViewBoundsToFrameTransform + 32.IBPluginDependency + 32.IBViewBoundsToFrameTransform + 33.IBPluginDependency + 33.IBViewBoundsToFrameTransform + 34.IBPluginDependency + 34.IBViewBoundsToFrameTransform + 44.CustomClassName + 44.IBEditorWindowLastContentRect + 44.IBPluginDependency + 46.IBPluginDependency + 46.IBViewBoundsToFrameTransform + 48.CustomClassName + 48.IBEditorWindowLastContentRect + 48.IBPluginDependency + 49.IBPluginDependency + 49.IBViewBoundsToFrameTransform + 55.CustomClassName + 55.IBEditorWindowLastContentRect + 55.IBPluginDependency + 60.IBPluginDependency + 60.IBViewBoundsToFrameTransform + 64.IBPluginDependency + 64.IBViewBoundsToFrameTransform + + + YES + GameConfigViewController + UIResponder + {{444, 287}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABAoAAAxLrgAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDtQAAxGNAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABD3wAAxLqgAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABByAAAxLmAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABEbEAAxLmAAA + + TeamConfigViewController + {{63, 355}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUOogABDOwAAA + + SchemeWeaponConfigViewController + {{84, 388}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAxHqAAA + + MapConfigViewController + {{126, 377}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUNRAABEMoAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAADCtgAAxDoAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 67 + + + + YES + + GameConfigViewController + UIViewController + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + id + id + + + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + + buttonPressed: + id + + + segmentPressed: + id + + + + + YES + + YES + mapConfigViewController + schemeWeaponConfigViewController + teamConfigViewController + + + YES + MapConfigViewController + SchemeWeaponConfigViewController + TeamConfigViewController + + + + YES + + YES + mapConfigViewController + schemeWeaponConfigViewController + teamConfigViewController + + + YES + + mapConfigViewController + MapConfigViewController + + + schemeWeaponConfigViewController + SchemeWeaponConfigViewController + + + teamConfigViewController + TeamConfigViewController + + + + + IBProjectSource + Classes/GameConfigViewController.h + + + + MapConfigViewController + UIViewController + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + id + id + id + id + + + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + + mapButtonPressed: + id + + + segmentedControlChanged: + id + + + sliderChanged: + id + + + sliderEndedChanging: + id + + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + UILabel + MapPreviewButtonView + UISegmentedControl + UILabel + UISlider + UITableView + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + + maxLabel + UILabel + + + previewButton + MapPreviewButtonView + + + segmentedControl + UISegmentedControl + + + sizeLabel + UILabel + + + slider + UISlider + + + tableView + UITableView + + + + + IBProjectSource + Classes/MapConfigViewController.h + + + + MapPreviewButtonView + UIButton + + delegate + id + + + delegate + + delegate + id + + + + IBProjectSource + Classes/MapPreviewButtonView.h + + + + SchemeWeaponConfigViewController + UIViewController + + IBProjectSource + Classes/SchemeWeaponConfigViewController.h + + + + TeamConfigViewController + UIViewController + + IBProjectSource + Classes/TeamConfigViewController.h + + + + UILabel + + IBProjectSource + Classes/HWUtils.h + + + + UITableView + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UISlider + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISlider.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + backButton.png + background.png + helpButton.png + startGameButton.png + title~iphone.png + + + YES + {64, 64} + {1024, 768} + {64, 64} + {142, 64} + {270, 150} + + + 132 + + diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/GameConfigViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPhone.xib Mon Oct 10 02:50:01 2011 +0200 @@ -0,0 +1,608 @@ + + + + 1056 + 10K540 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 292 + + YES + + + 266 + + YES + + + 292 + {{96, 8}, {270, 30}} + + NO + 12345 + IBCocoaTouchFramework + 2 + 4 + 0 + + YES + Map + Teams + Details + Help + + + YES + + + + + + + YES + + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + 1 + MC42IDAuNiAwLjYAA + + + + {{0, 276}, {480, 44}} + + NO + NO + IBCocoaTouchFramework + 1 + + YES + + Back + IBCocoaTouchFramework + 1 + + + + IBCocoaTouchFramework + + 5 + + + IBCocoaTouchFramework + + + + + IBCocoaTouchFramework + + 5 + + + 1 + Start + IBCocoaTouchFramework + 68 + 2 + + + + + + {480, 320} + + + 3 + MQA + + NO + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + + 17 + + + + buttonPressed: + + + + 23 + + + + segmentPressed: + + + 13 + + 29 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + 15 + + + YES + + + + + + + + + + 16 + + + + + 18 + + + + + 19 + + + + + 21 + + + YES + + + + + + 20 + + + + + 22 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 15.IBPluginDependency + 15.IBViewBoundsToFrameTransform + 16.IBPluginDependency + 18.IBPluginDependency + 19.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 20.IBPluginDependency + 22.IBPluginDependency + + + YES + GameConfigViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw58AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{131, 321}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 29 + + + + YES + + GameConfigViewController + UIViewController + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + id + id + + + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + + buttonPressed: + id + + + segmentPressed: + id + + + + + IBProjectSource + Classes/GameConfigViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UIToolbar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIToolbar.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + 132 + + diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/GameConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Mon Oct 10 02:50:01 2011 +0200 @@ -21,28 +21,25 @@ #import -@class HelpPageViewController; -@class MapConfigViewController; +@class SchemeWeaponConfigViewController; @class TeamConfigViewController; -@class SchemeWeaponConfigViewController; -@class GameInterfaceBridge; +@class MapConfigViewController; +@class HelpPageViewController; @interface GameConfigViewController : UIViewController { UIView *imgContainer; - HelpPageViewController *helpPage; - + + SchemeWeaponConfigViewController *schemeWeaponConfigViewController; + TeamConfigViewController *teamConfigViewController; MapConfigViewController *mapConfigViewController; - TeamConfigViewController *teamConfigViewController; - SchemeWeaponConfigViewController *schemeWeaponConfigViewController; - GameInterfaceBridge *interfaceBridge; + HelpPageViewController *helpPage; } @property (retain) UIView *imgContainer; +@property (nonatomic,retain) IBOutlet SchemeWeaponConfigViewController *schemeWeaponConfigViewController; +@property (nonatomic,retain) IBOutlet TeamConfigViewController *teamConfigViewController; +@property (nonatomic,retain) IBOutlet MapConfigViewController *mapConfigViewController; @property (nonatomic,retain) HelpPageViewController *helpPage; -@property (nonatomic,retain) MapConfigViewController *mapConfigViewController; -@property (nonatomic,retain) TeamConfigViewController *teamConfigViewController; -@property (nonatomic,retain) SchemeWeaponConfigViewController *schemeWeaponConfigViewController; -@property (nonatomic,retain) GameInterfaceBridge *interfaceBridge; -(IBAction) buttonPressed:(id) sender; -(IBAction) segmentPressed:(id) sender; diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Mon Oct 10 02:50:01 2011 +0200 @@ -28,13 +28,26 @@ @implementation GameConfigViewController -@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController, interfaceBridge; +@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return rotationManager(interfaceOrientation); } +/* +-(MapConfigViewController *)mapConfigViewController { + if (mapConfigViewController == nil) { + NSString *xib = IS_IPAD() ? @"MapConfigViewController-iPad" : @"MapConfigViewController-iPhone"; + MapConfigViewController *mcvc = [[MapConfigViewController alloc] initWithNibName:xib bundle:nil]; + [self.view addSubview:mcvc.view]; + self.mapConfigViewController = mcvc; + [mcvc release]; + } + return mapConfigViewController; +} +*/ + -(IBAction) buttonPressed:(id) sender { UIButton *theButton = (UIButton *)sender; @@ -84,28 +97,20 @@ } -(IBAction) segmentPressed:(id) sender { +/* UISegmentedControl *theSegment = (UISegmentedControl *)sender; [AudioManagerController playSelectSound]; switch (theSegment.selectedSegmentIndex) { case 0: - // this init here is just aestetic as this controller was already set up in viewDidLoad - if (mapConfigViewController == nil) { - mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; - [self.view addSubview:mapConfigViewController.view]; - } // this message is compulsory otherwise the table won't be loaded at all - [mapConfigViewController viewWillAppear:NO]; - [self.view bringSubviewToFront:mapConfigViewController.view]; + [self.mapConfigViewController viewWillAppear:NO]; + [self.view bringSubviewToFront:self.mapConfigViewController.view]; break; case 1: - if (teamConfigViewController == nil) { - teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.view addSubview:teamConfigViewController.view]; - } // this message is compulsory otherwise the table won't be loaded at all - [teamConfigViewController viewWillAppear:NO]; - [self.view bringSubviewToFront:teamConfigViewController.view]; + [self.teamConfigViewController viewWillAppear:NO]; + [self.view bringSubviewToFront:self.teamConfigViewController.view]; break; case 2: if (schemeWeaponConfigViewController == nil) { @@ -129,6 +134,7 @@ DLog(@"Nope"); break; } +*/ } -(BOOL) isEverythingSet { @@ -234,12 +240,9 @@ script,@"mission_command", nil]; - if (self.interfaceBridge == nil) { - GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; - self.interfaceBridge = bridge; - [bridge release]; - } - [self.interfaceBridge startLocalGame:gameDictionary]; + GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; + [bridge startLocalGame:gameDictionary]; + [bridge release]; } -(void) loadNiceHogs { @@ -300,48 +303,26 @@ self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); if (IS_IPAD()) { - // load other controllers and the background - if (self.mapConfigViewController == nil) - self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil]; + // the label for the filter slider + UILabel *filterLabel = [[UILabel alloc] initWithFrame:CGRectMake(116, 714, 310, 40) + andTitle:nil + withBorderWidth:2.0f]; + [self.view insertSubview:filterLabel belowSubview:self.mapConfigViewController.slider]; + [filterLabel release]; - UILabel *theLabel; - // top right column (map) - theLabel = [[UILabel alloc] initWithFrame:CGRectMake(714, 14, 300, 190) andTitle:nil withBorderWidth:2.3f]; - [self.mapConfigViewController.view addSubview:theLabel]; - releaseAndNil(theLabel); - // bottom left - theLabel = [[UILabel alloc] initWithFrame:CGRectMake(116, 714, 310, 40) andTitle:nil withBorderWidth:2.0f]; - [self.mapConfigViewController.view addSubview:theLabel]; - releaseAndNil(theLabel); - // bottom right - theLabel = [[UILabel alloc] initWithFrame:CGRectMake(598, 714, 310, 40) - andTitle:NSLocalizedString(@" Max Hogs:",@"") - withBorderWidth:2.0f]; - theLabel.font = [UIFont italicSystemFontOfSize:[UIFont labelFontSize]]; - theLabel.textColor = [UIColor whiteColor]; - theLabel.textAlignment = UITextAlignmentLeft; - [self.mapConfigViewController.view addSubview:theLabel]; - releaseAndNil(theLabel); + // the label for max hogs + UILabel *maxLabel = [[UILabel alloc] initWithFrame:CGRectMake(598, 714, 310, 40) + andTitle:NSLocalizedString(@"Loading...",@"") + withBorderWidth:2.0f]; + maxLabel.font = [UIFont italicSystemFontOfSize:[UIFont labelFontSize]]; + maxLabel.textColor = [UIColor whiteColor]; + maxLabel.textAlignment = UITextAlignmentCenter; + [self.view addSubview:maxLabel]; + self.mapConfigViewController.maxLabel = maxLabel; + [maxLabel release]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.maxLabel]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.sizeLabel]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.segmentedControl]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.previewButton]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.slider]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.tableView]; - - if (self.teamConfigViewController == nil) - self.teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.mapConfigViewController.view addSubview:self.teamConfigViewController.view]; - if (self.schemeWeaponConfigViewController == nil) - self.schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view]; - - self.mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); - self.schemeWeaponConfigViewController.view.frame = CGRectMake(0, 60, 320, 620); - self.teamConfigViewController.view.frame = CGRectMake(337, 187, 350, 505); - - self.mapConfigViewController.parentController = self; + // as this is loaded from a NIB we need to set its size and position + self.mapConfigViewController.view.frame = CGRectMake(704, 0, 320, 680); } else { // this is the visible controller if (self.mapConfigViewController == nil) @@ -351,7 +332,6 @@ [self.view addSubview:self.schemeWeaponConfigViewController.view]; } [self.view addSubview:self.mapConfigViewController.view]; - self.mapConfigViewController.externalController = schemeWeaponConfigViewController; [super viewDidLoad]; } @@ -390,28 +370,25 @@ } -(void) didReceiveMemoryWarning { + self.imgContainer = nil; + + if (self.mapConfigViewController.view.superview == nil) + self.mapConfigViewController = nil; if (self.teamConfigViewController.view.superview == nil) self.teamConfigViewController = nil; if (self.schemeWeaponConfigViewController.view.superview == nil) self.schemeWeaponConfigViewController = nil; if (self.helpPage.view.superview == nil) self.helpPage = nil; - if (self.mapConfigViewController.view.superview == nil) - self.mapConfigViewController = nil; - - self.imgContainer = nil; - // don't nil this one or it won't be able to send messages - //self.interfaceBridge = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } -(void) viewDidUnload { self.imgContainer = nil; - self.interfaceBridge = nil; + self.schemeWeaponConfigViewController = nil; + self.teamConfigViewController = nil; self.mapConfigViewController = nil; - self.teamConfigViewController = nil; - self.schemeWeaponConfigViewController = nil; self.helpPage = nil; MSG_DIDUNLOAD(); [super viewDidUnload]; @@ -419,10 +396,9 @@ -(void) dealloc { releaseAndNil(imgContainer); - releaseAndNil(interfaceBridge); + releaseAndNil(schemeWeaponConfigViewController); + releaseAndNil(teamConfigViewController); releaseAndNil(mapConfigViewController); - releaseAndNil(teamConfigViewController); - releaseAndNil(schemeWeaponConfigViewController); releaseAndNil(helpPage); [super dealloc]; } diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/GameConfigViewController.xib --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.xib Sun Oct 09 20:03:04 2011 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,608 +0,0 @@ - - - - 1056 - 10K540 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 266 - - YES - - - 292 - {{96, 8}, {270, 30}} - - NO - 12345 - IBCocoaTouchFramework - 2 - 4 - 0 - - YES - Map - Teams - Details - Help - - - YES - - - - - - - YES - - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - 1 - MC42IDAuNiAwLjYAA - - - - {{0, 276}, {480, 44}} - - NO - NO - IBCocoaTouchFramework - 1 - - YES - - Back - IBCocoaTouchFramework - 1 - - - - IBCocoaTouchFramework - - 5 - - - IBCocoaTouchFramework - - - - - IBCocoaTouchFramework - - 5 - - - 1 - Start - IBCocoaTouchFramework - 68 - 2 - - - - - - {480, 320} - - - 3 - MQA - - NO - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - - 17 - - - - buttonPressed: - - - - 23 - - - - segmentPressed: - - - 13 - - 29 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - 15 - - - YES - - - - - - - - - - 16 - - - - - 18 - - - - - 19 - - - - - 21 - - - YES - - - - - - 20 - - - - - 22 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 15.IBPluginDependency - 15.IBViewBoundsToFrameTransform - 16.IBPluginDependency - 18.IBPluginDependency - 19.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 20.IBPluginDependency - 22.IBPluginDependency - - - YES - GameConfigViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw58AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{131, 321}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 29 - - - - YES - - GameConfigViewController - UIViewController - - YES - - YES - buttonPressed: - segmentPressed: - - - YES - id - id - - - - YES - - YES - buttonPressed: - segmentPressed: - - - YES - - buttonPressed: - id - - - segmentPressed: - id - - - - - IBProjectSource - Classes/GameConfigViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UIToolbar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIToolbar.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 132 - - diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/HoldTableViewCell.h --- a/project_files/HedgewarsMobile/Classes/HoldTableViewCell.h Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.h Mon Oct 10 02:50:01 2011 +0200 @@ -23,7 +23,7 @@ @protocol HoldTableViewCellDelegate --(void) holdAction:(NSString *)content; +-(void) holdAction:(NSString *)content onTable:(UITableView *)aTableView; @end diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/HoldTableViewCell.m --- a/project_files/HedgewarsMobile/Classes/HoldTableViewCell.m Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.m Mon Oct 10 02:50:01 2011 +0200 @@ -58,8 +58,8 @@ } -(void) holdAction { - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:)]) - [self.delegate holdAction:self.textLabel.text]; + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:onTable:)]) + [self.delegate holdAction:self.textLabel.text onTable:(UITableView *)self.superview]; } -(void) dealloc { diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/MainMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Mon Oct 10 02:50:01 2011 +0200 @@ -151,7 +151,7 @@ switch (button.tag) { case 0: if (nil == self.gameConfigViewController) { - xib = IS_IPAD() ? nil : @"GameConfigViewController"; + xib = IS_IPAD() ? @"GameConfigViewController-iPad" : @"GameConfigViewController-iPhone"; GameConfigViewController *gcvc = [[GameConfigViewController alloc] initWithNibName:xib bundle:nil]; gcvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib Mon Oct 10 02:50:01 2011 +0200 @@ -42,23 +42,10 @@ 274 YES - - - 292 - {1024, 768} - - NO - NO - IBIPadFramework - - NSImage - background.png - - 289 - {{724, 166}, {280, 30}} + {{20, 166}, {280, 30}} NO IBIPadFramework @@ -105,90 +92,12 @@ MC42NjY2NjY2NjY3AA - - - 292 - {{263, 723}, {149, 23}} - - NO - IBIPadFramework - 0 - 0 - 0.05000000074505806 - 0.05000000074505806 - - - - 292 - {{778, 724}, {42, 21}} - - NO - YES - 7 - NO - IBIPadFramework - ... - - Helvetica-Bold - 17 - 16 - - - 1 - MSAxIDEAA - - - 1 - 10 - 1 - - - - 292 - {{112, 720}, {145, 29}} - - NO - YES - 7 - NO - IBIPadFramework - Label - - Helvetica-Oblique - 18 - 16 - - - 3 - MQA - - 2 - - - - 1 - 10 - 1 - - - - 292 - {{357, 17}, {309, 165}} - - NO - NO - IBIPadFramework - - NSImage - title~iphone.png - - 274 - {{704, 214}, {320, 466}} + {{0, 214}, {320, 554}} - + 3 MCAwAA @@ -204,88 +113,12 @@ YES 44 - - - 292 - {{441, 702}, {142, 64}} - - NO - 1 - IBIPadFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - NSImage - startGameButton.png - - - - - 292 - {{20, 693}, {64, 64}} - - NO - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - backButton.png - - - - - 292 - {{940, 693}, {64, 64}} - - NO - 2 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - helpButton.png - - - {1024, 768} + {320, 768} - - 2 - MC44MzkyMTU3NTU1IDAuODQ3MDU4ODkyMyAwLjg3MDU4ODMwMjYAA - + + NO + YES 3 @@ -305,40 +138,6 @@ - maxLabel - - - - 16 - - - - sizeLabel - - - - 18 - - - - sliderChanged: - - - 13 - - 19 - - - - sliderEndedChanging: - - - 7 - - 20 - - - segmentedControl @@ -356,14 +155,6 @@ - slider - - - - 23 - - - dataSource @@ -386,33 +177,6 @@ 69 - - - buttonPressed: - - - 7 - - 73 - - - - buttonPressed: - - - 7 - - 74 - - - - buttonPressed: - - - 7 - - 77 - @@ -439,69 +203,21 @@ YES - - - - - - - - - 75 - - - - - 72 - - - - - 70 - - - - 66 - 57 - - - - - 17 - - - - - 11 - - - - - 8 - - - - 7 - - 50 - - - @@ -512,57 +228,25 @@ -2.CustomClassName 1.IBEditorWindowLastContentRect 1.IBPluginDependency - 11.IBPluginDependency - 17.IBPluginDependency - 50.IBPluginDependency - 50.IBViewBoundsToFrameTransform - 57.IBPluginDependency - 57.IBViewBoundsToFrameTransform 66.IBPluginDependency + 66.IBViewBoundsToFrameTransform 7.IBPluginDependency 7.IBViewBoundsToFrameTransform - 70.IBPluginDependency - 70.IBViewBoundsToFrameTransform - 72.IBPluginDependency - 72.IBViewBoundsToFrameTransform - 75.IBPluginDependency - 75.IBViewBoundsToFrameTransform - 8.IBPluginDependency YES MapConfigViewController UIResponder - {{141, 288}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAxD+AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDsoAAwz8AAA - + {{289, 181}, {320, 768}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABENUAAw0IAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABD3IAAxD8AAA + P4AAAL+AAABEMAAAxCmAAA com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABBIAAAxDzAAA + P4AAAL+AAABBoAAAw0IAAA - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABEbsAAxDzAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -581,7 +265,7 @@ - 122 + 126 @@ -593,8 +277,7 @@ YES YES - buttonPressed: - mapButtonPressed + mapButtonPressed: segmentedControlChanged: sliderChanged: sliderEndedChanging: @@ -605,15 +288,13 @@ id id id - id YES YES - buttonPressed: - mapButtonPressed + mapButtonPressed: segmentedControlChanged: sliderChanged: sliderEndedChanging: @@ -621,11 +302,7 @@ YES - buttonPressed: - id - - - mapButtonPressed + mapButtonPressed: id @@ -862,14 +539,6 @@ - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - UILabel UIView @@ -1003,25 +672,6 @@ YES ../Hedgewars.xcodeproj 3 - - YES - - YES - backButton.png - background.png - helpButton.png - startGameButton.png - title~iphone.png - - - YES - {64, 64} - {1024, 768} - {64, 64} - {142, 64} - {270, 150} - - 132 diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/MapConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Mon Oct 10 02:50:01 2011 +0200 @@ -22,8 +22,6 @@ #import #import "MapPreviewButtonView.h" -@class SchemeWeaponConfigViewController; -@class GameConfigViewController; @interface MapConfigViewController : UIViewController { NSInteger oldValue; // for the slider @@ -51,15 +49,13 @@ // internal objects NSIndexPath *lastIndexPath; NSArray *dataSourceArray; - - // controller for mission state - SchemeWeaponConfigViewController *externalController; - GameConfigViewController *parentController; } +@property (nonatomic,assign) NSInteger oldValue; +@property (nonatomic,assign) NSInteger oldPage; +@property (nonatomic,assign) BOOL busy; @property (nonatomic,assign) NSInteger maxHogs; -@property (nonatomic,assign) BOOL busy; @property (nonatomic,retain) NSString *seedCommand; @property (nonatomic,retain) NSString *templateFilterCommand; @property (nonatomic,retain) NSString *mapGenCommand; @@ -78,11 +74,6 @@ @property (nonatomic,retain) NSIndexPath *lastIndexPath; @property (nonatomic,retain) NSArray *dataSourceArray; -@property (nonatomic,assign) SchemeWeaponConfigViewController *externalController; -@property (nonatomic,assign) GameConfigViewController *parentController; - - --(IBAction) buttonPressed:(id) sender; -(IBAction) mapButtonPressed:(id) sender; -(IBAction) sliderChanged:(id) sender; @@ -91,7 +82,7 @@ -(void) turnOnWidgets; -(void) turnOffWidgets; --(void) setLabelText:(NSString *)str; +-(void) setMaxLabelText:(NSString *)str; -(void) updatePreview; @end diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/MapConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Mon Oct 10 02:50:01 2011 +0200 @@ -31,7 +31,7 @@ @implementation MapConfigViewController @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand, missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy, - externalController, parentController; + oldPage, oldValue; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -45,7 +45,7 @@ -(void) updatePreview { // don't generate a new preview while it's already generating one - if (busy) + if (self.busy) return; // generate a seed @@ -76,22 +76,24 @@ busy = YES; self.previewButton.alpha = 0.5f; self.previewButton.enabled = NO; - self.maxLabel.text = @"..."; + self.maxLabel.text = NSLocalizedString(@"Loading...",@"");; self.segmentedControl.enabled = NO; self.slider.enabled = NO; } +#pragma mark - +#pragma mark MapPreviewButtonView delegate methods -(void) turnOnWidgets { self.previewButton.alpha = 1.0f; self.previewButton.enabled = YES; self.segmentedControl.enabled = YES; self.slider.enabled = YES; - busy = NO; + self.busy = NO; } --(void) setLabelText:(NSString *)str { +-(void) setMaxLabelText:(NSString *)str { self.maxHogs = [str intValue]; - self.maxLabel.text = str; + self.maxLabel.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Max Hogs:",@""),str]; } -(NSDictionary *)getDataForEngine { @@ -162,13 +164,12 @@ // if the number is not set we keep 18 standard; // sometimes it's not set but there are trailing characters, we get around them with the second equation + NSString *max; if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0) - maxHogs = [[split objectAtIndex:1] intValue]; + max = [split objectAtIndex:1]; else - maxHogs = 18; - NSString *max = [[NSString alloc] initWithFormat:@"%d",maxHogs]; - self.maxLabel.text = max; - [max release]; + max = @"18"; + [self setMaxLabelText:max]; self.themeCommand = [NSString stringWithFormat:@"etheme %@", [split objectAtIndex:0]]; self.staticMapCommand = [NSString stringWithFormat:@"emap %@", [source objectAtIndex:index]]; @@ -310,7 +311,7 @@ mission = @""; [self sliderChanged:nil]; self.slider.enabled = YES; - [externalController fillSections]; + [SchemeWeaponConfigViewController fillInstanceSections]; break; case 1: // Map @@ -320,7 +321,7 @@ mission = @""; self.slider.enabled = NO; self.sizeLabel.text = NSLocalizedString(@"No filter",@""); - [externalController fillSections]; + [SchemeWeaponConfigViewController fillInstanceSections]; break; case 2: // Maze @@ -329,7 +330,7 @@ mission = @""; [self sliderChanged:nil]; self.slider.enabled = YES; - [externalController fillSections]; + [SchemeWeaponConfigViewController fillInstanceSections]; break; case 3: // Mission @@ -339,7 +340,7 @@ mission = @""; self.slider.enabled = NO; self.sizeLabel.text = NSLocalizedString(@"No filter",@""); - [externalController emptySections]; + [SchemeWeaponConfigViewController emptyInstanceSections]; break; default: @@ -357,10 +358,6 @@ oldPage = newPage; } --(IBAction) buttonPressed:(id) sender { - [self.parentController buttonPressed:sender]; -} - #pragma mark - #pragma mark view management -(NSArray *) dataSourceArray { @@ -412,7 +409,7 @@ -(MapPreviewButtonView *)previewButton { if (previewButton == nil) { - MapPreviewButtonView *preview = [[MapPreviewButtonView alloc] initWithFrame:CGRectMake(736, 26, 256, 128)]; + MapPreviewButtonView *preview = [[MapPreviewButtonView alloc] initWithFrame:CGRectMake(32, 26, 256, 128)]; preview.delegate = self; [preview addTarget:self action:@selector(mapButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:preview]; @@ -427,23 +424,18 @@ srandom(time(NULL)); + /* CGSize screenSize = [[UIScreen mainScreen] bounds].size; self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); + */ // initialize some "default" values - self.sizeLabel.text = NSLocalizedString(@"All",@""); self.slider.value = 0.05f; - oldValue = 5; - - busy = NO; - self.lastIndexPath = [NSIndexPath indexPathForRow:-1 inSection:0]; - - // select a map at first because it's faster - done in IB - oldPage = 1; - if (self.segmentedControl.selectedSegmentIndex == 1) { - self.slider.enabled = NO; - self.sizeLabel.text = NSLocalizedString(@"No filter",@""); - } + self.slider.enabled = NO; + self.sizeLabel.text = NSLocalizedString(@"No filter",@""); + self.oldValue = 5; + self.busy = NO; + self.oldPage = self.segmentedControl.selectedSegmentIndex; self.templateFilterCommand = @"e$template_filter 0"; self.mazeSizeCommand = @"e$maze_size 0"; @@ -457,6 +449,10 @@ self.tableView.layer.borderWidth = 2.7f; self.tableView.layer.cornerRadius = 8; self.tableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0); + + UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 14, 300, 190) andTitle:nil withBorderWidth:2.3f]; + [self.view insertSubview:backLabel belowSubview:self.segmentedControl]; + [backLabel release]; } self.tableView.separatorColor = [UIColor whiteColor]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h --- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Mon Oct 10 02:50:01 2011 +0200 @@ -25,7 +25,7 @@ @protocol MapPreviewViewDelegate -(void) turnOnWidgets; --(void) setLabelText:(NSString *)string; +-(void) setMaxLabelText:(NSString *)string; -(NSDictionary *)getDataForEngine; @end diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m --- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Mon Oct 10 02:50:01 2011 +0200 @@ -223,15 +223,19 @@ #pragma mark - #pragma mark delegate -(void) turnOnWidgets { - [self.delegate turnOnWidgets]; + if ([self.delegate respondsToSelector:@selector(turnOnWidgets)]) + [self.delegate turnOnWidgets]; } -(void) setLabelText:(NSString *)string { - [self.delegate setLabelText:string]; + if ([self.delegate respondsToSelector:@selector(setMaxLabelText:)]) + [self.delegate setMaxLabelText:string]; } -(NSDictionary *)getDataForEngine { - return [self.delegate getDataForEngine]; + if ([self.delegate respondsToSelector:@selector(getDataForEngine)]) + return [self.delegate getDataForEngine]; + return nil; } @end diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Mon Oct 10 02:50:01 2011 +0200 @@ -22,7 +22,9 @@ #import -@interface SchemeWeaponConfigViewController : UITableViewController { +@interface SchemeWeaponConfigViewController : UIViewController { + UITableView *tableView; + NSArray *listOfSchemes; NSArray *listOfWeapons; NSArray *listOfScripts; @@ -37,9 +39,10 @@ NSString *scriptCommand; UISegmentedControl *topControl; - BOOL hideSections; + BOOL sectionsHidden; } +@property (nonatomic,retain) UITableView *tableView; @property (nonatomic,retain) NSArray *listOfSchemes; @property (nonatomic,retain) NSArray *listOfWeapons; @property (nonatomic,retain) NSArray *listOfScripts; @@ -51,9 +54,9 @@ @property (nonatomic,retain) NSString *selectedScript; @property (nonatomic,retain) NSString *scriptCommand; @property (nonatomic,retain) UISegmentedControl *topControl; -@property (assign) BOOL hideSections; +@property (nonatomic,assign) BOOL sectionsHidden; --(void) fillSections; --(void) emptySections; ++(void) fillInstanceSections; ++(void) emptyInstanceSections; @end diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Mon Oct 10 02:50:01 2011 +0200 @@ -25,9 +25,11 @@ #define LABEL_TAG 57423 +static SchemeWeaponConfigViewController *controllerInstance; + @implementation SchemeWeaponConfigViewController -@synthesize listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu, - selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, hideSections; +@synthesize tableView, listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu, + selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, sectionsHidden; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return rotationManager(interfaceOrientation); @@ -95,42 +97,44 @@ return topControl; } --(void) viewWillAppear:(BOOL) animated { - [super viewWillAppear:animated]; - [self.tableView reloadData]; -} - #pragma mark - #pragma mark View lifecycle -(void) viewDidLoad { - [super viewDidLoad]; + self.sectionsHidden = NO; - CGSize screenSize = [[UIScreen mainScreen] bounds].size; - self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); - + UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) + style:UITableViewStyleGrouped]; + aTableView.delegate = self; + aTableView.dataSource = self; if (IS_IPAD()) { - [self.tableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; - self.tableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; - self.tableView.layer.borderWidth = 2.7f; - self.tableView.layer.cornerRadius = 8; - self.tableView.contentInset = UIEdgeInsetsMake(5, 0, 5, 0); + [aTableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; + aTableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; + aTableView.layer.borderWidth = 2.7f; + aTableView.layer.cornerRadius = 8; + aTableView.contentInset = UIEdgeInsetsMake(5, 0, 5, 0); } else { UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"]; UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; [backgroundImage release]; - [self.tableView setBackgroundView:background]; + [aTableView setBackgroundView:background]; [background release]; } - self.tableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; - self.tableView.separatorColor = [UIColor whiteColor]; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + aTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; + aTableView.separatorColor = [UIColor whiteColor]; + aTableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableView = aTableView; + [aTableView release]; + [self.view addSubview:self.tableView]; + + [super viewDidLoad]; + controllerInstance = self; } #pragma mark - #pragma mark Table view data source -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return (self.hideSections ? 0 : 1); + return (self.sectionsHidden ? 0 : 1); } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { @@ -143,12 +147,12 @@ } // Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; NSInteger index = self.topControl.selectedSegmentIndex; NSInteger row = [indexPath row]; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; @@ -247,7 +251,6 @@ int index = [self.listOfSchemes indexOfObject:str]; self.selectedWeapon = str; self.lastIndexPath_we = [NSIndexPath indexPathForRow:index inSection:1]; - [self.tableView reloadData]; break; } } @@ -292,44 +295,41 @@ #pragma mark - #pragma mark called externally to empty or fill the sections completely --(void) fillSections { - if (self.hideSections == YES) { - self.hideSections = NO; - NSRange range; - range.location = 0; - range.length = 1; - NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; - [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade]; - self.tableView.scrollEnabled = YES; ++(void) fillInstanceSections { + if (controllerInstance.sectionsHidden == YES) { + controllerInstance.sectionsHidden = NO; + NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)]; + [controllerInstance.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade]; + controllerInstance.tableView.scrollEnabled = YES; - [[self.view viewWithTag:LABEL_TAG] removeFromSuperview]; + [[controllerInstance.view viewWithTag:LABEL_TAG] removeFromSuperview]; } } --(void) emptySections { - hideSections = YES; - NSRange range; - range.location = 0; - range.length = 1; - NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; - [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade]; - self.tableView.scrollEnabled = NO; ++(void) emptyInstanceSections { + if (controllerInstance.sectionsHidden == NO) { + controllerInstance.sectionsHidden = YES; + NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)]; + [controllerInstance.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade]; + controllerInstance.tableView.scrollEnabled = NO; - CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 60); - UILabel *theLabel = [[UILabel alloc] initWithFrame:frame - andTitle:NSLocalizedString(@"Missions don't need further configuration",@"")]; - theLabel.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2); - theLabel.numberOfLines = 2; - theLabel.tag = LABEL_TAG; + CGRect frame = CGRectMake(0, 0, controllerInstance.view.frame.size.width * 80/100, 60); + UILabel *theLabel = [[UILabel alloc] initWithFrame:frame + andTitle:NSLocalizedString(@"Missions don't need further configuration",@"")]; + theLabel.center = CGPointMake(controllerInstance.view.frame.size.width/2, controllerInstance.view.frame.size.height/2); + theLabel.numberOfLines = 2; + theLabel.tag = LABEL_TAG; - [self.view addSubview:theLabel]; - [theLabel release]; + [controllerInstance.view addSubview:theLabel]; + [theLabel release]; + } } #pragma mark - #pragma mark Memory management -(void) didReceiveMemoryWarning { if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) { + self.tableView = nil; self.lastIndexPath_sc = nil; self.lastIndexPath_we = nil; self.lastIndexPath_lu = nil; @@ -347,6 +347,7 @@ } -(void) viewDidUnload { + self.tableView = nil; self.listOfSchemes = nil; self.listOfWeapons = nil; self.listOfScripts = nil; @@ -363,6 +364,7 @@ } -(void) dealloc { + releaseAndNil(tableView); releaseAndNil(listOfSchemes); releaseAndNil(listOfWeapons); releaseAndNil(listOfScripts); diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/TeamConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Mon Oct 10 02:50:01 2011 +0200 @@ -22,17 +22,23 @@ #import #import "HoldTableViewCell.h" -@interface TeamConfigViewController : UITableViewController { + +@interface TeamConfigViewController : UIViewController { + UITableView *tableView; + NSInteger selectedTeamsCount; NSInteger allTeamsCount; NSMutableArray *listOfSelectedTeams; - NSMutableArray *listOfTeams; + NSMutableArray *listOfAllTeams; NSArray *cachedContentsOfDir; } -@property (nonatomic, retain) NSMutableArray *listOfTeams; -@property (nonatomic, retain) NSMutableArray *listOfSelectedTeams; -@property (nonatomic, retain) NSArray *cachedContentsOfDir; +@property (nonatomic,retain) UITableView *tableView; +@property (nonatomic,assign) NSInteger selectedTeamsCount; +@property (nonatomic,assign) NSInteger allTeamsCount; +@property (nonatomic,retain) NSMutableArray *listOfAllTeams; +@property (nonatomic,retain) NSMutableArray *listOfSelectedTeams; +@property (nonatomic,retain) NSArray *cachedContentsOfDir; @end diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Classes/TeamConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Mon Oct 10 02:50:01 2011 +0200 @@ -25,41 +25,51 @@ @implementation TeamConfigViewController -@synthesize listOfTeams, listOfSelectedTeams, cachedContentsOfDir; +@synthesize tableView, selectedTeamsCount, allTeamsCount, listOfAllTeams, listOfSelectedTeams, cachedContentsOfDir; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} #pragma mark - #pragma mark View lifecycle -(void) viewDidLoad { - [super viewDidLoad]; - +/* CGSize screenSize = [[UIScreen mainScreen] bounds].size; self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); - +*/ + UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) + style:UITableViewStyleGrouped]; + aTableView.delegate = self; + aTableView.dataSource = self; if (IS_IPAD()) { - [self.tableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; - self.tableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; - self.tableView.layer.borderWidth = 2.7f; - self.tableView.layer.cornerRadius = 8; - self.tableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0); + [aTableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; + aTableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; + aTableView.layer.borderWidth = 2.7f; + aTableView.layer.cornerRadius = 8; + aTableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0); } else { UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"]; UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; [backgroundImage release]; - [self.tableView setBackgroundView:background]; + [aTableView setBackgroundView:background]; [background release]; } - self.tableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; - self.tableView.separatorColor = [UIColor whiteColor]; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + aTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; + aTableView.separatorColor = [UIColor whiteColor]; + aTableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableView = aTableView; + [aTableView release]; + + [self.view addSubview:self.tableView]; + [super viewDidLoad]; } -(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL]; - // avoid overwriting selected teams when returning on this view if ([self.cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) { + self.cachedContentsOfDir = contentsOfDir; NSArray *colors = [HWUtils teamColors]; NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]]; for (int i = 0; i < [contentsOfDir count]; i++) { @@ -70,25 +80,19 @@ [array addObject:dict]; [dict release]; } - self.listOfTeams = array; + self.listOfAllTeams = array; [array release]; NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil]; self.listOfSelectedTeams = emptyArray; [emptyArray release]; - selectedTeamsCount = [self.listOfSelectedTeams count]; - allTeamsCount = [self.listOfTeams count]; + self.selectedTeamsCount = [self.listOfSelectedTeams count]; + self.allTeamsCount = [self.listOfAllTeams count]; + [self.tableView reloadData]; + } - NSArray *contents = [[NSArray alloc] initWithArray:contentsOfDir copyItems:YES]; - self.cachedContentsOfDir = contents; - [contents release]; - } - [self.tableView reloadData]; -} - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); + [super viewWillAppear:animated]; } -(NSInteger) filterNumberOfHogs:(NSInteger) hogs { @@ -140,7 +144,7 @@ } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return (section == 0 ? selectedTeamsCount : allTeamsCount); + return (section == 0 ? self.selectedTeamsCount : self.allTeamsCount); } // Customize the appearance of table view cells. @@ -177,7 +181,7 @@ if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; - cell.textLabel.text = [[[self.listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; + cell.textLabel.text = [[[self.listOfAllTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; cell.textLabel.backgroundColor = [UIColor clearColor]; NSString *teamPath = [NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),cell.textLabel.text]; @@ -222,13 +226,13 @@ return IS_IPAD() ? 40 : 20; } --(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section { +-(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section { NSInteger height = IS_IPAD() ? 40 : 20; - UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, height)]; + UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)]; footer.backgroundColor = [UIColor clearColor]; - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width*80/100, height)]; - label.center = CGPointMake(self.tableView.frame.size.width/2, height/2); + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width*80/100, height)]; + label.center = CGPointMake(aTableView.frame.size.width/2, height/2); label.textAlignment = UITextAlignmentCenter; label.font = [UIFont italicSystemFontOfSize:12]; label.textColor = [UIColor whiteColor]; @@ -251,9 +255,9 @@ NSInteger row = [indexPath row]; NSInteger section = [indexPath section]; - if (section == 1 && [self.listOfTeams count] > row) { - [self.listOfSelectedTeams addObject:[self.listOfTeams objectAtIndex:row]]; - [self.listOfTeams removeObjectAtIndex:row]; + if (section == 1 && [self.listOfAllTeams count] > row) { + [self.listOfSelectedTeams addObject:[self.listOfAllTeams objectAtIndex:row]]; + [self.listOfAllTeams removeObjectAtIndex:row]; NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:selectedTeamsCount inSection:0]; allTeamsCount--; @@ -277,7 +281,7 @@ } } --(void) holdAction:(NSString *)content { +-(void) holdAction:(NSString *)content onTable:(UITableView *)aTableView { NSInteger row; for (row = 0; row < [self.listOfSelectedTeams count]; row++) { NSDictionary *dict = [self.listOfSelectedTeams objectAtIndex:row]; @@ -285,15 +289,15 @@ break; } - [self.listOfTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; + [self.listOfAllTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; [self.listOfSelectedTeams removeObjectAtIndex:row]; - [self.tableView beginUpdates]; - [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationLeft]; - [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:allTeamsCount inSection:1]] withRowAnimation:UITableViewRowAnimationLeft]; - allTeamsCount++; - selectedTeamsCount--; - [self.tableView endUpdates]; + [aTableView beginUpdates]; + [aTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationLeft]; + [aTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:allTeamsCount inSection:1]] withRowAnimation:UITableViewRowAnimationLeft]; + self.allTeamsCount++; + self.selectedTeamsCount--; + [aTableView endUpdates]; } #pragma mark - @@ -301,7 +305,8 @@ -(void) didReceiveMemoryWarning { if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) { self.listOfSelectedTeams = nil; - self.listOfTeams = nil; + self.listOfAllTeams = nil; + self.tableView = nil; } self.cachedContentsOfDir = nil; MSG_MEMCLEAN(); @@ -309,7 +314,8 @@ } -(void) viewDidUnload { - self.listOfTeams = nil; + self.tableView = nil; + self.listOfAllTeams = nil; self.listOfSelectedTeams = nil; self.cachedContentsOfDir = nil; MSG_DIDUNLOAD(); @@ -318,7 +324,8 @@ -(void) dealloc { - releaseAndNil(listOfTeams); + releaseAndNil(tableView); + releaseAndNil(listOfAllTeams); releaseAndNil(listOfSelectedTeams); releaseAndNil(cachedContentsOfDir); [super dealloc]; diff -r 443cce9e060f -r 485cfecadc9a project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Oct 09 20:03:04 2011 -0400 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Mon Oct 10 02:50:01 2011 +0200 @@ -78,7 +78,7 @@ 61370653117B1D50004EE44A /* Entitlements-Distribution.plist in Resources */ = {isa = PBXBuildFile; fileRef = 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */; }; 61399013125D19C0003C2DC0 /* uMobile.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61399012125D19C0003C2DC0 /* uMobile.pas */; }; 6147DAD31253DCDE0010357E /* savesButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 6147DAD21253DCDE0010357E /* savesButton.png */; }; - 61536DF411CEAE7100D87A7E /* GameConfigViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924A11CA9CB400D6E256 /* GameConfigViewController.xib */; }; + 61536DF411CEAE7100D87A7E /* GameConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */; }; 615AD96212073B4D00F2FF04 /* startGameButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD96112073B4D00F2FF04 /* startGameButton.png */; }; 615AD9E9120764CA00F2FF04 /* backButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9E8120764CA00F2FF04 /* backButton.png */; }; 615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9EA1207654E00F2FF04 /* helpButton.png */; }; @@ -219,6 +219,7 @@ 61B7A61712FA13B00051E14E /* libSDL_mixer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A56012FA12BF0051E14E /* libSDL_mixer.a */; }; 61B7A61812FA13B00051E14E /* libSDL_net.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A56812FA12D00051E14E /* libSDL_net.a */; }; 61B7A61912FA13B00051E14E /* libSDL_ttf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A59012FA13330051E14E /* libSDL_ttf.a */; }; + 61B9A86814423A9D001541C1 /* GameConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */; }; 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C079E311F35A300072BF46 /* EditableCellView.m */; }; 61C28D3F142D380400DA16C2 /* AudioManagerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C28D3E142D380400DA16C2 /* AudioManagerController.m */; }; 61CADE331402EE290030C3EB /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61CADE321402EE290030C3EB /* ImageIO.framework */; }; @@ -457,7 +458,7 @@ 6165922B11CA9BD500D6E256 /* SquareButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SquareButtonView.m; path = Classes/SquareButtonView.m; sourceTree = ""; }; 6165922C11CA9BD500D6E256 /* UIImageExtra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIImageExtra.h; path = Classes/UIImageExtra.h; sourceTree = ""; }; 6165922D11CA9BD500D6E256 /* UIImageExtra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIImageExtra.m; path = Classes/UIImageExtra.m; sourceTree = ""; }; - 6165924A11CA9CB400D6E256 /* GameConfigViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GameConfigViewController.xib; sourceTree = ""; }; + 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "GameConfigViewController-iPhone.xib"; sourceTree = ""; }; 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MainMenuViewController-iPad.xib"; sourceTree = ""; }; 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MainMenuViewController-iPhone.xib"; sourceTree = ""; }; 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MapConfigViewController-iPad.xib"; sourceTree = ""; }; @@ -585,6 +586,7 @@ 61AC067312B2E32D000B52A2 /* Appirater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Appirater.m; path = Classes/Appirater.m; sourceTree = ""; }; 61B7A33612CC21080086B604 /* StatsPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatsPageViewController.h; sourceTree = ""; }; 61B7A33712CC21080086B604 /* StatsPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatsPageViewController.m; sourceTree = ""; }; + 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "GameConfigViewController-iPad.xib"; path = "Classes/GameConfigViewController-iPad.xib"; sourceTree = ""; }; 61C079E211F35A300072BF46 /* EditableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditableCellView.h; path = Classes/EditableCellView.h; sourceTree = ""; }; 61C079E311F35A300072BF46 /* EditableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EditableCellView.m; path = Classes/EditableCellView.m; sourceTree = ""; }; 61C28D3D142D380400DA16C2 /* AudioManagerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioManagerController.h; path = Classes/AudioManagerController.h; sourceTree = ""; }; @@ -707,6 +709,7 @@ 19C28FACFE9D520D11CA2CBB /* Products */, 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */, 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */, + 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */, ); name = CustomTemplate; sourceTree = ""; @@ -841,7 +844,7 @@ children = ( 616591E411CA9BA200D6E256 /* GameConfigViewController.h */, 616591E511CA9BA200D6E256 /* GameConfigViewController.m */, - 6165924A11CA9CB400D6E256 /* GameConfigViewController.xib */, + 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */, 6165920411CA9BA200D6E256 /* TeamConfigViewController.h */, 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */, 616591FC11CA9BA200D6E256 /* SchemeWeaponConfigViewController.h */, @@ -1360,7 +1363,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 61536DF411CEAE7100D87A7E /* GameConfigViewController.xib in Resources */, + 61536DF411CEAE7100D87A7E /* GameConfigViewController-iPhone.xib in Resources */, 61370653117B1D50004EE44A /* Entitlements-Distribution.plist in Resources */, 611E12FF117BBBDA0044B62F /* Entitlements-Development.plist in Resources */, 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */, @@ -1477,6 +1480,7 @@ 610782961440EE5C00645B29 /* basicFlags.plist in Resources */, 610782971440EE5C00645B29 /* credits.plist in Resources */, 610782981440EE5C00645B29 /* gameMods.plist in Resources */, + 61B9A86814423A9D001541C1 /* GameConfigViewController-iPad.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; };