Пример #1
0
        /// <summary>
        /// Occurs when the mouse is hovered over an <c>EditorView</c></summary>
        private void EditorViewMouseHover(object sender, EditorViewMouseEventArgs e)
        {
            var editor = sender as SyntaxEditor;

            if ((e.HitTestResult.Token != null) &&
                (MouseHoveringOverToken != null) &&
                (e.HitTestResult.Token.Language.Key.ToLower() != "plain text"))
            {
                Languages 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)
                {
                    IToken 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;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Constructor with the specified arguments</summary>
 /// <param name="language">Language</param>
 /// <param name="token">Token type</param>        
 /// <param name="lineNumber">The line number of the token</param>
 public MouseHoverOverTokenEventArgs(Languages language,Token token, int lineNumber)
 {
     m_language = language;
     m_token = token;            
     m_lineNumver = lineNumber;            
 }