示例#1
0
        private void Editor_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (AutoComplete)
                {
                    switch (e.KeyChar)
                    {
                    case '.':
                        EditionTextBox.SelectedText = e.KeyChar.ToString(CultureInfo.InvariantCulture);
                        e.Handled = true;
                        DisplayComboBox();
                        break;

                    case '{':
                        Structure structure = GetInstance(EditionTextBox.SelectionStart - 1) as Structure;
                        if (structure != null)
                        {
                            TextualExplanation text = new TextualExplanation();
                            text.WriteLine("{");
                            CreateDefaultStructureValue(text, structure, false);
                            EditionTextBox.SelectedText = text.Text;
                            EditionTextBox.ProcessAllLines(true);
                            e.Handled = true;
                        }
                        break;

                    case '(':
                        ICallable callable = GetInstance(EditionTextBox.SelectionStart - 1) as ICallable;
                        if (callable != null)
                        {
                            TextualExplanation text = new TextualExplanation();
                            CreateCallableParameters(text, callable);
                            EditionTextBox.SelectedText = text.Text;
                            EditionTextBox.ProcessAllLines(true);
                            e.Handled = true;
                        }
                        break;

                    case '>':
                    case '-':
                        char prev = EditionTextBox.Text[EditionTextBox.SelectionStart - 1];
                        if ((prev == '<' && e.KeyChar == '-') || (prev == '=' && e.KeyChar == '>'))
                        {
                            ITypedElement typedElement =
                                GetInstance(EditionTextBox.SelectionStart - 2) as ITypedElement;
                            if (typedElement != null)
                            {
                                EditionTextBox.SelectedText = e.KeyChar + " " + typedElement.Type.FullName;
                                e.Handled = true;
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
示例#2
0
 public void Redo()
 {
     EditionTextBox.Redo();
     EditionTextBox.ProcessAllLines();
 }
示例#3
0
 public void Paste()
 {
     EditionTextBox.Paste();
     EditionTextBox.ProcessAllLines();
 }
示例#4
0
 public void Undo()
 {
     EditionTextBox.Undo();
     EditionTextBox.ProcessAllLines();
 }
示例#5
0
 public void Cut()
 {
     EditionTextBox.Cut();
     EditionTextBox.ProcessAllLines();
 }