public InsightWindow(TextEditorControl control, string fileName)
            : base(type)
        {
            this.control             = control;
            this.fileName = fileName;
            System.Drawing.Point caretPos  = control.ActiveTextAreaControl.TextArea.Caret.Position;
            System.Drawing.Point visualPos = new System.Drawing.Point(control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X) + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.X,
                      (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y);

            focusEventHandler = new EventHandler(TextEditorLostFocus);

            control.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretOffsetChanged);
            //			control.TextAreaPainter.IHaveTheFocusChanged += focusEventHandler;

            //			control.TextAreaPainter.KeyPress += keyPressEventHandler;

            #if GTK
            this.SkipPagerHint = true;
            this.SkipTaskbarHint = true;
            this.Decorated = false;
            this.BorderWidth = 2;
            this.TypeHint = Gdk.WindowTypeHint.Dialog;
            #else
             		Location = control.ActiveTextAreaControl.PointToScreen(visualPos);

            StartPosition   = FormStartPosition.Manual;
            FormBorderStyle = FormBorderStyle.None;
            TopMost         = true;
            ShowInTaskbar   = false;
            Size            = new Size(0, 0);

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            #endif
        }
        /// <remarks>
        /// Creates a new Completion window at a given location
        /// </remarks>
        CompletionWindow(TextEditorControl control, Point location, ICompletionDataProvider completionDataProvider)
            : base(type)
        {
            this.completionDataProvider = completionDataProvider;
            this.control                = control;

            InitializeControls();
        }
Exemplo n.º 3
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
        }
        /// <remarks>
        /// Creates a new Completion window and puts it location under the caret
        /// </remarks>
        public CompletionWindow(TextEditorControl control, string fileName, ICompletionDataProvider completionDataProvider)
            : base(type)
        {
            this.fileName = fileName;
            this.completionDataProvider = completionDataProvider;
            this.control                = control;

            InitializeControls();
        }
Exemplo n.º 5
0
        public MonoPad()
        {
            Application.Init ();

            Window win = new Gtk.Window ("MonoPad");
            window = win;
            win.DeleteEvent += new DeleteEventHandler (Main_Closed);
            textEditor = new TextEditorControl ();
            textEditor.ShowEOLMarkers = false;
            textEditor.ShowLineNumbers = true;
            textEditor.ShowInvalidLines = true;
            textEditor.ShowTabs = false;
            textEditor.ShowVRuler = false;

            win.RequestSize = new Size (400, 400);
            VBox box = new VBox (false, 2);
            box.PackStart(BuildMenuBar(), false, false, 0);
            //box.PackStart(BuildToolBar(), false, false, 0);
            box.PackStart(textEditor, true, true, 0);

            win.Add(box);
            win.ShowAll ();
            Application.Run ();
        }
        public TextAreaControl(TextEditorControl motherTextEditorControl)
            : base(2, 2, false)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea                = new TextArea(motherTextEditorControl, this);
            #if GTK
            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);

            textArea.HasFocus = true;
            //Gtk.Table table = new Gtk.Table(2, 2, false);
            Gtk.Table table = this;
            //table.Homogeneous = false;
            table.Attach(textArea, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
            table.Attach(vScrollBar, 1, 2, 0, 1, Gtk.AttachOptions.Shrink, Gtk.AttachOptions.Fill, 0, 0);
            table.Attach(hScrollBar, 0, 1, 1, 2, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
            table.Attach(new Gtk.Label(""), 1, 2, 1, 2, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
            table.ShowAll();
            //Add(table);

            ScrollEvent += new GtkSharp.ScrollEventHandler(OnScroll);
            ButtonPressEvent += new GtkSharp.ButtonPressEventHandler(OnButtonPress);
            #else
                        Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
                        Controls.Add(this.hScrollBar);
                        ResizeRedraw = true;
            #endif

            Document.DocumentChanged += new DocumentEventHandler(AdjustScrollBars);
        }
 public void InsertAction(TextEditorControl control)
 {
     ((SharpDevelopTextAreaControl)control).ActiveTextAreaControl.TextArea.InsertString(completionString);
 }
 public void InsertAction(TextEditorControl control)
 {
     ((SharpDevelopTextAreaControl)control).InsertTemplate(template);
 }