Ejemplo n.º 1
0
        public EditorContext() {
            Postbox = Postbox.InstanceFor(EditorCode);
            Configuration.ConfigManager.AddEditorConfig(EditorCode, new Configuration.Config {
                Language = SupportedLanguages.JS,
                FormattingType = FormattingType.BRACKETS
            });

            TextsToEnter = new List<string>();
            CaretView = new CaretView();
            TextView = new TextView(CaretView);
            SelectionView = new SelectionView(TextView);
            LinesView = new LinesView();
            FoldingView = new FoldingView();
            EnterTextCommand = new EnterTextCommand(TextView, CaretView, SelectionView);
            RemoveTextCommand = new RemoveTextCommand(TextView, CaretView, SelectionView);
            CaretMoveCommand = new CaretMoveCommand(CaretView, TextView);
            SelectionCommand = new TextSelectionCommand(TextView, SelectionView, CaretView);
            
            CaretView.EditorCode = EditorCode;
            CaretView.Postbox = Postbox;
            TextView.EditorCode = EditorCode;
            TextView.Postbox = Postbox;
            SelectionView.EditorCode = EditorCode;
            SelectionView.Postbox = Postbox;
            LinesView.EditorCode = EditorCode;
            LinesView.Postbox = Postbox;
            FoldingView.EditorCode = EditorCode;
            FoldingView.Postbox = Postbox;

            InitEvents();
            ForceDraw();
        }
 public TextDeselectionCommand(SelectionView selectionView) {
     this.selectionView = selectionView;
 }
Ejemplo n.º 3
0
        private void SetupViews() {
            var editorCode = this.GetEditor().GetHashCode();

            caretView = new CaretView();
            textView = new TextView(caretView);
            selectionView = new SelectionView(textView);

            foreach (var view in new LocalViewBase[] { selectionView, textView, caretView }) {
                view.Margin = new Thickness(2, 0, 0, 0);
                view.HorizontalAlignment = HorizontalAlignment.Left;
                view.VerticalAlignment = VerticalAlignment.Top;
                
                views.Add(view);
                Children.Add(view);

                view.EditorCode = editorCode;
                view.Postbox = postbox;
            }
        }
 public TextSelectionCommand(ITextViewReadonly textViewReader, SelectionView selectionView, CaretView caretView) {
     this.textViewReader = textViewReader;
     this.selectionView = selectionView;
     this.caretView = caretView;
     algorithm = new TextSelectionAlgorithm(caretView, textViewReader, selectionView);
 }
 public TextSelectionAlgorithm(ICaretViewReadonly caretViewReader, ITextViewReadonly textViewReader, SelectionView parent) {
     this.caretViewReader = caretViewReader;
     this.textViewReader = textViewReader;
     this.parent = parent;
 }