예제 #1
0
        void DrawUpdateArea(int row, double ypos)
        {
            IEditorRender render = (IEditorRender)base.render;

            if (this.LayoutLines.GetDirtyFlag(row))
            {
                Point     pos  = new Point(this.PageBound.X + this.GetRealtiveX(AreaType.UpdateArea), ypos);
                Rectangle rect = new Rectangle(pos.X, pos.Y, UpdateAreaWidth, this.LayoutLines.GetLayout(row).Height);
                render.FillRectangle(rect, FillRectType.UpdateArea);
            }
        }
예제 #2
0
        public void DrawLineMarker(Point pos, ITextLayout layout)
        {
            if (this.HideLineMarker)
            {
                return;
            }
            IEditorRender render = (IEditorRender)base.render;
            Point         p      = this.CaretLocation;
            double        height = layout.Height;
            double        width  = this.render.TextArea.Width;

            render.FillRectangle(new Rectangle(this.PageBound.X + this.render.TextArea.X, pos.Y, width, height), FillRectType.LineMarker);
        }
예제 #3
0
        bool DrawCaret()
        {
            if (this.HideCaret || !this.IsFocused)
            {
                return(false);
            }

            long diff      = DateTime.Now.Ticks - this.tickCount;
            long blinkTime = this.To100nsTime(this.CaretBlinkTime);

            if (this.CaretBlink && diff % blinkTime >= blinkTime / 2)
            {
                return(false);
            }

            Rectangle CaretRect = new Rectangle();

            IEditorRender render = (IEditorRender)base.render;

            int         row        = this.Document.CaretPostion.row;
            ITextLayout layout     = this.LayoutLines.GetLayout(row);
            double      lineHeight = render.emSize.Height;
            double      charWidth  = layout.GetWidthFromIndex(this.Document.CaretPostion.col);

            if (this.InsertMode || charWidth == 0)
            {
                CaretRect.Size     = new Size(CaretWidthOnInsertMode, lineHeight);
                CaretRect.Location = new Point(this.CaretLocation.X, this.CaretLocation.Y);
                render.FillRectangle(CaretRect, FillRectType.InsertCaret);
            }
            else
            {
                double height = lineHeight / 3;
                CaretRect.Size     = new Size(charWidth, height);
                CaretRect.Location = new Point(this.CaretLocation.X, this.CaretLocation.Y + lineHeight - height);
                render.FillRectangle(CaretRect, FillRectType.OverwriteCaret);
            }
            return(true);
        }
예제 #4
0
        void DrawInsertPoint()
        {
            //一つしかない場合は行選択の可能性がある
            if (this.Selections.Count <= 1)
            {
                return;
            }
            IEditorRender render = (IEditorRender)base.render;

            foreach (Selection sel in this.Selections)
            {
                if (sel.length == 0)
                {
                    TextPoint tp         = this.GetLayoutLineFromIndex(sel.start);
                    Point     left       = this.GetPostionFromTextPoint(tp);
                    double    lineHeight = render.emSize.Height;
                    Rectangle InsertRect = new Rectangle(left.X,
                                                         left.Y,
                                                         CaretWidthOnInsertMode,
                                                         lineHeight);
                    render.FillRectangle(InsertRect, FillRectType.InsertPoint);
                }
            }
        }
예제 #5
0
        void DrawRuler()
        {
            IEditorRender render = (IEditorRender)base.render;

            Point     pos, from, to;
            Size      emSize       = render.emSize;
            Rectangle clipRect     = this.render.TextArea;
            int       count        = 0;
            double    markerHeight = emSize.Height / 2;

            if (this.Document.RightToLeft)
            {
                pos = new Point(clipRect.TopRight.X, clipRect.TopRight.Y - emSize.Height - LineMarkerThickness);
                for (; pos.X >= clipRect.TopLeft.X; pos.X -= emSize.Width, count++)
                {
                    from = pos;
                    to   = new Point(pos.X, pos.Y + emSize.Height);
                    int mod = count % 10;
                    if (mod == 0)
                    {
                        string countStr     = (count / 10).ToString();
                        double counterWidth = emSize.Width * countStr.Length;
                        this.render.DrawString(countStr, pos.X - counterWidth, pos.Y, StringAlignment.Right, new Size(counterWidth, double.MaxValue));
                    }
                    else if (mod == 5)
                    {
                        from.Y = from.Y + emSize.Height / 2;
                    }
                    else
                    {
                        from.Y = from.Y + emSize.Height * 3 / 4;
                    }
                    render.DrawLine(from, to);
                    if (this.CaretLocation.X >= pos.X && this.CaretLocation.X < pos.X + emSize.Width)
                    {
                        render.FillRectangle(new Rectangle(pos.X, pos.Y + markerHeight, emSize.Width, markerHeight), FillRectType.OverwriteCaret);
                    }
                }
            }
            else
            {
                pos = new Point(clipRect.TopLeft.X, clipRect.TopLeft.Y - emSize.Height - LineMarkerThickness);
                for (; pos.X < clipRect.TopRight.X; pos.X += emSize.Width, count++)
                {
                    from = pos;
                    to   = new Point(pos.X, pos.Y + emSize.Height);
                    int mod = count % 10;
                    if (mod == 0)
                    {
                        this.render.DrawString((count / 10).ToString(), pos.X, pos.Y, StringAlignment.Left, new Size(double.MaxValue, double.MaxValue));
                    }
                    else if (mod == 5)
                    {
                        from.Y = from.Y + emSize.Height / 2;
                    }
                    else
                    {
                        from.Y = from.Y + emSize.Height * 3 / 4;
                    }
                    render.DrawLine(from, to);
                    if (this.CaretLocation.X >= pos.X && this.CaretLocation.X < pos.X + emSize.Width)
                    {
                        render.FillRectangle(new Rectangle(pos.X, pos.Y + markerHeight, emSize.Width, markerHeight), FillRectType.OverwriteCaret);
                    }
                }
            }
            from    = clipRect.TopLeft;
            from.Y -= LineMarkerThickness;
            to      = clipRect.TopRight;
            to.Y   -= LineMarkerThickness;
            render.DrawLine(from, to);
        }