Example #1
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Executes the hover tip operation. </summary>
        ///
        /// <remarks> 10/09/2018. </remarks>
        ///
        /// <param name="s">    A Scintilla to process. </param>
        /// <param name="pos">  The position. </param>
        /// <param name="word"> The word. </param>
        /// -------------------------------------------------------------------------------------------------
        public void DoHoverTip(Scintilla s, int pos, string word)
        {
            HoverTipScintilla = s;
            Hoverpos          = pos;

            HoverLabel = Labels.FindLabel(word);

            //string tip = word;
            if (HoverLabel != null)
            {
                if (HoverLabel.function)
                {
                    //its a function label
                    HoverTipScintilla.CallTipShow(Hoverpos, "Function :" + HoverLabel.label + " @ $" + HoverLabel.address.ToString("X4"));
                }
                else
                {
                    Program.telnetConnection.SendCommand("read-memory " + HoverLabel.address.ToString() + " 2", HoverCallback);
                }



                //found a label
                //tip = tip + " $" + HoverLabel.address.ToString("X4");
            }
            else
            {
                //no label lets not display anything
                //s.CallTipShow(pos,tip);
            }
        }
Example #2
0
 private void ScintillaSrc_DwellStart(object sender, ScintillaNET.DwellEventArgs e)
 {
     var highlight = highlights.FirstOrDefault(h => h.Start <= e.Position && e.Position <= h.End);
     if (highlight != null)
     {
         scintilla.CallTipShow(highlight.Start, highlight.Message);
     }
 }
Example #3
0
 private void _textForm_DwellStart(object sender, DwellEventArgs e)
 {
     if (!String.IsNullOrEmpty(_lastWord))
     {
         _textForm.CallTipShow(_textForm.CurrentPosition, _lastWord);
     }
     else
     {
         _textForm.CallTipCancel();
     }
 }
Example #4
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Callback, called when the hover. </summary>
        ///
        /// <remarks> 10/09/2018. </remarks>
        ///
        /// <param name="response"> The response. </param>
        /// <param name="tag">	    The tag. </param>
        /// -------------------------------------------------------------------------------------------------
        void HoverCallback(string[] response, int tag)
        {
            HoverTipScintilla.BeginInvoke(new MethodInvoker(delegate
            {
                int value;
                if (int.TryParse(response[0], NumberStyles.HexNumber, null, out value))
                {
                    value     = MainForm.Endian(value);
                    int val8  = (value & 0xff);
                    int val16 = (value & 0xffff);


                    HoverTipScintilla.CallTipShow(Hoverpos, "Var :" + HoverLabel.label + " @ $" + HoverLabel.nextAddress.ToString() + "  mem:" + response[0] + "  8:$" + val8.ToString("X2") + " / " + val8 + "    16:$" + val16.ToString("X4") + " / " + val16);
                }
            }));
        }
Example #5
0
        private void scriptedit_KeyUp(object sender, KeyEventArgs e)
        {
            bool showcalltip    = false;
            int  highlightstart = 0;
            int  highlightend   = 0;

            UpdatePositionInfo();

            // Call tip shown
            if (scriptedit.CallTipActive)
            {
                // Should we hide the call tip?
                if (curfunctionname.Length == 0)
                {
                    // Hide the call tip
                    scriptedit.CallTipCancel();
                }
                else
                {
                    // Update the call tip
                    showcalltip = true;
                }
            }
            // No call tip
            else
            {
                // Should we show a call tip?
                showcalltip = (curfunctionname.Length > 0) && !scriptedit.AutoCActive;
            }

            // Show or update call tip
            if (showcalltip)
            {
                string functiondef = scriptconfig.GetFunctionDefinition(curfunctionname);
                if (functiondef != null)
                {
                    // Determine the range to highlight
                    int argsopenpos  = functiondef.IndexOf(scriptconfig.FunctionOpen, StringComparison.Ordinal);
                    int argsclosepos = functiondef.LastIndexOf(scriptconfig.FunctionClose, StringComparison.Ordinal);
                    if ((argsopenpos > -1) && (argsclosepos > -1))
                    {
                        string   argsstr = functiondef.Substring(argsopenpos + 1, argsclosepos - argsopenpos - 1);
                        string[] args    = argsstr.Split(scriptconfig.ArgumentDelimiter[0]);
                        if ((curargumentindex >= 0) && (curargumentindex < args.Length))
                        {
                            int argoffset = 0;
                            for (int i = 0; i < curargumentindex; i++)
                            {
                                argoffset += args[i].Length + 1;
                            }
                            highlightstart = argsopenpos + argoffset + 1;
                            highlightend   = highlightstart + args[curargumentindex].Length;
                        }
                    }

                    // Determine callip position
                    int tippos   = curfunctionstartpos;
                    int funcline = scriptedit.LineFromPosition(curfunctionstartpos);

                    //mxd. If the tip obscures the view, move it down
                    if (scriptedit.CurrentLine > funcline)
                    {
                        int offset = curfunctionstartpos - scriptedit.Lines[funcline].Position;
                        tippos = scriptedit.Lines[scriptedit.CurrentLine].Position + offset;
                    }

                    //mxd. Take line wrapping into account
                    if (scriptedit.Lines[scriptedit.CurrentLine].WrapCount > 0)
                    {
                        int x         = scriptedit.PointXFromPosition(tippos);
                        int y         = scriptedit.PointYFromPosition(scriptedit.CurrentPosition);
                        int newtippos = scriptedit.CharPositionFromPointClose(x, y);
                        if (newtippos != -1)
                        {
                            tippos = newtippos;
                        }
                    }

                    // Show tip
                    scriptedit.CallTipShow(tippos, functiondef);
                    scriptedit.CallTipSetHlt(highlightstart, highlightend);
                }
            }
        }