using combobox autotext for findreplace dlg

git-svn-id: trunk@8930 -
This commit is contained in:
mattias 2006-03-13 00:39:02 +00:00
parent b9bd15f7c6
commit 5e2fc8584f
4 changed files with 30 additions and 12 deletions

View File

@ -134,6 +134,7 @@ begin
SetBounds(ComboX,y,Self.ClientWidth-ComboX-x,Height);
Anchors:= [akLeft, akTop, akRight];
Text:='';
AutoCompleteText := [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending];
OnKeyDown:=@TextToFindComboBoxKeyDown;
Parent:=Self;
TabOrder:=0;
@ -155,6 +156,7 @@ begin
SetBounds(ComboX,y,Self.ClientWidth-ComboX-x,Height);
Anchors:= [akLeft, akTop, akRight];
Text:='';
AutoCompleteText := [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending];
OnKeyDown:=@TextToFindComboBoxKeyDown;
Parent:=Self;
TabOrder:=1;
@ -305,7 +307,7 @@ begin
Parent:= Self;
Default:=true;
SetBounds(Parent.ClientWidth-350,Parent.ClientHeight-32,120,Height);
Caption:='Ok';
Caption:='O&k';
OnClick:=@OkButtonClick;
end;
@ -551,6 +553,9 @@ begin
if ssoBackwards in NewOptions
then DirectionRadioGroup.ItemIndex:=1
else DirectionRadioGroup.ItemIndex:=0;
if ssoSelectedOnly in NewOptions then
ScopeRadioGroup.ItemIndex := 1 else
ScopeRadioGroup.ItemIndex := 0;
ReplaceAllButton.Enabled:=ssoReplace in NewOptions;
ReplaceTextComboBox.Enabled:=ReplaceAllButton.Enabled;
ReplaceWithLabel.Enabled:=ReplaceAllButton.Enabled;

View File

@ -1185,7 +1185,7 @@ resourcestring
lisFRBackwardSearch = 'Backward search';
dlgUpWord = 'Up';
dlgDownWord = 'Down';
dlgReplaceAll = 'Replace All';
dlgReplaceAll = 'Replace &All';
// IDEOptionDefs
dlgGetPosition = 'Get position';

View File

@ -991,6 +991,7 @@ end;
{------------------------------S T A R T F I N D-----------------------------}
procedure TSourceEditor.StartFindAndReplace(Replace:boolean);
var ALeft,ATop:integer;
bSelectedTextOption: Boolean;
begin
if SourceNotebook<>nil then
SourceNotebook.InitFindDialog;
@ -1028,6 +1029,12 @@ begin
FindReplaceDlg.Left:=ALeft;
FindReplaceDlg.Top:=ATop;
try
bSelectedTextOption := (ssoSelectedOnly in FindReplaceDlg.Options);
//if there are selected text and more than 1 word, automatically enable selected text option
if (EditorComponent.SelAvail and (Pos(' ', EditorComponent.SelText) <> 0)) then
FindReplaceDlg.Options := FindReplaceDlg.Options + [ssoSelectedOnly];
if (FindReplaceDlg.ShowModal = mrCancel) then begin
exit;
end;
@ -1038,6 +1045,12 @@ begin
InputHistories.AddToFindHistory(FindReplaceDlg.FindText);
InputHistories.Save;
DoFindAndReplace;
finally
//Restore original find options
if bSelectedTextOption then
FindReplaceDlg.Options := FindReplaceDlg.Options + [ssoSelectedOnly] else
FindReplaceDlg.Options := FindReplaceDlg.Options - [ssoSelectedOnly];
end;//End try-finally
end;
{------------------------------F I N D A G A I N ----------------------------}

View File

@ -47,7 +47,7 @@ ResourceString
rsMbIgnore = '&Ignore';
rsMbAll = '&All';
rsMbNoToAll = 'No to all';
rsMbYesToAll = 'Yes to all';
rsMbYesToAll = 'Yes to &All';
rsMbHelp = '&Help';
rsMbClose = '&Close';