1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-09 06:29:33 +00:00

Ensures the Mac doesn't show the 'Insert...' option for machines that can't accept an insertion.

This commit is contained in:
Thomas Harte 2018-08-06 18:52:42 -04:00
parent 60ac9b49ea
commit c61b9dca17
3 changed files with 12 additions and 0 deletions

View File

@ -301,6 +301,7 @@ class MachineDocument:
switch item.action {
case #selector(self.useKeyboardAsKeyboard):
if machine == nil || !machine.hasKeyboard {
menuItem.state = .off
return false
}
@ -309,6 +310,7 @@ class MachineDocument:
case #selector(self.useKeyboardAsJoystick):
if machine == nil || !machine.hasJoystick {
menuItem.state = .off
return false
}
@ -318,6 +320,9 @@ class MachineDocument:
case #selector(self.showActivity(_:)):
return self.activityPanel != nil
case #selector(self.insertMedia(_:)):
return self.machine != nil && self.machine.canInsertMedia
default: break
}
}

View File

@ -39,6 +39,7 @@ typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
@interface CSMachine : NSObject
- (nonnull instancetype)init NS_UNAVAILABLE;
/*!
Initialises an instance of CSMachine.
@ -70,6 +71,8 @@ typedef NS_ENUM(NSInteger, CSMachineKeyboardInputMode) {
@property (nonatomic, assign) CSMachineVideoSignal videoSignal;
@property (nonatomic, assign) BOOL useAutomaticTapeMotorControl;
@property (nonatomic, readonly) BOOL canInsertMedia;
- (bool)supportsVideoSignal:(CSMachineVideoSignal)videoSignal;
// Input control.

View File

@ -516,6 +516,10 @@ struct ActivityObserver: public Activity::Observer {
return [[NSString stringWithUTF8String:name.c_str()] lowercaseString];
}
- (BOOL)canInsertMedia {
return !!_machine->media_target();
}
#pragma mark - Special machines
- (CSAtari2600 *)atari2600 {