mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 12:55:57 +02:00
SynEdit, Mouse Actions: Added IDE-Command
git-svn-id: trunk@20528 -
This commit is contained in:
parent
b81b57c1e4
commit
b1baba1df8
@ -2532,6 +2532,12 @@ begin
|
||||
if (PopupMenu <> nil) and not Handled then
|
||||
PopupMenu.PopUp;
|
||||
end;
|
||||
emcSynEditCommand:
|
||||
begin
|
||||
if AnAction.MoveCaret then
|
||||
MoveCaret;
|
||||
CommandProcessor(AnAction.Option, #0, nil);
|
||||
end;
|
||||
else
|
||||
Result := False; // ACommand was not handled => Fallback to parent Context
|
||||
end;
|
||||
|
@ -61,7 +61,9 @@ const
|
||||
emcCodeFoldExpand = 15;
|
||||
emcCodeFoldContextMenu = 16;
|
||||
|
||||
emcMax = 16;
|
||||
emcSynEditCommand = 17; // Key-Commands
|
||||
|
||||
emcMax = 17;
|
||||
|
||||
// Options
|
||||
emcoSelectionStart = 0;
|
||||
@ -215,6 +217,8 @@ begin
|
||||
emcCodeFoldExpand: Result := SYNS_emcCodeFoldExpand;
|
||||
emcCodeFoldContextMenu: Result := SYNS_emcCodeFoldContextMenu;
|
||||
|
||||
emcSynEditCommand: Result := SYNS_emcSynEditCommand;
|
||||
|
||||
else Result := ''
|
||||
end;
|
||||
end;
|
||||
|
@ -294,6 +294,7 @@ const
|
||||
SYNS_emcCodeFoldExpand = 'Unfold Code';
|
||||
SYNS_emcCodeFoldExpand_opt = 'Nodes,One,All';
|
||||
SYNS_emcCodeFoldContextMenu = 'Fold Menu';
|
||||
SYNS_emcSynEditCommand = 'IDE Command';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -9,18 +9,18 @@ inherited EditorMouseOptionsFrame: TEditorMouseOptionsFrame
|
||||
DesignTop = 209
|
||||
object p2: TPanel[0]
|
||||
Left = 0
|
||||
Height = 380
|
||||
Height = 378
|
||||
Top = 0
|
||||
Width = 610
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 380
|
||||
ClientHeight = 378
|
||||
ClientWidth = 610
|
||||
TabOrder = 0
|
||||
object ActionGrid: TStringGrid
|
||||
AnchorSideBottom.Control = p3
|
||||
Left = 135
|
||||
Height = 380
|
||||
Height = 378
|
||||
Top = 0
|
||||
Width = 475
|
||||
Align = alClient
|
||||
@ -44,13 +44,13 @@ inherited EditorMouseOptionsFrame: TEditorMouseOptionsFrame
|
||||
end
|
||||
object ContextTree: TTreeView
|
||||
Left = 0
|
||||
Height = 380
|
||||
Height = 378
|
||||
Top = 0
|
||||
Width = 130
|
||||
Align = alLeft
|
||||
AutoExpand = True
|
||||
Constraints.MinWidth = 50
|
||||
DefaultItemHeight = 15
|
||||
DefaultItemHeight = 17
|
||||
ReadOnly = True
|
||||
ShowRoot = False
|
||||
TabOrder = 1
|
||||
@ -59,7 +59,7 @@ inherited EditorMouseOptionsFrame: TEditorMouseOptionsFrame
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 130
|
||||
Height = 380
|
||||
Height = 378
|
||||
Top = 0
|
||||
Width = 5
|
||||
AutoSnap = False
|
||||
@ -71,22 +71,22 @@ inherited EditorMouseOptionsFrame: TEditorMouseOptionsFrame
|
||||
AnchorSideBottom.Control = p2
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 35
|
||||
Top = 380
|
||||
Height = 37
|
||||
Top = 378
|
||||
Width = 610
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 35
|
||||
ClientHeight = 37
|
||||
ClientWidth = 610
|
||||
TabOrder = 1
|
||||
object DelButton: TButton
|
||||
AnchorSideLeft.Control = p3
|
||||
AnchorSideTop.Control = p3
|
||||
Left = 0
|
||||
Height = 23
|
||||
Height = 25
|
||||
Top = 6
|
||||
Width = 73
|
||||
Width = 79
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'DelButton'
|
||||
@ -97,10 +97,10 @@ inherited EditorMouseOptionsFrame: TEditorMouseOptionsFrame
|
||||
AnchorSideTop.Control = UpdateButton
|
||||
AnchorSideRight.Control = p3
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 512
|
||||
Height = 23
|
||||
Left = 502
|
||||
Height = 25
|
||||
Top = 6
|
||||
Width = 98
|
||||
Width = 108
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
Caption = 'AddNewButton'
|
||||
@ -110,10 +110,10 @@ inherited EditorMouseOptionsFrame: TEditorMouseOptionsFrame
|
||||
object UpdateButton: TButton
|
||||
AnchorSideTop.Control = p3
|
||||
AnchorSideRight.Control = AddNewButton
|
||||
Left = 413
|
||||
Height = 23
|
||||
Left = 396
|
||||
Height = 25
|
||||
Top = 6
|
||||
Width = 93
|
||||
Width = 100
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
|
@ -4,10 +4,10 @@ LazarusResources.Add('TEditorMouseOptionsFrame','FORMDATA',[
|
||||
'TPF0'#241#24'TEditorMouseOptionsFrame'#23'EditorMouseOptionsFrame'#6'Height'
|
||||
+#3#159#1#5'Width'#3'b'#2#7'Anchors'#11#5'akTop'#0#12'ClientHeight'#3#159#1#11
|
||||
+'ClientWidth'#3'b'#2#7'Visible'#8#10'DesignLeft'#3#246#0#9'DesignTop'#3#209#0
|
||||
+#0#242#2#0#6'TPanel'#2'p2'#4'Left'#2#0#6'Height'#3'|'#1#3'Top'#2#0#5'Width'#3
|
||||
+'b'#2#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3'|'
|
||||
+#0#242#2#0#6'TPanel'#2'p2'#4'Left'#2#0#6'Height'#3'z'#1#3'Top'#2#0#5'Width'#3
|
||||
+'b'#2#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3'z'
|
||||
+#1#11'ClientWidth'#3'b'#2#8'TabOrder'#2#0#0#11'TStringGrid'#10'ActionGrid'#24
|
||||
+'AnchorSideBottom.Control'#7#2'p3'#4'Left'#3#135#0#6'Height'#3'|'#1#3'Top'#2
|
||||
+'AnchorSideBottom.Control'#7#2'p3'#4'Left'#3#135#0#6'Height'#3'z'#1#3'Top'#2
|
||||
+#0#5'Width'#3#219#1#5'Align'#7#8'alClient'#8'AutoEdit'#8#8'ColCount'#2#9#14
|
||||
+'ExtendedSelect'#8#9'FixedCols'#2#0#7'Options'#11#15'goFixedVertLine'#15'goF'
|
||||
+'ixedHorzLine'#10'goVertLine'#10'goHorzLine'#13'goRangeSelect'#11'goColSizin'
|
||||
@ -18,29 +18,29 @@ LazarusResources.Add('TEditorMouseOptionsFrame','FORMDATA',[
|
||||
+'aderSized'#7#21'ActionGridHeaderSized'#11'OnMouseDown'#7#19'ActionGridMouse'
|
||||
+'Down'#11'OnMouseMove'#7#19'ActionGridMouseMove'#9'OnMouseUp'#7#17'ActionGri'
|
||||
+'dMouseUp'#8'OnResize'#7#16'ActionGridResize'#0#0#9'TTreeView'#11'ContextTre'
|
||||
+'e'#4'Left'#2#0#6'Height'#3'|'#1#3'Top'#2#0#5'Width'#3#130#0#5'Align'#7#6'al'
|
||||
+'e'#4'Left'#2#0#6'Height'#3'z'#1#3'Top'#2#0#5'Width'#3#130#0#5'Align'#7#6'al'
|
||||
+'Left'#10'AutoExpand'#9#20'Constraints.MinWidth'#2'2'#17'DefaultItemHeight'#2
|
||||
+#15#8'ReadOnly'#9#8'ShowRoot'#8#8'TabOrder'#2#1#8'OnChange'#7#17'ContextTree'
|
||||
+#17#8'ReadOnly'#9#8'ShowRoot'#8#8'TabOrder'#2#1#8'OnChange'#7#17'ContextTree'
|
||||
+'Change'#7'Options'#11#13'tvoAutoExpand'#17'tvoAutoItemHeight'#16'tvoHideSel'
|
||||
+'ection'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButtons'#12'tvo'
|
||||
+'ShowLines'#11'tvoToolTips'#0#0#0#9'TSplitter'#9'Splitter1'#4'Left'#3#130#0#6
|
||||
+'Height'#3'|'#1#3'Top'#2#0#5'Width'#2#5#8'AutoSnap'#8#0#0#0#242#2#1#6'TPanel'
|
||||
+'Height'#3'z'#1#3'Top'#2#0#5'Width'#2#5#8'AutoSnap'#8#0#0#0#242#2#1#6'TPanel'
|
||||
+#2'p3'#23'AnchorSideRight.Control'#7#2'p2'#20'AnchorSideRight.Side'#7#9'asrB'
|
||||
+'ottom'#24'AnchorSideBottom.Control'#7#2'p2'#21'AnchorSideBottom.Side'#7#9'a'
|
||||
+'srBottom'#4'Left'#2#0#6'Height'#2'#'#3'Top'#3'|'#1#5'Width'#3'b'#2#5'Align'
|
||||
+#7#8'alBottom'#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'#'
|
||||
+'srBottom'#4'Left'#2#0#6'Height'#2'%'#3'Top'#3'z'#1#5'Width'#3'b'#2#5'Align'
|
||||
+#7#8'alBottom'#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'%'
|
||||
+#11'ClientWidth'#3'b'#2#8'TabOrder'#2#1#0#7'TButton'#9'DelButton'#22'AnchorS'
|
||||
+'ideLeft.Control'#7#2'p3'#21'AnchorSideTop.Control'#7#2'p3'#4'Left'#2#0#6'He'
|
||||
+'ight'#2#23#3'Top'#2#6#5'Width'#2'I'#8'AutoSize'#9#17'BorderSpacing.Top'#2#6
|
||||
+'ight'#2#25#3'Top'#2#6#5'Width'#2'O'#8'AutoSize'#9#17'BorderSpacing.Top'#2#6
|
||||
+#7'Caption'#6#9'DelButton'#7'OnClick'#7#14'DelButtonClick'#8'TabOrder'#2#2#0
|
||||
+#0#7'TButton'#12'AddNewButton'#21'AnchorSideTop.Control'#7#12'UpdateButton'
|
||||
+#23'AnchorSideRight.Control'#7#2'p3'#20'AnchorSideRight.Side'#7#9'asrBottom'
|
||||
+#4'Left'#3#0#2#6'Height'#2#23#3'Top'#2#6#5'Width'#2'b'#7'Anchors'#11#5'akTop'
|
||||
+#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#12'AddNewButton'#7'OnClick'#7#17'Ad'
|
||||
+'dNewButtonClick'#8'TabOrder'#2#0#0#0#7'TButton'#12'UpdateButton'#21'AnchorS'
|
||||
+'ideTop.Control'#7#2'p3'#23'AnchorSideRight.Control'#7#12'AddNewButton'#4'Le'
|
||||
+'ft'#3#157#1#6'Height'#2#23#3'Top'#2#6#5'Width'#2']'#7'Anchors'#11#5'akTop'#7
|
||||
+'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#6#19'BorderSpacing.Right'#2
|
||||
+#6#20'BorderSpacing.Bottom'#2#6#7'Caption'#6#12'UpdateButton'#7'OnClick'#7#17
|
||||
+'UpdateButtonClick'#8'TabOrder'#2#1#0#0#0#0
|
||||
+#4'Left'#3#246#1#6'Height'#2#25#3'Top'#2#6#5'Width'#2'l'#7'Anchors'#11#5'akT'
|
||||
+'op'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#12'AddNewButton'#7'OnClick'#7#17
|
||||
+'AddNewButtonClick'#8'TabOrder'#2#0#0#0#7'TButton'#12'UpdateButton'#21'Ancho'
|
||||
+'rSideTop.Control'#7#2'p3'#23'AnchorSideRight.Control'#7#12'AddNewButton'#4
|
||||
+'Left'#3#140#1#6'Height'#2#25#3'Top'#2#6#5'Width'#2'd'#7'Anchors'#11#5'akTop'
|
||||
+#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#6#19'BorderSpacing.Right'
|
||||
+#2#6#20'BorderSpacing.Bottom'#2#6#7'Caption'#6#12'UpdateButton'#7'OnClick'#7
|
||||
+#17'UpdateButtonClick'#8'TabOrder'#2#1#0#0#0#0
|
||||
]);
|
||||
|
@ -27,7 +27,7 @@ interface
|
||||
uses
|
||||
LResources, EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, sysutils,
|
||||
StdCtrls, ExtCtrls, Classes, Controls, LCLProc, Grids, ComCtrls, Dialogs,
|
||||
SynEditMouseCmds, MouseActionDialog, math;
|
||||
SynEditMouseCmds, MouseActionDialog, math, KeyMapping;
|
||||
|
||||
type
|
||||
|
||||
@ -57,6 +57,8 @@ type
|
||||
procedure ActionGridHeaderSized(Sender: TObject; IsColumn: Boolean; Index: Integer);
|
||||
procedure ActionGridResize(Sender: TObject);
|
||||
private
|
||||
FKeyMap: TKeyCommandRelationList;
|
||||
|
||||
FMainNode, FSelNode: TTreeNode;
|
||||
FGutterNode: TTreeNode;
|
||||
FGutterFoldNode, FGutterFoldExpNode, FGutterFoldColNode: TTreeNode;
|
||||
@ -97,7 +99,7 @@ const
|
||||
MMoveName: Array [Boolean] of String = (dlgMouseOptMoveMouseFalse, dlgMouseOptMoveMouseTrue);
|
||||
var
|
||||
act: TSynEditMouseAction;
|
||||
i: Integer;
|
||||
i, j: Integer;
|
||||
optlist: TStringList;
|
||||
function ShiftName(ss: TShiftStateEnum): String;
|
||||
begin
|
||||
@ -124,9 +126,16 @@ begin
|
||||
ActionGrid.Cells[6, i] := ShiftName(ssCtrl);
|
||||
ActionGrid.Cells[7, i] := MMoveName[act.MoveCaret];
|
||||
ActionGrid.Cells[8, i] := '';
|
||||
optlist.CommaText := MouseCommandConfigName(act.Command);
|
||||
if act.Option < optlist.Count-1 then
|
||||
ActionGrid.Cells[8, i] := optlist[act.Option+1] +' ('+optlist[0]+')';
|
||||
if act.Command = emcSynEditCommand then begin
|
||||
j := KeyMapIndexOfCommand(FKeyMap, Act.Option);
|
||||
if (j >= 0) and (j < FKeyMap.RelationCount) then
|
||||
ActionGrid.Cells[8, i] := FKeyMap.Relations[j].GetLocalizedName;
|
||||
end
|
||||
else begin
|
||||
optlist.CommaText := MouseCommandConfigName(act.Command);
|
||||
if act.Option < optlist.Count-1 then
|
||||
ActionGrid.Cells[8, i] := optlist[act.Option+1] +' ('+optlist[0]+')';
|
||||
end;
|
||||
end;
|
||||
optlist.Free;
|
||||
ActionGrid.Row := 1;
|
||||
@ -194,6 +203,7 @@ var
|
||||
begin
|
||||
if FCurActions = nil then exit;
|
||||
|
||||
ChangeDlg.KeyMap := FKeyMap;
|
||||
ChangeDlg.ResetInputs;
|
||||
if ChangeDlg.ShowModal = mrOK then begin
|
||||
try
|
||||
@ -222,6 +232,7 @@ begin
|
||||
if (ActionGrid.Row-1 >= FCurActions.Count) or (ActionGrid.Row < 1) then exit;
|
||||
|
||||
MAct := TSynEditMouseAction(ActionGrid.Objects[0, ActionGrid.Row]);
|
||||
ChangeDlg.KeyMap := FKeyMap;
|
||||
ChangeDlg.ReadFromAction(MAct);
|
||||
if ChangeDlg.ShowModal = mrOK then begin
|
||||
try
|
||||
@ -392,6 +403,8 @@ begin
|
||||
FGutterActionsFoldExp.Assign(MouseGutterActionsFoldExp);
|
||||
FGutterActionsFoldCol.Assign(MouseGutterActionsFoldCol);
|
||||
FGutterActionsLines.Assign(MouseGutterActionsLines);
|
||||
|
||||
FKeyMap := KeyMap;
|
||||
end;
|
||||
ContextTree.Selected := FMainNode;
|
||||
end;
|
||||
|
@ -1211,6 +1211,7 @@ resourcestring
|
||||
dlgMouseOptErrorDupText = 'This entry conflicts with an existing entry';
|
||||
dlgMouseOptDescAction = 'Action';
|
||||
dlgMouseOptDescButton = 'Click';
|
||||
dlgMouseOptionsynCommand = 'IDE-Command';
|
||||
dlgUseDividerDraw = 'Divider drawing';
|
||||
dlgCopyWordAtCursorOnCopyNone = 'Copy word on copy none';
|
||||
dlgHomeKeyJumpsToNearestStart = 'Home key jumps to nearest start';
|
||||
|
@ -196,12 +196,16 @@ object MouseaActionDialog: TMouseaActionDialog
|
||||
AnchorSideLeft.Control = ActionLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 76
|
||||
Height = 23
|
||||
Top = 6
|
||||
Width = 196
|
||||
Width = 280
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
ItemHeight = 15
|
||||
OnChange = ActionBoxChange
|
||||
Style = csDropDownList
|
||||
@ -223,11 +227,15 @@ object MouseaActionDialog: TMouseaActionDialog
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = OptLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 182
|
||||
Height = 23
|
||||
Top = 57
|
||||
Width = 100
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
Enabled = False
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
|
@ -65,17 +65,21 @@ LazarusResources.Add('TMouseaActionDialog','FORMDATA',[
|
||||
+'asrBottom'#4'Left'#2'L'#6'Height'#2#19#3'Top'#2'#'#5'Width'#2'Q'#17'BorderS'
|
||||
,'pacing.Top'#2#6#7'Caption'#6#10'CaretCheck'#8'TabOrder'#2#1#0#0#9'TComboBox'
|
||||
+#9'ActionBox'#22'AnchorSideLeft.Control'#7#11'ActionLabel'#19'AnchorSideLeft'
|
||||
+'.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2'L'#6'H'
|
||||
+'eight'#2#23#3'Top'#2#6#5'Width'#3#196#0#18'BorderSpacing.Left'#2#6#17'Borde'
|
||||
+'rSpacing.Top'#2#6#10'ItemHeight'#2#15#8'OnChange'#7#15'ActionBoxChange'#5'S'
|
||||
+'tyle'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#12'TButtonPanel'#12'ButtonPa'
|
||||
+'nel1'#21'AnchorSideTop.Control'#7#10'BtnDefault'#18'AnchorSideTop.Side'#7#9
|
||||
+'.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRig'
|
||||
+'ht.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2'L'
|
||||
+#6'Height'#2#23#3'Top'#2#6#5'Width'#3#24#1#7'Anchors'#11#5'akTop'#6'akLeft'#7
|
||||
+'akRight'#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#19'BorderSp'
|
||||
+'acing.Right'#2#6#10'ItemHeight'#2#15#8'OnChange'#7#15'ActionBoxChange'#5'St'
|
||||
+'yle'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#12'TButtonPanel'#12'ButtonPan'
|
||||
+'el1'#21'AnchorSideTop.Control'#7#10'BtnDefault'#18'AnchorSideTop.Side'#7#9
|
||||
+'asrBottom'#4'Left'#2#6#6'Height'#2'"'#3'Top'#3#173#0#5'Width'#3'^'#1#7'Anch'
|
||||
+'ors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabOrder'#2#10#11'Sho'
|
||||
+'wButtons'#11#4'pbOK'#8'pbCancel'#0#0#0#9'TComboBox'#6'OptBox'#22'AnchorSide'
|
||||
+'Left.Control'#7#8'OptLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'Ancho'
|
||||
+'rSideTop.Control'#7#8'OptLabel'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Lef'
|
||||
+'t'#3#182#0#6'Height'#2#23#3'Top'#2'9'#5'Width'#2'd'#18'BorderSpacing.Left'#2
|
||||
+#6#7'Enabled'#8#10'ItemHeight'#2#15#5'Style'#7#14'csDropDownList'#8'TabOrder'
|
||||
+#2#11#0#0#0
|
||||
+'rSideTop.Control'#7#8'OptLabel'#18'AnchorSideTop.Side'#7#9'asrCenter'#23'An'
|
||||
+'chorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4
|
||||
+'Left'#3#182#0#6'Height'#2#23#3'Top'#2'9'#5'Width'#3#174#0#7'Anchors'#11#5'a'
|
||||
+'kTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#6#19'BorderSpacing.Ri'
|
||||
+'ght'#2#6#7'Enabled'#8#10'ItemHeight'#2#15#5'Style'#7#14'csDropDownList'#8'T'
|
||||
+'abOrder'#2#11#0#0#0
|
||||
]);
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
StdCtrls, ButtonPanel, SynEditMouseCmds, LazarusIDEStrConsts;
|
||||
StdCtrls, ButtonPanel, SynEditMouseCmds, LazarusIDEStrConsts, KeyMapping, IDECommands;
|
||||
|
||||
const
|
||||
ButtonName: Array [TMouseButton] of String =
|
||||
@ -41,13 +41,18 @@ type
|
||||
procedure CapturePanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
|
||||
X, Y: Integer);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
FKeyMap: TKeyCommandRelationList;
|
||||
public
|
||||
{ public declarations }
|
||||
Procedure ResetInputs;
|
||||
Procedure ReadFromAction(MAct: TSynEditMouseAction);
|
||||
Procedure WriteToAction(MAct: TSynEditMouseAction);
|
||||
property KeyMap: TKeyCommandRelationList read FKeyMap write FKeyMap;
|
||||
end;
|
||||
|
||||
function KeyMapIndexOfCommand(AKeyMap: TKeyCommandRelationList; ACmd: Word) : Integer;
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
@ -56,6 +61,16 @@ const
|
||||
IndexToBtn: array [0..2] of TMouseButton = (mbLeft, mbRight, mbMiddle);
|
||||
IndexToClick: array [0..4] of TSynMAClickCount = (ccSingle, ccDouble, ccTriple, ccQuad, ccAny);
|
||||
|
||||
function KeyMapIndexOfCommand(AKeyMap: TKeyCommandRelationList; ACmd: Word): Integer;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to AKeyMap.RelationCount - 1 do
|
||||
if AKeyMap.Relations[i].Command = ACmd then
|
||||
exit(i);
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
{ MouseaActionDialog }
|
||||
|
||||
procedure TMouseaActionDialog.FormCreate(Sender: TObject);
|
||||
@ -108,18 +123,36 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMouseaActionDialog.ActionBoxChange(Sender: TObject);
|
||||
var
|
||||
ACmd: TSynEditorMouseCommand;
|
||||
i: Integer;
|
||||
begin
|
||||
OptBox.Items.Clear;
|
||||
OptBox.Items.CommaText := MouseCommandConfigName
|
||||
(TSynEditorMouseCommand(PtrUInt(Pointer(ActionBox.items.Objects[ActionBox.ItemIndex]))));
|
||||
if OptBox.Items.Count > 0 then begin
|
||||
OptLabel.Caption := OptBox.Items[0];
|
||||
OptBox.Items.Delete(0);
|
||||
ACmd := TSynEditorMouseCommand(PtrUInt(Pointer(ActionBox.items.Objects[ActionBox.ItemIndex])));
|
||||
if ACmd = emcSynEditCommand then begin
|
||||
OptBox.Enabled := True;
|
||||
OptBox.Clear;
|
||||
for i := 0 to KeyMap.RelationCount - 1 do
|
||||
if (KeyMap.Relations[i].Category.Scope = IDECmdScopeSrcEdit) or
|
||||
(KeyMap.Relations[i].Category.Scope = IDECmdScopeSrcEditOnly)
|
||||
then
|
||||
OptBox.Items.AddObject(KeyMap.Relations[i].GetLocalizedName,
|
||||
TObject(Pointer(PtrUInt(KeyMap.Relations[i].Command))));
|
||||
OptLabel.Caption := dlgMouseOptionsynCommand;
|
||||
OptBox.ItemIndex := 0;
|
||||
end else begin
|
||||
OptLabel.Caption := '';
|
||||
OptBox.Enabled := False
|
||||
end
|
||||
else
|
||||
begin
|
||||
OptBox.Items.CommaText := MouseCommandConfigName(ACmd);
|
||||
if OptBox.Items.Count > 0 then begin
|
||||
OptLabel.Caption := OptBox.Items[0];
|
||||
OptBox.Items.Delete(0);
|
||||
OptBox.Enabled := True;
|
||||
OptBox.ItemIndex := 0;
|
||||
end else begin
|
||||
OptLabel.Caption := '';
|
||||
OptBox.Enabled := False
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -150,16 +183,12 @@ begin
|
||||
CtrlCheck.Checked := (ssCtrl in MAct.ShiftMask) and (ssCtrl in MAct.Shift);
|
||||
if not(ssCtrl in MAct.ShiftMask) then CtrlCheck.State := cbGrayed;
|
||||
|
||||
OptBox.Items.Clear;
|
||||
OptBox.Items.CommaText := MouseCommandConfigName(MAct.Command);
|
||||
if OptBox.Items.Count > 0 then begin
|
||||
OptLabel.Caption := OptBox.Items[0];
|
||||
OptBox.Items.Delete(0);
|
||||
OptBox.Enabled := True;
|
||||
OptBox.ItemIndex := MAct.Option;
|
||||
end else begin
|
||||
OptLabel.Caption := '';
|
||||
OptBox.Enabled := False
|
||||
ActionBoxChange(nil);
|
||||
if OptBox.Enabled then begin
|
||||
if MAct.Command = emcSynEditCommand then
|
||||
OptBox.ItemIndex := OptBox.Items.IndexOfObject(TObject(Pointer(PtrUInt(MAct.Option))))
|
||||
else
|
||||
OptBox.ItemIndex := MAct.Option;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -181,8 +210,13 @@ begin
|
||||
if AltCheck.Checked then MAct.Shift := MAct.Shift + [ssAlt];
|
||||
if CtrlCheck.Checked then MAct.Shift := MAct.Shift + [ssCtrl];
|
||||
|
||||
if OptBox.Enabled then
|
||||
MAct.Option := OptBox.ItemIndex;
|
||||
if OptBox.Enabled then begin
|
||||
if MAct.Command = emcSynEditCommand then begin
|
||||
MAct.Option := TSynEditorMouseCommandOpt(PtrUInt(Pointer(OptBox.Items.Objects[OptBox.ItemIndex])));
|
||||
end
|
||||
else
|
||||
MAct.Option := OptBox.ItemIndex;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
Loading…
Reference in New Issue
Block a user