public override void Select() { HexPosition start, end; if (HexView.Selection.IsEmpty) { start = HexView.Caret.Position.Position.ActivePosition.BufferPosition.Position; end = start; } else { var info2 = SelectionToUserValue(HexView.Selection.AnchorPoint, HexView.Selection.ActivePoint); start = info2.Anchor; end = info2.Active; } var minPos = HexView.BufferLines.ToLogicalPosition(HexView.BufferLines.StartPosition); var maxPos = HexView.BufferLines.ToLogicalPosition(HexView.BufferLines.EndPosition > HexView.BufferLines.StartPosition ? HexView.BufferLines.EndPosition - 1 : HexView.BufferLines.EndPosition); var logStart = HexView.BufferLines.ToLogicalPosition(start); var logEnd = HexView.BufferLines.ToLogicalPosition(end); var data = new SelectVM(logStart, logEnd, minPos, maxPos); var win = new SelectDlg(); win.DataContext = data; win.Owner = OwnerWindow; if (win.ShowDialog() != true) { return; } var newStart = HexView.BufferLines.ToPhysicalPosition(data.StartVM.Value); var newEnd = HexView.BufferLines.ToPhysicalPosition(data.EndVM.Value); var info = UserValueToSelection(newStart, newEnd); if (MoveTo(new HexBufferPoint(HexView.Buffer, info.Anchor), new HexBufferPoint(HexView.Buffer, info.Active), new HexBufferPoint(HexView.Buffer, info.Caret))) { HexView.Selection.Select(new HexBufferPoint(HexView.Buffer, info.Anchor), new HexBufferPoint(HexView.Buffer, info.Active), alignPoints: false); } }
public override void Select() { HexPosition start, end; if (HexView.Selection.IsEmpty) { start = HexView.Caret.Position.Position.ActivePosition.BufferPosition.Position; end = start; } else { var info2 = SelectionToUserValue(HexView.Selection.AnchorPoint, HexView.Selection.ActivePoint); start = info2.Anchor; end = info2.Active; } var logStart = HexView.BufferLines.ToLogicalPosition(start); var logEnd = HexView.BufferLines.ToLogicalPosition(end); var data = new SelectVM(logStart, logEnd); data.PositionKind = PositionKind.Absolute; data.PositionLengthKind = SelectPositionLengthKind.Position; var win = new SelectDlg(); win.DataContext = data; win.Owner = OwnerWindow; if (win.ShowDialog() != true) { return; } var newStart = ToBufferPosition(logStart, data.StartVM.Value.ToUInt64(), data.PositionKind); var newEnd = GetEndPosition(logStart, newStart, data.EndVM.Value, data.PositionKind, data.PositionLengthKind); var info = UserValueToSelection(newStart, newEnd); MoveTo(new HexBufferPoint(HexView.Buffer, info.Anchor), new HexBufferPoint(HexView.Buffer, info.Active), new HexBufferPoint(HexView.Buffer, info.Caret), select: true); }
public override void Select() { HexPosition start, end; if (HexView.Selection.IsEmpty) { start = HexView.Caret.Position.Position.ActivePosition.BufferPosition.Position; end = start; } else { var info2 = SelectionToUserValue(HexView.Selection.AnchorPoint, HexView.Selection.ActivePoint); start = info2.Anchor; end = info2.Active; } var minPos = HexView.BufferLines.ToLogicalPosition(HexView.BufferLines.StartPosition); var maxPos = HexView.BufferLines.ToLogicalPosition(HexView.BufferLines.EndPosition > HexView.BufferLines.StartPosition ? HexView.BufferLines.EndPosition - 1 : HexView.BufferLines.EndPosition); var logStart = HexView.BufferLines.ToLogicalPosition(start); var logEnd = HexView.BufferLines.ToLogicalPosition(end); var data = new SelectVM(logStart, logEnd, minPos, maxPos); var win = new SelectDlg(); win.DataContext = data; win.Owner = OwnerWindow; if (win.ShowDialog() != true) return; var newStart = HexView.BufferLines.ToPhysicalPosition(data.StartVM.Value); var newEnd = HexView.BufferLines.ToPhysicalPosition(data.EndVM.Value); var info = UserValueToSelection(newStart, newEnd); if (MoveTo(new HexBufferPoint(HexView.Buffer, info.Anchor), new HexBufferPoint(HexView.Buffer, info.Active), new HexBufferPoint(HexView.Buffer, info.Caret))) HexView.Selection.Select(new HexBufferPoint(HexView.Buffer, info.Anchor), new HexBufferPoint(HexView.Buffer, info.Active), alignPoints: false); }