Don't hardcode the number of frames in the throbber animation.

This commit is contained in:
bryner%netscape.com 2002-06-25 04:47:58 +00:00
parent b457216712
commit 644f05ed78
4 changed files with 24 additions and 32 deletions

View File

@ -652,20 +652,18 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (NSArray*)throbberImages
{
const int kNumThrobberImages = 6;
// Simply load an array of NSImage objects from the files "throbber-NN.tif". I used "Quicktime Player" to
// save all of the frames of the animated gif as individual .tif files for simplicity of implementation.
if (mThrobberImages == nil) {
NSImage* images[kNumThrobberImages];
for (int i = 0; i < kNumThrobberImages; ++i) {
NSImage* images[64];
int i;
for (i = 0;; ++i) {
NSString* imageName = [NSString stringWithFormat: @"throbber-%02d", i + 1];
images[i] = [NSImage imageNamed: imageName];
if (images[i] == nil) {
NSLog(@"throbber image %@ failed to load", imageName);
abort();
}
if (images[i] == nil)
break;
}
mThrobberImages = [[NSArray alloc] initWithObjects: images count: kNumThrobberImages];
mThrobberImages = [[NSArray alloc] initWithObjects: images count: i];
}
return mThrobberImages;
}

View File

@ -652,20 +652,18 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (NSArray*)throbberImages
{
const int kNumThrobberImages = 6;
// Simply load an array of NSImage objects from the files "throbber-NN.tif". I used "Quicktime Player" to
// save all of the frames of the animated gif as individual .tif files for simplicity of implementation.
if (mThrobberImages == nil) {
NSImage* images[kNumThrobberImages];
for (int i = 0; i < kNumThrobberImages; ++i) {
NSImage* images[64];
int i;
for (i = 0;; ++i) {
NSString* imageName = [NSString stringWithFormat: @"throbber-%02d", i + 1];
images[i] = [NSImage imageNamed: imageName];
if (images[i] == nil) {
NSLog(@"throbber image %@ failed to load", imageName);
abort();
}
if (images[i] == nil)
break;
}
mThrobberImages = [[NSArray alloc] initWithObjects: images count: kNumThrobberImages];
mThrobberImages = [[NSArray alloc] initWithObjects: images count: i];
}
return mThrobberImages;
}

View File

@ -652,20 +652,18 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (NSArray*)throbberImages
{
const int kNumThrobberImages = 6;
// Simply load an array of NSImage objects from the files "throbber-NN.tif". I used "Quicktime Player" to
// save all of the frames of the animated gif as individual .tif files for simplicity of implementation.
if (mThrobberImages == nil) {
NSImage* images[kNumThrobberImages];
for (int i = 0; i < kNumThrobberImages; ++i) {
NSImage* images[64];
int i;
for (i = 0;; ++i) {
NSString* imageName = [NSString stringWithFormat: @"throbber-%02d", i + 1];
images[i] = [NSImage imageNamed: imageName];
if (images[i] == nil) {
NSLog(@"throbber image %@ failed to load", imageName);
abort();
}
if (images[i] == nil)
break;
}
mThrobberImages = [[NSArray alloc] initWithObjects: images count: kNumThrobberImages];
mThrobberImages = [[NSArray alloc] initWithObjects: images count: i];
}
return mThrobberImages;
}

View File

@ -652,20 +652,18 @@ static NSString *SearchToolbarItemIdentifier = @"Search Toolbar Item";
- (NSArray*)throbberImages
{
const int kNumThrobberImages = 6;
// Simply load an array of NSImage objects from the files "throbber-NN.tif". I used "Quicktime Player" to
// save all of the frames of the animated gif as individual .tif files for simplicity of implementation.
if (mThrobberImages == nil) {
NSImage* images[kNumThrobberImages];
for (int i = 0; i < kNumThrobberImages; ++i) {
NSImage* images[64];
int i;
for (i = 0;; ++i) {
NSString* imageName = [NSString stringWithFormat: @"throbber-%02d", i + 1];
images[i] = [NSImage imageNamed: imageName];
if (images[i] == nil) {
NSLog(@"throbber image %@ failed to load", imageName);
abort();
}
if (images[i] == nil)
break;
}
mThrobberImages = [[NSArray alloc] initWithObjects: images count: kNumThrobberImages];
mThrobberImages = [[NSArray alloc] initWithObjects: images count: i];
}
return mThrobberImages;
}