Exemplo n.º 1
0
        public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
        {
            TextLayout layout = (TextLayout)lti.GetLayout(row);

            if (lti.GetLengthFromLineNumber(row) == 0)
            {
                return;
            }

            if (this.Printing == false)
            {
                int lineIndex    = lti.GetIndexFromLineNumber(row);
                int lineLength   = lti.GetLengthFromLineNumber(row);
                var SelectRanges = from s in doc.Selections.Get(lineIndex, lineLength)
                                   let n = Util.ConvertAbsIndexToRelIndex(s, lineIndex, lineLength)
                                           select n;

                foreach (Selection sel in SelectRanges)
                {
                    if (sel.length == 0 || sel.start == -1)
                    {
                        continue;
                    }

                    foreach (TextBounds bound in layout.GetTextBounds(sel.start, sel.length))
                    {
                        Rect rect = new Rect(x, y, bound.Rectangle.Width, bound.Rectangle.Height);
                        this.Context.DrawRectangle(this.Brushes[this.Hilight], null, rect);
                    }
                }
            }

            layout.Draw(this.Context, x, y);
        }
 public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
 {
     this.DrawOneLine(doc,
                      lti,
                      row,
                      x,
                      y,
                      null);
 }
Exemplo n.º 3
0
 public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
 {
     base.DrawOneLine(doc,
                      lti,
                      row,
                      x,
                      y,
                      this.DrawImeConversionLine
                      );
 }
Exemplo n.º 4
0
        private void DrawImeConversionLine(MyTextLayout layout, LineToIndexTable lti, int row, double x, double y)
        {
            if (InputMethod.Current.ImeState != InputMethodState.On)
            {
                return;
            }

            using (Unlocker locker = this.store.LockDocument(false))
            {
                int lineIndex  = lti.GetIndexFromLineNumber(row);
                int lineLength = lti.GetLengthFromLineNumber(row);
                foreach (TextDisplayAttribute attr in this.store.EnumAttributes(lineIndex, lineIndex + lineLength))
                {
                    if (attr.startIndex == attr.endIndex)
                    {
                        continue;
                    }
                    int length = attr.endIndex - attr.startIndex;
                    int start  = attr.startIndex - lineIndex;

                    HilightType type  = HilightType.None;
                    Color4?     color = null;
                    switch (attr.attribute.lsStyle)
                    {
                    case TF_DA_LINESTYLE.TF_LS_DOT:
                        type  = HilightType.Dot;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;

                    case TF_DA_LINESTYLE.TF_LS_SOLID:
                        type  = HilightType.Sold;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;

                    case TF_DA_LINESTYLE.TF_LS_DASH:
                        type  = HilightType.Dash;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;

                    case TF_DA_LINESTYLE.TF_LS_SQUIGGLE:
                        type  = HilightType.Squiggle;
                        color = this.GetColor4(attr.attribute.crLine);
                        break;
                    }

                    if (attr.attribute.crBk.type != TF_DA_COLORTYPE.TF_CT_NONE)
                    {
                        type  = HilightType.Select;
                        color = this.GetColor4(attr.attribute.crBk);
                    }

                    this.DrawMarkerEffect(layout, type, start, length, x, y, attr.attribute.fBoldLine, color);

                    color = this.GetColor4(attr.attribute.crText);
                    if (color != null)
                    {
                        this.SetTextColor(layout, start, length, color);
                        layout.Invaild = true;
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
        {
            PrintableTextLayout layout = (PrintableTextLayout)lti.GetLayout(row);

            layout.Draw(g, x, y, this.Foreground);
        }
Exemplo n.º 6
0
 public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
 {
     throw new NotImplementedException();
 }