media view - store the category in the path control to better identify if it's a disk image.

This commit is contained in:
Kelvin Sherlock 2021-07-10 12:07:01 -04:00
parent fc3bae79c3
commit 0d4a08113b
1 changed files with 25 additions and 6 deletions

View File

@ -282,7 +282,9 @@ enum {
}
-(void)prepareView: (TablePathView *)view {
/* set the path tag = category. */
NSPathControl *pc = [view pathControl];
[pc setTag: _category + 1]; // to differentiate 0 / no path control.
}
-(CGFloat)height {
@ -717,11 +719,28 @@ static NSString *kDragType = @"private.ample.media";
- (IBAction)pathAction:(id)sender {
NSURL *url = [(NSPathControl *)sender URL];
NSInteger tag = [sender tag];
// TODO - don't add to recent disks if this is a bitbanger / midi / printer device.
if (url && tag == 0) {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName: kNotificationDiskImageAdded object: url];
NSInteger tag = [sender tag] - 1;
switch(tag) {
case kIndexFloppy525:
case kIndexFloppy35:
case kIndexHardDrive:
case kIndexCDROM:
case kIndexCassette:
case kIndexDiskImage:
if (url) {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName: kNotificationDiskImageAdded object: url];
}
break;
/*
kIndexPicture,
kIndexMIn,
kIndexMout,
*/
default: break;
}
[self rebuildArgs];