public Control GetControl(IEnumerable <AutocompleteItem> autocompleteItems)
        {
            FastColoredTextBox textBox          = new FastColoredTextBox();
            AutocompleteMenu   autocompleteMenu = new AutocompleteMenu(textBox);

            textBox          = new FastColoredTextBox();
            textBox.Location = new Point(0, 0);
            textBox.Dock     = DockStyle.Fill;
            textBox.Show();
            // TODO: add diffmerge (put this elsewhere, its own tool/section)
            // TODO: make comments always override non-comment patterns
            textBox.SyntaxHighlighter       = new SyntaxHighlighter(textBox);
            textBox.AutoCompleteBrackets    = true;
            textBox.AutoIndentChars         = false;
            textBox.AutoIndentExistingLines = true;
            textBox.AutoIndent = true;
            textBox.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy1;
            textBox.LeftBracket   = '{';
            textBox.LeftBracket2  = '(';
            textBox.RightBracket  = '}';
            textBox.RightBracket2 = ')';
            textBox.DelayedTextChangedInterval = 400;
            textBox.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
            textBox.WordWrap      = true;
            textBox.LeftPadding   = 17;

            Color textColor          = ColorTranslator.FromHtml("#A9B7C6");
            Color backColor          = ColorTranslator.FromHtml("#2B2B2B");
            Color neutralGrey        = ColorTranslator.FromHtml("#808080");
            Color testingColorBright = ColorTranslator.FromHtml("#CB772F");

            // Colours - IntelliJ Darcula
            textBox.ForeColor       = textColor;
            textBox.BackColor       = backColor;
            textBox.SelectionColor  = textColor;
            textBox.IndentBackColor = backColor;
            textBox.LineNumberColor = textColor;
            // End Colours
            textBox.DescriptionFile = @"..\..\ParadoxSyntax\ParadoxFormat.xml";
            textBox.Language        = Language.Custom;
            // End Custom Properties

            textBox.OnTextChangedDelayed(textBox.Range);
            textBox.BringToFront();

            autocompleteMenu                   = new AutocompleteMenu(textBox);
            autocompleteMenu.ForeColor         = Color.White;
            autocompleteMenu.BackColor         = Color.Gray;
            autocompleteMenu.SelectedColor     = Color.Purple;
            autocompleteMenu.SearchPattern     = @"[\w\.]";
            autocompleteMenu.AllowTabKey       = true;
            autocompleteMenu.AlwaysShowTooltip = true;
            autocompleteMenu.SearchPattern     = @"[\w\.:=!<>]";

            autocompleteMenu.Items.SetAutocompleteItems(autocompleteItems);

            return(textBox);
        }
 public void BringToFront() => _tb.BringToFront();
Exemple #3
0
        private TabPage createNewContainet(string name, string fullPath = null, bool saved = false)
        {
            //create new tab
             TabPage newPage = new TabPage(name);
             tabContainer.TabPages.Add(newPage);

             SplitContainer container = new SplitContainer();
             container.Orientation = Orientation.Horizontal;
             container.Dock = DockStyle.Fill;
             newPage.Controls.Add(container);

             //create output console
             OutputConsole console = new OutputConsole();
             console.Name = "outputConsole";
             console.Dock = DockStyle.Fill;
             container.Panel2.Controls.Add(console);
             container.Panel2Collapsed = true;

             //create new editor
             var newEditor = new FastColoredTextBox();
             newEditor.Name = "mainEditor";
             newEditor.DelayedTextChangedInterval = 1000;
             newEditor.DelayedEventsInterval = 500;
             newEditor.Language = FastColoredTextBoxNS.Language.wQL;
             newEditor.TextChangedDelayed += new EventHandler<TextChangedEventArgs>(editor_TextChangedDelayed);
             newEditor.TextChanged += new EventHandler<TextChangedEventArgs>(editor_TextChanged);
             newEditor.SelectionChangedDelayed += new EventHandler(editor_SelectionChangedDelayed);
             newEditor.ToolTipNeeded += NewEditor_ToolTipNeeded;
             newEditor.Name = ProjectConstants.EditorControlName;
             container.Panel1.Controls.Add(newEditor);
             //newPage.Controls.Add(newEditor);
             newEditor.CurrentLineColor = highlightCurrentLineToolStripMenuItem.Checked ? currentLineColor : Color.Transparent;
             newEditor.HighlightingRangeType = HighlightingRangeType.VisibleRange;
             newEditor.AddStyle(sameWordsStyle);//same words style
             newEditor.Dock = DockStyle.Fill;

             AutocompleteMenu popupMenu = new AutocompleteMenu(newEditor);
             //popupMenu.Items.ImageList = ilAutocomplete;
             popupMenu.Opening += new EventHandler<CancelEventArgs>(popupMenu_Opening);
             BuildAutocompleteMenu(popupMenu);
             newEditor.Tag= popupMenu;

             tabContainer.SelectedTab = newPage;

             //create the details for the file
             var details = new FileDetails()
             {
            FileName = name,
            FullPath = fullPath,
            Saved = saved
             };

             newPage.Tag = details;

             updateTab(newPage);

             newEditor.BringToFront();
             newEditor.Focus();

             return newPage;
        }