IDE: Fix button order in FindReplaceDialog dialog using ButtonPanel. Issue #13561

git-svn-id: trunk@43615 -
This commit is contained in:
juha 2013-12-30 18:50:05 +00:00
parent 0efde5e2da
commit 6180212a33
2 changed files with 110 additions and 164 deletions

View File

@ -1,7 +1,7 @@
object LazFindReplaceDialog: TLazFindReplaceDialog
Left = 308
Left = 409
Height = 322
Top = 229
Top = 607
Width = 441
ActiveControl = TextToFindComboBox
BorderIcons = [biSystemMenu]
@ -13,14 +13,14 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
KeyPreview = True
OnChangeBounds = FormChangeBounds
OnClose = FormClose
LCLVersion = '1.1'
LCLVersion = '1.3'
object TextToFindLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = TextToFindComboBox
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 18
Top = 17
Width = 95
Alignment = taRightJustify
BorderSpacing.Left = 6
@ -35,7 +35,7 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideBottom.Control = TextToFindComboBox
AnchorSideBottom.Side = asrBottom
Left = 410
Height = 27
Height = 25
Top = 12
Width = 25
AllowAllUp = True
@ -51,9 +51,9 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideTop.Control = ReplaceTextComboBox
AnchorSideTop.Side = asrCenter
Left = 6
Height = 20
Top = 48
Width = 163
Height = 21
Top = 45
Width = 160
BorderSpacing.Left = 6
Caption = 'ReplaceWithCheckbox'
OnChange = ReplaceWithCheckboxChange
@ -64,7 +64,7 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = EnableAutoCompleteSpeedButton
Left = 107
Height = 27
Height = 25
Top = 12
Width = 303
Anchors = [akTop, akLeft, akRight]
@ -83,10 +83,10 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 181
Height = 27
Top = 45
Width = 254
Left = 178
Height = 25
Top = 43
Width = 257
Anchors = [akTop, akLeft, akRight]
AutoComplete = True
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending]
@ -101,26 +101,25 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ReplaceTextComboBox
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = BtnPanel
Left = 6
Height = 193
Top = 78
Width = 229
Height = 197
Top = 74
Width = 222
Anchors = [akTop, akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
Caption = 'OptionsGroupBox'
ClientHeight = 174
ClientWidth = 221
ClientHeight = 178
ClientWidth = 218
TabOrder = 3
OnResize = OptionsGroupBoxResize
object PromptOnReplaceCheckBox: TCheckBox
Left = 6
Height = 20
Top = 140
Width = 209
Height = 21
Top = 144
Width = 206
Align = alTop
BorderSpacing.Top = 6
BorderSpacing.Around = 6
@ -133,9 +132,9 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
end
object MultiLineCheckBox: TCheckBox
Left = 6
Height = 20
Top = 108
Width = 209
Height = 21
Top = 111
Width = 206
Align = alTop
BorderSpacing.Top = 6
BorderSpacing.Around = 6
@ -146,9 +145,9 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
end
object RegularExpressionsCheckBox: TCheckBox
Left = 6
Height = 20
Top = 76
Width = 209
Height = 21
Top = 78
Width = 206
Align = alTop
BorderSpacing.Top = 6
BorderSpacing.Around = 6
@ -159,9 +158,9 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
end
object WholeWordsOnlyCheckBox: TCheckBox
Left = 6
Height = 20
Top = 44
Width = 209
Height = 21
Top = 45
Width = 206
Align = alTop
BorderSpacing.Top = 6
BorderSpacing.Around = 6
@ -172,9 +171,9 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
end
object CaseSensitiveCheckBox: TCheckBox
Left = 6
Height = 20
Height = 21
Top = 12
Width = 209
Width = 206
Align = alTop
BorderSpacing.Top = 6
BorderSpacing.Around = 6
@ -191,10 +190,10 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 241
Height = 59
Top = 143
Width = 194
Left = 234
Height = 61
Top = 141
Width = 201
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
@ -206,22 +205,22 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
ChildSizing.ShrinkVertical = crsHomogenousSpaceResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 40
ClientWidth = 186
ClientHeight = 42
ClientWidth = 197
TabOrder = 5
object SelectedRadioButton: TRadioButton
Left = 6
Height = 20
Height = 21
Top = 0
Width = 174
Width = 185
Caption = 'SelectedRadioButton'
TabOrder = 0
end
object GlobalRadioButton: TRadioButton
Left = 6
Height = 20
Top = 20
Width = 174
Height = 21
Top = 21
Width = 185
Caption = 'GlobalRadioButton'
Checked = True
TabOrder = 1
@ -235,10 +234,10 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 241
Height = 59
Left = 234
Height = 61
Top = 208
Width = 194
Width = 201
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
@ -250,22 +249,22 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
ChildSizing.ShrinkVertical = crsHomogenousSpaceResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 40
ClientWidth = 186
ClientHeight = 42
ClientWidth = 197
TabOrder = 6
object BackwardRadioButton: TRadioButton
Left = 6
Height = 20
Height = 21
Top = 0
Width = 174
Width = 185
Caption = 'BackwardRadioButton'
TabOrder = 0
end
object ForwardRadioButton: TRadioButton
Left = 6
Height = 20
Top = 20
Width = 174
Height = 21
Top = 21
Width = 185
Caption = 'ForwardRadioButton'
Checked = True
TabOrder = 1
@ -279,10 +278,10 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 241
Height = 59
Top = 78
Width = 194
Left = 234
Height = 61
Top = 74
Width = 201
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
@ -294,14 +293,14 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
ChildSizing.ShrinkVertical = crsHomogenousSpaceResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 40
ClientWidth = 186
ClientHeight = 42
ClientWidth = 197
TabOrder = 4
object FromCursorRadioButton: TRadioButton
Left = 0
Height = 20
Left = 6
Height = 21
Top = 0
Width = 180
Width = 185
AutoSize = False
Caption = 'FromCursorRadioButton'
Checked = True
@ -309,86 +308,32 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
TabStop = True
end
object EntireScopeRadioButton: TRadioButton
Left = 0
Height = 20
Top = 20
Width = 180
Left = 6
Height = 21
Top = 21
Width = 185
AutoSize = False
Caption = 'EntireScopeRadioButton'
TabOrder = 1
end
end
object BtnPanel: TPanel
Left = 0
Height = 45
Top = 277
Width = 441
Align = alBottom
AutoSize = True
BevelOuter = bvNone
ClientHeight = 45
ClientWidth = 441
object BtnPanel: TButtonPanel
Left = 6
Height = 41
Top = 275
Width = 429
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
OKButton.OnClick = OkButtonClick
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
HelpButton.OnClick = HelpButtonClick
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CloseButton.OnClick = ReplaceAllButtonClick
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
CancelButton.OnClick = CancelButtonClick
TabOrder = 7
object ReplaceAllButton: TBitBtn
Left = 185
Height = 33
Top = 6
Width = 75
Align = alRight
AutoSize = True
BorderSpacing.Around = 6
Caption = '&All'
Constraints.MinWidth = 75
Kind = bkAll
OnClick = ReplaceAllButtonClick
TabOrder = 0
end
object OKButton: TBitBtn
Left = 266
Height = 33
Top = 6
Width = 75
Align = alRight
AutoSize = True
BorderSpacing.Around = 6
Caption = '&OK'
Constraints.MinWidth = 75
Default = True
Kind = bkOK
OnClick = OkButtonClick
TabOrder = 1
end
object CancelButton: TBitBtn
Left = 347
Height = 33
Top = 6
Width = 88
Align = alRight
AutoSize = True
BorderSpacing.Around = 6
Cancel = True
Caption = 'Cancel'
Constraints.MinWidth = 75
Kind = bkCancel
ModalResult = 2
OnClick = CancelButtonClick
TabOrder = 2
end
object HelpButton: TBitBtn
AnchorSideLeft.Control = BtnPanel
AnchorSideBottom.Control = BtnPanel
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 33
Top = 6
Width = 76
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Around = 6
Caption = '&Help'
Kind = bkHelp
OnClick = HelpButtonClick
TabOrder = 3
end
end
end

View File

@ -33,7 +33,7 @@ interface
uses
Classes, Math, SysUtils, LCLProc, LCLType, Controls, StdCtrls, Forms, Buttons,
ExtCtrls, Dialogs, Graphics,
ExtCtrls, Dialogs, Graphics, ButtonPanel,
SynEditTypes, SynRegExpr, SynEdit,
IDEHelpIntf, IDEImagesIntf, IDEWindowIntf, IDEDialogs,
LazarusIdeStrConsts, InputHistory;
@ -47,9 +47,7 @@ type
TLazFindReplaceDialog = class(TForm)
BackwardRadioButton: TRadioButton;
HelpButton: TBitBtn;
BtnPanel: TPanel;
CancelButton: TBitBtn;
BtnPanel: TButtonPanel;
CaseSensitiveCheckBox: TCheckBox;
DirectionGroupBox: TGroupBox;
EntireScopeRadioButton: TRadioButton;
@ -57,12 +55,10 @@ type
FromCursorRadioButton: TRadioButton;
GlobalRadioButton: TRadioButton;
MultiLineCheckBox: TCheckBox;
OKButton: TBitBtn;
OptionsGroupBox: TGroupBox;
OriginGroupBox: TGroupBox;
PromptOnReplaceCheckBox: TCheckBox;
RegularExpressionsCheckBox: TCheckBox;
ReplaceAllButton: TBitBtn;
ReplaceTextComboBox: TComboBox;
ReplaceWithCheckbox: TCheckBox;
ScopeGroupBox: TGroupBox;
@ -163,22 +159,21 @@ begin
Hint:=lisAskBeforeReplacingEachFoundText;
end;
OriginGroupBox.Caption:=dlgSROrigin;
OriginGroupBox.Caption := dlgSROrigin;
FromCursorRadioButton.Caption := dlgFromCursor;
EntireScopeRadioButton.Caption := dlgFromBeginning;
ScopeGroupBox.Caption:=dlgScope;
ScopeGroupBox.Caption := dlgScope;
GlobalRadioButton.Caption := dlgGlobal;
SelectedRadioButton.Caption := dlgSelectedText;
DirectionGroupBox.Caption:=dlgDirection;
DirectionGroupBox.Caption := dlgDirection;
ForwardRadioButton.Caption := lisFRForwardSearch;
BackwardRadioButton.Caption := lisFRBackwardSearch;
HelpButton.Caption:=lisMenuHelp;
ReplaceAllButton.Caption:=dlgReplaceAll;
OKButton.Caption:=lisMenuOk;
CancelButton.Caption:=lisCancel;
// CloseButton works now as ReplaceAllButton
BtnPanel.CloseButton.Caption := dlgReplaceAll;
BtnPanel.CloseButton.LoadGlyphFromResourceName(hInstance, 'btn_all');
fReplaceAllClickedLast:=false;
UpdateHints;
@ -306,17 +301,20 @@ end;
procedure TLazFindReplaceDialog.ReplaceWithCheckboxChange(Sender: TObject);
begin
ReplaceAllButton.Visible:=ReplaceWithCheckbox.Checked;
ReplaceTextComboBox.Enabled:=ReplaceAllButton.Visible;
PromptOnReplaceCheckBox.Enabled:=ReplaceAllButton.Visible;
if ReplaceAllButton.Visible then
if ReplaceWithCheckbox.Checked then
BtnPanel.ShowButtons := BtnPanel.ShowButtons + [pbClose]
else
BtnPanel.ShowButtons := BtnPanel.ShowButtons - [pbClose];
ReplaceTextComboBox.Enabled:=ReplaceWithCheckbox.Checked;
PromptOnReplaceCheckBox.Enabled:=ReplaceWithCheckbox.Checked;
if ReplaceWithCheckbox.Checked then
begin
Caption := lisReplace;
OkButton.Caption := lisBtnReplace;
BtnPanel.OKButton.Caption := lisBtnReplace;
end else
begin
Caption := lisMenuFind;
OkButton.Caption := lisBtnFind;
BtnPanel.OKButton.Caption := lisBtnFind;
end;
end;
@ -447,19 +445,22 @@ begin
then BackwardRadioButton.Checked:=True
else ForwardRadioButton.Checked:=True;
ReplaceAllButton.Visible:=ssoReplace in NewOptions;
ReplaceWithCheckbox.Checked:=ssoReplace in NewOptions;
ReplaceTextComboBox.Enabled:=ReplaceAllButton.Visible;
PromptOnReplaceCheckBox.Enabled:=ReplaceAllButton.Visible;
if ssoReplace in NewOptions then
BtnPanel.ShowButtons := BtnPanel.ShowButtons + [pbClose]
else
BtnPanel.ShowButtons := BtnPanel.ShowButtons - [pbClose];
ReplaceWithCheckbox.Checked := ssoReplace in NewOptions;
ReplaceTextComboBox.Enabled := ssoReplace in NewOptions;
PromptOnReplaceCheckBox.Enabled := ssoReplace in NewOptions;
if ssoReplace in NewOptions then
begin
Caption := lisReplace;
OkButton.Caption := lisBtnReplace;
BtnPanel.OKButton.Caption := lisBtnReplace;
end else
begin
Caption := lisMenuFind;
OkButton.Caption := lisBtnFind;
BtnPanel.OKButton.Caption := lisBtnFind;
end;
//DebugLn(['TLazFindReplaceDialog.SetOptions END ssoSelectedOnly=',ssoSelectedOnly in NewOptions,' SelectedRadioButton.Checked=',SelectedRadioButton.Checked]);
end;
@ -476,7 +477,7 @@ begin
if EntireScopeRadioButton.Checked then Include(Result,ssoEntireScope);
if SelectedRadioButton.Checked then include(Result,ssoSelectedOnly);
if BackwardRadioButton.Checked then include(Result,ssoBackwards);
if ReplaceAllButton.Visible then include(Result,ssoReplace);
if pbClose in BtnPanel.ShowButtons then include(Result,ssoReplace);
if fReplaceAllClickedLast then include(Result,ssoReplaceAll);
end;