ADD: Search in viewer on Windows

ADD: Toolbar in editor.col
ADD: File search by Attributes
This commit is contained in:
Alexander Koblov 2007-08-20 21:23:44 +00:00
commit 112d4337e6
23 changed files with 3200 additions and 1065 deletions

View file

@ -415,7 +415,11 @@ begin
if FMappingHandle <> 0 then
FMappedFile := MapViewOfFile(FMappingHandle, FILE_MAP_READ, 0, 0, 0)
else
begin
FMappedFile:=nil;
FileClose(FFileHandle);
Exit;
end;
FPosition:=0;
Invalidate;

View file

@ -1,16 +1,18 @@
object dmDlg: TdmDlg
Height = 300
HorizontalOffset = 376
VerticalOffset = 238
Width = 400
object OpenDialog: TOpenDialog
FilterIndex = 0
left = 65
top = 72
end
object SaveDialog: TSaveDialog
FilterIndex = 0
left = 65
top = 104
end
end
object dmDlg: TdmDlg
Height = 300
HorizontalOffset = 294
VerticalOffset = 172
Width = 400
object OpenDialog: TOpenDialog
Title = 'Îòêðûòü ñóùåñòâóþùèé ôàéë'
FilterIndex = 0
left = 65
top = 72
end
object SaveDialog: TSaveDialog
Title = 'Ñîõðàíèòü ôàéë êàê'
FilterIndex = 0
left = 65
top = 104
end
end

2
doc/feditor.txt Normal file
View file

@ -0,0 +1,2 @@
$$$*** This is unit history file ***$$$ ###encoding="UTF-8"###
19.08.2007 ADD: Панель инструментов

View file

@ -3,4 +3,5 @@
ADD: Добавил функцию отображения контекстного меню
17.07.2007 ADD: Добавил обработку команд открыть, вставить, переименовать,
удалить в контекстное меню
15.08.2007 ADD: Обновление списка дисков
15.08.2007 ADD: Обновление списка дисков
19.08.2007 ADD: Функции отображения файла в память

2
doc/ufindthread.txt Normal file
View file

@ -0,0 +1,2 @@
$$$*** This is unit history file ***$$$ ###encoding="UTF-8"###
20.08.2007 ADD: Поиск по атрибутам

View file

@ -1,91 +1,92 @@
{ $threading on}
program doublecmd;
// uGlobs must be first in uses, uLng must be before any form;
{%File 'doc/changelog.txt'}
{.$APPTYPE GUI}
uses
{$IFDEF UNIX}
cthreads,
//cwstring,
{$ENDIF}
Interfaces,
LCLProc,
uGlobsPaths,
uGlobs,
uLng,
SysUtils,
Forms,
fMain,
fAbout,
uFileList,
uFilePanel,
uFileOp,
uTypes,
framePanel,
uFileOpThread,
uFileProcs,
fFileOpDlg,
uCopyThread,
uDeleteThread,
fMkDir,
uCompareFiles,
uHighlighterProcs,
fEditor,
uMoveThread,
fMsg,
uSpaceThread,
fHotDir,
fHardLink,
fFindView,
uPathHistory,
uExts,
uLog,
uShowForm,
fEditSearch,
uColorExt,
fEditorConf,
{$IFNDEF WIN32}
uFindMmap,
fFileProperties,
uUsersGroups,
{$ENDIF}
fLinker,
fCompareFiles,
dmHigh,
uPixMapManager, uVFS,
KASComp, fbtnchangedlg, fconfigtoolbar, uWCXprototypes, uDCUtils,
fLngForm, dmDialogs, fViewer, fOptions, fCopyDlg, fMoveDlg, fFindDlg,
fSymLink, fMultiRename, fSplitter, fPackDlg, fExtractDlg;
{$IFDEF WIN32}
{$R XP.res}
{$ENDIF}
begin
// AssignFile(output, 'c:\doublecmd.log');
// Rewrite(output);
Application.Title:='Double Commander';
// try
Application.Initialize;
ThousandSeparator:=' ';
DebugLn('Double commander 0.2 alpha - Free Pascal');
DebugLn('This program is free software released under terms of GNU GPL 2');
DebugLn('(C)opyright 2006-7 Koblov Alexander (Alexx2000@mail.ru)');
DebugLn(' and contributors (see about dialog)');
LoadPaths;
if LoadGlobs then
begin
LoadPixMapManager;
Application.CreateForm(TfrmMain, frmMain); // main form
Application.CreateForm(TdmHighl, dmHighl); // highlighters
Application.Run;
end;
{ except
on E:Exception do
Writeln('Critical unhandled exception:', E.Message);
end}
end.
{ $threading on}
program doublecmd;
// uGlobs must be first in uses, uLng must be before any form;
{%File 'doc/changelog.txt'}
{.$APPTYPE GUI}
uses
{$IFDEF UNIX}
cthreads,
//cwstring,
{$ENDIF}
Interfaces,
LCLProc,
uGlobsPaths,
uGlobs,
uLng,
SysUtils,
Forms,
fMain,
fAbout,
uFileList,
uFilePanel,
uFileOp,
uTypes,
framePanel,
uFileOpThread,
uFileProcs,
fFileOpDlg,
uCopyThread,
uDeleteThread,
fMkDir,
uCompareFiles,
uHighlighterProcs,
fEditor,
uMoveThread,
fMsg,
uSpaceThread,
fHotDir,
fHardLink,
fFindView,
uPathHistory,
uExts,
uLog,
uShowForm,
fEditSearch,
uColorExt,
fEditorConf,
{$IFNDEF WIN32}
uFindMmap,
fFileProperties,
uUsersGroups,
{$ENDIF}
fLinker,
fCompareFiles,
dmHigh,
uPixMapManager, uVFS,
KASComp, fbtnchangedlg, fconfigtoolbar, uWCXprototypes, uDCUtils,
fLngForm, dmDialogs, fViewer, fOptions, fCopyDlg, fMoveDlg, fFindDlg,
fSymLink, fMultiRename, fSplitter, fPackDlg, fExtractDlg;
{$IFDEF WIN32}
{$R XP.res}
{$ENDIF}
begin
// AssignFile(output, 'c:\doublecmd.log');
// Rewrite(output);
Application.Title:='Double Commander';
// try
Application.Initialize;
ThousandSeparator:=' ';
DebugLn('Double commander 0.2 alpha - Free Pascal');
DebugLn('This program is free software released under terms of GNU GPL 2');
DebugLn('(C)opyright 2006-7 Koblov Alexander (Alexx2000@mail.ru)');
DebugLn(' and contributors (see about dialog)');
LoadPaths;
if LoadGlobs then
begin
LoadPixMapManager;
Application.CreateForm(TfrmMain, frmMain); // main form
Application.CreateForm(TdmHighl, dmHighl); // highlighters
Application.CreateForm(TdmDlg, dmDlg); // dialogs
Application.Run;
end;
{ except
on E:Exception do
Writeln('Critical unhandled exception:', E.Message);
end}
end.

