mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-26 20:28:25 +02:00
implement mousewheel support
git-svn-id: trunk@4941 -
This commit is contained in:
parent
8be99ebec5
commit
6b3b71d99a
@ -273,8 +273,9 @@ type
|
|||||||
procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY;
|
procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
|
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
|
||||||
{$IFNDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
// ToDo mouse wheel
|
procedure WMMouseWheel(var Msg: TLMMouseEvent); message LM_MOUSEWHEEL;
|
||||||
|
{$ELSE}
|
||||||
procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
|
procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
|
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
|
||||||
@ -331,9 +332,7 @@ type
|
|||||||
fBookMarkOpt: TSynBookMarkOpt;
|
fBookMarkOpt: TSynBookMarkOpt;
|
||||||
fBorderStyle: TBorderStyle;
|
fBorderStyle: TBorderStyle;
|
||||||
fHideSelection: boolean;
|
fHideSelection: boolean;
|
||||||
{$IFNDEF SYN_LAZARUS}
|
|
||||||
fMouseWheelAccumulator: integer;
|
fMouseWheelAccumulator: integer;
|
||||||
{$ENDIF}
|
|
||||||
fOverwriteCaret: TSynEditCaretType;
|
fOverwriteCaret: TSynEditCaretType;
|
||||||
fInsertCaret: TSynEditCaretType;
|
fInsertCaret: TSynEditCaretType;
|
||||||
fCaretOffset: TPoint;
|
fCaretOffset: TPoint;
|
||||||
@ -6669,7 +6668,36 @@ begin
|
|||||||
fRedoList.Unlock;
|
fRedoList.Unlock;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.WMMouseWheel(var Msg: TLMMouseEvent);
|
||||||
|
var
|
||||||
|
nDelta: integer;
|
||||||
|
nWheelClicks: integer;
|
||||||
|
const
|
||||||
|
LinesToScroll = 3;
|
||||||
|
WHEEL_DELTA = 120;
|
||||||
|
WHEEL_PAGESCROLL = $FFFFFFFF;
|
||||||
|
begin
|
||||||
|
if csDesigning in ComponentState then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
if GetKeyState(VK_CONTROL) >= 0 then
|
||||||
|
nDelta := LinesToScroll
|
||||||
|
else
|
||||||
|
nDelta := LinesInWindow shr Ord(eoHalfPageScroll in fOptions);
|
||||||
|
|
||||||
|
Inc(fMouseWheelAccumulator, Msg.WheelDelta);
|
||||||
|
nWheelClicks := fMouseWheelAccumulator div WHEEL_DELTA;
|
||||||
|
fMouseWheelAccumulator := fMouseWheelAccumulator mod WHEEL_DELTA;
|
||||||
|
if (nDelta = integer(WHEEL_PAGESCROLL)) or (nDelta > LinesInWindow) then
|
||||||
|
nDelta := LinesInWindow;
|
||||||
|
TopLine := TopLine - (nDelta * nWheelClicks);
|
||||||
|
Update;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$ELSE}
|
||||||
|
|
||||||
procedure TCustomSynEdit.WMMouseWheel(var Msg: TMessage);
|
procedure TCustomSynEdit.WMMouseWheel(var Msg: TMessage);
|
||||||
var
|
var
|
||||||
nDelta: integer;
|
nDelta: integer;
|
||||||
@ -6701,6 +6729,7 @@ begin
|
|||||||
TopLine := TopLine - (nDelta * nWheelClicks);
|
TopLine := TopLine - (nDelta * nWheelClicks);
|
||||||
Update;
|
Update;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetWantTabs(const Value: boolean);
|
procedure TCustomSynEdit.SetWantTabs(const Value: boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user