public override Point GetVirPos(IGraphics g, LineColumnPosition lcPos) { if (lcPos.LineIndex < 0 || _View.LineCount <= lcPos.LineIndex) { throw new ArgumentOutOfRangeException("lcPos", "Specified line index is out of" + "range. (value:" + lcPos.LineIndex + ", line count:" + GetLineCount() + ")"); } if (lcPos.ColumnIndex < 0) { throw new ArgumentOutOfRangeException("lcPos", "Specified column index is out of" + " range. (value:" + lcPos.ColumnIndex + ")"); } Point pos = new Point(); // set value for when the columnIndex is 0 pos.X = 0; pos.Y = (lcPos.LineIndex * _View.LineSpacing) + (_View.LinePadding >> 1); // if the location is not the head of the line, calculate x-coord. if (0 < lcPos.ColumnIndex) { int begin = GetCharIndex(new LineColumnPosition(lcPos.LineIndex, 0)); int end = GetCharIndex(lcPos); pos.X = _View.MeasureTokenEndX(g, new TextSegment(begin, end), pos.X); } return(pos); }
public override int GetCharIndex(LineColumnPosition lcPos) { if (lcPos.LineIndex < 0 || _View.LineCount < lcPos.LineIndex) { throw new ArgumentOutOfRangeException("lineIndex", "Invalid index was given" + " (lineIndex:" + lcPos.LineIndex + "," + " LineCount:" + _View.LineCount + ")."); } if (lcPos.ColumnIndex < 0) { throw new ArgumentOutOfRangeException("columnIndex", "Invalid index was given" + " (columnIndex:" + lcPos.ColumnIndex + ")."); } return(TextUtil.GetCharIndexFromLineColumnIndex(_View.Document.InternalBuffer, _View.PLHI, lcPos.LineIndex, lcPos.ColumnIndex)); }
public override Point GetVirPos(IGraphics g, LineColumnPosition lcPos) { if (lcPos.LineIndex < 0) { throw new ArgumentOutOfRangeException("lcPos", "Specified line index is out of" + "range. (value:" + lcPos.LineIndex + ", line count:" + GetLineCount() + ")"); } if (lcPos.ColumnIndex < 0) { throw new ArgumentOutOfRangeException("lcPos", "Specified column index is out of" + " range. (value:" + lcPos.ColumnIndex + ")"); } Point pos = new Point(); // set value for when the columnIndex is 0 pos.X = 0; pos.Y = (lcPos.LineIndex * _View.LineSpacing) + (_View.LinePadding >> 1); // if the location is not the head of the line, calculate x-coord. if (0 < lcPos.ColumnIndex) { // get partial content of the line which exists before the caret var lineBegin = TextUtil.GetLineRange(_View.Document.InternalBuffer, _View.PLHI, lcPos.LineIndex, true).Begin; // measure the characters pos.X = _View.MeasureTokenEndX(g, new TextSegment(lineBegin, lineBegin + lcPos.ColumnIndex), pos.X); } return(pos); }
public abstract int GetCharIndex(LineColumnPosition lcPos);
public abstract Point GetVirPos(IGraphics g, LineColumnPosition lcPos);
public override int GetCharIndex(LineColumnPosition lcPos) { return(_View.Document.GetCharIndexFromLineColumnIndex(lcPos.LineIndex, lcPos.ColumnIndex)); }
protected override void When() { _result = _offsetToLineColumnConverter.GetLineColumn(TestFilename, 12); }