mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 11:10:23 +02:00
MG: added Triple and Quad mouse clicks to lcl and synedit
git-svn-id: trunk@1569 -
This commit is contained in:
parent
248d37e16d
commit
f4a4458bbb
@ -160,7 +160,11 @@ type
|
|||||||
|
|
||||||
TSynStateFlag = (sfCaretChanged, sfScrollbarChanged, sfLinesChanging,
|
TSynStateFlag = (sfCaretChanged, sfScrollbarChanged, sfLinesChanging,
|
||||||
sfIgnoreNextChar, sfCaretVisible, sfDblClicked, sfPossibleGutterClick,
|
sfIgnoreNextChar, sfCaretVisible, sfDblClicked, sfPossibleGutterClick,
|
||||||
sfWaitForDragging, sfInsideRedo); //mh 2000-10-30
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
sfTripleClicked, sfQuadClicked,
|
||||||
|
{$ENDIF}
|
||||||
|
sfWaitForDragging, sfInsideRedo
|
||||||
|
); //mh 2000-10-30
|
||||||
TSynStateFlags = set of TSynStateFlag;
|
TSynStateFlags = set of TSynStateFlag;
|
||||||
|
|
||||||
TSynEditorOption = (eoAltSetsColumnMode, eoAutoIndent,
|
TSynEditorOption = (eoAltSetsColumnMode, eoAutoIndent,
|
||||||
@ -440,6 +444,7 @@ type
|
|||||||
procedure SetWordBlock(Value: TPoint);
|
procedure SetWordBlock(Value: TPoint);
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
procedure SetLineBlock(Value: TPoint);
|
procedure SetLineBlock(Value: TPoint);
|
||||||
|
procedure SetParagraphBlock(Value: TPoint);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
procedure SizeOrFontChanged(bFont: boolean);
|
procedure SizeOrFontChanged(bFont: boolean);
|
||||||
procedure StatusChanged(AChanges: TSynStatusChanges);
|
procedure StatusChanged(AChanges: TSynStatusChanges);
|
||||||
@ -452,6 +457,10 @@ type
|
|||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
procedure CreateWnd; override;
|
procedure CreateWnd; override;
|
||||||
procedure DblClick; override;
|
procedure DblClick; override;
|
||||||
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
procedure TripleClick; override;
|
||||||
|
procedure QuadClick; override;
|
||||||
|
{$ENDIF}
|
||||||
procedure DecPaintLock;
|
procedure DecPaintLock;
|
||||||
procedure DestroyWnd; override;
|
procedure DestroyWnd; override;
|
||||||
procedure DragOver(Source: TObject; X, Y: Integer;
|
procedure DragOver(Source: TObject; X, Y: Integer;
|
||||||
@ -708,6 +717,8 @@ type
|
|||||||
// inherited events
|
// inherited events
|
||||||
property OnClick;
|
property OnClick;
|
||||||
property OnDblClick;
|
property OnDblClick;
|
||||||
|
property OnTripleClick;
|
||||||
|
property OnQuadClick;
|
||||||
property OnDragDrop;
|
property OnDragDrop;
|
||||||
property OnDragOver;
|
property OnDragOver;
|
||||||
{$IFDEF SYN_COMPILER_4_UP}
|
{$IFDEF SYN_COMPILER_4_UP}
|
||||||
@ -1079,7 +1090,8 @@ begin
|
|||||||
fGutter.OnChange := {$IFDEF FPC}@{$ENDIF}GutterChanged;
|
fGutter.OnChange := {$IFDEF FPC}@{$ENDIF}GutterChanged;
|
||||||
fGutterWidth := fGutter.Width;
|
fGutterWidth := fGutter.Width;
|
||||||
fTextOffset := fGutterWidth + 2;
|
fTextOffset := fGutterWidth + 2;
|
||||||
ControlStyle := ControlStyle + [csOpaque, csSetCaption];
|
ControlStyle := ControlStyle + [csOpaque, csSetCaption
|
||||||
|
{$IFDEF SYN_LAZARUS}, csTripleClicks, csQuadClicks{$ENDIF}];
|
||||||
Height := 150;
|
Height := 150;
|
||||||
Width := 200;
|
Width := 200;
|
||||||
Cursor := crIBeam;
|
Cursor := crIBeam;
|
||||||
@ -1722,7 +1734,11 @@ begin
|
|||||||
if (Button = mbLeft) and bStartDrag then
|
if (Button = mbLeft) and bStartDrag then
|
||||||
Include(fStateFlags, sfWaitForDragging)
|
Include(fStateFlags, sfWaitForDragging)
|
||||||
else begin
|
else begin
|
||||||
if not (sfDblClicked in fStateFlags) then begin
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
if ([sfDblClicked,sfTripleClicked,sfQuadClicked]*fStateFlags=[]) then begin
|
||||||
|
{$ELSE}
|
||||||
|
if (sfDblClicked in fStateFlags) then begin
|
||||||
|
{$ENDIF}
|
||||||
if ssShift in Shift then
|
if ssShift in Shift then
|
||||||
SetBlockEnd(CaretXY)
|
SetBlockEnd(CaretXY)
|
||||||
else begin
|
else begin
|
||||||
@ -1914,7 +1930,9 @@ begin
|
|||||||
if (sfPossibleGutterClick in fStateFlags) and (X < fGutterWidth) then
|
if (sfPossibleGutterClick in fStateFlags) and (X < fGutterWidth) then
|
||||||
DoOnGutterClick(X, Y)
|
DoOnGutterClick(X, Y)
|
||||||
else
|
else
|
||||||
if fStateFlags * [sfDblClicked, sfWaitForDragging] = [sfWaitForDragging] then
|
if fStateFlags * [sfDblClicked,
|
||||||
|
{$IFDEF SYN_LAZARUS}sfTripleClicked,sfQuadClicked,{$ENDIF}
|
||||||
|
sfWaitForDragging] = [sfWaitForDragging] then
|
||||||
begin
|
begin
|
||||||
ComputeCaret(X, Y);
|
ComputeCaret(X, Y);
|
||||||
SetBlockBegin(CaretXY);
|
SetBlockBegin(CaretXY);
|
||||||
@ -1922,14 +1940,22 @@ begin
|
|||||||
Exclude(fStateFlags, sfWaitForDragging);
|
Exclude(fStateFlags, sfWaitForDragging);
|
||||||
end;
|
end;
|
||||||
if (Button=mbLeft)
|
if (Button=mbLeft)
|
||||||
and (fStateFlags * [sfDblClicked, sfWaitForDragging] = []) then begin
|
and (fStateFlags * [sfDblClicked,
|
||||||
|
{$IFDEF SYN_LAZARUS}sfTripleClicked,sfQuadClicked,{$ENDIF}
|
||||||
|
sfWaitForDragging] = []) then
|
||||||
|
begin
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
AquirePrimarySelection;
|
AquirePrimarySelection;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
fStateFlags:=fStateFlags-[sfDblClicked,sfTripleClicked,sfQuadClicked,
|
||||||
|
sfPossibleGutterClick];
|
||||||
|
{$ELSE}
|
||||||
Exclude(fStateFlags, sfDblClicked);
|
Exclude(fStateFlags, sfDblClicked);
|
||||||
Exclude(fStateFlags, sfPossibleGutterClick);
|
Exclude(fStateFlags, sfPossibleGutterClick);
|
||||||
//writeln('TCustomSynEdit.MouseUp END Mouse=',X,',',Y,' Caret=',CaretX,',',CaretY,', BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
{$ENDIF}
|
||||||
|
//writeln('TCustomSynEdit.MouseUp END Mouse=',X,',',Y,' Caret=',CaretX,',',CaretY,', BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.DoOnGutterClick(X, Y: integer);
|
procedure TCustomSynEdit.DoOnGutterClick(X, Y: integer);
|
||||||
@ -4195,7 +4221,26 @@ begin
|
|||||||
fBlockBegin:=Point(1,MinMax(Value.y, 1, Lines.Count));
|
fBlockBegin:=Point(1,MinMax(Value.y, 1, Lines.Count));
|
||||||
fBlockEnd:=Point(1,MinMax(Value.y+1, 1, Lines.Count));
|
fBlockEnd:=Point(1,MinMax(Value.y+1, 1, Lines.Count));
|
||||||
CaretXY:=fBlockEnd;
|
CaretXY:=fBlockEnd;
|
||||||
//writeln(' FFF2 ',Value.X,',',Value.Y,' BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
//writeln(' FFF2 ',Value.X,',',Value.Y,' BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
||||||
|
InvalidateLine(Value.Y);
|
||||||
|
StatusChanged([scSelection]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.SetParagraphBlock(Value: TPoint);
|
||||||
|
var ParagraphStartLine, ParagraphEndLine: integer;
|
||||||
|
begin
|
||||||
|
ParagraphStartLine:=MinMax(Value.y, 1, Lines.Count);
|
||||||
|
ParagraphEndLine:=MinMax(Value.y+1, 1, Lines.Count);
|
||||||
|
while (ParagraphStartLine>1)
|
||||||
|
and (Trim(Lines[ParagraphStartLine-1])<>'') do
|
||||||
|
dec(ParagraphStartLine);
|
||||||
|
while (ParagraphEndLine<Lines.Count)
|
||||||
|
and (Trim(Lines[ParagraphEndLine-1])<>'') do
|
||||||
|
inc(ParagraphEndLine);
|
||||||
|
fBlockBegin:=Point(1,ParagraphStartLine);
|
||||||
|
fBlockEnd:=Point(1,ParagraphEndLine);
|
||||||
|
CaretXY:=fBlockEnd;
|
||||||
|
//writeln(' FFF3 ',Value.X,',',Value.Y,' BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
||||||
InvalidateLine(Value.Y);
|
InvalidateLine(Value.Y);
|
||||||
StatusChanged([scSelection]);
|
StatusChanged([scSelection]);
|
||||||
end;
|
end;
|
||||||
@ -4225,6 +4270,42 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
procedure TCustomSynEdit.TripleClick;
|
||||||
|
var
|
||||||
|
ptMouse: TPoint;
|
||||||
|
begin
|
||||||
|
GetCursorPos(ptMouse);
|
||||||
|
ptMouse := ScreenToClient(ptMouse);
|
||||||
|
if ptMouse.X >= fGutterWidth + 2 then begin
|
||||||
|
if not (eoNoSelection in fOptions) then begin
|
||||||
|
SetLineBlock(PixelsToRowColumn(ptMouse))
|
||||||
|
end;
|
||||||
|
inherited;
|
||||||
|
Include(fStateFlags, sfTripleClicked);
|
||||||
|
MouseCapture := FALSE;
|
||||||
|
end else
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.QuadClick;
|
||||||
|
var
|
||||||
|
ptMouse: TPoint;
|
||||||
|
begin
|
||||||
|
GetCursorPos(ptMouse);
|
||||||
|
ptMouse := ScreenToClient(ptMouse);
|
||||||
|
if ptMouse.X >= fGutterWidth + 2 then begin
|
||||||
|
if not (eoNoSelection in fOptions) then begin
|
||||||
|
SetParagraphBlock(PixelsToRowColumn(ptMouse))
|
||||||
|
end;
|
||||||
|
inherited;
|
||||||
|
Include(fStateFlags, sfTripleClicked);
|
||||||
|
MouseCapture := FALSE;
|
||||||
|
end else
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function TCustomSynEdit.GetCanUndo: Boolean;
|
function TCustomSynEdit.GetCanUndo: Boolean;
|
||||||
begin
|
begin
|
||||||
result := fUndoList.CanUndo;
|
result := fUndoList.CanUndo;
|
||||||
|
@ -244,6 +244,7 @@ LM_MBUTTONUP = $0208;
|
|||||||
LM_MBUTTONDBLCLK = $0209;
|
LM_MBUTTONDBLCLK = $0209;
|
||||||
LM_MOUSEWHEEL = $020A;
|
LM_MOUSEWHEEL = $020A;
|
||||||
LM_MOUSELAST = $020A;
|
LM_MOUSELAST = $020A;
|
||||||
|
// for triple and quad clicks see below
|
||||||
|
|
||||||
LM_CAPTURECHANGED = $0215;
|
LM_CAPTURECHANGED = $0215;
|
||||||
LM_DROPFILES = $0233;
|
LM_DROPFILES = $0233;
|
||||||
@ -315,6 +316,12 @@ LM_MONTHCHANGED = LM_USER+65;
|
|||||||
LM_YEARCHANGED = LM_USER+66;
|
LM_YEARCHANGED = LM_USER+66;
|
||||||
LM_DAYCHANGED = LM_USER+67;
|
LM_DAYCHANGED = LM_USER+67;
|
||||||
|
|
||||||
|
LM_LBUTTONTRIPLECLK = LM_USER+68;
|
||||||
|
LM_LBUTTONQUADCLK = LM_USER+69;
|
||||||
|
LM_MBUTTONTRIPLECLK = LM_USER+70;
|
||||||
|
LM_MBUTTONQUADCLK = LM_USER+71;
|
||||||
|
LM_RBUTTONTRIPLECLK = LM_USER+72;
|
||||||
|
LM_RBUTTONQUADCLK = LM_USER+73;
|
||||||
|
|
||||||
LM_UNKNOWN = LM_User+99;
|
LM_UNKNOWN = LM_User+99;
|
||||||
|
|
||||||
@ -635,6 +642,12 @@ TLMMButtonDown = TLMMouse;
|
|||||||
TLMLButtonDblClk = TLMMouse;
|
TLMLButtonDblClk = TLMMouse;
|
||||||
TLMRButtonDblClk = TLMMouse;
|
TLMRButtonDblClk = TLMMouse;
|
||||||
TLMMButtonDblClk = TLMMouse;
|
TLMMButtonDblClk = TLMMouse;
|
||||||
|
TLMLButtonTripleClk = TLMMouse;
|
||||||
|
TLMRButtonTripleClk = TLMMouse;
|
||||||
|
TLMMButtonTripleClk = TLMMouse;
|
||||||
|
TLMLButtonQuadClk = TLMMouse;
|
||||||
|
TLMRButtonQuadClk = TLMMouse;
|
||||||
|
TLMMButtonQuadClk = TLMMouse;
|
||||||
TLMLButtonUp = TLMMouse;
|
TLMLButtonUp = TLMMouse;
|
||||||
TLMRButtonUp = TLMMouse;
|
TLMRButtonUp = TLMMouse;
|
||||||
TLMMButtonUp = TLMMouse;
|
TLMMButtonUp = TLMMouse;
|
||||||
@ -818,6 +831,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.24 2002/03/29 17:12:52 lazarus
|
||||||
|
MG: added Triple and Quad mouse clicks to lcl and synedit
|
||||||
|
|
||||||
Revision 1.23 2002/03/27 00:33:54 lazarus
|
Revision 1.23 2002/03/27 00:33:54 lazarus
|
||||||
MWE:
|
MWE:
|
||||||
* Cleanup in lmessages
|
* Cleanup in lmessages
|
||||||
|
Loading…
Reference in New Issue
Block a user