cocoaTouch/MapConfigViewController.m
author koda
Mon, 31 May 2010 19:33:42 +0000
changeset 3487 b1d00f1950c8
parent 3463 23c50be687a9
child 3490 016b3172b645
permissions -rw-r--r--
add some memory aware code revert sdl calls to past implementation (the one that did not crash) add some debug methods found online
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     1
//
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     2
//  MapConfigViewController.m
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     3
//  HedgewarsMobile
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     4
//
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     5
//  Created by Vittorio on 22/04/10.
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     7
//
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     8
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
     9
#import "MapConfigViewController.h"
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    10
#import "PascalImports.h"
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    11
#import "CommodityFunctions.h"
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    12
#import "UIImageExtra.h"
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    13
#import "SDL_net.h"
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    14
#import <pthread.h>
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    15
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    16
#define INDICATOR_TAG 7654
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
    17
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    18
@implementation MapConfigViewController
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
    19
@synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand,
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
    20
            tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, themeArray, mapArray;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    21
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    22
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    23
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    24
    return rotationManager(interfaceOrientation);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    25
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    26
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    27
#pragma mark -
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    28
#pragma mark Preview Handling
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    29
-(int) sendToEngine: (NSString *)string {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    30
	unsigned char length = [string length];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    31
	
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    32
	SDLNet_TCP_Send(csd, &length , 1);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    33
	return SDLNet_TCP_Send(csd, [string UTF8String], length);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    34
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    35
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    36
-(void) engineProtocol:(NSInteger) port {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    37
	IPaddress ip;
3374
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
    38
	BOOL serverQuit = NO;
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
    39
    
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    40
	if (SDLNet_Init() < 0) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    41
		NSLog(@"SDLNet_Init: %s", SDLNet_GetError());
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    42
        serverQuit = YES;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    43
	}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    44
	
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
    45
	// Resolving the host using NULL make network interface to listen
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    46
	if (SDLNet_ResolveHost(&ip, NULL, port) < 0) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    47
		NSLog(@"SDLNet_ResolveHost: %s\n", SDLNet_GetError());
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    48
        serverQuit = YES;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    49
	}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    50
	
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
    51
	// Open a connection with the IP provided (listen on the host's port)
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    52
	if (!(sd = SDLNet_TCP_Open(&ip))) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    53
		NSLog(@"SDLNet_TCP_Open: %s %\n", SDLNet_GetError(), port);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    54
        serverQuit = YES;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    55
	}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    56
	
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    57
	NSLog(@"engineProtocol - Waiting for a client on port %d", port);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    58
	while (!serverQuit) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    59
		/* This check the sd if there is a pending connection.
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    60
		 * If there is one, accept that, and open a new socket for communicating */
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    61
		csd = SDLNet_TCP_Accept(sd);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    62
		if (NULL != csd) {			
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    63
			NSLog(@"engineProtocol - Client found");
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    64
            
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    65
            [self sendToEngine:self.seedCommand];
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    66
            [self sendToEngine:self.templateFilterCommand];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    67
            [self sendToEngine:self.mapGenCommand];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    68
            [self sendToEngine:self.mazeSizeCommand];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    69
            [self sendToEngine:@"!"];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    70
                
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    71
            memset(map, 0, 128*32);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    72
            SDLNet_TCP_Recv(csd, map, 128*32);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    73
            SDLNet_TCP_Recv(csd, &maxHogs, sizeof(Uint8));
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    74
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    75
			SDLNet_TCP_Close(csd);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    76
			serverQuit = YES;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    77
		}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    78
	}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    79
	
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    80
	SDLNet_TCP_Close(sd);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    81
	SDLNet_Quit();
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    82
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    83
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    84
-(void) drawingThread {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    85
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    86
    
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    87
    // select the port for IPC and launch the preview generation
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    88
    int port = randomPort();
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
    89
    pthread_t thread_id;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    90
    pthread_create(&thread_id, NULL, (void *)GenLandPreview, (void *)port);
3487
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
    91
    pthread_detach(thread_id);
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    92
    [self engineProtocol:port];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    93
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    94
    // draw the buffer (1 pixel per component, 0= transparent 1= color)
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    95
    int xc = 0;
3374
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
    96
    int yc = -1;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    97
    UIGraphicsBeginImageContext(CGSizeMake(256,128));      
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    98
    CGContextRef context = UIGraphicsGetCurrentContext();       
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
    99
    UIGraphicsPushContext(context);  
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   100
    for (int i = 0; i < 32*128; i++) {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   101
        unsigned char byte = map[i];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   102
        for (int j = 0; j < 8; j++) {
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   103
            // select the color based on the leftmost bit
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   104
            if ((byte & 0x80) != 0)
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   105
                CGContextSetRGBFillColor(context, 0.5, 0.5, 0.7, 1.0);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   106
            else
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   107
                CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 0.0);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   108
            // draw pixel
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   109
            CGContextFillRect(context,CGRectMake(xc,yc,1,1));
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   110
            // move coordinates
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   111
            xc = (xc + 1) % 256;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   112
            if (xc == 0) yc++;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   113
            // shift to next bit
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   114
            byte <<= 1;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   115
        }
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   116
    }
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   117
    UIGraphicsPopContext();
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   118
    UIImage *previewImage = UIGraphicsGetImageFromCurrentImageContext();
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   119
    UIGraphicsEndImageContext();
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   120
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   121
    // set the preview image (autoreleased) in the button and the maxhog label
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   122
    [self.previewButton setBackgroundImage:previewImage forState:UIControlStateNormal];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   123
    self.maxLabel.text = [NSString stringWithFormat:@"%d", maxHogs];
