-
Notifications
You must be signed in to change notification settings - Fork 1
/
FFProgress.m
50 lines (35 loc) · 1006 Bytes
/
FFProgress.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
//RCS_ID("$Id: FFProgress.m 264 2004-08-20 14:22:11Z ravemax $")
#import "FFProgress.h"
@implementation FFProgress
- (id)init {
self = [super init];
if (self != nil)
m_tlock = [[NSLock alloc] init];
return self;
}
- (void)dealloc {
[m_tlock release];
[super dealloc];
}
- (void)_sthread:(id)arg {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[m_progressBar startAnimation:self];
[m_tlock lock]; [m_tlock unlock];
[m_progressBar stopAnimation:self];
[pool release];
}
- (void)startWithText:(NSString*)txt {
[m_text setStringValue:txt];
[NSApp beginSheet:m_progressWin modalForWindow:m_mainWin modalDelegate:self
didEndSelector:nil contextInfo:NULL];
[m_progressWin makeKeyAndOrderFront:self];
[m_tlock lock];
[m_progressBar setUsesThreadedAnimation:TRUE];
[NSThread detachNewThreadSelector:@selector(_sthread:) toTarget:self withObject:nil];
}
- (void)stop {
[m_tlock unlock];
[NSApp endSheet:m_progressWin];
[m_progressWin orderOut:NULL];
}
@end