public bool ExpandTo(GLine line, int position, RangeType type) { line.ExpandBuffer(position + 1); //_disabledTemporary = false; _state = SelectionState.Expansion; _forwardDestination.Line = line.ID; _backwardDestination.Line = line.ID; //Debug.WriteLine(String.Format("ExpandTo Line{0} Position{1}", line.ID, position)); switch (type) { case RangeType.Char: _forwardDestination.Column = position; _backwardDestination.Column = position; break; case RangeType.Word: { int start; int end; line.FindWordBreakPoint(position, out start, out end); _forwardDestination.Column = start; _backwardDestination.Column = end; } break; case RangeType.Line: _forwardDestination.Column = 0; _backwardDestination.Column = line.DisplayLength; break; } return(true); }
public bool StartSelection(GLine line, int position, RangeType type, int x, int y) { Debug.Assert(position >= 0); //日本語文字の右側からの選択は左側に修正 line.ExpandBuffer(position + 1); if (line.IsRightSideOfZenkaku(position)) { position--; } //_disabledTemporary = false; _pivotType = type; _forwardPivot.Line = line.ID; _backwardPivot.Line = line.ID; _forwardDestination.Line = line.ID; _forwardDestination.Column = position; _backwardDestination.Line = line.ID; _backwardDestination.Column = position; switch (type) { case RangeType.Char: _forwardPivot.Column = position; _backwardPivot.Column = position; break; case RangeType.Word: { int start; int end; line.FindWordBreakPoint(position, out start, out end); _forwardPivot.Column = start; _backwardPivot.Column = end; } break; case RangeType.Line: _forwardPivot.Column = 0; _backwardPivot.Column = line.DisplayLength; break; } _state = SelectionState.Pivot; _startX = x; _startY = y; FireSelectionStarted(); return(true); }