View Issue Details

IDProjectCategoryView StatusLast Update
0020654LazarusLCLpublic2011-12-03 14:24
ReporterBart BroersmaAssigned ToJuha Manninen 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Platformi386OSWinMeOS VersionMS
Product Version0.9.31 (SVN)Product Build33269 
Target VersionFixed in Version0.9.30.1 (SVN) 
Summary0020654: Feature request: add checkbox "Prompt on replace" to TReplaceDialog (patch included)
DescriptionWhen replacing text it is often quite useful to have a "Prompt on replace" option (checkbox) in the ReplaceDialog.
I have created such a feature and atteched the diff.
TagsNo tags attached.
Fixed in Revisionr33585
LazTarget-
Widgetset
Attached Files
  • replacedlg.diff (5,899 bytes)
    Index: lcl/dialogs.pp
    ===================================================================
    --- lcl/dialogs.pp	(revision 33269)
    +++ lcl/dialogs.pp	(working copy)
    @@ -368,7 +368,7 @@
       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)
    
    Index: lcl/include/replacedialog.inc
    ===================================================================
    --- lcl/include/replacedialog.inc	(revision 33269)
    +++ lcl/include/replacedialog.inc	(working copy)
    @@ -26,6 +26,7 @@
     { TReplaceDialogForm }
     
       TReplaceDialogForm = class(TForm)
    +    PromptOnReplaceCheckBox: TCheckBox;
         EntireScopeCheckBox: TCheckBox;
         FindMoreButton: TButton;
         ReplaceButton: TButton;
    @@ -76,6 +77,7 @@
         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 @@
       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 @@
       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 @@
         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;
    
    Index: lcl/lclstrconsts.pas
    ===================================================================
    --- lcl/lclstrconsts.pas	(revision 33269)
    +++ lcl/lclstrconsts.pas	(working copy)
    @@ -352,6 +352,7 @@
       rsWholeWordsOnly = 'Whole words only';
       rsCaseSensitive = 'Case sensitive';
       rsEntireScope   = 'Search entire file';
    +  rsPromptOnReplace = 'PromptOnReplace';
       rsText = 'Text';
       rsDirection = 'Direction';
       rsForward = 'Forward';
    
    Index: lcl/forms/replacedlgunit.pas
    ===================================================================
    --- lcl/forms/replacedlgunit.pas	(revision 33269)
    +++ lcl/forms/replacedlgunit.pas	(working copy)
    @@ -43,6 +43,7 @@
       { TReplaceDialogForm }
     
       TReplaceDialogForm = class(TForm)
    +    PromptOnReplaceCheckBox: TCheckBox;
         EntireScopeCheckBox: TCheckBox;
         FindMoreButton: TButton;
         ReplaceButton: TButton;
    
    Index: lcl/forms/replacedlgunit.lfm
    ===================================================================
    --- lcl/forms/replacedlgunit.lfm	(revision 33269)
    +++ lcl/forms/replacedlgunit.lfm	(working copy)
    @@ -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 @@
       end
       object EditReplace: TEdit
         Left = 72
    -    Height = 23
    +    Height = 21
         Top = 42
         Width = 257
         Anchors = [akTop, akLeft, akRight]
    @@ -47,17 +47,17 @@
       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 HelpButton: TButton
         Left = 337
         Height = 25
    -    Top = 129
    +    Top = 138
         Width = 91
         Anchors = [akRight, akBottom]
         Caption = 'Help'
    @@ -138,10 +138,18 @@
       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
    
    replacedlg.diff (5,899 bytes)
  • replacedlg.2.diff (6,024 bytes)
    Index: lcl/dialogs.pp
    ===================================================================
    --- lcl/dialogs.pp	(revision 33269)
    +++ lcl/dialogs.pp	(working copy)
    @@ -368,7 +368,7 @@
       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)
    Index: lcl/include/replacedialog.inc
    ===================================================================
    --- lcl/include/replacedialog.inc	(revision 33269)
    +++ lcl/include/replacedialog.inc	(working copy)
    @@ -26,6 +26,7 @@
     { TReplaceDialogForm }
     
       TReplaceDialogForm = class(TForm)
    +    PromptOnReplaceCheckBox: TCheckBox;
         EntireScopeCheckBox: TCheckBox;
         FindMoreButton: TButton;
         ReplaceButton: TButton;
    @@ -76,6 +77,7 @@
         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 @@
       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 @@
       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 @@
         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 @@
     constructor TReplaceDialog.Create(AOwner: TComponent);
     begin
       inherited Create(AOwner);
    -  Options:=Options + [frReplace, frReplaceAll];
    +  Options:=Options + [frReplace, frReplaceAll, frHidePromptOnreplace];
     end;
     
     function TReplaceDialog.DefaultTitle: string; 
    Index: lcl/lclstrconsts.pas
    ===================================================================
    --- lcl/lclstrconsts.pas	(revision 33269)
    +++ lcl/lclstrconsts.pas	(working copy)
    @@ -352,6 +352,7 @@
       rsWholeWordsOnly = 'Whole words only';
       rsCaseSensitive = 'Case sensitive';
       rsEntireScope   = 'Search entire file';
    +  rsPromptOnReplace = 'Prompt on replace';
       rsText = 'Text';
       rsDirection = 'Direction';
       rsForward = 'Forward';
    Index: lcl/forms/replacedlgunit.pas
    ===================================================================
    --- lcl/forms/replacedlgunit.pas	(revision 33269)
    +++ lcl/forms/replacedlgunit.pas	(working copy)
    @@ -43,6 +43,7 @@
       { TReplaceDialogForm }
     
       TReplaceDialogForm = class(TForm)
    +    PromptOnReplaceCheckBox: TCheckBox;
         EntireScopeCheckBox: TCheckBox;
         FindMoreButton: TButton;
         ReplaceButton: TButton;
    Index: lcl/forms/replacedlgunit.lfm
    ===================================================================
    --- lcl/forms/replacedlgunit.lfm	(revision 33269)
    +++ lcl/forms/replacedlgunit.lfm	(working copy)
    @@ -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 @@
       end
       object EditReplace: TEdit
         Left = 72
    -    Height = 23
    +    Height = 21
         Top = 42
         Width = 257
         Anchors = [akTop, akLeft, akRight]
    @@ -47,17 +47,17 @@
       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 HelpButton: TButton
         Left = 337
         Height = 25
    -    Top = 129
    +    Top = 138
         Width = 91
         Anchors = [akRight, akBottom]
         Caption = 'Help'
    @@ -138,10 +138,18 @@
       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
    
    replacedlg.2.diff (6,024 bytes)
  • replacedlg.doc.diff (820 bytes)
    Index: docs/xml/lcl/dialogs.xml
    ===================================================================
    --- docs/xml/lcl/dialogs.xml	(revision 32978)
    +++ docs/xml/lcl/dialogs.xml	(working copy)
    @@ -1831,6 +1831,12 @@
           <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>
    
    replacedlg.doc.diff (820 bytes)

