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

View File

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

View File

@ -991,6 +991,7 @@ end;
{------------------------------S T A R T F I N D-----------------------------} {------------------------------S T A R T F I N D-----------------------------}
procedure TSourceEditor.StartFindAndReplace(Replace:boolean); procedure TSourceEditor.StartFindAndReplace(Replace:boolean);
var ALeft,ATop:integer; var ALeft,ATop:integer;
bSelectedTextOption: Boolean;
begin begin
if SourceNotebook<>nil then if SourceNotebook<>nil then
SourceNotebook.InitFindDialog; SourceNotebook.InitFindDialog;
@ -1027,17 +1028,29 @@ begin
GetDialogPosition(FindReplaceDlg.Width,FindReplaceDlg.Height,ALeft,ATop); GetDialogPosition(FindReplaceDlg.Width,FindReplaceDlg.Height,ALeft,ATop);
FindReplaceDlg.Left:=ALeft; FindReplaceDlg.Left:=ALeft;
FindReplaceDlg.Top:=ATop; 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 if (FindReplaceDlg.ShowModal = mrCancel) then begin
exit; exit;
end; end;
//debugln('TSourceEditor.StartFindAndReplace B FindReplaceDlg.FindText="',dbgstr(FindReplaceDlg.FindText),'"'); //debugln('TSourceEditor.StartFindAndReplace B FindReplaceDlg.FindText="',dbgstr(FindReplaceDlg.FindText),'"');
if Replace then if Replace then
InputHistories.AddToReplaceHistory(FindReplaceDlg.ReplaceText); InputHistories.AddToReplaceHistory(FindReplaceDlg.ReplaceText);
InputHistories.AddToFindHistory(FindReplaceDlg.FindText); InputHistories.AddToFindHistory(FindReplaceDlg.FindText);
InputHistories.Save; InputHistories.Save;
DoFindAndReplace; 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; end;
{------------------------------F I N D A G A I N ----------------------------} {------------------------------F I N D A G A I N ----------------------------}

View File

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