コード例 #1
0
        private void syntaxIndicators()
        {
            var funcs = highlighter.Functions;
            int pos   = scintilla.CurrentPosition;

            ELToken currFunc = null;

            foreach (var f in funcs)
            {
                if (pos >= f.pos && pos <= f.pos + f.functionLen)
                {
                    currFunc = f;
                }
            }

            scintilla.IndicatorCurrent = 1;
            scintilla.IndicatorClearRange(0, scintilla.TextLength);
            scintilla.IndicatorCurrent = 2;
            scintilla.IndicatorClearRange(0, scintilla.TextLength);
            if (currFunc != null)
            {
                scintilla.IndicatorCurrent    = 1;
                scintilla.Indicators[1].Style = IndicatorStyle.StraightBox;
                scintilla.IndicatorClearRange(0, scintilla.TextLength);
                // don't highlight the entire text (first function, usually)
                if (settings.HighlightFunction)
                {
                    if (currFunc.pos > 2 || currFunc.functionLen < scintilla.Text.Trim().Length - 3 || pos <= currFunc.pos + currFunc.len)
                    {
                        scintilla.IndicatorFillRange(currFunc.pos, currFunc.functionLen);
                    }
                }

                scintilla.IndicatorCurrent        = 2;
                scintilla.Indicators[2].Style     = IndicatorStyle.FullBox;
                scintilla.Indicators[2].ForeColor = Color.Red;
                scintilla.Indicators[2].Alpha     = 60;
                scintilla.IndicatorClearRange(0, scintilla.TextLength);

                if (settings.HighlightDelimiters)
                {
                    foreach (int p in currFunc.separators)
                    {
                        scintilla.IndicatorFillRange(p, 1);
                    }
                }
            }
            if (currFunc != selectedFunction)
            {
                selectedFunction = currFunc;
                FunctionChanged?.Invoke(this, selectedFunction);
            }
        }
コード例 #2
0
 private void FunctionsDropdown_ValueChanged(object sender, string value)
 {
     Object.Function = ((DropDownUI)sender).SelectedItem as IFunctionBase;
     FunctionChanged?.Invoke(Object);
 }