Inheritance: System.Windows.Forms.ToolStripDropDown
        public NetAutoCompletionMap(AutocompleteMenu menu, string[] separators)
            : base(menu)
        {
            _memberSeparators = separators;
            _cachedTypes = new List<CodeEditorAutoCompleteItem>();
            IconProvider = IconProvider.GetProvider<AssemblyIconProvider>();

            InitKeywordItems(Language.Keywords);
            InitSnippetItems(Language.Snippets);
        }
        public AutocompleteSample()
        {
            InitializeComponent();

            //create autocomplete popup menu
            _popupMenu = new AutocompleteMenu(fctb);
            _popupMenu.MinFragmentLength = 2;

            //generate 456976 words
            var randomWords = new List<string>();
            var codeA = Convert.ToInt32('a');
            for (var i = 0; i < 26; i++)
                for (var j = 0; j < 26; j++)
                    for (var k = 0; k < 26; k++)
                        for (var l = 0; l < 26; l++)
                            randomWords.Add(
                                new string(new[]
                                {
                                    Convert.ToChar(i + codeA), Convert.ToChar(j + codeA), Convert.ToChar(k + codeA),
                                    Convert.ToChar(l + codeA)
                                }));

            //set words as autocomplete source
            _popupMenu.Items.SetAutocompleteItems(randomWords);
            //size of popupmenu
            _popupMenu.Items.MaximumSize = new Size(200, 300);
            _popupMenu.Items.Width = 200;
        }
Example #3
0
        /// <summary>
        /// Creates a code editor and opens a file.
        /// </summary>
        /// <param name="file">File path.</param>
        /// <param name="currentRpgCode">RPGCode autocomplete items.</param>
        public CodeEditor(string file, RPGcode currentRpgCode)
        {
            InitializeComponent();

            initialLoad = true;

            txtCodeEditor.DescriptionFile = Application.StartupPath + @"\Resources\RPGCodeHighlighter.xml";
            txtCodeEditor.Language = Language.Custom;

            rpgCodeReference = currentRpgCode;
            EditorFile = file;

            this.TabText = Path.GetFileNameWithoutExtension(EditorFile);
            txtCodeEditor.AddStyle(new MarkerStyle(new SolidBrush(Color.FromArgb(50, Color.Gray))));

            if (EditorFile != "Untitled")
            {
                ReadFile();
            }

            popupMenu = new AutocompleteMenu(txtCodeEditor); // Set autocompletemenu's text source.
            popupMenu.Opening += this.popupMenu_Opening; // Override the menu's Opening event.
            popupMenu.Items.ImageList = imageListPopup;
            popupMenu.MinFragmentLength = 1;
            popupMenu.AppearInterval = 400;
            popupMenu.AllowTabKey = true;

            BuildAutocompleteMenu();
        }
Example #4
0
        public DashGlobal(
            EventHandler<TextChangedEventArgs> textAreaTextChanged,
            EventHandler<TextChangedEventArgs> textAreaTextChangedDelayed,
            KeyEventHandler textAreaKeyUp,
            EventHandler textAreaSelectionChangedDelayed,
            DragEventHandler textAreaDragDrop,
            DragEventHandler textAreaDragEnter,
            TabControl mainTabControl,
            AutocompleteMenu armaSense,
            Main mainWindow)
        {
            EditorHelper = new EditorHelper(
                textAreaTextChanged,
                textAreaTextChangedDelayed,
                textAreaKeyUp,
                textAreaSelectionChangedDelayed,
                textAreaDragDrop,
                textAreaDragEnter,
                mainTabControl,
                armaSense,
                this);

            TabsHelper = new TabsHelper(
                textAreaTextChanged,
                textAreaSelectionChangedDelayed,
                mainTabControl,
                this);

            FilesHelper = new FilesHelper(this);
            SettingsHelper = new SettingsHelper();

            MainWindow = mainWindow;
        }
Example #5
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        public MainWindow()
        {
            myInstance = this;
            InitializeComponent();

            myConnection = new Connection();

            //create autocomplete popup menu
            myPromptPopupMenu = new AutocompleteMenu(myPromptBox);
            myPromptPopupMenu.MinFragmentLength = 1;
            //size of popupmenu
            myPromptPopupMenu.Items.MaximumSize = new System.Drawing.Size(300, 400);
            myPromptPopupMenu.Items.Width = 300;

            myAutocompletionList = new List<string>();

            // Load macros
            myMacros = new List<Macro>();
            int i = 0;
            foreach(string macroShortcut in Properties.Settings.Default.MacroShortcuts)
            {
                Macro m = new Macro();
                m.Shortcut = macroShortcut;
                m.Script = Properties.Settings.Default.MacroScripts[i++];
                myMacros.Add(m);
            }

            myConnection.Connect("localhost", 22500);
        }
Example #6
0
        public AutocompleteSample()
        {
            InitializeComponent();

            //create autocomplete popup menu
            popupMenu = new FastColoredTextBoxNS.AutocompleteMenu(fctb);
            popupMenu.MinFragmentLength = 2;

            //generate 456976 words
            var randomWords = new List <string>();
            int codeA       = Convert.ToInt32('a');

            for (int i = 0; i < 26; i++)
            {
                for (int j = 0; j < 26; j++)
                {
                    for (int k = 0; k < 26; k++)
                    {
                        for (int l = 0; l < 26; l++)
                        {
                            randomWords.Add(
                                new string(new char[] { Convert.ToChar(i + codeA), Convert.ToChar(j + codeA), Convert.ToChar(k + codeA), Convert.ToChar(l + codeA) }));
                        }
                    }
                }
            }

            //set words as autocomplete source
            popupMenu.Items.SetAutocompleteItems(randomWords);
            //size of popupmenu
            popupMenu.Items.MaximumSize = new System.Drawing.Size(200, 300);
            popupMenu.Items.Width       = 200;
        }