Activities

2011-11-09 01:39

 

replacedlg.diff (5,899 bytes)
Index: lcl/dialogs.pp
===================================================================
--- lcl/dialogs.pp	(revision 33269)
+++ lcl/dialogs.pp	(working copy)
@@ -368,7 +368,7 @@
   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)

Index: lcl/include/replacedialog.inc
===================================================================
--- lcl/include/replacedialog.inc	(revision 33269)
+++ lcl/include/replacedialog.inc	(working copy)
@@ -26,6 +26,7 @@
 { TReplaceDialogForm }
 
   TReplaceDialogForm = class(TForm)
+    PromptOnReplaceCheckBox: TCheckBox;
     EntireScopeCheckBox: TCheckBox;
     FindMoreButton: TButton;
     ReplaceButton: TButton;
@@ -76,6 +77,7 @@
     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 @@
   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 @@
   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 @@
     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;

Index: lcl/lclstrconsts.pas
===================================================================
--- lcl/lclstrconsts.pas	(revision 33269)
+++ lcl/lclstrconsts.pas	(working copy)
@@ -352,6 +352,7 @@
   rsWholeWordsOnly = 'Whole words only';
   rsCaseSensitive = 'Case sensitive';
   rsEntireScope   = 'Search entire file';
+  rsPromptOnReplace = 'PromptOnReplace';
   rsText = 'Text';
   rsDirection = 'Direction';
   rsForward = 'Forward';

Index: lcl/forms/replacedlgunit.pas
===================================================================
--- lcl/forms/replacedlgunit.pas	(revision 33269)
+++ lcl/forms/replacedlgunit.pas	(working copy)
@@ -43,6 +43,7 @@
   { TReplaceDialogForm }
 
   TReplaceDialogForm = class(TForm)
+    PromptOnReplaceCheckBox: TCheckBox;
     EntireScopeCheckBox: TCheckBox;
     FindMoreButton: TButton;
     ReplaceButton: TButton;

Index: lcl/forms/replacedlgunit.lfm
===================================================================
--- lcl/forms/replacedlgunit.lfm	(revision 33269)
+++ lcl/forms/replacedlgunit.lfm	(working copy)
@@ -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 @@
   end
   object EditReplace: TEdit
     Left = 72
-    Height = 23
+    Height = 21
     Top = 42
     Width = 257
     Anchors = [akTop, akLeft, akRight]
@@ -47,17 +47,17 @@
   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 HelpButton: TButton
     Left = 337
     Height = 25
-    Top = 129
+    Top = 138
     Width = 91
     Anchors = [akRight, akBottom]
     Caption = 'Help'
