From 6493c8344872b855a2a1ccaf6fc8b38f5eaab874 Mon Sep 17 00:00:00 2001 From: juha Date: Thu, 17 Nov 2011 13:41:04 +0000 Subject: [PATCH] LCL: added checkbox "Prompt on replace" to TReplaceDialog. Issue #20654, patch from Bart Broersma git-svn-id: trunk@33585 - --- docs/xml/lcl/dialogs.xml | 6 ++++++ lcl/dialogs.pp | 2 +- lcl/forms/replacedlgunit.lfm | 38 +++++++++++++++++++++-------------- lcl/forms/replacedlgunit.pas | 1 + lcl/include/replacedialog.inc | 10 ++++++++- lcl/lclstrconsts.pas | 1 + 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/docs/xml/lcl/dialogs.xml b/docs/xml/lcl/dialogs.xml index ab29bb53e5..fdb1077dee 100644 --- a/docs/xml/lcl/dialogs.xml +++ b/docs/xml/lcl/dialogs.xml @@ -1831,6 +1831,12 @@ shows all letters both in uppercase and lowercase. If set the dialog will display a help button. + + This flag is set when the user checks the "Prompt on replace" checkbox. + + + If set the "Prompt on replace" checkbox is hidden from the Find dialog. + A set of TFindOption diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp index 10ce9941ca..91a2d8be1c 100644 --- a/lcl/dialogs.pp +++ b/lcl/dialogs.pp @@ -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) diff --git a/lcl/forms/replacedlgunit.lfm b/lcl/forms/replacedlgunit.lfm index 5a5d50de84..0ee05aaf23 100644 --- a/lcl/forms/replacedlgunit.lfm +++ b/lcl/forms/replacedlgunit.lfm @@ -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 diff --git a/lcl/forms/replacedlgunit.pas b/lcl/forms/replacedlgunit.pas index d1e61980cf..5dfc6fc69d 100644 --- a/lcl/forms/replacedlgunit.pas +++ b/lcl/forms/replacedlgunit.pas @@ -43,6 +43,7 @@ type { TReplaceDialogForm } TReplaceDialogForm = class(TForm) + PromptOnReplaceCheckBox: TCheckBox; EntireScopeCheckBox: TCheckBox; FindMoreButton: TButton; ReplaceButton: TButton; diff --git a/lcl/include/replacedialog.inc b/lcl/include/replacedialog.inc index 7fd70409cb..04dff129c4 100644 --- a/lcl/include/replacedialog.inc +++ b/lcl/include/replacedialog.inc @@ -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; diff --git a/lcl/lclstrconsts.pas b/lcl/lclstrconsts.pas index 351cf3c1df..4f2b896219 100644 --- a/lcl/lclstrconsts.pas +++ b/lcl/lclstrconsts.pas @@ -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';