Example #7
0
        //CONSTRUCTER
        public SplitFCTB()
        {
            InitializeComponent();

            InfoKeywordList = new List<String>(InfoKeywords.Split('|'));
            InfoKeywordList.Sort();

            autocompleteMenu1 = new AutocompleteMenu(editor1);
            autocompleteMenu1.MinFragmentLength = 0;
            autocompleteMenu1.AppearInterval = 1;

            autocompleteMenu2 = new AutocompleteMenu(editor1);
            autocompleteMenu2.MinFragmentLength = 0;
            autocompleteMenu2.AppearInterval = 1;

            tabControl.Visible = false;
            tabControl.MouseClick += new MouseEventHandler(tabControl_MouseClick);

            editor1.ReadOnly = true;
            editor2.ReadOnly = true;
            editor1.AddStyle(MinModeStyle);
            editor1.UndoRedoStateChanged += new EventHandler<EventArgs>(editor1_UndoRedoStateChanged);

            editor1.VisibleRangeChangedDelayed += new EventHandler(editor1_VisibleRangeChanged);
            editor2.VisibleRangeChangedDelayed += new EventHandler(editor2_VisibleRangeChanged);

            editor1.SelectionChanged += new EventHandler(editor1_SelectionChanged);
            editor2.SelectionChanged += new EventHandler(editor2_SelectionChanged);

            currentTabSaved = true;
        }
Example #8
0
 public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     e.Tb.BeginUpdate();
     e.Tb.Selection.BeginUpdate();
     //remember places
     var p1 = popupMenu.Fragment.Start;
     var p2 = e.Tb.Selection.Start;
     //do auto indent
     if (e.Tb.AutoIndent) {
         for (int iLine = p1.iLine + 1; iLine <= p2.iLine; iLine++) {
             e.Tb.Selection.Start = new Place(0, iLine);
             e.Tb.DoAutoIndent(iLine);
         }
     }
     e.Tb.Selection.Start = p1;
     //move caret position right and find char ^
     while (e.Tb.Selection.CharBeforeStart != '^')
         if (!e.Tb.Selection.GoRightThroughFolded())
             break;
     //remove char ^
     e.Tb.Selection.GoLeft(true);
     e.Tb.InsertText("");
     //
     e.Tb.Selection.EndUpdate();
     e.Tb.EndUpdate();
 }
Example #9
0
        private string[] snippets = { }; //{ "diag_log \"\";", "for \"_i\" from 1 to 10 do { debugLog _i; };", "call compile preprocessFileLine Numbers \"\";" };

        #endregion Fields

        #region Constructors

        public EditorHelper(
            EventHandler<TextChangedEventArgs> textAreaTextChanged,
            EventHandler<TextChangedEventArgs> textAreaTextChangedDelayed,
            KeyEventHandler textAreaKeyUp,
            EventHandler textAreaSelectionChangedDelayed,
            DragEventHandler textAreaDragDrop,
            DragEventHandler textAreaDragEnter,
            TabControl mainTabControl,
            AutocompleteMenu armaSense,
            DashGlobal dashGlobal)
        {
            TextAreaTextChanged = textAreaTextChanged;
            TextAreaTextChangedDelayed = textAreaTextChangedDelayed;
            TextAreaKeyUp = textAreaKeyUp;
            TextAreaSelectionChangedDelayed = textAreaSelectionChangedDelayed;
            TextAreaDragDrop = textAreaDragDrop;
            TextAreaDragEnter = textAreaDragEnter;
            MainTabControl = mainTabControl;
            ArmaSense = armaSense;

            DashGlobal = dashGlobal;

            ArmaListItemsCount = 0;
            ArmaSenseKeywords = new List<AutocompleteItem>();

            foreach (var item in keywordList)
            {
                ArmaSenseKeywords.Add(new AutocompleteItem(item) { ImageIndex = 0, ToolTipTitle = "Arma Script Command", ToolTipText = item });
            }
        }
Example #10
0
File: frmMain.cs Project: zuun/wSQL
        private void BuildAutocompleteMenu(AutocompleteMenu popupMenu, string[] localVariables = null)
        {
            List<AutocompleteItem> items = new List<AutocompleteItem>();

             foreach (var item in snippets)
            items.Add(new SnippetAutocompleteItem(item) { ImageIndex = 1 });
             //foreach (var item in declarationSnippets)
             //   items.Add(new DeclarationSnippet(item) { ImageIndex = 0 });
             //foreach (var item in methods)
             //   items.Add(new MethodAutocompleteItem(item) { ImageIndex = 2 });
             foreach (var item in keywords)
            items.Add(new AutocompleteItem(item));

             //items.Add(new InsertSpaceSnippet());
             //items.Add(new InsertSpaceSnippet(@"^(\w+)([=<>!:]+)(\w+)$"));
             //items.Add(new InsertEnterSnippet());

             //add code variables
             //localVariables = new string[9] { "page", "table", "tds", "content", "tdsText", "texts", "test1", "outFile", "printToFile" };
             if (localVariables != null && localVariables.Count() > 0)
            foreach(var item in localVariables)
               items.Add(new AutocompleteItem(item));

             //set as autocomplete source
             popupMenu.Items.SetAutocompleteItems(items);
             popupMenu.SearchPattern = @"[\w\.:=!<>]";
        }
        public SetupForm(CSharp aCSharp, IItemBrowser aBrowser)
        {
            mCSharp     = aCSharp;
            mBrowser    = aBrowser;
            InitializeComponent();

            fastColoredTextBox_Code.Text                = mCSharp.Code;

            Size                                        = mCSharp.mEditorSize;
            mNormalSize                                 = mCSharp.mEditorSize;
            splitContainerControl_Code.SplitterPosition = mCSharp.mEditorSplitterPos;
            tsComboBox_Font.SelectedIndex               = mCSharp.mEditorFontIndex;

            mAutocompleteMenu                           = new AutocompleteMenu(fastColoredTextBox_Code);
            mAutocompleteMenu.SelectedColor             = Color.Green;

            var lItems                                  = mBrowser.TotalItemNames;
            string lMaxName                             = "";

            for (int i = 0; i < lItems.Length; i++)
            {
                if (lMaxName.Length < lItems[i].Length) lMaxName = lItems[i];
            }
            var lWidth                                  = TextRenderer.MeasureText(lMaxName, mAutocompleteMenu.Font).Width;
            lWidth                                      = lWidth + lWidth / 5;
            mAutocompleteMenu.Items.MaximumSize         = new System.Drawing.Size(lWidth, 300);
            mAutocompleteMenu.Items.Width               = lWidth;
            mAutocompleteMenu.Items.SetAutocompleteItems(lItems);

            TriggerTimeMS   = mCSharp.mTriggerTimeMS;
            WatchdogMS      = mCSharp.mWatchdogMS;
        }
        public AutocompleteSample2()
        {
            InitializeComponent();

            //create autocomplete popup menu
            popupMenu = new AutocompleteMenu(fctb);
            popupMenu.Items.ImageList = imageList1;
            popupMenu.SearchPattern = @"[\w\.:=!<>]";
            popupMenu.AllowTabKey = true;
            //
            BuildAutocompleteMenu();
        }
