public VisualPointInfo GetTextPointInfoFromCaretPoint(int caretX) { int accTextRunWidth = 0; int accTextRunCharCount = 0; EditableRun lastestTextRun = null; foreach (EditableRun t in this._runs) { lastestTextRun = t; int thisTextRunWidth = t.Width; if (accTextRunWidth + thisTextRunWidth > caretX) { EditableRunCharLocation localPointInfo = t.GetCharacterFromPixelOffset(caretX - thisTextRunWidth); EditableVisualPointInfo pointInfo = new EditableVisualPointInfo(this, accTextRunCharCount + localPointInfo.RunCharIndex); pointInfo.SetAdditionVisualInfo(t, accTextRunCharCount, caretX, accTextRunWidth); return(pointInfo); } else { accTextRunWidth += thisTextRunWidth; accTextRunCharCount += t.CharacterCount; } } if (lastestTextRun != null) { return(null); } else { EditableVisualPointInfo pInfo = new EditableVisualPointInfo(this, -1); pInfo.SetAdditionVisualInfo(null, accTextRunCharCount, caretX, accTextRunWidth); return(pInfo); } }
EditableVisualPointInfo CreateTextPointInfo(int lineId, int lineCharIndex, int caretPixelX, EditableRun onTextRun, int textRunCharOffset, int textRunPixelOffset) { EditableVisualPointInfo textPointInfo = new EditableVisualPointInfo(this, lineCharIndex); textPointInfo.SetAdditionVisualInfo(onTextRun, textRunCharOffset, caretPixelX, textRunPixelOffset); return(textPointInfo); }
public EditableVisualPointInfo GetTextPointInfoFromCharIndex(int charIndex) { int limit = CharCount - 1; if (charIndex > limit) { charIndex = limit; } EditableVisualPointInfo textPointInfo = new EditableVisualPointInfo(this, charIndex); int rCharOffset = 0; int rPixelOffset = 0; EditableRun lastestRun = null; foreach (EditableRun r in this) { lastestRun = r; int thisCharCount = lastestRun.CharacterCount; if (thisCharCount + rCharOffset > charIndex) { int localCharOffset = charIndex - rCharOffset; int pixelOffset = lastestRun.GetRunWidth(localCharOffset); textPointInfo.SetAdditionVisualInfo(lastestRun, localCharOffset, rPixelOffset + pixelOffset , rPixelOffset); return(textPointInfo); } else { rCharOffset += thisCharCount; rPixelOffset += r.Width; } } textPointInfo.SetAdditionVisualInfo(lastestRun, rCharOffset - lastestRun.CharacterCount, rPixelOffset, rPixelOffset - lastestRun.Width); return(textPointInfo); }
public EditableVisualPointInfo GetCurrentPointInfo() { #if DEBUG if (currentTextRun != null && !currentTextRun.HasParent) { throw new NotSupportedException(); } if (currentTextRun == null) { } #endif EditableVisualPointInfo textPointInfo = new EditableVisualPointInfo(currentLine, caret_char_index); textPointInfo.SetAdditionVisualInfo(currentTextRun, rCharOffset, caretXPos, rPixelOffset); return(textPointInfo); }
public EditableVisualPointInfo GetCurrentPointInfo() { #if DEBUG if (currentTextRun != null && !currentTextRun.HasParent) { throw new NotSupportedException(); } if (currentTextRun == null) { } #endif EditableVisualPointInfo textPointInfo = new EditableVisualPointInfo(currentLine, charIndex); textPointInfo.SetAdditionVisualInfo(currentTextRun, rCharOffset, caretXPos, rPixelOffset); return textPointInfo; }
public EditableVisualPointInfo GetTextPointInfoFromCharIndex(int charIndex) { int limit = CharCount - 1; if (charIndex > limit) { charIndex = limit; } EditableVisualPointInfo textPointInfo = new EditableVisualPointInfo(this, charIndex); int rCharOffset = 0; int rPixelOffset = 0; EditableRun lastestRun = null; foreach (EditableRun r in this) { lastestRun = r; int thisCharCount = lastestRun.CharacterCount; if (thisCharCount + rCharOffset > charIndex) { int localCharOffset = charIndex - rCharOffset; int pixelOffset = lastestRun.GetRunWidth(localCharOffset); textPointInfo.SetAdditionVisualInfo(lastestRun, localCharOffset, rPixelOffset + pixelOffset , rPixelOffset); return textPointInfo; } else { rCharOffset += thisCharCount; rPixelOffset += r.Width; } } textPointInfo.SetAdditionVisualInfo(lastestRun, rCharOffset - lastestRun.CharacterCount, rPixelOffset, rPixelOffset - lastestRun.Width); return textPointInfo; }
public VisualPointInfo GetTextPointInfoFromCaretPoint(int caretX) { int accTextRunWidth = 0; int accTextRunCharCount = 0; EditableRun lastestTextRun = null; foreach (EditableRun t in this) { lastestTextRun = t; int thisTextRunWidth = t.Width; if (accTextRunWidth + thisTextRunWidth > caretX) { EditableRunCharLocation localPointInfo = t.GetCharacterFromPixelOffset(caretX - thisTextRunWidth); EditableVisualPointInfo pointInfo = new EditableVisualPointInfo(this, accTextRunCharCount + localPointInfo.charIndex); pointInfo.SetAdditionVisualInfo(t, accTextRunCharCount, caretX, accTextRunWidth); return pointInfo; } else { accTextRunWidth += thisTextRunWidth; accTextRunCharCount += t.CharacterCount; } } if (lastestTextRun != null) { return null; } else { EditableVisualPointInfo pInfo = new EditableVisualPointInfo(this, -1); pInfo.SetAdditionVisualInfo(null, accTextRunCharCount, caretX, accTextRunWidth); return pInfo; } }
EditableVisualPointInfo CreateTextPointInfo(int lineId, int lineCharIndex, int caretPixelX, EditableRun onTextRun, int textRunCharOffset, int textRunPixelOffset) { EditableVisualPointInfo textPointInfo = new EditableVisualPointInfo(this, lineCharIndex); textPointInfo.SetAdditionVisualInfo(onTextRun, textRunCharOffset, caretPixelX, textRunPixelOffset); return textPointInfo; }