public void ProgressKeyDownState(KeyValue keyValue) { if (KeyValues.KeysWhichCanBePressedDown.Contains(keyValue) && KeyDownStates[keyValue].Value == Enums.KeyDownStates.Up) { Log.DebugFormat("Changing key down state of '{0}' key from UP to DOWN.", keyValue); KeyDownStates[keyValue].Value = Enums.KeyDownStates.Down; } else if (KeyValues.KeysWhichCanBeLockedDown.Contains(keyValue) && !KeyValues.KeysWhichCanBePressedDown.Contains(keyValue) && KeyDownStates[keyValue].Value == Enums.KeyDownStates.Up) { Log.DebugFormat("Changing key down state of '{0}' key from UP to LOCKED DOWN.", keyValue); KeyDownStates[keyValue].Value = Enums.KeyDownStates.LockedDown; } else if (KeyValues.KeysWhichCanBeLockedDown.Contains(keyValue) && KeyDownStates[keyValue].Value == Enums.KeyDownStates.Down) { Log.DebugFormat("Changing key down state of '{0}' key from DOWN to LOCKED DOWN.", keyValue); KeyDownStates[keyValue].Value = Enums.KeyDownStates.LockedDown; } else if (KeyDownStates[keyValue].Value != Enums.KeyDownStates.Up) { Log.DebugFormat("Changing key down state of '{0}' key from {1} to UP.", keyValue, KeyDownStates[keyValue].Value == Enums.KeyDownStates.Down ? "DOWN" : "LOCKED DOWN"); KeyDownStates[keyValue].Value = Enums.KeyDownStates.Up; } }
public void ThenA_CurrentPositionEventHandlerShouldBeAttachedToInputService() { var point = new Point(27, 10); var keyValue = new KeyValue(); InputService.Raise(s => s.CurrentPosition += null, this, new Tuple<Point, KeyValue?>(point, keyValue)); Assert.AreEqual(point, MainViewModel.CurrentPositionPoint); Assert.AreEqual(keyValue, MainViewModel.CurrentPositionKey); MouseOutputService.Verify(s => s.MoveTo(point), Times.Once()); }
public bool this[KeyValue keyValue] { get { //Key is not Sleep, but we are sleeping if (keyboardService.KeyDownStates[KeyValues.SleepKey].Value.IsDownOrLockedDown() && keyValue != KeyValues.SleepKey) { return false; } //Key is publish only, but we are not publishing if (!keyboardService.KeyDownStates[KeyValues.SimulateKeyStrokesKey].Value.IsDownOrLockedDown() && KeyValues.PublishOnlyKeys.Contains(keyValue)) { return false; } //Key is MultiKeySelection, but a key which prevents text capture is down or locked down if (keyValue == KeyValues.MultiKeySelectionEnabledKey && KeyValues.KeysWhichPreventTextCaptureIfDownOrLocked.Any(kv => keyboardService.KeyDownStates[kv].Value.IsDownOrLockedDown())) { return false; } //Key is Calibrate, but not calibrate service available if (keyValue == KeyValues.CalibrateKey && calibrationService == null) { return false; } //Key is Repeat Last Mouse Action, but KeyEnabledStates.RepeatLastMouseActionIsValid is not true if (keyValue == KeyValues.RepeatLastMouseActionKey && !lastMouseActionStateManager.LastMouseActionExists) { return false; } //Key is Previous suggestions, but no suggestions, or on page 1 if (keyValue == KeyValues.PreviousSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.SuggestionsPage == 0)) { return false; } //Key is Next suggestions but no suggestions, or on last page if (keyValue == KeyValues.NextSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.Suggestions.Count <= ((suggestionService.SuggestionsPage * suggestionService.SuggestionsPerPage) + suggestionService.SuggestionsPerPage))) { return false; } //Key is Suggestion 1 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion1Key && !SuggestionKeyIsValid(0)) { return false; } //Key is Suggestion 2 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion2Key && !SuggestionKeyIsValid(1)) { return false; } //Key is Suggestion 3 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion3Key && !SuggestionKeyIsValid(2)) { return false; } //Key is Suggestion 4 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion4Key && !SuggestionKeyIsValid(3)) { return false; } //Key is Suggestion 5 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion5Key && !SuggestionKeyIsValid(4)) { return false; } //Key is Suggestion 6 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion6Key && !SuggestionKeyIsValid(5)) { return false; } //Key is not a letter, but we're capturing a multi-keyValue selection (which must be ended by selecting a letter) if (capturingStateManager.CapturingMultiKeySelection && !KeyValues.MultiKeySelectionKeys.Contains(keyValue)) { return false; } //Key is Maximise, but the window is already maximised if (keyValue == KeyValues.MaximiseSizeKey && mainWindowStateService.WindowState == WindowState.Maximized) { return false; } //Key is Restore, but the window is already normal if (keyValue == KeyValues.RestoreSizeKey && mainWindowStateService.WindowState == WindowState.Normal) { return false; } return true; } }
public bool this[KeyValue keyValue] { get { //Key is not Sleep, but we are sleeping if (keyStateService.KeyDownStates[KeyValues.SleepKey].Value.IsDownOrLockedDown() && keyValue != KeyValues.SleepKey) { return false; } //Key is publish only, but we are not publishing if (!keyStateService.SimulateKeyStrokes && KeyValues.PublishOnlyKeys.Contains(keyValue)) { return false; } //Key is MultiKeySelection, but a key which prevents text capture is down or locked down if (keyValue == KeyValues.MultiKeySelectionKey && KeyValues.KeysWhichPreventTextCaptureIfDownOrLocked.Any(kv => keyStateService.KeyDownStates[kv].Value.IsDownOrLockedDown())) { return false; } //Key is Calibrate, but not calibrate service available if (keyValue == KeyValues.CalibrateKey && calibrationService == null) { return false; } //Key is Repeat Last Mouse Action, but KeyEnabledStates.RepeatLastMouseActionIsValid is not true if (keyValue == KeyValues.RepeatLastMouseActionKey && !lastMouseActionStateManager.LastMouseActionExists) { return false; } //Key is Previous suggestions, but no suggestions, or on page 1 if (keyValue == KeyValues.PreviousSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.SuggestionsPage == 0)) { return false; } //Key is Next suggestions but no suggestions, or on last page if (keyValue == KeyValues.NextSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.Suggestions.Count <= ((suggestionService.SuggestionsPage * suggestionService.SuggestionsPerPage) + suggestionService.SuggestionsPerPage))) { return false; } //Key is Suggestion 1 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion1Key && !SuggestionKeyIsValid(0)) { return false; } //Key is Suggestion 2 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion2Key && !SuggestionKeyIsValid(1)) { return false; } //Key is Suggestion 3 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion3Key && !SuggestionKeyIsValid(2)) { return false; } //Key is Suggestion 4 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion4Key && !SuggestionKeyIsValid(3)) { return false; } //Key is Suggestion 5 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion5Key && !SuggestionKeyIsValid(4)) { return false; } //Key is Suggestion 6 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion6Key && !SuggestionKeyIsValid(5)) { return false; } //Expand/Collapse dock when not docked if ((keyValue == KeyValues.ExpandDockKey || keyValue == KeyValues.CollapseDockKey) && Settings.Default.MainWindowState != WindowStates.Docked) { return false; } //Move & Resize keys when docked if(Settings.Default.MainWindowState == WindowStates.Docked && ((Settings.Default.MainWindowDockPosition == DockEdges.Top && (keyValue == KeyValues.MoveToTopBoundaryKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Bottom && (keyValue == KeyValues.MoveToBottomBoundaryKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Left && (keyValue == KeyValues.MoveToLeftBoundaryKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Right && (keyValue == KeyValues.MoveToRightBoundaryKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey)) || keyValue == KeyValues.MoveToBottomAndLeftBoundariesKey || keyValue == KeyValues.MoveToBottomAndRightBoundariesKey || keyValue == KeyValues.MoveToTopAndLeftBoundariesKey || keyValue == KeyValues.MoveToTopAndRightBoundariesKey)) { return false; } //Mouse actions involving left button if it is already down if ((keyValue == KeyValues.MouseDragKey || keyValue == KeyValues.MouseLeftClickKey || keyValue == KeyValues.MouseLeftDoubleClickKey || keyValue == KeyValues.MouseMoveAndLeftClickKey || keyValue == KeyValues.MouseMoveAndLeftDoubleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseLeftDownUpKey].Value.IsDownOrLockedDown()) { return false; } //Mouse actions involving middle button if it is already down if ((keyValue == KeyValues.MouseMiddleClickKey || keyValue == KeyValues.MouseMoveAndMiddleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseMiddleDownUpKey].Value.IsDownOrLockedDown()) { return false; } //Mouse actions involving right button if it is already down if ((keyValue == KeyValues.MouseRightClickKey || keyValue == KeyValues.MouseMoveAndRightClickKey) && keyStateService.KeyDownStates[KeyValues.MouseRightDownUpKey].Value.IsDownOrLockedDown()) { return false; } //Multi-key capture is disabled if (keyValue == KeyValues.MultiKeySelectionKey && !Settings.Default.MultiKeySelectionEnabled) { return false; } //Key is not a letter, but we're capturing a multi-keyValue selection (which must be ended by selecting a letter) if (capturingStateManager.CapturingMultiKeySelection && !KeyValues.MultiKeySelectionKeys.Contains(keyValue)) { return false; } return true; } }
public void ProcessFunctionKey(FunctionKeys functionKey) { Log.DebugFormat("Processing captured function key '{0}'", functionKey); lastTextChangeWasSuggestion = false; switch (functionKey) { case FunctionKeys.BackMany: if (!string.IsNullOrEmpty(Text)) { var backManyCount = Text.CountBackToLastCharCategoryBoundary(); dictionaryService.DecrementEntryUsageCount(Text.Substring(Text.Length - backManyCount, backManyCount).Trim()); var textAfterBackMany = Text.Substring(0, Text.Length - backManyCount); var textChangedByBackMany = Text != textAfterBackMany; Text = textAfterBackMany; if (backManyCount == 0) backManyCount = 1; //Always publish at least one backspace for (int i = 0; i < backManyCount; i++) { PublishKeyPress(FunctionKeys.BackOne); ReleaseUnlockedKeys(); } if (textChangedByBackMany || string.IsNullOrEmpty(Text)) { AutoPressShiftIfAppropriate(); } StoreLastTextChange(null); GenerateAutoCompleteSuggestions(); Log.Debug("Suppressing next auto space."); suppressNextAutoSpace = true; } else { //Scratchpad is empty, but publish 1 backspace anyway, as per the behaviour for 'BackOne' PublishKeyPress(FunctionKeys.BackOne); } break; case FunctionKeys.BackOne: var backOneCount = string.IsNullOrEmpty(lastTextChange) ? 1 //Default to removing one character if no lastTextChange : lastTextChange.Length; var textChangedByBackOne = false; if (!string.IsNullOrEmpty(Text)) { if (Text.Length < backOneCount) { backOneCount = Text.Length; //Coallesce backCount if somehow the Text length is less } var textAfterBackOne = Text.Substring(0, Text.Length - backOneCount); textChangedByBackOne = Text != textAfterBackOne; if (backOneCount > 1) { //Removing more than one character - only decrement removed string dictionaryService.DecrementEntryUsageCount(Text.Substring(Text.Length - backOneCount, backOneCount).Trim()); } else if(!string.IsNullOrEmpty(lastTextChange) && lastTextChange.Length == 1 && !Char.IsWhiteSpace(lastTextChange[0])) { dictionaryService.DecrementEntryUsageCount(Text.InProgressWord(Text.Length)); //We are removing a non-whitespace character - decrement the in progress word dictionaryService.IncrementEntryUsageCount(textAfterBackOne.InProgressWord(Text.Length)); //And increment the in progress word that is left after the removal } Text = textAfterBackOne; } for (int i = 0; i < backOneCount; i++) { PublishKeyPress(FunctionKeys.BackOne); ReleaseUnlockedKeys(); } if (textChangedByBackOne || string.IsNullOrEmpty(Text)) { AutoPressShiftIfAppropriate(); } StoreLastTextChange(null); GenerateAutoCompleteSuggestions(); Log.Debug("Suppressing next auto space."); suppressNextAutoSpace = true; break; case FunctionKeys.ClearScratchpad: Text = null; StoreLastTextChange(null); ClearSuggestions(); AutoPressShiftIfAppropriate(); Log.Debug("Suppressing next auto space."); suppressNextAutoSpace = true; break; case FunctionKeys.Suggestion1: SwapLastTextChangeForSuggestion(0); lastTextChangeWasSuggestion = true; break; case FunctionKeys.Suggestion2: SwapLastTextChangeForSuggestion(1); lastTextChangeWasSuggestion = true; break; case FunctionKeys.Suggestion3: SwapLastTextChangeForSuggestion(2); lastTextChangeWasSuggestion = true; break; case FunctionKeys.Suggestion4: SwapLastTextChangeForSuggestion(3); lastTextChangeWasSuggestion = true; break; case FunctionKeys.Suggestion5: SwapLastTextChangeForSuggestion(4); lastTextChangeWasSuggestion = true; break; case FunctionKeys.Suggestion6: SwapLastTextChangeForSuggestion(5); lastTextChangeWasSuggestion = true; break; default: if (functionKey.ToVirtualKeyCode() != null) { //Key corresponds to physical keyboard key GenerateAutoCompleteSuggestions(); //If the key cannot be pressed or locked down (these are handled in //ReactToPublishableKeyDownStateChanges) then publish it and release unlocked keys var keyValue = new KeyValue { FunctionKey = functionKey }; if (!KeyValues.KeysWhichCanBePressedDown.Contains(keyValue) && !KeyValues.KeysWhichCanBeLockedDown.Contains(keyValue)) { PublishKeyPress(functionKey); ReleaseUnlockedKeys(); } } if (functionKey == FunctionKeys.LeftShift) { shiftStateSetAutomatically = false; } break; } }
private void HandleFunctionKeySelectionResult(KeyValue singleKeyValue) { if (singleKeyValue.FunctionKey != null) { keyStateService.ProgressKeyDownState(singleKeyValue); var currentKeyboard = Keyboard; switch (singleKeyValue.FunctionKey.Value) { case FunctionKeys.AddToDictionary: AddTextToDictionary(); break; case FunctionKeys.AlphaKeyboard: Log.Debug("Changing keyboard to Alpha."); Keyboard = new Alpha(); break; case FunctionKeys.BackFromKeyboard: Log.Debug("Navigating back from keyboard."); var navigableKeyboard = Keyboard as IBackAction; if (navigableKeyboard != null && navigableKeyboard.BackAction != null) { navigableKeyboard.BackAction(); } else { Keyboard = new Alpha(); } break; case FunctionKeys.Calibrate: if (CalibrationService != null) { Log.Debug("Calibrate requested."); var question = CalibrationService.CanBeCompletedWithoutManualIntervention ? "Are you sure you would like to re-calibrate?" : "Calibration cannot be completed without manual intervention, e.g. having to use a mouse. You may be stuck in the calibration process if you cannot manually interact with your computer.\nAre you sure you would like to re-calibrate?"; Keyboard = new YesNoQuestion( question, () => { inputService.RequestSuspend(); Keyboard = currentKeyboard; CalibrateRequest.Raise(new NotificationWithCalibrationResult(), calibrationResult => { if (calibrationResult.Success) { audioService.PlaySound(Settings.Default.InfoSoundFile, Settings.Default.InfoSoundVolume); RaiseToastNotification("Success", calibrationResult.Message, NotificationTypes.Normal, () => inputService.RequestResume()); } else { audioService.PlaySound(Settings.Default.ErrorSoundFile, Settings.Default.ErrorSoundVolume); RaiseToastNotification("Uh-oh!", calibrationResult.Exception != null ? calibrationResult.Exception.Message : calibrationResult.Message ?? "Something went wrong, but I don't know what - please check the logs", NotificationTypes.Error, () => inputService.RequestResume()); } }); }, () => { Keyboard = currentKeyboard; }); } break; case FunctionKeys.CollapseDock: Log.Debug("Collapsing dock."); mainWindowManipulationService.ResizeDockToCollapsed(); if (Keyboard is ViewModels.Keyboards.Mouse) { Settings.Default.MouseKeyboardDockSize = DockSizes.Collapsed; } break; case FunctionKeys.ConversationAlphaKeyboard: Log.Debug("Changing keyboard to ConversationAlpha."); var opacityBeforeConversationAlpha = mainWindowManipulationService.GetOpacity(); Action conversationAlphaBackAction = currentKeyboard is ConversationNumericAndSymbols ? ((ConversationNumericAndSymbols)currentKeyboard).BackAction : () => { Log.Debug("Restoring window size."); mainWindowManipulationService.Restore(); Log.DebugFormat("Restoring window opacity to {0}", opacityBeforeConversationAlpha); mainWindowManipulationService.SetOpacity(opacityBeforeConversationAlpha); Keyboard = currentKeyboard; }; Keyboard = new ConversationAlpha(conversationAlphaBackAction); Log.Debug("Maximising window."); mainWindowManipulationService.Maximise(); Log.DebugFormat("Setting opacity to 1 (fully opaque)"); mainWindowManipulationService.SetOpacity(1); break; case FunctionKeys.ConversationNumericAndSymbolsKeyboard: Log.Debug("Changing keyboard to ConversationNumericAndSymbols."); var opacityBeforeConversationNumericAndSymbols = mainWindowManipulationService.GetOpacity(); Action conversationNumericAndSymbolsBackAction = currentKeyboard is ConversationAlpha ? ((ConversationAlpha)currentKeyboard).BackAction : () => { Log.Debug("Restoring window size."); mainWindowManipulationService.Restore(); Log.DebugFormat("Restoring window opacity to {0}", opacityBeforeConversationNumericAndSymbols); mainWindowManipulationService.SetOpacity(opacityBeforeConversationNumericAndSymbols); Keyboard = currentKeyboard; }; Keyboard = new ConversationNumericAndSymbols(conversationNumericAndSymbolsBackAction); Log.Debug("Maximising window."); mainWindowManipulationService.Maximise(); Log.DebugFormat("Setting opacity to 1 (fully opaque)"); mainWindowManipulationService.SetOpacity(1); break; case FunctionKeys.Currencies1Keyboard: Log.Debug("Changing keyboard to Currencies1."); Keyboard = new Currencies1(); break; case FunctionKeys.Currencies2Keyboard: Log.Debug("Changing keyboard to Currencies2."); Keyboard = new Currencies2(); break; case FunctionKeys.DecreaseOpacity: Log.Debug("Decreasing opacity."); mainWindowManipulationService.IncrementOrDecrementOpacity(false); break; case FunctionKeys.Diacritic1Keyboard: Log.Debug("Changing keyboard to Diacritic1."); Keyboard = new Diacritics1(); break; case FunctionKeys.Diacritic2Keyboard: Log.Debug("Changing keyboard to Diacritic2."); Keyboard = new Diacritics2(); break; case FunctionKeys.Diacritic3Keyboard: Log.Debug("Changing keyboard to Diacritic3."); Keyboard = new Diacritics3(); break; case FunctionKeys.ExpandDock: Log.Debug("Expanding dock."); mainWindowManipulationService.ResizeDockToFull(); if (Keyboard is ViewModels.Keyboards.Mouse) { Settings.Default.MouseKeyboardDockSize = DockSizes.Full; } break; case FunctionKeys.ExpandToBottom: Log.DebugFormat("Expanding to bottom by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.Bottom, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToBottomAndLeft: Log.DebugFormat("Expanding to bottom and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.BottomLeft, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToBottomAndRight: Log.DebugFormat("Expanding to bottom and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.BottomRight, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToLeft: Log.DebugFormat("Expanding to left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.Left, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToRight: Log.DebugFormat("Expanding to right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.Right, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToTop: Log.DebugFormat("Expanding to top by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.Top, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToTopAndLeft: Log.DebugFormat("Expanding to top and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.TopLeft, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToTopAndRight: Log.DebugFormat("Expanding to top and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Expand(ExpandToDirections.TopRight, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.IncreaseOpacity: Log.Debug("Increasing opacity."); mainWindowManipulationService.IncrementOrDecrementOpacity(true); break; case FunctionKeys.MenuKeyboard: Log.Debug("Restoring window size."); mainWindowManipulationService.Restore(); Log.Debug("Changing keyboard to Menu."); Keyboard = new Menu(() => Keyboard = currentKeyboard); break; case FunctionKeys.Minimise: Log.Debug("Minimising window."); mainWindowManipulationService.Minimise(); Log.Debug("Changing keyboard to Minimised."); Keyboard = new Minimised(() => { Log.Debug("Restoring window size."); mainWindowManipulationService.Restore(); Keyboard = currentKeyboard; }); break; case FunctionKeys.MouseDrag: Log.Debug("Mouse drag selected."); SetupFinalClickAction(firstFinalPoint => { if (firstFinalPoint != null) { audioService.PlaySound(Settings.Default.MouseDownSoundFile, Settings.Default.MouseDownSoundVolume); //This class reacts to the point selection event AFTER the MagnifyPopup reacts to it. //This means that if the MagnifyPopup sets the nextPointSelectionAction from the //MagnifiedPointSelectionAction then it will be called immediately i.e. for the same point. //The workaround is to set the nextPointSelectionAction to a lambda which sets the NEXT //nextPointSelectionAction. This means the immediate call to the lambda just sets up the //delegate for the subsequent call. nextPointSelectionAction = repeatFirstClickOrSecondClickAction => { Action<Point> deferIfMagnifyingElseDoNow = repeatFirstClickOrSecondClickPoint => { Action<Point?> secondFinalClickAction = secondFinalPoint => { if (secondFinalPoint != null) { Action<Point, Point> simulateDrag = (fp1, fp2) => { Log.DebugFormat("Performing mouse drag between points ({0},{1}) and {2},{3}).", fp1.X, fp1.Y, fp2.X, fp2.Y); mouseOutputService.MoveTo(fp1); mouseOutputService.LeftButtonDown(); audioService.PlaySound(Settings.Default.MouseUpSoundFile, Settings.Default.MouseUpSoundVolume); mouseOutputService.MoveTo(fp2); mouseOutputService.LeftButtonUp(); }; lastMouseActionStateManager.LastMouseAction = () => simulateDrag(firstFinalPoint.Value, secondFinalPoint.Value); simulateDrag(firstFinalPoint.Value, secondFinalPoint.Value); } ResetAndCleanupAfterMouseAction(); }; if (keyStateService.KeyDownStates[KeyValues.MouseMagnifierKey].Value.IsDownOrLockedDown()) { ShowCursor = false; //See MouseMoveAndLeftClick case for explanation of this MagnifiedPointSelectionAction = secondFinalClickAction; MagnifyAtPoint = repeatFirstClickOrSecondClickPoint; ShowCursor = true; } else { secondFinalClickAction(repeatFirstClickOrSecondClickPoint); } nextPointSelectionAction = null; }; if (keyStateService.KeyDownStates[KeyValues.MouseMagnifierKey].Value.IsDownOrLockedDown()) { nextPointSelectionAction = deferIfMagnifyingElseDoNow; } else { deferIfMagnifyingElseDoNow(repeatFirstClickOrSecondClickAction); } }; } else { //Reset and clean up if we are not continuing to 2nd point SelectionMode = SelectionModes.Key; nextPointSelectionAction = null; ShowCursor = false; if (keyStateService.KeyDownStates[KeyValues.MouseMagnifierKey].Value == KeyDownStates.Down) { keyStateService.KeyDownStates[KeyValues.MouseMagnifierKey].Value = KeyDownStates.Up; //Release magnifier if down but not locked down } } //Reset and clean up MagnifyAtPoint = null; MagnifiedPointSelectionAction = null; }, finalClickInSeries: false); break; case FunctionKeys.MouseKeyboard: Log.Debug("Changing keyboard to Mouse."); Action backAction; if (keyStateService.SimulateKeyStrokes && Settings.Default.SuppressModifierKeysWhenInMouseKeyboard) { var lastLeftShiftValue = keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value; var lastLeftCtrlValue = keyStateService.KeyDownStates[KeyValues.LeftCtrlKey].Value; var lastLeftWinValue = keyStateService.KeyDownStates[KeyValues.LeftWinKey].Value; var lastLeftAltValue = keyStateService.KeyDownStates[KeyValues.LeftAltKey].Value; keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value = KeyDownStates.Up; keyStateService.KeyDownStates[KeyValues.LeftCtrlKey].Value = KeyDownStates.Up; keyStateService.KeyDownStates[KeyValues.LeftWinKey].Value = KeyDownStates.Up; keyStateService.KeyDownStates[KeyValues.LeftAltKey].Value = KeyDownStates.Up; backAction = () => { keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value = lastLeftShiftValue; keyStateService.KeyDownStates[KeyValues.LeftCtrlKey].Value = lastLeftCtrlValue; keyStateService.KeyDownStates[KeyValues.LeftWinKey].Value = lastLeftWinValue; keyStateService.KeyDownStates[KeyValues.LeftAltKey].Value = lastLeftAltValue; Keyboard = currentKeyboard; }; } else { backAction = () => Keyboard = currentKeyboard; } Keyboard = new Mouse(backAction); //Reinstate mouse keyboard docked state (if docked) if (Settings.Default.MainWindowState == WindowStates.Docked) { if (Settings.Default.MouseKeyboardDockSize == DockSizes.Full && Settings.Default.MainWindowDockSize != DockSizes.Full) { mainWindowManipulationService.ResizeDockToFull(); } else if (Settings.Default.MouseKeyboardDockSize == DockSizes.Collapsed && Settings.Default.MainWindowDockSize != DockSizes.Collapsed) { mainWindowManipulationService.ResizeDockToCollapsed(); } } break; case FunctionKeys.MouseLeftClick: var leftClickPoint = mouseOutputService.GetCursorPosition(); Log.DebugFormat("Mouse left click selected at point ({0},{1}).", leftClickPoint.X, leftClickPoint.Y); Action<Point?> performLeftClick = point => { if (point != null) { mouseOutputService.MoveTo(point.Value); } audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); mouseOutputService.LeftButtonClick(); }; lastMouseActionStateManager.LastMouseAction = () => performLeftClick(leftClickPoint); performLeftClick(null); break; case FunctionKeys.MouseLeftDoubleClick: var leftDoubleClickPoint = mouseOutputService.GetCursorPosition(); Log.DebugFormat("Mouse left double click selected at point ({0},{1}).", leftDoubleClickPoint.X, leftDoubleClickPoint.Y); Action<Point?> performLeftDoubleClick = point => { if (point != null) { mouseOutputService.MoveTo(point.Value); } audioService.PlaySound(Settings.Default.MouseDoubleClickSoundFile, Settings.Default.MouseDoubleClickSoundVolume); mouseOutputService.LeftButtonDoubleClick(); }; lastMouseActionStateManager.LastMouseAction = () => performLeftDoubleClick(leftDoubleClickPoint); performLeftDoubleClick(null); break; case FunctionKeys.MouseLeftDownUp: var leftDownUpPoint = mouseOutputService.GetCursorPosition(); if (keyStateService.KeyDownStates[KeyValues.MouseLeftDownUpKey].Value.IsDownOrLockedDown()) { Log.DebugFormat("Pressing mouse left button down at point ({0},{1}).", leftDownUpPoint.X, leftDownUpPoint.Y); audioService.PlaySound(Settings.Default.MouseDownSoundFile, Settings.Default.MouseDownSoundVolume); mouseOutputService.LeftButtonDown(); lastMouseActionStateManager.LastMouseAction = null; } else { Log.DebugFormat("Releasing mouse left button at point ({0},{1}).", leftDownUpPoint.X, leftDownUpPoint.Y); audioService.PlaySound(Settings.Default.MouseUpSoundFile, Settings.Default.MouseUpSoundVolume); mouseOutputService.LeftButtonUp(); lastMouseActionStateManager.LastMouseAction = null; } break; case FunctionKeys.MouseMiddleClick: var middleClickPoint = mouseOutputService.GetCursorPosition(); Log.DebugFormat("Mouse middle click selected at point ({0},{1}).", middleClickPoint.X, middleClickPoint.Y); Action<Point?> performMiddleClick = point => { if (point != null) { mouseOutputService.MoveTo(point.Value); } audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); mouseOutputService.MiddleButtonClick(); }; lastMouseActionStateManager.LastMouseAction = () => performMiddleClick(middleClickPoint); performMiddleClick(null); break; case FunctionKeys.MouseMiddleDownUp: var middleDownUpPoint = mouseOutputService.GetCursorPosition(); if (keyStateService.KeyDownStates[KeyValues.MouseMiddleDownUpKey].Value.IsDownOrLockedDown()) { Log.DebugFormat("Pressing mouse middle button down at point ({0},{1}).", middleDownUpPoint.X, middleDownUpPoint.Y); audioService.PlaySound(Settings.Default.MouseDownSoundFile, Settings.Default.MouseDownSoundVolume); mouseOutputService.MiddleButtonDown(); lastMouseActionStateManager.LastMouseAction = null; } else { Log.DebugFormat("Releasing mouse middle button at point ({0},{1}).", middleDownUpPoint.X, middleDownUpPoint.Y); audioService.PlaySound(Settings.Default.MouseUpSoundFile, Settings.Default.MouseUpSoundVolume); mouseOutputService.MiddleButtonUp(); lastMouseActionStateManager.LastMouseAction = null; } break; case FunctionKeys.MouseMoveAndLeftClick: Log.Debug("Mouse move and left click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { Log.DebugFormat("Performing mouse left click at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); mouseOutputService.MoveAndLeftClick(fp, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveAndLeftDoubleClick: Log.Debug("Mouse move and left double click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { Log.DebugFormat("Performing mouse left double click at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseDoubleClickSoundFile, Settings.Default.MouseDoubleClickSoundVolume); mouseOutputService.MoveAndLeftDoubleClick(fp, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveAndMiddleClick: Log.Debug("Mouse move and middle click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { Log.DebugFormat("Performing mouse middle click at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); mouseOutputService.MoveAndMiddleClick(fp, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveAndRightClick: Log.Debug("Mouse move and right click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { Log.DebugFormat("Performing mouse right click at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); mouseOutputService.MoveAndRightClick(fp, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveAmountInPixels: Log.Debug("Progressing MouseMoveAmountInPixels."); switch (Settings.Default.MouseMoveAmountInPixels) { case 1: Settings.Default.MouseMoveAmountInPixels = 5; break; case 5: Settings.Default.MouseMoveAmountInPixels = 10; break; case 10: Settings.Default.MouseMoveAmountInPixels = 25; break; case 25: Settings.Default.MouseMoveAmountInPixels = 50; break; case 50: Settings.Default.MouseMoveAmountInPixels = 100; break; default: Settings.Default.MouseMoveAmountInPixels = 1; break; } break; case FunctionKeys.MouseMoveAndScrollToBottom: Log.Debug("Mouse move and scroll to bottom selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateScrollToBottom = fp => { Log.DebugFormat("Performing mouse scroll to bottom at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); mouseOutputService.MoveAndScrollWheelDown(fp, Settings.Default.MouseScrollAmountInClicks, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateScrollToBottom(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateScrollToBottom(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveAndScrollToLeft: Log.Debug("Mouse move and scroll to left selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateScrollToLeft = fp => { Log.DebugFormat("Performing mouse scroll to left at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); mouseOutputService.MoveAndScrollWheelLeft(fp, Settings.Default.MouseScrollAmountInClicks, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateScrollToLeft(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateScrollToLeft(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveAndScrollToRight: Log.Debug("Mouse move and scroll to right selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateScrollToRight = fp => { Log.DebugFormat("Performing mouse scroll to right at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); mouseOutputService.MoveAndScrollWheelRight(fp, Settings.Default.MouseScrollAmountInClicks, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateScrollToRight(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateScrollToRight(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveAndScrollToTop: Log.Debug("Mouse move and scroll to top selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateScrollToTop = fp => { Log.DebugFormat("Performing mouse scroll to top at point ({0},{1}).", fp.X, fp.Y); audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); mouseOutputService.MoveAndScrollWheelUp(fp, Settings.Default.MouseScrollAmountInClicks, true); }; lastMouseActionStateManager.LastMouseAction = () => simulateScrollToTop(finalPoint.Value); ShowCursor = false; //Hide cursor popup before performing action as it is possible for it to be performed on the popup simulateScrollToTop(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveTo: Log.Debug("Mouse move to selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateMoveTo = fp => { Log.DebugFormat("Performing mouse move to point ({0},{1}).", fp.X, fp.Y); mouseOutputService.MoveTo(fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateMoveTo(finalPoint.Value); simulateMoveTo(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMoveToBottom: Log.Debug("Mouse move to bottom selected."); Action simulateMoveToBottom = () => { var cursorPosition = mouseOutputService.GetCursorPosition(); var moveToPoint = new Point(cursorPosition.X, cursorPosition.Y + Settings.Default.MouseMoveAmountInPixels); Log.DebugFormat("Performing mouse move to point ({0},{1}).", moveToPoint.X, moveToPoint.Y); mouseOutputService.MoveTo(moveToPoint); }; lastMouseActionStateManager.LastMouseAction = simulateMoveToBottom; simulateMoveToBottom(); break; case FunctionKeys.MouseMoveToLeft: Log.Debug("Mouse move to left selected."); Action simulateMoveToLeft = () => { var cursorPosition = mouseOutputService.GetCursorPosition(); var moveToPoint = new Point(cursorPosition.X - Settings.Default.MouseMoveAmountInPixels, cursorPosition.Y); Log.DebugFormat("Performing mouse move to point ({0},{1}).", moveToPoint.X, moveToPoint.Y); mouseOutputService.MoveTo(moveToPoint); }; lastMouseActionStateManager.LastMouseAction = simulateMoveToLeft; simulateMoveToLeft(); break; case FunctionKeys.MouseMoveToRight: Log.Debug("Mouse move to right selected."); Action simulateMoveToRight = () => { var cursorPosition = mouseOutputService.GetCursorPosition(); var moveToPoint = new Point(cursorPosition.X + Settings.Default.MouseMoveAmountInPixels, cursorPosition.Y); Log.DebugFormat("Performing mouse move to point ({0},{1}).", moveToPoint.X, moveToPoint.Y); mouseOutputService.MoveTo(moveToPoint); }; lastMouseActionStateManager.LastMouseAction = simulateMoveToRight; simulateMoveToRight(); break; case FunctionKeys.MouseMoveToTop: Log.Debug("Mouse move to top selected."); Action simulateMoveToTop = () => { var cursorPosition = mouseOutputService.GetCursorPosition(); var moveToPoint = new Point(cursorPosition.X, cursorPosition.Y - Settings.Default.MouseMoveAmountInPixels); Log.DebugFormat("Performing mouse move to point ({0},{1}).", moveToPoint.X, moveToPoint.Y); mouseOutputService.MoveTo(moveToPoint); }; lastMouseActionStateManager.LastMouseAction = simulateMoveToTop; simulateMoveToTop(); break; case FunctionKeys.MouseRightClick: var rightClickPoint = mouseOutputService.GetCursorPosition(); Log.DebugFormat("Mouse right click selected at point ({0},{1}).", rightClickPoint.X, rightClickPoint.Y); Action<Point?> performRightClick = point => { if (point != null) { mouseOutputService.MoveTo(point.Value); } audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); mouseOutputService.RightButtonClick(); }; lastMouseActionStateManager.LastMouseAction = () => performRightClick(rightClickPoint); performRightClick(null); break; case FunctionKeys.MouseRightDownUp: var rightDownUpPoint = mouseOutputService.GetCursorPosition(); if (keyStateService.KeyDownStates[KeyValues.MouseRightDownUpKey].Value.IsDownOrLockedDown()) { Log.DebugFormat("Pressing mouse right button down at point ({0},{1}).", rightDownUpPoint.X, rightDownUpPoint.Y); audioService.PlaySound(Settings.Default.MouseDownSoundFile, Settings.Default.MouseDownSoundVolume); mouseOutputService.RightButtonDown(); lastMouseActionStateManager.LastMouseAction = null; } else { Log.DebugFormat("Releasing mouse right button at point ({0},{1}).", rightDownUpPoint.X, rightDownUpPoint.Y); audioService.PlaySound(Settings.Default.MouseUpSoundFile, Settings.Default.MouseUpSoundVolume); mouseOutputService.RightButtonUp(); lastMouseActionStateManager.LastMouseAction = null; } break; case FunctionKeys.MoveAndResizeAdjustmentAmount: Log.Debug("Progressing MoveAndResizeAdjustmentAmount."); switch (Settings.Default.MoveAndResizeAdjustmentAmountInPixels) { case 1: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 5; break; case 5: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 10; break; case 10: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 25; break; case 25: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 50; break; case 50: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 100; break; default: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 1; break; } break; case FunctionKeys.MouseScrollAmountInClicks: Log.Debug("Progressing MouseScrollAmountInClicks."); switch (Settings.Default.MouseScrollAmountInClicks) { case 1: Settings.Default.MouseScrollAmountInClicks = 3; break; case 3: Settings.Default.MouseScrollAmountInClicks = 5; break; case 5: Settings.Default.MouseScrollAmountInClicks = 10; break; case 10: Settings.Default.MouseScrollAmountInClicks = 25; break; default: Settings.Default.MouseScrollAmountInClicks = 1; break; } break; case FunctionKeys.MoveToBottom: Log.DebugFormat("Moving to bottom by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.Bottom, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToBottomAndLeft: Log.DebugFormat("Moving to bottom and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.BottomLeft, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToBottomAndLeftBoundaries: Log.Debug("Moving to bottom and left boundaries."); mainWindowManipulationService.Move(MoveToDirections.BottomLeft, null); break; case FunctionKeys.MoveToBottomAndRight: Log.DebugFormat("Moving to bottom and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.BottomRight, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToBottomAndRightBoundaries: Log.Debug("Moving to bottom and right boundaries."); mainWindowManipulationService.Move(MoveToDirections.BottomRight, null); break; case FunctionKeys.MoveToBottomBoundary: Log.Debug("Moving to bottom boundary."); mainWindowManipulationService.Move(MoveToDirections.Bottom, null); break; case FunctionKeys.MoveToLeft: Log.DebugFormat("Moving to left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.Left, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToLeftBoundary: Log.Debug("Moving to left boundary."); mainWindowManipulationService.Move(MoveToDirections.Left, null); break; case FunctionKeys.MoveToRight: Log.DebugFormat("Moving to right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.Right, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToRightBoundary: Log.Debug("Moving to right boundary."); mainWindowManipulationService.Move(MoveToDirections.Right, null); break; case FunctionKeys.MoveToTop: Log.DebugFormat("Moving to top by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.Top, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToTopAndLeft: Log.DebugFormat("Moving to top and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.TopLeft, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToTopAndLeftBoundaries: Log.Debug("Moving to top and left boundaries."); mainWindowManipulationService.Move(MoveToDirections.TopLeft, null); break; case FunctionKeys.MoveToTopAndRight: Log.DebugFormat("Moving to top and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Move(MoveToDirections.TopRight, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToTopAndRightBoundaries: Log.Debug("Moving to top and right boundaries."); mainWindowManipulationService.Move(MoveToDirections.TopRight, null); break; case FunctionKeys.MoveToTopBoundary: Log.Debug("Moving to top boundary."); mainWindowManipulationService.Move(MoveToDirections.Top, null); break; case FunctionKeys.NextSuggestions: Log.Debug("Incrementing suggestions page."); if (suggestionService.Suggestions != null && (suggestionService.Suggestions.Count > (suggestionService.SuggestionsPage + 1) * SuggestionService.SuggestionsPerPage)) { suggestionService.SuggestionsPage++; } break; case FunctionKeys.NoQuestionResult: HandleYesNoQuestionResult(false); break; case FunctionKeys.NumericAndSymbols1Keyboard: Log.Debug("Changing keyboard to NumericAndSymbols1."); Keyboard = new NumericAndSymbols1(); break; case FunctionKeys.NumericAndSymbols2Keyboard: Log.Debug("Changing keyboard to NumericAndSymbols2."); Keyboard = new NumericAndSymbols2(); break; case FunctionKeys.NumericAndSymbols3Keyboard: Log.Debug("Changing keyboard to Symbols3."); Keyboard = new NumericAndSymbols3(); break; case FunctionKeys.PhysicalKeysKeyboard: Log.Debug("Changing keyboard to PhysicalKeys."); Keyboard = new PhysicalKeys(); break; case FunctionKeys.PreviousSuggestions: Log.Debug("Decrementing suggestions page."); if (suggestionService.SuggestionsPage > 0) { suggestionService.SuggestionsPage--; } break; case FunctionKeys.Quit: Log.Debug("Quit key selected."); var keyboardBeforeQuit = Keyboard; Keyboard = new YesNoQuestion("Are you sure you would like to quit?", () => { Keyboard = new YesNoQuestion("Are you absolutely sure that you'd like to quit?", () => Application.Current.Shutdown(), () => { Keyboard = keyboardBeforeQuit; }); }, () => { Keyboard = keyboardBeforeQuit; }); break; case FunctionKeys.RepeatLastMouseAction: if (lastMouseActionStateManager.LastMouseAction != null) { lastMouseActionStateManager.LastMouseAction(); } break; case FunctionKeys.ShrinkFromBottom: Log.DebugFormat("Shrinking from bottom by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.Bottom, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromBottomAndLeft: Log.DebugFormat("Shrinking from bottom and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.BottomLeft, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromBottomAndRight: Log.DebugFormat("Shrinking from bottom and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.BottomRight, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromLeft: Log.DebugFormat("Shrinking from left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.Left, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromRight: Log.DebugFormat("Shrinking from right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.Right, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromTop: Log.DebugFormat("Shrinking from top by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.Top, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromTopAndLeft: Log.DebugFormat("Shrinking from top and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.TopLeft, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromTopAndRight: Log.DebugFormat("Shrinking from top and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.Shrink(ShrinkFromDirections.TopRight, Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.SizeAndPositionKeyboard: Log.Debug("Changing keyboard to Size & Position."); Keyboard = new SizeAndPosition(() => Keyboard = currentKeyboard); break; case FunctionKeys.Speak: var speechStarted = audioService.SpeakNewOrInterruptCurrentSpeech( keyboardOutputService.Text, () => { KeyStateService.KeyDownStates[KeyValues.SpeakKey].Value = KeyDownStates.Up; }, Settings.Default.SpeechVolume, Settings.Default.SpeechRate, Settings.Default.SpeechVoice); KeyStateService.KeyDownStates[KeyValues.SpeakKey].Value = speechStarted ? KeyDownStates.Down : KeyDownStates.Up; break; case FunctionKeys.YesQuestionResult: HandleYesNoQuestionResult(true); break; } keyboardOutputService.ProcessFunctionKey(singleKeyValue.FunctionKey.Value); } }
private void KeySelectionResult(KeyValue? singleKeyValue, List<string> multiKeySelection) { //Single key string if (singleKeyValue != null && !string.IsNullOrEmpty(singleKeyValue.Value.String)) { Log.DebugFormat("KeySelectionResult received with string value '{0}'", singleKeyValue.Value.String.ConvertEscapedCharsToLiterals()); keyboardOutputService.ProcessSingleKeyText(singleKeyValue.Value.String); } //Single key function key if (singleKeyValue != null && singleKeyValue.Value.FunctionKey != null) { Log.DebugFormat("KeySelectionResult received with function key value '{0}'", singleKeyValue.Value.FunctionKey); HandleFunctionKeySelectionResult(singleKeyValue.Value); } //Multi key selection if (multiKeySelection != null && multiKeySelection.Any()) { Log.DebugFormat("KeySelectionResult received with '{0}' multiKeySelection results", multiKeySelection.Count); keyboardOutputService.ProcessMultiKeyTextAndSuggestions(multiKeySelection); } }
public bool Equals(KeyValue kv) { // Return true if the fields match: return (FunctionKey == kv.FunctionKey) && (String == kv.String); }
public bool this[KeyValue keyValue] { get { // Key has no payload if (keyValue == null || !keyValue.HasContent()) { return(false); } //Key is not Sleep, but we are sleeping if (keyStateService.KeyDownStates[KeyValues.SleepKey].Value.IsDownOrLockedDown() && keyValue != KeyValues.SleepKey) { return(false); } //Key is publish only, but we are not publishing (simulating key strokes) if (!keyStateService.SimulateKeyStrokes && KeyValues.PublishOnlyKeys.Contains(keyValue)) { return(false); } //Key is MultiKeySelection, but a key which prevents text capture is down or locked down if (keyValue == KeyValues.MultiKeySelectionIsOnKey && KeyValues.KeysWhichPreventTextCaptureIfDownOrLocked.Any(kv => keyStateService.KeyDownStates[kv].Value.IsDownOrLockedDown())) { return(false); } //Key is Shift and ForceCapsLock setting is true if (keyValue == KeyValues.LeftShiftKey && Settings.Default.ForceCapsLock) { return(false); } //Key is Calibrate, but calibrate service is not available if (keyValue == KeyValues.CalibrateKey && calibrationService == null) { return(false); } //Key is Repeat Last Mouse Action, but KeyEnabledStates.RepeatLastMouseActionIsValid is not true if (keyValue == KeyValues.RepeatLastMouseActionKey && !lastMouseActionStateManager.LastMouseActionExists) { return(false); } //Key is Previous suggestions, but no suggestions, or on page 1 if (keyValue == KeyValues.PreviousSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.SuggestionsPage == 0)) { return(false); } //Key is Next suggestions but no suggestions, or on last page if (keyValue == KeyValues.NextSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.Suggestions.Count <= ((suggestionService.SuggestionsPage * suggestionService.SuggestionsPerPage) + suggestionService.SuggestionsPerPage))) { return(false); } //Key is Suggestion 1 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion1Key && !SuggestionKeyIsValid(0)) { return(false); } //Key is Suggestion 2 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion2Key && !SuggestionKeyIsValid(1)) { return(false); } //Key is Suggestion 3 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion3Key && !SuggestionKeyIsValid(2)) { return(false); } //Key is Suggestion 4 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion4Key && !SuggestionKeyIsValid(3)) { return(false); } //Key is Suggestion 5 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion5Key && !SuggestionKeyIsValid(4)) { return(false); } //Key is Suggestion 6 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion6Key && !SuggestionKeyIsValid(5)) { return(false); } //Expand/Collapse dock when not docked if ((keyValue == KeyValues.ExpandDockKey || keyValue == KeyValues.CollapseDockKey) && Settings.Default.MainWindowState != WindowStates.Docked) { return(false); } //Move & Resize keys when docked if (Settings.Default.MainWindowState == WindowStates.Docked && ((Settings.Default.MainWindowDockPosition == DockEdges.Top && (keyValue == KeyValues.MoveToTopBoundaryKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Bottom && (keyValue == KeyValues.MoveToBottomBoundaryKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Left && (keyValue == KeyValues.MoveToLeftBoundaryKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Right && (keyValue == KeyValues.MoveToRightBoundaryKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey)) || keyValue == KeyValues.MoveToBottomAndLeftBoundariesKey || keyValue == KeyValues.MoveToBottomAndRightBoundariesKey || keyValue == KeyValues.MoveToTopAndLeftBoundariesKey || keyValue == KeyValues.MoveToTopAndRightBoundariesKey)) { return(false); } //Mouse actions involving left button if it is already down if ((keyValue == KeyValues.MouseDragKey || keyValue == KeyValues.MouseLeftClickKey || keyValue == KeyValues.MouseLeftDoubleClickKey || keyValue == KeyValues.MouseMoveAndLeftClickKey || keyValue == KeyValues.MouseMoveAndLeftDoubleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseLeftDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Mouse actions involving middle button if it is already down if ((keyValue == KeyValues.MouseMiddleClickKey || keyValue == KeyValues.MouseMoveAndMiddleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseMiddleDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Mouse actions involving right button if it is already down if ((keyValue == KeyValues.MouseRightClickKey || keyValue == KeyValues.MouseMoveAndRightClickKey) && keyStateService.KeyDownStates[KeyValues.MouseRightDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Multi-key capture is disabled explicitly in the settings if (keyValue == KeyValues.MultiKeySelectionIsOnKey && !Settings.Default.MultiKeySelectionEnabled) { return(false); } //Multi-key capture is disabled because the current language does not support the concept if (keyValue == KeyValues.MultiKeySelectionIsOnKey && new[] { Languages.KoreanKorea }.Contains(Settings.Default.KeyboardAndDictionaryLanguage)) { return(false); } //Key is not a letter, but we're capturing a multi-keyValue selection (which must be ended by selecting a letter) if (capturingStateManager.CapturingMultiKeySelection && !KeyValues.MultiKeySelectionKeys.Contains(keyValue)) { return(false); } // Multi-key is down/locked down - we shouldn't allow combining keys anymore if (KeyValues.KeysDisabledWithMultiKeysSelectionIsOn.Contains(keyValue) && keyStateService.KeyDownStates[KeyValues.MultiKeySelectionIsOnKey].Value.IsDownOrLockedDown()) { return(false); } //Catalan specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.CatalanSpain) { //Acute accent: Éé, Íí, Óó, Úú if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà, Èè, Òò if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("o") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Ïï, Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("i") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Cedilla: çÇ if (keyStateService.KeyDownStates[KeyValues.CombiningCedillaKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCedillaKey || //Allow the cedilla to be manually released keyValue == new KeyValue("c") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Czech specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.CzechCzechRepublic) { //Acute accent: áÁ éÉ íÍ óÓ úÚ ýÝ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == new KeyValue("y") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Caron: čČ ďĎ ěĚ ňŇ řŘ šŠ ťŤ žŽ if (keyStateService.KeyDownStates[KeyValues.CombiningCaronOrHacekKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCaronOrHacekKey || //Allow the caron to be manually released keyValue == new KeyValue("c") || keyValue == new KeyValue("d") || keyValue == new KeyValue("e") || keyValue == new KeyValue("n") || keyValue == new KeyValue("r") || keyValue == new KeyValue("s") || keyValue == new KeyValue("t") || keyValue == new KeyValue("z") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Greek specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.GreekGreece) { //Acute accent: Άά Έέ Ήή Ίί Όό Ύύ Ώώ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown() && !keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released (keyValue == KeyValues.CombiningDiaeresisOrUmlautKey && !keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value.IsDownOrLockedDown()) || //The acute accent can be combined with a diaeresis on lower case letters only (shift must be is up) keyValue == new KeyValue("α") || keyValue == new KeyValue("ε") || keyValue == new KeyValue("η") || keyValue == new KeyValue("ι") || keyValue == new KeyValue("ο") || keyValue == new KeyValue("υ") || keyValue == new KeyValue("ω") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Acute accent + diaeresis: ΐ ΰ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown() && keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown() && !keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value.IsDownOrLockedDown()) //These two diacritics can only be combined with lowercase letters { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == KeyValues.CombiningDiaeresisOrUmlautKey ||//Allow the diaeresis to be manually released keyValue == new KeyValue("ι") || keyValue == new KeyValue("υ")); } //Diaeresis: Ϊϊ Ϋϋ if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown() && !keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey ||//Allow the diaeresis to be manually released (keyValue == KeyValues.CombiningAcuteAccentKey && !keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value.IsDownOrLockedDown()) || //The diaeresis can be combined with an acute accent on lower case letters only (shift must be is up) keyValue == new KeyValue("ι") || keyValue == new KeyValue("υ") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //French specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.FrenchFrance || Settings.Default.KeyboardAndDictionaryLanguage == Languages.FrenchCanada) { //Acute accent: Éé if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("e") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà Èè Ùù if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Circumflex: Ââ Êê Îî Ôô Ûû if (keyStateService.KeyDownStates[KeyValues.CombiningCircumflexKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCircumflexKey || //Allow the circumflex to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Ëë Ïï Üü Ÿÿ if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("u") || keyValue == new KeyValue("y") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Cedilla: Çç if (keyStateService.KeyDownStates[KeyValues.CombiningCedillaKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCedillaKey || //Allow the cedilla to be manually released keyValue == new KeyValue("c") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Dutch specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.DutchBelgium || Settings.Default.KeyboardAndDictionaryLanguage == Languages.DutchNetherlands) { //Acute accent: Áá éÉ íÍ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà Èè if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Ëë Ïï Öö Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //German specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.GermanGermany) { //Diaeresis: Ää Öö Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Italian specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.ItalianItaly) { //Acute accent: éÉ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("e") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà Èè Ìì Òò Ùù if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Polish specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.PolishPoland) { if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { //Acute accent: ćĆ ńŃ óÓ śŚ źŹ return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("c") || keyValue == new KeyValue("n") || keyValue == new KeyValue("o") || keyValue == new KeyValue("s") || keyValue == new KeyValue("z") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } if (keyStateService.KeyDownStates[KeyValues.CombiningOgonekOrNosineKey].Value.IsDownOrLockedDown()) { //Ogonek accent: ąĄ ęĘ return(keyValue == KeyValues.CombiningOgonekOrNosineKey || //Allow the ogonek accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } if (keyStateService.KeyDownStates[KeyValues.CombiningDotAboveKey].Value.IsDownOrLockedDown()) { //Dot above accent: żŻ return(keyValue == KeyValues.CombiningDotAboveKey || //Allow the dot above accent to be manually released keyValue == new KeyValue("z") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Portuguese specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.PortuguesePortugal) { //Acute accent: áÁ éÉ íÍ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Circumflex: Ââ Êê Ôô if (keyStateService.KeyDownStates[KeyValues.CombiningCircumflexKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCircumflexKey || //Allow the circumflex to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("o") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Tilde: ãÃõÕ if (keyStateService.KeyDownStates[KeyValues.CombiningTildeKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningTildeKey || //Allow the circumflex to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("o") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Cedilla: Çç if (keyStateService.KeyDownStates[KeyValues.CombiningCedillaKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCedillaKey || //Allow the cedilla to be manually released keyValue == new KeyValue("c") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Russian specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.RussianRussia) { //Acute Accent: Аа Ээ Ыы Уу Оо Яя Ее Юю Ии if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("а") || keyValue == new KeyValue("э") || keyValue == new KeyValue("ы") || keyValue == new KeyValue("у") || keyValue == new KeyValue("о") || keyValue == new KeyValue("я") || keyValue == new KeyValue("е") || keyValue == new KeyValue("ю") || keyValue == new KeyValue("и") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Spanish specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.SpanishSpain) { //Acute accent: Áá éÉ íÍ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Slovak specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.SlovakSlovakia) { //Acute accent: Áá éÉ íÍ ĺĹ óÓ ŕŔ úÚ ýÝ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("l") || keyValue == new KeyValue("o") || keyValue == new KeyValue("r") || keyValue == new KeyValue("u") || keyValue == new KeyValue("y") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Caron: čČ ďĎ ľĽ ňŇ šŠ ťŤ žŽ if (keyStateService.KeyDownStates[KeyValues.CombiningCaronOrHacekKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCaronOrHacekKey || //Allow the caron to be manually released keyValue == new KeyValue("c") || keyValue == new KeyValue("d") || keyValue == new KeyValue("l") || keyValue == new KeyValue("n") || keyValue == new KeyValue("s") || keyValue == new KeyValue("t") || keyValue == new KeyValue("z") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Spanish specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.SpanishSpain) { //Acute accent: Áá éÉ íÍ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Turkish specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.TurkishTurkey) { //Circumflex: Ââ Îî Ûû if (keyStateService.KeyDownStates[KeyValues.CombiningCircumflexKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("i") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Ukrainian specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.UkrainianUkraine) { //Acute accent: Аа Ее Єє Ии Іі Її Оо Уу Юю Яя if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("а") || keyValue == new KeyValue("е") || keyValue == new KeyValue("є") || keyValue == new KeyValue("и") || keyValue == new KeyValue("і") || keyValue == new KeyValue("ї") || keyValue == new KeyValue("о") || keyValue == new KeyValue("у") || keyValue == new KeyValue("ю") || keyValue == new KeyValue("я") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } return(true); } }
public KeyValueAndTimeSpan(string name, KeyValue keyValue, string timeSpan) { this.name = name; this.keyValue = keyValue; this.timeSpan = timeSpan; }
public PointAndKeyValue(Point point, KeyValue? keyValue) : this() { Point = point; KeyValue = keyValue; }
public PointAndKeyValue(Point point, KeyValue keyValue) { Point = point; KeyValue = keyValue; }
public bool this[KeyValue keyValue] { get { //Key is not Sleep, but we are sleeping if (keyStateService.KeyDownStates[KeyValues.SleepKey].Value.IsDownOrLockedDown() && keyValue != KeyValues.SleepKey) { return(false); } //Key is publish only, but we are not publishing (simulating key strokes) if (!keyStateService.SimulateKeyStrokes && KeyValues.PublishOnlyKeys.Contains(keyValue)) { return(false); } //Key is MultiKeySelection, but a key which prevents text capture is down or locked down if (keyValue == KeyValues.MultiKeySelectionIsOnKey && KeyValues.KeysWhichPreventTextCaptureIfDownOrLocked.Any(kv => keyStateService.KeyDownStates[kv].Value.IsDownOrLockedDown())) { return(false); } //Key is Calibrate, but not calibrate service available if (keyValue == KeyValues.CalibrateKey && calibrationService == null) { return(false); } //Key is Repeat Last Mouse Action, but KeyEnabledStates.RepeatLastMouseActionIsValid is not true if (keyValue == KeyValues.RepeatLastMouseActionKey && !lastMouseActionStateManager.LastMouseActionExists) { return(false); } //Key is Previous suggestions, but no suggestions, or on page 1 if (keyValue == KeyValues.PreviousSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.SuggestionsPage == 0)) { return(false); } //Key is Next suggestions but no suggestions, or on last page if (keyValue == KeyValues.NextSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.Suggestions.Count <= ((suggestionService.SuggestionsPage * suggestionService.SuggestionsPerPage) + suggestionService.SuggestionsPerPage))) { return(false); } //Key is Suggestion 1 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion1Key && !SuggestionKeyIsValid(0)) { return(false); } //Key is Suggestion 2 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion2Key && !SuggestionKeyIsValid(1)) { return(false); } //Key is Suggestion 3 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion3Key && !SuggestionKeyIsValid(2)) { return(false); } //Key is Suggestion 4 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion4Key && !SuggestionKeyIsValid(3)) { return(false); } //Key is Suggestion 5 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion5Key && !SuggestionKeyIsValid(4)) { return(false); } //Key is Suggestion 6 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion6Key && !SuggestionKeyIsValid(5)) { return(false); } //Expand/Collapse dock when not docked if ((keyValue == KeyValues.ExpandDockKey || keyValue == KeyValues.CollapseDockKey) && Settings.Default.MainWindowState != WindowStates.Docked) { return(false); } //Move & Resize keys when docked if (Settings.Default.MainWindowState == WindowStates.Docked && ((Settings.Default.MainWindowDockPosition == DockEdges.Top && (keyValue == KeyValues.MoveToTopBoundaryKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Bottom && (keyValue == KeyValues.MoveToBottomBoundaryKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Left && (keyValue == KeyValues.MoveToLeftBoundaryKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Right && (keyValue == KeyValues.MoveToRightBoundaryKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey)) || keyValue == KeyValues.MoveToBottomAndLeftBoundariesKey || keyValue == KeyValues.MoveToBottomAndRightBoundariesKey || keyValue == KeyValues.MoveToTopAndLeftBoundariesKey || keyValue == KeyValues.MoveToTopAndRightBoundariesKey)) { return(false); } //Mouse actions involving left button if it is already down if ((keyValue == KeyValues.MouseDragKey || keyValue == KeyValues.MouseLeftClickKey || keyValue == KeyValues.MouseLeftDoubleClickKey || keyValue == KeyValues.MouseMoveAndLeftClickKey || keyValue == KeyValues.MouseMoveAndLeftDoubleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseLeftDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Mouse actions involving middle button if it is already down if ((keyValue == KeyValues.MouseMiddleClickKey || keyValue == KeyValues.MouseMoveAndMiddleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseMiddleDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Mouse actions involving right button if it is already down if ((keyValue == KeyValues.MouseRightClickKey || keyValue == KeyValues.MouseMoveAndRightClickKey) && keyStateService.KeyDownStates[KeyValues.MouseRightDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Multi-key capture is disabled if (keyValue == KeyValues.MultiKeySelectionIsOnKey && !Settings.Default.MultiKeySelectionEnabled) { return(false); } //Key is not a letter, but we're capturing a multi-keyValue selection (which must be ended by selecting a letter) if (capturingStateManager.CapturingMultiKeySelection && !KeyValues.MultiKeySelectionKeys.Contains(keyValue)) { return(false); } //Greek specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.GreekGreece) { //Acute accent: Άά Έέ Ήή Ίί Όό Ύύ Ώώ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown() && !keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released (keyValue == KeyValues.CombiningDiaeresisOrUmlautKey && !keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value.IsDownOrLockedDown()) || //The acute accent can be combined with a diaeresis on lower case letters only (shift must be is up) keyValue == new KeyValue("α") || keyValue == new KeyValue("ε") || keyValue == new KeyValue("η") || keyValue == new KeyValue("ι") || keyValue == new KeyValue("ο") || keyValue == new KeyValue("υ") || keyValue == new KeyValue("ω") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Acute accent + diaeresis: ΐ ΰ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown() && keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown() && !keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value.IsDownOrLockedDown()) //These two diacritics can only be combined with lowercase letters { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == KeyValues.CombiningDiaeresisOrUmlautKey ||//Allow the diaeresis to be manually released keyValue == new KeyValue("ι") || keyValue == new KeyValue("υ")); } //Diaeresis: Ϊϊ Ϋϋ if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown() && !keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey ||//Allow the diaeresis to be manually released (keyValue == KeyValues.CombiningAcuteAccentKey && !keyStateService.KeyDownStates[KeyValues.LeftShiftKey].Value.IsDownOrLockedDown()) || //The diaeresis can be combined with an acute accent on lower case letters only (shift must be is up) keyValue == new KeyValue("ι") || keyValue == new KeyValue("υ") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //French specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.FrenchFrance) { //Acute accent: Éé if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("e") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà Èè Ùù if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Circumflex: Ââ Êê Îî Ôô Ûû if (keyStateService.KeyDownStates[KeyValues.CombiningCircumflexKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCircumflexKey || //Allow the circumflex to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Ëë Ïï Üü Ÿÿ if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("u") || keyValue == new KeyValue("y") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Cedilla: Çç if (keyStateService.KeyDownStates[KeyValues.CombiningCedillaKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningCedillaKey || //Allow the cedilla to be manually released keyValue == new KeyValue("c") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Dutch specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.DutchBelgium || Settings.Default.KeyboardAndDictionaryLanguage == Languages.DutchNetherlands) { //Acute accent: Áá éÉ íÍ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà Èè if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Ëë Ïï Öö Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //German specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.GermanGermany) { //Diaeresis: Ää Öö Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Italian specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.ItalianItaly) { //Acute accent: éÉ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("e") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Grave accent: Àà Èè Ìì Òò Ùù if (keyStateService.KeyDownStates[KeyValues.CombiningGraveAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningGraveAccentKey || //Allow the grave accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Russian specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.RussianRussia) { //Acute Accent: Аа Ээ Ыы Уу Оо Яя Ее Юю Ии if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("а") || keyValue == new KeyValue("э") || keyValue == new KeyValue("ы") || keyValue == new KeyValue("у") || keyValue == new KeyValue("о") || keyValue == new KeyValue("я") || keyValue == new KeyValue("е") || keyValue == new KeyValue("ю") || keyValue == new KeyValue("и") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Spanish specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.SpanishSpain) { //Acute accent: Áá éÉ íÍ óÓ úÚ if (keyStateService.KeyDownStates[KeyValues.CombiningAcuteAccentKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("e") || keyValue == new KeyValue("i") || keyValue == new KeyValue("o") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } //Diaeresis: Üü if (keyStateService.KeyDownStates[KeyValues.CombiningDiaeresisOrUmlautKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningDiaeresisOrUmlautKey || //Allow the diaeresis to be manually released keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } //Turkish specific rules if (Settings.Default.KeyboardAndDictionaryLanguage == Languages.TurkishTurkey) { //Circumflex: Ââ Îî Ûû if (keyStateService.KeyDownStates[KeyValues.CombiningCircumflexKey].Value.IsDownOrLockedDown()) { return(keyValue == KeyValues.CombiningAcuteAccentKey || //Allow the acute accent to be manually released keyValue == new KeyValue("a") || keyValue == new KeyValue("i") || keyValue == new KeyValue("u") || keyValue == KeyValues.LeftShiftKey); //Allow shift to be toggled on/off } } return(true); } }
public bool this[KeyValue keyValue] { get { //Key is not Sleep, but we are sleeping if (keyStateService.KeyDownStates[KeyValues.SleepKey].Value.IsDownOrLockedDown() && keyValue != KeyValues.SleepKey) { return(false); } //Key is publish only, but we are not publishing if (!keyStateService.SimulateKeyStrokes && KeyValues.PublishOnlyKeys.Contains(keyValue)) { return(false); } //Key is MultiKeySelection, but a key which prevents text capture is down or locked down if (keyValue == KeyValues.MultiKeySelectionKey && KeyValues.KeysWhichPreventTextCaptureIfDownOrLocked.Any(kv => keyStateService.KeyDownStates[kv].Value.IsDownOrLockedDown())) { return(false); } //Key is Calibrate, but not calibrate service available if (keyValue == KeyValues.CalibrateKey && calibrationService == null) { return(false); } //Key is Repeat Last Mouse Action, but KeyEnabledStates.RepeatLastMouseActionIsValid is not true if (keyValue == KeyValues.RepeatLastMouseActionKey && !lastMouseActionStateManager.LastMouseActionExists) { return(false); } //Key is Previous suggestions, but no suggestions, or on page 1 if (keyValue == KeyValues.PreviousSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.SuggestionsPage == 0)) { return(false); } //Key is Next suggestions but no suggestions, or on last page if (keyValue == KeyValues.NextSuggestionsKey && (suggestionService.Suggestions == null || !suggestionService.Suggestions.Any() || suggestionService.Suggestions.Count <= ((suggestionService.SuggestionsPage * suggestionService.SuggestionsPerPage) + suggestionService.SuggestionsPerPage))) { return(false); } //Key is Suggestion 1 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion1Key && !SuggestionKeyIsValid(0)) { return(false); } //Key is Suggestion 2 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion2Key && !SuggestionKeyIsValid(1)) { return(false); } //Key is Suggestion 3 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion3Key && !SuggestionKeyIsValid(2)) { return(false); } //Key is Suggestion 4 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion4Key && !SuggestionKeyIsValid(3)) { return(false); } //Key is Suggestion 5 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion5Key && !SuggestionKeyIsValid(4)) { return(false); } //Key is Suggestion 6 but no suggestion exist for that index if (keyValue == KeyValues.Suggestion6Key && !SuggestionKeyIsValid(5)) { return(false); } //Expand/Collapse dock when not docked if ((keyValue == KeyValues.ExpandDockKey || keyValue == KeyValues.CollapseDockKey) && Settings.Default.MainWindowState != WindowStates.Docked) { return(false); } //Move & Resize keys when docked if (Settings.Default.MainWindowState == WindowStates.Docked && ((Settings.Default.MainWindowDockPosition == DockEdges.Top && (keyValue == KeyValues.MoveToTopBoundaryKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Bottom && (keyValue == KeyValues.MoveToBottomBoundaryKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Left && (keyValue == KeyValues.MoveToLeftBoundaryKey || keyValue == KeyValues.MoveToLeftKey || keyValue == KeyValues.MoveToBottomAndLeftKey || keyValue == KeyValues.MoveToTopAndLeftKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ShrinkFromLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey)) || (Settings.Default.MainWindowDockPosition == DockEdges.Right && (keyValue == KeyValues.MoveToRightBoundaryKey || keyValue == KeyValues.MoveToRightKey || keyValue == KeyValues.MoveToBottomAndRightKey || keyValue == KeyValues.MoveToTopAndRightKey || keyValue == KeyValues.MoveToTopKey || keyValue == KeyValues.MoveToBottomKey || keyValue == KeyValues.ExpandToRightKey || keyValue == KeyValues.ExpandToBottomAndRightKey || keyValue == KeyValues.ExpandToTopAndRightKey || keyValue == KeyValues.ExpandToTopKey || keyValue == KeyValues.ExpandToBottomKey || keyValue == KeyValues.ExpandToTopAndLeftKey || keyValue == KeyValues.ExpandToBottomAndLeftKey || keyValue == KeyValues.ShrinkFromRightKey || keyValue == KeyValues.ShrinkFromBottomAndRightKey || keyValue == KeyValues.ShrinkFromTopAndRightKey || keyValue == KeyValues.ShrinkFromTopKey || keyValue == KeyValues.ShrinkFromBottomKey || keyValue == KeyValues.ShrinkFromTopAndLeftKey || keyValue == KeyValues.ShrinkFromBottomAndLeftKey)) || keyValue == KeyValues.MoveToBottomAndLeftBoundariesKey || keyValue == KeyValues.MoveToBottomAndRightBoundariesKey || keyValue == KeyValues.MoveToTopAndLeftBoundariesKey || keyValue == KeyValues.MoveToTopAndRightBoundariesKey)) { return(false); } //Mouse actions involving left button if it is already down if ((keyValue == KeyValues.MouseDragKey || keyValue == KeyValues.MouseLeftClickKey || keyValue == KeyValues.MouseLeftDoubleClickKey || keyValue == KeyValues.MouseMoveAndLeftClickKey || keyValue == KeyValues.MouseMoveAndLeftDoubleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseLeftDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Mouse actions involving middle button if it is already down if ((keyValue == KeyValues.MouseMiddleClickKey || keyValue == KeyValues.MouseMoveAndMiddleClickKey) && keyStateService.KeyDownStates[KeyValues.MouseMiddleDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Mouse actions involving right button if it is already down if ((keyValue == KeyValues.MouseRightClickKey || keyValue == KeyValues.MouseMoveAndRightClickKey) && keyStateService.KeyDownStates[KeyValues.MouseRightDownUpKey].Value.IsDownOrLockedDown()) { return(false); } //Multi-key capture is disabled if (keyValue == KeyValues.MultiKeySelectionKey && !Settings.Default.MultiKeySelectionEnabled) { return(false); } //Key is not a letter, but we're capturing a multi-keyValue selection (which must be ended by selecting a letter) if (capturingStateManager.CapturingMultiKeySelection && !KeyValues.MultiKeySelectionKeys.Contains(keyValue)) { return(false); } return(true); } }
private void HandleFunctionKeySelectionResult(KeyValue singleKeyValue) { if (singleKeyValue.FunctionKey != null) { keyboardService.ProgressKeyDownState(singleKeyValue); var currentKeyboard = Keyboard; switch (singleKeyValue.FunctionKey.Value) { case FunctionKeys.AddToDictionary: AddTextToDictionary(); break; case FunctionKeys.AlphaKeyboard: Log.Debug("Changing keyboard to Alpha."); Keyboard = new Alpha(); break; case FunctionKeys.Diacritic1Keyboard: Log.Debug("Changing keyboard to Diacritic1."); Keyboard = new Diacritic1(); break; case FunctionKeys.Diacritic2Keyboard: Log.Debug("Changing keyboard to Diacritic2."); Keyboard = new Diacritic2(); break; case FunctionKeys.Diacritic3Keyboard: Log.Debug("Changing keyboard to Diacritic3."); Keyboard = new Diacritic3(); break; case FunctionKeys.BackFromKeyboard: Log.Debug("Navigating back from keyboard."); var navigableKeyboard = Keyboard as IBackAction; if (navigableKeyboard != null && navigableKeyboard.BackAction != null) { navigableKeyboard.BackAction(); } else { Keyboard = new Alpha(); } break; case FunctionKeys.Calibrate: if (CalibrationService != null) { Log.Debug("Calibrate requested."); var previousKeyboard = Keyboard; var question = CalibrationService.CanBeCompletedWithoutManualIntervention ? "Are you sure you would like to re-calibrate?" : "Calibration cannot be completed without manual intervention, e.g. having to use a mouse. You may be stuck in the calibration process if you cannot manually interact with your computer.\nAre you sure you would like to re-calibrate?"; Keyboard = new YesNoQuestion( question, () => { inputService.State = RunningStates.Paused; Keyboard = previousKeyboard; CalibrateRequest.Raise(new NotificationWithCalibrationResult(), calibrationResult => { if (calibrationResult.Success) { audioService.PlaySound(Settings.Default.InfoSoundFile, Settings.Default.InfoSoundVolume); RaiseToastNotification("Success", calibrationResult.Message, NotificationTypes.Normal, () => { inputService.State = RunningStates.Running; }); } else { audioService.PlaySound(Settings.Default.ErrorSoundFile, Settings.Default.ErrorSoundVolume); RaiseToastNotification("Uh-oh!", calibrationResult.Exception != null ? calibrationResult.Exception.Message : calibrationResult.Message ?? "Something went wrong, but I don't know what - please check the logs", NotificationTypes.Error, () => { inputService.State = RunningStates.Running; }); } }); }, () => { Keyboard = previousKeyboard; }); } break; case FunctionKeys.Currencies1Keyboard: Log.Debug("Changing keyboard to Currencies1."); Keyboard = new Currencies1(); break; case FunctionKeys.Currencies2Keyboard: Log.Debug("Changing keyboard to Currencies2."); Keyboard = new Currencies2(); break; case FunctionKeys.DecreaseOpacity: Log.Debug("Decreasing opacity."); mainWindowManipulationService.DecreaseOpacity(); break; case FunctionKeys.ExpandToBottom: Log.DebugFormat("Expanding to bottom by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToBottom(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToBottomAndLeft: Log.DebugFormat("Expanding to bottom and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToBottomAndLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToBottomAndRight: Log.DebugFormat("Expanding to bottom and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToBottomAndRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToLeft: Log.DebugFormat("Expanding to left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToRight: Log.DebugFormat("Expanding to right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToTop: Log.DebugFormat("Expanding to top by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToTop(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToTopAndLeft: Log.DebugFormat("Expanding to top and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToTopAndLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ExpandToTopAndRight: Log.DebugFormat("Expanding to top and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ExpandToTopAndRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.IncreaseOpacity: Log.Debug("Increasing opacity."); mainWindowManipulationService.IncreaseOpacity(); break; case FunctionKeys.MaximiseSize: Log.Debug("Maximising size."); mainWindowManipulationService.Maximise(); break; case FunctionKeys.MenuKeyboard: Log.Debug("Changing keyboard to Menu."); Keyboard = new Menu(() => Keyboard = currentKeyboard); break; case FunctionKeys.MouseKeyboard: Log.Debug("Changing keyboard to Mouse."); if (keyboardService.KeyDownStates[KeyValues.SimulateKeyStrokesKey].Value.IsDownOrLockedDown() && Settings.Default.DisableKeyboardSimulationWhileMouseKeyboardIsOpen) { var lastSimulateKeyStrokesValue = keyboardService.KeyDownStates[KeyValues.SimulateKeyStrokesKey].Value; var lastLeftShiftValue = keyboardService.KeyDownStates[KeyValues.LeftShiftKey].Value; var lastLeftCtrlValue = keyboardService.KeyDownStates[KeyValues.LeftCtrlKey].Value; var lastLeftWinValue = keyboardService.KeyDownStates[KeyValues.LeftWinKey].Value; var lastLeftAltValue = keyboardService.KeyDownStates[KeyValues.LeftAltKey].Value; keyboardService.KeyDownStates[KeyValues.SimulateKeyStrokesKey].Value = KeyDownStates.Up; Keyboard = new Mouse(() => { keyboardService.KeyDownStates[KeyValues.SimulateKeyStrokesKey].Value = lastSimulateKeyStrokesValue; keyboardService.KeyDownStates[KeyValues.LeftShiftKey].Value = lastLeftShiftValue; keyboardService.KeyDownStates[KeyValues.LeftCtrlKey].Value = lastLeftCtrlValue; keyboardService.KeyDownStates[KeyValues.LeftWinKey].Value = lastLeftWinValue; keyboardService.KeyDownStates[KeyValues.LeftAltKey].Value = lastLeftAltValue; Keyboard = currentKeyboard; }); } else { Keyboard = new Mouse(() => Keyboard = currentKeyboard); } break; case FunctionKeys.MouseDoubleLeftClick: Log.Debug("Mouse double left click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); outputService.LeftMouseButtonDoubleClick(fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseDrag: Log.Debug("Mouse drag selected."); SetupFinalClickAction(firstFinalPoint => { if (firstFinalPoint != null) { //This class reacts to the point selection event AFTER the MagnifyPopup reacts to it. //This means that if the MagnifyPopup sets the nextPointSelectionAction from the //MagnifiedPointSelectionAction then it will be called immediately i.e. for the same point. //The workaround is to set the nextPointSelectionAction to a lambda which sets the NEXT //nextPointSelectionAction. This means the immediate call to the lambda just sets up the //delegate for the subsequent call. nextPointSelectionAction = repeatFirstClickOrSecondClickAction => { Action<Point> deferIfMagnifyingElseDoNow = repeatFirstClickOrSecondClickPoint => { Action<Point?> secondFinalClickAction = secondFinalPoint => { if (secondFinalPoint != null) { Action<Point, Point> simulateDrag = (fp1, fp2) => { audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); outputService.LeftMouseButtonDown(fp1); audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); outputService.LeftMouseButtonUp(fp2); }; lastMouseActionStateManager.LastMouseAction = () => simulateDrag(firstFinalPoint.Value, secondFinalPoint.Value); simulateDrag(firstFinalPoint.Value, secondFinalPoint.Value); } ResetAndCleanupAfterMouseAction(); }; if (keyboardService.KeyDownStates[KeyValues.MouseMagnifierKey].Value.IsDownOrLockedDown()) { ShowCursor = false; //See MouseLeftClick case for explanation of this MagnifiedPointSelectionAction = secondFinalClickAction; MagnifyAtPoint = repeatFirstClickOrSecondClickPoint; ShowCursor = true; } else { secondFinalClickAction(repeatFirstClickOrSecondClickPoint); } nextPointSelectionAction = null; }; if (keyboardService.KeyDownStates[KeyValues.MouseMagnifierKey].Value.IsDownOrLockedDown()) { nextPointSelectionAction = deferIfMagnifyingElseDoNow; } else { deferIfMagnifyingElseDoNow(repeatFirstClickOrSecondClickAction); } }; } else { //Reset and clean up if we are not continuing to 2nd point SelectionMode = SelectionModes.Key; nextPointSelectionAction = null; ShowCursor = false; if (keyboardService.KeyDownStates[KeyValues.MouseMagnifierKey].Value == KeyDownStates.Down) { keyboardService.KeyDownStates[KeyValues.MouseMagnifierKey].Value = KeyDownStates.Up; //Release magnifier if down but not locked down } } //Reset and clean up MagnifyAtPoint = null; MagnifiedPointSelectionAction = null; }, finalClickInSeries: false); break; case FunctionKeys.MouseLeftClick: Log.Debug("Mouse left click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); outputService.LeftMouseButtonClick(fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseMiddleClick: Log.Debug("Mouse middle click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); outputService.MiddleMouseButtonClick(fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseRightClick: Log.Debug("Mouse right click selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseClickSoundFile, Settings.Default.MouseClickSoundVolume); outputService.RightMouseButtonClick(fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollAmountInClicks: Log.Debug("Progressing MouseScrollAmountInClicks."); switch (Settings.Default.MouseScrollAmountInClicks) { case 1: Settings.Default.MouseScrollAmountInClicks = 3; break; case 3: Settings.Default.MouseScrollAmountInClicks = 5; break; case 5: Settings.Default.MouseScrollAmountInClicks = 10; break; case 10: Settings.Default.MouseScrollAmountInClicks = 25; break; default: Settings.Default.MouseScrollAmountInClicks = 1; break; } break; case FunctionKeys.MouseScrollToBottom: Log.Debug("Mouse scroll to bottom selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelDown(Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollToBottomAndLeft: Log.Debug("Mouse scroll to bottom and left selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelDownAndLeft( Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollToBottomAndRight: Log.Debug("Mouse scroll to bottom and right selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelDownAndRight( Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollToLeft: Log.Debug("Mouse scroll to left selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelLeft(Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollToRight: Log.Debug("Mouse scroll to right selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelRight(Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollToTop: Log.Debug("Mouse scroll to top selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelUp(Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollToTopAndLeft: Log.Debug("Mouse scroll to top and left selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelUpAndLeft(Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MouseScrollToTopAndRight: Log.Debug("Mouse scroll to top and right selected."); SetupFinalClickAction(finalPoint => { if (finalPoint != null) { Action<Point> simulateClick = fp => { audioService.PlaySound(Settings.Default.MouseScrollSoundFile, Settings.Default.MouseScrollSoundVolume); outputService.ScrollMouseWheelUpAndRight(Settings.Default.MouseScrollAmountInClicks, fp); }; lastMouseActionStateManager.LastMouseAction = () => simulateClick(finalPoint.Value); simulateClick(finalPoint.Value); } //Reset and clean up ResetAndCleanupAfterMouseAction(); }); break; case FunctionKeys.MoveAndResizeAdjustmentAmount: Log.Debug("Progressing MoveAndResizeAdjustmentAmount."); switch (Settings.Default.MoveAndResizeAdjustmentAmountInPixels) { case 1: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 5; break; case 5: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 10; break; case 10: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 25; break; case 25: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 50; break; case 50: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 100; break; default: Settings.Default.MoveAndResizeAdjustmentAmountInPixels = 1; break; } break; case FunctionKeys.MoveToBottom: Log.DebugFormat("Moving to bottom by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToBottom(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToBottomAndLeft: Log.DebugFormat("Moving to bottom and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToBottomAndLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToBottomAndLeftBoundaries: Log.Debug("Moving to bottom and left boundaries."); mainWindowManipulationService.MoveToBottomAndLeftBoundaries(); break; case FunctionKeys.MoveToBottomAndRight: Log.DebugFormat("Moving to bottom and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToBottomAndRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToBottomAndRightBoundaries: Log.Debug("Moving to bottom and right boundaries."); mainWindowManipulationService.MoveToBottomAndRightBoundaries(); break; case FunctionKeys.MoveToBottomBoundary: Log.Debug("Moving to bottom boundary."); mainWindowManipulationService.MoveToBottomBoundary(); break; case FunctionKeys.MoveToLeft: Log.DebugFormat("Moving to left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToLeftBoundary: Log.Debug("Moving to left boundary."); mainWindowManipulationService.MoveToLeftBoundary(); break; case FunctionKeys.MoveToRight: Log.DebugFormat("Moving to right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToRightBoundary: Log.Debug("Moving to right boundary."); mainWindowManipulationService.MoveToRightBoundary(); break; case FunctionKeys.MoveToTop: Log.DebugFormat("Moving to top by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToTop(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToTopAndLeft: Log.DebugFormat("Moving to top and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToTopAndLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToTopAndLeftBoundaries: Log.Debug("Moving to top and left boundaries."); mainWindowManipulationService.MoveToTopAndLeftBoundaries(); break; case FunctionKeys.MoveToTopAndRight: Log.DebugFormat("Moving to top and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.MoveToTopAndRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.MoveToTopAndRightBoundaries: Log.Debug("Moving to top and right boundaries."); mainWindowManipulationService.MoveToTopAndRightBoundaries(); break; case FunctionKeys.MoveToTopBoundary: Log.Debug("Moving to top boundary."); mainWindowManipulationService.MoveToTopBoundary(); break; case FunctionKeys.NextSuggestions: Log.Debug("Incrementing suggestions page."); if (suggestionService.Suggestions != null && (suggestionService.Suggestions.Count > (suggestionService.SuggestionsPage + 1) * SuggestionService.SuggestionsPerPage)) { suggestionService.SuggestionsPage++; } break; case FunctionKeys.NoQuestionResult: HandleYesNoQuestionResult(false); break; case FunctionKeys.NumericAndSymbols1Keyboard: Log.Debug("Changing keyboard to NumericAndSymbols1."); Keyboard = new NumericAndSymbols1(); break; case FunctionKeys.NumericAndSymbols2Keyboard: Log.Debug("Changing keyboard to NumericAndSymbols2."); Keyboard = new NumericAndSymbols2(); break; case FunctionKeys.NumericAndSymbols3Keyboard: Log.Debug("Changing keyboard to Symbols3."); Keyboard = new NumericAndSymbols3(); break; case FunctionKeys.PhysicalKeysKeyboard: Log.Debug("Changing keyboard to PhysicalKeys."); Keyboard = new PhysicalKeys(); break; case FunctionKeys.PositionKeyboard: Log.Debug("Changing keyboard to Position."); Keyboard = new Position(() => Keyboard = currentKeyboard); break; case FunctionKeys.PreviousSuggestions: Log.Debug("Decrementing suggestions page."); if (suggestionService.SuggestionsPage > 0) { suggestionService.SuggestionsPage--; } break; case FunctionKeys.RepeatLastMouseAction: if (lastMouseActionStateManager.LastMouseAction != null) { lastMouseActionStateManager.LastMouseAction(); } break; case FunctionKeys.RestoreSize: Log.Debug("Restoring size."); mainWindowManipulationService.Restore(); break; case FunctionKeys.ShrinkFromBottom: Log.DebugFormat("Shrinking from bottom by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromBottom(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromBottomAndLeft: Log.DebugFormat("Shrinking from bottom and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromBottomAndLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromBottomAndRight: Log.DebugFormat("Shrinking from bottom and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromBottomAndRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromLeft: Log.DebugFormat("Shrinking from left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromRight: Log.DebugFormat("Shrinking from right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromTop: Log.DebugFormat("Shrinking from top by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromTop(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromTopAndLeft: Log.DebugFormat("Shrinking from top and left by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromTopAndLeft(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.ShrinkFromTopAndRight: Log.DebugFormat("Shrinking from top and right by {0}px.", Settings.Default.MoveAndResizeAdjustmentAmountInPixels); mainWindowManipulationService.ShrinkFromTopAndRight(Settings.Default.MoveAndResizeAdjustmentAmountInPixels); break; case FunctionKeys.SizeKeyboard: Log.Debug("Changing keyboard to Size."); Keyboard = new Size(() => Keyboard = currentKeyboard); break; case FunctionKeys.Speak: audioService.Speak( outputService.Text, Settings.Default.SpeechVolume, Settings.Default.SpeechRate, Settings.Default.SpeechVoice); break; case FunctionKeys.YesQuestionResult: HandleYesNoQuestionResult(true); break; } outputService.ProcessFunctionKey(singleKeyValue.FunctionKey.Value); } }
protected override void Arrange() { base.Arrange(); MainViewModel.SelectionMode = SelectionModes.Key; KeyValueToAssert = new KeyValue(); KeySelectionProgress = new NotifyingConcurrentDictionary<KeyValue, double>(); KeySelectionProgress[KeyValueToAssert] = new NotifyingProxy<double>(123); KeyStateService.Setup(s => s.KeySelectionProgress) .Returns(KeySelectionProgress); }
public void FireKeySelectionEvent(KeyValue kv) { if (KeySelection != null) { KeySelection(this, kv); } }
public KeyCommand(KeyCommands name, KeyValue keyValue) { this.Name = name; this.KeyValue = keyValue; }