FIX: Error on open Options dialog under Linux

UPD: Replace WriteLN to DebugLN in some places
This commit is contained in:
Alexander Koblov 2007-12-23 11:21:01 +00:00
commit 85735ae237
19 changed files with 227 additions and 210 deletions

View file

@ -12,4 +12,5 @@
16.09.2007 Все опции на вкладке "Layout" теперь работают
25.09.2007 ADD: Возможность отключения показа иконок
18.12.2007 ADD: Настройка формата вывода даты/времени
ADD: Настройка параметров отображения вкладок
ADD: Настройка параметров отображения вкладок
23.12.2007 FIX: Ошибка при открытии под Линукс

View file

@ -1,98 +1,94 @@
{ $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, fconfigtoolbar, uWCXprototypes, uDCUtils,
dmDialogs, fViewer, fOptions, fCopyDlg, fMoveDlg, fFindDlg,
fSymLink, fMultiRename, fSplitter, fPackDlg, fExtractDlg;
{$IFDEF WIN32}
{$R XP.res}
{$ENDIF}
const
buildDate = {$I %DATE%};
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('Build: ' + buildDate);
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)');
fAbout.buildDate := buildDate;
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.
{ $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 MSWINDOWS}
uFindMmap,
fFileProperties,
uUsersGroups,
{$ENDIF}
fLinker,
fCompareFiles,
dmHigh,
uPixMapManager, uVFS,
KASComp, fconfigtoolbar, uWCXprototypes, uDCUtils, uOSUtils,
dmDialogs, fViewer, fOptions, fCopyDlg, fMoveDlg, fFindDlg,
fSymLink, fMultiRename, fSplitter, fPackDlg, fExtractDlg;
{$IFDEF MSWINDOWS}
{$R XP.res}
{$ENDIF}
const
buildDate = {$I %DATE%};
begin
{$IFDEF MSWINDOWS}
AssignFile(output, GetHomeDir + 'doublecmd.log');
Rewrite(output);
{$ENDIF}
Application.Title:='Double Commander';
Application.Initialize;
ThousandSeparator:=' ';
DebugLn('Double commander 0.2 alpha - Free Pascal');
DebugLn('Build: ' + buildDate);
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)');
fAbout.buildDate := buildDate;
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;
end.

View file

@ -60,7 +60,7 @@ const
'Radek Cervinka (radek.cervinka@centrum.cz) - author of Seksi Commander'+#13+
'Contributors:'+#13+
'Tolstov Igor (attid@yandex.ru)'+#13+
'Zolotov Alexey'+#13+
'Zolotov Alex'+#13+
'Peter Cernoch (pcernoch@volny.cz) - author PFM'+#13+
'Pavel Letko (letcuv@centrum.cz) - multirename, split, linker'+#13+
'Jiri Karasek (jkarasek@centrum.cz)'+#13+

View file

@ -138,7 +138,7 @@ procedure ShowFindDlg(const sActPath:String);
implementation
uses
fViewer, uLng, uGlobs, uShowForm, fMain, uTypes, uFileOp, uFindEx, uOSUtils;
LCLProc, fViewer, uLng, uGlobs, uShowForm, fMain, uTypes, uFileOp, uFindEx, uOSUtils;
procedure ShowFindDlg(const sActPath:String);
begin
@ -327,7 +327,7 @@ begin
if cbDirectory.Checked then
Attributes := Attributes or faDirectory;
WriteLN('Attributes == ', Attributes);
DebugLn('Attributes == ' + IntToStr(Attributes));
if cbSymLink.Checked then
Attributes := Attributes or uOSUtils.faSymLink;
@ -341,11 +341,11 @@ begin
end;
Status:=lblStatus;
Current:=lblCurrent;
writeln('thread a');
DebugLn('thread a');
{$IFDEF NOFAKETHREAD}
FreeOnTerminate:=False;
OnTerminate:=@ThreadTerminate; // napojime udalost na obsluhu tlacitka
writeln('thread a1');
DebugLn('thread a1');
Resume;
end;
{$ELSE}
@ -354,7 +354,7 @@ begin
end;
//ThreadTerminate(self); //remove if thread is Ok
{$ENDIF}
writeln('thread a2');
DebugLn('thread a2');
end;
@ -475,7 +475,7 @@ end;
procedure TfrmFindDlg.ThreadTerminate(Sender:TObject);
begin
writeln('thread terminate end');
DebugLn('thread terminate end');
{ FFindThread.Terminate;
FFindThread.WaitFor;}
btnStop.Enabled:=False;

