-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEPTwittererMapperController.m
72 lines (53 loc) · 1.85 KB
/
EPTwittererMapperController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// EPTwittererMapperController.m
// Degrees of Tweetdom
//
// Created by Simone Manganelli on 2008-08-26.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "EPTwittererMapperController.h"
#import "EPTwittererMapper.h"
@implementation EPTwittererMapperController
- (id)init;
{
if (self = [super initWithWindowNibName:@"TwittererMapper"]) {
twittererMapperInstance = [[EPTwittererMapper alloc] initWithStatusDelegate:self];
}
return self;
}
- (void)dealloc;
{
[twittererMapperInstance release];
[super dealloc];
}
- (void)awakeFromNib;
{
[mapImageView setAllowsCutCopyPaste:YES];
}
- (void)addStatusLine:(NSString *)statusLine;
{
NSString *newStatus = [[errorConsoleView string] stringByAppendingString:[NSString stringWithFormat:@"%@\n",statusLine]];
[errorConsoleView performSelectorOnMainThread:@selector(setString:) withObject:newStatus waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(scrollErrorConsoleToBottom) withObject:nil waitUntilDone:NO];
}
- (void)scrollErrorConsoleToBottom;
{
[errorConsoleView scrollRangeToVisible:NSMakeRange([[errorConsoleView string] length]-1,1)];
}
- (IBAction)startTwitterMapping:(id)sender;
{
[errorConsoleView setString:@""];
[NSThread detachNewThreadSelector:@selector(createMap)
toTarget:self
withObject:nil];
}
- (void)createMap;
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *twitterersArray = [[twitterersToMapTextField stringValue] componentsSeparatedByString:@","];
NSArray *twittererExclusions = [[twitterersToExcludeTextField stringValue] componentsSeparatedByString:@","];
NSImage *twittererMap = [twittererMapperInstance createMapOfTwitterers:twitterersArray excluding:twittererExclusions];
[mapImageView performSelectorOnMainThread:@selector(setImage:) withObject:twittererMap waitUntilDone:YES];
[pool release];
}
@end