View file

@ -4,358 +4,358 @@ bg=$00000000
fg=$00FFFFFF
style=$0
[Asm]
bg=$00000000
fg=$0000FF00
bg=$00FFFFFF
fg=$00008000
style=$0
[Asm comment]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Asm key]
bg=$00000000
bg=$00FFFFFF
fg=$00000000
style=$0
[Assembler]
bg=$00000000
fg=$0000FF00
bg=$00FFFFFF
fg=$00008000
style=$0
[Attribute Name]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$00800000
style=$0
[Attribute Value]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Block]
bg=$000000FF
fg=$00FFFFFF
fg=$00000000
style=$0
[Untitled]
bg=$00000000
fg=$00000000
fg=$00FFFFFF
style=$0
[Brackets]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$000000FF
style=$0
[CDATA Section]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Character]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Class]
bg=$00000000
fg=$00FFFFFF
style=$0
bg=$00FFFFFF
fg=$00000000
style=$1
[Comment]
bg=$00000000
fg=$00C0C0C0
style=$2
bg=$00FFFFFF
fg=$00FF0000
style=$1
[Condition]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$000000FF
style=$0
[Data type]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Default packages]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Direction]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Directive]
bg=$00000000
fg=$00FFFFFF
style=$0
bg=$00FFFFFF
fg=$000000FF
style=$1
[DOCTYPE Section]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Documentation]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Element Name]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Embedded SQL]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Embedded text]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Entity Reference]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Escape ampersand]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Event]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Exception]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Float]
bg=$00000000
bg=$00FFFFFF
fg=$00FF00FF
style=$0
[Form]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Function]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Hexadecimal]
bg=$00000000
bg=$00FFFFFF
fg=$00FF00FF
style=$0
[Icon reference]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Identifier]
bg=$00000000
fg=$00FFFF00
style=$1
bg=$00FFFFFF
fg=$00000000
style=$0
[Illegal char]
bg=$00000000
bg=$00FFFFFF
fg=$000000FF
style=$0
[Include]
bg=$00000000
bg=$00FFFFFF
fg=$000000FF
style=$0
[Indirect]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Invalid symbol]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Internal function]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Key]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$00800000
style=$0
[Label]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Macro]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Marker]
bg=$00000000
bg=$00FFFFFF
fg=$000000FF
style=$0
[Message]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Miscellaneous]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Namespace Attribute Name]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Namespace Attribute Value]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Non-reserved keyword]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Null]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Number]
bg=$00000000
fg=$00FF00FF
bg=$00FFFFFF
fg=$00800000
style=$0
[Octal]
bg=$00000000
bg=$00FFFFFF
fg=$0000FF00
style=$0
[Operator]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$000000FF
style=$0
[Reserved word (PL/SQL)]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$1
[Pragma]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Preprocessor]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Processing Instruction]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Qualifier]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Register]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$1
[Reserved word]
bg=$00000000
fg=$00FFFF00
style=$0
bg=$00FFFFFF
fg=$00000000
style=$1
[Rpl]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Rpl key]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Rpl comment]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[SASM]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[SASM Comment]
bg=$00000000
bg=$00FFFFFF
fg=$00C0C0C0
style=$2
[SASM Key]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$00800000
style=$1
[Second reserved word]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$00800000
style=$0
[Section]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Space]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Special variable]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[SQL keyword]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$00800000
style=$0
[SQL*Plus command]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[String]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00800000
style=$0
[Symbol]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$000000FF
style=$0
[SyntaxError]
bg=$00000000
bg=$00FFFFFF
fg=$000000FF
style=$0
[System functions and variables]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$00800000
style=$0
[System value]
bg=$00000000
bg=$00FFFFFF
fg=$0000FF00
style=$0
[Table Name]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$1
[Terminator]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Text]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Unknown word]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[User functions and variables]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[User functions]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Value]
bg=$00000000
bg=$00FFFFFF
fg=$00FF00FF
style=$0
[Variable]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Whitespace]
bg=$00000000
fg=$00FFFFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Math Mode]
bg=$00000000
bg=$00FFFFFF
fg=$0000FF00
style=$0
[Text in Math Mode]
bg=$00000000
fg=$0000FFFF
bg=$00FFFFFF
fg=$00000000
style=$0
[Square Bracket]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$000000FF
style=$0
[Round Bracket]
bg=$00000000
bg=$00FFFFFF
fg=$00FFFF00
style=$0
[TeX Command]
bg=$00000000
fg=$00FFFF00
bg=$00FFFFFF
fg=$00800000
style=$1

View file

@ -1,7 +1,7 @@
object frmAbout: TfrmAbout
Left = 289
Left = 307
Height = 324
Top = 133
Top = 255
Width = 532
HorzScrollBar.Page = 531
HorzScrollBar.Range = 521
@ -31,7 +31,6 @@ object frmAbout: TfrmAbout
Top = 200
Width = 84
Caption = 'version 0.2 alpha'
Color = clNone
ParentColor = False
end
object OKButton: TButton
@ -39,6 +38,7 @@ object frmAbout: TfrmAbout
Height = 23
Top = 288
Width = 100
BorderSpacing.InnerBorder = 4
Caption = 'Hmm...'
OnClick = OKButtonClick
TabOrder = 0

View file

@ -56,6 +56,8 @@ const
'Martin Matusu (xmat@volny.cz) - chown, chgrp'+#13+
'Radek Polak - some viewer fixes'+#13+
'translators (see detail in lng files) '+#13+#13+
'In program used icons from:'+#13+
'-Tango Icon Library (http://tango.freedesktop.org/Tango_Icon_Library)'+#13+#13+
'Big thanks to Lazarus and FreePascal Team';

View file

