/// <summary> /// Changes the current <see cref="HighlightMode">mode</see> for text being written. /// </summary> /// <param name="mode"></param> public void ChangeHighlightMode(HighlightMode mode) { if (this.m_hasStartedMode) { if (mode != this.m_mode) { if (this.m_mode != HighlightMode.Normal) { this.WriteModeEnd(); } if (mode != HighlightMode.Normal) { this.WriteModeStart(mode); } } this.m_mode = mode; } else { this.m_mode = mode; this.m_hasStartedMode = true; if (mode != HighlightMode.Normal) { this.WriteModeStart(mode); } } }
public void DeactivateOutlines(Tile t, bool tilesBecameNotClickable = true, HighlightMode highlightModeAfter = HighlightMode.NoHighlight) { if (!(t is Free) || (t is Water)) { return; } Free tile = t as Free; tile.highlighted = false; tile.highlightCase.enabled = false; tile.ropeUp.enabled = false; tile.ropeRight.enabled = false; tile.ropeDown.enabled = false; tile.ropeLeft.enabled = false; if (tilesBecameNotClickable) { tile.isClickable = false; } switch (highlightModeAfter) { case HighlightMode.NoHighlight: break; default: ActivateOutlines(new List <Tile>() { t }, highlightModeAfter); break; } }
/// <summary> /// Initializes a new instance of a <see cref="Wilco.Web.SyntaxHighlighting.SyntaxHighlighter"/> class. /// </summary> public SyntaxHighlighter() : base(HtmlTextWriterTag.Div) { this.mode = HighlightMode.Inline; this.codeLayoutTemplate = new DefaultCodeLayoutTemplate(); this.lineNumberTemplate = new DefaultLineNumberTemplate(); this.sourceLineTemplate = new DefaultSourceLineTemplate(); }
static Group() { m_builtinHighlightModes = new Dictionary <string, HighlightMode>(); for (HighlightMode mode = HighlightMode.Comment; mode <= HighlightMode.Todo; mode++) { m_builtinHighlightModes[mode.ToString().ToUpperInvariant()] = mode; } }
internal void SetHighlightModeInChildren() { if (0 == this.m_items.Count) { return; } HighlightMode mode = this.HighlightMode; this.m_items.ForEach(i => i.HighlightMode = mode); this.m_syntaxDefinition.PossibleHighlightModes.Add(mode); }
internal Group(string name, SyntaxDefinition syntaxDefinition) { this.m_name = name; this.m_syntaxDefinition = syntaxDefinition; this.m_items = new List<SyntaxItem>(); if (m_builtinHighlightModes.ContainsKey(name)) { this.m_highlightMode = m_builtinHighlightModes[name]; } else { this.m_highlightMode = HighlightMode.Normal; } }
Graphing.ColorMap drag_liftMap = new Graphing.ColorMap(v => new Color(Math.Max(1 - (v - 0.5f) * 2, 0), Math.Max((v - 0.5f) * 2, 0), 0, Math.Abs(1 - v * 2)));//new Color(0, 1, 0, Math.Max((v - 0.5f) * 2, 0)) + new Color(1, 0, 0, Math.Max(1 - (v - 0.5f) * 2, 0))); public void UpdateHighlighting(HighlightMode highlightMode, CelestialBody body, float altitude, float speed, float aoa) { this.highlightMode = highlightMode; this.body = body; this.altitude = altitude; this.speed = speed; this.aoa = aoa; ClearPartHighlighting(); if (highlightMode == HighlightMode.Off) { return; } GenerateHighlightingData(EditorLogic.fetch.ship, body, altitude, speed, aoa); int count = highlightingData.Length; float min, max; Func <PartAeroData, float> highlightValueFunc; switch (highlightMode) { case HighlightMode.Lift: highlightValueFunc = (p) => p.lift; break; case HighlightMode.DragOverMass: highlightValueFunc = (p) => p.drag / p.mass; break; case HighlightMode.DragOverLift: highlightValueFunc = (p) => p.lift / p.drag; break; case HighlightMode.Drag: default: highlightValueFunc = (p) => p.drag; break; } float[] highlightingDataResolved = highlightingData.Select(highlightValueFunc).ToArray(); min = highlightingDataResolved.Where(f => !float.IsNaN(f) && !float.IsInfinity(f)).Min(); max = highlightingDataResolved.Where(f => !float.IsNaN(f) && !float.IsInfinity(f)).Max(); for (int i = 0; i < count; i++) { float value = (highlightingDataResolved[i] - min) / (max - min); HighlightPart(EditorLogic.fetch.ship.parts[i], value); } }
internal Group(string name, SyntaxDefinition syntaxDefinition) { this.m_name = name; this.m_syntaxDefinition = syntaxDefinition; this.m_items = new List <SyntaxItem>(); if (m_builtinHighlightModes.ContainsKey(name)) { this.m_highlightMode = m_builtinHighlightModes[name]; } else { this.m_highlightMode = HighlightMode.Normal; } }
public void OnButtonFalse() { window.Visible = false; highlightMode = HighlightMode.Off; ClearPartHighlighting(); if (appButton != null) { appButton.SetTexture(icon); } if (blizzyToolbarButton != null) { blizzyToolbarButton.TexturePath = iconPath_blizzy_off; } }
public void UpdateHighlighting(HighlightMode highlightMode, CelestialBody body, float altitude, float speed, float aoa) { this.highlightMode = highlightMode; this.body = body; this.altitude = altitude; this.speed = speed; this.aoa = aoa; ClearPartHighlighting(); if (highlightMode == HighlightMode.Off) { return; } GenerateHighlightingData(EditorLogic.fetch.ship, body, altitude, speed, aoa); int count = highlightingData.Length; float min, max; switch (highlightMode) { case HighlightMode.Drag: min = minHighlights.x; max = maxHighlights.x; for (int i = 0; i < count; i++) { float value = (highlightingData[i].x - min) / (max - min); HighlightPart(EditorLogic.fetch.ship.parts[i], value); } break; case HighlightMode.Lift: min = minHighlights.y; max = maxHighlights.y; for (int i = 0; i < count; i++) { float value = (highlightingData[i].y - min) / (max - min); HighlightPart(EditorLogic.fetch.ship.parts[i], value); } break; } }
static XmlFormatter() { m_xmlWriterSettings = new XmlWriterSettings(); m_xmlWriterSettings.OmitXmlDeclaration = true; m_xmlWriterSettings.Indent = false; m_xmlWriterSettings.CheckCharacters = true; m_xmlWriterSettings.NewLineChars = Environment.NewLine; m_xmlWriterSettings.ConformanceLevel = ConformanceLevel.Auto; m_xmlWriterSettings.NewLineHandling = NewLineHandling.None; List <string> modeNames = new List <string>(40); for (HighlightMode mode = HighlightMode.IrisBug; mode <= HighlightMode.Todo; mode++) { modeNames.Add(mode.ToString()); } m_modeNames = modeNames.ToArray(); }
public int ShowHighlight(List <Tile> tilesToHighlight, HighlightMode highlightMode, bool tilesBecameClickable = false) { /*Material highlightMat; * * switch (highlightMode) * { * case HighlightMode.MoveHighlight: * highlightMat = moveHighlightMat; * break; * case HighlightMode.MoveRangePreview: * highlightMat = moveRangePreviewMat; * break; * case HighlightMode.ActionPreview: * highlightMat = actionPreviewMat; * break; * case HighlightMode.ActionHighlight: * highlightMat = actionHighlightMat; * break; * case HighlightMode.ExplosionPreview: * highlightMat = explosionPreviewMat; * break; * default: * highlightMat = hoverMat; * break; * } * * foreach(Tile tile in tilesToHighlight) * { * tile.highlighted = true; * tile.rend.material = highlightMat; * if (tilesBecameClickable) * { * tile.isClickable = true; * } * }*/ ActivateOutlines(tilesToHighlight, highlightMode); return(GenerateNewID(tilesToHighlight)); }
protected virtual void BufferMoreActualText() { this.m_actualReader.MoveToContent(); if (this.m_actualReader.NodeType == XmlNodeType.EndElement && this.m_actualReader.LocalName == "code") { // what this means is that we ran out of actual text. Sometimes this is because of extraneous whitespace characters in the expected text, // so to avoid lots of tortuous ifs, we supply an endless stream of whitespace chars from this point on this.m_idxActualBuffer = 0; this.m_actualBuffer = new string(' ', 10); this.m_actualBufferHasEnded = true; return; } if (this.m_actualReader.NodeType == XmlNodeType.Text) { this.m_currentLine = (this.m_actualReader as IXmlLineInfo).LineNumber; this.m_modeForBufferedText = HighlightMode.Normal; this.m_actualBuffer = this.m_actualReader.ReadString(); this.m_idxActualBuffer = 0; return; } if (this.m_actualReader.IsStartElement()) { this.m_currentLine = (this.m_actualReader as IXmlLineInfo).LineNumber; this.m_modeForBufferedText = (HighlightMode) Enum.Parse(typeof (HighlightMode), this.m_actualReader.LocalName, true); this.m_actualBuffer = this.m_actualReader.ReadElementContentAsString(); this.m_idxActualBuffer = 0; return; } string msg = StringExtensions.Fi("Unexpected node type '{0}' (local name '{1}') at line {2}", this.m_actualReader.NodeType, this.m_actualReader.LocalName, (this.m_actualReader as IXmlLineInfo).LineNumber); throw new AssertionViolationException(msg); }
public HighlightObjectEventArgs(ObjectSelection target, HighlightMode mode) { this.target = target; this.mode = mode; }
/// <summary> /// Called when a <see cref="HighlightMode">mode</see> starts. /// </summary> /// <param name="mode"></param> protected override void WriteModeStart(HighlightMode mode) { this.m_writer.WriteStartElement("span"); this.m_writer.WriteAttributeString("class", this.m_classNames[(int)mode]); }
/// <summary> /// Jinxters the frobnozzle. /// </summary> public void ChangeHighlightMode(HighlightMode mode) { }
private void DoCheckAgainstBufferedActualText(HighlightMode expectedMode, string expectedText, ref int idxExpected) { while ((idxExpected < expectedText.Length) && (this.m_idxActualBuffer < this.m_actualBuffer.Length)) { if (Char.IsWhiteSpace(expectedText[idxExpected])) { idxExpected++; continue; } if (Char.IsWhiteSpace(CurrentActualChar)) { if (this.m_actualBufferHasEnded) { this.ThrowContentError(expectedText[idxExpected], ' ', expectedText, "<PREMATURE END OF ACTUAL BUFFER>"); } this.m_idxActualBuffer++; continue; } if (expectedText[idxExpected] != CurrentActualChar) { this.ThrowContentError(expectedText[idxExpected], CurrentActualChar, expectedText, this.m_actualBuffer); } this.ThrowIfModesDontMatch(expectedMode, expectedText); idxExpected++; this.m_idxActualBuffer++; } }
private void ThrowModeError(HighlightMode expectedMode, HighlightMode actualMode, string expectedText) { string msg = StringExtensions.Fi("Error found comparing actual highlighting to expected highlighting. Expected mode '{0}' but found mode '{1}' " + "for text '{2}' on line '{3}' of input. Actual text is '{4}'. Good luck.", expectedMode, actualMode, expectedText, this.m_currentLine, this.m_actualBuffer.Substring(this.m_idxActualBuffer, this.m_actualBuffer.Length - this.m_idxActualBuffer)); throw new Exception(msg); }
static private void SetHighlightMode(string key, HighlightMode value) { EditorPrefs.SetInt(key, (int)value); }
static private HighlightMode GetHighlightMode(string key, HighlightMode defaultValue) { return((HighlightMode)EditorPrefs.GetInt(key, (int)defaultValue)); }
/// <summary> /// Called when a <see cref="HighlightMode">mode</see> starts. /// </summary> protected virtual void WriteModeStart(HighlightMode mode) { this.m_writer.WriteStartElement(m_modeNames[(int) mode]); }
public void ActivateOutlines(List <Tile> tilesToHighlight, HighlightMode highlightMode, bool tilesBecameNotClickable = true) { Color highlightColor; Material highlightCaseMat, highlightCordeMat; switch (highlightMode) { case HighlightMode.MoveRangePreview: highlightColor = moveRangePreviewColor; highlightCaseMat = moveRangePreviewDecalCaseMat; highlightCordeMat = moveRangePreviewDecalCordeMat; break; case HighlightMode.MoveHighlight: highlightColor = moveHighlightColor; highlightCaseMat = moveHighlightDecalCaseMat; highlightCordeMat = moveHighlightDecalCordeMat; break; case HighlightMode.ActionPreview: highlightColor = actionPreviewColor; highlightCaseMat = actionPreviewDecalCaseMat; highlightCordeMat = actionPreviewDecalCordeMat; break; case HighlightMode.ActionHighlight: highlightColor = actionHighlightColor; highlightCaseMat = actionHighlightMDecalCaseMat; highlightCordeMat = actionHighlightMDecalCordeMat; break; case HighlightMode.ExplosionPreview: highlightColor = explosionPreviewColor; highlightCaseMat = explosionPreviewDecalCaseMat; highlightCordeMat = explosionPreviewDecalCordeMat; break; default: highlightColor = hoverColor; highlightCaseMat = hoverDecalCaseMat; highlightCordeMat = hoverDecalCordeMat; break; } Free tile; foreach (Tile t in tilesToHighlight) { if (!(t is Free) || (t is Water)) { continue; } tile = t as Free; tile.highlightCase.enabled = false; tile.ropeUp.enabled = false; tile.ropeRight.enabled = false; tile.ropeDown.enabled = false; tile.ropeLeft.enabled = false; //Change case decal material tile.highlightCase.material = highlightCaseMat; //Change corde decal material tile.ropeUp.material = highlightCordeMat; tile.ropeRight.material = highlightCordeMat; tile.ropeDown.material = highlightCordeMat; tile.ropeLeft.material = highlightCordeMat; //Change highlight color tile.highlightCase.material.SetColor("_EmissiveColor", highlightColor); tile.highlightCase.material.SetColor("_BaseColor", highlightColor); tile.ropeUp.material.SetColor("_EmissiveColor", highlightColor); tile.ropeUp.material.SetColor("_BaseColor", highlightColor); tile.ropeRight.material.SetColor("_EmissiveColor", highlightColor); tile.ropeRight.material.SetColor("_BaseColor", highlightColor); tile.ropeDown.material.SetColor("_EmissiveColor", highlightColor); tile.ropeDown.material.SetColor("_BaseColor", highlightColor); tile.ropeLeft.material.SetColor("_EmissiveColor", highlightColor); tile.ropeLeft.material.SetColor("_BaseColor", highlightColor); tile.highlighted = true; if (tilesBecameNotClickable) { tile.isClickable = true; } //Highlight de la case enable tile.highlightCase.enabled = true; //Check for neighbours //UP Tile currentNeighbour = tile.neighbours.up; if (IsTileAvailableToHighlight(currentNeighbour)) { if (tilesToHighlight.Contains(currentNeighbour)) { tile.ropeUp.enabled = false; } else { tile.ropeUp.enabled = true; } } else { tile.ropeUp.enabled = true; } //RIGHT currentNeighbour = tile.neighbours.right; if (IsTileAvailableToHighlight(currentNeighbour)) { if (tilesToHighlight.Contains(currentNeighbour)) { tile.ropeRight.enabled = false; } else { tile.ropeRight.enabled = true; } } else { tile.ropeRight.enabled = true; } //DOWN currentNeighbour = tile.neighbours.down; if (IsTileAvailableToHighlight(currentNeighbour)) { if (tilesToHighlight.Contains(currentNeighbour)) { tile.ropeDown.enabled = false; } else { tile.ropeDown.enabled = true; } } else { tile.ropeDown.enabled = true; } //LEFT currentNeighbour = tile.neighbours.left; if (IsTileAvailableToHighlight(currentNeighbour)) { if (tilesToHighlight.Contains(currentNeighbour)) { tile.ropeLeft.enabled = false; } else { tile.ropeLeft.enabled = true; } } else { tile.ropeLeft.enabled = true; } } }
/// <summary> /// Start work on a chunk of text with output to a <see cref="XmlWriter"/>. /// </summary> public void Start(XmlWriter writer, Syntax syntax) { ArgumentValidator.ThrowIfNull(writer, "writer"); ArgumentValidator.ThrowIfNull(syntax, "syntax"); this.m_writer = writer; this.m_mode = HighlightMode.Unknown; this.m_hasStartedMode = false; this.m_charBuf = new char[CharBufferSize]; this.Start(syntax); }
private void ToggleHighlightMode(HighlightMode mode) { if(_suspendUi || _project.HighlightMode == mode) return; _project.HighlightMode = mode; RefreshOptionsUI(); ShowRegexResults(); }
protected virtual void ThrowIfModesDontMatch(HighlightMode expectedMode, string expectedText) { if (this.m_modeForBufferedText != expectedMode) { this.ThrowModeError(expectedMode, this.m_modeForBufferedText, expectedText); } }
internal void SetHighlightMode(HighlightMode mode) { this.HasHighlightMode = true; this.HighlightMode = mode; }
private void CheckAgainstActual(HighlightMode expectedMode, string expectedText) { int idxExpected = 0; do { if (this.m_idxActualBuffer == this.m_actualBuffer.Length) { this.BufferMoreActualText(); } DoCheckAgainstBufferedActualText(expectedMode, expectedText, ref idxExpected); } while (idxExpected < expectedText.Length); }
/// <summary> /// Set selected items' highlight mode. /// </summary> private void SetHighlightMode(HighlightMode mode) { Runtime.ValidateRefCounted(this); ListView_SetHighlightMode(handle, mode); }
private bool ReadFromExpected(out HighlightMode mode, out string text) { if (this.m_expectedReader.NodeType == XmlNodeType.Text || this.m_expectedReader.NodeType == XmlNodeType.Whitespace) { mode = HighlightMode.Normal; text = this.m_expectedReader.ReadString(); return true; } if (!this.m_expectedReader.IsStartElement("span")) { if (!this.m_expectedReader.ReadToFollowing("span")) { mode = HighlightMode.Unknown; text = null; return false; } } // there's a bug in the Vim 2html script where it outputs a <span> with an empty class atribute. This works around it. if (string.IsNullOrEmpty(this.m_expectedReader.GetAttribute("class"))) { mode = HighlightMode.Normal; } else { mode = (HighlightMode) Enum.Parse(typeof (HighlightMode), this.m_expectedReader.GetAttribute("class"), true); } text = string.Empty; while (!(this.m_expectedReader.NodeType == XmlNodeType.EndElement && this.m_expectedReader.LocalName == "span")) { this.m_expectedReader.Read(); if (this.m_expectedReader.NodeType == XmlNodeType.Text || this.m_expectedReader.NodeType == XmlNodeType.CDATA) { text += this.m_expectedReader.Value; } } this.m_expectedReader.Read(); return true; }
/// <summary> /// macOS: Sets when the tray’s icon background becomes highlighted (in blue). /// /// Note: You can use highlightMode with a BrowserWindow by toggling between /// 'never' and 'always' modes when the window visibility changes. /// </summary> /// <param name="highlightMode"></param> public void SetHighlightMode(HighlightMode highlightMode) { BridgeConnector.Socket.Emit("tray-setHighlightMode", highlightMode.ToString()); }
internal void AddHighlightLinkTo(Group target) { this.m_highlightMode = HighlightMode.Unknown; this.m_highlightLink = target; }
internal void SendMode(HighlightMode mode, int idxHighlightStart) { this.TrimModesAtAndAfter(idxHighlightStart); this.m_modes.Add(new KeyValuePair<int, HighlightMode>(idxHighlightStart, mode)); }
/// <summary> /// Called when a <see cref="HighlightMode">mode</see> starts. /// </summary> protected virtual void WriteModeStart(HighlightMode mode) { this.m_writer.WriteStartElement(m_modeNames[(int)mode]); }
public override void DeactivateHighlight(HighlightMode highlightModeAfter) { Highlight_Manager.instance.DeactivateOutlines(this, false, highlightModeAfter); }
internal void SendMode(HighlightMode mode, int idxHighlightStart) { this.TrimModesAtAndAfter(idxHighlightStart); this.m_modes.Add(new KeyValuePair <int, HighlightMode>(idxHighlightStart, mode)); }
internal static extern void XmTextSetHighlight(IntPtr widget, long left, long right, HighlightMode mode);
public virtual void ActivateHighlight(HighlightMode highlightMode) { }
private IBrush GetColorForHighlightMode(HighlightMode mode) => mode switch {
public virtual void DeactivateHighlight(HighlightMode highlightModeAfter) { }
internal static extern void ListView_SetHighlightMode(IntPtr handle, HighlightMode mode);
public void SetCommand(HighlightCommand command) { this._command = command; this.Status = this._command.GetStatus(); }
protected override void WriteModeStart(HighlightMode mode) { _xmlWriter.WriteStartElement("span"); if (_highlightMode == CodeHighlightMode.DirectIris || _highlightMode == CodeHighlightMode.IndirectIris) { _xmlWriter.WriteAttributeString("class", _classNames[(int)mode]); } else if (_highlightMode == CodeHighlightMode.Snippets) { // Let's degrade to using the three classes supported by the snippets if (mode == HighlightMode.Comment) { _xmlWriter.WriteAttributeString("class", "comment"); } else if (mode == HighlightMode.Keyword) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.Statement) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.StorageClass) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.Type) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.Boolean) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.Conditional) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.Repeat) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.PreProc) { _xmlWriter.WriteAttributeString("class", "keyword"); } else if (mode == HighlightMode.String) { _xmlWriter.WriteAttributeString("class", "literal"); } else if (mode == HighlightMode.Character) { _xmlWriter.WriteAttributeString("class", "literal"); } else if (mode == HighlightMode.Number) { _xmlWriter.WriteAttributeString("class", "literal"); } else if (mode == HighlightMode.Float) { _xmlWriter.WriteAttributeString("class", "literal"); } else if (mode == HighlightMode.PreCondit) { _xmlWriter.WriteAttributeString("class", "literal"); } else { _xmlWriter.WriteAttributeString("class", _classNames[(int)mode]); } } }
public void SetHighlight(Range range, HighlightMode mode) { NativeMethods.XmTextSetHighlight(this.NativeHandle.Widget, range.Begin, range.End, mode); }
public override void ActivateHighlight(HighlightMode highlightMode) { Highlight_Manager.instance.ActivateOutlines(new List <Tile> { this }, highlightMode, false); }