Example #13
0
        public AutocompleteSample4()
        {
            InitializeComponent();

            //create autocomplete popup menu
            popupMenu = new AutocompleteMenu(fctb);
            popupMenu.SearchPattern = @"[\w\.]";

            //
            var items = new List<AutocompleteItem>();
            foreach (var item in sources)
                items.Add(new MethodAutocompleteItem2(item));

            popupMenu.Items.SetAutocompleteItems(items);
        }
        public Editor()
        {
            InitializeComponent();

            _blueStyle = new TextStyle(Brushes.Blue, null, FontStyle.Regular);

            _txtSrcCode = new FastColoredTextBox {
                Font = new Font("Consolas", 11),
                Dock = DockStyle.Fill
            };
            _txtSrcCode.TextChanged += (s, e) => PPLSyntaxHighlight(e);
            _txtSrcCode.SelectionChangedDelayed += (s, e) => SelectionDelayed();
            _txtSrcCode.KeyDown += (s, e) => {
                if (e.KeyCode == Keys.Space)
                    if (e.Control) {
                        _popupMenu.Show(true);
                        e.Handled = true;
                    }
            };

            _popupMenu = new AutocompleteMenu(_txtSrcCode) {
                MinFragmentLength = 100,
                AllowTabKey = true
            };

            _popupMenu.Items.ImageList = iconsList;

            _popupMenu.Items.SetAutocompleteItems(
                new List<AutocompleteItem> {
                    //operators
                    new AutocompleteItem("when"),
                    new AutocompleteItem("and"),
                    new AutocompleteItem("or"),
                    //conditions
                    new AutocompleteItem("is_a_bad_credit_customer",1),
                    new AutocompleteItem("order_ammount_is",1),
                    new AutocompleteItem("is_a_good_credit_customer",1),
                    new AutocompleteItem("is_international_order",1),
                    //actions
                    new AutocompleteItem("add_shipping_fee",0),
                    new AutocompleteItem("apply_discount",0),
                    new AutocompleteItem("block_the_order",0),
                });

            Controls.Add(_txtSrcCode);
        }
Example #15
0
        private void BuildAutocomplete()
        {
            menu = new AutocompleteMenu(codebox);

            menu.Items.SetAutocompleteItems(menuItemList);
            menu.SearchPattern = "[\\w\\.:=!<>]";
            menu.AllowTabKey   = true;
            foreach (var item in declarationSnippets)
            {
                menuItemList.Add(new DeclarationSnippet(item));
            }
            foreach (var item in snippets)
            {
                menuItemList.Add(new SnippetAutocompleteItem(item));
            }
            var xmldoc = new XmlDocument();

            xmldoc.Load(Application.StartupPath + @"\Configurations\Autocomplete.xml");
            foreach (XmlNode item in xmldoc.SelectNodes("*/autocomplete/item"))
            {
                menuItemList.Add(new AutocompleteItem(item.InnerText));
            }
        }
        public AutocompleteSample()
        {
            InitializeComponent();

            //create autocomplete popup menu
            popupMenu = new FastColoredTextBoxNS.AutocompleteMenu(fctb);
            popupMenu.MinFragmentLength = 2;

            //generate 456976 words
            var randomWords = new List<string>();
            int codeA = Convert.ToInt32('a');
            for (int i = 0; i < 26; i++)
            for (int j = 0; j < 26; j++)
            for (int k = 0; k < 26; k++)
            for (int l = 0; l < 26; l++)
                randomWords.Add(
                    new string(new char[]{Convert.ToChar(i + codeA), Convert.ToChar(j + codeA), Convert.ToChar(k + codeA), Convert.ToChar(l + codeA)}));

            //set words as autocomplete source
            popupMenu.Items.SetAutocompleteItems(randomWords);
            //size of popupmenu
            popupMenu.Items.MaximumSize = new System.Drawing.Size(200, 300);
            popupMenu.Items.Width = 200;
        }
Example #17
0
        public FileEditorTab(string content)
        {
            Text = "Untitled";

            UseVisualStyleBackColor = true;
            textBox = new FastColoredTextBox();
            textBox.AllowDrop = true;
            textBox.KeyDown += _KeyDown;
            textBox.TextChanged += _TextChanged;
            textBox.AutoIndentNeeded += _AutoIndentNeeded;
            textBox.Dock = DockStyle.Fill;
            textBox.Text = content;

            autocomplete = new AutocompleteMenu(textBox);
            autocomplete.MinFragmentLength = 1;
            autocomplete.Items.MaximumSize = new System.Drawing.Size(200, 300);
            autocomplete.Items.Width = 400;

            amandaTagParser = new AmandaTagParser();

            saveDialog.Filter = "Amanda File|*.ama";

            Controls.Add(textBox);
        }
Example #18
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        public MacroWindow()
        {
            InitializeComponent();

            //create autocomplete popup menu
            AutocompleteMenu popupMenu = new AutocompleteMenu(myScriptBox);
            popupMenu.MinFragmentLength = 1;
            //size of popupmenu
            popupMenu.Items.MaximumSize = new System.Drawing.Size(300, 400);
            popupMenu.Items.Width = 300;
            popupMenu.Items.SetAutocompleteItems(MainWindow.Instance.AutocompletionList);

            List<string> autocompletionList = MainWindow.Instance.AutocompletionList;
            keywordList = "";
            foreach(string item in autocompletionList)
            {
                string[] tokens = item.Split('(');
                keywordList += tokens[0] + "|";
            }
            keywordList = keywordList.Trim('|');
            keywordList = @"\b(" + keywordList + @")\b";

            preprocessorList = @"(%%|%slider|%color|%button)";
        }
Example #19
0
        public override FATabStripItem CreateTab()
        {
            this.editor = new FastColoredTextBox();

            this.tab = new FATabStripItem();
            this.tab.Title = this.File.Name;
            this.tab.Tag = this;

            //load the spellchecker extension for FastColoredTextBox
            SpellCheckFastColoredTextBox spellCheckerTextBox = new SpellCheckFastColoredTextBox();
            ControlExtensions.LoadSingleControlExtension(editor, spellCheckerTextBox);
            spellCheckerTextBox.SpellCheckMatch = @"^([\w']+)| ([\w']+)|>([\w']+)"; // Only process words starting a line, following a space or a tag

            this.editor.Parent = this.tab;
            this.editor.Dock = DockStyle.Fill;
            this.editor.Text = this.Read();
            this.editor.Focus();

            this.editor.TextChanged += this.Editor_TextChanged;
            this.editor.KeyDown += this.Editor_KeyDown;
            this.editor.MouseMove += this.Editor_MouseMove;
            this.editor.MouseUp += this.Editor_MouseUp;
            this.editor.MouseDown += this.Editor_MouseDown;

            autoMenu = new AutocompleteMenu(this.editor); //Autocompletion items will be set upon tab selection to be able to include all vocab files
            autoMenu.MinFragmentLength = 2;
            autoMenu.TopLevel = true;
            autoMenu.Items.MaximumSize = new System.Drawing.Size(200, 300);
            autoMenu.Items.Width = 200;

            return this.tab;
        }
