project_files/HedgewarsMobile/Classes/MapConfigViewController.m
changeset 4082 bfe14b38dad1
parent 3996 eb549fd864a5
child 4115 222b8016c773
equal deleted inserted replaced
4081:d4cb8f216724 4082:bfe14b38dad1
    69     }
    69     }
    70     [seed release];
    70     [seed release];
    71 
    71 
    72     // perform as if user clicked on an entry
    72     // perform as if user clicked on an entry
    73     [self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
    73     [self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
    74     [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionNone animated:YES];
    74     if (IS_NOT_POWERFUL() == NO)
       
    75         [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionNone animated:YES];
    75 }
    76 }
    76 
    77 
    77 -(void) turnOffWidgets {
    78 -(void) turnOffWidgets {
    78     busy = YES;
    79     busy = YES;
    79     self.previewButton.alpha = 0.5f;
    80     self.previewButton.alpha = 0.5f;
   220     }
   221     }
   221     [aTableView deselectRowAtIndexPath:indexPath animated:YES];
   222     [aTableView deselectRowAtIndexPath:indexPath animated:YES];
   222 }
   223 }
   223 
   224 
   224 #pragma mark -
   225 #pragma mark -
   225 #pragma mark slider & segmentedControl
   226 #pragma mark slider & segmentedControl & button
   226 // this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl
   227 // this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl
   227 // no methods are called by this routine and you can pass nil to it
   228 // no methods are called by this routine and you can pass nil to it
   228 -(IBAction) sliderChanged:(id) sender {
   229 -(IBAction) sliderChanged:(id) sender {
   229     NSString *labelText;
   230     NSString *labelText;
   230     NSString *templateCommand;
   231     NSString *templateCommand;
   365     [self.tableView reloadData];
   366     [self.tableView reloadData];
   366     [self updatePreview];
   367     [self updatePreview];
   367     oldPage = newPage;
   368     oldPage = newPage;
   368 }
   369 }
   369 
   370 
       
   371 -(IBAction) buttonPressed:(id) sender {
       
   372     [[NSNotificationCenter defaultCenter] postNotificationName:@"buttonPressed"
       
   373                                                         object:nil
       
   374                                                       userInfo:[NSDictionary dictionaryWithObject:sender forKey:@"sender"]];
       
   375 }
       
   376 
   370 #pragma mark -
   377 #pragma mark -
   371 #pragma mark calls the parent's function that checks the parameters and starts the game
   378 #pragma mark view management
   372 -(IBAction) buttonPressed:(id) sender {
       
   373     [[NSNotificationCenter defaultCenter] postNotificationName:@"buttonPressed" object:nil userInfo:[NSDictionary dictionaryWithObject:sender forKey:@"sender"]];
       
   374 }
       
   375 
       
   376 -(void) loadDataSourceArray {
   379 -(void) loadDataSourceArray {
   377     // themes.cfg contains all the user-selectable themes
   380     // themes.cfg contains all the user-selectable themes
   378     NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"]
   381     NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"]
   379                                                        encoding:NSUTF8StringEncoding
   382                                                        encoding:NSUTF8StringEncoding
   380                                                           error:NULL];
   383                                                           error:NULL];
   389     self.dataSourceArray = array;
   392     self.dataSourceArray = array;
   390     [array release];
   393     [array release];
   391     [themeArray release];
   394     [themeArray release];
   392 }
   395 }
   393 
   396 
   394 #pragma mark -
       
   395 #pragma mark view management
       
   396 -(void) viewDidLoad {
   397 -(void) viewDidLoad {
   397     [super viewDidLoad];
   398     [super viewDidLoad];
   398 
   399 
   399     srandom(time(NULL));
   400     srandom(time(NULL));
   400 
   401 
   422     self.mapGenCommand = @"e$mapgen 0";
   423     self.mapGenCommand = @"e$mapgen 0";
   423     self.staticMapCommand = @"";
   424     self.staticMapCommand = @"";
   424     self.missionCommand = @"";
   425     self.missionCommand = @"";
   425 
   426 
   426     if (IS_IPAD()) {
   427     if (IS_IPAD()) {
   427         [self.tableView setBackgroundView:nil];
   428         if ([UITableView respondsToSelector:@selector(setBackgroundView:)])
       
   429             [self.tableView setBackgroundView:nil];
   428         self.view.backgroundColor = [UIColor clearColor];
   430         self.view.backgroundColor = [UIColor clearColor];
   429         self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
   431         self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
   430         self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   432         self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   431         self.tableView.rowHeight = 45;
   433         self.tableView.rowHeight = 45;
   432     }
   434     }