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

View File

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