Example #20
0
        private void InitializeData(Object threadContext)
        {
            Stopwatch watch = Stopwatch.StartNew();

            _parser = new Parser();
            _store = new EvalStore();
            StringBuilder cmd = new StringBuilder();

            _attributes = new AttributeTable();
            _attributes.Load();
            statusStrip.Text = "Loading Attributes...";

            _facts = new FactTable();
            _facts.Load();
            statusStrip.Text = "Loading Facts...";

            _contexts = new ContextTable();
            _contexts.Load();
            statusStrip.Text = "Loading Contexts...";

            _resources = new ResourceTable();
            _resources.Load();
            statusStrip.Text = "Loading Resources...";

            watch.Stop();

            _popupMenu = new AutocompleteMenu(queryCode);
            _popupMenu.SearchPattern = @"[\w\.:=!<>]";
            _popupMenu.AllowTabKey = true;

            List<AutocompleteItem> items = new List<AutocompleteItem>();
            for (int i = 0; i < _facts.ColumnDefinitions.Count; i++) {
                items.Add(new AutocompleteItem(_facts.ColumnDefinitions[i].Name));
            }

            items.Add(new AutocompleteItem("select"));
            items.Add(new AutocompleteItem("where"));
            items.Add(new AutocompleteItem("order"));
            items.Add(new AutocompleteItem("group"));
            items.Add(new AutocompleteItem("by"));
            items.Add(new AutocompleteItem("limit"));
            items.Add(new AutocompleteItem("desc"));
            items.Add(new AutocompleteItem("asc"));
            items.Add(new AutocompleteItem("between"));

            for (int i=0; i<_resources.Cols; i++) {
                items.Add(new AutocompleteItem(_resources.ColumnDefinitions[i].Name));
            }

            items.Add(new AutocompleteItem("Context"));
            items.Add(new AutocompleteItem("value"));
            items.Add(new AutocompleteItem("time"));

            foreach (string func in _parser.GetFunctionNames()) {
                SnippetAutocompleteItem n = new SnippetAutocompleteItem(func + "(^)");
                n.ToolTipText = n.Text;
                n.ToolTipTitle = "";
                items.Add(n);
            }

            _popupMenu.Items.SetAutocompleteItems(items);
            queryCode.Language = FastColoredTextBoxNS.Language.SQL;

            _store.Enter();
            _store.Put<Element>("pi", new Element(3.131492653586));
            _store.Put<Element>("e", new Element(2.71828183));
            _store.Put<Table>(_facts.Name, _facts);
            _store.Put<Table>(_attributes.Name, _attributes);
            _store.Put<Table>(_contexts.Name, _contexts);
            _store.Put<Table>(_resources.Name, _resources);

            Trace.WriteLine("InitializeData              : " + watch.ElapsedMilliseconds + "ms");
            toolStrip1.Enabled = true;
            statusStrip.Text = "OK";
        }
 public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     base.OnSelected(popupMenu, e);
     if (Parent.Fragment.tb.AutoIndent)
         Parent.Fragment.tb.DoAutoIndent();
 }
Example #22
0
        /// <summary>
        /// Sets up the Scintilla editor
        /// </summary>
        private void SetupEditor()
        {
            // create the new popup menu
            popupMenu = new FastColoredTextBoxNS.AutocompleteMenu(editor);
            popupMenu.MinFragmentLength = 1;
            // TODO: stop the menu appearing if the caret is within ( brackets )
            //popupMenu.SearchPattern =
            popupMenu.AppearInterval = 150;
            popupMenu.ToolTipDuration = 1000 * 60 * 5; // 5 minutes
            popupMenu.Items.MaximumSize = new System.Drawing.Size(200, 300);
            popupMenu.Width = 300;
            popupMenu.Items.SetAutocompleteItems(GetActions());

            // set some default text
            editor.Text = "$.browser(\"firefox\")" + Environment.NewLine + "$.load(\"http://www.google.com\")";

            // set the font
            editor.Font = new Font(FontFamily.GenericMonospace, 10);
        }
 public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
 }
Example #24
0
        public void BuildAutocompleteMenu(AutocompleteMenu armaSense, bool forceUpdate = false)
        {
            // Break out if the number of items hasn't changed -> might cause problems if 1 item is removed, then 1 added
            var itemsCount = (snippets.Length + UserVariablesCurrentFile.Count + ArmaSenseKeywords.Count + 3);
            if(!forceUpdate)
                if (ArmaListItemsCount == itemsCount) return;

            // Don't load ArmaSense if the user has turned it off
            if (!Settings.Default.EnableArmaSense) return;

            if (armaSense == null)
            {
                armaSense = this.CreateArmaSense();
            }

            List<AutocompleteItem> items = new List<AutocompleteItem>();

            foreach (var item in snippets)
                items.Add(new SnippetAutocompleteItem(item));

            foreach (var item in UserVariablesCurrentFile)
                items.Add(new AutocompleteItem(item.VarName) { ImageIndex = 1, ToolTipTitle = item.TooltipTitle, ToolTipText = item.TooltipText });

            #region Foreach backup
            //foreach (var item in userVariables)
            //    items.Add(new AutocompleteItem(item) { ImageIndex = 1 });

            //foreach (var item in methods)
            //    items.Add(new MethodAutocompleteItem(item) { ImageIndex = 2 });
            #endregion

            items.AddRange(ArmaSenseKeywords);

            items.Add(new InsertSpaceSnippet());
            items.Add(new InsertSpaceSnippet(@"^(\w+)([=<>!:]+)(\w+)$"));
            items.Add(new InsertEnterSnippet());

            try
            {
                // Set as autocomplete source
                armaSense.Items.SetAutocompleteItems(items);
            }
            catch (Exception ex)
            {
                Logger.Log(ex.Message);
            }

            ArmaListItemsCount = items.Count;
        }
