Esempio n. 1
0
        public void ShowAutocomplete(Pos pos)
        {
            completeSource.Initialize((IView)editor.FindForm());
            var list = completeSource.GetItems();

            ShowAutocomplete(pos, list);
        }
Esempio n. 2
0
        private AutocompleteWindow GetAutocompleteWindow()
        {
            if (window == null)
            {
                window = new AutocompleteWindow(editor)
                {
                    MaxItems = 15, SmallFont = true
                };
                window.Visible    = false;
                window.MouseDown += AutocompleteClick;
                editor.FindForm().Controls.Add(window);
                window.BringToFront();
            }

            return(window);
        }
Esempio n. 3
0
        private void RestyleRange(Range range)
        {
            if (range.End.Line < 0)
            {
                return;
            }

            if (StyleNeeded != null)
            {
                StyleNeeded?.Invoke(this, new StyleNeededEventArgs(range));
            }
            else
            {
                var grm    = App.Ext.Grammars().GetGrammar(editor.Buffer.GrammarKey);
                var styler = grm == null ? null
                    : App.Catalog <IStylerComponent>().GetComponent(grm.StylerKey ?? defaultStyler);
                if (styler != null)
                {
                    styler.Style((IView)editor.FindForm(), range);
                }
            }
        }
Esempio n. 4
0
        private void RunRebuild(int fvl, int lvl)
        {
            try
            {
                busy = true;

                while (fvl > -1 && !IsFoldingHeader(fvl))
                {
                    fvl--;
                }

                fvl = fvl < 0 ? 0 : fvl;
                lvl = lvl < fvl ? fvl : lvl;

                var range = new Range(
                    new Pos(fvl, 0),
                    new Pos(lvl, Lines[lvl].Length - 1));

                if (FoldingNeeded != null)
                {
                    FoldingNeeded?.Invoke(this, new FoldingNeededEventArgs(range));
                }
                else
                {
                    var aff = editor.AffinityManager.GetRootAffinity();
                    var key = aff?.FoldingComponentKey ?? editor.EditorSettings.FoldingComponentKey;

                    if (key != null)
                    {
                        var fp = App.Catalog <IFoldingComponent>().GetComponent(key);
                        fp.Fold((IView)editor.FindForm(), range);
                    }
                }
            }
            finally
            {
                busy = false;
            }
        }
Esempio n. 5
0
        public bool CheckSpelling()
        {
            // check spelling
            using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), false))
            {
                //  center the spell-checking form over the document body
                spellCheckerForm.StartPosition = FormStartPosition.CenterParent;

                // create word range
                // TODO: smarter word range for html
                //TextBoxWordRange wordRange = new TextBoxWordRange(_textBox, _textBox.SelectionLength > 0);
                HtmlTextBoxWordRange wordRange = new HtmlTextBoxWordRange(_textBox);

                // check spelling
                spellCheckerForm.CheckSpelling(wordRange);

                // return completed status
                return(spellCheckerForm.Completed);
            }
        }