mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 05:09:10 +02:00
SynEdit / IDE: zoom with ctrl wheel
git-svn-id: trunk@33986 -
This commit is contained in:
parent
b940e9e6a6
commit
3403a53c21
@ -390,6 +390,7 @@ type
|
|||||||
fCharsInWindow: Integer;
|
fCharsInWindow: Integer;
|
||||||
fCharWidth: Integer;
|
fCharWidth: Integer;
|
||||||
fFontDummy: TFont;
|
fFontDummy: TFont;
|
||||||
|
FLastSetFontSize: Integer;
|
||||||
{$IFDEF SYN_MBCSSUPPORT}
|
{$IFDEF SYN_MBCSSUPPORT}
|
||||||
fImeCount: Integer;
|
fImeCount: Integer;
|
||||||
fMBCSStepAside: Boolean;
|
fMBCSStepAside: Boolean;
|
||||||
@ -1364,6 +1365,11 @@ procedure TSynEditMouseGlobalActions.InitForOptions(AnOptions: TSynEditorMouseOp
|
|||||||
begin
|
begin
|
||||||
AddCommand(emcWheelScrollDown, False, mbWheelDown, ccAny, cdDown, [], []);
|
AddCommand(emcWheelScrollDown, False, mbWheelDown, ccAny, cdDown, [], []);
|
||||||
AddCommand(emcWheelScrollUp, False, mbWheelUp, ccAny, cdDown, [], []);
|
AddCommand(emcWheelScrollUp, False, mbWheelUp, ccAny, cdDown, [], []);
|
||||||
|
|
||||||
|
if emCtrlWheelZoom in AnOptions then begin
|
||||||
|
AddCommand(emcWheelZoomOut, False, mbWheelDown, ccAny, cdDown, [ssCtrl], [ssCtrl]);
|
||||||
|
AddCommand(emcWheelZoomIn, False, mbWheelUp, ccAny, cdDown, [ssCtrl], [ssCtrl]);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSynEditMouseTextActions }
|
{ TSynEditMouseTextActions }
|
||||||
@ -1821,6 +1827,7 @@ begin
|
|||||||
fFontDummy.Height := SynDefaultFontHeight;
|
fFontDummy.Height := SynDefaultFontHeight;
|
||||||
fFontDummy.Pitch := SynDefaultFontPitch;
|
fFontDummy.Pitch := SynDefaultFontPitch;
|
||||||
fFontDummy.Quality := SynDefaultFontQuality;
|
fFontDummy.Quality := SynDefaultFontQuality;
|
||||||
|
FLastSetFontSize := fFontDummy.Size;
|
||||||
fLastMouseCaret := Point(-1,-1);
|
fLastMouseCaret := Point(-1,-1);
|
||||||
FLastMousePoint := Point(-1,-1);
|
FLastMousePoint := Point(-1,-1);
|
||||||
fBlockIndent := 2;
|
fBlockIndent := 2;
|
||||||
@ -2142,6 +2149,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomSynEdit.FontChanged(Sender: TObject);
|
procedure TCustomSynEdit.FontChanged(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
FLastSetFontSize := Font.Size;
|
||||||
RecalcCharExtent;
|
RecalcCharExtent;
|
||||||
SizeOrFontChanged(TRUE);
|
SizeOrFontChanged(TRUE);
|
||||||
end;
|
end;
|
||||||
@ -2595,6 +2603,7 @@ function TCustomSynEdit.DoHandleMouseAction(AnActionList: TSynEditMouseActions;
|
|||||||
AnInfo: TSynEditMouseActionInfo): Boolean;
|
AnInfo: TSynEditMouseActionInfo): Boolean;
|
||||||
var
|
var
|
||||||
CaretDone: Boolean;
|
CaretDone: Boolean;
|
||||||
|
AnAction: TSynEditMouseAction;
|
||||||
|
|
||||||
procedure MoveCaret;
|
procedure MoveCaret;
|
||||||
begin
|
begin
|
||||||
@ -2602,14 +2611,49 @@ var
|
|||||||
CaretDone := True;
|
CaretDone := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetWheelScrollAmount(APageSize: integer): integer;
|
||||||
|
const
|
||||||
|
WHEEL_PAGESCROLL = MAXDWORD;
|
||||||
|
begin
|
||||||
|
case AnAction.Option of
|
||||||
|
emcWheelScrollSystem:
|
||||||
|
begin
|
||||||
|
Result := Mouse.WheelScrollLines;
|
||||||
|
if (Result = WHEEL_PAGESCROLL) or (Result > APageSize) then
|
||||||
|
Result := APageSize;
|
||||||
|
end;
|
||||||
|
emcWheelScrollLines:
|
||||||
|
begin
|
||||||
|
Result := 1;
|
||||||
|
if AnAction.Option2 > 0 then
|
||||||
|
Result := AnAction.Option2;
|
||||||
|
if (Result > APageSize) then
|
||||||
|
Result := APageSize;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
emcWheelScrollPages:
|
||||||
|
Result := APageSize;
|
||||||
|
emcWheelScrollPagesLessOne:
|
||||||
|
Result := APageSize - 1;
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Result := Mouse.WheelScrollLines;
|
||||||
|
if (Result = WHEEL_PAGESCROLL) or (Result > APageSize) then
|
||||||
|
Result := APageSize;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if AnAction.Option2 > 0 then
|
||||||
|
Result := MulDiv(Result, AnAction.Option2, 100);
|
||||||
|
if (Result > APageSize) then
|
||||||
|
Result := APageSize;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
ACommand: TSynEditorMouseCommand;
|
ACommand: TSynEditorMouseCommand;
|
||||||
Handled: Boolean;
|
Handled: Boolean;
|
||||||
AnAction: TSynEditMouseAction;
|
|
||||||
ClipHelper: TSynClipboardStream;
|
ClipHelper: TSynClipboardStream;
|
||||||
i: integer;
|
i, j: integer;
|
||||||
const
|
|
||||||
WHEEL_PAGESCROLL = MAXDWORD;
|
|
||||||
begin
|
begin
|
||||||
AnAction := nil;
|
AnAction := nil;
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -2655,6 +2699,22 @@ begin
|
|||||||
CaretDone := AnInfo.CaretDone;
|
CaretDone := AnInfo.CaretDone;
|
||||||
MouseCapture := False;
|
MouseCapture := False;
|
||||||
|
|
||||||
|
if (ACommand = emcWheelScrollDown)
|
||||||
|
then begin
|
||||||
|
// sroll dependant on visible scrollbar / or not at all
|
||||||
|
if (sfVertScrollbarVisible in fStateFlags) then ACommand := emcWheelVertScrollDown
|
||||||
|
else
|
||||||
|
if (sfHorizScrollbarVisible in fStateFlags) then ACommand := emcWheelHorizScrollDown;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (ACommand = emcWheelScrollUp)
|
||||||
|
then begin
|
||||||
|
// sroll dependant on visible scrollbar / or not at all
|
||||||
|
if (sfVertScrollbarVisible in fStateFlags) then ACommand := emcWheelVertScrollUp
|
||||||
|
else
|
||||||
|
if (sfHorizScrollbarVisible in fStateFlags) then ACommand := emcWheelHorizScrollUp;
|
||||||
|
end;
|
||||||
|
|
||||||
case ACommand of
|
case ACommand of
|
||||||
emcNone: ; // do nothing, but result := true
|
emcNone: ; // do nothing, but result := true
|
||||||
emcStartSelections, emcStartColumnSelections, emcStartLineSelections:
|
emcStartSelections, emcStartColumnSelections, emcStartLineSelections:
|
||||||
@ -2756,20 +2816,39 @@ begin
|
|||||||
MoveCaret;
|
MoveCaret;
|
||||||
CommandProcessor(AnAction.Option, #0, nil);
|
CommandProcessor(AnAction.Option, #0, nil);
|
||||||
end;
|
end;
|
||||||
emcWheelScrollDown:
|
emcWheelHorizScrollDown, emcWheelHorizScrollUp:
|
||||||
begin
|
begin
|
||||||
i := Mouse.WheelScrollLines;
|
i := GetWheelScrollAmount(fCharsInWindow);
|
||||||
if (i = WHEEL_PAGESCROLL) or (i > fLinesInWindow) then
|
if ACommand = emcWheelHorizScrollUp then i := -i;
|
||||||
i := fLinesInWindow;
|
LeftChar := LeftChar + i;
|
||||||
TopView := TopView - i;
|
|
||||||
end;
|
end;
|
||||||
emcWheelScrollUp:
|
emcWheelVertScrollDown, emcWheelVertScrollUp:
|
||||||
begin
|
begin
|
||||||
i := Mouse.WheelScrollLines;
|
i := GetWheelScrollAmount(fLinesInWindow);
|
||||||
if (i = WHEEL_PAGESCROLL) or (i > fLinesInWindow) then
|
if ACommand = emcWheelVertScrollUp then i := -i;
|
||||||
i := fLinesInWindow;
|
|
||||||
TopView := TopView + i;
|
TopView := TopView + i;
|
||||||
end;
|
end;
|
||||||
|
emcWheelZoomOut, emcWheelZoomIn:
|
||||||
|
begin
|
||||||
|
if ( (ACommand = emcWheelZoomOut) and (abs(Font.Size) < 3) ) or
|
||||||
|
( (ACommand = emcWheelZoomIn) and (abs(Font.Size) > 50) )
|
||||||
|
then begin
|
||||||
|
Result := False;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
j := 1;
|
||||||
|
if ACommand = emcWheelZoomIn then j := -1;
|
||||||
|
i := FLastSetFontSize;
|
||||||
|
if Font.Size < 0
|
||||||
|
then Font.Size := Font.Size + j
|
||||||
|
else Font.Size := Font.Size - j;
|
||||||
|
FLastSetFontSize := i;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
emcWheelZoomNorm:
|
||||||
|
begin
|
||||||
|
Font.Size := FLastSetFontSize;
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
Result := False; // ACommand was not handled => Fallback to parent Context
|
Result := False; // ACommand was not handled => Fallback to parent Context
|
||||||
end;
|
end;
|
||||||
@ -7202,12 +7281,12 @@ begin
|
|||||||
try
|
try
|
||||||
while FMouseWheelAccumulator > WHEEL_DELTA do begin
|
while FMouseWheelAccumulator > WHEEL_DELTA do begin
|
||||||
dec(FMouseWheelAccumulator, WHEEL_DELTA);
|
dec(FMouseWheelAccumulator, WHEEL_DELTA);
|
||||||
FindAndHandleMouseAction(mbWheelDown, lState, Message.X, Message.Y, ccSingle, cdDown);
|
FindAndHandleMouseAction(mbWheelUp, lState, Message.X, Message.Y, ccSingle, cdDown);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
while FMouseWheelAccumulator < WHEEL_DELTA do begin
|
while FMouseWheelAccumulator < WHEEL_DELTA do begin
|
||||||
inc(FMouseWheelAccumulator, WHEEL_DELTA);
|
inc(FMouseWheelAccumulator, WHEEL_DELTA);
|
||||||
FindAndHandleMouseAction(mbWheelUp, lState, Message.X, Message.Y, ccSingle, cdDown);
|
FindAndHandleMouseAction(mbWheelDown, lState, Message.X, Message.Y, ccSingle, cdDown);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
DecPaintLock;
|
DecPaintLock;
|
||||||
|
@ -46,7 +46,8 @@ type
|
|||||||
emDragDropEditing, // Allows you to select a block of text and drag it within the document to another location
|
emDragDropEditing, // Allows you to select a block of text and drag it within the document to another location
|
||||||
emRightMouseMovesCursor, // When clicking with the right mouse for a popup menu, move the cursor to that location
|
emRightMouseMovesCursor, // When clicking with the right mouse for a popup menu, move the cursor to that location
|
||||||
emDoubleClickSelectsLine, // Select line on double click
|
emDoubleClickSelectsLine, // Select line on double click
|
||||||
emShowCtrlMouseLinks // Pressing Ctrl (SYNEDIT_LINK_MODIFIER) will highlight the word under the mouse cursor
|
emShowCtrlMouseLinks, // Pressing Ctrl (SYNEDIT_LINK_MODIFIER) will highlight the word under the mouse cursor
|
||||||
|
emCtrlWheelZoom
|
||||||
);
|
);
|
||||||
TSynEditorMouseOptions = set of TSynEditorMouseOption;
|
TSynEditorMouseOptions = set of TSynEditorMouseOption;
|
||||||
|
|
||||||
@ -85,6 +86,7 @@ type
|
|||||||
private
|
private
|
||||||
FClickDir: TSynMAClickDir;
|
FClickDir: TSynMAClickDir;
|
||||||
FOption: TSynEditorMouseCommandOpt;
|
FOption: TSynEditorMouseCommandOpt;
|
||||||
|
FOption2: Integer;
|
||||||
FPriority: TSynEditorMouseCommandOpt;
|
FPriority: TSynEditorMouseCommandOpt;
|
||||||
FShift, FShiftMask: TShiftState;
|
FShift, FShiftMask: TShiftState;
|
||||||
FButton: TSynMouseButton;
|
FButton: TSynMouseButton;
|
||||||
@ -97,6 +99,7 @@ type
|
|||||||
procedure SetCommand(const AValue: TSynEditorMouseCommand);
|
procedure SetCommand(const AValue: TSynEditorMouseCommand);
|
||||||
procedure SetMoveCaret(const AValue: Boolean);
|
procedure SetMoveCaret(const AValue: Boolean);
|
||||||
procedure SetOption(const AValue: TSynEditorMouseCommandOpt);
|
procedure SetOption(const AValue: TSynEditorMouseCommandOpt);
|
||||||
|
procedure SetOption2(AValue: Integer);
|
||||||
procedure SetPriority(const AValue: TSynEditorMouseCommandOpt);
|
procedure SetPriority(const AValue: TSynEditorMouseCommandOpt);
|
||||||
procedure SetShift(const AValue: TShiftState);
|
procedure SetShift(const AValue: TShiftState);
|
||||||
procedure SetShiftMask(const AValue: TShiftState);
|
procedure SetShiftMask(const AValue: TShiftState);
|
||||||
@ -120,6 +123,7 @@ type
|
|||||||
property Command: TSynEditorMouseCommand read FCommand write SetCommand;
|
property Command: TSynEditorMouseCommand read FCommand write SetCommand;
|
||||||
property MoveCaret: Boolean read FMoveCaret write SetMoveCaret default False;
|
property MoveCaret: Boolean read FMoveCaret write SetMoveCaret default False;
|
||||||
property Option: TSynEditorMouseCommandOpt read FOption write SetOption default 0;
|
property Option: TSynEditorMouseCommandOpt read FOption write SetOption default 0;
|
||||||
|
property Option2: Integer read FOption2 write SetOption2 default 0;
|
||||||
property Priority: TSynEditorMouseCommandOpt read FPriority write SetPriority default 0;
|
property Priority: TSynEditorMouseCommandOpt read FPriority write SetPriority default 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -152,7 +156,8 @@ type
|
|||||||
const AButton: TSynMouseButton; const AClickCount: TSynMAClickCount;
|
const AButton: TSynMouseButton; const AClickCount: TSynMAClickCount;
|
||||||
const ADir: TSynMAClickDir; const AShift, AShiftMask: TShiftState;
|
const ADir: TSynMAClickDir; const AShift, AShiftMask: TShiftState;
|
||||||
const AOpt: TSynEditorMouseCommandOpt = 0;
|
const AOpt: TSynEditorMouseCommandOpt = 0;
|
||||||
const APrior: Integer = 0);
|
const APrior: Integer = 0;
|
||||||
|
const AOpt2: integer = 0);
|
||||||
public
|
public
|
||||||
property Items[Index: Integer]: TSynEditMouseAction read GetItem
|
property Items[Index: Integer]: TSynEditMouseAction read GetItem
|
||||||
write SetItem; default;
|
write SetItem; default;
|
||||||
@ -236,30 +241,44 @@ const
|
|||||||
emcWheelScrollDown = TSynEditorMouseCommand(18);
|
emcWheelScrollDown = TSynEditorMouseCommand(18);
|
||||||
emcWheelScrollUp = TSynEditorMouseCommand(19);
|
emcWheelScrollUp = TSynEditorMouseCommand(19);
|
||||||
|
|
||||||
emcMax = 19;
|
emcWheelVertScrollDown = TSynEditorMouseCommand(20);
|
||||||
|
emcWheelVertScrollUp = TSynEditorMouseCommand(21);
|
||||||
|
emcWheelHorizScrollDown = TSynEditorMouseCommand(22);
|
||||||
|
emcWheelHorizScrollUp = TSynEditorMouseCommand(23);
|
||||||
|
|
||||||
|
emcWheelZoomOut = TSynEditorMouseCommand(24);
|
||||||
|
emcWheelZoomIn = TSynEditorMouseCommand(25);
|
||||||
|
emcWheelZoomNorm = TSynEditorMouseCommand(26);
|
||||||
|
|
||||||
|
emcMax = 26;
|
||||||
|
|
||||||
emcPluginFirst = 20000;
|
emcPluginFirst = 20000;
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
emcoSelectionStart = 0;
|
emcoSelectionStart = TSynEditorMouseCommandOpt(0);
|
||||||
emcoSelectionContinue = 1;
|
emcoSelectionContinue = TSynEditorMouseCommandOpt(1);
|
||||||
|
|
||||||
emcoSelectLineSmart = 0;
|
emcoSelectLineSmart = TSynEditorMouseCommandOpt(0);
|
||||||
emcoSelectLineFull = 1;
|
emcoSelectLineFull = TSynEditorMouseCommandOpt(1);
|
||||||
emcoMouseLinkShow = 0;
|
emcoMouseLinkShow = TSynEditorMouseCommandOpt(0);
|
||||||
emcoMouseLinkHide = 1;
|
emcoMouseLinkHide = TSynEditorMouseCommandOpt(1);
|
||||||
|
|
||||||
emcoCodeFoldCollapsOne = 0;
|
emcoCodeFoldCollapsOne = TSynEditorMouseCommandOpt(0);
|
||||||
emcoCodeFoldCollapsAll = 1;
|
emcoCodeFoldCollapsAll = TSynEditorMouseCommandOpt(1);
|
||||||
emcoCodeFoldCollapsAtCaret = 2;
|
emcoCodeFoldCollapsAtCaret = TSynEditorMouseCommandOpt(2);
|
||||||
emcoCodeFoldCollapsPreCaret = 3;
|
emcoCodeFoldCollapsPreCaret = TSynEditorMouseCommandOpt(3);
|
||||||
emcoCodeFoldExpandOne = 0;
|
emcoCodeFoldExpandOne = TSynEditorMouseCommandOpt(0);
|
||||||
emcoCodeFoldExpandAll = 1;
|
emcoCodeFoldExpandAll = TSynEditorMouseCommandOpt(1);
|
||||||
|
|
||||||
// menu, and caret move
|
// menu, and caret move
|
||||||
emcoSelectionCaretMoveNever = 0;
|
emcoSelectionCaretMoveNever = TSynEditorMouseCommandOpt(0);
|
||||||
emcoSelectionCaretMoveOutside = 1; // click is outside selected area
|
emcoSelectionCaretMoveOutside = TSynEditorMouseCommandOpt(1); // click is outside selected area
|
||||||
emcoSelectionCaretMoveAlways = 2;
|
emcoSelectionCaretMoveAlways = TSynEditorMouseCommandOpt(2);
|
||||||
|
|
||||||
|
emcWheelScrollSystem = TSynEditorMouseCommandOpt(0); // Opt2 > 0 ==> percentage
|
||||||
|
emcWheelScrollLines = TSynEditorMouseCommandOpt(1); // Opt2 > 0 ==> amount of lines
|
||||||
|
emcWheelScrollPages = TSynEditorMouseCommandOpt(2); // Opt2 > 0 ==> percentage
|
||||||
|
emcWheelScrollPagesLessOne = TSynEditorMouseCommandOpt(3); // Opt2 > 0 ==> percentage
|
||||||
|
|
||||||
// Plugins don't know of other plugins, so they need to map the codes
|
// Plugins don't know of other plugins, so they need to map the codes
|
||||||
// Plugins all start at ecPluginFirst (overlapping)
|
// Plugins all start at ecPluginFirst (overlapping)
|
||||||
@ -280,7 +299,7 @@ const
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
const
|
const
|
||||||
SynMouseCommandNames: array [0..17] of TIdentMapEntry = (
|
SynMouseCommandNames: array [0..24] of TIdentMapEntry = (
|
||||||
(Value: emcNone; Name: 'emcNone'),
|
(Value: emcNone; Name: 'emcNone'),
|
||||||
(Value: emcStartSelections; Name: 'emcStartSelections'),
|
(Value: emcStartSelections; Name: 'emcStartSelections'),
|
||||||
(Value: emcStartColumnSelections; Name: 'emcStartColumnSelections'),
|
(Value: emcStartColumnSelections; Name: 'emcStartColumnSelections'),
|
||||||
@ -290,22 +309,30 @@ const
|
|||||||
(Value: emcSelectLine; Name: 'emcSelectLine'),
|
(Value: emcSelectLine; Name: 'emcSelectLine'),
|
||||||
(Value: emcSelectPara; Name: 'emcSelectPara'),
|
(Value: emcSelectPara; Name: 'emcSelectPara'),
|
||||||
|
|
||||||
(Value: emcStartDragMove; Name: 'emcStartDragMove'),
|
(Value: emcStartDragMove; Name: 'emcStartDragMove'),
|
||||||
(Value: emcPasteSelection; Name: 'emcPasteSelection'),
|
(Value: emcPasteSelection; Name: 'emcPasteSelection'),
|
||||||
(Value: emcMouseLink; Name: 'emcMouseLink'),
|
(Value: emcMouseLink; Name: 'emcMouseLink'),
|
||||||
|
|
||||||
(Value: emcContextMenu; Name: 'emcContextMenu'),
|
(Value: emcContextMenu; Name: 'emcContextMenu'),
|
||||||
|
|
||||||
(Value: emcOnMainGutterClick; Name: 'emcOnMainGutterClick'),
|
(Value: emcOnMainGutterClick; Name: 'emcOnMainGutterClick'),
|
||||||
|
|
||||||
(Value: emcCodeFoldCollaps; Name: 'emcCodeFoldCollaps'),
|
(Value: emcCodeFoldCollaps; Name: 'emcCodeFoldCollaps'),
|
||||||
(Value: emcCodeFoldExpand; Name: 'emcCodeFoldExpand'),
|
(Value: emcCodeFoldExpand; Name: 'emcCodeFoldExpand'),
|
||||||
(Value: emcCodeFoldContextMenu; Name: 'emcCodeFoldContextMenu'),
|
(Value: emcCodeFoldContextMenu; Name: 'emcCodeFoldContextMenu'),
|
||||||
|
|
||||||
(Value: emcSynEditCommand; Name: 'emcSynEditCommand'),
|
(Value: emcSynEditCommand; Name: 'emcSynEditCommand'),
|
||||||
|
|
||||||
(Value: emcWheelScrollDown; Name: 'emcWheelScrollDown'),
|
(Value: emcWheelScrollDown; Name: 'emcWheelScrollDown'),
|
||||||
(Value: emcWheelScrollUp; Name: 'emcWheelScrollUp')
|
(Value: emcWheelScrollUp; Name: 'emcWheelScrollUp'),
|
||||||
|
(Value: emcWheelVertScrollDown; Name: 'emcWheelVertScrollDown'),
|
||||||
|
(Value: emcWheelVertScrollUp; Name: 'emcWheelVertScrollUp'),
|
||||||
|
(Value: emcWheelHorizScrollDown; Name: 'emcWheelHorizScrollDown'),
|
||||||
|
(Value: emcWheelHorizScrollUp; Name: 'emcWheelHorizScrollUp'),
|
||||||
|
|
||||||
|
(Value: emcWheelZoomOut; Name: 'emcWheelZoomOut'),
|
||||||
|
(Value: emcWheelZoomIn; Name: 'emcWheelZoomIn'),
|
||||||
|
(Value: emcWheelZoomNorm; Name: 'emcWheelZoomNorm')
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -342,6 +369,14 @@ begin
|
|||||||
|
|
||||||
emcWheelScrollDown: Result := SYNS_emcWheelScrollDown;
|
emcWheelScrollDown: Result := SYNS_emcWheelScrollDown;
|
||||||
emcWheelScrollUp: Result := SYNS_emcWheelScrollUp;
|
emcWheelScrollUp: Result := SYNS_emcWheelScrollUp;
|
||||||
|
emcWheelHorizScrollDown: Result := SYNS_emcWheelHorizScrollDown;
|
||||||
|
emcWheelHorizScrollUp: Result := SYNS_emcWheelHorizScrollUp;
|
||||||
|
emcWheelVertScrollDown: Result := SYNS_emcWheelVertScrollDown;
|
||||||
|
emcWheelVertScrollUp: Result := SYNS_emcWheelVertScrollUp;
|
||||||
|
|
||||||
|
emcWheelZoomOut: Result := SYNS_emcWheelZoomOut;
|
||||||
|
emcWheelZoomIn: Result := SYNS_emcWheelZoomIn;
|
||||||
|
emcWheelZoomNorm: Result := SYNS_emcWheelZoomNorm;
|
||||||
|
|
||||||
else Result := ''
|
else Result := ''
|
||||||
end;
|
end;
|
||||||
@ -494,6 +529,14 @@ begin
|
|||||||
TSynEditMouseActions(Collection).AssertNoConflict(self);
|
TSynEditMouseActions(Collection).AssertNoConflict(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSynEditMouseAction.SetOption2(AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FOption2 = AValue then Exit;
|
||||||
|
FOption2 := AValue;
|
||||||
|
if Collection <> nil then
|
||||||
|
TSynEditMouseActions(Collection).AssertNoConflict(self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynEditMouseAction.SetPriority(const AValue: TSynEditorMouseCommandOpt);
|
procedure TSynEditMouseAction.SetPriority(const AValue: TSynEditorMouseCommandOpt);
|
||||||
begin
|
begin
|
||||||
if FPriority = AValue then exit;
|
if FPriority = AValue then exit;
|
||||||
@ -583,7 +626,8 @@ begin
|
|||||||
and (Other.Shift * self.ShiftMask = self.Shift * Other.ShiftMask)
|
and (Other.Shift * self.ShiftMask = self.Shift * Other.ShiftMask)
|
||||||
and ((Other.Command <> self.Command) or // Only conflicts, if Command differs
|
and ((Other.Command <> self.Command) or // Only conflicts, if Command differs
|
||||||
(Other.MoveCaret <> self.MoveCaret) or
|
(Other.MoveCaret <> self.MoveCaret) or
|
||||||
(Other.Option <> self.Option) )
|
(Other.Option <> self.Option) or
|
||||||
|
(Other.Option2 <> self.Option2) )
|
||||||
and not(Other.IsFallback xor self.IsFallback)
|
and not(Other.IsFallback xor self.IsFallback)
|
||||||
and (Other.Priority = self.Priority);
|
and (Other.Priority = self.Priority);
|
||||||
end;
|
end;
|
||||||
@ -599,6 +643,7 @@ begin
|
|||||||
and (Other.Priority = self.Priority)
|
and (Other.Priority = self.Priority)
|
||||||
and ((Other.Command = self.Command) or IgnoreCmd)
|
and ((Other.Command = self.Command) or IgnoreCmd)
|
||||||
and ((Other.Option = self.Option) or IgnoreCmd)
|
and ((Other.Option = self.Option) or IgnoreCmd)
|
||||||
|
and ((Other.Option2 = self.Option2) or IgnoreCmd)
|
||||||
and ((Other.MoveCaret = self.MoveCaret) or IgnoreCmd);
|
and ((Other.MoveCaret = self.MoveCaret) or IgnoreCmd);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -747,7 +792,7 @@ procedure TSynEditMouseActions.AddCommand(const ACmd: TSynEditorMouseCommand;
|
|||||||
const AMoveCaret: Boolean; const AButton: TSynMouseButton;
|
const AMoveCaret: Boolean; const AButton: TSynMouseButton;
|
||||||
const AClickCount: TSynMAClickCount; const ADir: TSynMAClickDir;
|
const AClickCount: TSynMAClickCount; const ADir: TSynMAClickDir;
|
||||||
const AShift, AShiftMask: TShiftState; const AOpt: TSynEditorMouseCommandOpt = 0;
|
const AShift, AShiftMask: TShiftState; const AOpt: TSynEditorMouseCommandOpt = 0;
|
||||||
const APrior: Integer = 0);
|
const APrior: Integer = 0; const AOpt2: integer = 0);
|
||||||
var
|
var
|
||||||
new: TSynEditMouseAction;
|
new: TSynEditMouseAction;
|
||||||
begin
|
begin
|
||||||
@ -764,6 +809,7 @@ begin
|
|||||||
ShiftMask := AShiftMask;
|
ShiftMask := AShiftMask;
|
||||||
Option := AOpt;
|
Option := AOpt;
|
||||||
Priority := APrior;
|
Priority := APrior;
|
||||||
|
Option2 := AOpt2;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
dec(FAssertLock);
|
dec(FAssertLock);
|
||||||
|
@ -304,7 +304,7 @@ type
|
|||||||
constructor Create(AHandleOwner: TWinControl);
|
constructor Create(AHandleOwner: TWinControl);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Hide; // Keep visible = true
|
procedure Hide; // Keep visible = true
|
||||||
procedure DestroyCaret;
|
procedure DestroyCaret(SkipHide: boolean = False);
|
||||||
procedure Lock;
|
procedure Lock;
|
||||||
procedure UnLock;
|
procedure UnLock;
|
||||||
property HandleOwner: TWinControl read FHandleOwner;
|
property HandleOwner: TWinControl read FHandleOwner;
|
||||||
@ -1614,7 +1614,7 @@ begin
|
|||||||
HideCaret;
|
HideCaret;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditScreenCaret.DestroyCaret;
|
procedure TSynEditScreenCaret.DestroyCaret(SkipHide: boolean = False);
|
||||||
begin
|
begin
|
||||||
if FCurrentCreated and HandleAllocated then begin
|
if FCurrentCreated and HandleAllocated then begin
|
||||||
{$IFDeF SynCaretDebug}
|
{$IFDeF SynCaretDebug}
|
||||||
@ -1624,7 +1624,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
FCurrentCreated := False;
|
FCurrentCreated := False;
|
||||||
FCurrentVisible := False;
|
FCurrentVisible := False;
|
||||||
FVisible := False;
|
if not SkipHide then
|
||||||
|
FVisible := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditScreenCaret.Lock;
|
procedure TSynEditScreenCaret.Lock;
|
||||||
@ -1731,6 +1732,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
CalcExtraLineChars;
|
CalcExtraLineChars;
|
||||||
|
DestroyCaret(True);
|
||||||
UpdateDisplay;
|
UpdateDisplay;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -406,6 +406,14 @@ resourcestring
|
|||||||
SYNS_emcSynEditCommand = 'IDE Command';
|
SYNS_emcSynEditCommand = 'IDE Command';
|
||||||
SYNS_emcWheelScrollDown = 'Wheel scroll down';
|
SYNS_emcWheelScrollDown = 'Wheel scroll down';
|
||||||
SYNS_emcWheelScrollUp = 'Wheel scroll up';
|
SYNS_emcWheelScrollUp = 'Wheel scroll up';
|
||||||
|
SYNS_emcWheelHorizScrollDown = 'Wheel scroll down (Horizontal)';
|
||||||
|
SYNS_emcWheelHorizScrollUp = 'Wheel scroll up (Horizontal)';
|
||||||
|
SYNS_emcWheelVertScrollDown = 'Wheel scroll down (Vertical)';
|
||||||
|
SYNS_emcWheelVertScrollUp = 'Wheel scroll up (Vertical)';
|
||||||
|
SYNS_emcWheelZoomOut = 'Wheel zoom out';
|
||||||
|
SYNS_emcWheelZoomIn = 'Wheel zoom in';
|
||||||
|
SYNS_emcWheelZoomNorm = 'Wheel zoom default';
|
||||||
|
|
||||||
SYNS_emcContextMenuCaretMove_opt = '"Move caret, when selection exists", Never, "Click outside", Always';
|
SYNS_emcContextMenuCaretMove_opt = '"Move caret, when selection exists", Never, "Click outside", Always';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
@ -2401,7 +2401,7 @@ begin
|
|||||||
moTMIgnore: {nothing} ;
|
moTMIgnore: {nothing} ;
|
||||||
moTMDeclarationJump:
|
moTMDeclarationJump:
|
||||||
begin
|
begin
|
||||||
AddCommand(emcMouseLink, False, mbMiddle, ccSingle, cdDown, [ssCtrl], [ssCtrl], emcoMouseLinkShow);
|
AddCommand(emcMouseLink, False, mbMiddle, ccSingle, cdDown, [ssCtrl], [ssCtrl], emcoMouseLinkShow, 999);
|
||||||
AddCommand(emcMouseLink, False, mbMiddle, ccSingle, cdDown, [], [], emcoMouseLinkHide);
|
AddCommand(emcMouseLink, False, mbMiddle, ccSingle, cdDown, [], [], emcoMouseLinkHide);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2417,11 +2417,17 @@ begin
|
|||||||
AddCommand(emcSynEditCommand, False, mbLeft, ccSingle, cdUp, [SYNEDIT_LINK_MODIFIER], [ssShift, ssAlt, ssCtrl], ecFindBlockOtherEnd, 1);
|
AddCommand(emcSynEditCommand, False, mbLeft, ccSingle, cdUp, [SYNEDIT_LINK_MODIFIER], [ssShift, ssAlt, ssCtrl], ecFindBlockOtherEnd, 1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
AddCommand(emcWheelZoomNorm, False, mbMiddle, ccAny, cdDown, [ssCtrl], [ssCtrl]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with FMainActions do begin
|
with FMainActions do begin
|
||||||
AddCommand(emcWheelScrollDown, False, mbWheelDown, ccAny, cdDown, [], []);
|
AddCommand(emcWheelScrollDown, False, mbWheelDown, ccAny, cdDown, [], []);
|
||||||
AddCommand(emcWheelScrollUp, False, mbWheelUp, ccAny, cdDown, [], []);
|
AddCommand(emcWheelScrollUp, False, mbWheelUp, ccAny, cdDown, [], []);
|
||||||
|
|
||||||
|
AddCommand(emcWheelZoomOut, False, mbWheelDown, ccAny, cdDown, [ssCtrl], [ssCtrl]);
|
||||||
|
AddCommand(emcWheelZoomIn, False, mbWheelUp, ccAny, cdDown, [ssCtrl], [ssCtrl]);
|
||||||
|
AddCommand(emcWheelZoomNorm, False, mbMiddle, ccAny, cdDown, [ssCtrl], [ssCtrl]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FTextDrag then
|
if FTextDrag then
|
||||||
|
Loading…
Reference in New Issue
Block a user