MG: added facade for find in files

git-svn-id: trunk@394 -
This commit is contained in:
lazarus 2001-11-06 16:42:23 +00:00
parent c40fc48e9e
commit 6009a891c7
5 changed files with 275 additions and 13 deletions

1
.gitattributes vendored
View File

@ -99,6 +99,7 @@ ide/compreg.pp svneol=native#text/pascal
ide/customformeditor.pp svneol=native#text/pascal
ide/editoroptions.pp svneol=native#text/pascal
ide/environmentopts.pp svneol=native#text/pascal
ide/findinfilesdlg.pas svneol=native#text/pascal
ide/findreplacedialog.pp svneol=native#text/pascal
ide/formeditor.pp svneol=native#text/pascal
ide/global.inc svneol=native#text/pascal

257
ide/findinfilesdlg.pas Normal file
View File

@ -0,0 +1,257 @@
{
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Author: Mattias Gaertner
Abstract:
Find in files dialog form.
Usage:
Add to program
"Application.CreateForm(TLazFindInFilesDialog, FindInFilesDlg);"
Set the FindInFilesDlg.Options poperty
then do MResult:=FindInFilesDlg.ShowModal
ShowModal can have three possible results:
- mrOk for Find in files.
- mrCancel for Cancel
ToDo:
}
unit FindInFilesDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLLinux, Controls, StdCtrls, Forms, Buttons, ExtCtrls,
LResources;
type
TLazFindInFilesDialog = class(TForm)
private
published
TextToFindLabel: TLabel;
TextToFindEdit: TEdit;
OptionsGroupBox: TGroupBox;
CaseSensitiveCheckBox: TCheckBox;
WholeWordsOnlyCheckBox: TCheckBox;
RegularExpressionsCheckBox: TCheckBox;
WhereRadioGroup: TRadioGroup;
DirectoryOptionsGroupBox: TGroupBox;
DirectoryLabel: TLabel;
DirectoryComboBox: TComboBox;
DirectoryBrowse: TBitBtn;
FileMaskLabel: TLabel;
FileMaskComboBox: TComboBox;
IncludeSubDirsCheckBox: TCheckBox;
OkButton: TButton;
CancelButton: TButton;
procedure OkButtonClick(Sender: TObject);
procedure CancelButtonClick(Sender: TObject);
public
constructor Create(AOwner:TComponent); override;
end;
var FindInFilesDialog: TLazFindInFilesDialog;
implementation
{ TLazFindInFilesDialog }
constructor TLazFindInFilesDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
if LazarusResources.Find(ClassName)=nil then begin
Caption:='Find in files';
SetBounds((Screen.Width-320) div 2,(Screen.Height-430) div 2,320,430);
TextToFindLabel:=TLabel.Create(Self);
with TextToFindLabel do begin
Name:='TextToFindLabel';
Parent:=Self;
SetBounds(8,8,80,Height);
Caption:='Text to find:';
Visible:=true;
end;
TextToFindEdit:=TEdit.Create(Self);
with TextToFindEdit do begin
Name:='TextToFindEdit';
Parent:=Self;
SetBounds(TextToFindLabel.Left+TextToFindLabel.Width+5,
TextToFindLabel.Top-2,
Self.ClientWidth-TextToFindLabel.Left-TextToFindLabel.Width-13,
Height);
Text:='';
Visible:=true;
end;
OptionsGroupBox:=TGroupBox.Create(Self);
with OptionsGroupBox do begin
Name:='OptionsGroupBox';
Parent:=Self;
SetBounds(8,TextToFindLabel.Top+TextToFindLabel.Height+10,
Self.ClientWidth-20,95);
Caption:='Options';
Visible:=true;
end;
CaseSensitiveCheckBox:=TCheckBox.Create(Self);
with CaseSensitiveCheckBox do begin
Name:='CaseSensitiveCheckBox';
Parent:=OptionsGroupBox;
SetBounds(8,2,OptionsGroupBox.ClientWidth-20,20);
Caption:='Case sensitive';
Visible:=true;
end;
WholeWordsOnlyCheckBox:=TCheckBox.Create(Self);
with WholeWordsOnlyCheckBox do begin
Name:='WholeWordsOnlyCheckBox';
Parent:=OptionsGroupBox;
SetBounds(CaseSensitiveCheckBox.Left,
CaseSensitiveCheckBox.Top+CaseSensitiveCheckBox.Height+5,
CaseSensitiveCheckBox.Width,20);
Caption:='Whole words only';
Visible:=true;
end;
RegularExpressionsCheckBox:=TCheckBox.Create(Self);
with RegularExpressionsCheckBox do begin
Name:='RegularExpressionsCheckBox';
Parent:=OptionsGroupBox;
SetBounds(CaseSensitiveCheckBox.Left,
WholeWordsOnlyCheckBox.Top+WholeWordsOnlyCheckBox.Height+5,
CaseSensitiveCheckBox.Width,20);
Caption:='Regular expressions';
Visible:=true;
end;
WhereRadioGroup:=TRadioGroup.Create(Self);
with WhereRadioGroup do begin
Name:='WhereRadioGroup';
Parent:=Self;
SetBounds(8,OptionsGroupBox.Top+OptionsGroupBox.Height+10,
Self.ClientWidth-20,90);
Caption:='Where';
Items.BeginUpdate;
Items.Add('search all files in project');
Items.Add('search all open files');
Items.Add('search in directories');
Items.EndUpdate;
Visible:=true;
end;
DirectoryOptionsGroupBox:=TGroupBox.Create(Self);
with DirectoryOptionsGroupBox do begin
Name:='DirectoryOptionsGroupBox';
Parent:=Self;
SetBounds(8,WhereRadioGroup.Top+WhereRadioGroup.Height+10,
Self.ClientWidth-20,135);
Caption:='Directory options';
Visible:=true;
end;
DirectoryLabel:=TLabel.Create(Self);
with DirectoryLabel do begin
Name:='DirectoryLabel';
Parent:=DirectoryOptionsGroupBox;
SetBounds(8,5,80,Height);
Caption:='Directory';
Visible:=true;
end;
DirectoryComboBox:=TComboBox.Create(Self);
with DirectoryComboBox do begin
Name:='DirectoryComboBox';
Parent:=DirectoryOptionsGroupBox;
Left:=DirectoryLabel.Left+DirectoryLabel.Width+5;
Top:=DirectoryLabel.Top-2;
Width:=Parent.ClientWidth-Left-8-25-5;
Visible:=true;
end;
DirectoryBrowse:=TBitBtn.Create(Self);
with DirectoryBrowse do begin
Name:='DirectoryBrowse';
Parent:=DirectoryOptionsGroupBox;
SetBounds(DirectoryComboBox.Left+DirectoryComboBox.Width+5,
DirectoryComboBox.Top,25,25);
Caption:='...';
Visible:=true;
end;
FileMaskLabel:=TLabel.Create(Self);
with FileMaskLabel do begin
Name:='FileMaskLabel';
Parent:=DirectoryOptionsGroupBox;
SetBounds(8,DirectoryComboBox.Top+DirectoryComboBox.Height+5,200,Height);
Caption:='File mask (*, *.*, *.bak?)';
Visible:=true;
end;
FileMaskComboBox:=TComboBox.Create(Self);
with FileMaskComboBox do begin
Name:='FileMaskComboBox';
Parent:=DirectoryOptionsGroupBox;
SetBounds(FileMaskLabel.Left, FileMaskLabel.Top+FileMaskLabel.Height+3,
Self.ClientWidth-20-5-25,Height);
Visible:=true;
end;
IncludeSubDirsCheckBox:=TCheckBox.Create(Self);
with IncludeSubDirsCheckBox do begin
Name:='IncludeSubDirsCheckBox';
Parent:=DirectoryOptionsGroupBox;
SetBounds(8,FileMaskComboBox.Top+FileMaskComboBox.Height+10,
150,Height);
Caption:='Include sub directories';
Visible:=true;
end;
OkButton:=TButton.Create(Self);
with OkButton do begin
Name:='OkButton';
Parent:=Self;
SetBounds(Self.ClientWidth-200,Self.ClientHeight-40,80,Height);
Caption:='Ok';
OnClick:=@OkButtonClick;
Visible:=true;
end;
CancelButton:=TButton.Create(Self);
with CancelButton do begin
Name:='CancelButton';
Parent:=Self;
SetBounds(Self.ClientWidth-100,Self.ClientHeight-40,80,Height);
Caption:='Cancel';
OnClick:=@CancelButtonClick;
Visible:=true;
end;
end;
end;
procedure TLazFindInFilesDialog.OkButtonClick(Sender: TObject);
begin
ModalResult:=mrOk;
end;
procedure TLazFindInFilesDialog.CancelButtonClick(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
end.

View File

@ -38,7 +38,8 @@ uses
Splash,
Main,
MsgView,
FindReplaceDialog;
FindReplaceDialog,
FindInFilesDlg;
begin
Application.Initialize;
@ -57,6 +58,7 @@ CheckHeap('TMainIDE created');
{$ENDIF}
Application.CreateForm(TMessagesView, MessagesView);
Application.CreateForm(TLazFindReplaceDialog, FindReplaceDlg);
Application.CreateForm(TLazFindInFilesDialog, FindInFilesDialog);
SplashForm.StartTimer;
Application.Run;
SplashForm.Free;
@ -67,6 +69,9 @@ end.
{
$Log$
Revision 1.24 2001/11/06 16:42:23 lazarus
MG: added facade for find in files
Revision 1.23 2001/10/26 20:36:48 lazarus
Added an OnSelectionChanged event in Main.pp fired by MSgView dialog. This fires when the ListBox gets clicked on.
This allows the editor to highlight different lines when you click on different error messages.

View File

@ -1023,7 +1023,6 @@ begin
Clear;
ProjectInfoFile:=LPIFilename;
writeln('TProject.ReadProject A');
try
xmlconfig := TXMLConfig.Create(ProjectInfoFile);
except
@ -1032,7 +1031,6 @@ writeln('TProject.ReadProject A');
Result:=mrCancel;
exit;
end;
writeln('TProject.ReadProject B');
try
ProjectType := ProjectTypeNameToType(xmlconfig.GetValue(
@ -1506,8 +1504,8 @@ end.
{
$Log$
Revision 1.37 2001/11/06 16:21:05 lazarus
MG: fixed run parameter saving
Revision 1.38 2001/11/06 16:42:23 lazarus
MG: added facade for find in files
Revision 1.36 2001/11/06 15:47:32 lazarus
MG: added build all

View File

@ -38,7 +38,7 @@ uses
FindReplaceDialog, EditorOptions, CustomFormEditor, KeyMapping, StdCtrls,
Compiler, MsgView, WordCompletion, CodeToolManager, CodeCache, SourceLog,
SynEdit, SynEditHighlighter, SynHighlighterPas, SynEditAutoComplete,
SynEditKeyCmds,SynCompletion, Graphics, Extctrls, Menus, Splash;
SynEditKeyCmds,SynCompletion, Graphics, Extctrls, Menus, Splash, FindInFilesDlg;
type
// --------------------------------------------------------------------------
@ -2369,13 +2369,14 @@ End;
Procedure TSourceNotebook.FindInFilesClicked(Sender : TObject);
Begin
Application.MessageBox('If You can help us implement this feature, mail to'#13
+'lazarus@miraclec.com','Not implemented yet',mb_IconInformation+mb_OK);
{ MessageDlg('Not implemented yet',
'If you can help us to implement this feature, mail to'#13
+'lazarus@miraclec.com', mtInformation,[mbCancel],0);
}
if MessageDlg('Not implemented yet',
'If You can help us to implement this feature, mail to'#13
+'lazarus@miraclec.com', mtInformation,[mbOk,mbCancel],0)=mrCancel then exit;
if FindInFilesDialog.ShowModal=mrOk then begin
MessageDlg('I told You: Not implemented yet',
'If You can help us to implement this feature, mail to'#13
+'lazarus@miraclec.com', mtInformation,[mbOk,mbCancel],0);
end;
End;
Procedure TSourceNotebook.BookMarkClicked(Sender : TObject);