Added "smarter" removal of playlist entries.

CQTexperiment
vspader 2007-10-22 00:04:34 +00:00
parent 0eb32ff9f6
commit 11fd5b5454
3 changed files with 42 additions and 11 deletions

View File

@ -34,14 +34,14 @@
<integer>4</integer>
<key>IBOpenObjects</key>
<array>
<integer>1063</integer>
<integer>29</integer>
<integer>268</integer>
<integer>21</integer>
<integer>1156</integer>
<integer>1324</integer>
<integer>513</integer>
<integer>463</integer>
<integer>1324</integer>
<integer>29</integer>
<integer>1063</integer>
</array>
<key>IBSystem Version</key>
<string>8R2218</string>

Binary file not shown.

View File

@ -161,11 +161,30 @@
- (void)removeObjectsAtArrangedObjectIndexes:(NSIndexSet *)indexes
{
NSArray *a = [[self arrangedObjects] objectsAtIndexes:indexes]; //Screw 10.3
NSLog(@"Removing indexes: %@", indexes);
NSLog(@"Current index: %i", [[currentEntry index] intValue]);
if ([a containsObject:currentEntry])
if ([[currentEntry index] intValue] >= 0 && [indexes containsIndex:[[currentEntry index] intValue]])
{
[currentEntry setIndex:[NSNumber numberWithInt:-1]];
[currentEntry setIndex:[NSNumber numberWithInt:-[[currentEntry index] intValue] - 1]];
NSLog(@"Current removed: %i", [[currentEntry index] intValue]);
}
if ([[currentEntry index] intValue] < 0) //Need to update the negative index
{
int i = -[[currentEntry index] intValue] - 1;
NSLog(@"I is %i", i);
int j;
for (j = i - 1; j >= 0; j--)
{
if ([indexes containsIndex:j]) {
NSLog(@"Removing 1");
i--;
}
}
[currentEntry setIndex: [NSNumber numberWithInt:-i - 1]];
NSLog(@"UPDATING INDEX: %@", [currentEntry index]);
}
[super removeObjectsAtArrangedObjectIndexes:indexes];
@ -290,7 +309,17 @@
}
else
{
return [self entryAtIndex:([[pe index] intValue] + 1)];
int i;
if ([[pe index] intValue] < 0) //Was a current entry, now removed.
{
i = -[[pe index] intValue] - 1;
}
else
{
i = [[pe index] intValue] + 1;
}
return [self entryAtIndex:i];
}
}
@ -302,15 +331,17 @@
}
else
{
//Fix for removing a track, then pressing prev with repeat turned on
if ([[pe index] intValue] == -1)
int i;
if ([[pe index] intValue] < 0) //Was a current entry, now removed.
{
return [self entryAtIndex:[[pe index] intValue]];
i = -[[pe index] intValue] - 2;
}
else
{
return [self entryAtIndex:[[pe index] intValue] - 1];
i = [[pe index] intValue] - 1;
}
return [self entryAtIndex:i];
}
}