@@ -138,10 +138,18 @@
   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
replacedlg.diff (5,899 bytes)

Zeljan Rikalo

2011-11-09 07:56

developer   ~0053946

that resource string should be "Prompt on replace", not PromptOnReplace

Felipe Monteiro de Carvalho

2011-11-09 08:03

developer   ~0053947

Is the feature on by default in your patch? It looks like that to me. I think it should be off by default, because it requires the code that uses the replace dialog to be aware of it and implement the actual prompt on replace, correct?

Bart Broersma

2011-11-09 12:49

developer   ~0053951

@Felipe: I wondered if I should make the checkbox not visible by default when I wrote the patch, but when the "Entire scope" checkbox was introduced it also was on by default (it couldn't turned off to begin with, so I wrote a patch for that some time ago).
I'll be happy to include frHidePropmtOnReplace in Options in the constructor.

@Zeljan: well spotted. I shouldn't write patches after midnight.

2011-11-09 13:18

 

replacedlg.2.diff (6,024 bytes)
Index: lcl/dialogs.pp
===================================================================
--- lcl/dialogs.pp	(revision 33269)
+++ lcl/dialogs.pp	(working copy)
@@ -368,7 +368,7 @@
   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)
Index: lcl/include/replacedialog.inc
===================================================================
--- lcl/include/replacedialog.inc	(revision 33269)
+++ lcl/include/replacedialog.inc	(working copy)
@@ -26,6 +26,7 @@
 { TReplaceDialogForm }
 
   TReplaceDialogForm = class(TForm)
+    PromptOnReplaceCheckBox: TCheckBox;
     EntireScopeCheckBox: TCheckBox;
     FindMoreButton: TButton;
     ReplaceButton: TButton;
@@ -76,6 +77,7 @@
     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 @@
   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 @@
   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 @@
     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 @@
 constructor TReplaceDialog.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  Options:=Options + [frReplace, frReplaceAll];
+  Options:=Options + [frReplace, frReplaceAll, frHidePromptOnreplace];
 end;
 
 function TReplaceDialog.DefaultTitle: string; 
Index: lcl/lclstrconsts.pas
===================================================================
--- lcl/lclstrconsts.pas	(revision 33269)
+++ lcl/lclstrconsts.pas	(working copy)
@@ -352,6 +352,7 @@
   rsWholeWordsOnly = 'Whole words only';
   rsCaseSensitive = 'Case sensitive';
   rsEntireScope   = 'Search entire file';
+  rsPromptOnReplace = 'Prompt on replace';
   rsText = 'Text';
   rsDirection = 'Direction';
   rsForward = 'Forward';
Index: lcl/forms/replacedlgunit.pas
===================================================================
--- lcl/forms/replacedlgunit.pas	(revision 33269)
+++ lcl/forms/replacedlgunit.pas	(working copy)
@@ -43,6 +43,7 @@
   { TReplaceDialogForm }
 
   TReplaceDialogForm = class(TForm)
+    PromptOnReplaceCheckBox: TCheckBox;
     EntireScopeCheckBox: TCheckBox;
     FindMoreButton: TButton;
     ReplaceButton: TButton;
Index: lcl/forms/replacedlgunit.lfm
===================================================================
--- lcl/forms/replacedlgunit.lfm	(revision 33269)
+++ lcl/forms/replacedlgunit.lfm	(working copy)
@@ -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 @@
   end
   object EditReplace: TEdit
     Left = 72
-    Height = 23
+    Height = 21
     Top = 42
     Width = 257
     Anchors = [akTop, akLeft, akRight]
@@ -47,17 +47,17 @@
   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 HelpButton: TButton
     Left = 337
     Height = 25
-    Top = 129
+    Top = 138
     Width = 91
     Anchors = [akRight, akBottom]
     Caption = 'Help'
@@ -138,10 +138,18 @@
   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
replacedlg.2.diff (6,024 bytes)

Bart Broersma

2011-11-09 13:18

developer   ~0053952

New patch uploaded with corrected resourcestring and hiding the PromptOnReplace checkbox by default.

Vincent Snijders

2011-11-09 13:59

manager   ~0053954

I see in the patch both frPromptOnReplace and frHidePromptOnReplace. Some for Entire Scope. Seems confusing to me revert the logical, depending on the class you are in.

Bart Broersma

2011-11-09 16:02

developer   ~0053956

@Vincent:

> Seems confusing to me revert the logical, depending on the class you are in

I do not understand what you mean by that.

The frPromptOnReplace/frHidePromptOnReplace combination is there by design.
It allows for the checkbox to be visible or not, depending on the preferences of the programmer.
The same logic exist for WholeWords, MatchCase, UpDown and EntireScope.

WholeWords, MatchCase and UpDown also have options to disable them.