View file

@ -132,8 +132,8 @@ begin
ktbBar.FlatButtons := gToolBarFlat;
ktbBar.ChangePath := gpExePath;
ktbBar.EnvVar := '%commander_path%';
ktbBar.LoadFromFile(gpIniDir + 'default.bar');
stToolBarFileName.Caption := gpIniDir + 'default.bar';
ktbBar.LoadFromFile(gpCfgDir + 'default.bar');
stToolBarFileName.Caption := gpCfgDir + 'default.bar';
if ktbBar.Tag >= 0 then
begin
ktbBar.Buttons[ktbBar.Tag].Click;
@ -171,11 +171,11 @@ begin
Save;
gToolBarIconSize := StrToIntDef(kedtBarSize.Text, 16);
gToolBarFlat := cbFlatIcons.Checked;
ktbBar.SaveToFile(gpIniDir + 'default.bar');
ktbBar.SaveToFile(gpCfgDir + 'default.bar');
frmMain.MainToolBar.ButtonGlyphSize := gToolBarIconSize;
frmMain.MainToolBar.DeleteAllToolButtons;
frmMain.MainToolBar.FlatButtons := gToolBarFlat;
frmMain.MainToolBar.LoadFromFile(gpIniDir + 'default.bar');
frmMain.MainToolBar.LoadFromFile(gpCfgDir + 'default.bar');
Close;
end;

View file

@ -169,7 +169,7 @@ begin
editor := TfrmEditor.Create(Application);
gEditorPos.Restore(editor);
try
LoadAttrFromFile(gpIniDir+csDefaultName);
LoadAttrFromFile(gpCfgDir + csDefaultName);
if sFileName='' then
editor.actFileNew.Execute
else

View file

@ -271,7 +271,7 @@ begin
lbNames.Items.Add(cSynAttrNames[i]);
lbNames.ItemIndex:=0;
FillComboPred;
LoadAttrFromFile(gpIniDir+csDefaultName);
LoadAttrFromFile(gpCfgDir + csDefaultName);
lbNamesClick(Sender);
end;
@ -320,7 +320,7 @@ var
iIndex:Integer;
begin
cmbPredefined.Clear;
if FindFirst(gpIniDir+'*.col', faAnyFile, fr)<>0 then
if FindFirst(gpCfgDir+'*.col', faAnyFile, fr)<>0 then
begin
FindClose(fr);
Exit;
@ -340,7 +340,7 @@ end;
procedure TfrmEditorConf.btnOKClick(Sender: TObject);
begin
SaveAttrToFile(gpIniDir+csDefaultName);
SaveAttrToFile(gpCfgDir + csDefaultName);
Close;
end;

View file

@ -14,7 +14,7 @@ object frmFindView: TfrmFindView
ClientHeight = 94
ClientWidth = 339
OnShow = FormShow
Position = poOwnerFormCenter
Position = poScreenCenter
object cbDataToFind: TComboBox
Left = 16
Height = 21

View file

@ -40,7 +40,7 @@ type
implementation
uses
uLng;
LCLProc, uLng;
procedure TfrmFindView.FormShow(Sender: TObject);
begin
@ -61,7 +61,7 @@ begin
inherited;
if (Key=VK_Down) and (cbDataToFind.Items.Count>0) then
cbDataToFind.DroppedDown:=True;
writeln(Key);
DebugLn(IntToStr(Key));
if Key=13 then
begin
Key:=0;

