mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 23:40:40 +02:00
SynEdit: Refactored Block-Selection / Fix Drag-Drop Edit
git-svn-id: trunk@20962 -
This commit is contained in:
parent
5dcb73cd82
commit
fccbd52e32
@ -2566,6 +2566,7 @@ begin
|
|||||||
or (Abs(fMouseDownY - Y) >= GetSystemMetrics(SM_CYDRAG))
|
or (Abs(fMouseDownY - Y) >= GetSystemMetrics(SM_CYDRAG))
|
||||||
then begin
|
then begin
|
||||||
Exclude(fStateFlags, sfWaitForDragging);
|
Exclude(fStateFlags, sfWaitForDragging);
|
||||||
|
Exclude(fStateFlags, sfMouseSelecting);
|
||||||
Include(fStateFlags, sfIsDragging);
|
Include(fStateFlags, sfIsDragging);
|
||||||
//debugln('TCustomSynEdit.MouseMove BeginDrag');
|
//debugln('TCustomSynEdit.MouseMove BeginDrag');
|
||||||
BeginDrag(true);
|
BeginDrag(true);
|
||||||
@ -2577,12 +2578,19 @@ begin
|
|||||||
//DebugLn(' TCustomSynEdit.MouseMove CAPTURE Mouse=',dbgs(X),',',dbgs(Y),' Caret=',dbgs(CaretXY),', BlockBegin=',dbgs(BlockBegin),' BlockEnd=',dbgs(BlockEnd));
|
//DebugLn(' TCustomSynEdit.MouseMove CAPTURE Mouse=',dbgs(X),',',dbgs(Y),' Caret=',dbgs(CaretXY),', BlockBegin=',dbgs(BlockBegin),' BlockEnd=',dbgs(BlockEnd));
|
||||||
FInternalCaret.AssignFrom(FCaret);
|
FInternalCaret.AssignFrom(FCaret);
|
||||||
FInternalCaret.LineCharPos := PixelsToRowColumn(Point(X,Y));
|
FInternalCaret.LineCharPos := PixelsToRowColumn(Point(X,Y));
|
||||||
if (not(sfIsDragging in fStateFlags)) then
|
|
||||||
SetBlockEnd(FInternalCaret.LineBytePos);
|
if (X >= fGutterWidth) and (X < ClientWidth-ScrollBarWidth) and
|
||||||
if (X >= fGutterWidth) and (X < ClientWidth-ScrollBarWidth)
|
(Y >= 0) and (Y < ClientHeight-ScrollBarWidth)
|
||||||
and (Y >= 0) and (Y < ClientHeight-ScrollBarWidth)
|
then begin
|
||||||
then
|
if sfIsDragging in fStateFlags then
|
||||||
|
FBlockSelection.IncPersistentLock;
|
||||||
|
FBlockSelection.AutoExtend := sfMouseSelecting in fStateFlags;
|
||||||
FCaret.LineBytePos := FInternalCaret.LineBytePos;
|
FCaret.LineBytePos := FInternalCaret.LineBytePos;
|
||||||
|
FBlockSelection.AutoExtend := False;
|
||||||
|
if sfIsDragging in fStateFlags then
|
||||||
|
FBlockSelection.DecPersistentLock;
|
||||||
|
end;
|
||||||
|
|
||||||
// should we begin scrolling?
|
// should we begin scrolling?
|
||||||
Dec(X, fGutterWidth);
|
Dec(X, fGutterWidth);
|
||||||
// calculate chars past right
|
// calculate chars past right
|
||||||
@ -4946,10 +4954,12 @@ begin
|
|||||||
DragCursor := crMultiDrag
|
DragCursor := crMultiDrag
|
||||||
else
|
else
|
||||||
DragCursor := crDrag;
|
DragCursor := crDrag;
|
||||||
|
FBlockSelection.IncPersistentLock;
|
||||||
if State = dsDragLeave then //restore prev caret position
|
if State = dsDragLeave then //restore prev caret position
|
||||||
ComputeCaret(FMouseDownX, FMouseDownY)
|
ComputeCaret(FMouseDownX, FMouseDownY)
|
||||||
else //position caret under the mouse cursor
|
else //position caret under the mouse cursor
|
||||||
ComputeCaret(X, Y);
|
ComputeCaret(X, Y);
|
||||||
|
FBlockSelection.DecPersistentLock;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user