(I once proposed to have such option to disable EntireScope, but this was rejected by Mattias (see: http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-June/064303.html), and so I did not introduce this option for PromptOnReplace)

At a request of Felipe I defaulted the PromptOnReplace checkbox to be not visible.
This has the advantage that users do not have to alter existing ReplaceDialogs when rebuilding.

So, what exactly would you like me to change in the proposed patch?
Or do you think there should be no PromptOnReplace at all in TReplaceDialog?

Felipe Monteiro de Carvalho

2011-11-10 09:00

developer   ~0053967

Last edited: 2011-11-10 09:04

@Vincent:

Ummm, there are up 3 options for the same item, for example: frDisableMatchCase, frHideMatchCase, frMatchCase

And they all have different meanings, and there are even various meanings for various parts which look simetric at first, but are not simetric in meaning. It is a bit confusing, but everything is documented here, and comes from Delphi:

http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Dialogs_TFindOptions.html

Note that I am just comenting on the general idea, I haven't fully revied to check what is the meaning of this new options.

Felipe Monteiro de Carvalho

2011-11-10 09:01

developer   ~0053968

@Bart

Could you also add a patch for the documentation explaining exactly what your new options do?

Bart Broersma

2011-11-10 11:46

developer   ~0053973

@Felipe: where do I find that documentation?

Vincent Snijders

2011-11-10 13:08

manager   ~0053974

Indeed, those options confused me.

2011-11-11 21:34

 

replacedlg.doc.diff (820 bytes)
Index: docs/xml/lcl/dialogs.xml
===================================================================
--- docs/xml/lcl/dialogs.xml	(revision 32978)
+++ docs/xml/lcl/dialogs.xml	(working copy)
@@ -1831,6 +1831,12 @@
       <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>
replacedlg.doc.diff (820 bytes)

Bart Broersma

2011-11-11 21:35

developer   ~0054020

Reminder sent to: Felipe Monteiro de Carvalho

Felipe: patch for docs is attached.
Can this be applied now?

Juha Manninen

2011-11-17 13:17

developer   ~0054149

Unless Felipe or someone else objects, I will apply this in near future.

Juha Manninen

2011-11-17 14:42

developer   ~0054153

Applied. Thanks.

Bart Broersma

2011-12-03 14:24

developer   ~0054667

Thanks for applying.

Issue History

Date Modified Username Field Change
2011-11-09 01:39 Bart Broersma New Issue
2011-11-09 01:39 Bart Broersma File Added: replacedlg.diff
2011-11-09 01:39 Bart Broersma LazTarget => -
2011-11-09 07:56 Zeljan Rikalo Note Added: 0053946
2011-11-09 08:03 Felipe Monteiro de Carvalho Note Added: 0053947
2011-11-09 12:49 Bart Broersma Note Added: 0053951
2011-11-09 13:18 Bart Broersma File Added: replacedlg.2.diff
2011-11-09 13:18 Bart Broersma Note Added: 0053952
2011-11-09 13:59 Vincent Snijders Note Added: 0053954
2011-11-09 16:02 Bart Broersma Note Added: 0053956
2011-11-10 09:00 Felipe Monteiro de Carvalho Note Added: 0053967
2011-11-10 09:01 Felipe Monteiro de Carvalho Note Edited: 0053967
2011-11-10 09:01 Felipe Monteiro de Carvalho Note Added: 0053968
2011-11-10 09:03 Felipe Monteiro de Carvalho Note Edited: 0053967
2011-11-10 09:04 Felipe Monteiro de Carvalho Note Edited: 0053967
2011-11-10 11:46 Bart Broersma Note Added: 0053973
2011-11-10 13:08 Vincent Snijders Note Added: 0053974
2011-11-11 21:34 Bart Broersma File Added: replacedlg.doc.diff
2011-11-11 21:35 Bart Broersma Note Added: 0054020
2011-11-12 11:45 Felipe Monteiro de Carvalho Status new => assigned
2011-11-12 11:45 Felipe Monteiro de Carvalho Assigned To => Felipe Monteiro de Carvalho
2011-11-17 13:16 Juha Manninen Assigned To Felipe Monteiro de Carvalho => Juha Manninen
2011-11-17 13:17 Juha Manninen Note Added: 0054149
2011-11-17 14:42 Juha Manninen Fixed in Revision => r33585
2011-11-17 14:42 Juha Manninen Status assigned => resolved
2011-11-17 14:42 Juha Manninen Resolution open => fixed
2011-11-17 14:42 Juha Manninen Note Added: 0054153
2011-12-03 14:24 Bart Broersma Status resolved => closed
2011-12-03 14:24 Bart Broersma Note Added: 0054667
2011-12-03 14:24 Bart Broersma Fixed in Version => 0.9.30.1 (SVN)