diff --git a/Boxer/BXSession+BXUIControls.h b/Boxer/BXSession+BXUIControls.h index 931e9009..2c8cc477 100644 --- a/Boxer/BXSession+BXUIControls.h +++ b/Boxer/BXSession+BXUIControls.h @@ -159,6 +159,9 @@ typedef NS_ENUM(NSInteger, BXPlaybackMode) { - (IBAction) mountNextDrivesInQueues: (id)sender; - (IBAction) mountPreviousDrivesInQueues: (id)sender; +/// Cycle all mounted drives to their next queued images. Triggered by Cmd+F4 keyboard shortcut. +- (IBAction) cycleMountedDiscsForward: (id)sender; + /// Whether we have any drive queues that can be cycled. Used for UI bindings. - (BOOL) canCycleDrivesInQueues; diff --git a/Boxer/BXSession+BXUIControls.m b/Boxer/BXSession+BXUIControls.m index f381392b..8ce03fac 100644 --- a/Boxer/BXSession+BXUIControls.m +++ b/Boxer/BXSession+BXUIControls.m @@ -1087,6 +1087,36 @@ - (IBAction) mountPreviousDrivesInQueues: (id)sender [self _mountQueuedSiblingsAtOffset: -1]; } +- (IBAction) cycleMountedDiscsForward: (id)sender +{ + //Cycle through each mounted drive's queued images, showing bezel notifications for each change. + //This is triggered by Cmd+F4 in the keyboard input handler. + for (BXDrive *currentDrive in self.mountedDrives) + { + BXDrive *siblingDrive = [self siblingOfQueuedDrive: currentDrive atOffset: 1]; + if (siblingDrive && ![siblingDrive isEqual: currentDrive]) + { + NSError *mountError = nil; + BXDrive *mountedDrive = [self mountDrive: siblingDrive + ifExists: BXDriveReplace + options: BXDefaultDriveMountOptions + error: &mountError]; + + if (!mountedDrive && mountError) + { + [self presentError: mountError + modalForWindow: self.windowForDriveSheet + delegate: nil + didPresentSelector: NULL + contextInfo: NULL]; + + //Don't continue mounting if we encounter a problem + break; + } + } + } +} + + (NSSet *) keyPathsForValuesAffectingCanCycleDrivesInQueues { return [NSSet setWithObject: @"drives"]; diff --git a/Boxer/DOS window/BXInputController+BXKeyboardInput.m b/Boxer/DOS window/BXInputController+BXKeyboardInput.m index d74b306a..2bc9c036 100644 --- a/Boxer/DOS window/BXInputController+BXKeyboardInput.m +++ b/Boxer/DOS window/BXInputController+BXKeyboardInput.m @@ -68,6 +68,14 @@ - (void) _syncKeyboardLayout - (void) keyDown: (NSEvent *)theEvent { + //Special handling for Cmd+F4 to cycle through mounted disc images + if ((theEvent.modifierFlags & NSEventModifierFlagCommand) == NSEventModifierFlagCommand && + theEvent.keyCode == kVK_F4) + { + [self cycleMountedDiscsForward: self]; + return; + } + //If the keypress was command-modified, don't pass it on to the emulator as it indicates //a failed key equivalent. //(This is consistent with how other OS X apps with textinput handle Cmd-keypresses.) @@ -230,6 +238,10 @@ - (IBAction) sendForwardSlash: (id)sender { [self.representedObject.emulator ha - (IBAction) sendColon: (id)sender { [self.representedObject.emulator handlePastedString: @":" asCommand: NO]; } - (IBAction) sendDash: (id)sender { [self.representedObject.emulator handlePastedString: @"-" asCommand: NO]; } +- (IBAction) cycleMountedDiscsForward: (id)sender +{ + [self.representedObject cycleMountedDiscsForward: sender]; +} - (void) type: (NSString *)message {