equal
deleted
inserted
replaced
52 CFRelease(uuid); |
52 CFRelease(uuid); |
53 NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; |
53 NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; |
54 self.seedCommand = seedCmd; |
54 self.seedCommand = seedCmd; |
55 [seedCmd release]; |
55 [seedCmd release]; |
56 |
56 |
|
57 if (self.dataSourceArray == nil) |
|
58 [self loadDataSourceArray]; |
57 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
59 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
58 NSIndexPath *theIndex; |
60 NSIndexPath *theIndex; |
59 if (isRandomness()) { |
61 if (isRandomness()) { |
60 // prevent other events and add an activity while the preview is beign generated |
62 // prevent other events and add an activity while the preview is beign generated |
61 [self turnOffWidgets]; |
63 [self turnOffWidgets]; |
109 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
111 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
110 return 1; |
112 return 1; |
111 } |
113 } |
112 |
114 |
113 -(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section { |
115 -(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section { |
|
116 if (self.dataSourceArray == nil) |
|
117 [self loadDataSourceArray]; |
114 return [[self.dataSourceArray objectAtIndex:scIndex] count]; |
118 return [[self.dataSourceArray objectAtIndex:scIndex] count]; |
115 } |
119 } |
116 |
120 |
117 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
121 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
118 static NSString *CellIdentifier = @"Cell"; |
122 static NSString *CellIdentifier = @"Cell"; |
123 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
127 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
124 |
128 |
125 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) |
129 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) |
126 cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; |
130 cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; |
127 |
131 |
|
132 if (self.dataSourceArray == nil) |
|
133 [self loadDataSourceArray]; |
128 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
134 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
129 |
135 |
130 NSString *labelString = [source objectAtIndex:row]; |
136 NSString *labelString = [source objectAtIndex:row]; |
131 cell.textLabel.text = labelString; |
137 cell.textLabel.text = labelString; |
132 |
138 |
148 return cell; |
154 return cell; |
149 } |
155 } |
150 |
156 |
151 // this set details for a static map (called by didSelectRowAtIndexPath) |
157 // this set details for a static map (called by didSelectRowAtIndexPath) |
152 -(void) setDetailsForStaticMap:(NSInteger) index { |
158 -(void) setDetailsForStaticMap:(NSInteger) index { |
|
159 if (self.dataSourceArray == nil) |
|
160 [self loadDataSourceArray]; |
153 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
161 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
154 |
162 |
155 NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", |
163 NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", |
156 (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]]; |
164 (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]]; |
157 NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL]; |
165 NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL]; |
183 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
191 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
184 int newRow = [indexPath row]; |
192 int newRow = [indexPath row]; |
185 int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
193 int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
186 |
194 |
187 if (newRow != oldRow) { |
195 if (newRow != oldRow) { |
|
196 if (self.dataSourceArray == nil) |
|
197 [self loadDataSourceArray]; |
188 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
198 NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
189 if (isRandomness()) { |
199 if (isRandomness()) { |
190 // just change the theme, don't update preview |
200 // just change the theme, don't update preview |
191 self.themeCommand = [NSString stringWithFormat:@"etheme %@", [source objectAtIndex:newRow]]; |
201 self.themeCommand = [NSString stringWithFormat:@"etheme %@", [source objectAtIndex:newRow]]; |
192 } else { |
202 } else { |
459 } |
469 } |
460 |
470 |
461 -(void) didReceiveMemoryWarning { |
471 -(void) didReceiveMemoryWarning { |
462 [super didReceiveMemoryWarning]; |
472 [super didReceiveMemoryWarning]; |
463 self.dataSourceArray = nil; |
473 self.dataSourceArray = nil; |
|
474 self.lastIndexPath = nil; |
464 // maybe we can save some more |
475 // maybe we can save some more |
465 MSG_MEMCLEAN(); |
476 MSG_MEMCLEAN(); |
466 } |
477 } |
467 |
478 |
468 -(void) dealloc { |
479 -(void) dealloc { |