View file

@ -139,7 +139,6 @@ object frmLinker: TfrmLinker
TabOrder = 5
end
object dlgSaveAll: TSaveDialog
Title = 'Сохранить файл как'
Filter = 'All files|*.*'
FilterIndex = 0
left = 160

View file

@ -52,7 +52,7 @@ function ShowLinkerFilesForm(var lsFiles:TStringList):Boolean;
implementation
uses
uLng, uFileProcs;
LCLProc, uLng, uFileProcs;
//var gDirectory:string;
@ -73,7 +73,7 @@ begin
for c:=0 to lsFiles.Count-1 do
with lstFile.Items do
begin
writeln(ExtractFileName(lsFiles[c]));
DebugLn(ExtractFileName(lsFiles[c]));
Add(ExtractFileName(lsFiles[c]));
end;
LoadLng;

View file

@ -513,7 +513,7 @@ begin
DebugLn('frmMain.Destroy');
edtCommand.Items.SaveToFile(gpIniDir+cHistoryFile);
{*Tool Bar*}
MainToolBar.SaveToFile(gpIniDir + 'default.bar');
MainToolBar.SaveToFile(gpCfgDir + 'default.bar');
{*Tool Bar*}
end;
@ -539,7 +539,7 @@ if pmToolBar.Tag >= 0 then
if msgYesNo('You really want delete button?') then
begin
MainToolBar.RemoveButton (pmToolBar.Tag);
MainToolBar.SaveToFile(gpIniDir + 'default.bar');
MainToolBar.SaveToFile(gpCfgDir + 'default.bar');
end;
end;
end;
@ -745,7 +745,7 @@ begin
MainToolBar.ButtonGlyphSize := gToolBarIconSize;
MainToolBar.ChangePath := gpExePath;
MainToolBar.EnvVar := '%commander_path%';
MainToolBar.LoadFromFile(gpIniDir + 'default.bar');
MainToolBar.LoadFromFile(gpCfgDir + 'default.bar');
end;
(*Tool Bar*)
@ -2665,7 +2665,7 @@ begin
begin
MainToolBar.ChangePath := gpExePath;
MainToolBar.EnvVar := '%commander_path%';
MainToolBar.LoadFromFile(gpIniDir + 'default.bar');
MainToolBar.LoadFromFile(gpCfgDir + 'default.bar');
MainToolBar.Visible := gButtonBar;
end
else

View file