Example #25
0
        public static void InitScriptEditor()
        {
            _autoCompleteMenu = new AutocompleteMenu(ScriptEditor);
            //_autoCompleteMenu.Items.ImageList = imageList2;
            _autoCompleteMenu.SearchPattern   = @"[\w\.:=!<>]";
            _autoCompleteMenu.AllowTabKey     = true;
            _autoCompleteMenu.ToolTipDuration = 5000;
            _autoCompleteMenu.AppearInterval  = 100;

            #region Keywords

            string[] keywords =
            {
                "if",     "elseif", "else", "endif", "while", "endwhile", "for", "endfor", "break", "continue", "stop",
                "replay", "not",    "and",  "or"
            };

            #endregion

            #region Commands auto-complete

            string[] commands =
            {
                "cast",           "dress",         "undress",       "dressconfig",  "target",    "targettype", "targetrelloc", "dress",       "drop",
                "waitfortarget",  "wft",           "dclick",        "dclicktype",   "dclickvar", "usetype",    "useobject",    "droprelloc",
                "lift",           "lifttype",      "waitforgump",   "gumpresponse", "gumpclose", "menu",       "menuresponse", "waitformenu",
                "promptresponse", "waitforprompt", "hotkey",        "say",          "msg",       "overhead",   "sysmsg",       "wait",        "pause",
                "waitforstat",    "setability",    "setlasttarget", "lasttarget",   "setvar",    "skill",      "useskill",     "walk",
                "script",         "attack"
            };

            #endregion

            Dictionary <string, ToolTipDescriptions> descriptionCommands = new Dictionary <string, ToolTipDescriptions>();

            #region DropTips

            ToolTipDescriptions tooltip = new ToolTipDescriptions("drop", new[] { "drop (serial) (x y z/layername)" },
                                                                  "N/A", "Drop a specific item on the location or on you", "drop 0x42ABD 234 521 0\ndrop 0x42ABD Helm");
            descriptionCommands.Add("drop", tooltip);

            #endregion

            #region DressTips

            #endregion

            #region TargetTips

            tooltip = new ToolTipDescriptions("target", new[] { "target (serial) [x] [y] [z]" }, "N/A",
                                              "Target a specific item or mobile OR target a specific x, y, z location",
                                              "target 0x345A\ntarget 1563 2452 0");
            descriptionCommands.Add("target", tooltip);

            tooltip = new ToolTipDescriptions("targettype", new[] { "targettype (isMobile) (graphic)" }, "N/A",
                                              "Target a specific type of item/mobile", "targettype true 0x43");
            descriptionCommands.Add("targettype", tooltip);

            tooltip = new ToolTipDescriptions("targetrelloc", new[] { "targetrelloc (x-offset) (y-offset)" }, "N/A",
                                              "Target a relative location based on your location", "targetrelloc -4 6");
            descriptionCommands.Add("targetrelloc", tooltip);

            #endregion

            #region DClickTips

            #endregion

            #region MovingTips

            #endregion

            #region GumpTips

            #endregion

            #region MenuTips

            #endregion

            #region PromptTips

            #endregion

            #region HotKeyTips

            #endregion

            #region MessageTips

            #endregion

            #region WaitPauseTips

            #endregion

            #region DressTips

            #endregion

            #region MiscTips

            #endregion


            List <AutocompleteItem> items = new List <AutocompleteItem>();

            foreach (var item in keywords)
            {
                items.Add(new AutocompleteItem(item));
            }

            foreach (var item in commands)
            {
                descriptionCommands.TryGetValue(item, out ToolTipDescriptions element);

                if (element != null)
                {
                    items.Add(new MethodAutocompleteItemAdvance(item)
                    {
                        ImageIndex   = 2,
                        ToolTipTitle = element.Title,
                        ToolTipText  = element.ToolTipDescription()
                    });
                }
                else
                {
                    items.Add(new MethodAutocompleteItemAdvance(item)
                    {
                        ImageIndex = 2
                    });
                }
            }

            _autoCompleteMenu.Items.SetAutocompleteItems(items);
            _autoCompleteMenu.Items.MaximumSize =
                new Size(_autoCompleteMenu.Items.Width + 20, _autoCompleteMenu.Items.Height);
            _autoCompleteMenu.Items.Width = _autoCompleteMenu.Items.Width + 20;

            ScriptEditor.Language = FastColoredTextBoxNS.Language.Razor;
        }
 public override AutoCompletionMap CreateAutoCompletionMap(AutocompleteMenu menu)
 {
     return null;
 }
Example #27
0
        public AutocompleteMenu CreateArmaSense()
        {
            var editor = MainTabControl.SelectedTab.Controls[0] as FastColoredTextBox;

            // Clear out any old ArmaSense instances
            ArmaSense = null;
            ArmaSense = new AutocompleteMenu(editor)
            {
                SearchPattern = @"[\w\.:=!<>]",
                AllowTabKey = true,
                AppearInterval = 10,
                MinFragmentLength = 1,
                BackColor = Color.White,
                SelectedColor = Color.Khaki,
                MinimumSize = new Size(250, 50),
                ForeColor = Color.Black,
                Font = new Font("Consolas", 10),
                Items = { ImageList = ArmaSenseImageList }
            };

            // TODO - Optimise this -> currently we build a new list of autocomplete items every time we change tab
            //BuildAutocompleteMenu(ArmaSense);

            return ArmaSense;
        }
 public override AutoCompletionMap CreateAutoCompletionMap(AutocompleteMenu menu)
 {
     return new VisualBasicAutoCompletionMap(menu);
 }
Example #29
0
 /// <summary>
 /// This method is called after item inserted into text
 /// </summary>
 public virtual void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     ;
 }
 public WebAutoCompletionMap(AutocompleteMenu menu)
     : base(menu)
 {
 }
