LCL: added checkbox "Prompt on replace" to TReplaceDialog. Issue #20654, patch from Bart Broersma

git-svn-id: trunk@33585 -
This commit is contained in:
juha 2011-11-17 13:41:04 +00:00
parent 565e07e237
commit 6493c83448
6 changed files with 41 additions and 17 deletions

View File

@ -1831,6 +1831,12 @@ shows all letters both in uppercase and lowercase.
<element name="TFindOption.frShowHelp">
<short>If set the dialog will display a help button.</short>
</element>
<element name="TFindOption.frPromptOnReplace">
<short>This flag is set when the user checks the "Prompt on replace" checkbox.</short>
</element>
<element name="TFindOption.frHidePromptOnReplace">
<short>If set the "Prompt on replace" checkbox is hidden from the Find dialog.</short>
</element>
<!-- set type Visibility: default -->
<element name="TFindOptions">
<short>A set of TFindOption</short>

View File

@ -368,7 +368,7 @@ type
TFindOption = (frDown, frFindNext, frHideMatchCase, frHideWholeWord,
frHideUpDown, frMatchCase, frDisableMatchCase, frDisableUpDown,
frDisableWholeWord, frReplace, frReplaceAll, frWholeWord, frShowHelp,
frEntireScope, frHideEntireScope);
frEntireScope, frHideEntireScope, frPromptOnReplace, frHidePromptOnReplace);
TFindOptions = set of TFindOption;
TFindDialog = class(TCommonDialog)

View File

@ -1,35 +1,35 @@
object ReplaceDialogForm: TReplaceDialogForm
Left = 415
Height = 162
Height = 171
Top = 391
Width = 432
ActiveControl = EditFind
BorderIcons = [biSystemMenu, biHelp]
Caption = 'Replace text'
ClientHeight = 162
ClientHeight = 171
ClientWidth = 432
LCLVersion = '0.9.31'
object TextLabel: TLabel
Left = 4
Height = 16
Height = 14
Top = 19
Width = 61
Width = 54
Caption = 'Text to find'
FocusControl = EditFind
ParentColor = False
end
object ReplaceLabel: TLabel
Left = 4
Height = 16
Height = 14
Top = 48
Width = 68
Width = 63
Caption = 'Replace with'
FocusControl = EditReplace
ParentColor = False
end
object EditFind: TEdit
Left = 72
Height = 23
Height = 21
Top = 10
Width = 257
Anchors = [akTop, akLeft, akRight]
@ -38,7 +38,7 @@ object ReplaceDialogForm: TReplaceDialogForm
end
object EditReplace: TEdit
Left = 72
Height = 23
Height = 21
Top = 42
Width = 257
Anchors = [akTop, akLeft, akRight]
@ -47,17 +47,17 @@ object ReplaceDialogForm: TReplaceDialogForm
end
object WholeWordsOnlyCheckBox: TCheckBox
Left = 4
Height = 19
Height = 17
Top = 80
Width = 115
Width = 104
Caption = 'Whole words only'
TabOrder = 2
end
object CaseSensitiveCheckBox: TCheckBox
Left = 4
Height = 19
Height = 17
Top = 104
Width = 93
Width = 88
Caption = 'Case sensitive'
TabOrder = 3
end
@ -106,7 +106,7 @@ object ReplaceDialogForm: TReplaceDialogForm
object HelpButton: TButton
Left = 337
Height = 25
Top = 129
Top = 138
Width = 91
Anchors = [akRight, akBottom]
Caption = 'Help'
@ -138,10 +138,18 @@ object ReplaceDialogForm: TReplaceDialogForm
end
object EntireScopeCheckBox: TCheckBox
Left = 4
Height = 19
Height = 17
Top = 128
Width = 107
Width = 99
Caption = 'Search entire file'
TabOrder = 10
end
object PromptOnReplaceCheckBox: TCheckBox
Left = 4
Height = 17
Top = 152
Width = 106
Caption = 'Prompt on replace'
TabOrder = 11
end
end

View File

@ -43,6 +43,7 @@ type
{ TReplaceDialogForm }
TReplaceDialogForm = class(TForm)
PromptOnReplaceCheckBox: TCheckBox;
EntireScopeCheckBox: TCheckBox;
FindMoreButton: TButton;
ReplaceButton: TButton;

View File

@ -26,6 +26,7 @@ type
{ TReplaceDialogForm }
TReplaceDialogForm = class(TForm)
PromptOnReplaceCheckBox: TCheckBox;
EntireScopeCheckBox: TCheckBox;
FindMoreButton: TButton;
ReplaceButton: TButton;
@ -76,6 +77,7 @@ begin
WholeWordsOnlyCheckBox.Caption := rsWholeWordsOnly;
CaseSensitiveCheckBox.Caption := rsCaseSensitive;
EntireScopeCheckBox.Caption := rsEntireScope;
PromptOnReplaceCheckBox.Caption := rsPromptOnReplace;
TextLabel.Caption := rsText;
ReplaceLabel.Caption := rsReplace;
DirectionRadioGroup.Caption := rsDirection;
@ -106,6 +108,7 @@ begin
dlg.WholeWordsOnlyCheckBox.Checked:=frWholeWord in Options;
Dlg.EntireScopeCheckBox.Checked:=frEntireScope in Options;
dlg.CaseSensitiveCheckBox.Checked:=frMatchCase in Options;
dlg.PromptOnReplaceCheckBox.Checked := frPromptOnReplace in Options;
Dlg.DirectionRadioGroup.ItemIndex:=ord(not(frDown in Options));
dlg.WholeWordsOnlyCheckBox.Enabled:=not (frDisableWholeWord in Options);
@ -117,6 +120,7 @@ begin
dlg.DirectionRadioGroup.Visible:=not (frHideUpDown in Options);
dlg.HelpButton.Visible:=(frShowHelp in Options);
Dlg.EntireScopeCheckBox.Visible := not (frHideEntireScope in Options);
dlg.PromptOnReplaceCheckBox.Visible := not (frHidePromptOnReplace in Options);
end;
procedure TReplaceDialog.GetFormValues;
@ -140,6 +144,10 @@ begin
FOptions:=FOptions + [frEntireScope]
else
FOptions:=FOptions - [frEntireScope];
if Dlg.PromptOnReplaceCheckBox.Checked then
FOptions := FOptions + [frPromptOnReplace]
else
FOptions := FOptions - [frPromptOnReplace];
FFindText := Dlg.EditFind.Text;
FReplaceText := Dlg.EditReplace.Text;
end;
@ -147,7 +155,7 @@ end;
constructor TReplaceDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Options:=Options + [frReplace, frReplaceAll];
Options:=Options + [frReplace, frReplaceAll, frHidePromptOnreplace];
end;
function TReplaceDialog.DefaultTitle: string;

View File

@ -354,6 +354,7 @@ resourceString
ifsAlt = 'Alt';
rsWholeWordsOnly = 'Whole words only';
rsCaseSensitive = 'Case sensitive';
rsPromptOnReplace= 'Prompt on replace';
rsEntireScope = 'Search entire file';
rsText = 'Text';
rsDirection = 'Direction';