project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
branchios-develop
changeset 12872 00215a7ec5f5
parent 11549 893722a2a1f9
child 13166 ba5c794adae3
equal deleted inserted replaced
12871:2c06b1120749 12872:00215a7ec5f5
    27 
    27 
    28 @implementation SchemeWeaponConfigViewController
    28 @implementation SchemeWeaponConfigViewController
    29 @synthesize listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu,
    29 @synthesize listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu,
    30             selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, sectionsHidden;
    30             selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, sectionsHidden;
    31 
    31 
    32 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    32 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    33     return rotationManager(interfaceOrientation);
    33     return rotationManager(interfaceOrientation);
    34 }
    34 }
    35 
    35 
    36 #pragma mark -
    36 #pragma mark -
    37 #pragma mark custom setters/getters
    37 #pragma mark custom setters/getters
    83         NSArray *array = [[NSArray alloc] initWithObjects:
    83         NSArray *array = [[NSArray alloc] initWithObjects:
    84                           NSLocalizedString(@"Scheme",@""),
    84                           NSLocalizedString(@"Scheme",@""),
    85                           NSLocalizedString(@"Weapon",@""),
    85                           NSLocalizedString(@"Weapon",@""),
    86                           NSLocalizedString(@"Style",@""),nil];
    86                           NSLocalizedString(@"Style",@""),nil];
    87         UISegmentedControl *controller = [[UISegmentedControl alloc] initWithItems:array];
    87         UISegmentedControl *controller = [[UISegmentedControl alloc] initWithItems:array];
    88         [array release];
       
    89         controller.segmentedControlStyle = UISegmentedControlStyleBar;
    88         controller.segmentedControlStyle = UISegmentedControlStyleBar;
    90         controller.tintColor = [UIColor lightGrayColor];
    89         controller.tintColor = [UIColor lightGrayColor];
    91         controller.selectedSegmentIndex = 0;
    90         controller.selectedSegmentIndex = 0;
    92         self.topControl = controller;
    91         self.topControl = controller;
    93         [controller release];
       
    94     }
    92     }
    95     return topControl;
    93     return topControl;
    96 }
    94 }
    97 
    95 
    98 #pragma mark -
    96 #pragma mark -
    99 #pragma mark View lifecycle
    97 #pragma mark View lifecycle
   100 -(void) viewDidLoad {
    98 - (void)viewDidLoad {
   101     self.sectionsHidden = NO;
    99     self.sectionsHidden = NO;
   102 
   100 
   103     NSInteger topOffset = IS_IPAD() ? 45 : 0;
   101     NSInteger topOffset = IS_IPAD() ? 45 : 0;
   104     NSInteger bottomOffset = IS_IPAD() ? 3 : 0;
   102     NSInteger bottomOffset = IS_IPAD() ? 3 : 0;
   105     UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,
   103     UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,
   114         UILabel *background = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)
   112         UILabel *background = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)
   115                                                     andTitle:nil
   113                                                     andTitle:nil
   116                                              withBorderWidth:2.7f];
   114                                              withBorderWidth:2.7f];
   117         background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
   115         background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
   118         [self.view insertSubview:background atIndex:0];
   116         [self.view insertSubview:background atIndex:0];
   119         [background release];
       
   120 
   117 
   121         self.topControl.frame = CGRectMake(0, 4, self.view.frame.size.width * 80/100, 30);
   118         self.topControl.frame = CGRectMake(0, 4, self.view.frame.size.width * 80/100, 30);
   122         self.topControl.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
   119         self.topControl.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
   123         self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
   120         self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
   124         [self.topControl addTarget:aTableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
   121         [self.topControl addTarget:aTableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
   126     } else {
   123     } else {
   127         UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"];
   124         UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"];
   128         UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
   125         UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
   129         background.contentMode = UIViewContentModeScaleAspectFill;
   126         background.contentMode = UIViewContentModeScaleAspectFill;
   130         background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
   127         background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
   131         [backgroundImage release];
       
   132         [self.view addSubview:background];
   128         [self.view addSubview:background];
   133         [background release];
       
   134         [aTableView setBackgroundColorForAnyTable:[UIColor clearColor]];
   129         [aTableView setBackgroundColorForAnyTable:[UIColor clearColor]];
   135     }
   130     }
   136 
   131 
   137     aTableView.tag = TABLE_TAG;
   132     aTableView.tag = TABLE_TAG;
   138     aTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
   133     aTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
   139     aTableView.separatorColor = [UIColor whiteColor];
   134     aTableView.separatorColor = [UIColor whiteColor];
   140     aTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   135     aTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   141     aTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
   136     aTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
   142     [self.view addSubview:aTableView];
   137     [self.view addSubview:aTableView];
   143     [aTableView release];
       
   144 
   138 
   145     [super viewDidLoad];
   139     [super viewDidLoad];
   146 
   140 
   147     // display or hide the lists, driven by MapConfigViewController
   141     // display or hide the lists, driven by MapConfigViewController
   148     [[NSNotificationCenter defaultCenter] addObserver:self
   142     [[NSNotificationCenter defaultCenter] addObserver:self
   155                                                object:nil];
   149                                                object:nil];
   156 }
   150 }
   157 
   151 
   158 #pragma mark -
   152 #pragma mark -
   159 #pragma mark Table view data source
   153 #pragma mark Table view data source
   160 -(NSInteger) numberOfSectionsInTableView:(UITableView *)aTableView {
   154 - (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
   161     return (self.sectionsHidden ? 0 : 1);
   155     return (self.sectionsHidden ? 0 : 1);
   162 }
   156 }
   163 
   157 
   164 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   158 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   165     if (self.topControl.selectedSegmentIndex == 0)
   159     if (self.topControl.selectedSegmentIndex == 0)
   166         return [self.listOfSchemes count];
   160         return [self.listOfSchemes count];
   167     else if (self.topControl.selectedSegmentIndex == 1)
   161     else if (self.topControl.selectedSegmentIndex == 1)
   168         return [self.listOfWeapons count];
   162         return [self.listOfWeapons count];
   169     else
   163     else
   176     NSInteger index = self.topControl.selectedSegmentIndex;
   170     NSInteger index = self.topControl.selectedSegmentIndex;
   177     NSInteger row = [indexPath row];
   171     NSInteger row = [indexPath row];
   178 
   172 
   179     UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   173     UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   180     if (cell == nil)
   174     if (cell == nil)
   181         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
   175         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
   182 
   176 
   183     cell.accessoryView = nil;
   177     cell.accessoryView = nil;
   184     if (0 == index) {
   178     if (0 == index) {
   185         cell.textLabel.text = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension];
   179         cell.textLabel.text = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension];
   186         NSString *str = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]];
   180         NSString *str = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]];
   187         NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
   181         NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
   188         cell.detailTextLabel.text = [dict objectForKey:@"description"];
   182         cell.detailTextLabel.text = [dict objectForKey:@"description"];
   189         [dict release];
       
   190         if ([[self.listOfSchemes objectAtIndex:row] isEqualToString:self.selectedScheme]) {
   183         if ([[self.listOfSchemes objectAtIndex:row] isEqualToString:self.selectedScheme]) {
   191             UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   184             UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   192             cell.accessoryView = checkbox;
   185             cell.accessoryView = checkbox;
   193             [checkbox release];
       
   194             self.lastIndexPath_sc = indexPath;
   186             self.lastIndexPath_sc = indexPath;
   195         }
   187         }
   196     } else if (1 == index) {
   188     } else if (1 == index) {
   197         cell.textLabel.text = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension];
   189         cell.textLabel.text = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension];
   198         NSString *str = [NSString stringWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
   190         NSString *str = [NSString stringWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
   199         NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
   191         NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
   200         cell.detailTextLabel.text = [dict objectForKey:@"description"];
   192         cell.detailTextLabel.text = [dict objectForKey:@"description"];
   201         [dict release];
       
   202         if ([[self.listOfWeapons objectAtIndex:row] isEqualToString:self.selectedWeapon]) {
   193         if ([[self.listOfWeapons objectAtIndex:row] isEqualToString:self.selectedWeapon]) {
   203             UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   194             UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   204             cell.accessoryView = checkbox;
   195             cell.accessoryView = checkbox;
   205             [checkbox release];
       
   206             self.lastIndexPath_we = indexPath;
   196             self.lastIndexPath_we = indexPath;
   207         }
   197         }
   208     } else {
   198     } else {
   209         if (row == 0)
   199         if (row == 0)
   210         {
   200         {
   212             
   202             
   213             if ([self.selectedScript isEqualToString:@""])
   203             if ([self.selectedScript isEqualToString:@""])
   214             {
   204             {
   215                 UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   205                 UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   216                 cell.accessoryView = checkbox;
   206                 cell.accessoryView = checkbox;
   217                 [checkbox release];
       
   218                 self.lastIndexPath_lu = indexPath;
   207                 self.lastIndexPath_lu = indexPath;
   219             }
   208             }
   220         }
   209         }
   221         else
   210         else
   222         {
   211         {
   226                                    stringByReplacingOccurrencesOfString:@"_" withString:@" "];
   215                                    stringByReplacingOccurrencesOfString:@"_" withString:@" "];
   227             //cell.detailTextLabel.text = ;
   216             //cell.detailTextLabel.text = ;
   228             if ([[self.listOfScripts objectAtIndex:row] isEqualToString:self.selectedScript]) {
   217             if ([[self.listOfScripts objectAtIndex:row] isEqualToString:self.selectedScript]) {
   229                 UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   218                 UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   230                 cell.accessoryView = checkbox;
   219                 cell.accessoryView = checkbox;
   231                 [checkbox release];
       
   232                 self.lastIndexPath_lu = indexPath;
   220                 self.lastIndexPath_lu = indexPath;
   233             }
   221             }
   234         }
   222         }
   235     }
   223     }
   236 
   224 
   240     cell.textLabel.adjustsFontSizeToFitWidth = YES;
   228     cell.textLabel.adjustsFontSizeToFitWidth = YES;
   241     cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
   229     cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
   242     return cell;
   230     return cell;
   243 }
   231 }
   244 
   232 
   245 -(CGFloat) tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger) section {
   233 -(CGFloat) tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger)section {
   246     return IS_IPAD() ? 0 : 50;
   234     return IS_IPAD() ? 0 : 50;
   247 }
   235 }
   248 
   236 
   249 -(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger) section {
   237 -(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger)section {
   250     if (IS_IPAD())
   238     if (IS_IPAD())
   251         return nil;
   239         return nil;
   252     UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];
   240     UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];
   253     theView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
   241     theView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
   254     self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
   242     self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
   255     self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
   243     self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
   256     [self.topControl addTarget:aTableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
   244     [self.topControl addTarget:aTableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
   257     [theView addSubview:self.topControl];
   245     [theView addSubview:self.topControl];
   258     return [theView autorelease];
   246     return theView;
   259 }
   247 }
   260 
   248 
   261 -(CGFloat) tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger) section {
   249 -(CGFloat) tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger)section {
   262     return 40;
   250     return 40;
   263 }
   251 }
   264 
   252 
   265 -(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section {
   253 -(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger)section {
   266     NSInteger height = 40;
   254     NSInteger height = 40;
   267     UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)];
   255     UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)];
   268     footer.backgroundColor = [UIColor clearColor];
   256     footer.backgroundColor = [UIColor clearColor];
   269     footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
   257     footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
   270 
   258 
   278     label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
   266     label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
   279 
   267 
   280     label.text = NSLocalizedString(@"Setting a Style might force a particular Scheme or Weapon configuration.",@"");
   268     label.text = NSLocalizedString(@"Setting a Style might force a particular Scheme or Weapon configuration.",@"");
   281 
   269 
   282     [footer addSubview:label];
   270     [footer addSubview:label];
   283     [label release];
   271     return footer;
   284     return [footer autorelease];
       
   285 }
   272 }
   286 
   273 
   287 #pragma mark -
   274 #pragma mark -
   288 #pragma mark Table view delegate
   275 #pragma mark Table view delegate
   289 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   276 - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   290     NSIndexPath *lastIndexPath;
   277     NSIndexPath *lastIndexPath;
   291     NSInteger index = self.topControl.selectedSegmentIndex;
   278     NSInteger index = self.topControl.selectedSegmentIndex;
   292     if (index == 0)
   279     if (index == 0)
   293         lastIndexPath = self.lastIndexPath_sc;
   280         lastIndexPath = self.lastIndexPath_sc;
   294     else if (index == 1)
   281     else if (index == 1)
   302     if (newRow != oldRow) {
   289     if (newRow != oldRow) {
   303         //TODO: this code works only for a single section table
   290         //TODO: this code works only for a single section table
   304         UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
   291         UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
   305         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   292         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   306         newCell.accessoryView = checkbox;
   293         newCell.accessoryView = checkbox;
   307         [checkbox release];
       
   308         UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath];
   294         UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath];
   309         oldCell.accessoryView = nil;
   295         oldCell.accessoryView = nil;
   310 
   296 
   311         if (index == 0) {
   297         if (index == 0) {
   312             self.lastIndexPath_sc = indexPath;
   298             self.lastIndexPath_sc = indexPath;
   348                 self.selectedScript = [self.listOfScripts objectAtIndex:newRow];
   334                 self.selectedScript = [self.listOfScripts objectAtIndex:newRow];
   349                 
   335                 
   350                 // some styles disable or force the choice of a particular scheme/weaponset
   336                 // some styles disable or force the choice of a particular scheme/weaponset
   351                 NSString *path = [[NSString alloc] initWithFormat:@"%@/%@.cfg",SCRIPTS_DIRECTORY(),[self.selectedScript stringByDeletingPathExtension]];
   337                 NSString *path = [[NSString alloc] initWithFormat:@"%@/%@.cfg",SCRIPTS_DIRECTORY(),[self.selectedScript stringByDeletingPathExtension]];
   352                 NSString *configFile = [[NSString alloc] initWithContentsOfFile:path];
   338                 NSString *configFile = [[NSString alloc] initWithContentsOfFile:path];
   353                 [path release];
       
   354                 NSArray *scriptOptions = [configFile componentsSeparatedByString:@"\n"];
   339                 NSArray *scriptOptions = [configFile componentsSeparatedByString:@"\n"];
   355                 [configFile release];
       
   356                 
   340                 
   357                 self.scriptCommand = [NSString stringWithFormat:@"escript Scripts/Multiplayer/%@",self.selectedScript];
   341                 self.scriptCommand = [NSString stringWithFormat:@"escript Scripts/Multiplayer/%@",self.selectedScript];
   358                 NSString *scheme = [scriptOptions objectAtIndex:0];
   342                 NSString *scheme = [scriptOptions objectAtIndex:0];
   359                 if ([scheme isEqualToString:@"locked"])
   343                 if ([scheme isEqualToString:@"locked"])
   360                 {
   344                 {
   394     [aTableView deselectRowAtIndexPath:indexPath animated:YES];
   378     [aTableView deselectRowAtIndexPath:indexPath animated:YES];
   395 }
   379 }
   396 
   380 
   397 #pragma mark -
   381 #pragma mark -
   398 #pragma mark called by an NSNotification to empty or fill the sections completely
   382 #pragma mark called by an NSNotification to empty or fill the sections completely
   399 -(void) fillSections {
   383 - (void)fillSections {
   400     if (self.sectionsHidden == YES) {
   384     if (self.sectionsHidden == YES) {
   401         self.sectionsHidden = NO;
   385         self.sectionsHidden = NO;
   402         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
   386         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
   403         UITableView *aTableView = (UITableView *)[self.view viewWithTag:TABLE_TAG];
   387         UITableView *aTableView = (UITableView *)[self.view viewWithTag:TABLE_TAG];
   404         [aTableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
   388         [aTableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
   405         aTableView.scrollEnabled = YES;
   389         aTableView.scrollEnabled = YES;
   406         [[self.view viewWithTag:LABEL_TAG] removeFromSuperview];
   390         [[self.view viewWithTag:LABEL_TAG] removeFromSuperview];
   407     }
   391     }
   408 }
   392 }
   409 
   393 
   410 -(void) emptySections {
   394 - (void)emptySections {
   411     if (self.sectionsHidden == NO) {
   395     if (self.sectionsHidden == NO) {
   412         self.sectionsHidden = YES;
   396         self.sectionsHidden = YES;
   413         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
   397         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
   414         UITableView *aTableView = (UITableView *)[self.view viewWithTag:TABLE_TAG];
   398         UITableView *aTableView = (UITableView *)[self.view viewWithTag:TABLE_TAG];
   415         [aTableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   399         [aTableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   424         theLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth |
   408         theLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth |
   425                                     UIViewAutoresizingFlexibleTopMargin |
   409                                     UIViewAutoresizingFlexibleTopMargin |
   426                                     UIViewAutoresizingFlexibleBottomMargin;
   410                                     UIViewAutoresizingFlexibleBottomMargin;
   427 
   411 
   428         [self.view addSubview:theLabel];
   412         [self.view addSubview:theLabel];
   429         [theLabel release];
       
   430     }
   413     }
   431 }
   414 }
   432 
   415 
   433 #pragma mark -
   416 #pragma mark -
   434 #pragma mark Memory management
   417 #pragma mark Memory management
   435 -(void) didReceiveMemoryWarning {
   418 
       
   419 - (void)didReceiveMemoryWarning {
   436     self.listOfSchemes = nil;
   420     self.listOfSchemes = nil;
   437     self.listOfWeapons = nil;
   421     self.listOfWeapons = nil;
   438     self.listOfScripts = nil;
   422     self.listOfScripts = nil;
   439     MSG_MEMCLEAN();
   423     MSG_MEMCLEAN();
   440     [super didReceiveMemoryWarning];
   424     [super didReceiveMemoryWarning];
   441 }
   425 }
   442 
   426 
   443 -(void) viewDidUnload {
   427 - (void)dealloc
   444     self.listOfSchemes = nil;
       
   445     self.listOfWeapons = nil;
       
   446     self.listOfScripts = nil;
       
   447     self.lastIndexPath_sc = nil;
       
   448     self.lastIndexPath_we = nil;
       
   449     self.lastIndexPath_lu = nil;
       
   450     self.selectedScheme = nil;
       
   451     self.selectedWeapon = nil;
       
   452     self.selectedScript = nil;
       
   453     self.scriptCommand = nil;
       
   454     self.topControl = nil;
       
   455     MSG_DIDUNLOAD();
       
   456     [super viewDidUnload];
       
   457 }
       
   458 
       
   459 -(void) dealloc
       
   460 {
   428 {
   461     [[NSNotificationCenter defaultCenter] removeObserver:self];
   429     [[NSNotificationCenter defaultCenter] removeObserver:self];
   462     releaseAndNil(listOfSchemes);
       
   463     releaseAndNil(listOfWeapons);
       
   464     releaseAndNil(listOfScripts);
       
   465     releaseAndNil(lastIndexPath_sc);
       
   466     releaseAndNil(lastIndexPath_we);
       
   467     releaseAndNil(lastIndexPath_lu);
       
   468     releaseAndNil(selectedScheme);
       
   469     releaseAndNil(selectedWeapon);
       
   470     releaseAndNil(selectedScript);
       
   471     releaseAndNil(scriptCommand);
       
   472     releaseAndNil(topControl);
       
   473     [super dealloc];
       
   474 }
   430 }
   475 
   431 
   476 
   432 
   477 @end
   433 @end
   478 
   434