Example #31
0
        public static void InitScriptEditor()
        {
            _autoCompleteMenu = new AutocompleteMenu(ScriptEditor);
            //_autoCompleteMenu.Items.ImageList = imageList2;
            _autoCompleteMenu.SearchPattern   = @"[\w\.:=!<>]";
            _autoCompleteMenu.AllowTabKey     = true;
            _autoCompleteMenu.ToolTipDuration = 5000;
            _autoCompleteMenu.AppearInterval  = 100;

            #region Keywords

            string[] keywords =
            {
                "if",     "elseif", "else", "endif", "while", "endwhile", "for", "endfor", "break", "continue", "stop",
                "replay", "not",    "and",  "or"
            };

            #endregion

            #region Commands auto-complete

            string[] commands =
            {
                "attack",         "cast",       "dclick",      "dclicktype",  "dress",         "drop",          "droprelloc",  "gumpresponse",  "gumpclose",
                "hotkey",         "lasttarget", "lift",        "lifttype",    "menu",          "menuresponse",  "organizer",   "overhead",      "potion",
                "promptresponse", "restock",    "say",         "script",      "scavenger",     "sell",          "setability",  "setlasttarget",
                "setvar",         "skill",      "sysmsg",      "target",      "targettype",    "targetrelloc",  "undress",     "useonce",       "walk",
                "wait",           "pause",      "waitforgump", "waitformenu", "waitforprompt", "waitfortarget", "clearsysmsg", "clearjournal"
            };

            #endregion

            Dictionary <string, ToolTipDescriptions> descriptionCommands = new Dictionary <string, ToolTipDescriptions>();

            #region CommandToolTips

            var tooltip = new ToolTipDescriptions("attack", new[] { "attack (serial) or attack ('variablename')" },
                                                  "N/A", "Attack a specific serial or variable tied to a serial.", "attack 0x2AB4\n\tattack 'attackdummy'");
            descriptionCommands.Add("attack", tooltip);

            tooltip = new ToolTipDescriptions("cast", new[] { "cast ('name of spell')" }, "N/A", "Cast a spell by name",
                                              "cast 'blade spirits'");
            descriptionCommands.Add("cast", tooltip);

            tooltip = new ToolTipDescriptions("dclick", new[] { "dclick (serial) or useobject (serial)" }, "N/A",
                                              "This command will use (double-click) a specific item or mobile.", "dclick 0x34AB");
            descriptionCommands.Add("dclick", tooltip);

            tooltip = new ToolTipDescriptions("dclicktype",
                                              new[]
            {
                "dclicktype ('name of item') OR (graphicID) [inrange] or usetype ('name of item') OR (graphicID) [inrange]"
            }, "N/A",
                                              "This command will use (double-click) an item type either provided by the name or the graphic ID.\n\t\tIf you include the optional true parameter, items within range (2 tiles) will only be considered.",
                                              "dclicktype 'dagger'\n\t\twaitfortarget\n\t\ttargettype 'robe'");
            descriptionCommands.Add("dclicktype", tooltip);

            tooltip = new ToolTipDescriptions("dress", new[] { "dress ('name of dress list')" }, "N/A",
                                              "This command will execute a spec dress list you have defined in Razor.", "dress 'My Sunday Best'");
            descriptionCommands.Add("dress", tooltip);

            tooltip = new ToolTipDescriptions("drop", new[] { "drop (serial) (x/y/z/layername)" }, "N/A",
                                              "This command will drop the item you are holding either at your feet,\n\t\ton a specific layer or at a specific X / Y / Z location.",
                                              "lift 0x400D54A7 1\n\t\tdrop 0x6311 InnerTorso");
            descriptionCommands.Add("drop", tooltip);

            tooltip = new ToolTipDescriptions("", new[] { "" }, "N/A", "",
                                              "lift 0x400D54A7 1\n\twait 5000\n\tdrop 0xFFFFFFFF 5926 1148 0");
            descriptionCommands.Add("", tooltip);

            tooltip = new ToolTipDescriptions("droprelloc", new[] { "droprelloc (x) (y)" }, "N/A",
                                              "This command will drop the item you're holding to a location relative to your position.",
                                              "lift 0x400EED2A 1\n\twait 1000\n\tdroprelloc 1 1");
            descriptionCommands.Add("droprelloc", tooltip);

            tooltip = new ToolTipDescriptions("gumpresponse", new[] { "gumpresponse (buttonID)" }, "N/A",
                                              "Responds to a specific gump button", "gumpresponse 4");
            descriptionCommands.Add("gumpresponse", tooltip);

            tooltip = new ToolTipDescriptions("gumpclose", new[] { "gumpclose" }, "N/A",
                                              "This command will close the last gump that opened.", "gumpclose");
            descriptionCommands.Add("gumpclose", tooltip);

            tooltip = new ToolTipDescriptions("hotkey", new[] { "hotkey ('name of hotkey')" }, "N/A",
                                              "This command will execute any Razor hotkey by name.",
                                              "skill 'detect hidden'\n\twaitfortarget\n\thotkey 'target self'");
            descriptionCommands.Add("hotkey", tooltip);

            tooltip = new ToolTipDescriptions("lasttarget", new[] { "lasttarget" }, "N/A",
                                              "This command will target your last target set in Razor.",
                                              "cast 'magic arrow'\n\twaitfortarget\n\tlasttarget");
            descriptionCommands.Add("lasttarget", tooltip);

            tooltip = new ToolTipDescriptions("lift", new[] { "lift (serial) [amount]" }, "N/A",
                                              "This command will lift a specific item and amount. If no amount is provided, 1 is defaulted.",
                                              "lift 0x400EED2A 1\n\twait 1000\n\tdroprelloc 1 1 0");
            descriptionCommands.Add("lift", tooltip);

            tooltip = new ToolTipDescriptions("lifttype",
                                              new[] { "lifttype (gfx) [amount] or lifttype ('name of item') [amount]" }, "N/A",
                                              "This command will lift a specific item by type either by the graphic id or by the name.\n\tIf no amount is provided, 1 is defaulted.",
                                              "lifttype 'robe'\n\twait 1000\n\tdroprelloc 1 1 0\n\tlifttype 0x1FCD\n\twait 1000\n\tdroprelloc 1 1");
            descriptionCommands.Add("lifttype", tooltip);

            tooltip = new ToolTipDescriptions("menu", new[] { "menu (serial) (index)" }, "N/A",
                                              "Selects a specific index within a context menu", "menu 0x123ABC 4");
            descriptionCommands.Add("menu", tooltip);

            tooltip = new ToolTipDescriptions("menuresponse", new[] { "menuresponse (index) (menuId) [hue]" }, "N/A",
                                              "Responds to a specific menu and menu ID", "menuresponse 3 4");
            descriptionCommands.Add("menuresponse", tooltip);

            tooltip = new ToolTipDescriptions("organizer", new[] { "organizer (number) ['set']" }, "N/A",
                                              "This command will execute a specific organizer agent. If the set parameter is included,\n\tyou will instead be prompted to set the organizer agent's hotbag.",
                                              "organizer 1\n\torganizer 4 'set'");
            descriptionCommands.Add("organizer", tooltip);

            tooltip = new ToolTipDescriptions("overhead", new[] { "overhead ('text') [color] [serial]" }, "N/A",
                                              "This command will display a message over your head. Only you can see this.",
                                              "if stam = 100\n\t    overhead 'ready to go!'\n\tendif");
            descriptionCommands.Add("overhead", tooltip);

            tooltip = new ToolTipDescriptions("potion", new[] { "potion ('potion type')" }, "N/A",
                                              "This command will use a specific potion based on the type.", "potion 'agility'\n\tpotion 'heal'");
            descriptionCommands.Add("potion", tooltip);

            tooltip = new ToolTipDescriptions("promptresponse", new[] { "promptresponse ('prompt response')" }, "N/A",
                                              "This command will respond to a prompt triggered from actions such as renaming runes or giving a guild title.",
                                              "dclicktype 'rune'\n\twaitforprompt\n\tpromptresponse 'to home'");
            descriptionCommands.Add("promptresponse", tooltip);

            tooltip = new ToolTipDescriptions("restock", new[] { "restock (number) ['set']" }, "N/A",
                                              "This command will execute a specific restock agent.\n\tIf the set parameter is included, you will instead be prompted to set the restock agent's hotbag.",
                                              "restock 1\n\trestock 4 'set'");
            descriptionCommands.Add("restock", tooltip);

            tooltip = new ToolTipDescriptions("say",
                                              new[] { "say ('message to send') [hue] or msg ('message to send') [hue]" }, "N/A",
                                              "This command will force your character to say the message passed as the parameter.",
                                              "say 'Hello world!'\n\tsay 'Hello world!' 454");
            descriptionCommands.Add("say", tooltip);

            tooltip = new ToolTipDescriptions("script", new[] { "script 'name'" }, "N/A",
                                              "This command will call another script.", "if hp = 40\n\t   script 'healself'\n\tendif");
            descriptionCommands.Add("script", tooltip);

            tooltip = new ToolTipDescriptions("scavenger", new[] { "scavenger ['clear'/'add'/'on'/'off'/'set']" },
                                              "N/A", "This command will control the scavenger agent.", "scavenger 'off'");
            descriptionCommands.Add("scavenger", tooltip);

            tooltip = new ToolTipDescriptions("sell", new[] { "sell" }, "N/A",
                                              "This command will set the Sell agent's hotbag.", "sell");
            descriptionCommands.Add("sell", tooltip);

            tooltip = new ToolTipDescriptions("setability",
                                              new[] { "setability ('primary'/'secondary'/'stun'/'disarm') ['on'/'off']" }, "N/A",
                                              "This will set a specific ability on or off. If on or off is missing, on is defaulted.",
                                              "setability stun");
            descriptionCommands.Add("setability", tooltip);

            tooltip = new ToolTipDescriptions("setlasttarget", new[] { "setlasttarget" }, "N/A",
                                              "This command will pause the script until you select a target to be set as Last Target.",
                                              "overhead 'set last target'\n\tsetlasttarget\n\toverhead 'set!'\n\tcast 'magic arrow'\n\twaitfortarget\n\ttarget 'last'");
            descriptionCommands.Add("setlasttarget", tooltip);

            tooltip = new ToolTipDescriptions("setvar", new[] { "setvar ('variable') or setvariable ('variable')" },
                                              "N/A",
                                              "This command will pause the script until you select a target to be assigned a variable.\n\tPlease note, the variable must exist before you can assign values to it.",
                                              "setvar 'dummy'\n\tcast 'magic arrow'\n\twaitfortarget\n\ttarget 'dummy'");
            descriptionCommands.Add("setvar", tooltip);

            tooltip = new ToolTipDescriptions("skill", new[] { "skill 'name of skill' or skill last" }, "N/A",
                                              "This command will use a specific skill (assuming it's a usable skill).",
                                              "while mana < maxmana\n\t    say 'mediation!'\n\t    skill 'meditation'\n\t    wait 11000\n\tendwhile");
            descriptionCommands.Add("skill", tooltip);

            tooltip = new ToolTipDescriptions("sysmsg", new[] { "sysmsg ('message to display in system message')" },
                                              "N/A", "This command will display a message in the lower-left of the client.",
                                              "if stam = 100\n\t    sysmsg 'ready to go!'\n\tendif");
            descriptionCommands.Add("sysmsg", tooltip);

            tooltip = new ToolTipDescriptions("target", new[] { "target (serial) or target (x) (y) (z)" }, "N/A",
                                              "This command will target a specific mobile or item or target a specific location based on X/Y/Z coordinates.",
                                              "cast 'lightning'\n\twaitfortarget\n\ttarget 0xBB3\n\tcast 'fire field'\n\twaitfortarget\n\ttarget 5923 1145 0");
            descriptionCommands.Add("target", tooltip);

            tooltip = new ToolTipDescriptions("targettype",
                                              new[] { "targettype (graphic) or targettype ('name of item or mobile type') [inrangecheck]" }, "N/A",
                                              "This command will target a specific type of mobile or item based on the graphic id or based on\n\tthe name of the item or mobile. If the optional parameter is passed\n\tin as true only items within the range of 2 tiles will be considered.",
                                              "usetype 'dagger'\n\twaitfortarget\n\ttargettype 'robe'\n\tuseobject 0x4005ECAF\n\twaitfortarget\n\ttargettype 0x1f03\n\tuseobject 0x4005ECAF\n\twaitfortarget\n\ttargettype 0x1f03 true");
            descriptionCommands.Add("targettype", tooltip);

            tooltip = new ToolTipDescriptions("targetrelloc", new[] { "targetrelloc (x-offset) (y-offset)" }, "N/A",
                                              "This command will target a specific location on the map relative to your position.",
                                              "cast 'fire field'\n\twaitfortarget\n\ttargetrelloc 1 1");
            descriptionCommands.Add("targetrelloc", tooltip);

            tooltip = new ToolTipDescriptions("undress",
                                              new[] { "undress ['name of dress list']' or undress 'LayerName'" }, "N/A",
                                              "This command will either undress you completely if no dress list is provided.\n\tIf you provide a dress list, only those specific items will be undressed. Lastly, you can define a layer name to undress.",
                                              "undress\n\tundress 'My Sunday Best'\n\tundress 'Shirt'\n\tundrsss 'Pants'");
            descriptionCommands.Add("undress", tooltip);

            tooltip = new ToolTipDescriptions("useonce", new[] { "useonce ['add'/'addcontainer']" }, "N/A",
                                              "This command will execute the UseOnce agent. If the add parameter is included, you can add items to your UseOnce list.\n\tIf the addcontainer parameter is included, you can add all items in a container to your UseOnce list.",
                                              "useonce\n\tuseonce 'add'\n\tuseonce 'addcontainer'");
            descriptionCommands.Add("useonce", tooltip);

            tooltip = new ToolTipDescriptions("walk", new[] { "walk ('direction')" }, "N/A",
                                              "This command will turn and/or walk your player in a certain direction.",
                                              "walk 'North'\n\twalk 'Up'\n\twalk 'West'\n\twalk 'Left'\n\twalk 'South'\n\twalk 'Down'\n\twalk 'East'\n\twalk 'Right'");
            descriptionCommands.Add("walk", tooltip);

            tooltip = new ToolTipDescriptions("wait",
                                              new[] { "wait [time in milliseconds or pause [time in milliseconds]" }, "N/A",
                                              "This command will pause the execution of a script for a given time.",
                                              "while stam < 100\n\t    wait 5000\n\tendwhile");
            descriptionCommands.Add("wait", tooltip);

            tooltip = new ToolTipDescriptions("pause",
                                              new[] { "pause [time in milliseconds or pause [time in milliseconds]" }, "N/A",
                                              "This command will pause the execution of a script for a given time.",
                                              "while stam < 100\n\t    wait 5000\n\tendwhile");
            descriptionCommands.Add("pause", tooltip);

            tooltip = new ToolTipDescriptions("waitforgump", new[] { "waitforgump [gump id]" }, "N/A",
                                              "This command will wait for a gump. If no gump id is provided, it will wait for **any * *gump.",
                                              "waitforgump\n\twaitforgump 4");
            descriptionCommands.Add("waitforgump", tooltip);

            tooltip = new ToolTipDescriptions("waitformenu", new[] { "waitformenu [menu id]" }, "N/A",
                                              "This command will wait for a context menu. If no menu id is provided, it will wait for **any * *menu.",
                                              "waitformenu\n\twaitformenu 4");
            descriptionCommands.Add("waitformenu", tooltip);

            tooltip = new ToolTipDescriptions("waitforprompt", new[] { "waitforprompt" }, "N/A",
                                              "This command will wait for a prompt before continuing.",
                                              "dclicktype 'rune'\n\twaitforprompt\n\tpromptresponse 'to home'");
            descriptionCommands.Add("waitforprompt", tooltip);

            tooltip = new ToolTipDescriptions("waitfortarget",
                                              new[] { "waitfortarget [pause in milliseconds] or wft [pause in milliseconds]" }, "N/A",
                                              "This command will cause the script to pause until you have a target cursor.\n\tBy default it will wait 30 seconds but you can define a specific wait time if you prefer.",
                                              "cast 'energy bolt'\n\twaitfortarget\n\thotkey 'Target Closest Enemy'");
            descriptionCommands.Add("waitfortarget", tooltip);

            tooltip = new ToolTipDescriptions("clearsysmsg",
                                              new[] { "clearsysmsg" }, "N/A",
                                              "This command will clear the internal system message queue used with insysmsg.",
                                              "clearsysmsg\n");
            descriptionCommands.Add("clearsysmsg", tooltip);

            tooltip = new ToolTipDescriptions("clearjournal",
                                              new[] { "clearjournal" }, "N/A",
                                              "This command (same as clearjournal) will clear the internal system message queue used with insysmsg.",
                                              "clearjournal\n");
            descriptionCommands.Add("clearjournal", tooltip);

            #endregion

            List <AutocompleteItem> items = new List <AutocompleteItem>();

            foreach (var item in keywords)
            {
                items.Add(new AutocompleteItem(item));
            }

            foreach (var item in commands)
            {
                descriptionCommands.TryGetValue(item, out ToolTipDescriptions element);

                if (element != null)
                {
                    items.Add(new MethodAutocompleteItemAdvance(item)
                    {
                        ImageIndex   = 2,
                        ToolTipTitle = element.Title,
                        ToolTipText  = element.ToolTipDescription()
                    });
                }
                else
                {
                    items.Add(new MethodAutocompleteItemAdvance(item)
                    {
                        ImageIndex = 2
                    });
                }
            }

            _autoCompleteMenu.Items.SetAutocompleteItems(items);
            _autoCompleteMenu.Items.MaximumSize =
                new Size(_autoCompleteMenu.Items.Width + 20, _autoCompleteMenu.Items.Height);
            _autoCompleteMenu.Items.Width = _autoCompleteMenu.Items.Width + 20;

            ScriptEditor.Language = FastColoredTextBoxNS.Language.Razor;
        }
 public override AutoCompletionMap CreateAutoCompletionMap(AutocompleteMenu menu)
 {
     return new CssAutoCompletionMap(menu);
 }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }

                if (mAutocompleteMenu != null)
                {
                    mAutocompleteMenu.Dispose();
                    mAutocompleteMenu = null;
                }
            }
            base.Dispose(disposing);
        }
