mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-26 10:28:47 +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;
|
||||
{$ENDIF}
|
||||
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
|
||||
{$IFNDEF SYN_LAZARUS}
|
||||
// ToDo mouse wheel
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
procedure WMMouseWheel(var Msg: TLMMouseEvent); message LM_MOUSEWHEEL;
|
||||
{$ELSE}
|
||||
procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
|
||||
{$ENDIF}
|
||||
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
|
||||
@ -331,9 +332,7 @@ type
|
||||
fBookMarkOpt: TSynBookMarkOpt;
|
||||
fBorderStyle: TBorderStyle;
|
||||
fHideSelection: boolean;
|
||||
{$IFNDEF SYN_LAZARUS}
|
||||
fMouseWheelAccumulator: integer;
|
||||
{$ENDIF}
|
||||
fOverwriteCaret: TSynEditCaretType;
|
||||
fInsertCaret: TSynEditCaretType;
|
||||
fCaretOffset: TPoint;
|
||||
@ -6669,7 +6668,36 @@ begin
|
||||
fRedoList.Unlock;
|
||||
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);
|
||||
var
|
||||
nDelta: integer;
|
||||
@ -6701,6 +6729,7 @@ begin
|
||||
TopLine := TopLine - (nDelta * nWheelClicks);
|
||||
Update;
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
procedure TCustomSynEdit.SetWantTabs(const Value: boolean);
|
||||
|
Loading…
Reference in New Issue
Block a user