Inheritance: System.EventArgs
示例#1
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();
 }
示例#2
0
 /// <summary>
 /// This method is called after item inserted into text
 /// </summary>
 public virtual void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
 }
示例#3
0
 public void OnSelected(SelectedEventArgs args)
 {
     if (Selected != null)
         Selected(this, args);
 }
示例#4
0
        internal virtual void OnSelecting()
        {
            if (selectedItemIndex < 0 || selectedItemIndex >= visibleItems.Count)
                return;
            tb.manager.BeginAutoUndoCommands();
            try
            {
                AutocompleteItem item = visibleItems[selectedItemIndex];
                SelectingEventArgs args = new SelectingEventArgs()
                {
                    Item = item,
                    SelectedIndex = selectedItemIndex
                };

                Menu.OnSelecting(args);

                if (args.Cancel)
                {
                    selectedItemIndex = args.SelectedIndex;
                    Invalidate();
                    return;
                }

                if (!args.Handled)
                {
                    var fragment = Menu.Fragment;
                    DoAutocomplete(item, fragment);
                }

                Menu.Close();
                //
                SelectedEventArgs args2 = new SelectedEventArgs()
                {
                    Item = item,
                    Tb = Menu.Fragment.tb
                };
                item.OnSelected(Menu, args2);
                Menu.OnSelected(args2);
            }
            finally
            {
                tb.manager.EndAutoUndoCommands();
            }
        }
 public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     base.OnSelected(popupMenu, e);
     if (Parent.Fragment.tb.AutoIndent)
         Parent.Fragment.tb.DoAutoIndent();
 }
 public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
 }
示例#7
0
 public void OnSelected(SelectedEventArgs args)
 {
     if (lastwords[0] != args.Item.MenuText) {
         Array.Copy(lastwords, 0, lastwords, 1, lastwords.Length - 1); // By WendyH
         lastwords[0] = args.Item.MenuText;
     }
     if (Selected != null)
         Selected(this, args);
 }
        public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
        {
            e.Tb.BeginUpdate();
            e.Tb.Selection.BeginUpdate();

            var fragmentStart = popupMenu.Fragment.Start;
            var selectionStart = e.Tb.Selection.Start;

            if (e.Tb.AutoIndent)
            {
                for (int iLine = fragmentStart.iLine + 1; iLine <= selectionStart.iLine; iLine++)
                {
                    e.Tb.Selection.Start = new Place(0, iLine);
                    e.Tb.DoAutoIndent(iLine);
                }
            }

            if (Text.Contains('^'))
            {
                e.Tb.Selection.Start = fragmentStart;

                while (e.Tb.Selection.CharBeforeStart != '^')
                {
                    if (!e.Tb.Selection.GoRightThroughFolded())
                        break;
                }

                e.Tb.Selection.GoLeft(true);
                e.Tb.InsertText("");
            }

            e.Tb.Selection.EndUpdate();
            e.Tb.EndUpdate();
        }
        public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
        {
            e.Tb.BeginUpdate();
            e.Tb.Selection.BeginUpdate();

            base.OnSelected(popupMenu, e);

            if (AppendParantheses)
            {
                var fragmentStart = e.Tb.Selection.Start;
                e.Tb.InsertText(Parantheses);

                if (Parantheses.Contains('^'))
                {
                    e.Tb.Selection.Start = fragmentStart;

                    while (e.Tb.Selection.CharBeforeStart != '^')
                    {
                        if (!e.Tb.Selection.GoRightThroughFolded())
                            break;
                    }

                    e.Tb.Selection.GoLeft(true);
                    e.Tb.InsertText("");
                }
            }

            e.Tb.Selection.EndUpdate();
            e.Tb.EndUpdate();

        }
示例#10
0
        public void OnSelected(SelectedEventArgs args)
        {
            if (args.Item.MenuText != null) {
                string word = args.Item.ToString();
                LastWords[word] = System.Diagnostics.Stopwatch.GetTimestamp();
                /*
                if (LastWords.ContainsKey(word))
                    LastWords[word]++;
                else
                    LastWords[word] = 1;
                */
            }

            Selected?.Invoke(this, args);
        }
        internal virtual void OnSelecting()
        {
            if (FocussedItemIndex < 0 || FocussedItemIndex >= VisibleItems.Count)
                return;
            _tb.TextSource.Manager.BeginAutoUndoCommands();
            try
            {
                var item = FocussedItem;
                var args = new SelectingEventArgs
                {
                    Item = item,
                    SelectedIndex = FocussedItemIndex
                };

                Menu.OnSelecting(args);

                if (args.Cancel)
                {
                    FocussedItemIndex = args.SelectedIndex;
                    Invalidate();
                    return;
                }

                if (!args.Handled)
                {
                    var fragment = Menu.Fragment;
                    DoAutocomplete(item, fragment);
                }

                Menu.Close();
                //
                var args2 = new SelectedEventArgs
                {
                    Item = item,
                    Tb = Menu.Fragment.Tb
                };
                item.OnSelected(Menu, args2);
                Menu.OnSelected(args2);
            }
            finally
            {
                _tb.TextSource.Manager.EndAutoUndoCommands();
            }
        }
示例#12
0
        void CodeBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            Range range, full;
            if (CurrentTab.IsNowOpened)
            {
                full = range = e.ChangedRange;
            }
            else
            {
                range = (sender as FastColoredTextBox).VisibleRange;
                full = (sender as FastColoredTextBox).Range;
            }

            range.ClearStyle(TextStyles.Values.ToArray());
            range.ClearFoldingMarkers();
            ApplyHighlight(range);

            if (CurrentTab.IsNowOpened == false)
            {
                if (CurrentTab.Changed == false)
                {
                    CurrentTab.Changed = true;
                    CurrentTab.Text = CurrentTab.Text + " *";
                }
            }
            else
                CurrentTab.IsNowOpened = false;

            SelectedEventArgs sel = new SelectedEventArgs();
            CurrentTab.AutoComp.OnSelected(sel);

            if (sel.Item != null)
                StatusBarLabel.Text = sel.Item.Text;
        }
示例#13
0
 /// <summary>
 /// This method is called after item inserted into text
 /// </summary>
 public virtual void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     ;
 }