public void pressButton(FighterState.Input key, KeyMode mode) { if (mode == KeyMode.RELEASE) { if (held.Contains(key)) { held.Remove(key); } if (pressed.Contains(key)) { pressed.Remove(key); } } else if (mode == KeyMode.HOLD) { if (!held.Contains(key)) { held.Add(key); } if (!pressed.Contains(key)) { pressed.Add(key); } } else { if (!pressed.Contains(key)) { pressed.Add(key); } } }
public void QueueData(KeyMode mode, ConsoleKey key) { // 0byte: mode (0: down, 1: up) // 1byte: KeyCode bytes.Add((byte)mode); bytes.Add((byte)key); }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag.Equals(Constants.PlayerTag)) { if (_mode == KeyMode.NotConnected) { var targetRigidbody = other.gameObject.GetComponent <Rigidbody>(); CreateSpringJoint(targetRigidbody); _joinedPlayer = targetRigidbody.gameObject; _mode = KeyMode.ConnectedToPlayer; SetColor(); } } else if (other.gameObject.tag.Equals(Constants.KeyHoleTag)) { if (_mode == KeyMode.ConnectedToPlayer) { RemoveOldJoint(); var targetRigidbody = other.gameObject.GetComponent <Rigidbody>(); CreateSpringJoint(targetRigidbody); _mode = KeyMode.FlyingToDoor; SetColor(); } } }
public bool GetKey(KeyMode km, Key_Hub key) { if (!gameObject.activeSelf) { return(false); } bool flag = false; switch (km) { case KeyMode.Enter: { flag = GetEnter(key, hard); } break; case KeyMode.Stay: { flag = GetStay(key, hard); } break; case KeyMode.Exit: { flag = GetExit(key, hard); } break; } return(flag); }
public void UpdateMode(KeyMode mode) { if (onUpdateKeyMode != null) { onUpdateKeyMode(mode); } }
public string GetKeyString(byte[] key, KeyMode keyMode) { var sb = new StringBuilder(); if (keyMode == KeyMode.Bytes) { foreach (var b in key) { sb.Append(b + ", "); } return(sb.ToString().Remove(sb.ToString().Length - 2)); } if (keyMode == KeyMode.Chars) { const string avlChars = "aąbcćdeęfghijklmnoópqrstuvwxyzżźAĄBCĆDEĘFGHIJKLMNOÓPQRSTUVWXYZŻŹ~!@#$%^&*()-_=+,./;\'[]<>?:\"|\\{}"; var enc = new UTF8Encoding(); var b = 0; while (enc.GetByteCount(sb.ToString()) != key.Length) { sb.Append(avlChars[key[b++ % key.Length] % avlChars.Length]); while (enc.GetByteCount(sb.ToString()) > key.Length) { sb.Length--; } } return(sb.ToString()); } throw new Exception("Incorrect way of key input. "); }
public Key2(Vector2 v, Vector2 inT, Vector2 outT, KeyMode inMode, KeyMode outMode) { vector = v; inTan = inT; outTan = outT; this.inMode = inMode; this.outMode = outMode; }
public override void ReadPayload(NetDataReader message) { base.ReadPayload(message); Key = message.GetUInt(); Shift = message.GetBool(); Control = message.GetBool(); Alt = message.GetBool(); Mode = (KeyMode)message.GetInt(); }
public KeyboardBar(IKeyboardWindow _window, Range _range, KeySize _size, KeyMode _mode) { window = _window; mode = _mode; InitializeComponent(); setKeyboardSize(_range, _size); mouseKey = null; }
/// <summary> /// This hack allows to disable keymode when opened new window over current with pressed ctrl, alt or shift /// </summary> public void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { var title = GetActiveWindowTitle(); if (!string.Equals(title, this.Title)) { _keyMode = KeyMode.None; border.SetKeyMode(_keyMode); } }
public void Update(Keyboard keyboard, KeyMode mode) { if (FKeyboard != keyboard || FKeyMode != mode) { Unsubscribe(); FKeyboard = keyboard; FKeyMode = mode; Subscribe(); } }
public static IDictionary <string, Texture2D> GetIcons(string class_name, KeyMode key_mode = KeyMode.Normal) { string label = class_name + ".HierarchyIcon"; var asset_guids = AssetDatabase.FindAssets("t:texture2D l:" + label); var asset_paths = asset_guids.Select(guid => AssetDatabase.GUIDToAssetPath(guid)); var key_function = GetKeyFunction(key_mode); return(asset_paths.ToDictionary( path => key_function(Path.GetFileName(path)), path => AssetDatabase.LoadAssetAtPath <Texture2D>(path))); }
private void LoadMesh(double fieldOfView) { if ((myViewport3D != null) && (modelGroup.Children.Count > 0)) { myViewport3D.Children.Remove(modelsVisual); modelGroup.Children.Clear(); } ((PerspectiveCamera)myViewport3D.Camera).FieldOfView = fieldOfView; // Define the material for the model. SolidColorBrush brush = new SolidColorBrush(Colors.Cyan); DiffuseMaterial colorMaterial = new DiffuseMaterial(brush); // Load the mesh for the model. MeshGeometry3D objMesh = (MeshGeometry3D)Application.Current.Resources[_mesh]; objModel = new GeometryModel3D(objMesh, colorMaterial); // Define the projection camera and add to the model. SetProjectionCamera(myViewport3D, modelGroup); modelGroup.Children.Add(objModel); // Add ambient light to the model group. if (checkBoxAmbientLight.IsChecked == true) { myLights.ShowAmbientLight(true, modelGroup); } // Add directional lights to the model group. if (checkBoxDirLightOne.IsChecked == true) { myLights.ShowDirLight(0, true, modelGroup); } if (checkBoxDirLightTwo.IsChecked == true) { myLights.ShowDirLight(1, true, modelGroup); } // Add the model group data to the viewport. modelsVisual.Content = modelGroup; myViewport3D.Children.Add(modelsVisual); checkBoxPointLight.IsChecked = false; xyzPointLight.Foreground = System.Windows.Media.Brushes.LightGray; currKeyMode = KeyMode.Camera; rbPosition1.IsChecked = true; }
public bool Check(KeyMode mode = KeyMode.PressDown) { if (modifiers.Count == 0 && keys.Count == 0) { return(false); } return(modifiers.All(key => Input.GetKey(key)) && keys.All(key => (mode == KeyMode.Press ? Input.GetKey(key) : (mode == KeyMode.PressDown ? Input.GetKeyDown(key) : Input.GetKeyUp(key)))) && MODIFIER_LIST.Except(modifiers).All(invalidModifier => !Input.GetKey(invalidModifier))); }
private static Func <string, string> GetKeyFunction(KeyMode key_mode) { switch (key_mode) { default: case KeyMode.Normal: return(Plain); case KeyMode.LowerCase: return(ToLower); case KeyMode.UpperCase: return(ToUpper); } }
public HKC(string variable, string displayText, uint key, KeyMode mode, Vector2 pos, Color boxColor) { VarToCheck = variable; DisplayText = displayText; SetMode = mode; BoxPosition = pos; BoxColor = boxColor; Key = key; keyToggleT = 0; //Event subs Game.OnWndProc += HKC_WndProc; Drawing.OnDraw += HKC_Draw; Game.OnUpdate += HKC_Update; }
public HKC(string variable, string displayText, uint key, KeyMode mode, Vector2 pos, Color boxColor) { VarToCheck = variable; DisplayText = displayText; SetMode = mode; BoxPosition = pos; BoxColor = boxColor; Key = key; OrigKey = key; keyToggleT = 0; //Event subs Game.OnUpdate += HKC_Update; Game.OnWndProc += HKC_WndProc; Drawing.OnDraw += HKC_Draw; }
void picPreview_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.ShiftKey || e.KeyCode == Keys.Menu || e.KeyCode == Keys.ControlKey) { return; } else if (e.KeyCode == Keys.Enter) { if (mode == EditingMode.TopLeft) { mode = EditingMode.BottomRight; } else { mode = EditingMode.TopLeft; } return; } Point loc = rectangle.GetPoint(mode); int dif = e.Control ? 10 : 1; if (e.KeyCode == Keys.Left) { key |= KeyMode.Left; } else if (e.KeyCode == Keys.Right) { key |= KeyMode.Right; } else if (e.KeyCode == Keys.Up) { key |= KeyMode.Up; } else if (e.KeyCode == Keys.Down) { key |= KeyMode.Down; } loc.Offset( (key & KeyMode.Horizontal) != 0 ? (key.HasFlag(KeyMode.Left) ? -dif : dif) : 0, (key & KeyMode.Vertical) != 0 ? (key.HasFlag(KeyMode.Up) ? -dif : dif) : 0); loc = GetVerifiedLocation(loc); rectangle.SetPoint(e.Shift ? EditingMode.TopLeft | EditingMode.BottomRight : mode, loc); picPreview.Invalidate(); }
void picPreview_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) { key &= ~KeyMode.Left; } else if (e.KeyCode == Keys.Right) { key &= ~KeyMode.Right; } else if (e.KeyCode == Keys.Up) { key &= ~KeyMode.Up; } else if (e.KeyCode == Keys.Down) { key &= ~KeyMode.Down; } }
//</SnippetShow3DLights3DN8> private void OnPositionChecked(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; if (rb.Name == "rbPosition1") { currKeyMode = KeyMode.Camera; } if (rb.Name == "rbPosition2") { currKeyMode = KeyMode.PointLight; } if (myViewport3D != null) { myViewport3D.Focus(); } }
// Add or remove a point light from the 3D viewport. private void OnPointLight(object sender, EventArgs e) { if (checkBoxPointLight.IsChecked == true) { currKeyMode = KeyMode.PointLight; rbPosition2.IsChecked = true; myLights.ShowPointLight(1, true, modelGroup); xyzPointLight.Foreground = System.Windows.Media.Brushes.Black; xyzPointLight.Content = "x: " + myLights.PointLightPosition.X + " y: " + myLights.PointLightPosition.Y + " z: " + myLights.PointLightPosition.Z; } else { currKeyMode = KeyMode.Camera; rbPosition1.IsChecked = true; myLights.ShowPointLight(1, false, modelGroup); xyzPointLight.Foreground = System.Windows.Media.Brushes.LightGray; } myViewport3D.Focus(); }
public static ElementKey FromElement(XElement elem, KeyMode mode) { if (mode == KeyMode.ItemId) { if (elem.Attribute("id") != null) { return(new ElementKey(elem.Attribute("id").Value)); } else if (elem.Attribute("idlist") != null) { return(new ElementKey(elem.Attribute("idlist").Value)); } else if (elem.Attribute("where") != null) { return(new ElementKey(elem.Attribute("where").Value)); } else if (elem.Element("related_id") != null) { var textNode = elem.Element("related_id").Nodes().OfType <XText>().FirstOrDefault(); if (textNode == null) { var item = elem.Element("related_id").Element("Item"); if (item != null && item.Attribute("id") != null) { return(new ElementKey(item.Attribute("id").Value)); } } else { return(new ElementKey(textNode.Value)); } } return(new ElementKey(elem.Name.LocalName + "[" + ElementIndex(elem).ToString() + "]")); } else { var lang = elem.Attribute(XNamespace.Xml + "lang"); return(new ElementKey(elem.Name.LocalName + (lang == null ? "" : "[" + lang.Value + "]"))); } }
private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { Key key = (e.Key == Key.System ? e.SystemKey : e.Key); if (key == Key.LeftAlt || key == Key.RightAlt) { _keyMode |= KeyMode.Alt; } if (key == Key.LeftShift || key == Key.RightShift) { _keyMode |= KeyMode.Shift; } if (key == Key.LeftCtrl || key == Key.RightCtrl) { _keyMode |= KeyMode.Ctrl; } border.SetKeyMode(_keyMode); }
internal Key(Pitch root, KeyMode keyMode) { Root = root; KeyMode = keyMode; ActualMode = KeyMode == KeyMode.Major ? Major : NaturalMinor; Scale = new Scale(Root, ActualMode); var accidentals = new List <Pitch>(); foreach (var accidental in SignatureAccidentals) { if (Scale.ScalePitches.Contains(accidental)) { accidentals.Add(accidental); } } KeySignatureAccidentals = accidentals; }
public void pressButton(FighterState.Input key, KeyMode mode) { if (mode == KeyMode.RELEASE) { if (held.Contains(key)) held.Remove(key); if (pressed.Contains(key)) pressed.Remove(key); } else if (mode == KeyMode.HOLD) { if (!held.Contains(key)) held.Add(key); if (!pressed.Contains(key)) pressed.Add(key); } else { if (!pressed.Contains(key)) pressed.Add(key); } }
/// <summary> /// Permet à une liste de touches d'effectuer la même action enfonction d'un mode d'appui. /// </summary> /// <param name="keyCodes"></param> /// <param name="keyMode"></param> /// <returns></returns> public static bool MultipleKey(List <KeyCode> keyCodes, KeyMode keyMode = KeyMode.DownOnce) { if (keyCodes.Count > 0 && Input.anyKey) { foreach (KeyCode kc in keyCodes) { switch (keyMode) { case KeyMode.Continuous: if (Input.GetKey(kc)) { return(true); } break; case KeyMode.DownOnce: if (Input.GetKeyDown(kc)) { return(true); } break; } } } else if (keyCodes.Count > 0 && keyMode == KeyMode.Up) { foreach (KeyCode kc in keyCodes) { if (Input.GetKeyUp(kc)) { return(true); } } } return(false); }
private void TestSetup(KeyMode keyMode, params KeyHandler[] keyHandlers) { Console.Clear(); PSConsoleReadLine.ClearHistory(); PSConsoleReadLine.ClearKillRing(); // We don't want stdout redirected, we want it sent to the screen. var standardOutput = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true }; Console.SetOut(standardOutput); var options = new SetPSReadlineOption { AddToHistoryHandler = null, BellStyle = PSConsoleReadlineOptions.DefaultBellStyle, CompletionQueryItems = PSConsoleReadlineOptions.DefaultCompletionQueryItems, ContinuationPrompt = PSConsoleReadlineOptions.DefaultContinuationPrompt, ContinuationPromptBackgroundColor = Console.BackgroundColor, ContinuationPromptForegroundColor = Console.ForegroundColor, DingDuration = 1, // Make tests virtually silent when they ding DingTone = 37, // Make tests virtually silent when they ding EmphasisBackgroundColor = Console.BackgroundColor, EmphasisForegroundColor = PSConsoleReadlineOptions.DefaultEmphasisForegroundColor, ExtraPromptLineCount = PSConsoleReadlineOptions.DefaultExtraPromptLineCount, HistoryNoDuplicates = PSConsoleReadlineOptions.DefaultHistoryNoDuplicates, HistorySearchCaseSensitive = PSConsoleReadlineOptions.DefaultHistorySearchCaseSensitive, HistorySearchCursorMovesToEnd = PSConsoleReadlineOptions.DefaultHistorySearchCursorMovesToEnd, MaximumHistoryCount = PSConsoleReadlineOptions.DefaultMaximumHistoryCount, MaximumKillRingCount = PSConsoleReadlineOptions.DefaultMaximumKillRingCount, ResetTokenColors = true, ShowToolTips = PSConsoleReadlineOptions.DefaultShowToolTips, WordDelimiters = PSConsoleReadlineOptions.DefaultWordDelimiters, }; switch (keyMode) { case KeyMode.Cmd: options.EditMode = EditMode.Windows; break; case KeyMode.Emacs: options.EditMode = EditMode.Emacs; break; #if FALSE case KeyMode.Vi: options.EditMode = EditMode.Vi; break; #endif } PSConsoleReadLine.SetOptions(options); foreach (var keyHandler in keyHandlers) { PSConsoleReadLine.SetKeyHandler(new [] { keyHandler.Chord }, keyHandler.Handler, "", ""); } var colorOptions = new SetPSReadlineOption(); foreach (var val in typeof(TokenClassification).GetEnumValues()) { colorOptions.TokenKind = (TokenClassification)val; colorOptions.ForegroundColor = ForegroundColors[(int)val]; colorOptions.BackgroundColor = BackgroundColors[(int)val]; PSConsoleReadLine.SetOptions(colorOptions); } }
private void TestSetup(KeyMode keyMode, params KeyHandler[] keyHandlers) { Skip.If(WindowsConsoleFixtureHelper.GetKeyboardLayout() != this.Fixture.Lang, $"Keyboard layout must be set to {this.Fixture.Lang}"); _console = new TestConsole(_); _mockedMethods = new MockedMethods(); var instance = (PSConsoleReadLine)typeof(PSConsoleReadLine) .GetField("_singleton", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); typeof(PSConsoleReadLine) .GetField("_mockableMethods", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(instance, _mockedMethods); typeof(PSConsoleReadLine) .GetField("_console", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(instance, _console); PSConsoleReadLine.ClearHistory(); PSConsoleReadLine.ClearKillRing(); var options = new SetPSReadLineOption { AddToHistoryHandler = PSConsoleReadLineOptions.DefaultAddToHistoryHandler, AnsiEscapeTimeout = 0, BellStyle = PSConsoleReadLineOptions.DefaultBellStyle, CompletionQueryItems = PSConsoleReadLineOptions.DefaultCompletionQueryItems, ContinuationPrompt = PSConsoleReadLineOptions.DefaultContinuationPrompt, DingDuration = 1, // Make tests virtually silent when they ding DingTone = 37, // Make tests virtually silent when they ding ExtraPromptLineCount = PSConsoleReadLineOptions.DefaultExtraPromptLineCount, HistoryNoDuplicates = PSConsoleReadLineOptions.DefaultHistoryNoDuplicates, HistorySaveStyle = HistorySaveStyle.SaveNothing, HistorySearchCaseSensitive = PSConsoleReadLineOptions.DefaultHistorySearchCaseSensitive, HistorySearchCursorMovesToEnd = PSConsoleReadLineOptions.DefaultHistorySearchCursorMovesToEnd, MaximumHistoryCount = PSConsoleReadLineOptions.DefaultMaximumHistoryCount, MaximumKillRingCount = PSConsoleReadLineOptions.DefaultMaximumKillRingCount, ShowToolTips = PSConsoleReadLineOptions.DefaultShowToolTips, WordDelimiters = PSConsoleReadLineOptions.DefaultWordDelimiters, PromptText = new [] { "" }, Colors = new Hashtable { { "ContinuationPrompt", MakeCombinedColor(_console.ForegroundColor, _console.BackgroundColor) }, { "Emphasis", MakeCombinedColor(PSConsoleReadLineOptions.DefaultEmphasisColor, _console.BackgroundColor) }, { "Error", MakeCombinedColor(ConsoleColor.Red, ConsoleColor.DarkRed) }, } }; switch (keyMode) { case KeyMode.Cmd: options.EditMode = EditMode.Windows; break; case KeyMode.Emacs: options.EditMode = EditMode.Emacs; break; case KeyMode.Vi: options.EditMode = EditMode.Vi; break; } PSConsoleReadLine.SetOptions(options); foreach (var keyHandler in keyHandlers) { PSConsoleReadLine.SetKeyHandler(new [] { keyHandler.Chord }, keyHandler.Handler, "", ""); } var tokenTypes = new[] { "Default", "Comment", "Keyword", "String", "Operator", "Variable", "Command", "Parameter", "Type", "Number", "Member", "Selection", "InlinePrediction", "ListPrediction", "ListPredictionSelected" }; var colors = new Hashtable(); for (var i = 0; i < tokenTypes.Length; i++) { colors.Add(tokenTypes[i], MakeCombinedColor(Colors[i], BackgroundColors[i])); } var colorOptions = new SetPSReadLineOption { Colors = colors }; PSConsoleReadLine.SetOptions(colorOptions); }
private void TestSetup(KeyMode keyMode, params KeyHandler[] keyHandlers) { TestSetup(console: null, keyMode, keyHandlers); }
public XmlKeyStroke(string strokeString, KeyMode mode = KeyMode.PressUp) { CheckMode = mode; Keys = strokeString; }
void picPreview_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.ShiftKey || e.KeyCode == Keys.Menu || e.KeyCode == Keys.ControlKey) return; else if (e.KeyCode == Keys.Enter) { if (mode == EditingMode.TopLeft) mode = EditingMode.BottomRight; else mode = EditingMode.TopLeft; return; } Point loc = rectangle.GetPoint(mode); int dif = e.Control ? 10 : 1; if (e.KeyCode == Keys.Left) key |= KeyMode.Left; else if (e.KeyCode == Keys.Right) key |= KeyMode.Right; else if (e.KeyCode == Keys.Up) key |= KeyMode.Up; else if (e.KeyCode == Keys.Down) key |= KeyMode.Down; loc.Offset( (key & KeyMode.Horizontal) != 0 ? (key.HasFlag(KeyMode.Left) ? -dif : dif) : 0, (key & KeyMode.Vertical) != 0 ? (key.HasFlag(KeyMode.Up) ? -dif : dif) : 0); loc = GetVerifiedLocation(loc); rectangle.SetPoint(e.Shift ? EditingMode.TopLeft | EditingMode.BottomRight : mode, loc); picPreview.Invalidate(); }
private void LoadMesh(double fieldOfView) { if ((myViewport3D != null) && (modelGroup.Children.Count > 0)) { myViewport3D.Children.Remove(modelsVisual); modelGroup.Children.Clear(); } ((PerspectiveCamera)myViewport3D.Camera).FieldOfView = fieldOfView; // Define the material for the model. SolidColorBrush brush = new SolidColorBrush(Colors.Cyan); DiffuseMaterial colorMaterial = new DiffuseMaterial(brush); // Load the mesh for the model. MeshGeometry3D objMesh = (MeshGeometry3D)Application.Current.Resources[_mesh]; objModel = new GeometryModel3D(objMesh, colorMaterial); // Define the projection camera and add to the model. SetProjectionCamera(myViewport3D, modelGroup); modelGroup.Children.Add(objModel); // Add ambient light to the model group. if (checkBoxAmbientLight.IsChecked == true) { myLights.ShowAmbientLight(true, modelGroup); } // Add directional lights to the model group. if (checkBoxDirLightOne.IsChecked == true) { myLights.ShowDirLight(0, true, modelGroup); } if (checkBoxDirLightTwo.IsChecked == true) { myLights.ShowDirLight(1, true, modelGroup); } // Add the model group data to the viewport. modelsVisual.Content = modelGroup; myViewport3D.Children.Add(modelsVisual); checkBoxPointLight.IsChecked = false; xyzPointLight.Foreground = System.Windows.Media.Brushes.LightGray; currKeyMode = KeyMode.Camera; rbPosition1.IsChecked = true; }
// Add or remove a point light from the 3D viewport. private void OnPointLight(object sender, EventArgs e) { if (checkBoxPointLight.IsChecked == true) { currKeyMode = KeyMode.PointLight; rbPosition2.IsChecked = true; myLights.ShowPointLight(1, true, modelGroup); xyzPointLight.Foreground = System.Windows.Media.Brushes.Black; xyzPointLight.Content = "x: " + myLights.PointLightPosition.X + " y: " + myLights.PointLightPosition.Y + " z: " + myLights.PointLightPosition.Z; } else { currKeyMode = KeyMode.Camera; rbPosition1.IsChecked = true; myLights.ShowPointLight(1, false, modelGroup); xyzPointLight.Foreground = System.Windows.Media.Brushes.LightGray; } myViewport3D.Focus(); }
private void TestSetup(KeyMode keyMode, params KeyHandler[] keyHandlers) { ClearScreen(); PSConsoleReadLine.ClearHistory(); PSConsoleReadLine.ClearKillRing(); var options = new SetPSReadlineOption { AddToHistoryHandler = null, HistoryNoDuplicates = PSConsoleReadLine.DefaultHistoryNoDuplicates, MinimumHistoryCommandLength = PSConsoleReadLine.DefaultMinimumHistoryCommandLength, MaximumHistoryCount = PSConsoleReadLine.DefaultMaximumHistoryCount, MaximumKillRingCount = PSConsoleReadLine.DefaultMaximumKillRingCount, ResetTokenColors = true, }; switch (keyMode) { case KeyMode.Cmd: options.EditMode = EditMode.Windows; break; case KeyMode.Emacs: options.EditMode = EditMode.Emacs; break; #if FALSE case KeyMode.Vi: options.EditMode = EditMode.Vi; break; #endif } PSConsoleReadLine.SetOptions(options); foreach (var keyHandler in keyHandlers) { PSConsoleReadLine.SetKeyHandler(keyHandler.Key, false, keyHandler.Handler, "", ""); } var colorOptions = new SetPSReadlineOption(); foreach (var val in typeof(TokenClassification).GetEnumValues()) { colorOptions.TokenKind = (TokenClassification)val; colorOptions.ForegroundColor = ForegroundColors[(int)val]; colorOptions.BackgroundColor = BackgroundColors[(int)val]; PSConsoleReadLine.SetOptions(colorOptions); } }
protected override void OnSceneGUI() { { Rect rArea = new Rect(0, 0, 500, 100); Handles.BeginGUI(); GUILayout.BeginArea(rArea); //if (GUILayout.Button("Reset Area")) // Debug.Log("test"); GUILayout.Box("Please choose key mode and then press space to add keys for selected points"); GUILayout.Box((keyMode == KeyMode.COLOR_KEY ? "->" :"") +"mode: Color key"); GUILayout.Box((keyMode == KeyMode.XY_KEY ? "->" : "") + "mode: X Y key"); GUILayout.Box((keyMode == KeyMode.Z_KEY ? "->" : "") + "mode: Z key"); GUILayout.EndArea(); Handles.EndGUI(); } bool dontBase = false; if (Event.current.type == EventType.mouseDown) { if ((new Rect(0, 25, 90, 25).Contains(Event.current.mousePosition))) { keyMode = KeyMode.COLOR_KEY; dontBase = true; } else if ((new Rect(0, 50, 90, 25).Contains(Event.current.mousePosition))) { keyMode = KeyMode.XY_KEY; dontBase = true; } else if ((new Rect(0, 75, 90, 25).Contains(Event.current.mousePosition))) { keyMode = KeyMode.Z_KEY; dontBase = true; } } if (!dontBase) base.OnSceneGUI(); if (Event.current.keyCode == KeyCode.Space && Event.current.type == EventType.keyDown && !isSpace) { if(keyMode == KeyMode.COLOR_KEY) { setColorKeyStart(); } if (keyMode == KeyMode.XY_KEY) { setPointKeyStart(true, true, false); } if (keyMode == KeyMode.Z_KEY) { setPointKeyStart(false, false, true); } isSpace = true; } if (Event.current.keyCode == KeyCode.Space && Event.current.type == EventType.keyUp) { isSpace = false; if (keyMode == KeyMode.COLOR_KEY) { setColorKeyEnd(); } if (keyMode == KeyMode.XY_KEY) { setPointKeyEnd(true, true, false); } if (keyMode == KeyMode.Z_KEY) { setPointKeyEnd(false, false, true); } } }
void picPreview_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) key &= ~KeyMode.Left; else if (e.KeyCode == Keys.Right) key &= ~KeyMode.Right; else if (e.KeyCode == Keys.Up) key &= ~KeyMode.Up; else if (e.KeyCode == Keys.Down) key &= ~KeyMode.Down; }
protected override void OnSceneGUI() { bool dontBase = false; if (spriteDeformer.editorProps.mainToolBar == MainToolBarInspector.EDIT_VERTICS) { { Rect rArea = new Rect(0, 0, 500, 100); Handles.BeginGUI(); GUILayout.BeginArea(rArea); //if (GUILayout.Button("Reset Area")) // Debug.Log("test"); GUILayout.Box("Please choose key mode and then press space to add keys for selected points"); GUILayout.Box((keyMode == KeyMode.COLOR_KEY ? "->" : "") + "mode: Color key"); GUILayout.Box((keyMode == KeyMode.XY_KEY ? "->" : "") + "mode: X Y key"); GUILayout.Box((keyMode == KeyMode.Z_KEY ? "->" : "") + "mode: Z key"); GUILayout.EndArea(); Handles.EndGUI(); } if (Event.current.type == EventType.mouseDown) { if ((new Rect(0, 25, 90, 25).Contains(Event.current.mousePosition))) { keyMode = KeyMode.COLOR_KEY; dontBase = true; } else if ((new Rect(0, 50, 90, 25).Contains(Event.current.mousePosition))) { keyMode = KeyMode.XY_KEY; dontBase = true; } else if ((new Rect(0, 75, 90, 25).Contains(Event.current.mousePosition))) { keyMode = KeyMode.Z_KEY; dontBase = true; } } } if (!dontBase) { base.OnSceneGUI(); } if (Event.current.keyCode == KeyCode.Space && Event.current.type == EventType.keyDown && !isSpace) { if (keyMode == KeyMode.COLOR_KEY) { setColorKeyStart(); } if (keyMode == KeyMode.XY_KEY) { setPointKeyStart(true, true, false); } if (keyMode == KeyMode.Z_KEY) { setPointKeyStart(false, false, true); } isSpace = true; } if (Event.current.keyCode == KeyCode.Space && Event.current.type == EventType.keyUp) { isSpace = false; if (keyMode == KeyMode.COLOR_KEY) { setColorKeyEnd(); } if (keyMode == KeyMode.XY_KEY) { setPointKeyEnd(true, true, false); } if (keyMode == KeyMode.Z_KEY) { setPointKeyEnd(false, false, true); } } }
private void TestSetup(KeyMode keyMode, params KeyHandler[] keyHandlers) { _console = new TestConsole(); _mockedMethods = new MockedMethods(); var instance = (PSConsoleReadLine)typeof(PSConsoleReadLine) .GetField("_singleton", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); typeof(PSConsoleReadLine) .GetField("_mockableMethods", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(instance, _mockedMethods); typeof(PSConsoleReadLine) .GetField("_console", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(instance, _console); PSConsoleReadLine.ClearHistory(); PSConsoleReadLine.ClearKillRing(); var options = new SetPSReadlineOption { AddToHistoryHandler = null, BellStyle = PSConsoleReadlineOptions.DefaultBellStyle, CompletionQueryItems = PSConsoleReadlineOptions.DefaultCompletionQueryItems, ContinuationPrompt = PSConsoleReadlineOptions.DefaultContinuationPrompt, ContinuationPromptBackgroundColor = _console.BackgroundColor, ContinuationPromptForegroundColor = _console.ForegroundColor, DingDuration = 1, // Make tests virtually silent when they ding DingTone = 37, // Make tests virtually silent when they ding EmphasisBackgroundColor = _console.BackgroundColor, EmphasisForegroundColor = PSConsoleReadlineOptions.DefaultEmphasisForegroundColor, ErrorBackgroundColor = ConsoleColor.DarkRed, ErrorForegroundColor = ConsoleColor.Red, ExtraPromptLineCount = PSConsoleReadlineOptions.DefaultExtraPromptLineCount, HistoryNoDuplicates = PSConsoleReadlineOptions.DefaultHistoryNoDuplicates, HistorySaveStyle = HistorySaveStyle.SaveNothing, HistorySearchCaseSensitive = PSConsoleReadlineOptions.DefaultHistorySearchCaseSensitive, HistorySearchCursorMovesToEnd = PSConsoleReadlineOptions.DefaultHistorySearchCursorMovesToEnd, MaximumHistoryCount = PSConsoleReadlineOptions.DefaultMaximumHistoryCount, MaximumKillRingCount = PSConsoleReadlineOptions.DefaultMaximumKillRingCount, ResetTokenColors = true, ShowToolTips = PSConsoleReadlineOptions.DefaultShowToolTips, WordDelimiters = PSConsoleReadlineOptions.DefaultWordDelimiters, }; switch (keyMode) { case KeyMode.Cmd: options.EditMode = EditMode.Windows; break; case KeyMode.Emacs: options.EditMode = EditMode.Emacs; break; case KeyMode.Vi: options.EditMode = EditMode.Vi; break; } PSConsoleReadLine.SetOptions(options); foreach (var keyHandler in keyHandlers) { PSConsoleReadLine.SetKeyHandler(new [] { keyHandler.Chord }, keyHandler.Handler, "", ""); } var colorOptions = new SetPSReadlineOption(); foreach (var val in typeof(TokenClassification).GetEnumValues()) { colorOptions.TokenKind = (TokenClassification)val; colorOptions.ForegroundColor = ForegroundColors[(int)val]; colorOptions.BackgroundColor = BackgroundColors[(int)val]; PSConsoleReadLine.SetOptions(colorOptions); } }
internal void OnDestroy( KeyMode k ) { foreach( Layout l in _layouts.Values ) { l.DestroyConfig( k, true ); } }
private void OnPositionChecked(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; if (rb.Name == "rbPosition1") { currKeyMode = KeyMode.Camera; } if (rb.Name == "rbPosition2") { currKeyMode = KeyMode.PointLight; } if (myViewport3D != null) { myViewport3D.Focus(); } }
public Key(KeyMode mode, int fifths) { Mode = mode; Fifths = fifths; }
public static ElementKey FromElement(XElement elem, KeyMode mode) { if (mode == KeyMode.ItemId) { if (elem.Attribute("id") != null) { return new ElementKey(elem.Attribute("id").Value); } else if (elem.Attribute("idlist") != null) { return new ElementKey(elem.Attribute("idlist").Value); } else if (elem.Attribute("where") != null) { return new ElementKey(elem.Attribute("where").Value); } else if (elem.Element("related_id") != null) { var textNode = elem.Element("related_id").Nodes().OfType<XText>().FirstOrDefault(); if (textNode == null) { var item = elem.Element("related_id").Element("Item"); if (item != null && item.Attribute("id") != null) return new ElementKey(item.Attribute("id").Value); } else { return new ElementKey(textNode.Value); } } return new ElementKey(elem.Name.LocalName + "[" + ElementIndex(elem).ToString() + "]"); } else { var lang = elem.Attribute(XNamespace.Xml + "lang"); return new ElementKey(elem.Name.LocalName + (lang == null ? "" : "[" + lang.Value + "]")); } }
private void TestSetup(KeyMode keyMode, params KeyHandler[] keyHandlers) { Console.Clear(); PSConsoleReadLine.ClearHistory(); PSConsoleReadLine.ClearKillRing(); // We don't want stdout redirected, we want it sent to the screen. var standardOutput = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = true}; Console.SetOut(standardOutput); var options = new SetPSReadlineOption { AddToHistoryHandler = null, BellStyle = PSConsoleReadlineOptions.DefaultBellStyle, CompletionQueryItems = PSConsoleReadlineOptions.DefaultCompletionQueryItems, ContinuationPrompt = PSConsoleReadlineOptions.DefaultContinuationPrompt, ContinuationPromptBackgroundColor = Console.BackgroundColor, ContinuationPromptForegroundColor = Console.ForegroundColor, DingDuration = 1, // Make tests virtually silent when they ding DingTone = 37, // Make tests virtually silent when they ding EmphasisBackgroundColor = Console.BackgroundColor, EmphasisForegroundColor = PSConsoleReadlineOptions.DefaultEmphasisForegroundColor, ExtraPromptLineCount = PSConsoleReadlineOptions.DefaultExtraPromptLineCount, HistoryNoDuplicates = PSConsoleReadlineOptions.DefaultHistoryNoDuplicates, HistorySaveStyle = HistorySaveStyle.SaveNothing, HistorySearchCaseSensitive = PSConsoleReadlineOptions.DefaultHistorySearchCaseSensitive, HistorySearchCursorMovesToEnd = PSConsoleReadlineOptions.DefaultHistorySearchCursorMovesToEnd, MaximumHistoryCount = PSConsoleReadlineOptions.DefaultMaximumHistoryCount, MaximumKillRingCount = PSConsoleReadlineOptions.DefaultMaximumKillRingCount, ResetTokenColors = true, ShowToolTips = PSConsoleReadlineOptions.DefaultShowToolTips, WordDelimiters = PSConsoleReadlineOptions.DefaultWordDelimiters, }; switch (keyMode) { case KeyMode.Cmd: options.EditMode = EditMode.Windows; break; case KeyMode.Emacs: options.EditMode = EditMode.Emacs; break; #if FALSE case KeyMode.Vi: options.EditMode = EditMode.Vi; break; #endif } PSConsoleReadLine.SetOptions(options); foreach (var keyHandler in keyHandlers) { PSConsoleReadLine.SetKeyHandler(new [] {keyHandler.Chord}, keyHandler.Handler, "", ""); } var colorOptions = new SetPSReadlineOption(); foreach (var val in typeof(TokenClassification).GetEnumValues()) { colorOptions.TokenKind = (TokenClassification)val; colorOptions.ForegroundColor = ForegroundColors[(int)val]; colorOptions.BackgroundColor = BackgroundColors[(int)val]; PSConsoleReadLine.SetOptions(colorOptions); } }
/// <summary> /// Loads the given mode data into this <see cref="ChannelModesCreator" /> /// </summary> public void Parse(string modeChanges, IList<string> modeArguments) { if (string.IsNullOrEmpty(modeChanges)) { return; } if (modeArguments == null) { modeArguments = new List<string>(); } this._modes.Clear(); var currentAction = ModeAction.Add; int argIndex = 0; foreach (char c in modeChanges) { switch (c) { case '+': currentAction = ModeAction.Add; break; case '-': currentAction = ModeAction.Remove; break; // PONDER This probably won't correctly parse incorrect mode messages, should I? case 'a': this._modes.Add(new AnonymousMode(currentAction)); break; case 'b': var banMode = new BanMode(currentAction, new User(modeArguments[argIndex])); argIndex++; this._modes.Add(banMode); break; case 'e': var banExceptionMode = new BanExceptionMode(currentAction, new User(modeArguments[argIndex])); argIndex++; this._modes.Add(banExceptionMode); break; case 'h': var halfOpMode = new HalfOpMode(currentAction, modeArguments[argIndex]); argIndex++; this._modes.Add(halfOpMode); break; case 'I': var invitationExceptionMode = new InvitationExceptionMode(currentAction, new User(modeArguments[argIndex])); argIndex++; this._modes.Add(invitationExceptionMode); break; case 'i': var inviteOnlyMode = new InviteOnlyMode(currentAction); this._modes.Add(inviteOnlyMode); break; case 'k': var keyMode = new KeyMode(currentAction); if (currentAction == ModeAction.Add) { keyMode.Password = modeArguments[argIndex]; argIndex++; } this._modes.Add(keyMode); break; case 'l': var limitMode = new LimitMode(currentAction); if (currentAction == ModeAction.Add) { limitMode.UserLimit = Convert.ToInt32(modeArguments[argIndex], CultureInfo.InvariantCulture); argIndex++; } this._modes.Add(limitMode); break; case 'm': this._modes.Add(new ModeratedMode(currentAction)); break; case 'n': this._modes.Add(new NoOutsideMessagesMode(currentAction)); break; case 'O': var creatorMode = new CreatorMode(currentAction, modeArguments[argIndex]); argIndex++; this._modes.Add(creatorMode); break; case 'o': var operatorMode = new OperatorMode(currentAction, modeArguments[argIndex]); argIndex++; this._modes.Add(operatorMode); break; case 'p': this._modes.Add(new PrivateMode(currentAction)); break; case 'q': this._modes.Add(new QuietMode(currentAction)); break; case 's': this._modes.Add(new SecretMode(currentAction)); break; case 'r': this._modes.Add(new ServerReopMode(currentAction)); break; case 'R': this._modes.Add(new RegisteredNicksOnlyMode(currentAction)); break; case 't': this._modes.Add(new TopicGuardedMode(currentAction)); break; case 'v': var voiceMode = new VoiceMode(currentAction, modeArguments[argIndex]); argIndex++; this._modes.Add(voiceMode); break; default: string unknownMode = c.ToString(CultureInfo.InvariantCulture); if (this._serverSupports.ModesWithParameters.Contains(unknownMode) || (this._serverSupports.ModesWithParametersWhenSet.Contains(unknownMode) && currentAction == ModeAction.Add)) { // I want to yank a parameter this._modes.Add(new UnknownChannelMode(currentAction, unknownMode, modeArguments[argIndex])); argIndex++; } else { // I don't this._modes.Add(new UnknownChannelMode(currentAction, unknownMode)); } break; } } this.CollapseModes(); }