mirror of https://github.com/ksherlock/ample.git
remove unused code
This commit is contained in:
parent
ab1315d22d
commit
26c6dcdbe5
|
@ -57,7 +57,6 @@
|
|||
B6109A4324F5F377005CB652 /* agat7.plist in Resources */ = {isa = PBXBuildFile; fileRef = B6109A1624F5F376005CB652 /* agat7.plist */; };
|
||||
B64979C224EF6703008ABD20 /* MediaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B64979C124EF6703008ABD20 /* MediaViewController.m */; };
|
||||
B64E15A924EA1D5300E8AD3D /* MachineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B64E15A824EA1D5300E8AD3D /* MachineViewController.m */; };
|
||||
B64E15AC24EA1FD400E8AD3D /* SlotBrowserDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B64E15AB24EA1FD400E8AD3D /* SlotBrowserDelegate.m */; };
|
||||
B65593B124ECB61800722E0C /* SlotViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B65593B024ECB61800722E0C /* SlotViewController.m */; };
|
||||
B6BA258024E99BE9005FB8FF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B6BA257F24E99BE9005FB8FF /* AppDelegate.m */; };
|
||||
B6BA258224E99BEB005FB8FF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B6BA258124E99BEB005FB8FF /* Assets.xcassets */; };
|
||||
|
@ -125,8 +124,6 @@
|
|||
B64979C124EF6703008ABD20 /* MediaViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MediaViewController.m; sourceTree = "<group>"; };
|
||||
B64E15A724EA1D5300E8AD3D /* MachineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MachineViewController.h; sourceTree = "<group>"; };
|
||||
B64E15A824EA1D5300E8AD3D /* MachineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MachineViewController.m; sourceTree = "<group>"; };
|
||||
B64E15AA24EA1FD400E8AD3D /* SlotBrowserDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlotBrowserDelegate.h; sourceTree = "<group>"; };
|
||||
B64E15AB24EA1FD400E8AD3D /* SlotBrowserDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SlotBrowserDelegate.m; sourceTree = "<group>"; };
|
||||
B65593AF24ECB61800722E0C /* SlotViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SlotViewController.h; sourceTree = "<group>"; };
|
||||
B65593B024ECB61800722E0C /* SlotViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SlotViewController.m; sourceTree = "<group>"; };
|
||||
B67BD48424EE249D0073E334 /* apple1.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = apple1.plist; sourceTree = "<group>"; };
|
||||
|
@ -252,8 +249,6 @@
|
|||
B60A6E1324EE0AE2004B7EEF /* FlippedView.m */,
|
||||
B60A6E1224EE0AE2004B7EEF /* FlippedView.h */,
|
||||
B6BA258124E99BEB005FB8FF /* Assets.xcassets */,
|
||||
B64E15AA24EA1FD400E8AD3D /* SlotBrowserDelegate.h */,
|
||||
B64E15AB24EA1FD400E8AD3D /* SlotBrowserDelegate.m */,
|
||||
B64E15AF24EA365E00E8AD3D /* Resources */,
|
||||
B6BA258624E99BEB005FB8FF /* Info.plist */,
|
||||
B6D6DE3A24FACF4F00661A5F /* Defaults.plist */,
|
||||
|
@ -397,7 +392,6 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B6BA258824E99BEB005FB8FF /* main.m in Sources */,
|
||||
B64E15AC24EA1FD400E8AD3D /* SlotBrowserDelegate.m in Sources */,
|
||||
B6D6DE4124FADFAC00661A5F /* LaunchWindowController.m in Sources */,
|
||||
B64E15A924EA1D5300E8AD3D /* MachineViewController.m in Sources */,
|
||||
B64979C224EF6703008ABD20 /* MediaViewController.m in Sources */,
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
//
|
||||
// SlotBrowserDelegate.h
|
||||
// MA2ME
|
||||
//
|
||||
// Created by Kelvin Sherlock on 8/16/2020.
|
||||
// Copyright © 2020 Kelvin Sherlock. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SlotBrowserDelegate : NSObject <NSBrowserDelegate>
|
||||
|
||||
@property (nonatomic) NSString *model;
|
||||
|
||||
@property (weak) NSBrowser *browser;
|
||||
|
||||
@property NSString *slot0;
|
||||
@property NSString *slot1;
|
||||
@property NSString *slot2;
|
||||
@property NSString *slot3;
|
||||
@property NSString *slot4;
|
||||
@property NSString *slot5;
|
||||
@property NSString *slot6;
|
||||
@property NSString *slot7;
|
||||
@property NSString *slot8;
|
||||
|
||||
@property NSString *exp;
|
||||
@property NSString *aux;
|
||||
|
||||
@property NSString *gameio;
|
||||
@property NSString *printer;
|
||||
@property NSString *modem;
|
||||
@property NSString *rs232;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -1,160 +0,0 @@
|
|||
//
|
||||
// SlotBrowserDelegate.m
|
||||
// MA2ME
|
||||
//
|
||||
// Created by Kelvin Sherlock on 8/16/2020.
|
||||
// Copyright © 2020 Kelvin Sherlock. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SlotBrowserDelegate.h"
|
||||
|
||||
@interface SlotBrowserDelegate () {
|
||||
|
||||
NSString *_model;
|
||||
NSMutableArray *_data;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation SlotBrowserDelegate
|
||||
|
||||
-(void)awakeFromNib {
|
||||
_data = [NSMutableArray new];
|
||||
}
|
||||
|
||||
@synthesize model = _model;
|
||||
|
||||
static NSString *Mame[] = {
|
||||
@"-sl0", @"-sl1", @"-sl2", @"-sl3",
|
||||
@"-sl4", @"-sl5", @"-sl6", @"-sl7",
|
||||
@"-sl8", @"-exp", @"-aux",
|
||||
@"-gameio", @"-printer", @"-modem", @"-rs232"
|
||||
};
|
||||
|
||||
static NSString *Keys[] = {
|
||||
@"slot0", @"slot1", @"slot2", @"slot3",
|
||||
@"slot4", @"slot5", @"slot6", @"slot7",
|
||||
@"slot8", @"exp", @"aux",
|
||||
@"gameio", @"printer", @"modem", @"rs232"
|
||||
};
|
||||
|
||||
static NSString *Names[] = {
|
||||
@"Slot 0", @"Slot 1", @"Slot 2", @"Slot 3",
|
||||
@"Slot 4", @"Slot 5", @"Slot 6", @"Slot 7",
|
||||
@"Slot 8", @"Expansion", @"Auxiliary",
|
||||
@"Game I/O", @"Printer", @"Modem", @"RS232"
|
||||
};
|
||||
|
||||
|
||||
-(void)setModel:(NSString *)model {
|
||||
|
||||
|
||||
if (_model == model) return;
|
||||
if ([_model isEqualToString: model]) return;
|
||||
_model = model;
|
||||
|
||||
[_data removeAllObjects];
|
||||
|
||||
if (!model) return;
|
||||
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
|
||||
NSDictionary *none = @{ @"Name": @"None", @"Mame": @"" };
|
||||
|
||||
for (unsigned i = 0; i < sizeof(Keys)/sizeof(Keys[0]); ++i) {
|
||||
NSString *key = Keys[i];
|
||||
|
||||
NSString *path = [bundle pathForResource: key ofType: @"plist" inDirectory: model];
|
||||
if (!path) {
|
||||
[self setValue: nil forKey: key];
|
||||
continue;
|
||||
}
|
||||
NSMutableArray *data = [NSMutableArray arrayWithContentsOfFile: path];
|
||||
|
||||
if (![data count]) {
|
||||
[self setValue: nil forKey: key];
|
||||
continue;
|
||||
}
|
||||
|
||||
[data insertObject: none atIndex: 0];
|
||||
|
||||
NSString *value = [self valueForKey: key];
|
||||
if (value) {
|
||||
BOOL found = NO;
|
||||
for (NSDictionary *item in data) {
|
||||
if ([value isEqualToString: [item objectForKey: @"Mame"]]) {
|
||||
found = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) [self setValue: nil forKey: key];
|
||||
}
|
||||
|
||||
NSDictionary *item = @{
|
||||
@"Children": data,
|
||||
@"Name": Names[i],
|
||||
@"Mame": key
|
||||
};
|
||||
[_data addObject: item];
|
||||
}
|
||||
// needs to call [NSBrowser reloadColumn0];
|
||||
[_browser loadColumnZero];
|
||||
}
|
||||
|
||||
#if 0
|
||||
-(id)rootItemForBrowser:(NSBrowser *)browser {
|
||||
return _data;
|
||||
}
|
||||
|
||||
- (BOOL)browser:(NSBrowser *)browser isLeafItem:(id)item {
|
||||
|
||||
if (!item) return YES;
|
||||
if (item == _data) return NO;
|
||||
|
||||
return ![(NSDictionary *)item objectForKey: @"Children"];
|
||||
}
|
||||
|
||||
- (id)browser:(NSBrowser *)browser child:(NSInteger)index ofItem:(id)item {
|
||||
|
||||
if (!item) return nil;
|
||||
if (item == _data) return [item objectAtIndex: index];
|
||||
|
||||
NSArray *data = [item objectForKey: @"Children"];
|
||||
return [data objectAtIndex: index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(id)browser:(NSBrowser *)browser objectValueForItem:(id)item {
|
||||
if (item == _data) return @"Root";
|
||||
return [item objectForKey: @"Name"];
|
||||
}
|
||||
|
||||
|
||||
- (NSInteger)browser:(NSBrowser *)browser numberOfChildrenOfItem:(id)item {
|
||||
NSArray *data = item == _data ? item : [item objectForKey: @"Children"];
|
||||
return [data count];
|
||||
}
|
||||
#endif
|
||||
|
||||
-(void)browser:(NSBrowser *)sender willDisplayCell:(id)cell atRow:(NSInteger)row column:(NSInteger)column {
|
||||
[(NSBrowserCell *)cell set];
|
||||
[(NSBrowserCell *)cell setLeaf: YES];
|
||||
[(NSBrowserCell *)cell setStringValue: @"Hello"];
|
||||
}
|
||||
|
||||
|
||||
-(NSArray *)args {
|
||||
NSMutableArray *array = [NSMutableArray new];
|
||||
|
||||
for (unsigned i = 0; i < sizeof(Keys)/sizeof(Keys[0]); ++i) {
|
||||
NSString *key = Keys[i];
|
||||
|
||||
NSString *value = [self valueForKey: key];
|
||||
if (!value || ![value length]) continue;
|
||||
[array addObject: Mame[i]];
|
||||
[array addObject: value];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue