Exemplo n.º 1
0
        public EditorControl(EditorSettings settings)
        {
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint
                     | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw
                     | ControlStyles.Selectable, true);
            Cursor    = Cursors.IBeam;
            TabStop   = true;
            AllowDrop = true;

            EditorSettings  = settings;
            TopMargins      = new MarginList(this);
            LeftMargins     = new MarginList(this);
            RightMargins    = new MarginList(this);
            BottomMargins   = new MarginList(this);
            Info            = new EditorInfo(this);
            CaretRenderer   = new CaretRenderer(this);
            Renderer        = new Renderer(this);
            Scroll          = new ScrollingManager(this);
            Locations       = new LocationManager(this);//+
            Folding         = new FoldingManager(this);
            CallTips        = new CallTipManager(this);
            MatchBrackets   = new MatchBracketManager(this);
            MatchWords      = new MatchWordManager(this);
            Autocomplete    = new AutocompleteManager(this);
            AffinityManager = new AffinityManager(this);
            Search          = new SearchManager(this);
            Styles          = new StyleManager(this);
            timer.Tick     += Tick;
        }
Exemplo n.º 2
0
 public MathBox()
 {
     InitializeComponent();
     this.TextChanged      += this.TextChangedHandler;
     this.KeyUp            += new KeyEventHandler(KeyUpHandler);
     SyntaxHighlighter.mBox = this;
     currentPosition        = Document.ContentStart;
     HighlightsBrackets     = false;
     AutocompleteManager.connectToAutocomplete(this);
     EditingCommands.ToggleUnderline.InputGestures.Clear();
 }
Exemplo n.º 3
0
        private void PreviewKeyDownHandler(object sender, KeyEventArgs e)
        {
            AutocompleteManager.handleKeyDown(e);
            if (e.Handled || Keyboard.IsKeyDown(Key.RightAlt))
            {
                return;
            }

            Char c = KeyDecoder.GetCharFromKey(e.Key);

            if (e.Key == Key.Enter)
            {
                if (!Selection.IsEmpty)
                {
                    Selection.Text = "";
                }

                TextPointer inserted = Selection.Start.InsertLineBreak();
                Selection.Select(inserted, inserted);

                e.Handled = true;
            }
            else if ((c == '?' || c == '#') && Selection.IsEmpty)
            {
                Selection.Text = c.ToString();
                LMD_Document lmdDoc = new LMD_Document(getDocument(Document));
                String       result = lmdDoc.getCommandResult();
                Selection.Text = (result == "") ? c.ToString() : result;
                Selection.Select(Selection.End, Selection.End);
                e.Handled = true;
            }
            else if (e.Key == Key.Space)
            {
                BeginChange();
                CaretPosition = CaretPosition.GetPositionAtOffset(0, LogicalDirection.Backward);
                CaretPosition.InsertTextInRun(c.ToString());
                CaretPosition = CaretPosition.GetNextInsertionPosition(LogicalDirection.Forward);
                e.Handled     = true;
                EndChange();
            }
        }