3366
f0e5ff24fb72 rename the project from HedgewarsMobile to Hedgewars
koda
parents: 3365
diff changeset
   124
    
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   125
    // restore functionality of button and remove the spinning wheel
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   126
    [self turnOnWidgets];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   127
    UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[self.previewButton viewWithTag:INDICATOR_TAG];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   128
    [indicator stopAnimating];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   129
    [indicator removeFromSuperview];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   130
    
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   131
    [pool release];
3487
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   132
    //Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution.
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   133
    //[NSThread exit];
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   134
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   135
    /*
3366
f0e5ff24fb72 rename the project from HedgewarsMobile to Hedgewars
koda
parents: 3365
diff changeset
   136
    // http://developer.apple.com/mac/library/qa/qa2001/qa1037.html
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   137
    CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray();
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   138
    CGContextRef bitmapImage = CGBitmapContextCreate(mapExp, 128, 32, 8, 128, colorspace, kCGImageAlphaNone);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   139
    CGColorSpaceRelease(colorspace);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   140
    
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   141
    CGImageRef previewCGImage = CGBitmapContextCreateImage(bitmapImage);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   142
    UIImage *previewImage = [[UIImage alloc] initWithCGImage:previewCGImage];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   143
    CGImageRelease(previewCGImage);
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   144
    */
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   145
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   146
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   147
-(IBAction) updatePreview {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   148
    // don't generate a new preview while it's already generating one
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   149
    if (busy)
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   150
        return;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   151
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   152
    // generate a seed
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   153
    CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   154
    NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   155
    CFRelease(uuid);
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   156
    NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   157
    [seed release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   158
    self.seedCommand = seedCmd;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   159
    [seedCmd release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   160
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   161
    NSIndexPath *theIndex;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   162
    if (segmentedControl.selectedSegmentIndex != 1) {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   163
        // prevent other events and add an activity while the preview is beign generated
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   164
        [self turnOffWidgets];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   165
        
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   166
        // remove the current preview
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   167
        [self.previewButton setImage:nil forState:UIControlStateNormal];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   168
        
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   169
        // add a very nice spinning wheel
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   170
        UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] 
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   171
                                              initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   172
        indicator.center = CGPointMake(previewButton.bounds.size.width / 2, previewButton.bounds.size.height / 2);
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   173
        indicator.tag = INDICATOR_TAG;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   174
        [indicator startAnimating];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   175
        [self.previewButton addSubview:indicator];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   176
        [indicator release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   177
        
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   178
        // let's draw in a separate thread so the gui can work; at the end it restore other widgets
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   179
        [NSThread detachNewThreadSelector:@selector(drawingThread) toTarget:self withObject:nil];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   180
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   181
        theIndex = [NSIndexPath indexPathForRow:(random()%[self.themeArray count]) inSection:0];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   182
    } else {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   183
        theIndex = [NSIndexPath indexPathForRow:(random()%[self.mapArray count]) inSection:0];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   184
    }
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   185
    [self.tableView reloadData];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   186
    [self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   187
    [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionNone animated:YES];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   188
}
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   189
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   190
-(void) updatePreviewWithMap:(NSInteger) index {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   191
    // change the preview button
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   192
    NSString *fileImage = [[NSString alloc] initWithFormat:@"%@/%@/preview.png", MAPS_DIRECTORY(),[self.mapArray objectAtIndex:index]];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   193
    UIImage *image = [[UIImage alloc] initWithContentsOfFile:fileImage];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   194
    [fileImage release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   195
    [self.previewButton setBackgroundImage:image forState:UIControlStateNormal];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   196
    [image release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   197
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   198
    // update label
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   199
    maxHogs = 18;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   200
    NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", MAPS_DIRECTORY(),[self.mapArray objectAtIndex:index]];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   201
    NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   202
    [fileCfg release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   203
    NSArray *split = [contents componentsSeparatedByString:@"\n"];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   204
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   205
    // if the number is not set we keep 18 standard; 
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   206
    // sometimes it's not set but there are trailing characters, we get around them with the second equation
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   207
    if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0)
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   208
        maxHogs = [[split objectAtIndex:1] intValue];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   209
    [contents release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   210
    NSString *max = [[NSString alloc] initWithFormat:@"%d",maxHogs];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   211
    self.maxLabel.text = max;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   212
    [max release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   213
}
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   214
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   215
-(void) turnOffWidgets {
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   216
    busy = YES;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   217
    self.previewButton.alpha = 0.5f;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   218
    self.previewButton.enabled = NO;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   219
    self.maxLabel.text = @"...";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   220
    self.segmentedControl.enabled = NO;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   221
    self.tableView.allowsSelection = NO;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   222
    self.slider.enabled = NO;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   223
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   224
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   225
-(void) turnOnWidgets {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   226
    self.previewButton.alpha = 1.0f;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   227
    self.previewButton.enabled = YES;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   228
    self.segmentedControl.enabled = YES;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   229
    self.tableView.allowsSelection = YES;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   230
    self.slider.enabled = YES;
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   231
    busy = NO;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   232
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   233
    
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   234
#pragma mark -
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   235
#pragma mark Table view data source
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   236
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   237
    return 1;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   238
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   239
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   240
-(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   241
    if (self.segmentedControl.selectedSegmentIndex != 1)
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   242
        return [themeArray count];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   243
    else
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   244
        return [mapArray count];
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   245
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   246
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   247
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   248
    static NSString *CellIdentifier = @"Cell";
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   249
    NSInteger row = [indexPath row];
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   250
    
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   251
    UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   252
    if (cell == nil) 
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   253
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   254
    
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   255
    if (self.segmentedControl.selectedSegmentIndex != 1) {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   256
        // the % prevents a strange bug that occurs sporadically
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   257
        NSString *themeName = [self.themeArray objectAtIndex:row % [self.themeArray count]];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   258
        cell.textLabel.text = themeName;
3463
23c50be687a9 update sdl functions to latest revision
koda
parents: 3385
diff changeset
   259
        UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/Icon.png",THEMES_DIRECTORY(),themeName]];
23c50be687a9 update sdl functions to latest revision
koda
parents: 3385
diff changeset
   260
        cell.imageView.image = image;
23c50be687a9 update sdl functions to latest revision
koda
parents: 3385
diff changeset
   261
        [image release];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   262
    } else {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   263
        cell.textLabel.text = [self.mapArray objectAtIndex:row];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   264
        cell.imageView.image = nil;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   265
    }
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   266
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   267
    if (row == [self.lastIndexPath row]) 
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   268
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   269
    else
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   270
        cell.accessoryType = UITableViewCellAccessoryNone;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   271
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   272
    return cell;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   273
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   274
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   275
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   276
#pragma mark -
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   277
#pragma mark Table view delegate
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   278
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   279
    int newRow = [indexPath row];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   280
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   281
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   282
    if (newRow != oldRow) {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   283
        if (self.segmentedControl.selectedSegmentIndex != 1) {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   284
            NSString *theme = [self.themeArray objectAtIndex:newRow];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   285
            self.themeCommand =  [NSString stringWithFormat:@"etheme %@", theme];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   286
        } else
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   287
            [self updatePreviewWithMap:newRow];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   288
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   289
        UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; 
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   290
        newCell.accessoryType = UITableViewCellAccessoryCheckmark;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   291
        UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   292
        oldCell.accessoryType = UITableViewCellAccessoryNone;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   293
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   294
        self.lastIndexPath = indexPath;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   295
        [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   296
    }
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   297
    [aTableView deselectRowAtIndexPath:indexPath animated:YES];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   298
}
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   299
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   300
#pragma mark -
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   301
#pragma mark slider & segmentedControl
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   302
// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   303
// no methods are called by this routine and you can pass nil to it
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   304
-(IBAction) sliderChanged:(id) sender {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   305
    NSString *labelText;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   306
    NSString *templateCommand;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   307
    NSString *mazeCommand;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   308
    
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   309
    switch ((int)(self.slider.value*100)) {
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   310
        case 0:
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   311
            if (self.segmentedControl.selectedSegmentIndex == 0) {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   312
                labelText = NSLocalizedString(@"Wacky",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   313
            } else {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   314
                labelText = NSLocalizedString(@"Large Floating Islands",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   315
            }
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   316
            templateCommand = @"e$template_filter 5";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   317
            mazeCommand = @"e$maze_size 5";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   318
            break;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   319
        case 1:
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   320
            if (self.segmentedControl.selectedSegmentIndex == 0) {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   321
                labelText = NSLocalizedString(@"Cavern",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   322
            } else {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   323
                labelText = NSLocalizedString(@"Medium Floating Islands",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   324
            }
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   325
            templateCommand = @"e$template_filter 4";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   326
            mazeCommand = @"e$maze_size 4";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   327
            break;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   328
        case 2:
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   329
            if (self.segmentedControl.selectedSegmentIndex == 0) {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   330
                labelText = NSLocalizedString(@"Small",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   331
            } else {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   332
                labelText = NSLocalizedString(@"Small Floating Islands",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   333
            }
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   334
            templateCommand = @"e$template_filter 1";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   335
            mazeCommand = @"e$maze_size 3";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   336
            break;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   337
        case 3:
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   338
            if (self.segmentedControl.selectedSegmentIndex == 0) {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   339
                labelText = NSLocalizedString(@"Medium",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   340
            } else {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   341
                labelText = NSLocalizedString(@"Large Tunnels",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   342
            }
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   343
            templateCommand = @"e$template_filter 2";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   344
            mazeCommand = @"e$maze_size 2";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   345
            break;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   346
        case 4:
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   347
            if (self.segmentedControl.selectedSegmentIndex == 0) {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   348
                labelText = NSLocalizedString(@"Large",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   349
            } else {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   350
                labelText = NSLocalizedString(@"Medium Tunnels",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   351
            }
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   352
            templateCommand = @"e$template_filter 3";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   353
            mazeCommand = @"e$maze_size 1";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   354
            break;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   355
        case 5:
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   356
            if (self.segmentedControl.selectedSegmentIndex == 0) {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   357
                labelText = NSLocalizedString(@"All",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   358
            } else {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   359
                labelText = NSLocalizedString(@"Small Tunnels",@"");
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   360
            }
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   361
            templateCommand = @"e$template_filter 0";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   362
            mazeCommand = @"e$maze_size 0";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   363
            break;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   364
        default:
3487
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   365
            labelText = nil;
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   366
            templateCommand = nil;
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   367
            mazeCommand = nil;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   368
            break;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   369
    }
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   370
    
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   371
    self.sizeLabel.text = labelText;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   372
    self.templateFilterCommand = templateCommand;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   373
    self.mazeSizeCommand = mazeCommand;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   374
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   375
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   376
// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   377
-(IBAction) sliderEndedChanging:(id) sender {
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   378
    int num = (int) (self.slider.value * 100);
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   379
    if (oldValue != num) {
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   380
        [self updatePreview];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   381
        oldValue = num;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   382
    }
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   383
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   384
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   385
// perform actions based on the activated section, then call updatePreview to visually update the selection 
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   386
// updatePreview will call didSelectRowAtIndexPath which will call the right update routine)
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   387
// and if necessary update the table with a slide animation
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   388
-(IBAction) segmentedControlChanged:(id) sender {
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   389
    NSString *mapgen;
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   390
    NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   391
    
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   392
    switch (newPage) {
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   393
        case 0: // Random
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   394
            mapgen = @"e$mapgen 0";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   395
            [self sliderChanged:nil];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   396
            self.slider.enabled = YES;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   397
            break;
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   398
            
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   399
        case 1: // Map
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   400
            mapgen = @"e$mapgen 0";
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   401
            self.slider.enabled = NO;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   402
            self.sizeLabel.text = @".";
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   403
            break;
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   404
            
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   405
        case 2: // Maze
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   406
            mapgen = @"e$mapgen 1";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   407
            [self sliderChanged:nil];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   408
            self.slider.enabled = YES;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   409
            break;
3487
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   410
        
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   411
        default:
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   412
            mapgen = nil;
b1d00f1950c8 add some memory aware code
koda
parents: 3463
diff changeset
   413
            break;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   414
    }
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   415
    self.mapGenCommand = mapgen;
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   416
    [self updatePreview];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   417
    
3374
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   418
    // nice animation for updating the table when appropriate (on iphone)
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   419
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   420
        if (((oldPage == 0 || oldPage == 2) && newPage == 1) ||
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   421
            (oldPage == 1 && (newPage == 0 || newPage == 2))) {
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   422
            [UIView beginAnimations:@"moving out table" context:NULL];
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   423
            self.tableView.frame = CGRectMake(480, 0, 185, 276);
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   424
            [UIView commitAnimations];
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   425
            [self performSelector:@selector(moveTable) withObject:nil afterDelay:0.2];
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   426
        }
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   427
    oldPage = newPage;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   428
}
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   429
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   430
// update data when table is not visible and then show it
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   431
-(void) moveTable {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   432
    [self.tableView reloadData];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   433
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   434
    [UIView beginAnimations:@"moving in table" context:NULL];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   435
    self.tableView.frame = CGRectMake(295, 0, 185, 276);
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   436
    [UIView commitAnimations];
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   437
}
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   438
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   439
#pragma mark -
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   440
#pragma mark view management
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   441
-(void) viewDidLoad {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   442
    [super viewDidLoad];
3385
361bd29293f4 add automatic rotation in ipad (landscape only)
koda
parents: 3374
diff changeset
   443
    
361bd29293f4 add automatic rotation in ipad (landscape only)
koda
parents: 3374
diff changeset
   444
    srandom(time(NULL));
361bd29293f4 add automatic rotation in ipad (landscape only)
koda
parents: 3374
diff changeset
   445
    
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   446
    CGSize screenSize = [[UIScreen mainScreen] bounds].size;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   447
    self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   448
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   449
    // themes.cfg contains all the user-selectable themes
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   450
    NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"]
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   451
                                                       encoding:NSUTF8StringEncoding 
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   452
                                                          error:NULL];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   453
    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   454
    [string release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   455
    // remove a trailing "" element
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   456
    [array removeLastObject];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   457
    self.themeArray = array;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   458
    [array release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   459
    self.mapArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   460
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   461
    self.tableView.rowHeight = 42;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   462
    busy = NO;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   463
    // initialize some "default" values
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   464
    self.sizeLabel.text = NSLocalizedString(@"All",@"");
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   465
    self.slider.value = 0.05f;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   466
    self.segmentedControl.selectedSegmentIndex = 0;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   467
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   468
    self.templateFilterCommand = @"e$template_filter 0";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   469
    self.mazeSizeCommand = @"e$maze_size 0";
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   470
    self.mapGenCommand = @"e$mapgen 0";
3374
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   471
    self.lastIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   472
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   473
    oldValue = 5;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   474
    oldPage = 0;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   475
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   476
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   477
-(void) viewDidAppear:(BOOL) animated {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   478
    [super viewDidAppear:animated];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   479
    [self updatePreview];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   480
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   481
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   482
#pragma mark -
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   483
#pragma mark memory
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   484
-(void) didReceiveMemoryWarning {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   485
    [super didReceiveMemoryWarning];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   486
}
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   487
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   488
-(void) viewDidUnload {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   489
    self.previewButton = nil;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   490
    self.seedCommand = nil;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   491
    self.templateFilterCommand = nil;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   492
    self.mapGenCommand = nil;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   493
    self.mazeSizeCommand = nil;
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   494
    self.themeCommand = nil;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   495
    
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   496
    self.previewButton = nil;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   497
    self.tableView = nil;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   498
    self.maxLabel = nil;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   499
    self.sizeLabel = nil;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   500
    self.segmentedControl = nil;
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   501
    self.slider = nil;
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   502
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   503
    self.lastIndexPath = nil;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   504
    self.themeArray = nil;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   505
    self.mapArray = nil;
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   506
    
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   507
    [super viewDidUnload];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   508
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   509
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   510
-(void) dealloc {
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   511
    [seedCommand release];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   512
    [templateFilterCommand release];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   513
    [mapGenCommand release];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   514
    [mazeSizeCommand release];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   515
    [themeCommand release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   516
    
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   517
    [previewButton release];
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   518
    [tableView release];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   519
    [maxLabel release];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   520
    [sizeLabel release];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   521
    [segmentedControl release];
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3366
diff changeset
   522
    [slider release];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   523
    
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   524
    [lastIndexPath release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   525
    [themeArray release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   526
    [mapArray release];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   527
    
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   528
    [super dealloc];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   529
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   530
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   531
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents:
diff changeset
   532
@end