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"> <element name="TFindOption.frShowHelp">
<short>If set the dialog will display a help button.</short> <short>If set the dialog will display a help button.</short>
</element> </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 --> <!-- set type Visibility: default -->
<element name="TFindOptions"> <element name="TFindOptions">
<short>A set of TFindOption</short> <short>A set of TFindOption</short>

View File

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

View File

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

View File

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

View File

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

View File

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