示例#1
0
		public TerminalView (CGRect rect) : base (rect)
		{
			fontNormal = NSFont.FromFontName ("Lucida Sans Typewriter", 14);
			fontBold = NSFont.FromFontName ("Lucida Sans Typewriter Bold", 14);
			fontItalic = NSFont.FromFontName ("Lucida Sans Typewriter Oblique", 14);
			fontBoldItalic = NSFont.FromFontName ("Lucida Sans Typewriter Bold Oblique", 14);
			ComputeCellDimensions ();

			var cols = (int)(rect.Width / cellWidth);
			var rows = (int)(rect.Height / cellHeight);

			terminal = new Terminal (this, new TerminalOptions () { Cols = cols, Rows = rows });
			FullBufferUpdate ();
			
			caret = new NSView (new CGRect (0, cellDelta, cellHeight, cellWidth)) {
				WantsLayer = true
			};
			AddSubview (caret);
			debug = new NSView (new CGRect (0, 0, 10, 10)) {
				WantsLayer = true
			};
			//AddSubview (debug);

			var caretColor = NSColor.FromColor (NSColor.Blue.ColorSpace, 0.4f, 0.2f, 0.9f, 0.5f);

			caret.Layer.BackgroundColor = caretColor.CGColor;

			debug.Layer.BackgroundColor = caretColor.CGColor;
		}
示例#2
0
        public SelectionView(Terminal terminal, SelectionService selection, CGRect rect, CellDimension cellDimensions) : base(rect)
        {
            if (terminal == null)
            {
                throw new ArgumentNullException(nameof(terminal));
            }
            if (selection == null)
            {
                throw new ArgumentNullException(nameof(selection));
            }
            if (rect == null)
            {
                throw new ArgumentNullException(nameof(rect));
            }

            this.terminal       = terminal;
            this.selection      = selection;
            this.cellDimensions = cellDimensions;

            selection.SelectionChanged += HandleSelectionChanged;

            WantsLayer = true;
            maskLayer  = new CAShapeLayer();
            Layer.Mask = maskLayer;

            SelectionColor = NSColor.FromColor(NSColor.Blue.ColorSpace, 0.4f, 0.2f, 0.9f, 0.8f);
        }
示例#3
0
        public CaretView(CellDimension dimensions) : base(new CGRect(0, 0, dimensions.Height, dimensions.Width + 2))
        {
            this.dimensions = dimensions;
            pos             = new Point(0, 0);
            padding         = 1;
            WantsLayer      = true;
            CaretColor      = NSColor.FromColor(NSColor.Blue.ColorSpace, 0.4f, 0.2f, 0.9f, 0.5f);

            maskLayer  = new CAShapeLayer();
            Layer.Mask = maskLayer;
            Focused    = false;
        }
示例#4
0
        public TerminalView(CGRect rect) : base(rect)
        {
            fontNormal     = NSFont.FromFontName("xLucida Sans Typewriter", 14) ?? NSFont.FromFontName("Courier", 14);
            fontBold       = NSFont.FromFontName("xLucida Sans Typewriter Bold", 14) ?? NSFont.FromFontName("Courier Bold", 14);
            fontItalic     = NSFont.FromFontName("xLucida Sans Typewriter Oblique", 14) ?? NSFont.FromFontName("Courier Oblique", 14);
            fontBoldItalic = NSFont.FromFontName("xLucida Sans Typewriter Bold Oblique", 14) ?? NSFont.FromFontName("Courier Bold Oblique", 14);
            var textBounds = ComputeCellDimensions();

            var cols = (int)(rect.Width / cellWidth);
            var rows = (int)(rect.Height / cellHeight);

            terminal = new Terminal(this, new TerminalOptions()
            {
                Cols = cols, Rows = rows
            });
            selection = new SelectionService(terminal);
            selection.SelectionChanged += HandleSelectionChanged;
            FullBufferUpdate();

            var selectColor = NSColor.FromColor(NSColor.Blue.ColorSpace, 0.4f, 0.2f, 0.9f, 0.8f);

            selectionView = new SelectionView(terminal, selection, new CGRect(0, cellDelta, cellHeight, cellWidth), textBounds)
            {
                SelectionColor = selectColor,
            };

            caret = new NSView(new CGRect(0, cellDelta, cellHeight, cellWidth))
            {
                WantsLayer = true
            };
            AddSubview(caret);
            debug = new NSView(new CGRect(0, 0, 10, 10))
            {
                WantsLayer = true
            };
            //AddSubview (debug);

            var caretColor = NSColor.FromColor(NSColor.Blue.ColorSpace, 0.4f, 0.2f, 0.9f, 0.5f);

            caret.Layer.BackgroundColor = caretColor.CGColor;

            debug.Layer.BackgroundColor = caretColor.CGColor;

            terminal.Scrolled          += Terminal_Scrolled;
            terminal.Buffers.Activated += Buffers_Activated;

            autoScrollTimer.Elapsed += AutoScrollTimer_Elapsed;
        }