void Caret_PositionChanged(object sender, EventArgs e)
 {
     if (ActiveTextAreaControl.SelectionManager.SelectedText == "")
     {
         DocumentLanguage tmpLang = HighlighterUtils.GetDocumentLanguage(this);
         if (tmpLang != docLang)
         {
             docLang = tmpLang;
             OnHighlighterChanged(this, new HighlighterChangedEventArgs(docLang));
         }
     }
 }
Beispiel #2
0
        public void Parse()
        {
            switch (HighlighterUtils.GetDocumentLanguageFromHighlighter(editorTab.editor))
            {
            case DocumentLanguage.HTML:
                ParserClass.HtmlParser.Parse(editorTab.editor.FileName, editorTab.editor.Text, true, MainForm.mainForm.codeBrowser.codeBrowserControl);
                //LanguageBinding.HTMLParser.Parse(editorTab.editor.Text);
                if (HTMLParser.StyleNodes != null)
                {
                    foreach (var item in LanguageBinding.HTMLParser.StyleNodes)
                    {
                        HtmlNode styleNode = (item.Object as HtmlNode);
                        LanguageBinding.CSSParser.Parse(styleNode.InnerText, item);
                    }
                }
                break;

            case DocumentLanguage.CSS:
                LanguageBinding.CSSParser.Parse(editorTab.editor.Text);
                break;
            }
        }
Beispiel #3
0
        public bool TextArea_DoProcessDialogKey(Keys keyData, EditorControl editor)
        {
            if ((CurrentTemplate != null) && keyData == Keys.Enter)
            {
                foreach (var item in CurrentTemplate.List)
                {
                    if (item.HasChilds)
                    {
                        List <CopyMarker> copyMarkerList = CurrentTemplate.GetChildsOfParent(item.VariableName);
                        if (copyMarkerList.Count > 0)
                        {
                            string currentText = editor.Text.Substring(item.Expression.Offset, item.Expression.Length);
                            foreach (var copyItem in copyMarkerList)
                            {
                                //string copyText
                                editor.Document.Remove(copyItem.Expression.Offset, copyItem.Expression.Length);
                                editor.Document.Insert(copyItem.Expression.Offset, currentText);
                            }
                        }
                    }
                }

                CurrentTemplate.GoToEndMarker(editor);
                ClearMarkers(editor);
                CurrentTemplate = null;
                processTemplate = false;
                return(true);
            }
            if ((keyData == Keys.Tab) && (CurrentTemplate != null))
            {
                bool canSwitch = CurrentTemplate.SwitchBetweenExpressions(editor);

                if (canSwitch)
                {
                    return(canSwitch);
                }
                else
                {
                    CurrentTemplate.GoToEndMarker(editor);
                    return(true);
                }
            }
            else if (keyData == Keys.Tab)
            {
                if (mouseEndPosition != null)
                {
                    editor.Caret.Position = editor.Document.OffsetToPosition(mouseEndPosition.Offset);

                    removeMouseEndPosition(editor);
                    return(true);
                }
                else
                {
                    int    shortcutOffset = TextUtilities.FindPrevWordStart(editor.Document, editor.Caret.Offset);
                    string shortcut       = TextUtilities.GetWordAt(editor.Document, shortcutOffset);
                    switch (HighlighterUtils.GetDocumentLanguage(editor))
                    {
                    case DocumentLanguage.PHP:
                        return(InsertQuickTemplate(shortcut, shortcutOffset, DocumentLanguage.PHP, editor));;

                    case DocumentLanguage.JavaScript:
                        return(InsertQuickTemplate(shortcut, shortcutOffset, DocumentLanguage.JavaScript, editor));
                    }
                }
            }

            return(false);
        }