@ -120,7 +120,7 @@ object frmOptions: TfrmOptions
Width = 454
Align = alClient
OnPageChanged = nbNotebookPageChanged
PageIndex = 9
PageIndex = 1
ShowTabs = False
TabOrder = 0
object pgLng: TPage
@ -139,17 +139,21 @@ object frmOptions: TfrmOptions
ClientWidth = 446
ClientHeight = 321
object lblTerm: TLabel
AnchorSideTop.Control = edtTerm
AnchorSideTop.Side = asrCenter
Left = 8
Height = 14
Top = 16
Top = 13
Width = 45
Caption = 'Terminal:'
ParentColor = False
end
object lblRunTerm: TLabel
AnchorSideTop.Control = edtRunTerm
AnchorSideTop.Side = asrCenter
Left = 8
Height = 14
Top = 48
Top = 43
Width = 65
Caption = 'Run terminal:'
ParentColor = False
@ -163,20 +167,26 @@ object frmOptions: TfrmOptions
Text = '/usr/X11R6/bin/xterm -e bash -i -c %s'
end
object edtRunTerm: TEdit
AnchorSideTop.Control = edtTerm
AnchorSideTop.Side = asrBottom
Left = 96
Height = 24
Top = 40
Top = 38
Width = 313
BorderSpacing.Top = 6
TabOrder = 1
Text = '/usr/X11R6/bin/xterm'
end
object gb: TGroupBox
AnchorSideTop.Control = edtRunTerm
AnchorSideTop.Side = asrBottom
Left = 10
Height = 156
Top = 66
Top = 68
Width = 202
ClientHeight = 156
ClientWidth = 202
BorderSpacing.Top = 6
ClientHeight = 138
ClientWidth = 198
ParentCtl3D = False
TabOrder = 2
object cbDirSelect: TCheckBox
@ -226,12 +236,15 @@ object frmOptions: TfrmOptions
end
end
object gbMisc: TGroupBox
AnchorSideTop.Control = edtRunTerm
AnchorSideTop.Side = asrBottom
Left = 218
Height = 156
Top = 66
Top = 68
Width = 188
ClientHeight = 156
ClientWidth = 188
BorderSpacing.Top = 6
ClientHeight = 138
ClientWidth = 184
TabOrder = 3
object lblIconsSize: TLabel
Left = 14
@ -275,12 +288,12 @@ object frmOptions: TfrmOptions
AnchorSideTop.Side = asrBottom
Left = 10
Height = 89
Top = 228
Top = 230
Width = 201
BorderSpacing.Top = 6
Caption = 'Date and time'
ClientHeight = 89
ClientWidth = 201
ClientHeight = 71
ClientWidth = 197
TabOrder = 4
object lblDateTimeFormat: TLabel
Left = 8
@ -1424,7 +1437,7 @@ object frmOptions: TfrmOptions
object pgFileOp: TPage
Caption = 'pgFileOp'
ClientWidth = 446
ClientHeight = 339
ClientHeight = 321
object gbCopyBufferSize: TGroupBox
Left = 10
Height = 100

View file

