protected override void OnTokenMouseLeave(EditorViewMouseEventArgs e) { base.OnTokenMouseLeave(e); if (this.UriLayer != null) { this.UriLayer.Clear(); } }
protected override void OnViewMouseHover(EditorViewMouseEventArgs e) { if (e.get_HitTestResult().get_Target() == 10) { if ((((e.get_HitTestResult().get_DisplayLine() != null) && (e.get_HitTestResult().get_DisplayLine().get_DocumentLine() != null)) && (e.get_HitTestResult().get_DisplayLine().get_DocumentLine().get_LineIndicators() != null)) && (e.get_HitTestResult().get_DisplayLine().get_DocumentLine().get_LineIndicators().get_Count() > 0)) { string s = e.get_HitTestResult().get_DisplayLine().get_DocumentLine().get_LineIndicators().get_Item(0).get_Tag() as string; if (s != null) { e.set_ToolTipText(this.BulletizeAndEscape(s)); } } } else if ((e.get_HitTestResult().get_Token() != null) && (e.get_HitTestResult().get_Token().get_Key() == "CommentURLToken")) { e.set_ToolTipText(base.get_Document().GetTokenText(e.get_HitTestResult().get_Token()) + "<br/><b>CTRL + click to follow link</b>"); } else if ((e.get_HitTestResult().get_Token() != null) && ((e.get_HitTestResult().get_Token().get_Key() == "SingleLineComment") || (e.get_HitTestResult().get_Token().get_Key() == "MultiLineComment"))) { string tokenText = base.get_Document().GetTokenText(e.get_HitTestResult().get_Token()); Match match = UriMatcher.Match(tokenText); if (match.Success) { e.set_ToolTipText(match.Value + "<br/><b>CTRL + click to follow link</b>"); } } else { SpanIndicator[] indicatorsForTextRange = this.MainErrorLayer.GetIndicatorsForTextRange(new TextRange(e.get_HitTestResult().get_Offset(), e.get_HitTestResult().get_Offset() + 1)); if (indicatorsForTextRange.Length == 0) { indicatorsForTextRange = this.WarningsLayer.GetIndicatorsForTextRange(new TextRange(e.get_HitTestResult().get_Offset(), e.get_HitTestResult().get_Offset() + 1)); } if (indicatorsForTextRange.Length > 0) { } if ((CS$ < > 9__CachedAnonymousMethodDelegate22 == null) && indicatorsForTextRange.OfType <CompilerErrorSpanIndicator>().Any <CompilerErrorSpanIndicator>(CS$ < > 9__CachedAnonymousMethodDelegate22)) { e.set_ToolTipText(this.BulletizeAndEscape(indicatorsForTextRange.OfType <CompilerErrorSpanIndicator>().First <CompilerErrorSpanIndicator>(i => (i.get_Tag() is string)).get_Tag().ToString())); } } base.OnViewMouseHover(e); }
protected override void OnTokenMouseEnter(EditorViewMouseEventArgs e) { base.OnTokenMouseEnter(e); if ((e.get_HitTestResult().get_Token() != null) && ((e.get_HitTestResult().get_Token().get_Key() == "SingleLineComment") || (e.get_HitTestResult().get_Token().get_Key() == "MultiLineComment"))) { string input = null; try { input = base.get_Document().GetTokenText(e.get_HitTestResult().get_Token()); } catch (ArgumentException) { return; } Match match = UriMatcher.Match(input); if (match.Success && (this.UriLayer != null)) { this.UriLayer.Add(new UriSpanIndicator(), new TextRange(e.get_HitTestResult().get_Token().get_StartOffset() + match.Index, (e.get_HitTestResult().get_Token().get_StartOffset() + match.Index) + match.Length)); } } }
protected override void OnViewMouseDown(EditorViewMouseEventArgs e) { if ((e.Button == MouseButtons.Left) && (Control.ModifierKeys == Keys.Control)) { if ((e.get_HitTestResult().get_Token() != null) && (e.get_HitTestResult().get_Token().get_Key() == "CommentURLToken")) { e.set_Cancel(true); WebHelper.LaunchBrowser(base.get_Document().GetTokenText(e.get_HitTestResult().get_Token())); } else if ((e.get_HitTestResult().get_Token() != null) && ((e.get_HitTestResult().get_Token().get_Key() == "SingleLineComment") || (e.get_HitTestResult().get_Token().get_Key() == "MultiLineComment"))) { string tokenText = base.get_Document().GetTokenText(e.get_HitTestResult().get_Token()); Match match = UriMatcher.Match(tokenText); if (match.Success) { e.set_Cancel(true); WebHelper.LaunchBrowser(match.Value); } } } base.OnViewMouseDown(e); }
protected override void OnViewMouseHover(EditorViewMouseEventArgs e) { if (e.get_HitTestResult().get_Target() == 10) { if ((((e.get_HitTestResult().get_DisplayLine() != null) && (e.get_HitTestResult().get_DisplayLine().get_DocumentLine() != null)) && (e.get_HitTestResult().get_DisplayLine().get_DocumentLine().get_LineIndicators() != null)) && (e.get_HitTestResult().get_DisplayLine().get_DocumentLine().get_LineIndicators().get_Count() > 0)) { string s = e.get_HitTestResult().get_DisplayLine().get_DocumentLine().get_LineIndicators().get_Item(0).get_Tag() as string; if (s != null) { e.set_ToolTipText(this.BulletizeAndEscape(s)); } } } else if ((e.get_HitTestResult().get_Token() != null) && (e.get_HitTestResult().get_Token().get_Key() == "CommentURLToken")) { e.set_ToolTipText(base.get_Document().GetTokenText(e.get_HitTestResult().get_Token()) + "<br/><b>CTRL + click to follow link</b>"); } else if ((e.get_HitTestResult().get_Token() != null) && ((e.get_HitTestResult().get_Token().get_Key() == "SingleLineComment") || (e.get_HitTestResult().get_Token().get_Key() == "MultiLineComment"))) { string tokenText = base.get_Document().GetTokenText(e.get_HitTestResult().get_Token()); Match match = UriMatcher.Match(tokenText); if (match.Success) { e.set_ToolTipText(match.Value + "<br/><b>CTRL + click to follow link</b>"); } } else { SpanIndicator[] indicatorsForTextRange = this.MainErrorLayer.GetIndicatorsForTextRange(new TextRange(e.get_HitTestResult().get_Offset(), e.get_HitTestResult().get_Offset() + 1)); if (indicatorsForTextRange.Length == 0) { indicatorsForTextRange = this.WarningsLayer.GetIndicatorsForTextRange(new TextRange(e.get_HitTestResult().get_Offset(), e.get_HitTestResult().get_Offset() + 1)); } if (indicatorsForTextRange.Length > 0) { } if ((CS$<>9__CachedAnonymousMethodDelegate22 == null) && indicatorsForTextRange.OfType<CompilerErrorSpanIndicator>().Any<CompilerErrorSpanIndicator>(CS$<>9__CachedAnonymousMethodDelegate22)) { e.set_ToolTipText(this.BulletizeAndEscape(indicatorsForTextRange.OfType<CompilerErrorSpanIndicator>().First<CompilerErrorSpanIndicator>(i => (i.get_Tag() is string)).get_Tag().ToString())); } } base.OnViewMouseHover(e); }
/// <summary> /// Occurs when the mouse is hovered over an <see cref="EditorView"/>. /// </summary> /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will raise the event.</param> /// <param name="e">An <c>EditorViewMouseEventArgs</c> that contains the event data.</param> protected override void OnSyntaxEditorViewMouseHover(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, EditorViewMouseEventArgs e) { if ((e.HitTestResult.Token == null) || (e.ToolTipText != null)) return; int offset = e.HitTestResult.Token.StartOffset; e.ToolTipText = GetQuickInfo(syntaxEditor, ref offset); }
protected override void OnSyntaxEditorViewMouseDown(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, EditorViewMouseEventArgs e) { m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.MovedCaret, syntaxEditor); base.OnSyntaxEditorViewMouseDown(syntaxEditor, e); }
/// <summary> /// Fired when the user clicks the sidebar to add a breakpoint. Determines whether to add or /// remove a breakpoint, does that, then updates the debugger breakpoints. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void syntaxEditor1_ViewMouseDown(object sender, EditorViewMouseEventArgs e) { if (e.Clicks == 1 && e.HitTestResult.Target == SyntaxEditorHitTestTarget.IndicatorMargin) { if (e.HitTestResult.DisplayLine.TextRange.AbsoluteLength == 0) { return; } SpanIndicatorLayer layer = syntaxEditor1.Document.SpanIndicatorLayers[BreakpointLayerKey]; SpanIndicator[] indicators = layer.GetIndicatorsForTextRange(e.HitTestResult.DisplayLine.TextRange); if (indicators != null && indicators.Length != 0) { foreach (BreakpointSpanIndicator indicator in indicators) { layer.Remove(indicator); } _FunctionRunner.RemoveBreakpoint(CurrentFunction, e.HitTestResult.DisplayLineIndex, 0); syntaxEditor1.Invalidate(); } else { DocumentLine line = e.HitTestResult.DisplayLine.DocumentLine; CreateBreakpoint(line.Index, 0); } } }
/// <summary> /// Occurs when a mouse button is pressed over an <c>EditorView</c></summary> private void EditorViewMouseDown(object sender, EditorViewMouseEventArgs e) { var editor = sender as SyntaxEditor; switch (e.HitTestResult.Target) { case SyntaxEditorHitTestTarget.IndicatorMargin: { if (e.HitTestResult.DocumentLine == null || e.Button == MouseButtons.Right || e.HitTestResult.DocumentLine.Text.Trim().Length == 0) return; ProcessBreakpointChange(e.HitTestResult.DocumentLine, BreakpointOperation.Toggle); } break; default: { if (e.HitTestResult.Token != null) { // See if the token is a URL token switch (e.HitTestResult.Token.Key) { case "CommentURLToken": case "MultiLineCommentURLToken": case "XMLCommentURLToken": { // If the CTRL key is pressed, navigate to the URL if ((e.Button == MouseButtons.Left) && (ModifierKeys == Keys.Control)) { e.Cancel = true; if (editor != null) System.Diagnostics.Process.Start(editor.Document.GetTokenText(e.HitTestResult.Token)); } } break; } } } break; } }
/// <summary> /// Occurs when the mouse is hovered over an <see cref="EditorView"/>. /// </summary> /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will raise the event.</param> /// <param name="e">An <c>EditorViewMouseEventArgs</c> that contains the event data.</param> protected override void OnSyntaxEditorViewMouseHover(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, EditorViewMouseEventArgs e) { if ((e.HitTestResult.Token == null) || (e.ToolTipText != null)) { return; } int offset = e.HitTestResult.Token.StartOffset; e.ToolTipText = GetQuickInfo(syntaxEditor, ref offset); }
/// <summary> /// Occurs when a mouse button is pressed over an <c>EditorView</c></summary> private void EditorViewMouseDown(object sender, EditorViewMouseEventArgs e) { var editor = sender as ActiproSoftware.SyntaxEditor.SyntaxEditor; switch (e.HitTestResult.Target) { case SyntaxEditorHitTestTarget.IndicatorMargin: { if (e.HitTestResult.DocumentLine == null || e.Button == MouseButtons.Right || e.HitTestResult.DocumentLine.Text.Trim().Length == 0) return; ProcessBreakpointChange(e.HitTestResult.DocumentLine, BreakpointOperation.Toggle); break; } default: if (e.HitTestResult.Token != null) { // See if the token is a URL token switch (e.HitTestResult.Token.Key) { case "CommentURLToken": case "MultiLineCommentURLToken": case "XMLCommentURLToken": // If the CTRL key is pressed, navigate to the URL if ((e.Button == MouseButtons.Left) && (ModifierKeys == Keys.Control) && (editor != null)) { e.Cancel = true; Process.Start(editor.Document.GetTokenText(e.HitTestResult.Token)); } break; } } // Add status message // this.WriteLine("ViewMouseDown: " + e.ToString()); break; } }
/// <summary> /// Occurs when the mouse is hovered over an <c>EditorView</c></summary> private void EditorViewMouseHover(object sender, EditorViewMouseEventArgs e) { var editor = sender as ActiproSoftware.SyntaxEditor.SyntaxEditor; if (e.HitTestResult.Token == null || MouseHoveringOverToken == null || e.HitTestResult.Token.Language.Key.ToLower() == "plain text") return; var lang = Languages.Text; switch (e.HitTestResult.Token.Language.Key.ToLower()) { case "c#": lang = Languages.Csharp; break; case "lua": lang = Languages.Lua; break; case "python": lang = Languages.Python; break; case "xml": lang = Languages.Xml; break; } if (editor == null) return; var itok = e.HitTestResult.Token; var t = new Token( itok.StartOffset, itok.EndOffset, itok.ID, itok.Key, editor.Document.GetTokenText(itok)); var arg = new MouseHoverOverTokenEventArgs( lang, t, e.HitTestResult.DocumentLine.Index + 1); MouseHoveringOverToken(this, arg); if (!string.IsNullOrEmpty(arg.TooltipText)) e.ToolTipText = arg.TooltipText; }
private void syntaxEditor1_ViewMouseHover(object sender, EditorViewMouseEventArgs e) { //SpanIndicator[] indicators = syntaxEditor1.Document.Indicators.GetSpanIndicatorsForOffset(e.OldMouseOverToken.StartOffset); if (e.HitTestResult.Token == null) { return; } SpanIndicator[] indicators = syntaxEditor1.Document.SpanIndicatorLayers.GetIndicatorsForTextRange( new TextRange(e.HitTestResult.Token.StartOffset, e.HitTestResult.Token.EndOffset), false); if (indicators != null) { foreach (SpanIndicator ind in indicators) { if (ind.Name == "ErrorIndicator") { e.ToolTipText = (string)ind.Tag; } } } }