예제 #1
0
        private void viewer_DwellStart(Object sender, ScintillaNET.ScintillaMouseEventArgs args)
        {
            //MessageBox.Show(args.Position.ToString());
            string varStr = GetVariableFromPosition((sender as Scintilla).Text, args.Position);

            if (!string.IsNullOrEmpty(varStr))
            {
                //MessageBox.Show(varStr);
                rtViewer.Width  = 500;
                rtViewer.Height = 200;
                int x = args.X + (sender as Scintilla).Location.X;
                int y = args.Y + (sender as Scintilla).Location.Y + 5;
                if (x + rtViewer.Width > this.Width)
                {
                    x = this.Width - rtViewer.Width;
                }

                rtViewer.Location = new Point(x, y);

                rtViewer.VarName = varStr;
                rtViewer.Context = DebugTrace.PostContext;
                rtViewer.Display();
                if (rtViewer.Parent == null)
                {
                    this.Controls.Add(rtViewer);
                }
                rtViewer.Visible = true;
                rtViewer.BringToFront();
            }
        }
예제 #2
0
        void scintillaCodeView_DwellStart(object sender, ScintillaNET.ScintillaMouseEventArgs e)
        {
            var curpos    = this.PositionFromPoint(e.X, e.Y);
            int mappedPos = CodePositionMapper != null?CodePositionMapper(this.Text, curpos) : curpos;

            if (mappedPos < 0)
            {
                return;
            }

            string fullCode = GetCode == null ? this.Text : GetCode();

            if (mappedPos > fullCode.Length - 1)
            {
                this.CallTip.Hide();
                return;
            }

            var currentChar = fullCode[mappedPos];

            if (char.IsWhiteSpace(currentChar))
            {
                this.CallTip.Hide();
                return;
            }

            var callTipText = new CodeAnalysisService().GetCallTipTextAtPosition(fullCode, mappedPos);

            if (!string.IsNullOrWhiteSpace(callTipText))
            {
                this.CallTip.BackColor = Color.FromArgb(231, 232, 236);
                this.CallTip.ForeColor = Color.Black;
                this.Styles[ScintillaNET.StylesCommon.CallTip].Font = _callTipFont;

                if (callTipText.Length > 150 && callTipText.IndexOf('\n') < 0)
                {
                    var chars = callTipText.ToCharArray();
                    for (int i = 149; i < chars.Length; i++)
                    {
                        if (char.IsWhiteSpace(chars[i]))
                        {
                            chars[i] = '\n';
                            break;
                        }
                    }
                    callTipText = new string(chars);
                }
                this.CallTip.Show(callTipText, curpos);
            }
            else
            {
                this.CallTip.Hide();
            }
        }
예제 #3
0
 /// <summary>
 ///     Raises the <see cref="IndicatorClick"/> event.
 /// </summary>
 /// <param name="e">An <see cref="ScintillaMouseEventArgs"/> that contains the event data.</param>
 protected virtual void OnIndicatorClick(ScintillaMouseEventArgs e)
 {
     EventHandler<ScintillaMouseEventArgs> handler = Events[_indicatorClickEventKey] as EventHandler<ScintillaMouseEventArgs>;
     if (handler != null)
         handler(this, e);
 }
예제 #4
0
 /// <summary>
 ///     Raises the <see cref="DwellStart"/> event.
 /// </summary>
 /// <param name="e">An <see cref="ScintillaMouseEventArgs"/> that contains the event data.</param>
 protected virtual void OnDwellStart(ScintillaMouseEventArgs e)
 {
     EventHandler<ScintillaMouseEventArgs> handler = Events[_dwellStartEventKey] as EventHandler<ScintillaMouseEventArgs>;
     if (handler != null)
         handler(this, e);
 }
예제 #5
0
 void scintillaCodeView_DwellEnd(object sender, ScintillaNET.ScintillaMouseEventArgs e)
 {
     this.CallTip.Hide();
 }