@ -106,7 +106,7 @@ type
implementation
uses
uLng, uShowMsg, uGlobs, GraphType, uPixmapManager, uDCUtils, uOSUtils;
LCLProc, uLng, uShowMsg, uGlobs, GraphType, uPixmapManager, uDCUtils, uOSUtils;
procedure TFrameFilePanel.LoadPanel;
@ -217,7 +217,7 @@ end;
procedure TFrameFilePanel.dgPanelKeyPress(Sender: TObject; var Key: Char);
begin
writeln(output, 'dgpanel:',Ord(Key))
DebugLn('dgpanel:' + Key)
end;
procedure TFrameFilePanel.dgPanelPrepareCanvas(sender: TObject; Col,
@ -283,7 +283,7 @@ var
i:Integer;
begin
if edtSearch.Text='' then Exit;
// writeln('edSearchChange:'+ edSearch.Text);
// DebugLn('edSearchChange:'+ edSearch.Text);
for i:=1 to dgPanel.RowCount-1 do // first is header
begin
@ -561,7 +561,7 @@ end;
procedure TFrameFilePanel.dgPanelExit(Sender: TObject);
begin
// writeln(Self.Name+'.dgPanelExit');
// DebugLn(Self.Name+'.dgPanelExit');
// edtRename.OnExit(Sender); // this is hack, because onExit is NOT called
{ if pnAltSearch.Visible then
CloseAltPanel;}
@ -607,7 +607,7 @@ end;
procedure TFrameFilePanel.dgPanelEnter(Sender: TObject);
begin
// writeln(Self.Name+'.OnEnter');
// DebugLn(Self.Name+'.OnEnter');
CloseAltPanel;
// edtRename.OnExit(Sender); // this is hack, bacause onExit is NOT called
SetFocus;
@ -695,7 +695,7 @@ constructor TFrameFilePanel.Create(AOwner : TWinControl; lblDriveInfo : TLabel;
var
x:Integer;
begin
writeln(output, 'TFrameFilePanel.Create components');
DebugLn('TFrameFilePanel.Create components');
inherited Create(AOwner);
Parent:=AOwner;
Align:=alClient;
@ -746,7 +746,7 @@ begin
// dgPanel.Height:=Self.Height - pnlHeader.Height - pnlFooter.Height;
// writeln(Self.Height - pnlHeader.Height - pnlFooter.Height);
// DebugLn(Self.Height - pnlHeader.Height - pnlFooter.Height);
dgPanel.Align:=alClient;
// dgPanel.DefaultDrawing:=False;
dgPanel.ColCount:=5;

View file

@ -123,7 +123,7 @@ uses
procedure ShowViewer(sl:TStringList; bDeleteAfterView : Boolean = False);
var viewer: TfrmViewer;
begin
//writeln('ShowViewer - Using Internal');
//DebugLn('ShowViewer - Using Internal');
viewer := TfrmViewer.Create(Application);
gViewerPos.Restore(viewer);
viewer.FileList.Assign(sl);
@ -134,20 +134,20 @@ end;
procedure TfrmViewer.LoadFile(iIndex:Integer);
begin
// writeln('Viewer: LoadFile:',iIndex);
// DebugLn('Viewer: LoadFile:' + iIndex);
iActiveFile:=iIndex;
Caption:=FileList.Strings[iIndex];
Screen.Cursor:=crHourGlass;
try
// writeln('View: BeforeCheckGraphics:',iIndex);
// DebugLn('View: BeforeCheckGraphics:' + iIndex);
if CheckGraphics(FileList.Strings[iIndex]) then
begin
// writeln('View: LoadGraphics:',iIndex);
// DebugLn('View: LoadGraphics:' + iIndex);
LoadGraphics(FileList.Strings[iIndex]);
end
else
begin
// writeln('View: LoadIntoViewer:',iIndex);
// DebugLn('View: LoadIntoViewer:' + iIndex);
miImage.Visible:=False;
miEdit.Visible:=True;
@ -332,7 +332,7 @@ end;
procedure TfrmViewer.FormCreate(Sender: TObject);
begin
// writeln('TfrmViewer.FormCreate');
// DebugLn('TfrmViewer.FormCreate');
ViewerControl.Color:=clWindow;
FileList := TStringList.Create;
@ -340,7 +340,7 @@ begin
{ Status.Panels[0].Width:=50;
Status.Panels[1].Width:=50;}
// writeln('TfrmViewer.FormCreate done');
// DebugLn('TfrmViewer.FormCreate done');
end;
procedure TfrmViewer.FormDestroy(Sender: TObject);
@ -356,7 +356,7 @@ var
sViewCmd:String;
sCurrName:String;
begin
{ writeln('TfrmViewer.miProcessClick');
{ DebugLn('TfrmViewer.miProcessClick');
inherited;
miEdit.Visible:=True;
if not miProcess.Checked then
@ -388,7 +388,7 @@ end;
procedure TfrmViewer.ReMmapIfNeed;
begin
// writeln('TfrmViewer.RemmapIfneed');
// DebugLn('TfrmViewer.RemmapIfneed');
if bImage then
begin
bImage:=False;
@ -406,7 +406,7 @@ end;
procedure TfrmViewer.UpDateScrollBar;
begin
// writeln('TfrmViewer.Update scrollbar');
// DebugLn('TfrmViewer.Update scrollbar');
if ScrollBarVert.Min<>0 then
ScrollBarVert.Min:=0;
if ScrollBarVert.Max<>ViewerControl.FileSize then
@ -426,7 +426,7 @@ Function TfrmViewer.CheckGraphics(const sFileName:String):Boolean;
var
sExt:String;
begin
// writeln('TfrmViewer.CheckGraphics');
// DebugLn('TfrmViewer.CheckGraphics');
sExt:=Lowercase(ExtractFileExt(sFileName));
Result:=(sExt='.bmp') or (sExt='.xpm') or (sExt='.png') or
(sExt='.jpg') or (sExt='.jpeg') or (sExt='.ico') or
@ -447,7 +447,7 @@ end;
procedure TfrmViewer.LoadGraphics(const sFileName:String);
begin
// writeln('TfrmViewer.Load graphics');
// DebugLn('TfrmViewer.Load graphics');
Image.Stretch:=miStretch.Checked;
Image.Picture.LoadFromFile(sFileName);
with Image.Picture do AdjustViewerSize(Width, Height);

View file

@ -3,28 +3,38 @@ unit uGlobsPaths;
interface
var
gpExePath:String ='';
gpIniDir:String =''; // local for user
gpCfgDir:String =''; // global for all user
gpLngDir:String =''; // path to language *.po files
gpPixmapPath:String ='';
gpExePath : String = ''; // executable directory
gpIniDir : String = ''; // config dir local for user
gpCfgDir : String = ''; // config dir global for all user
gpLngDir : String = ''; // path to language *.po files
gpPixmapPath : String = ''; // path to pixmaps
procedure LoadPaths;
implementation
uses
SysUtils;
LCLProc, SysUtils;
function GetAppName : String;
begin
Result := '.doublecmd'; // hidden directory
end;
procedure LoadPaths;
begin
gpExePath:=ExtractFilePath(ParamStr(0));
Writeln('executable directory:',gpExePath);
OnGetApplicationName := @GetAppName; // for add a dot in directory name
gpIniDir := GetAppConfigDir(False);
if not DirectoryExists(gpIniDir) then
ForceDirectories(gpIniDir);
OnGetApplicationName := nil;
gpIniDir := IncludeTrailingPathDelimiter(gpIniDir); // add if need path delimiter
gpExePath := ExtractFilePath(ParamStr(0));
DebugLn('Executable directory: ', gpExePath);
// gpExePath:=gpExePath+DirectorySeparator;
gpIniDir:=gpExePath;
gpCfgDir:=gpExePath;
gpLngDir:=gpExePath + 'language' + DirectorySeparator;
gpPixmapPath:= gpExePath + 'pixmaps' + DirectorySeparator;
gpCfgDir := gpExePath;
gpLngDir := gpExePath + 'language' + DirectorySeparator;
gpPixmapPath := gpExePath + 'pixmaps' + DirectorySeparator;
end;
end.

View file

@ -171,13 +171,13 @@ function cnvFormatFileSize(iSize:Int64):String;
var
d:double;
begin
// WriteLN(output, iSize);
// DebugLn( iSize);
if gShortFileSizeFormat then
begin
// TODo Giga
if iSize div (1024*1024) >0 then
begin
// WriteLN(output, 'Div:',Trunc(iSize*10 /(1024*1024))/10);
// DebugLn( 'Div:',Trunc(iSize*10 /(1024*1024))/10);
Result:=FloatToStrF((iSize*10 div (1024*1024))/10, ffFixed, 15, 1)+'M'
end
else
@ -266,7 +266,7 @@ Begin
End;
sl.Free;
End;
//WriteLN(output, 'PathX ' , Result);
//DebugLn('PathX ' , Result);
if Canvas.TextWidth(Result) > MaxLen + Canvas.TextWidth('XXX') then
begin
while Canvas.TextWidth(Result) > MaxLen do

View file

@ -117,20 +117,19 @@ TFindThread = class(TThread)
implementation
uses
Dialogs, Masks, uLng, uFindMmap, uFindEx, uGlobs;
LCLProc, Dialogs, Masks, uLng, uFindMmap, uFindEx, uGlobs;
{ TFindThread }
constructor TFindThread.Create;
begin
writeln('thread b');
DebugLn('thread b');
inherited Create(True);
//FFilter:=TFilter.Create;
FCaseSens:=True;
FFilesScaned:=0;
FilterMask:='*';
GetDir(0, FPathStart);
FItems:=Nil;
FItems:=nil;
FIsDateFrom := False;
FIsDateTo := False;
FIsFileSizeFrom := False;
@ -141,8 +140,7 @@ end;
destructor TFindThread.Destroy;
begin
//if assigned(FFilter) then
//FreeAndNil(FFilter)
end;
procedure TFindThread.Execute;
@ -150,20 +148,20 @@ var
sCurrDir:String;
begin
try
writeln('thread b2');
DebugLn('thread b2');
assert(Assigned(FItems),'assert:FItems is empty');
Synchronize(@UpDateProgress);
if FPathStart[length(FPathStart)] = PathDelim then
Delete(FPathStart,length(FPathStart),1);
sCurrDir:=GetCurrentDir;
try
writeln('thread b',FPathStart);
DebugLn('thread b',FPathStart);
WalkAdr(FPathStart);
finally
ChDir(sCurrDir);
end;
// MessageBeep(1000);
writeln('thread end');
DebugLn('thread end');
except
on E:Exception do
@ -277,13 +275,13 @@ begin
if (FIsTimeFrom and Result) then
Result := ((Trunc(Frac(DateTime) * 10000000) / 10000000) >= (Trunc(Frac(FDateTimeFrom) * 1000) / 1000));
WriteLN('Time From = ', FloatToStr(FDateTimeFrom), ' File time = ', FloatToStr(DateTime), ' Result = ', BoolToStr(Result));
DebugLn('Time From = ', FloatToStr(FDateTimeFrom), ' File time = ', FloatToStr(DateTime), ' Result = ', BoolToStr(Result));
(* Check time to *)
if (FIsTimeTo and Result) then
Result := ((Trunc(Frac(DateTime) * 10000000) / 10000000) <= (Trunc(Frac(FDateTimeTo) * 1000) / 1000));
//WriteLN('Time To = ', FloatToStr(FDateTimeTo), ' File time = ', FloatToStr(DateTime), ' Result = ', BoolToStr(Result));
//DebugLn('Time To = ', FloatToStr(FDateTimeTo), ' File time = ', FloatToStr(DateTime), ' Result = ', BoolToStr(Result));
end;
@ -294,11 +292,11 @@ begin
if FIsFileSizeFrom then
Result := (FileSize >= FFileSizeFrom);
//WriteLN('After From', FileSize, '-', FFileSizeFrom, BoolToStr(Result));
//DebugLn('After From', FileSize, '-', FFileSizeFrom, BoolToStr(Result));
if (FIsFileSizeTo and Result) then
Result := (FileSize <= FFileSizeTo);
//WriteLN('After To', FileSize, '-', FFileSizeTo, BoolToStr(Result));
//DebugLn('After To', FileSize, '-', FFileSizeTo, BoolToStr(Result));
end;
function TFindThread.CheckFile(const Folder : String; const sr : TSearchRec) : Boolean;
@ -308,7 +306,7 @@ begin
Result := True;
{$IFDEF WIN32}
(* This is hack *)
//WriteLN('File = ', sr.Name);
//DebugLn('File = ', sr.Name);
if not MatchesMaskList(sr.Name, FFileMask) then
begin
Result := False;
@ -343,19 +341,19 @@ var
sr: TSearchRec;
Path : String;
begin
writeln(sNewDir);
DebugLn(sNewDir);
if not SetCurrentDir(sNewDir) then Exit;
Path := sNewDir + PathDelim + FFileMask;
//WriteLN('Path = ', Path);
//DebugLn('Path = ', Path);
WriteLN('FAttributes == ', FAttributes);
DebugLn('FAttributes == ' + IntToStr(FAttributes));
if FindFirstEx(Path, FAttributes, sr) = 0 then
repeat
if (sr.Name='.') or (sr.Name='..') then Continue;
inc(FFilesScaned);
//writeln(sr.Name);
//DebugLn(sr.Name);
if CheckFile(sNewDir, sr) then
begin
@ -372,7 +370,7 @@ begin
if not Terminated then
begin
Path := sNewDir + PathDelim + '*';
WriteLN('Search in sub folders = ', Path);
DebugLn('Search in sub folders = ', Path);
if not Terminated and (FindFirstEx(Path, faDirectory, sr) = 0) then
repeat
if (sr.Name[1] <> '.') then

View file

@ -144,17 +144,17 @@ var
implementation
uses
SysUtils, uGlobsPaths, uLng, uShowMsg, uOSUtils;
LCLProc, SysUtils, uGlobsPaths, uLng, uShowMsg, uOSUtils;
// for debugging only, can be removed
procedure dbgShowWindowPos(const pos: TControlPosition);
begin
writeln('TWindowPos');
writeln('Left: ', pos.Left);
writeln('Top: ', pos.Top);
writeln('Width: ', pos.Width);
writeln('Height: ', pos.Height);
writeln('END');
DebugLn('TWindowPos');
WriteLN('Left: ', pos.Left);
WriteLN('Top: ', pos.Top);
WriteLN('Width: ', pos.Width);
WriteLN('Height: ', pos.Height);
DebugLn('END');
end;
procedure TControlPosition.Save(Control: TControl);
@ -191,11 +191,11 @@ end;
procedure InitGlobs;
begin
gIni:=TIniFile.Create(gpIniDir+'doublecmd.ini');
gIni:=TIniFile.Create(gpCfgDir + 'doublecmd.ini');
if gIni.ReadInteger('Configuration', 'UseIniInProgramDir', 1) = 0 then
begin
gIni.Free;
gIni:=TIniFile.Create(GetHomeDir + 'doublecmd.ini');
gIni:=TIniFile.Create(gpIniDir + 'doublecmd.ini');
end;
gExts := TExts.Create;
gColorExt := TColorExt.Create;
@ -223,7 +223,7 @@ end;
function LoadGlobs : Boolean;
begin
Result := False;
writeln('Loading configuration...');
DebugLn('Loading configuration...');
InitGlobs;
{Layout page}
@ -266,13 +266,13 @@ begin
gExtDiff := gIni.ReadString('Configuration', 'ExtDiff', '');
gRunTerm := gIni.ReadString('Configuration', 'RunTerm', gRunTerm);
{ Fonts }
gFontName:=gIni.ReadString('Configuration', 'FontName', '');
gFontName:=gIni.ReadString('Configuration', 'FontName', 'default');
gFontWeight := gIni.ReadInteger('Configuration', 'FontWeight', 1);
writeln('gFontName:',gFontName);
gEditorFontName:=gIni.ReadString('Configuration', 'FontEditorName', '');
writeln('gEditorFontName:',gEditorFontName);
gViewerFontName:=gIni.ReadString('Configuration', 'FontViewerName', '');
writeln('gViewerEditorFontName:',gViewerFontName);
DebugLn('gFontName:',gFontName);
gEditorFontName:=gIni.ReadString('Configuration', 'FontEditorName', 'default');
DebugLn('gEditorFontName:',gEditorFontName);
gViewerFontName:=gIni.ReadString('Configuration', 'FontViewerName', 'default');
DebugLn('gViewerEditorFontName:',gViewerFontName);
gFontSize:=gIni.ReadInteger('Configuration', 'FontSize', 10);
gEditorSize:=gIni.ReadInteger('Configuration', 'EditorSize', 14);
gViewerSize:=gIni.ReadInteger('Configuration', 'ViewerSize', 14);
@ -311,9 +311,9 @@ begin
gColumnSize[3] := gIni.ReadInteger('Configuration', 'Col3', 73);
gColumnSize[4] := gIni.ReadInteger('Configuration', 'Col4', 59);
writeln('Loading viewer position...');
DebugLn('Loading viewer position...');
LoadWindowPos(gViewerPos, 'Viewer.');
writeln('Loading editor position...');
DebugLn('Loading editor position...');
LoadWindowPos(gEditorPos, 'Editor.');
{ Localization }