예제 #1
0
        public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
            : base()
        {
            this.motherTextAreaControl      = motherTextAreaControl;
            this.motherTextEditorControl    = motherTextEditorControl;

            caret            = new Caret(this);
            selectionManager = new SelectionManager(Document);

            this.textAreaClipboardHandler = new TextAreaClipboardHandler(this);

            #if GTK
            // FIXME: GTKize?
            this.DoubleBuffered = false;
            #else
            ResizeRedraw = true;

            SetStyle(ControlStyles.DoubleBuffer, false);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.Opaque, false);
            #endif

            textView = new TextView(this);

            gutterMargin = new GutterMargin(this);
            foldMargin   = new FoldMargin(this);
            iconBarMargin = new IconBarMargin(this);
            leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin });
            OptionsChanged();

            new TextAreaMouseHandler(this).Attach();
            new TextAreaDragDropHandler().Attach(this);

            bracketshemes.Add(new BracketHighlightingSheme('{', '}'));
            bracketshemes.Add(new BracketHighlightingSheme('(', ')'));
            bracketshemes.Add(new BracketHighlightingSheme('[', ']'));

            CanFocus = true;

            caret.PositionChanged += new EventHandler(SearchMatchingBracket);
            Document.TextContentChanged += new EventHandler(TextContentChanged);

            #if GTK
            KeyPressEvent += new GtkSharp.KeyPressEventHandler (OnKeyPress);

            AddEvents ((int) (Gdk.EventMask.ExposureMask |
                      Gdk.EventMask.LeaveNotifyMask |
                      Gdk.EventMask.ButtonPressMask |
                      Gdk.EventMask.ButtonReleaseMask |
                      Gdk.EventMask.PointerMotionMask |
                      Gdk.EventMask.KeyPressMask |
                      Gdk.EventMask.ScrollMask |
                      Gdk.EventMask.KeyReleaseMask));

            ExposeEvent += new GtkSharp.ExposeEventHandler (ExposeHandler);
            #endif
        }
        public TextEditorControl()
        {
            Document = (new DocumentFactory()).CreateDocument();
            Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();

            primaryTextArea  = new TextAreaControl(this);
            #if GTK
            // FIXME: GTKize
            //pane.Add1(primaryTextArea);
            PackEnd(primaryTextArea, true, true, 0);
            #else
            primaryTextArea  = new TextAreaControl(this);
            primaryTextArea.Dock = DockStyle.Fill;
            Controls.Add(primaryTextArea);
            ResizeRedraw = true;
            #endif
            InitializeTextAreaControl(primaryTextArea);
            Document.UpdateCommited += new EventHandler(CommitUpdateRequested);
            OptionsChanged();
        }
 protected override void InitializeTextAreaControl(TextAreaControl newControl)
 {
     base.InitializeTextAreaControl(newControl);
     MenuService menuService = (MenuService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(MenuService));
     newControl.ContextMenu = menuService.CreateContextMenu(this, contextMenuPath);
     newControl.TextArea.KeyEventHandler += new MonoDevelop.TextEditor.KeyEventHandler(HandleKeyPress);
     newControl.SelectionManager.SelectionChanged += new EventHandler(SelectionChanged);
     newControl.Caret.PositionChanged += new EventHandler(CaretPositionChanged);
 }
        // FIXME: GTKize
        public void Split()
        {
            if (secondaryTextArea == null) {
                secondaryTextArea = new TextAreaControl(this);
                secondaryTextArea.Dock = DockStyle.Bottom;
                secondaryTextArea.Height = Height / 2;
                textAreaSplitter =  new Splitter();
                textAreaSplitter.BorderStyle = BorderStyle.FixedSingle ;
                textAreaSplitter.Height = 8;
                textAreaSplitter.Dock = DockStyle.Bottom;
                Controls.Add(textAreaSplitter);
                Controls.Add(secondaryTextArea);
                InitializeTextAreaControl(secondaryTextArea);
                secondaryTextArea.OptionsChanged();
            } else {
                Controls.Remove(secondaryTextArea);
                Controls.Remove(textAreaSplitter);

                secondaryTextArea.Dispose();
                textAreaSplitter.Dispose();
                secondaryTextArea = null;
                textAreaSplitter  = null;
            }
        }
 protected virtual void InitializeTextAreaControl(TextAreaControl newControl)
 {
 }