From 88a5ad88c21f9e34ff9c14440a27e9bbfc35311c Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 27 May 2015 20:21:43 +0000 Subject: [PATCH] IDE: Advanced Mouse-settings: fixed layout: Issue #0028185 git-svn-id: trunk@49193 - --- ide/mouseactiondialog.lfm | 157 ++++++++++++++++---------------------- ide/mouseactiondialog.pas | 52 +++++++++---- 2 files changed, 102 insertions(+), 107 deletions(-) diff --git a/ide/mouseactiondialog.lfm b/ide/mouseactiondialog.lfm index 36e9f51e09..a1b5fbf68c 100644 --- a/ide/mouseactiondialog.lfm +++ b/ide/mouseactiondialog.lfm @@ -1,14 +1,13 @@ object MouseaActionDialog: TMouseaActionDialog - Left = 478 - Height = 319 - Top = 191 - Width = 374 - AutoSize = True + Left = 414 + Height = 400 + Top = 225 + Width = 620 BorderIcons = [biSystemMenu] BorderStyle = bsDialog Caption = 'MouseaActionDialog' - ClientHeight = 319 - ClientWidth = 374 + ClientHeight = 400 + ClientWidth = 620 OnCreate = FormCreate Position = poScreenCenter LCLVersion = '1.5' @@ -47,7 +46,7 @@ object MouseaActionDialog: TMouseaActionDialog Left = 75 Height = 16 Top = 60 - Width = 293 + Width = 539 Anchors = [akTop, akLeft, akRight] AutoSize = False BorderSpacing.Top = 6 @@ -68,34 +67,31 @@ object MouseaActionDialog: TMouseaActionDialog ParentColor = False end object CapturePanel: TPanel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = ShiftCheck - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = BtnDefault + AnchorSideLeft.Control = chkUpRestrict + AnchorSideTop.Control = BtnDefault + AnchorSideRight.Control = chkUpRestrict + AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = ButtonPanel1 - Left = 6 - Height = 31 - Top = 242 - Width = 274 + Left = 181 + Height = 62 + Top = 292 + Width = 433 Anchors = [akTop, akLeft, akRight, akBottom] - BorderSpacing.Left = 6 - BorderSpacing.Top = 6 - BorderSpacing.Right = 6 - BorderSpacing.Bottom = 6 BevelOuter = bvLowered BevelWidth = 2 - ClientHeight = 31 - ClientWidth = 274 + ClientHeight = 62 + ClientWidth = 433 Color = clBtnShadow ParentColor = False - TabOrder = 2 + TabOrder = 11 OnMouseDown = CapturePanelMouseDown object PaintBox1: TPaintBox Left = 2 - Height = 27 + Height = 58 Top = 2 - Width = 270 + Width = 429 Align = alClient + Anchors = [akTop, akRight, akBottom] OnMouseDown = CapturePanelMouseDown OnMouseWheel = PaintBox1MouseWheel end @@ -111,54 +107,50 @@ object MouseaActionDialog: TMouseaActionDialog AllowGrayed = True BorderSpacing.Top = 6 Caption = 'ShiftCheck' - TabOrder = 3 + TabOrder = 6 end object AltCheck: TCheckBox AnchorSideLeft.Control = ShiftCheck - AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = ShiftCheck - AnchorSideTop.Side = asrCenter - Left = 158 + AnchorSideTop.Side = asrBottom + Left = 75 Height = 19 - Top = 217 + Top = 242 Width = 68 AllowGrayed = True - BorderSpacing.Left = 6 + BorderSpacing.Top = 6 Caption = 'AltCheck' - TabOrder = 4 + TabOrder = 7 end object CtrlCheck: TCheckBox AnchorSideLeft.Control = AltCheck - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = ShiftCheck - AnchorSideTop.Side = asrCenter - Left = 232 + AnchorSideTop.Control = AltCheck + AnchorSideTop.Side = asrBottom + Left = 75 Height = 19 - Top = 217 + Top = 267 Width = 72 AllowGrayed = True - BorderSpacing.Left = 6 + BorderSpacing.Top = 6 Caption = 'CtrlCheck' - TabOrder = 5 + TabOrder = 8 end object BtnDefault: TButton - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = CapturePanel - AnchorSideTop.Side = asrCenter + AnchorSideLeft.Control = CtrlCheck + AnchorSideTop.Control = CtrlCheck + AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom AnchorSideBottom.Side = asrBottom - Left = 286 + Left = 75 Height = 25 - Top = 245 + Top = 292 Width = 82 - Anchors = [akTop, akRight] AutoSize = True BorderSpacing.Top = 6 - BorderSpacing.Right = 6 Caption = 'BtnDefault' OnClick = BtnDefaultClick - TabOrder = 6 + TabOrder = 9 end object CaretCheck: TCheckBox AnchorSideLeft.Control = ActionBox @@ -181,7 +173,7 @@ object MouseaActionDialog: TMouseaActionDialog Left = 75 Height = 23 Top = 6 - Width = 293 + Width = 539 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 6 BorderSpacing.Top = 6 @@ -198,8 +190,8 @@ object MouseaActionDialog: TMouseaActionDialog AnchorSideRight.Side = asrBottom Left = 6 Height = 34 - Top = 279 - Width = 362 + Top = 360 + Width = 608 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True HelpButton.Name = 'HelpButton' @@ -208,7 +200,7 @@ object MouseaActionDialog: TMouseaActionDialog CloseButton.DefaultCaption = True CancelButton.Name = 'CancelButton' CancelButton.DefaultCaption = True - TabOrder = 7 + TabOrder = 12 ShowButtons = [pbOK, pbCancel] end object OptBox: TComboBox @@ -220,13 +212,13 @@ object MouseaActionDialog: TMouseaActionDialog Left = 75 Height = 23 Top = 76 - Width = 293 + Width = 539 Anchors = [akTop, akLeft, akRight] BorderSpacing.Right = 6 Enabled = False ItemHeight = 15 Style = csDropDownList - TabOrder = 8 + TabOrder = 2 end object PriorSpin: TSpinEdit AnchorSideLeft.Control = OptLabel @@ -238,7 +230,7 @@ object MouseaActionDialog: TMouseaActionDialog Width = 60 BorderSpacing.Top = 6 MaxValue = 3 - TabOrder = 9 + TabOrder = 3 end object Opt2Spin: TSpinEdit AnchorSideLeft.Control = OptLabel @@ -246,7 +238,7 @@ object MouseaActionDialog: TMouseaActionDialog AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 308 + Left = 554 Height = 23 Top = 105 Width = 60 @@ -254,14 +246,14 @@ object MouseaActionDialog: TMouseaActionDialog BorderSpacing.Top = 6 BorderSpacing.Right = 6 MaxValue = 999 - TabOrder = 10 + TabOrder = 4 end object Opt2Label: TLabel AnchorSideLeft.Control = Owner AnchorSideTop.Control = Opt2Spin AnchorSideTop.Side = asrCenter AnchorSideRight.Control = Opt2Spin - Left = 248 + Left = 494 Height = 15 Top = 109 Width = 54 @@ -284,7 +276,7 @@ object MouseaActionDialog: TMouseaActionDialog BevelOuter = bvNone ClientHeight = 77 ClientWidth = 100 - TabOrder = 11 + TabOrder = 5 object DirCheck: TCheckBox AnchorSideTop.Control = ClickBox AnchorSideTop.Side = asrBottom @@ -295,7 +287,7 @@ object MouseaActionDialog: TMouseaActionDialog BorderSpacing.Top = 6 Caption = 'DirCheck' OnChange = DirCheckChange - TabOrder = 0 + TabOrder = 2 end object ClickBox: TComboBox AnchorSideTop.Control = ButtonBox @@ -319,39 +311,22 @@ object MouseaActionDialog: TMouseaActionDialog ItemHeight = 15 OnChange = ButtonBoxChange Style = csDropDownList - TabOrder = 2 - end - end - object ScrollBox1: TScrollBox - AnchorSideLeft.Control = Panel1 - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = Panel1 - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Panel1 - AnchorSideBottom.Side = asrBottom - Left = 181 - Height = 77 - Top = 134 - Width = 187 - HorzScrollBar.Page = 170 - VertScrollBar.Page = 60 - Anchors = [akTop, akLeft, akRight, akBottom] - BorderSpacing.Left = 6 - BorderSpacing.Right = 6 - BorderStyle = bsNone - ClientHeight = 60 - ClientWidth = 170 - Constraints.MinWidth = 180 - TabOrder = 12 - object chkUpRestrict: TCheckListBox - Left = 0 - Height = 150 - Top = 0 - Width = 900 - BorderSpacing.Right = 6 - ItemHeight = 0 TabOrder = 0 end end + object chkUpRestrict: TCheckListBox + AnchorSideLeft.Control = Panel1 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Panel1 + AnchorSideBottom.Control = BtnDefault + Left = 181 + Height = 152 + Top = 134 + Width = 433 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Left = 6 + BorderSpacing.Right = 6 + ItemHeight = 0 + TabOrder = 10 + end end diff --git a/ide/mouseactiondialog.pas b/ide/mouseactiondialog.pas index c4fcd12630..d4070b5784 100644 --- a/ide/mouseactiondialog.pas +++ b/ide/mouseactiondialog.pas @@ -38,7 +38,6 @@ type OptLabel: TLabel; Opt2Spin: TSpinEdit; Opt2Label: TLabel; - ScrollBox1: TScrollBox; ShiftCheck: TCheckBox; PriorSpin: TSpinEdit; procedure ActionBoxChange(Sender: TObject); @@ -53,6 +52,7 @@ type private FKeyMap: TKeyCommandRelationList; procedure AddMouseCmd(const S: string); + procedure FillListbox; public { public declarations } Procedure ResetInputs; @@ -65,6 +65,8 @@ type implementation +uses Math; + {$R *.lfm} const @@ -98,11 +100,42 @@ begin end; end; +procedure TMouseaActionDialog.FillListbox; +const + cCheckSize=35; +var + r: TSynMAUpRestriction; + s: string; + i, Len: integer; +begin + for r := low(TSynMAUpRestriction) to high(TSynMAUpRestriction) do + case r of + crLastDownPos: chkUpRestrict.AddItem(synfMatchActionPosOfMouseDown, nil); + crLastDownPosSameLine: chkUpRestrict.AddItem(synfMatchActionLineOfMouseDown, nil); + crLastDownPosSearchAll: chkUpRestrict.AddItem(synfSearchAllActionOfMouseDown, nil); + crLastDownButton: chkUpRestrict.AddItem(synfMatchActionButtonOfMouseDown, nil); + crLastDownShift: chkUpRestrict.AddItem(synfMatchActionModifiersOfMouseDown, nil); + crAllowFallback: chkUpRestrict.AddItem(synfContinueWithNextMouseUpAction, nil); + else begin + WriteStr(s, r); + chkUpRestrict.AddItem(s, nil); + end; + end; + + // update scrollbar + Len := 0; + with chkUpRestrict do + begin + for i := 0 to Items.Count-1 do + Len := Max(Len, Canvas.TextWidth(Items[i])+cCheckSize); + ScrollWidth := Len; + end; +end; + procedure TMouseaActionDialog.FormCreate(Sender: TObject); var mb: TSynMouseButton; cc: TSynMAClickCount; - r: TSynMAUpRestriction; s: string; begin ButtonName[mbXLeft]:=dlgMouseOptBtnLeft; @@ -119,20 +152,7 @@ begin ClickName[ccQuad]:=dlgMouseOptBtn4; ClickName[ccAny]:=dlgMouseOptBtnAny; - for r := low(TSynMAUpRestriction) to high(TSynMAUpRestriction) do - case r of - crLastDownPos: chkUpRestrict.AddItem(synfMatchActionPosOfMouseDown, nil); - crLastDownPosSameLine: chkUpRestrict.AddItem(synfMatchActionLineOfMouseDown, nil); - crLastDownPosSearchAll: chkUpRestrict.AddItem(synfSearchAllActionOfMouseDown, nil); - crLastDownButton: chkUpRestrict.AddItem(synfMatchActionButtonOfMouseDown, nil); - crLastDownShift: chkUpRestrict.AddItem(synfMatchActionModifiersOfMouseDown, nil); - crAllowFallback: chkUpRestrict.AddItem(synfContinueWithNextMouseUpAction, nil); - else begin - WriteStr(s, r); - chkUpRestrict.AddItem(s, nil); - end; - end; - + FillListbox; ButtonDirName[cdUp]:=lisUp; ButtonDirName[cdDown]:=lisDown;