mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 08:59:10 +02:00
using combobox autotext for findreplace dlg
git-svn-id: trunk@8930 -
This commit is contained in:
parent
b9bd15f7c6
commit
5e2fc8584f
@ -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;
|
||||||
|
@ -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';
|
||||||
|
@ -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;
|
||||||
@ -1028,16 +1029,28 @@ begin
|
|||||||
FindReplaceDlg.Left:=ALeft;
|
FindReplaceDlg.Left:=ALeft;
|
||||||
FindReplaceDlg.Top:=ATop;
|
FindReplaceDlg.Top:=ATop;
|
||||||
|
|
||||||
if (FindReplaceDlg.ShowModal = mrCancel) then begin
|
try
|
||||||
exit;
|
bSelectedTextOption := (ssoSelectedOnly in FindReplaceDlg.Options);
|
||||||
end;
|
//if there are selected text and more than 1 word, automatically enable selected text option
|
||||||
//debugln('TSourceEditor.StartFindAndReplace B FindReplaceDlg.FindText="',dbgstr(FindReplaceDlg.FindText),'"');
|
if (EditorComponent.SelAvail and (Pos(' ', EditorComponent.SelText) <> 0)) then
|
||||||
|
FindReplaceDlg.Options := FindReplaceDlg.Options + [ssoSelectedOnly];
|
||||||
|
|
||||||
if Replace then
|
if (FindReplaceDlg.ShowModal = mrCancel) then begin
|
||||||
InputHistories.AddToReplaceHistory(FindReplaceDlg.ReplaceText);
|
exit;
|
||||||
InputHistories.AddToFindHistory(FindReplaceDlg.FindText);
|
end;
|
||||||
InputHistories.Save;
|
//debugln('TSourceEditor.StartFindAndReplace B FindReplaceDlg.FindText="',dbgstr(FindReplaceDlg.FindText),'"');
|
||||||
DoFindAndReplace;
|
|
||||||
|
if Replace then
|
||||||
|
InputHistories.AddToReplaceHistory(FindReplaceDlg.ReplaceText);
|
||||||
|
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;
|
end;
|
||||||
|
|
||||||
{------------------------------F I N D A G A I N ----------------------------}
|
{------------------------------F I N D A G A I N ----------------------------}
|
||||||
|
@ -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';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user