public void BindToTextLayer(EditableTextFlowLayer textLayer) { this.textLayer = textLayer; //check is on the sameline, //or multiple lines // if (IsOnTheSameLine) { EditableTextLine line = textLayer.GetTextLine(selectionRangeSnapshot.startLineNum); //at this line //find start and end point int startColNum = selectionRangeSnapshot.startColumnNum; int endColNum = selectionRangeSnapshot.endColumnNum; int lineHeight = line.ActualLineHeight; _startLocation = new MarkerLocation() { lineNum = line.LineNumber, x_offset = line.GetXOffsetAtCharIndex(startColNum), line = line }; _stopLocation = new MarkerLocation() { lineNum = line.LineNumber, x_offset = line.GetXOffsetAtCharIndex(endColNum), line = line }; } else { EditableTextLine startLine = textLayer.GetTextLine(selectionRangeSnapshot.startLineNum); _startLocation = new MarkerLocation() { lineNum = startLine.LineNumber, x_offset = startLine.GetXOffsetAtCharIndex(selectionRangeSnapshot.startColumnNum), line = startLine }; // EditableTextLine endLine = textLayer.GetTextLine(selectionRangeSnapshot.endLineNum); _stopLocation = new MarkerLocation() { lineNum = endLine.LineNumber, x_offset = endLine.GetXOffsetAtCharIndex(selectionRangeSnapshot.endColumnNum), line = endLine }; // } }
public void MoveToLine(int lineNumber) { currentLine = visualFlowLayer.GetTextLine(lineNumber); currentLineY = currentLine.Top; currentTextRun = (EditableRun)currentLine.FirstRun; rCharOffset = 0; rPixelOffset = 0; charIndex = -1; caretXPos = 0; }
public void MoveToLine(int lineNumber) { currentLine = visualFlowLayer.GetTextLine(lineNumber); currentLineY = currentLine.Top; //if current line is a blank line //not first run => currentTextRun= null currentTextRun = (EditableRun)currentLine.FirstRun; rCharOffset = 0; rPixelOffset = 0; caret_char_index = 0; caretXPos = 0; }
public TextLineReader(EditableTextFlowLayer flowlayer) { #if DEBUG this.dbug_MyId = dbugTotalId; dbugTotalId++; #endif this.visualFlowLayer = flowlayer; flowlayer.Reflow += new EventHandler(flowlayer_Reflow); currentLine = flowlayer.GetTextLine(0); if (currentLine.FirstRun != null) { currentTextRun = currentLine.FirstRun; } }