Exemple #1
0
 public void InvokeIfNeeded(Action action)
 {
     if (codeEditorControl.InvokeRequired)
     {
         codeEditorControl.BeginInvoke(action);
     }
     else
     {
         action.Invoke();
     }
 }
Exemple #2
0
 /// <summary>Update Scintilla Control (From Any Thread)</summary>
 /// <param name="sci">Scintilla Control Name</param>
 /// <param name="Text"> </param>
 public void UpdateScintilla(Scintilla sci, string Text)
 {
     // update control text (from any thread) -- [ works in dll ]
     if (sci.InvokeRequired)
     {
         sci.BeginInvoke((MethodInvoker) delegate() { sci.Text = Text; });
     }
     else
     {
         sci.Text = Text;
     }
 }
Exemple #3
0
 /// <summary>Unfold All Bracked Code</summary>
 /// <param name="sci">Scintilla Control Name</param>
 public void UnFold(Scintilla sci)
 {
     // update control text (from any thread) -- [ works in dll ]
     if (sci.InvokeRequired)
     {
         sci.BeginInvoke((MethodInvoker) delegate() { sci.FoldAll(FoldAction.Expand); });
     }
     else
     {
         sci.FoldAll(FoldAction.Expand);
     }
 }
Exemple #4
0
 internal CallTip(Scintilla scintilla) : base(scintilla)
 {
     //	Go ahead and enable this. It's all pretty idiosyncratic IMO. For one
     //	thing you can't turn it off. We set the CallTip styles by default
     //	anyhow.
     NativeScintilla.CallTipUseStyle(10);
     Scintilla.BeginInvoke(new MethodInvoker(delegate()
     {
         HighlightTextColor = HighlightTextColor;
         ForeColor          = ForeColor;
         BackColor          = BackColor;
     }));
 }
Exemple #5
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);
                }
            }));
        }
Exemple #6
0
        /// <summary>Returns current line number in control</summary>
        /// <param name="sci">Scintilla Control Name</param>
        public int CurrentLine(Scintilla sci)
        {
            int current = -1;

            // update control text (from any thread) -- [ works in dll ]
            if (sci.InvokeRequired)
            {
                sci.BeginInvoke((MethodInvoker) delegate() { current = sci.CurrentLine; });
            }
            else
            {
                current = sci.CurrentLine;
            }

            return(current);
        }
Exemple #7
0
        private void _snippetLinkTimer_Tick(object sender, EventArgs e)
        {
            _snippetLinkTimer.Enabled = false;
            Range sr = Scintilla.Selection.Range;

            if (_snippetLinks.IsActive)
            {
                SnippetLink      oldActiveSnippetLink = _snippetLinks.ActiveSnippetLink;
                SnippetLinkRange oldActiveRange       = _snippetLinks.ActiveRange;

                if (oldActiveRange != null && (oldActiveRange.IntersectsWith(sr) || oldActiveRange.Equals(sr)))
                {
                    Scintilla.BeginInvoke(new MethodInvoker(delegate()
                    {
                        cascadeSnippetLinkRangeChange(oldActiveSnippetLink, oldActiveRange);

                        foreach (SnippetLink sl in _snippetLinks.Values)
                        {
                            foreach (Range r in sl.Ranges)
                            {
                                if (sl == _snippetLinks.ActiveSnippetLink)
                                {
                                    r.ClearIndicator(Scintilla.Snippets.InactiveSnippetIndicator);
                                    r.SetIndicator(Scintilla.Snippets.ActiveSnippetIndicator);
                                }
                                else
                                {
                                    r.SetIndicator(Scintilla.Snippets.InactiveSnippetIndicator);
                                    r.ClearIndicator(Scintilla.Snippets.ActiveSnippetIndicator);
                                }
                            }
                        }

                        if (_pendingUndo)
                        {
                            _pendingUndo = false;
                            Scintilla.UndoRedo.EndUndoAction();
                        }

                        Scintilla.NativeInterface.Colourise(0, -1);
                    }));
                }
            }
        }