@ -1,13 +1,15 @@
inherited frmFindDlg: TfrmFindDlg
Left = 173
Left = 197
Height = 476
Top = 33
Width = 541
HorzScrollBar.Page = 540
Top = 54
Width = 582
HorzScrollBar.Page = 581
VertScrollBar.Page = 475
VertScrollBar.Range = 316
ActiveControl = edtFindPathStart
ActiveControl = cmbFindFileMask
Caption = 'frmFindDlg'
ClientHeight = 476
ClientWidth = 582
KeyPreview = True
OnClose = frmFindDlgClose
OnCloseQuery = FormCloseQuery
@ -19,33 +21,36 @@ inherited frmFindDlg: TfrmFindDlg
Cursor = crVSplit
Height = 1
Top = 295
Width = 541
Width = 582
Align = alTop
ResizeAnchor = akTop
end
object Panel2: TPanel
Height = 295
Width = 541
Width = 582
Align = alTop
BevelOuter = bvNone
ClientHeight = 295
ClientWidth = 582
FullRepaint = False
TabOrder = 0
object pgcSearch: TPageControl
Height = 296
Width = 446
Width = 487
ActivePage = tsStandard
Anchors = [akTop, akLeft, akRight]
TabIndex = 0
TabOrder = 0
object tsStandard: TTabSheet
Caption = 'Standard'
ClientHeight = 270
ClientWidth = 479
object lblFindPathStart: TLabel
Left = 8
Height = 14
Top = 50
Width = 30
Caption = 'FileDir'
Color = clNone
ParentColor = False
end
object lblFindFileMask: TLabel
@ -54,28 +59,8 @@ inherited frmFindDlg: TfrmFindDlg
Top = 4
Width = 41
Caption = 'FileMask'
Color = clNone
ParentColor = False
end
object edtFindPathStart: TEdit
Left = 8
Height = 24
Top = 67
Width = 362
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
end
object btnSelDir: TButton
Left = 378
Height = 25
Top = 66
Width = 25
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 4
Caption = '...'
OnClick = btnSelDirClick
TabOrder = 2
end
object cmbFindFileMask: TComboBox
Left = 8
Height = 21
@ -83,10 +68,10 @@ inherited frmFindDlg: TfrmFindDlg
Width = 362
Anchors = [akTop, akLeft, akRight]
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
ItemHeight = 18
ItemHeight = 13
MaxLength = 0
ParentCtl3D = False
TabOrder = 1
TabOrder = 0
Text = '*'
end
object gbFindData: TGroupBox
@ -96,9 +81,11 @@ inherited frmFindDlg: TfrmFindDlg
Width = 418
Anchors = [akTop, akLeft, akRight]
Caption = 'Find Data'
ClientHeight = 127
ClientWidth = 414
Enabled = False
ParentCtl3D = False
TabOrder = 3
TabOrder = 1
object cbCaseSens: TCheckBox
Left = 18
Height = 13
@ -111,7 +98,7 @@ inherited frmFindDlg: TfrmFindDlg
Left = 16
Height = 24
Top = 9
Width = 310
Width = 286
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
end
@ -148,11 +135,23 @@ inherited frmFindDlg: TfrmFindDlg
Width = 67
Caption = 'Find in file'
OnClick = cbFindInFileClick
TabOrder = 4
TabOrder = 2
end
object edtFindPathStart: TDirectoryEdit
Left = 8
Height = 21
Top = 66
Width = 362
ButtonWidth = 23
NumGlyphs = 1
ParentColor = False
TabOrder = 3
end
end
object tsAdvanced: TTabSheet
Caption = 'Advanced'
ClientHeight = 270
ClientWidth = 479
ImageIndex = 1
object deDateFrom: TDateEdit
Left = 4
@ -257,6 +256,7 @@ inherited frmFindDlg: TfrmFindDlg
Width = 110
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
Enabled = False
ItemHeight = 13
ItemIndex = 2
Items.Strings = (
'Minute(s)'
@ -319,6 +319,8 @@ inherited frmFindDlg: TfrmFindDlg
Top = 217
Width = 72
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
Enabled = False
ItemHeight = 13
ItemIndex = 1
Items.Strings = (
'Byte'
@ -349,36 +351,90 @@ inherited frmFindDlg: TfrmFindDlg
OnChange = cbTimeToChange
TabOrder = 13
end
object meTimeFrom: TMaskEdit
object edtTimeFrom: TEdit
Left = 4
Height = 23
Top = 97
Width = 80
Enabled = False
EditMask = '00:00:00'
Top = 98
Width = 106
AutoSelect = True
MaxLength = 8
ParentColor = False
TabOrder = 14
Text = '00:00:00'
OnChange = meTimeChange
end
object meTimeTo: TMaskEdit
object edtTimeTo: TEdit
Left = 164
Height = 23
Top = 97
Width = 80
Enabled = False
EditMask = '00:00:00'
Top = 98
Width = 110
AutoSelect = True
MaxLength = 8
ParentColor = False
TabOrder = 15
Text = '00:00:00'
OnChange = meTimeChange
end
object gbAttributes: TGroupBox
Left = 280
Height = 165
Top = 41
Width = 188
ClientHeight = 147
ClientWidth = 184
Enabled = False
TabOrder = 16
object lblInfo: TLabel
Left = 10
Height = 27
Top = 113
Width = 172
Caption = 'Windows: ''rahs'' Unix: ''rwxrwxrwx'''#13#10'Use ''-'' to off attribute and ''?'' to any'
ParentColor = False
end
object cbDirectory: TCheckBox
Left = 10
Height = 13
Top = 4
Width = 62
Caption = 'Directory'
OnChange = cbDirectoryChange
TabOrder = 0
end
object cbSymLink: TCheckBox
Left = 10
Height = 13
Top = 32
Width = 60
Caption = 'SymLink'
OnChange = cbSymLinkChange
TabOrder = 1
end
object cbMore: TCheckBox
Left = 10
Height = 13
Top = 60
Width = 44
Caption = 'More'
OnChange = cbMoreChange
TabOrder = 2
end
object edtAttrib: TEdit
Left = 10
Height = 23
Top = 84
Width = 128
Enabled = False
TabOrder = 3
end
end
object cbAttrib: TCheckBox
Left = 284
Height = 13
Top = 22
Width = 64
Caption = 'Attributes'
OnChange = cbAttribChange
TabOrder = 17
end
end
end
object btnClose: TButton
Left = 454
Left = 495
Height = 25
Top = 71
Width = 75
@ -389,7 +445,7 @@ inherited frmFindDlg: TfrmFindDlg
TabOrder = 3
end
object btnStop: TButton
Left = 454
Left = 495
Height = 25
Top = 103
Width = 75
@ -402,7 +458,7 @@ inherited frmFindDlg: TfrmFindDlg
TabOrder = 1
end
object btnStart: TButton
Left = 454
Left = 495
Height = 25
Top = 39
Width = 75
@ -417,17 +473,21 @@ inherited frmFindDlg: TfrmFindDlg
object Panel1: TPanel
Height = 180
Top = 296
Width = 541
Width = 582
Align = alClient
BevelOuter = bvNone
ClientHeight = 180
ClientWidth = 582
FullRepaint = False
TabOrder = 1
object Panel3: TPanel
Height = 54
Width = 541
Width = 582
Align = alTop
BevelInner = bvRaised
BevelOuter = bvLowered
ClientHeight = 54
ClientWidth = 582
FullRepaint = False
TabOrder = 0
object lblStatus: TLabel
@ -436,7 +496,6 @@ inherited frmFindDlg: TfrmFindDlg
Top = 30
Width = 44
Caption = 'lblStatus'
Color = clNone
Font.Color = clBlack
Font.Height = 13
Font.Name = 'adobe-helvetica'
@ -450,7 +509,6 @@ inherited frmFindDlg: TfrmFindDlg
Top = 12
Width = 49
Caption = 'lblCurrent'
Color = clNone
Font.Color = clBlack
Font.Height = 13
Font.Name = 'adobe-helvetica'
@ -462,7 +520,7 @@ inherited frmFindDlg: TfrmFindDlg
object lsFoundedFiles: TListBox
Height = 76
Top = 54
Width = 541
Width = 582
Align = alClient
MultiSelect = True
OnDblClick = lsFoundedFilesDblClick
@ -472,8 +530,10 @@ inherited frmFindDlg: TfrmFindDlg
object Panel4: TPanel
Height = 50
Top = 130
Width = 541
Width = 582
Align = alBottom
ClientHeight = 50
ClientWidth = 582
TabOrder = 2
object btnView: TButton
Left = 24
@ -496,20 +556,22 @@ inherited frmFindDlg: TfrmFindDlg
TabOrder = 1
end
object btnGoToPath: TButton
Left = 280
Left = 321
Height = 25
Top = 14
Width = 104
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 4
Caption = '&Go to file'
OnClick = btnGoToPathClick
TabOrder = 2
end
object btnWorkWithFound: TButton
Left = 408
Left = 449
Height = 25
Top = 14
Width = 104
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 4
Caption = 'Feed to &listbox'
OnClick = btnWorkWithFoundClick

View file

@ -1,15 +1,27 @@
{
Seksi Commander
----------------------------
Licence : GNU GPL v 2.0
Author : radek.cervinka@centrum.cz
Double Commander
-------------------------------------------------------------------------
Find dialog, with searching in thread
Find dialog, with searching in thread
Copyright (C) 2003-2004 Radek Cervinka (radek.cervinka@centrum.cz)
Copyright (C) 2006-2007 Koblov Alexander (Alexx2000@mail.ru)
contributors:
Copyright (C) 2006-2007 Alexander Koblov (Alexx2000@mail.ru)
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
{ $threading on}
unit fFindDlg;
{$mode objfpc}{$H+}
@ -46,11 +58,19 @@ type
cbTimeTo: TCheckBox;
cbDelayUnit: TComboBox;
cbUnitOfMeasure: TComboBox;
cbDirectory: TCheckBox;
cbSymLink: TCheckBox;
cbMore: TCheckBox;
cbAttrib: TCheckBox;
deDateFrom: TDateEdit;
deDateTo: TDateEdit;
edtFindPathStart: TDirectoryEdit;
edtAttrib: TEdit;
edtTimeFrom: TEdit;
edtTimeTo: TEdit;
edtReplaceText: TEdit;
meTimeFrom: TMaskEdit;
meTimeTo: TMaskEdit;
gbAttributes: TGroupBox;
lblInfo: TLabel;
Panel4: TPanel;
seNotOlderThan: TSpinEdit;
seFileSizeFrom: TSpinEdit;
@ -60,8 +80,6 @@ type
pgcSearch: TPageControl;
tsStandard: TTabSheet;
lblFindPathStart: TLabel;
edtFindPathStart: TEdit;
btnSelDir: TButton;
lblFindFileMask: TLabel;
cmbFindFileMask: TComboBox;
gbFindData: TGroupBox;
@ -81,12 +99,16 @@ type
procedure btnStartClick(Sender: TObject);
procedure btnViewClick(Sender: TObject);
procedure btnWorkWithFoundClick(Sender: TObject);
procedure cbAttribChange(Sender: TObject);
procedure cbDateFromChange(Sender: TObject);
procedure cbDateToChange(Sender: TObject);
procedure cbDirectoryChange(Sender: TObject);
procedure cbFileSizeFromChange(Sender: TObject);
procedure cbFileSizeToChange(Sender: TObject);
procedure cbMoreChange(Sender: TObject);
procedure cbNotOlderThanChange(Sender: TObject);
procedure cbReplaceTextChange(Sender: TObject);
procedure cbSymLinkChange(Sender: TObject);
procedure cbTimeFromChange(Sender: TObject);
procedure cbTimeToChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
@ -117,12 +139,13 @@ procedure ShowFindDlg(const sActPath:String);
implementation
uses
fViewer, uLng, uShowForm, fMain, uTypes, uFileOp;
fViewer, uLng, uShowForm, fMain, uTypes, uFileOp, uFindEx, uOSUtils;
procedure ShowFindDlg(const sActPath:String);
begin
if not assigned (frmFindDlg) then
frmFindDlg:=TfrmFindDlg.Create(nil);
frmFindDlg.edtFindPathStart.Text := sActPath;
frmFindDlg.Show;
frmFindDlg.BringToFront;
frmFindDlg.cmbFindFileMask.SetFocus;
@ -142,6 +165,7 @@ begin
gbFindData.Caption:= lngGetString(clngFindData);
cbCaseSens.Caption:= lngGetString(clngFindCase);
miShowInViewer.Caption:=lngGetString(clngFindShowView);
edtFindPathStart.DialogTitle := lngGetString(clngFindWhereBeg);
end;
@ -217,7 +241,7 @@ begin
begin
IsTimeFrom := True;
dtTime := 0;
if TryStrToTime(meTimeFrom.Text, dtTime) then
if TryStrToTime(edtTimeFrom.Text, dtTime) then
DateTimeFrom := DateTimeFrom + dtTime;
end;
@ -225,7 +249,7 @@ begin
begin
IsTimeTo := True;
dtTime := 0;
if TryStrToTime(meTimeTo.Text, dtTime) then
if TryStrToTime(edtTimeTo.Text, dtTime) then
DateTimeTo := DateTimeTo + dtTime;
end;
(* Not Older Than *)
@ -297,7 +321,22 @@ begin
FileSizeTo := seFileSizeTo.Value * 1073741824; //GigaByte
end;
end;
(* File attributes *)
if cbAttrib.Checked then
begin
Attributes := 0;
if cbDirectory.Checked then
Attributes := Attributes or faDirectory;
WriteLN('Attributes == ', Attributes);
if cbSymLink.Checked then
Attributes := Attributes or uOSUtils.faSymLink;
if cbMore.Checked then
AttribStr := edtAttrib.Text;
end;
Status:=lblStatus;
Current:=lblCurrent;
writeln('thread a');
@ -336,7 +375,7 @@ begin
begin
fr.sNameNoExt := lsFoundedFiles.Items[I];
fr.sName := fr.sNameNoExt;
FindFirst(fr.sNameNoExt, faAnyFile, sr);
FindFirstEx(fr.sNameNoExt, faAnyFile, sr);
fr.sExt := ExtractFileExt(fr.sNameNoExt);
fr.iSize := sr.Size;
fr.sTime := DateTimeToStr(Trunc(FileDateToDateTime(sr.Time)));
@ -352,6 +391,11 @@ begin
Close;
end;
procedure TfrmFindDlg.cbAttribChange(Sender: TObject);
begin
gbAttributes.Enabled := cbAttrib.Checked;
end;
procedure TfrmFindDlg.cbDateFromChange(Sender: TObject);
begin
deDateFrom.Enabled := cbDateFrom.Checked;
@ -362,14 +406,33 @@ begin
deDateTo.Enabled := cbDateTo.Checked;
end;
procedure TfrmFindDlg.cbDirectoryChange(Sender: TObject);
begin
end;
procedure TfrmFindDlg.cbFileSizeFromChange(Sender: TObject);
begin
seFileSizeFrom.Enabled := cbFileSizeFrom.Checked;
if seFileSizeFrom.Enabled or seFileSizeTo.Enabled then
cbUnitOfMeasure.Enabled := True
else
cbUnitOfMeasure.Enabled := False;
end;
procedure TfrmFindDlg.cbFileSizeToChange(Sender: TObject);
begin
seFileSizeTo.Enabled := cbFileSizeTo.Checked;
if seFileSizeFrom.Enabled or seFileSizeTo.Enabled then
cbUnitOfMeasure.Enabled := True
else
cbUnitOfMeasure.Enabled := False;
end;
procedure TfrmFindDlg.cbMoreChange(Sender: TObject);
begin
edtAttrib.Enabled := cbMore.Checked;
end;
procedure TfrmFindDlg.cbNotOlderThanChange(Sender: TObject);
@ -385,22 +448,27 @@ begin
cbNoThisText.Enabled := not cbReplaceText.Checked;
end;
procedure TfrmFindDlg.cbSymLinkChange(Sender: TObject);
begin
end;
procedure TfrmFindDlg.cbTimeFromChange(Sender: TObject);
var
sTime : String;
begin
meTimeFrom.Enabled := cbTimeFrom.Checked;
edtTimeFrom.Enabled := cbTimeFrom.Checked;
DateTimeToString(sTime, 'hh:mm:ss', Time);
meTimeFrom.EditText := sTime;
edtTimeFrom.Text := sTime;
end;
procedure TfrmFindDlg.cbTimeToChange(Sender: TObject);
var
sTime : String;
begin
meTimeTo.Enabled := cbTimeTo.Checked;
edtTimeTo.Enabled := cbTimeTo.Checked;
DateTimeToString(sTime, 'hh:mm:ss', Time);
meTimeTo.EditText := sTime;
edtTimeTo.Text := sTime;
end;
procedure TfrmFindDlg.ThreadTerminate(Sender:TObject);
@ -462,7 +530,8 @@ end;
procedure TfrmFindDlg.frmFindDlgShow(Sender: TObject);
begin
cmbFindFileMask.SelectAll;
if cmbFindFileMask.Visible then
cmbFindFileMask.SelectAll;
//cmbFindFileMask.SetFocus;
end;
@ -476,7 +545,7 @@ var
ME : TMaskEdit;
begin
ME := TMaskEdit(Sender);
if StrToIntDef(Copy(ME.EditText, 1, 2), 24) > 23 then
ME.EditText := '00' + Copy(ME.EditText, 3, 6);

File diff suppressed because it is too large Load diff

View file

@ -34,6 +34,7 @@ type
actEditRedo: TAction;
actEditPaste: TAction;
actEditDelete: TAction;
ilImageList: TImageList;
MainMenu1: TMainMenu;
ActListEdit: TActionList;
actAbout: TAction;
@ -43,6 +44,9 @@ type
actFileSaveAs: TAction;
actFileNew: TAction;
actFileExit: TAction;
miDelete: TMenuItem;
miSelectAll: TMenuItem;
miRedo: TMenuItem;
miDeleteContext: TMenuItem;
miSelectAllContext: TMenuItem;
miSeparator2: TMenuItem;
@ -80,7 +84,22 @@ type
actConfHigh: TAction;
miDiv: TMenuItem;
miConfHigh: TMenuItem;
tbToolBar: TToolBar;
tbNew: TToolButton;
tbOpen: TToolButton;
tbSave: TToolButton;
tbSeparator1: TToolButton;
tbCut: TToolButton;
tbCopy: TToolButton;
tbPaste: TToolButton;
tbSeparator2: TToolButton;
tbUndo: TToolButton;
tbRedo: TToolButton;
tbSeparator3: TToolButton;
tbConfig: TToolButton;
tbHelp: TToolButton;
procedure actEditDeleteExecute(Sender: TObject);
procedure actEditRedoExecute(Sender: TObject);
procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure EditorKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure EditorReplaceText(Sender: TObject; const ASearch, AReplace: string;
@ -321,6 +340,11 @@ begin
Editor.ClearSelection;
end;
procedure TfrmEditor.actEditRedoExecute(Sender: TObject);
begin
editor.Redo;
end;
procedure TfrmEditor.actEditSelectAllExecute(Sender: TObject);
begin
editor.SelectAll;
@ -328,7 +352,7 @@ end;
procedure TfrmEditor.actFileOpenExecute(Sender: TObject);
begin
inherited;
//inherited;
dmDlg.OpenDialog.Filter:='*.*';
if not dmDlg.OpenDialog.Execute then Exit;
OpenFile(dmDlg.OpenDialog.FileName);

View file

@ -1,7 +1,7 @@
inherited frmMain: TfrmMain
Left = 238
Left = 241
Height = 336
Top = 297
Top = 122
Width = 525
HorzScrollBar.Page = 524
VertScrollBar.Page = 316

View file

@ -4,11 +4,11 @@ inherited frmViewer: TfrmViewer
Top = 287
Width = 200
HorzScrollBar.Page = 199
VertScrollBar.Page = 80
VertScrollBar.Page = 79
VertScrollBar.Range = 19
ActiveControl = ScrollBarVert
Caption = 'frmViewer'
ClientHeight = 81
ClientHeight = 80
ClientWidth = 200
Constraints.MinHeight = 100
Constraints.MinWidth = 200
@ -22,8 +22,8 @@ inherited frmViewer: TfrmViewer
Position = poDefault
ShowInTaskBar = stAlways
object Status: TStatusBar
Height = 20
Top = 61
Height = 23
Top = 57
Width = 200
Panels = <
item
@ -41,7 +41,7 @@ inherited frmViewer: TfrmViewer
SimplePanel = False
end
object nbPages: TNotebook
Height = 61
Height = 57
Width = 200
Align = alClient
PageIndex = 0
@ -50,10 +50,10 @@ inherited frmViewer: TfrmViewer
object pgText: TPage
Caption = 'pgText'
ClientWidth = 192
ClientHeight = 53
ClientHeight = 49
object ScrollBarVert: TScrollBar
Left = 177
Height = 53
Height = 49
Width = 15
Align = alRight
Anchors = [akTop, akRight]
@ -67,7 +67,7 @@ inherited frmViewer: TfrmViewer
end
object ViewerControl: TViewerControl
Cursor = crIBeam
Height = 53
Height = 49
Width = 177
ViewerMode = vmText
Font.Height = -14
@ -81,7 +81,7 @@ inherited frmViewer: TfrmViewer
object pgImage: TPage
Caption = 'pgImage'
ClientWidth = 192
ClientHeight = 53
ClientHeight = 49
object ScrollBox: TScrollBox
Height = 468
Width = 788

View file

@ -117,7 +117,7 @@ procedure ShowViewer(sl:TStringList; bDeleteAfterView : Boolean = False);
implementation
uses
uLng, uShowMsg, uGlobs, lcltype, lazjpeg{$IFNDEF WIN32}, uFindMmap{$ENDIF} ;
uLng, uShowMsg, uGlobs, lcltype, lazjpeg, uFindMmap;
procedure ShowViewer(sl:TStringList; bDeleteAfterView : Boolean = False);
var viewer: TfrmViewer;
@ -503,9 +503,9 @@ begin
FFindDialog:=TfrmFindView.Create(Application);
if FFindDialog.ShowModal <> mrOK then Exit;
if FFindDialog.cbDataToFind.Text='' then Exit;
{$IFNDEF WIN32} // Alexx2000 ñäåëàòü ïîçæå ïîèñê
PAdr:=PosMem(PAdr, iSizeData, FFindDialog.cbDataToFind.Text, FFindDialog.cbCaseSens.Checked);
{$ENDIF}
if (Integer(PAdr)<>-1) then
begin
// founded, set position to ViewerControl

File diff suppressed because it is too large Load diff

View file

@ -159,11 +159,12 @@ begin
if FPS_ISDIR(iAttr) then Result[1]:='d';
if FPS_ISLNK(iAttr) then Result[1]:='l';
if Boolean(iAttr and $02) then Result[2] := 'h';
if Boolean(iAttr and $04) then Result[3] := 's';
if Boolean(iAttr and $08) then Result[4] := 'v';
if Boolean(iAttr and $01) then Result[5] := 'r';
if Boolean(iAttr and $20) then Result[6] := 'a';
if Boolean(iAttr and $01) then Result[2] := 'r';
if Boolean(iAttr and $20) then Result[3] := 'a';
if Boolean(iAttr and $02) then Result[4] := 'h';
if Boolean(iAttr and $04) then Result[5] := 's';
if Boolean(iAttr and $08) then Result[6] := 'v';
{$ELSE}
if FPS_ISDIR(iAttr) then Result[1]:='d';

View file

@ -32,7 +32,7 @@ interface
{ $DEFINE USE_STAT64LIBC} // libc version
uses
SysUtils {$IFNDEF WIN32},BaseUnix, Unix{$IFDEF USE_STAT64LIBC}, Libc {$ELSE}, SysCall{$ENDIF}{$ENDIF};
SysUtils {$IFNDEF WIN32},BaseUnix, Unix, Libc{$IFDEF USE_STAT64LIBC}, Libc {$ELSE}, SysCall{$ENDIF}{$ENDIF};
Type
TFindStatus = (fsOK, fsStatFailed, fsBadAttr);
@ -50,6 +50,7 @@ Type
function FindFirstEx (Const Path : String; Attr : Longint; out Rslt : TSearchRec) : Longint;
function FindNextEx (Var Rslt : TSearchRec) : Longint;
function CheckAttrMask(DefaultAttr : Cardinal; sAttr : String; Attr : Cardinal) : Boolean;
{$IFNDEF WIN32} //*nix systems
{$IFNDEF FAKE_FIND}
@ -230,6 +231,10 @@ end;
function FindFirstEx (Const Path : String; Attr : Longint; out Rslt : TSearchRec) : Longint;
begin
{$IFDEF UNIX}
if (Attr and faSymLink) = faSymLink then
Attr := Attr or not faSymLink;
{$ENDIF}
Result := FindFirst(Path, Attr, Rslt);
{$IFDEF UNIX}
if Result = 0 then
@ -246,5 +251,65 @@ begin
{$ENDIF}
end;
function CheckAttrMask(DefaultAttr : Cardinal; sAttr : String; Attr : Cardinal) : Boolean;
{$IFDEF WINDOWS}
begin
Result := True;
if (DefaultAttr <> 0) and (DefaultAttr <> faAnyFile) then
Result := (Attr and DefaultAttr) = DefaultAttr;
if Length(sAttr) < 4 then Exit;
if Result then
begin
if sAttr[1] = 'r' then Result := Result and ((Attr and faReadOnly) = faReadOnly)
else if sAttr[1] = '-' then Result := Result and ((Attr and faReadOnly) <> faReadOnly);
//WriteLN('After r == ', BoolToStr(Result));
if sAttr[2] = 'a' then Result := Result and ((Attr and faArchive) = faArchive)
else if sAttr[2] = '-' then Result := Result and ((Attr and faArchive) <> faArchive);
//WriteLN('After a == ', BoolToStr(Result));
if sAttr[3] = 'h' then Result := Result and ((Attr and faHidden) = faHidden)
else if sAttr[3] = '-' then Result := Result and ((Attr and faHidden) <> faHidden);
//WriteLN('After h == ', BoolToStr(Result));
if sAttr[4] = 's' then Result := Result and ((Attr and faSysFile) = faSysFile)
else if sAttr[4] = '-' then Result := Result and ((Attr and faSysFile) <> faSysFile);
end;
end;
{$ELSE}
begin
Result := True;
if (DefaultAttr <> 0) and (DefaultAttr <> faAnyFile) then
begin
if Boolean(DefaultAttr and faDirectory) then
Result := Result and fpS_ISDIR(Attr);
WriteLN('Result do == ', BoolToStr(Result));
if Boolean(DefaultAttr and faSymLink) then
Result := Result and ((Attr and S_IFLNK) = S_IFLNK);
WriteLN('Result after == ', BoolToStr(Result));
end;
if Length(sAttr) < 9 then Exit;
if sAttr[1]='r' then Result:=Result and ((Attr AND S_IRUSR) = S_IRUSR)
else if sAttr[1]='-' then Result:=Result and ((Attr AND S_IRUSR) <> S_IRUSR);
if sAttr[2]='w' then Result:=Result and ((Attr AND S_IWUSR) = S_IWUSR)
else if sAttr[2]='-' then Result:=Result and ((Attr AND S_IWUSR) <> S_IWUSR);
if sAttr[3]='x' then Result:=Result and ((Attr AND S_IXUSR) = S_IXUSR)
else if sAttr[3]='-' then Result:=Result and ((Attr AND S_IXUSR) <> S_IXUSR);
if sAttr[4]='r' then Result:=Result and ((Attr AND S_IRGRP) = S_IRGRP)
else if sAttr[4]='-' then Result:=Result and ((Attr AND S_IRGRP) <> S_IRGRP);
if sAttr[5]='w' then Result:=Result and ((Attr AND S_IWGRP) = S_IWGRP)
else if sAttr[5]='-' then Result:=Result and ((Attr AND S_IWGRP) <> S_IWGRP);
if sAttr[6]='x' then Result:=Result and ((Attr AND S_IXGRP) = S_IXGRP)
else if sAttr[6]='-' then Result:=Result and ((Attr AND S_IXGRP) <> S_IXGRP);
if sAttr[7]='r' then Result:=Result and ((Attr AND S_IROTH) = S_IROTH)
else if sAttr[7]='-' then Result:=Result and ((Attr AND S_IROTH) <> S_IROTH);
if sAttr[8]='w' then Result:=Result and ((Attr AND S_IWOTH) = S_IWOTH)
else if sAttr[8]='-' then Result:=Result and ((Attr AND S_IWOTH) <> S_IWOTH);
if sAttr[9]='x' then Result:=Result and ((Attr AND S_IXOTH) = S_IXOTH)
else if sAttr[9]='-' then Result:=Result and ((Attr AND S_IXOTH) <> S_IXOTH);
if sAttr[3]='s' then Result:=Result and ((Attr AND S_ISUID) = S_ISUID);
if sAttr[6]='s' then Result:=Result and ((Attr AND S_ISGID) = S_ISGID);
end;
{$ENDIF}
end.

View file

@ -1,89 +1,75 @@
{
Seksi Commander
----------------------------
Licence : GNU GPL v 2.0
Author : radek.cervinka@centrum.cz
implementind memory searching with case
and mmap file to memory
contributors:
}
unit uFindMmap;
{$mode objfpc}{$H+}
interface
function PosMem(pAdr:PChar; iLength:Integer; const sData:String; bCase:Boolean):Pointer;
function FindMmap(const sFileName:String; const sFindData:String; bCase:Boolean):Boolean;
implementation
uses
Libc;
function PosMem(pAdr:PChar; iLength:Integer; const sData:String; bCase:Boolean):Pointer;
var
xIndex:Integer;
function sPos2(pAdr:PChar; const sData:String):Boolean;
var
i:Integer;
begin
Result:=False;
for i:=1 to length(sData) do
begin
case bCase of
False:if UpCase(pAdr^)<>UpCase(sData[i]) then Exit;
True: if pAdr^<>sData[i] then Exit;
end;
inc(pAdr);
end;
Result:=True;
end;
begin
Result:=pointer(-1);
for xIndex:=0 to iLength-length(sData) do
begin
if sPos2(pAdr,sData) then
begin
Result:=pAdr;
Exit;
end;
inc(pAdr);
end;
end;
function FindMmap(const sFileName, sFindData:String; bCase:Boolean):Boolean;
var
fd:Integer;
pmmap:Pointer;
fs:Integer;
stat:_stat64;
begin
Result:=False;
pmmap:=nil;
fs:=0;
fd:=Libc.Open(PChar(sFileName), O_RDONLY);
if fd=-1 then Exit;
try
if fstat64(fd, stat) <> 0 then Exit;
fs := stat.st_size;
pmmap:=mmap(nil,fs,PROT_READ, MAP_PRIVATE,fd,0 );
if Integer(Pmmap)=-1 then Exit;
Result:= PosMem(pmmap,fs,sFindData,bCase)<>Pointer(-1);
finally
Libc.__close(fd);
if assigned(pmmap) then
munmap(pmmap,fs);
end;
end;
end.
{
Seksi Commander
----------------------------
Licence : GNU GPL v 2.0
Author : radek.cervinka@centrum.cz
implementind memory searching with case
and mmap file to memory
contributors:
Copyright (C) 2006-2007 Koblov Alexander (Alexx2000@mail.ru)
}
unit uFindMmap;
{$mode objfpc}{$H+}
interface
function PosMem(pAdr:PChar; iLength:Integer; const sData:String; bCase:Boolean):Pointer;
function FindMmap(const sFileName:String; const sFindData:String; bCase:Boolean):Boolean;
implementation
uses
uOSUtils;
function PosMem(pAdr:PChar; iLength:Integer; const sData:String; bCase:Boolean):Pointer;
var
xIndex:Integer;
function sPos2(pAdr:PChar; const sData:String):Boolean;
var
i:Integer;
begin
Result:=False;
for i:=1 to length(sData) do
begin
case bCase of
False:if UpCase(pAdr^)<>UpCase(sData[i]) then Exit;
True: if pAdr^<>sData[i] then Exit;
end;
inc(pAdr);
end;
Result:=True;
end;
begin
Result:=pointer(-1);
for xIndex:=0 to iLength-length(sData) do
begin
if sPos2(pAdr,sData) then
begin
Result:=pAdr;
Exit;
end;
inc(pAdr);
end;
end;
function FindMmap(const sFileName, sFindData:String; bCase:Boolean):Boolean;
var
fmr : TFileMapRec;
begin
Result:=False;
try
if MapFile(sFileName, fmr) then
Result:= PosMem(fmr.MappedFile, fmr.FileSize, sFindData, bCase)<>Pointer(-1);
finally
UnMapFile(fmr);
end;
end;
end.

View file

@ -1,18 +1,27 @@
{
Seksi Commander
----------------------------
Licence : GNU GPL v 2.0
Author : radek.cervinka@centrum.cz
Double Commander
-------------------------------------------------------------------------
Thread for search files (called from frmSearchDlg)
Thread for search in files (called from frmSearchDlg)
Copyright (C) 2003-2004 Radek Cervinka (radek.cervinka@centrum.cz)
Copyright (C) 2006-2007 Koblov Alexander (Alexx2000@mail.ru)
contributors:
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.
Copyright (C) 2006-2007 Alexander Koblov (Alexx2000@mail.ru)
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit uFindThread;
{$mode objfpc}{$H+}
@ -37,6 +46,7 @@ TFindThread = class(TThread)
FFoundFile:String;
FFileMask : String;
FAttributes: Cardinal;
FAttribStr : String;
FCaseSens:Boolean;
{Date search}
FIsDateFrom,
@ -99,17 +109,17 @@ TFindThread = class(TThread)
property FileSizeFrom : Int64 read FFileSizeFrom write FFileSizeFrom;
property FileSizeTo : Int64 read FFileSizeTo write FFileSizeTo;
property Attributes: Cardinal read FAttributes write FAttributes default
(faArchive or faReadonly or faHidden or faSysFile or faDirectory);
property Attributes: Cardinal read FAttributes write FAttributes;
property AttribStr : String read FAttribStr write FAttribStr;
end;
implementation
uses
Dialogs, uLng{$IFNDEF WIN32}, uFindMmap, BaseUnix{$ENDIF};
{ TFindThread }
Dialogs, uLng, uFindMmap, uFindEx, uGlobs;
{ TFindThread }
constructor TFindThread.Create;
begin
@ -125,6 +135,8 @@ begin
FIsDateTo := False;
FIsFileSizeFrom := False;
FIsFileSizeTo := False;
FAttributes := faAnyFile;
FAttribStr := '?????????';
end;
destructor TFindThread.Destroy;
@ -172,7 +184,6 @@ end;
function FindInFile(const sFileName:String; sData: String; bCase:Boolean): Boolean;
{$IFDEF WIN32}
const
BufferSize = 4096;
var
@ -183,20 +194,26 @@ var
Compare: function(Str1, Str2: PChar; MaxLen: SizeInt): SizeInt;
begin
Result := False;
if sData = '' then Exit;
begin
if gUseMmapInSearch then
begin
Result := FindMmap(sFileName, sData, bCase);
Exit;
end;
Result := False;
if sData = '' then Exit;
if bCase then
Compare := @StrLIComp
else
Compare := @StrLComp;
if bCase then
Compare := @StrLIComp
else
Compare := @StrLComp;
sDataLength := Length(sData);
sDataLength := Length(sData);
try
fs := TFileStream.Create(sFileName, fmOpenRead or fmShareDenyNone);
try
fs := TFileStream.Create(sFileName, fmOpenRead or fmShareDenyNone);
try
repeat
OffsetPos := fs.Read(Buffer, BufferSize) - sDataLength;
lastPos := 0;
@ -207,18 +224,12 @@ var
end;
until fs.Position >= fs.Size;
except
end;
finally
fs.Free;
except
end;
finally
fs.Free;
end;
{$ELSE} // *nix
begin
Result := FindMmap(sFileName, sData, bCase);
end;
{$ENDIF}
procedure FileReplaceString(const FileName, SearchString, ReplaceString: string; bCase:Boolean);
@ -291,6 +302,8 @@ begin
end;
function TFindThread.CheckFile(const Folder : String; const sr : TSearchRec) : Boolean;
var
Attrib : Cardinal;
begin
Result := True;
{$IFDEF WIN32}
@ -307,6 +320,11 @@ if not G_ValidateWildText(sr.Name, FFileMask) then
if (FIsFileSizeFrom or FIsFileSizeTo) and Result then
Result := CheckFileSize(sr.Size);
// if Length(FAttribStr) <> 0 then
begin
Result := CheckAttrMask(FAttributes, FAttribStr, sr.Attr);
end;
if (FFindInFiles and Result) then
begin
@ -331,7 +349,9 @@ begin
Path := sNewDir + PathDelim + FFileMask;
//WriteLN('Path = ', Path);
if FindFirst(Path, faAnyFile, sr) = 0 then
WriteLN('FAttributes == ', FAttributes);
if FindFirstEx(Path, FAttributes, sr) = 0 then
repeat
if (sr.Name='.') or (sr.Name='..') then Continue;
inc(FFilesScaned);
@ -345,7 +365,7 @@ begin
FCurrentFile:=sNewDir + PathDelim + sr.Name;
Synchronize(@UpDateProgress);
until (FindNext(sr)<>0)or terminated;
until (FindNextEx(sr)<>0)or terminated;
FindClose(sr);
{Search in sub folders}
@ -353,11 +373,11 @@ begin
begin
Path := sNewDir + PathDelim + '*';
WriteLN('Search in sub folders = ', Path);
if not Terminated and (FindFirst(Path, faDirectory, sr) = 0) then
if not Terminated and (FindFirstEx(Path, faDirectory, sr) = 0) then
repeat
if (sr.Name[1] <> '.') then
WalkAdr(sNewDir + PathDelim + sr.Name);
until Terminated or (FindNext(sr) <> 0);
until Terminated or (FindNextEx(sr) <> 0);
FindClose(sr);
end;

View file

@ -80,6 +80,7 @@ var
gIconsSize : Integer;
gDirTabOptions,
gDirTabLimit : Integer;
gUseMmapInSearch : Boolean;
const
{ Tabs options }
@ -232,6 +233,8 @@ begin
gpPixmapPath := gpPixmapPath + IntToStr(gIconsSize) + 'x' + IntToStr(gIconsSize) + PathDelim;
gUseMmapInSearch := gIni.ReadBool('Configuration', 'UseMmapInSearch', False);
if FileExists(gpCfgDir+'doublecmd.ext') then
gExts.LoadFromFile(gpCfgDir+'doublecmd.ext');
@ -330,6 +333,8 @@ begin
gIni.WriteInteger('Configuration', 'IconsSize', gIconsSize);
gIni.WriteBool('Configuration', 'UseMmapInSearch', gUseMmapInSearch);
for x:=0 to 4 do
gIni.WriteInteger('Configuration', 'Col'+IntToStr(x), gColumnSize[x]);

View file

@ -182,14 +182,14 @@ function ModeStr2Mode(const sMode:String):Integer;
begin
// stupid conversion
Result:=0;
{$IFDEF WIN32}
{$IFDEF WINDOWS}
if sMode[1] = 'd' then Result := Result or $10;
if sMode[2] = 'h' then Result := Result or $02;
if sMode[3] = 's' then Result := Result or $04;
if sMode[4] = 'v' then Result := Result or $08;
if sMode[5] = 'r' then Result := Result or $01;
if sMode[6] = 'a' then Result := Result or $20;
if sMode[2] = 'r' then Result := Result or $01;
if sMode[3] = 'a' then Result := Result or $20;
if sMode[4] = 'h' then Result := Result or $02;
if sMode[5] = 's' then Result := Result or $04;
if sMode[6] = 'v' then Result := Result or $08;
{$ELSE}
// if sMode[1]='-' then Result:=Result+10;