mirror of https://github.com/ksherlock/ample.git
set the category index to -1 when category not in use.
This commit is contained in:
parent
a278f679b0
commit
b58a859398
|
@ -342,8 +342,10 @@ static_assert(kIndexLast == CATEGORY_COUNT, "Invalid Category Count");
|
||||||
_data[kIndexMidiOut] = [MediaCategory categoryWithTitle: @"MIDI (Out)"];
|
_data[kIndexMidiOut] = [MediaCategory categoryWithTitle: @"MIDI (Out)"];
|
||||||
_data[kIndexPicture] = [MediaCategory categoryWithTitle: @"Picture"];
|
_data[kIndexPicture] = [MediaCategory categoryWithTitle: @"Picture"];
|
||||||
|
|
||||||
for (unsigned i = 0; i < CATEGORY_COUNT; ++i)
|
for (unsigned i = 0; i < CATEGORY_COUNT; ++i) {
|
||||||
[_data[i] setCategory: i];
|
[_data[i] setCategory: i];
|
||||||
|
[_data[i] setIndex: -1];
|
||||||
|
}
|
||||||
|
|
||||||
_root = [NSMutableArray new];
|
_root = [NSMutableArray new];
|
||||||
|
|
||||||
|
@ -383,6 +385,7 @@ static_assert(kIndexLast == CATEGORY_COUNT, "Invalid Category Count");
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)rebuildRoot {
|
-(void)rebuildRoot {
|
||||||
|
|
||||||
NSMutableArray *tmp = [NSMutableArray new];
|
NSMutableArray *tmp = [NSMutableArray new];
|
||||||
int ix = 0;
|
int ix = 0;
|
||||||
for (unsigned j = 0 ; j < CATEGORY_COUNT; ++j) {
|
for (unsigned j = 0 ; j < CATEGORY_COUNT; ++j) {
|
||||||
|
@ -415,6 +418,8 @@ static_assert(kIndexLast == CATEGORY_COUNT, "Invalid Category Count");
|
||||||
if (MediaEqual(&_media, &media)) return;
|
if (MediaEqual(&_media, &media)) return;
|
||||||
_media = media;
|
_media = media;
|
||||||
|
|
||||||
|
[_outlineView beginUpdates];
|
||||||
|
|
||||||
|
|
||||||
#undef _
|
#undef _
|
||||||
#define _(name, index) \
|
#define _(name, index) \
|
||||||
|
@ -435,6 +440,8 @@ x = media.name; cat = _data[index]; delta |= [cat setItemCount: x]
|
||||||
[self rebuildRoot];
|
[self rebuildRoot];
|
||||||
if (!_loadingBookmark) [self rebuildArgs];
|
if (!_loadingBookmark) [self rebuildArgs];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[_outlineView endUpdates];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)resetDiskImages {
|
-(void)resetDiskImages {
|
||||||
|
@ -724,6 +731,7 @@ static NSString *kDragType = @"private.ample.media";
|
||||||
withAnimation: NSTableViewAnimationEffectFade];
|
withAnimation: NSTableViewAnimationEffectFade];
|
||||||
|
|
||||||
[_root removeObjectAtIndex: ix];
|
[_root removeObjectAtIndex: ix];
|
||||||
|
[cat setIndex: -1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue