Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-07

findinfiles.diff

9 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bob Wingard

Attached is a patch against, findinfilesdlg.pas, ideprocs.pp, dialogs.pp and uniteditor.pp.

Summary:

findinfiles.pas - Add dialogs to uses section, call new function SelectDirectory when the browse directory button is pressed, returns selected directory. TODO: Add path history and save selections.

ideprocs.pp - Modified the FindInFiles procedure to include some context information about the find. The message now includes the next 60 charaters after the search text.

uniteditor.pp - Ingnore files that are open or part of the project but do not exist on disk yet, this would cause lazarus to crash, bad bad. Added informational messages to the message window when a search fails. TODO: Add progress box with Cancel button.

dialogs.pp - Added the function SelectDirectory, this is same function that is in free-clx. Displays a dialog and returns selected directory.

dirsel.lfm, dirsel.lrs, dirsel.pas - Files to implement a work alike for the Directory Browser in kylix. Borland used a lot of libc calls in thier version, I replace these with regular pascal calls, no chance the libc calls would have worked on win32! This dialog is fully functional, but is still pretty rough. I will continue to clean it up. I had these files in /lazarus/lcl directory. There is not a drive list box, no such thing in linux, I will add one later and disable it if on linux or fill it with drives if on windows. I need some help with locating images of open and closed folders, when I have them I will make the treeview owner drawn and spiff it up a bit.

Bob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00019.zip
Type: application/octet-stream
Size: 7032 bytes
Desc: "findinfiles.zip"
Url : http://localhost/pipermail/lazarus/attachments/20030731/62efe7a5/zip00019.obj

Reply by email

Mattias Gaertner
to Bob Wingard
Attached is a patch against, findinfilesdlg.pas, ideprocs.pp, dialogs.pp and uniteditor.pp.

Great. Applied.

Show quoted text 28 lines
Summary: findinfiles.pas - Add dialogs to uses section, call new function SelectDirectory when the browse directory button is pressed, returns selected directory. TODO: Add path history and save selections. ideprocs.pp - Modified the FindInFiles procedure to include some context information about the find. The message now includes the next 60 charaters after the search text. uniteditor.pp - Ingnore files that are open or part of the project but do not exist on disk yet, this would cause lazarus to crash, bad bad. Added informational messages to the message window when a search fails. TODO: Add progress box with Cancel button. dialogs.pp - Added the function SelectDirectory, this is same function that is in free-clx. Displays a dialog and returns selected directory. dirsel.lfm, dirsel.lrs, dirsel.pas - Files to implement a work alike for the Directory Browser in kylix. Borland used a lot of libc calls in thier version, I replace these with regular pascal calls, no chance the libc calls would have worked on win32! This dialog is fully functional, but is still pretty rough. I will continue to clean it up. I had these files in /lazarus/lcl directory. There is not a drive list box, no such thing in linux, I will add one later and disable it if on linux or fill it with drives if on windows. I need some help with locating images of open and closed folders, when I have them I will make the treeview owner drawn and spiff it up a bit.

I changed the SelectDirectory function to use the new SelectDirectoryProc variable. This way users can define their own directory selection or use the lcl one by adding DirSel to the uses section. This also breaks the unit circle.
I removed the global variables in dirsel.pas.

What help do you need with icons?

Mattias

Reply by email

Vincent Snijders
to Bob Wingard: Extends InputHistory class to include Find In Files Dialog Search Paths and Masks Modify…
Show quoted text 14 lines
> I think that the FindClose should be outside the if then block in de > FindMatchingFiles procedure in ideproc. What happens if FindFirst > return 0, for example when there are no *.inc files in a directory. > FindClose is not called. This is also true for the recursive find, > but there FindFirst (almost?) never return zero, for a directory > contains the . file. Notice that the check if a file is a directory > if ((faDirectory and FileInfo.Attr)>0) then (line 2104) > is only done for the first file found. Maybe this should be put > inside the repeat until loop. Yep. Mattias

Attached the patch to do this.

Vincent.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gz00031.gz
Type: application/octet-stream
Size: 704 bytes
Desc: "findinfiles.patch.gz"
Url : http://localhost/pipermail/lazarus/attachments/20030804/b05c8af0/gz00031.obj

Reply by email

Vincent Snijders
to Bob Wingard: Extends InputHistory class to include Find In Files Dialog Search Paths and Masks Modify…
Show quoted text 5 lines
Extends InputHistory class to include Find In Files Dialog Search Paths and Masks Modify UnitEditor To load and save Find In Files Dialog History. Bob

I am very fond of the findinfiles dialog (and heaptrc). Some more remarks, hopefully helpful.

The msgview form doesn't free the DirectoryList. Attached patch solves thie memoryleak.

I think that the FindClose should be outside the if then block in de FindMatchingFiles procedure in ideproc. What happens if FindFirst return 0, for example when there are no *.inc files in a directory. FindClose is not called. This is also true for the recursive find, but there FindFirst (almost?) never return zero, for a directory contains the . file. Notice that the check if a file is a directory if ((faDirectory and FileInfo.Attr)>0) then (line 2104) is only done for the first file found. Maybe this should be put inside the repeat until loop.

Regards,
Vincent.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gz00030.gz
Type: application/octet-stream
Size: 448 bytes
Desc: "msgview.patch.gz"
Url : http://localhost/pipermail/lazarus/attachments/20030803/8b949cac/gz00030.obj

Reply by email

Vincent Snijders

I beat you to it just a few minutes. Mattias must decide which patch to apply.
Bob, did I mention that, thanks for implementing this nice piece of functionality. Glad I could help.

Vincent.

Show quoted text 8 lines
-----Oorspronkelijk bericht----- Van: Bob Wingard Verzonden: dinsdag 5 augustus 2003 0:04 Aan: Lazarus List Onderwerp: [lazarus] Findinfiles.diff I have stopped receiving messages from the list, but I looked at the archive on the lazarus web site saw the comments from Vincent about

the

Show quoted text 5 lines
directory test on line 2104 in ideprocs.pp. Again you are correct, the attached patch will correct the problem. Did I mention that, *you da man* :-) Vincent, thanks. Bob

Reply by email

Bob Wingard

I have stopped receiving messages from the list, but I looked at the archive on the lazarus web site saw the comments from Vincent about the directory test on line 2104 in ideprocs.pp. Again you are correct, the attached patch will correct the problem. Did I mention that, *you da man* :-) Vincent, thanks.

Bob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00025.zip
Type: application/octet-stream
Size: 580 bytes
Desc: "findinfiles.zip"
Url : http://localhost/pipermail/lazarus/attachments/20030804/873a74cb/zip00025.obj

Reply by email

Mattias Gaertner
to Bob Wingard: Extends InputHistory class to include Find In Files Dialog Search Paths and Masks Modify…
Show quoted text 13 lines
On Sun, 03 Aug 2003 14:47:00 -0400 Bob Wingard wrote: > Extends InputHistory class to include Find In Files Dialog Search > Paths and Masks > Modify UnitEditor To load and save Find In Files Dialog History. > > Bob I am very fond of the findinfiles dialog (and heaptrc). Some more remarks, hopefully helpful. The msgview form doesn't free the DirectoryList. Attached patch solves thie memoryleak.

Thanks. Applied both fixes.

Show quoted text 9 lines
I think that the FindClose should be outside the if then block in de FindMatchingFiles procedure in ideproc. What happens if FindFirst return 0, for example when there are no *.inc files in a directory. FindClose is not called. This is also true for the recursive find, but there FindFirst (almost?) never return zero, for a directory contains the . file. Notice that the check if a file is a directory if ((faDirectory and FileInfo.Attr)>0) then (line 2104) is only done for the first file found. Maybe this should be put inside the repeat until loop.

Yep.

Mattias

Reply by email

Mattias Gaertner
to Bob Wingard: Extends InputHistory class to include Find In Files Dialog Search Paths and Masks Modify…
Show quoted text 15 lines
> > I think that the FindClose should be outside the if then block in de > > FindMatchingFiles procedure in ideproc. What happens if FindFirst > > return 0, for example when there are no *.inc files in a directory. > > FindClose is not called. This is also true for the recursive find, > > but there FindFirst (almost?) never return zero, for a directory > > contains the . file. Notice that the check if a file is a directory > > if ((faDirectory and FileInfo.Attr)>0) then (line 2104) > > is only done for the first file found. Maybe this should be put > > inside the repeat until loop. > > Yep. > > > Mattias Attached the patch to do this.

Applied.

Mattias

Reply by email