public bool ShowLineBreak
{
- get
- {
- throw new NotImplementedException();
- }
-
- set
- {
- throw new NotImplementedException();
- }
+ get;
+ set;
}
public event ChangedRenderResourceEventHandler ChangedRenderResource;
this.Context.DrawRectangle(this.Brushes[this.Background], null, rect);
}
- public void DrawOneLine(LineToIndexTable lti, int row, double x, double y, IEnumerable<Selection> SelectRanges)
+ public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y)
{
TextLayout layout = (TextLayout)lti.GetLayout(row);
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)
foreach (TextBounds bound in layout.GetTextBounds(sel.start, sel.length))
{
- Rect rect = new Rect(x,y,bound.Rectangle.Width,bound.Rectangle.Height);
+ 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 List<LineToIndexTableData> BreakLine(Document doc, LineToIndexTable layoutLineCollection, int startIndex, int endIndex, double wrapwidth)
+ public void BeginClipRect(Rectangle rect)
{
- List<LineToIndexTableData> output = new List<LineToIndexTableData>();
-
- foreach (string str in doc.GetLines(startIndex, endIndex))
- {
- TextLayout layout = new TextLayout(str, this.FontFamily, this.FontSize, this.Brushes[this.Foreground], wrapwidth);
-
- int i = startIndex;
- foreach (TextLine line in layout.Lines)
- {
- if (line.Length == 0 && line.NewlineLength == 0)
- continue;
-
- int length = line.Length;
-
- IList<TextSpan<TextRun>> runs = line.GetTextRunSpans();
- if (runs.Last().Value is TextEndOfParagraph)
- length--;
-
- bool lineend = false;
- if (line.NewlineLength > 0)
- lineend = true;
-
- output.Add(layoutLineCollection.CreateLineToIndexTableData(i, length, lineend, null));
- i += line.Length;
- }
-
- layout.Dispose();
-
- startIndex += str.Length;
- }
-
- if (output.Count > 0)
- output.Last().LineEnd = true;
+ this.Context.PushClip(new RectangleGeometry(rect));
+ }
- return output;
+ public void EndClipRect()
+ {
+ this.Context.Pop();
}
- public ITextLayout CreateLaytout(string str, SyntaxInfo[] syntaxCollection, IEnumerable<Marker> MarkerRanges)
+ public ITextLayout CreateLaytout(string str, SyntaxInfo[] syntaxCollection, IEnumerable<Marker> MarkerRanges, IEnumerable<Selection> SelectRanges, double wrapwidth)
{
- TextLayout layout = new TextLayout(str,this.FontFamily,this.FontSize,Brushes[this.Foreground],this.TextArea.Width);
- layout.TextWarpping = TextWrapping.NoWrap;
+ TextLayout layout;
+ if(wrapwidth == LineToIndexTable.NONE_BREAK_LINE)
+ {
+ layout = new TextLayout(str, this.FontFamily, this.FontSize, Brushes[this.Foreground], this.TextArea.Width);
+ layout.TextWarpping = TextWrapping.NoWrap;
+ }
+ else
+ {
+ layout = new TextLayout(str, this.FontFamily, this.FontSize, Brushes[this.Foreground], wrapwidth);
+ layout.TextWarpping = TextWrapping.Wrap;
+ }
layout.FlowDirection = this.RightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
if (syntaxCollection != null)