From e2ce0db6bc7bd711c90119e678ea6fdd450de0b6 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 4 Jun 2009 01:18:42 +0000 Subject: [PATCH] EditorOptions/Mouse: added extra option; Full line select (issue #12302) / Mouselink on middle btn (issue #1878) git-svn-id: trunk@20389 - --- components/synedit/synedit.pp | 6 +- components/synedit/syneditmousecmds.pp | 35 ++++- components/synedit/syneditstrconst.pp | 6 +- ide/frames/editor_mouseaction_options.lfm | 2 +- ide/frames/editor_mouseaction_options.lrs | 2 +- ide/frames/editor_mouseaction_options.pas | 8 ++ ide/lazarusidestrconsts.pas | 1 + ide/mouseactiondialog.lfm | 64 +++++++--- ide/mouseactiondialog.lrs | 149 ++++++++++++---------- ide/mouseactiondialog.pas | 36 +++++- 10 files changed, 214 insertions(+), 95 deletions(-) diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 069c6032e5..018a3297ad 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -2487,7 +2487,7 @@ procedure TCustomSynEdit.HandleMouseAction(Button: TMouseButton; emcSelectLine: begin if not (eoNoSelection in fOptions) then - SetLineBlock(LogCaretXY); + SetLineBlock(LogCaretXY, AnAction.Option = emcoSelectLineFull); MouseCapture := FALSE; end; emcSelectPara: @@ -5139,7 +5139,9 @@ begin // todo: check FMouseSelActions if over selection? for i := 0 to FMouseActions.Count - 1 do begin act := FMouseActions.Items[i]; - if (act.Command = emcMouseLink) and act.IsMatchingShiftState(AShift) then + if (act.Command = emcMouseLink) and (act.Option = emcoMouseLinkShow) and + act.IsMatchingShiftState(AShift) + then exit(True); end; end; diff --git a/components/synedit/syneditmousecmds.pp b/components/synedit/syneditmousecmds.pp index 0388dcd8e7..52b4279b36 100644 --- a/components/synedit/syneditmousecmds.pp +++ b/components/synedit/syneditmousecmds.pp @@ -57,9 +57,16 @@ const emcContextMenu = 12; emcMax = 12; + // Options + emcoSelectLineSmart = 0; + emcoSelectLineFull = 1; + emcoMouseLinkShow = 0; + emcoMouseLinkHide = 1; + type TSynEditorMouseCommand = type word; + TSynEditorMouseCommandOpt = type word; TSynMAClickCount = (ccSingle, ccDouble, ccTriple, ccQuad); TSynMAClickDir = (cdUp, cdDown); ESynMouseCmdError = class(Exception); @@ -69,6 +76,7 @@ type TSynEditMouseAction = class(TCollectionItem) private FClickDir: TSynMAClickDir; + FOption: TSynEditorMouseCommandOpt; FShift, FShiftMask: TShiftState; FButton: TMouseButton; FClickCount: TSynMAClickCount; @@ -79,6 +87,7 @@ type procedure SetClickDir(const AValue: TSynMAClickDir); procedure SetCommand(const AValue: TSynEditorMouseCommand); procedure SetMoveCaret(const AValue: Boolean); + procedure SetOption(const AValue: TSynEditorMouseCommandOpt); procedure SetShift(const AValue: TShiftState); procedure SetShiftMask(const AValue: TShiftState); protected @@ -97,6 +106,7 @@ type property ClickDir: TSynMAClickDir read FClickDir write SetClickDir; property Command: TSynEditorMouseCommand read FCommand write SetCommand; property MoveCaret: Boolean read FMoveCaret write SetMoveCaret; + property Option: TSynEditorMouseCommandOpt read FOption write SetOption; end; { TSynEditMouseActions } @@ -139,6 +149,7 @@ type end; function MouseCommandName(emc: TSynEditorMouseCommand): String; + function MouseCommandConfigName(emc: TSynEditorMouseCommand): String; const SYNEDIT_LINK_MODIFIER = {$IFDEF LCLcarbon}ssMeta{$ELSE}ssCtrl{$ENDIF}; @@ -165,6 +176,15 @@ begin end; end; +function MouseCommandConfigName(emc: TSynEditorMouseCommand): String; +begin + case emc of + emcSelectLine: Result := SYNS_emcSelectLine_opt; + emcMouseLink: Result := SYNS_emcMouseLink_opt; + else Result := '' + end; +end; + { TSynEditMouseAction } procedure TSynEditMouseAction.SetButton(const AValue: TMouseButton); @@ -207,6 +227,14 @@ begin TSynEditMouseActions(Collection).AssertNoConflict(self); end; +procedure TSynEditMouseAction.SetOption(const AValue: TSynEditorMouseCommandOpt); +begin + if FOption = AValue then exit; + FOption := AValue; + if Collection <> nil then + TSynEditMouseActions(Collection).AssertNoConflict(self); +end; + procedure TSynEditMouseAction.SetShift(const AValue: TShiftState); begin if FShift = AValue then exit; @@ -239,6 +267,7 @@ begin FShift := TSynEditMouseAction(Source).Shift; FShiftMask := TSynEditMouseAction(Source).ShiftMask; FMoveCaret := TSynEditMouseAction(Source).MoveCaret; + FOption := TSynEditMouseAction(Source).Option; end else inherited Assign(Source); if Collection <> nil then @@ -262,8 +291,9 @@ begin and (Other.ClickCount = self.ClickCount) and (Other.ClickDir = self.ClickDir) and (Other.Shift * self.ShiftMask = self.Shift * Other.ShiftMask) - and ((Other.Command <> self.Command) or - (Other.MoveCaret <> self.MoveCaret)) // Only conflicts, if Command differs + and ((Other.Command <> self.Command) or // Only conflicts, if Command differs + (Other.MoveCaret <> self.MoveCaret) or + (Other.Option <> self.Option) ) and not(Other.IsFallback xor self.IsFallback); end; @@ -276,6 +306,7 @@ begin and (Other.Shift = self.Shift) and (Other.ShiftMask = self.ShiftMask) and ((Other.Command = self.Command) or IgnoreCmd) + and ((Other.Option = self.Option) or IgnoreCmd) and ((Other.MoveCaret = self.MoveCaret) or IgnoreCmd); end; diff --git a/components/synedit/syneditstrconst.pp b/components/synedit/syneditstrconst.pp index 647f5e4dec..6cb8b98053 100644 --- a/components/synedit/syneditstrconst.pp +++ b/components/synedit/syneditstrconst.pp @@ -279,12 +279,14 @@ const SYNS_emcContinueSelections = 'Continue Selection'; SYNS_emcStartColumnSelections = 'Start Column Selection'; SYNS_emcContinueColumnSelections = 'Continue Column Selection'; - SYNS_emcSelectWord = 'Select Word'; - SYNS_emcSelectLine = 'Select Line'; + SYNS_emcSelectWord = 'Select Word'; + SYNS_emcSelectLine = 'Select Line'; + SYNS_emcSelectLine_opt = '"Include spaces",no,yes'; SYNS_emcSelectPara = 'Select Paragraph'; SYNS_emcStartDragMove = 'Drag Selection'; SYNS_emcPasteSelection = 'Quick Paste Selection'; SYNS_emcMouseLink = 'Source Link'; + SYNS_emcMouseLink_opt = 'Underline,yes, no'; SYNS_emcContextMenu = 'Popup Menu'; implementation diff --git a/ide/frames/editor_mouseaction_options.lfm b/ide/frames/editor_mouseaction_options.lfm index 50093297f0..925afafbb9 100644 --- a/ide/frames/editor_mouseaction_options.lfm +++ b/ide/frames/editor_mouseaction_options.lfm @@ -25,7 +25,7 @@ inherited EditorMouseOptionsFrame: TEditorMouseOptionsFrame Width = 475 Align = alClient AutoEdit = False - ColCount = 8 + ColCount = 9 ExtendedSelect = False FixedCols = 0 Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goRowSelect, goSmoothScroll] diff --git a/ide/frames/editor_mouseaction_options.lrs b/ide/frames/editor_mouseaction_options.lrs index c9eb231d7e..0e9edf5206 100644 --- a/ide/frames/editor_mouseaction_options.lrs +++ b/ide/frames/editor_mouseaction_options.lrs @@ -8,7 +8,7 @@ LazarusResources.Add('TEditorMouseOptionsFrame','FORMDATA',[ +'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'z'#1#3'Top'#2 - +#0#5'Width'#3#219#1#5'Align'#7#8'alClient'#8'AutoEdit'#8#8'ColCount'#2#8#14 + +#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' +'g'#11'goRowSelect'#14'goSmoothScroll'#0#8'RowCount'#2#1#10'ScrollBars'#7#14 diff --git a/ide/frames/editor_mouseaction_options.pas b/ide/frames/editor_mouseaction_options.pas index b1d61b3f66..bd7d2811af 100644 --- a/ide/frames/editor_mouseaction_options.pas +++ b/ide/frames/editor_mouseaction_options.pas @@ -85,6 +85,7 @@ const var act: TSynEditMouseAction; i: Integer; + optlist: TStringList; function ShiftName(ss: TShiftStateEnum): String; begin if not(ss in act.ShiftMask) then exit(dlgMouseOptModKeyIgnore); @@ -97,6 +98,7 @@ begin FCurNode := Node; FCurActions := TSynEditMouseActions(Node.Data); ActionGrid.RowCount := FCurActions.Count + 1; + optlist := TStringlist.Create; for i := 1 to FCurActions.Count do begin act := FCurActions[i-1]; ActionGrid.Cells[0, i] := act.DisplayName; @@ -107,7 +109,12 @@ begin ActionGrid.Cells[5, i] := ShiftName(ssAlt); 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]+')'; end; + optlist.Free; ActionGrid.Row := 1; end; @@ -272,6 +279,7 @@ begin ActionGrid.Cells[5,0] := dlgMouseOptHeadAlt; ActionGrid.Cells[6,0] := dlgMouseOptHeadCtrl; ActionGrid.Cells[7,0] := dlgMouseOptHeadCaret; + ActionGrid.Cells[8,0] := dlgMouseOptHeadOpt; ActionGrid.ColWidths[0] := 100; ActionGridHeaderSized(nil, true, 0); diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 5d73e158e4..c1a464b610 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1173,6 +1173,7 @@ resourcestring dlgMouseOptHeadAlt = 'Alt'; dlgMouseOptHeadCtrl = 'Ctrl'; dlgMouseOptHeadCaret = 'Caret'; + dlgMouseOptHeadOpt = 'Option'; dlgMouseOptBtnLeft = 'Left'; dlgMouseOptBtnMiddle = 'Middle'; dlgMouseOptBtnRight = 'Right'; diff --git a/ide/mouseactiondialog.lfm b/ide/mouseactiondialog.lfm index 2c2648d877..c0b896e6e8 100644 --- a/ide/mouseactiondialog.lfm +++ b/ide/mouseactiondialog.lfm @@ -1,13 +1,13 @@ -object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog +object MouseaActionDialog: TMouseaActionDialog Left = 283 - Height = 185 + Height = 213 Top = 237 Width = 362 AutoSize = True BorderIcons = [biSystemMenu] BorderStyle = bsDialog - Caption = 'EditorMouseOptionsChangeDialog' - ClientHeight = 185 + Caption = 'MouseaActionDialog' + ClientHeight = 213 ClientWidth = 362 OnCreate = FormCreate Position = poScreenCenter @@ -20,7 +20,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideRight.Side = asrBottom Left = 6 Height = 16 - Top = 63 + Top = 91 Width = 64 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 6 @@ -39,6 +39,22 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog Caption = 'ActionLabel' ParentColor = False end + object OptLabel: TLabel + AnchorSideLeft.Control = CaretCheck + AnchorSideTop.Control = CaretCheck + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = ButtonBox + AnchorSideRight.Side = asrBottom + Left = 76 + Height = 16 + Top = 60 + Width = 100 + Anchors = [akTop, akLeft, akRight] + AutoSize = False + BorderSpacing.Top = 6 + Caption = ' ' + ParentColor = False + end object CapturePanel: TPanel AnchorSideLeft.Control = Owner AnchorSideTop.Control = ShiftCheck @@ -48,7 +64,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideBottom.Side = asrBottom Left = 6 Height = 25 - Top = 114 + Top = 142 Width = 262 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Left = 6 @@ -67,7 +83,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideTop.Side = asrBottom Left = 76 Height = 19 - Top = 89 + Top = 117 Width = 77 AllowGrayed = True BorderSpacing.Top = 6 @@ -81,7 +97,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideTop.Side = asrCenter Left = 159 Height = 19 - Top = 89 + Top = 117 Width = 68 AllowGrayed = True BorderSpacing.Left = 6 @@ -95,7 +111,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideTop.Side = asrCenter Left = 233 Height = 19 - Top = 89 + Top = 117 Width = 72 AllowGrayed = True BorderSpacing.Left = 6 @@ -112,7 +128,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideBottom.Side = asrBottom Left = 274 Height = 25 - Top = 114 + Top = 142 Width = 82 Anchors = [akTop, akRight] AutoSize = True @@ -130,7 +146,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideTop.Side = asrCenter Left = 288 Height = 19 - Top = 62 + Top = 90 Width = 68 BorderSpacing.Around = 6 Caption = 'DirCheck' @@ -142,7 +158,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideTop.Control = ButtonBox Left = 182 Height = 23 - Top = 60 + Top = 88 Width = 100 BorderSpacing.Left = 6 ItemHeight = 15 @@ -152,14 +168,14 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog object ButtonBox: TComboBox AnchorSideLeft.Control = BtnLabel AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = CaretCheck + AnchorSideTop.Control = OptLabel AnchorSideTop.Side = asrBottom Left = 76 Height = 23 - Top = 60 + Top = 88 Width = 100 BorderSpacing.Left = 6 - BorderSpacing.Top = 6 + BorderSpacing.Top = 12 ItemHeight = 15 Style = csDropDownList TabOrder = 3 @@ -187,6 +203,7 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog BorderSpacing.Left = 6 BorderSpacing.Top = 6 ItemHeight = 15 + OnChange = ActionBoxChange Style = csDropDownList TabOrder = 0 end @@ -195,10 +212,25 @@ object EditorMouseOptionsChangeDialog: TEditorMouseOptionsChangeDialog AnchorSideTop.Side = asrBottom Left = 6 Height = 34 - Top = 145 + Top = 173 Width = 350 Anchors = [akTop, akLeft, akRight, akBottom] TabOrder = 10 ShowButtons = [pbOK, pbCancel] end + object OptBox: TComboBox + AnchorSideLeft.Control = OptLabel + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = OptLabel + AnchorSideTop.Side = asrCenter + Left = 182 + Height = 23 + Top = 57 + Width = 100 + BorderSpacing.Left = 6 + Enabled = False + ItemHeight = 15 + Style = csDropDownList + TabOrder = 11 + end end diff --git a/ide/mouseactiondialog.lrs b/ide/mouseactiondialog.lrs index 1ee349a77d..4d4c813082 100644 --- a/ide/mouseactiondialog.lrs +++ b/ide/mouseactiondialog.lrs @@ -1,72 +1,83 @@ { This is an automatically generated lazarus resource file } -LazarusResources.Add('TEditorMouseOptionsChangeDialog','FORMDATA',[ - 'TPF0'#31'TEditorMouseOptionsChangeDialog'#30'EditorMouseOptionsChangeDialog' - +#4'Left'#3#27#1#6'Height'#3#185#0#3'Top'#3#237#0#5'Width'#3'j'#1#8'AutoSize' - +#9#11'BorderIcons'#11#12'biSystemMenu'#0#11'BorderStyle'#7#8'bsDialog'#7'Cap' - +'tion'#6#30'EditorMouseOptionsChangeDialog'#12'ClientHeight'#3#185#0#11'Clie' - +'ntWidth'#3'j'#1#8'OnCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenCente' - +'r'#10'LCLVersion'#6#6'0.9.27'#0#6'TLabel'#8'BtnLabel'#22'AnchorSideLeft.Con' - +'trol'#7#5'Owner'#21'AnchorSideTop.Control'#7#9'ButtonBox'#18'AnchorSideTop.' - +'Side'#7#9'asrCenter'#23'AnchorSideRight.Control'#7#11'ActionLabel'#20'Ancho' - +'rSideRight.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#16#3'Top'#2'?'#5'Wi' - +'dth'#2'@'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Le' - +'ft'#2#6#7'Caption'#6#8'BtnLabel'#11'ParentColor'#8#0#0#6'TLabel'#11'ActionL' - +'abel'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#9'A' - +'ctionBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#16#3 - +'Top'#2#9#5'Width'#2'@'#18'BorderSpacing.Left'#2#6#7'Caption'#6#11'ActionLab' - +'el'#11'ParentColor'#8#0#0#6'TPanel'#12'CapturePanel'#22'AnchorSideLeft.Cont' - +'rol'#7#5'Owner'#21'AnchorSideTop.Control'#7#10'ShiftCheck'#18'AnchorSideTop' - +'.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#10'BtnDefault'#24'Ancho' - +'rSideBottom.Control'#7#10'BtnDefault'#21'AnchorSideBottom.Side'#7#9'asrBott' - +'om'#4'Left'#2#6#6'Height'#2#25#3'Top'#2'r'#5'Width'#3#6#1#7'Anchors'#11#5'a' - +'kTop'#6'akLeft'#7'akRight'#8'akBottom'#0#18'BorderSpacing.Left'#2#6#17'Bord' - +'erSpacing.Top'#2#6#19'BorderSpacing.Right'#2#6#10'BevelOuter'#7#9'bvLowered' - +#10'BevelWidth'#2#2#5'Color'#7#11'clBtnShadow'#11'ParentColor'#8#8'TabOrder' - +#2#2#11'OnMouseDown'#7#21'CapturePanelMouseDown'#0#0#9'TCheckBox'#10'ShiftCh' - +'eck'#22'AnchorSideLeft.Control'#7#9'ButtonBox'#21'AnchorSideTop.Control'#7#9 - +'ButtonBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'L'#6'Height'#2#19 - +#3'Top'#2'Y'#5'Width'#2'M'#11'AllowGrayed'#9#17'BorderSpacing.Top'#2#6#7'Cap' - +'tion'#6#10'ShiftCheck'#8'TabOrder'#2#6#0#0#9'TCheckBox'#8'AltCheck'#22'Anch' - +'orSideLeft.Control'#7#10'ShiftCheck'#19'AnchorSideLeft.Side'#7#9'asrBottom' - +#21'AnchorSideTop.Control'#7#10'ShiftCheck'#18'AnchorSideTop.Side'#7#9'asrCe' - +'nter'#4'Left'#3#159#0#6'Height'#2#19#3'Top'#2'Y'#5'Width'#2'D'#11'AllowGray' - +'ed'#9#18'BorderSpacing.Left'#2#6#7'Caption'#6#8'AltCheck'#8'TabOrder'#2#7#0 - +#0#9'TCheckBox'#9'CtrlCheck'#22'AnchorSideLeft.Control'#7#8'AltCheck'#19'Anc' - +'horSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#10'ShiftCheck' - +#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#3#233#0#6'Height'#2#19#3'Top' - +#2'Y'#5'Width'#2'H'#11'AllowGrayed'#9#18'BorderSpacing.Left'#2#6#7'Caption'#6 - +#9'CtrlCheck'#8'TabOrder'#2#8#0#0#7'TButton'#10'BtnDefault'#22'AnchorSideLef' - +'t.Control'#7#9'CtrlCheck'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorS' - +'ideTop.Control'#7#10'ShiftCheck'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'A' - +'nchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom' - +#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#18#1#6'Height'#2#25#3'To' - +'p'#2'r'#5'Width'#2'R'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#18 - +'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#19'BorderSpacing.Right'#2 - +#6#7'Caption'#6#10'BtnDefault'#7'OnClick'#7#15'BtnDefaultClick'#8'TabOrder'#2 - +#9#0#0#9'TCheckBox'#8'DirCheck'#22'AnchorSideLeft.Control'#7#8'ClickBox'#19 - +'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#8'ClickBox' - +#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#3' '#1#6'Height'#2#19#3'Top'#2 - +'>'#5'Width'#2'D'#20'BorderSpacing.Around'#2#6#7'Caption'#6#8'DirCheck'#8'Ta' - +'bOrder'#2#5#0#0#9'TComboBox'#8'ClickBox'#22'AnchorSideLeft.Control'#7#9'But' - +'tonBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#9 - +'ButtonBox'#4'Left'#3#182#0#6'Height'#2#23#3'Top'#2'<'#5'Width'#2'd'#18'Bord' - +'erSpacing.Left'#2#6#10'ItemHeight'#2#15#5'Style'#7#14'csDropDownList'#8'Tab' - +'Order'#2#4#0#0#9'TComboBox'#9'ButtonBox'#22'AnchorSideLeft.Control'#7#8'Btn' - +'Label'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#10 - +'CaretCheck'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'L'#6'Height'#2 - +#23#3'Top'#2'<'#5'Width'#2'd'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.To' - +'p'#2#6#10'ItemHeight'#2#15#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#3#0#0 - +#9'TCheckBox'#10'CaretCheck'#22'AnchorSideLeft.Control'#7#9'ActionBox'#21'An' - +'chorSideTop.Control'#7#9'ActionBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4 - +'Left'#2'L'#6'Height'#2#19#3'Top'#2'#'#5'Width'#2'Q'#17'BorderSpacing.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'as' - +'rBottom'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2'L'#6'Height'#2#23#3 - +'Top'#2#6#5'Width'#3#196#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2 - +#6#10'ItemHeight'#2#15#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#12 - ,'TButtonPanel'#12'ButtonPanel1'#21'AnchorSideTop.Control'#7#10'BtnDefault'#18 - +'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2'"'#3'Top'#3#145#0 - +#5'Width'#3'^'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8 - +'TabOrder'#2#10#11'ShowButtons'#11#4'pbOK'#8'pbCancel'#0#0#0#0 +LazarusResources.Add('TMouseaActionDialog','FORMDATA',[ + 'TPF0'#19'TMouseaActionDialog'#18'MouseaActionDialog'#4'Left'#3#27#1#6'Height' + +#3#213#0#3'Top'#3#237#0#5'Width'#3'j'#1#8'AutoSize'#9#11'BorderIcons'#11#12 + +'biSystemMenu'#0#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#18'MouseaActionD' + +'ialog'#12'ClientHeight'#3#213#0#11'ClientWidth'#3'j'#1#8'OnCreate'#7#10'For' + +'mCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.27'#0#6'TL' + +'abel'#8'BtnLabel'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Co' + +'ntrol'#7#9'ButtonBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#23'AnchorSideRi' + +'ght.Control'#7#11'ActionLabel'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Le' + +'ft'#2#6#6'Height'#2#16#3'Top'#2'['#5'Width'#2'@'#7'Anchors'#11#5'akTop'#6'a' + +'kLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#8'BtnLabel'#11 + +'ParentColor'#8#0#0#6'TLabel'#11'ActionLabel'#22'AnchorSideLeft.Control'#7#5 + +'Owner'#21'AnchorSideTop.Control'#7#9'ActionBox'#18'AnchorSideTop.Side'#7#9 + +'asrCenter'#4'Left'#2#6#6'Height'#2#16#3'Top'#2#9#5'Width'#2'@'#18'BorderSpa' + +'cing.Left'#2#6#7'Caption'#6#11'ActionLabel'#11'ParentColor'#8#0#0#6'TLabel' + +#8'OptLabel'#22'AnchorSideLeft.Control'#7#10'CaretCheck'#21'AnchorSideTop.Co' + +'ntrol'#7#10'CaretCheck'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSide' + +'Right.Control'#7#9'ButtonBox'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Lef' + +'t'#2'L'#6'Height'#2#16#3'Top'#2'<'#5'Width'#2'd'#7'Anchors'#11#5'akTop'#6'a' + +'kLeft'#7'akRight'#0#8'AutoSize'#8#17'BorderSpacing.Top'#2#6#7'Caption'#6#1 + +' '#11'ParentColor'#8#0#0#6'TPanel'#12'CapturePanel'#22'AnchorSideLeft.Contr' + +'ol'#7#5'Owner'#21'AnchorSideTop.Control'#7#10'ShiftCheck'#18'AnchorSideTop.' + +'Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#10'BtnDefault'#24'Anchor' + +'SideBottom.Control'#7#10'BtnDefault'#21'AnchorSideBottom.Side'#7#9'asrBotto' + +'m'#4'Left'#2#6#6'Height'#2#25#3'Top'#3#142#0#5'Width'#3#6#1#7'Anchors'#11#5 + +'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#18'BorderSpacing.Left'#2#6#17'Bor' + +'derSpacing.Top'#2#6#19'BorderSpacing.Right'#2#6#10'BevelOuter'#7#9'bvLowere' + +'d'#10'BevelWidth'#2#2#5'Color'#7#11'clBtnShadow'#11'ParentColor'#8#8'TabOrd' + +'er'#2#2#11'OnMouseDown'#7#21'CapturePanelMouseDown'#0#0#9'TCheckBox'#10'Shi' + +'ftCheck'#22'AnchorSideLeft.Control'#7#9'ButtonBox'#21'AnchorSideTop.Control' + +#7#9'ButtonBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'L'#6'Height' + +#2#19#3'Top'#2'u'#5'Width'#2'M'#11'AllowGrayed'#9#17'BorderSpacing.Top'#2#6#7 + +'Caption'#6#10'ShiftCheck'#8'TabOrder'#2#6#0#0#9'TCheckBox'#8'AltCheck'#22'A' + +'nchorSideLeft.Control'#7#10'ShiftCheck'#19'AnchorSideLeft.Side'#7#9'asrBott' + +'om'#21'AnchorSideTop.Control'#7#10'ShiftCheck'#18'AnchorSideTop.Side'#7#9'a' + +'srCenter'#4'Left'#3#159#0#6'Height'#2#19#3'Top'#2'u'#5'Width'#2'D'#11'Allow' + +'Grayed'#9#18'BorderSpacing.Left'#2#6#7'Caption'#6#8'AltCheck'#8'TabOrder'#2 + +#7#0#0#9'TCheckBox'#9'CtrlCheck'#22'AnchorSideLeft.Control'#7#8'AltCheck'#19 + +'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#10'ShiftChe' + +'ck'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#3#233#0#6'Height'#2#19#3 + +'Top'#2'u'#5'Width'#2'H'#11'AllowGrayed'#9#18'BorderSpacing.Left'#2#6#7'Capt' + +'ion'#6#9'CtrlCheck'#8'TabOrder'#2#8#0#0#7'TButton'#10'BtnDefault'#22'Anchor' + +'SideLeft.Control'#7#9'CtrlCheck'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21 + +'AnchorSideTop.Control'#7#10'ShiftCheck'#18'AnchorSideTop.Side'#7#9'asrBotto' + +'m'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrB' + +'ottom'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#18#1#6'Height'#2 + +#25#3'Top'#3#142#0#5'Width'#2'R'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoS' + +'ize'#9#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#19'BorderSpacin' + +'g.Right'#2#6#7'Caption'#6#10'BtnDefault'#7'OnClick'#7#15'BtnDefaultClick'#8 + +'TabOrder'#2#9#0#0#9'TCheckBox'#8'DirCheck'#22'AnchorSideLeft.Control'#7#8'C' + +'lickBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7 + +#8'ClickBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#3' '#1#6'Height'#2 + +#19#3'Top'#2'Z'#5'Width'#2'D'#20'BorderSpacing.Around'#2#6#7'Caption'#6#8'Di' + +'rCheck'#8'TabOrder'#2#5#0#0#9'TComboBox'#8'ClickBox'#22'AnchorSideLeft.Cont' + +'rol'#7#9'ButtonBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop' + +'.Control'#7#9'ButtonBox'#4'Left'#3#182#0#6'Height'#2#23#3'Top'#2'X'#5'Width' + +#2'd'#18'BorderSpacing.Left'#2#6#10'ItemHeight'#2#15#5'Style'#7#14'csDropDow' + +'nList'#8'TabOrder'#2#4#0#0#9'TComboBox'#9'ButtonBox'#22'AnchorSideLeft.Cont' + +'rol'#7#8'BtnLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.' + +'Control'#7#8'OptLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'L'#6 + +'Height'#2#23#3'Top'#2'X'#5'Width'#2'd'#18'BorderSpacing.Left'#2#6#17'Border' + +'Spacing.Top'#2#12#10'ItemHeight'#2#15#5'Style'#7#14'csDropDownList'#8'TabOr' + +'der'#2#3#0#0#9'TCheckBox'#10'CaretCheck'#22'AnchorSideLeft.Control'#7#9'Act' + +'ionBox'#21'AnchorSideTop.Control'#7#9'ActionBox'#18'AnchorSideTop.Side'#7#9 + +'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 + +'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 ]); diff --git a/ide/mouseactiondialog.pas b/ide/mouseactiondialog.pas index c2557c4fc1..9b376b2b6b 100644 --- a/ide/mouseactiondialog.pas +++ b/ide/mouseactiondialog.pas @@ -18,7 +18,7 @@ const type - { TEditorMouseOptionsChangeDialog } + { TMouseaActionDialog } TMouseaActionDialog = class(TForm) ActionBox: TComboBox; @@ -30,10 +30,13 @@ type ButtonPanel1: TButtonPanel; CaretCheck: TCheckBox; ClickBox: TComboBox; + OptBox: TComboBox; CtrlCheck: TCheckBox; DirCheck: TCheckBox; CapturePanel: TPanel; + OptLabel: TLabel; ShiftCheck: TCheckBox; + procedure ActionBoxChange(Sender: TObject); procedure BtnDefaultClick(Sender: TObject); procedure CapturePanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); @@ -53,7 +56,7 @@ const IndexToBtn: array [0..2] of TMouseButton = (mbLeft, mbRight, mbMiddle); IndexToClick: array [0..3] of TSynMAClickCount = (ccSingle, ccDouble, ccTriple, ccQuad); -{ TMouseaActionDialog } +{ MouseaActionDialog } procedure TMouseaActionDialog.FormCreate(Sender: TObject); var @@ -104,6 +107,21 @@ begin CtrlCheck.State := cbGrayed; end; +procedure TMouseaActionDialog.ActionBoxChange(Sender: TObject); +begin + 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); + OptBox.Enabled := True; + OptBox.ItemIndex := 0; + end else begin + OptLabel.Caption := ''; + OptBox.Enabled := False + end; +end; + procedure TMouseaActionDialog.CapturePanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin @@ -130,6 +148,17 @@ begin if not(ssAlt in MAct.ShiftMask) then AltCheck.State := cbGrayed; CtrlCheck.Checked := (ssCtrl in MAct.ShiftMask) and (ssCtrl in MAct.Shift); if not(ssCtrl in MAct.ShiftMask) then CtrlCheck.State := cbGrayed; + + 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 + end; end; procedure TMouseaActionDialog.WriteToAction(MAct: TSynEditMouseAction); @@ -149,6 +178,9 @@ begin if ShiftCheck.Checked then MAct.Shift := MAct.Shift + [ssShift]; 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; end; initialization