mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 00:19:26 +02:00
findinfiles uses tselectdirectorydialog; remove global SelectDirectory function (from vincent)
git-svn-id: trunk@5094 -
This commit is contained in:
parent
5c441f1564
commit
39eee1a5a3
@ -24,7 +24,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLIntf, Controls, StdCtrls, Forms, Buttons, ExtCtrls,
|
Classes, SysUtils, LCLIntf, Controls, StdCtrls, Forms, Buttons, ExtCtrls,
|
||||||
LResources, FileCtrl, LazarusIDEStrConsts, DirSel, Dialogs, SynEditTypes;
|
LResources, FileCtrl, LazarusIDEStrConsts, Dialogs, SynEditTypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
TLazFindInFileSearchOption = (fifMatchCase, fifWholeWord, fifRegExpr,
|
TLazFindInFileSearchOption = (fifMatchCase, fifWholeWord, fifRegExpr,
|
||||||
@ -46,6 +46,7 @@ type
|
|||||||
DirectoryLabel: TLabel;
|
DirectoryLabel: TLabel;
|
||||||
DirectoryComboBox: TComboBox;
|
DirectoryComboBox: TComboBox;
|
||||||
DirectoryBrowse: TBitBtn;
|
DirectoryBrowse: TBitBtn;
|
||||||
|
SelectDirectoryDialog: TSelectDirectoryDialog;
|
||||||
FileMaskLabel: TLabel;
|
FileMaskLabel: TLabel;
|
||||||
FileMaskComboBox: TComboBox;
|
FileMaskComboBox: TComboBox;
|
||||||
IncludeSubDirsCheckBox: TCheckBox;
|
IncludeSubDirsCheckBox: TCheckBox;
|
||||||
@ -200,6 +201,10 @@ begin
|
|||||||
OnClick:=@DirectoryBrowseClick;
|
OnClick:=@DirectoryBrowseClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
SelectDirectoryDialog := TSelectDirectoryDialog.Create(Self);
|
||||||
|
with SelectDirectoryDialog do
|
||||||
|
Options:= Options + [ofPathMustExist];
|
||||||
|
|
||||||
FileMaskLabel:=TLabel.Create(Self);
|
FileMaskLabel:=TLabel.Create(Self);
|
||||||
with FileMaskLabel do begin
|
with FileMaskLabel do begin
|
||||||
Name:='FileMaskLabel';
|
Name:='FileMaskLabel';
|
||||||
@ -356,16 +361,10 @@ begin
|
|||||||
end;//WhereRaidoGroupClick
|
end;//WhereRaidoGroupClick
|
||||||
|
|
||||||
procedure TLazFindInFilesDialog.DirectoryBrowseClick(Sender: TObject);
|
procedure TLazFindInFilesDialog.DirectoryBrowseClick(Sender: TObject);
|
||||||
var
|
|
||||||
TheDirectory: string; //Starting Directory and
|
|
||||||
//Directory Returned from Function
|
|
||||||
TheRootDir: string; //The root directory on the current dirve
|
|
||||||
begin
|
begin
|
||||||
TheDirectory:= GetCurrentDir;
|
SelectDirectoryDialog.InitialDir:= GetCurrentDir;
|
||||||
TheRootDir:= ExtractFileDrive(TheDirectory);
|
if SelectDirectoryDialog.Execute then
|
||||||
TheRootDir:= FileCtrl.AppendPathDelim(TheRootDir);
|
DirectoryComboBox.Text:= SelectDirectoryDialog.FileName;
|
||||||
if SelectDirectory('Select A Directory', TheRootDir, TheDirectory, false) then
|
|
||||||
DirectoryComboBox.Text:= TheDirectory;
|
|
||||||
end;//DirectoryBrowseClick
|
end;//DirectoryBrowseClick
|
||||||
|
|
||||||
procedure TLazFindInFilesDialog.SetOptions(
|
procedure TLazFindInFilesDialog.SetOptions(
|
||||||
|
@ -313,18 +313,7 @@ type
|
|||||||
Function InputBox(const ACaption, APrompt, ADefault : String) : String;
|
Function InputBox(const ACaption, APrompt, ADefault : String) : String;
|
||||||
Function PasswordBox(const ACaption, APrompt : String) : String;
|
Function PasswordBox(const ACaption, APrompt : String) : String;
|
||||||
|
|
||||||
{ Directory Selection }
|
|
||||||
type
|
|
||||||
TSelectDirectoryProc = function(const Caption: String; const Root: string;
|
|
||||||
var Directory: string; ShowHidden: Boolean): Boolean;
|
|
||||||
|
|
||||||
function SelectDirectory(const Caption: String; const Root: string;
|
|
||||||
var Directory: string; ShowHidden: Boolean): Boolean;
|
|
||||||
|
|
||||||
var
|
|
||||||
SelectDirectoryProc: TSelectDirectoryProc;
|
|
||||||
|
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -392,14 +381,6 @@ begin
|
|||||||
Result := MessageDlg(Caption,Text,DlgType,Buttons,0);
|
Result := MessageDlg(Caption,Text,DlgType,Buttons,0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SelectDirectory(const Caption: String; const Root: string;
|
|
||||||
var Directory: string; ShowHidden: Boolean): Boolean;
|
|
||||||
begin
|
|
||||||
Result:=false;
|
|
||||||
if Assigned(SelectDirectoryProc) then
|
|
||||||
Result:=SelectDirectoryProc(Caption,Root,Directory,ShowHidden);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{$I colordialog.inc}
|
{$I colordialog.inc}
|
||||||
{$I commondialog.inc}
|
{$I commondialog.inc}
|
||||||
@ -414,7 +395,6 @@ initialization
|
|||||||
Forms.MessageBoxFunction:=@ShowMessageBox;
|
Forms.MessageBoxFunction:=@ShowMessageBox;
|
||||||
InterfaceBase.InputDialogFunction:=@ShowInputDialog;
|
InterfaceBase.InputDialogFunction:=@ShowInputDialog;
|
||||||
InterfaceBase.PromptDialogFunction:=@ShowPromptDialog;
|
InterfaceBase.PromptDialogFunction:=@ShowPromptDialog;
|
||||||
SelectDirectoryProc:=nil;
|
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
|
|
||||||
@ -423,6 +403,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.41 2004/01/24 11:42:53 micha
|
||||||
|
findinfiles uses tselectdirectorydialog; remove global SelectDirectory function (from vincent)
|
||||||
|
|
||||||
Revision 1.40 2004/01/13 16:39:01 mattias
|
Revision 1.40 2004/01/13 16:39:01 mattias
|
||||||
changed consistency stops during var renaming to errors
|
changed consistency stops during var renaming to errors
|
||||||
|
|
||||||
|
@ -264,30 +264,7 @@ begin
|
|||||||
Result:= GetAbsolutePath(TV.Selected);
|
Result:= GetAbsolutePath(TV.Selected);
|
||||||
end;//SelectedDir
|
end;//SelectedDir
|
||||||
|
|
||||||
function InternalSelectDirectory(const Caption: String;
|
|
||||||
const Root: string; var Directory: string; ShowHidden: Boolean): Boolean;
|
|
||||||
var
|
|
||||||
Dlg: TDirSelDlg;
|
|
||||||
begin
|
|
||||||
Dlg := TDirSelDlg.Create(Application);
|
|
||||||
if Dlg <> nil then
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Dlg.ShowHidden := ShowHidden;
|
|
||||||
Dlg.RootDirectory := Root;
|
|
||||||
Dlg.Directory := Directory;
|
|
||||||
Dlg.Caption := Caption;
|
|
||||||
Result := Dlg.ShowModal = mrOK;
|
|
||||||
if Result then Directory := Dlg.SelectedDir;
|
|
||||||
finally
|
|
||||||
Dlg.Free;
|
|
||||||
end;
|
|
||||||
end;//if
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$I dirsel.lrs}
|
{$I dirsel.lrs}
|
||||||
SelectDirectoryProc:=@InternalSelectDirectory;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -787,22 +787,14 @@ Var
|
|||||||
B : Boolean;
|
B : Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If Assigned(SelectDirectoryProc) then
|
Dlg:=CreateDialog;
|
||||||
begin
|
Try
|
||||||
D:=Text;
|
B:=Dlg.Execute;
|
||||||
B:=SelectDirectory(DialogTitle,RootDir,D,ShowHidden);
|
If B then
|
||||||
end
|
D:=GetDialogResult(Dlg);
|
||||||
else
|
Finally
|
||||||
begin
|
Dlg.Free;
|
||||||
Dlg:=CreateDialog;
|
end;
|
||||||
Try
|
|
||||||
B:=Dlg.Execute;
|
|
||||||
If B then
|
|
||||||
D:=GetDialogResult(Dlg);
|
|
||||||
Finally
|
|
||||||
Dlg.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
If B then
|
If B then
|
||||||
begin
|
begin
|
||||||
If Assigned(FOnAcceptDir) then
|
If Assigned(FOnAcceptDir) then
|
||||||
|
Loading…
Reference in New Issue
Block a user