Example #34
0
 /// <summary>
 /// This method is called after item inserted into text
 /// </summary>
 public virtual void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
 }
Example #35
0
        void InitForm()
        {
            cardlist = new SortedDictionary<long, string>();
            tooltipDic = new SortedList<string, string>();
            InitializeComponent();
            //设置字体,大小
            string fontname = MyConfig.readString(MyConfig.TAG_FONT_NAME);
            float fontsize = MyConfig.readFloat(MyConfig.TAG_FONT_SIZE, fctb.Font.Size);
            fctb.Font = new Font(fontname, fontsize);
            if (MyConfig.readBoolean(MyConfig.TAG_IME))
                fctb.ImeMode = ImeMode.On;
            if (MyConfig.readBoolean(MyConfig.TAG_WORDWRAP))
                fctb.WordWrap = true;
            else
                fctb.WordWrap = false;
            if (MyConfig.readBoolean(MyConfig.TAG_TAB2SPACES))
                tabisspaces = true;
            else
                tabisspaces = false;

            Font ft = new Font(fctb.Font.Name, fctb.Font.Size / 1.2f, FontStyle.Regular);
            popupMenu = new FastColoredTextBoxNS.AutocompleteMenu(fctb);
            popupMenu.MinFragmentLength = 2;
            popupMenu.Items.Font = ft;
            popupMenu.Items.MaximumSize = new System.Drawing.Size(200, 400);
            popupMenu.Items.Width = 300;
            popupMenu.BackColor = fctb.BackColor;
            popupMenu.ForeColor = fctb.ForeColor;
            popupMenu.Closed += new ToolStripDropDownClosedEventHandler(popupMenu_Closed);

            popupMenu.SelectedColor = Color.LightGray;

            title = this.Text;
        }