project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
branchhedgeroid
changeset 6224 42b256eca362
parent 6220 39782c4d9246
child 6247 6dfad55fd71c
equal deleted inserted replaced
6055:88cfcd9161d3 6224:42b256eca362
    18  * File created on 13/06/2010.
    18  * File created on 13/06/2010.
    19  */
    19  */
    20 
    20 
    21 
    21 
    22 #import "SchemeWeaponConfigViewController.h"
    22 #import "SchemeWeaponConfigViewController.h"
    23 #import "CommodityFunctions.h"
    23 #import <QuartzCore/QuartzCore.h>
       
    24 
    24 
    25 
    25 #define LABEL_TAG 57423
    26 #define LABEL_TAG 57423
    26 
    27 
       
    28 static SchemeWeaponConfigViewController *controllerInstance;
       
    29 
    27 @implementation SchemeWeaponConfigViewController
    30 @implementation SchemeWeaponConfigViewController
    28 @synthesize listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu,
    31 @synthesize tableView, listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu,
    29             selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, hideSections;
    32             selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, sectionsHidden;
    30 
    33 
    31 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    34 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    32     return rotationManager(interfaceOrientation);
    35     return rotationManager(interfaceOrientation);
    33 }
    36 }
    34 
    37 
    35 #pragma mark -
    38 #pragma mark -
       
    39 #pragma mark custom setters/getters
       
    40 -(NSString *)selectedScheme {
       
    41     if (selectedScheme == nil)
       
    42         self.selectedScheme = @"Default.plist";
       
    43     return selectedScheme;
       
    44 }
       
    45 
       
    46 -(NSString *)selectedWeapon {
       
    47     if (selectedWeapon == nil)
       
    48         self.selectedWeapon = @"Default.plist";
       
    49     return selectedWeapon;
       
    50 }
       
    51 
       
    52 -(NSString *)selectedScript {
       
    53     if (selectedScript == nil)
       
    54         self.selectedScript = @"Normal.plist";
       
    55     return selectedScript;
       
    56 }
       
    57 
       
    58 -(NSString *)scriptCommand {
       
    59     if (scriptCommand == nil)
       
    60         self.scriptCommand = @"";
       
    61     return scriptCommand;
       
    62 }
       
    63 
       
    64 -(NSArray *)listOfSchemes {
       
    65     if (listOfSchemes == nil)
       
    66         self.listOfSchemes = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL];
       
    67     return listOfSchemes;
       
    68 }
       
    69 
       
    70 -(NSArray *)listOfWeapons {
       
    71     if (listOfWeapons == nil)
       
    72         self.listOfWeapons = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
       
    73     return listOfWeapons;
       
    74 }
       
    75 
       
    76 -(NSArray *)listOfScripts {
       
    77     if (listOfScripts == nil)
       
    78         self.listOfScripts = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL];
       
    79     return listOfScripts;
       
    80 }
       
    81 
       
    82 -(UISegmentedControl *)topControl {
       
    83     if (topControl == nil) {
       
    84         NSArray *array = [[NSArray alloc] initWithObjects:
       
    85                           NSLocalizedString(@"Scheme",@""),
       
    86                           NSLocalizedString(@"Weapon",@""),
       
    87                           NSLocalizedString(@"Style",@""),nil];
       
    88         UISegmentedControl *controller = [[UISegmentedControl alloc] initWithItems:array];
       
    89         [array release];
       
    90         controller.segmentedControlStyle = UISegmentedControlStyleBar;
       
    91         controller.tintColor = [UIColor lightGrayColor];
       
    92         controller.selectedSegmentIndex = 0;
       
    93         self.topControl = controller;
       
    94         [controller addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
       
    95         [controller release];
       
    96     }
       
    97     return topControl;
       
    98 }
       
    99 
       
   100 #pragma mark -
    36 #pragma mark View lifecycle
   101 #pragma mark View lifecycle
    37 -(void) viewDidLoad {
   102 -(void) viewDidLoad {
       
   103     self.sectionsHidden = NO;
       
   104 
       
   105     UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)
       
   106                                                            style:UITableViewStyleGrouped];
       
   107     aTableView.delegate = self;
       
   108     aTableView.dataSource = self;
       
   109     if (IS_IPAD()) {
       
   110         [aTableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]];
       
   111         aTableView.layer.borderColor = [[UIColor darkYellowColor] CGColor];
       
   112         aTableView.layer.borderWidth = 2.7f;
       
   113         aTableView.layer.cornerRadius = 8;
       
   114         aTableView.contentInset = UIEdgeInsetsMake(5, 0, 5, 0);
       
   115     } else {
       
   116         UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"];
       
   117         UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
       
   118         [backgroundImage release];
       
   119         [self.view addSubview:background];
       
   120         [background release];
       
   121         [aTableView setBackgroundColorForAnyTable:[UIColor clearColor]];
       
   122     }
       
   123 
       
   124     aTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
       
   125     aTableView.separatorColor = [UIColor whiteColor];
       
   126     aTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
       
   127     self.tableView = aTableView;
       
   128     [aTableView release];
       
   129     [self.view addSubview:self.tableView];
       
   130 
    38     [super viewDidLoad];
   131     [super viewDidLoad];
    39 
   132     controllerInstance = self;
    40     CGSize screenSize = [[UIScreen mainScreen] bounds].size;
   133 }
    41     self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
       
    42 
       
    43     self.selectedScheme = nil;
       
    44     self.selectedWeapon = nil;
       
    45     self.selectedScript = nil;
       
    46     self.scriptCommand = nil;
       
    47 
       
    48     if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) {
       
    49         if (IS_IPAD())
       
    50             [self.tableView setBackgroundView:nil];
       
    51         else {
       
    52             UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"];
       
    53             UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
       
    54             [backgroundImage release];
       
    55             [self.tableView setBackgroundView:background];
       
    56             [background release];
       
    57         }
       
    58     } else {
       
    59         self.view.backgroundColor = [UIColor blackColor];
       
    60     }
       
    61 
       
    62     self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
       
    63     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
       
    64 }
       
    65 
       
    66 -(void) viewWillAppear:(BOOL) animated {
       
    67     [super viewWillAppear:animated];
       
    68 
       
    69     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL];
       
    70     self.listOfSchemes = contentsOfDir;
       
    71 
       
    72     if (self.selectedScheme == nil && [listOfSchemes containsObject:@"Default.plist"])
       
    73         self.selectedScheme = @"Default.plist";
       
    74     
       
    75     contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
       
    76     self.listOfWeapons = contentsOfDir;
       
    77     
       
    78     if (self.selectedWeapon == nil && [listOfWeapons containsObject:@"Default.plist"])
       
    79         self.selectedWeapon = @"Default.plist";
       
    80 
       
    81     contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL];
       
    82     self.listOfScripts = contentsOfDir;
       
    83     self.selectedScript = @"Normal.plist";
       
    84     self.scriptCommand = @"";
       
    85 
       
    86     [self.tableView reloadData];
       
    87 }
       
    88 
       
    89 
   134 
    90 #pragma mark -
   135 #pragma mark -
    91 #pragma mark Table view data source
   136 #pragma mark Table view data source
    92 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
   137 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
    93     if (hideSections)
   138     return (self.sectionsHidden ? 0 : 1);
    94         return 0;
       
    95     else
       
    96         return 1;
       
    97 }
   139 }
    98 
   140 
    99 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   141 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   100     if (self.topControl.selectedSegmentIndex == 0)
   142     if (self.topControl.selectedSegmentIndex == 0)
   101         return [self.listOfSchemes count];
   143         return [self.listOfSchemes count];
   104     else
   146     else
   105         return [self.listOfScripts count];
   147         return [self.listOfScripts count];
   106 }
   148 }
   107 
   149 
   108 // Customize the appearance of table view cells.
   150 // Customize the appearance of table view cells.
   109 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   151 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   110     static NSString *CellIdentifier = @"Cell";
   152     static NSString *CellIdentifier = @"Cell";
   111     NSInteger index = self.topControl.selectedSegmentIndex;
   153     NSInteger index = self.topControl.selectedSegmentIndex;
   112     NSInteger row = [indexPath row];
   154     NSInteger row = [indexPath row];
   113 
   155 
   114     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   156     UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   115     if (cell == nil)
   157     if (cell == nil)
   116         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
   158         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
   117 
   159 
   118     cell.accessoryView = nil;
   160     cell.accessoryView = nil;
   119     if (0 == index) {
   161     if (0 == index) {
   152             [checkbox release];
   194             [checkbox release];
   153             self.lastIndexPath_lu = indexPath;
   195             self.lastIndexPath_lu = indexPath;
   154         }
   196         }
   155     }
   197     }
   156 
   198 
   157     cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK;
   199     cell.backgroundColor = [UIColor blackColorTransparent];
   158     cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
   200     cell.textLabel.textColor = [UIColor lightYellowColor];
   159     cell.detailTextLabel.textColor = [UIColor whiteColor];
   201     cell.detailTextLabel.textColor = [UIColor whiteColor];
   160     cell.textLabel.adjustsFontSizeToFitWidth = YES;
   202     cell.textLabel.adjustsFontSizeToFitWidth = YES;
   161     cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
   203     cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
   162     return cell;
   204     return cell;
   163 }
   205 }
   165 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
   207 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
   166     return 50.0;
   208     return 50.0;
   167 }
   209 }
   168 
   210 
   169 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
   211 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
   170     if (self.topControl == nil) {
       
   171         NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"Scheme",@""),NSLocalizedString(@"Weapon",@""),
       
   172                           NSLocalizedString(@"Style",@""),nil];
       
   173         self.topControl = [[UISegmentedControl alloc] initWithItems:array];
       
   174         [array release];
       
   175         [self.topControl addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
       
   176         self.topControl.segmentedControlStyle = UISegmentedControlStyleBar;
       
   177         self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
       
   178         self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
       
   179         self.topControl.tintColor = [UIColor lightGrayColor];
       
   180         self.topControl.selectedSegmentIndex = 0;
       
   181     }
       
   182 
       
   183     UIView *theView = [[[UIView alloc] init] autorelease];
   212     UIView *theView = [[[UIView alloc] init] autorelease];
       
   213     self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
       
   214     self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
   184     [theView addSubview:self.topControl];
   215     [theView addSubview:self.topControl];
   185     return theView;
   216     return theView;
   186 }
   217 }
   187 
   218 
   188 #pragma mark -
   219 #pragma mark -
   211 
   242 
   212         if (index == 0) {
   243         if (index == 0) {
   213             self.lastIndexPath_sc = indexPath;
   244             self.lastIndexPath_sc = indexPath;
   214             self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow];
   245             self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow];
   215 
   246 
       
   247             // also set weaponset when selecting scheme, if set
   216             NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
   248             NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
   217             if ([[settings objectForKey:@"sync_ws"] boolValue]) {
   249             if ([[settings objectForKey:@"sync_ws"] boolValue]) {
   218                 for (NSString *str in self.listOfWeapons) {
   250                 for (NSString *str in self.listOfWeapons) {
   219                     if ([str isEqualToString:self.selectedScheme]) {
   251                     if ([str isEqualToString:self.selectedScheme]) {
   220                         int index = [self.listOfSchemes indexOfObject:str];
   252                         int index = [self.listOfSchemes indexOfObject:str];
   221                         self.selectedWeapon = str;
   253                         self.selectedWeapon = str;
   222                         self.lastIndexPath_we = [NSIndexPath indexPathForRow:index inSection:1];
   254                         self.lastIndexPath_we = [NSIndexPath indexPathForRow:index inSection:1];
   223                         [self.tableView reloadData];
       
   224                         break;
   255                         break;
   225                     }
   256                     }
   226                 }
   257                 }
   227             }
   258             }
   228         } else if (index == 1) {
   259         } else if (index == 1) {
   230             self.selectedWeapon = [self.listOfWeapons objectAtIndex:newRow];
   261             self.selectedWeapon = [self.listOfWeapons objectAtIndex:newRow];
   231         } else {
   262         } else {
   232             self.lastIndexPath_lu = indexPath;
   263             self.lastIndexPath_lu = indexPath;
   233             self.selectedScript = [self.listOfScripts objectAtIndex:newRow];
   264             self.selectedScript = [self.listOfScripts objectAtIndex:newRow];
   234 
   265 
   235             NSString *path = [[NSString alloc] initWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),selectedScript];
   266             // some styles disable or force the choice of a particular scheme/weaponset
       
   267             NSString *path = [[NSString alloc] initWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),self.selectedScript];
   236             NSDictionary *scriptDict = [[NSDictionary alloc] initWithContentsOfFile:path];
   268             NSDictionary *scriptDict = [[NSDictionary alloc] initWithContentsOfFile:path];
   237             [path release];
   269             [path release];
   238             self.scriptCommand = [scriptDict objectForKey:@"command"];
   270             self.scriptCommand = [scriptDict objectForKey:@"command"];
   239             NSString *scheme = [scriptDict objectForKey:@"scheme"];
   271             NSString *scheme = [scriptDict objectForKey:@"scheme"];
   240             if ([scheme isEqualToString:@""]) {
   272             if ([scheme isEqualToString:@""]) {
   260         [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
   292         [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
   261     }
   293     }
   262     [aTableView deselectRowAtIndexPath:indexPath animated:YES];
   294     [aTableView deselectRowAtIndexPath:indexPath animated:YES];
   263 }
   295 }
   264 
   296 
   265 -(void) fillSections {
   297 #pragma mark -
   266     if (hideSections == YES) {
   298 #pragma mark called externally to empty or fill the sections completely
   267         hideSections = NO;
   299 +(void) fillInstanceSections {
   268         NSRange range;
   300     if (controllerInstance.sectionsHidden == YES) {
   269         range.location = 0;
   301         controllerInstance.sectionsHidden = NO;
   270         range.length = 1;
   302         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
   271         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range];
   303         [controllerInstance.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
   272         [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
   304         controllerInstance.tableView.scrollEnabled = YES;
   273         self.selectedScheme = @"Default.plist";
   305 
   274         self.selectedWeapon = @"Default.plist";
   306         [[controllerInstance.view viewWithTag:LABEL_TAG] removeFromSuperview];
   275         self.selectedScript = @"Normal.plist";
   307     }
   276 
   308 }
   277         self.tableView.scrollEnabled = YES;
   309 
   278 
   310 +(void) emptyInstanceSections {
   279         [[self.view viewWithTag:LABEL_TAG] removeFromSuperview];
   311     if (controllerInstance.sectionsHidden == NO) {
   280     }
   312         controllerInstance.sectionsHidden = YES;
   281 }
   313         NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
   282 
   314         [controllerInstance.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   283 -(void) emptySections {
   315         controllerInstance.tableView.scrollEnabled = NO;
   284     hideSections = YES;
   316 
   285     NSRange range;
   317         CGRect frame = CGRectMake(0, 0, controllerInstance.view.frame.size.width * 80/100, 60);
   286     range.location = 0;
   318         UILabel *theLabel = [[UILabel alloc] initWithFrame:frame
   287     range.length = 1;
   319                                                   andTitle:NSLocalizedString(@"Missions don't need further configuration",@"")];
   288     NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range];
   320         theLabel.center = CGPointMake(controllerInstance.view.frame.size.width/2, controllerInstance.view.frame.size.height/2);
   289     [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   321         theLabel.numberOfLines = 2;
   290     self.selectedScheme = @"Default.plist";
   322         theLabel.tag = LABEL_TAG;
   291     self.selectedWeapon = @"Default.plist";
   323 
   292     self.selectedScript = @"Normal.plist";
   324         [controllerInstance.view addSubview:theLabel];
   293 
   325         [theLabel release];
   294     self.tableView.scrollEnabled = NO;
   326     }
   295 
       
   296     CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 60);
       
   297     UILabel *theLabel = createBlueLabel(NSLocalizedString(@"Missions don't need further configuration",@""), frame);
       
   298     theLabel.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2);
       
   299     theLabel.numberOfLines = 2;
       
   300     theLabel.tag = LABEL_TAG;
       
   301 
       
   302     [self.view addSubview:theLabel];
       
   303     [theLabel release];
       
   304 }
   327 }
   305 
   328 
   306 #pragma mark -
   329 #pragma mark -
   307 #pragma mark Memory management
   330 #pragma mark Memory management
   308 -(void) didReceiveMemoryWarning {
   331 -(void) didReceiveMemoryWarning {
   309     if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) {
   332     if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) {
       
   333         self.tableView = nil;
   310         self.lastIndexPath_sc = nil;
   334         self.lastIndexPath_sc = nil;
   311         self.lastIndexPath_we = nil;
   335         self.lastIndexPath_we = nil;
   312         self.lastIndexPath_lu = nil;
   336         self.lastIndexPath_lu = nil;
   313         self.listOfSchemes = nil;
   337         self.selectedScheme = nil;
   314         self.listOfWeapons = nil;
   338         self.selectedWeapon = nil;
   315         self.listOfScripts = nil;
   339         self.selectedScript = nil;
       
   340         self.scriptCommand = nil;
   316         self.topControl = nil;
   341         self.topControl = nil;
   317         MSG_MEMCLEAN();
   342     }
   318     }
   343     self.listOfSchemes = nil;
       
   344     self.listOfWeapons = nil;
       
   345     self.listOfScripts = nil;
       
   346     MSG_MEMCLEAN();
   319     [super didReceiveMemoryWarning];
   347     [super didReceiveMemoryWarning];
   320 }
   348 }
   321 
   349 
   322 -(void) viewDidUnload {
   350 -(void) viewDidUnload {
       
   351     self.tableView = nil;
   323     self.listOfSchemes = nil;
   352     self.listOfSchemes = nil;
   324     self.listOfWeapons = nil;
   353     self.listOfWeapons = nil;
   325     self.listOfScripts = nil;
   354     self.listOfScripts = nil;
   326     self.lastIndexPath_sc = nil;
   355     self.lastIndexPath_sc = nil;
   327     self.lastIndexPath_we = nil;
   356     self.lastIndexPath_we = nil;
   333     self.topControl = nil;
   362     self.topControl = nil;
   334     MSG_DIDUNLOAD();
   363     MSG_DIDUNLOAD();
   335     [super viewDidUnload];
   364     [super viewDidUnload];
   336 }
   365 }
   337 
   366 
   338 
       
   339 -(void) dealloc {
   367 -(void) dealloc {
       
   368     releaseAndNil(tableView);
   340     releaseAndNil(listOfSchemes);
   369     releaseAndNil(listOfSchemes);
   341     releaseAndNil(listOfWeapons);
   370     releaseAndNil(listOfWeapons);
   342     releaseAndNil(listOfScripts);
   371     releaseAndNil(listOfScripts);
   343     releaseAndNil(lastIndexPath_sc);
   372     releaseAndNil(lastIndexPath_sc);
   344     releaseAndNil(lastIndexPath_we);
   373     releaseAndNil(lastIndexPath_we);