style modernisation using helpers isEmpty & isNotEmpty

This commit is contained in:
Basile Burg 2016-01-11 01:09:21 +01:00
parent 3fa80be500
commit 0303d0f75f
22 changed files with 87 additions and 70 deletions

View File

@ -48,6 +48,11 @@ type
function isNotNil: boolean; function isNotNil: boolean;
end; end;
TStringHelper = type helper for string
function isEmpty: boolean;
function isNotEmpty: boolean;
end;
(** (**
* Workaround for a TAsyncProcess Linux issue: OnTerminate event not called. * Workaround for a TAsyncProcess Linux issue: OnTerminate event not called.
* An idle timer is started when executing and trigs the event if necessary. * An idle timer is started when executing and trigs the event if necessary.
@ -316,6 +321,16 @@ begin
exit(self <> nil); exit(self <> nil);
end; end;
function TStringHelper.isEmpty: boolean;
begin
exit(self = '');
end;
function TStringHelper.isNotEmpty: boolean;
begin
exit(self <> '');
end;
{$IFDEF LINUX} {$IFDEF LINUX}
constructor TCheckedAsyncProcess.Create(aOwner: TComponent); constructor TCheckedAsyncProcess.Create(aOwner: TComponent);
begin begin
@ -653,7 +668,7 @@ var
files: TStringList; files: TStringList;
begin begin
result := false; result := false;
if aPath = '' then if aPath.isEmpty then
exit; exit;
// //
if aPath[length(aPath)] = '*' then if aPath[length(aPath)] = '*' then
@ -759,7 +774,7 @@ var
env: string; env: string;
begin begin
ext := extractFileExt(anExeName); ext := extractFileExt(anExeName);
if ext = '' then if ext.isEmpty then
anExeName += exeExt; anExeName += exeExt;
//full path already specified //full path already specified
if FileExists(anExeName) and (not FileExists(ExtractFileName(anExeName))) then if FileExists(anExeName) and (not FileExists(ExtractFileName(anExeName))) then
@ -1083,7 +1098,7 @@ end;
function isStringDisabled(const str: string): boolean; function isStringDisabled(const str: string): boolean;
begin begin
result := false; result := false;
if str = '' then if str.isEmpty then
exit; exit;
if str[1] = ';' then if str[1] = ';' then
result := true; result := true;

View File

@ -392,7 +392,7 @@ begin
if i = 0 then if i = 0 then
updateServerlistening; updateServerlistening;
setLength(str, i); setLength(str, i);
if str <> '' then if str.isNotEmpty then
begin begin
i := Pos(#9, str); i := Pos(#9, str);
if i = -1 then if i = -1 then

View File

@ -402,7 +402,7 @@ begin
if (fConfigs.Count <> 1) and (fConfigs.Strings[0] <> DubDefaultConfigName) then if (fConfigs.Count <> 1) and (fConfigs.Strings[0] <> DubDefaultConfigName) then
dubproc.Parameters.Add('--config=' + fConfigs.Strings[fConfigIx]); dubproc.Parameters.Add('--config=' + fConfigs.Strings[fConfigIx]);
dubProc.Parameters.Add('--compiler=' + DubCompilerFilename); dubProc.Parameters.Add('--compiler=' + DubCompilerFilename);
if run and (runArgs <> '') then if run and runArgs.isNotEmpty then
dubproc.Parameters.Add('--' + runArgs); dubproc.Parameters.Add('--' + runArgs);
dubproc.Execute; dubproc.Execute;
while dubproc.Running do while dubproc.Running do
@ -799,7 +799,7 @@ begin
try try
try try
maybe.loadFromFile(filename); maybe.loadFromFile(filename);
if (maybe.json = nil) or (maybe.filename = '') then if maybe.json.isNil or maybe.filename.isEmpty then
result := false result := false
else if maybe.json.Find('name').isNil then else if maybe.json.Find('name').isNil then
result := false; result := false;
@ -824,7 +824,7 @@ begin
gdc: DubCompilerFilename := exeFullName('gdc' + exeExt); gdc: DubCompilerFilename := exeFullName('gdc' + exeExt);
ldc: DubCompilerFilename := exeFullName('ldc2' + exeExt); ldc: DubCompilerFilename := exeFullName('ldc2' + exeExt);
end; end;
if (not fileExists(DubCompilerFilename)) or (DubCompilerFilename = '') then if (not fileExists(DubCompilerFilename)) or DubCompilerFilename.isEmpty then
begin begin
value := dmd; value := dmd;
DubCompilerFilename:= 'dmd' + exeExt; DubCompilerFilename:= 'dmd' + exeExt;

View File

@ -443,7 +443,7 @@ begin
fTokList.Clear; fTokList.Clear;
fErrList.Clear; fErrList.Clear;
end; end;
if md = '' then md := extractFileName(fDoc.fileName); if md.isEmpty then md := extractFileName(fDoc.fileName);
pageControl.currentPage.Caption := md; pageControl.currentPage.Caption := md;
end; end;
end; end;
@ -480,7 +480,8 @@ begin
fTokList.Clear; fTokList.Clear;
fErrList.Clear; fErrList.Clear;
end; end;
if md = '' then md := extractFileName(fDoc.fileName); if md.isEmpty then
md := extractFileName(fDoc.fileName);
pageControl.currentPage.Caption := md; pageControl.currentPage.Caption := md;
end; end;
{$ENDREGION} {$ENDREGION}

View File

@ -25,12 +25,12 @@ inherited CEInfoWidget: TCEInfoWidget
Align = alTop Align = alTop
BorderSpacing.Around = 4 BorderSpacing.Around = 4
Caption = 'about' Caption = 'about'
ClientHeight = 89 ClientHeight = 75
ClientWidth = 399 ClientWidth = 399
TabOrder = 0 TabOrder = 0
object Label1: TLabel object Label1: TLabel
Left = 0 Left = 0
Height = 89 Height = 75
Top = 0 Top = 0
Width = 399 Width = 399
Align = alClient Align = alClient
@ -52,12 +52,12 @@ inherited CEInfoWidget: TCEInfoWidget
Align = alClient Align = alClient
BorderSpacing.Around = 4 BorderSpacing.Around = 4
Caption = 'tools status' Caption = 'tools status'
ClientHeight = 290 ClientHeight = 276
ClientWidth = 399 ClientWidth = 399
TabOrder = 1 TabOrder = 1
object boxTools: TScrollBox object boxTools: TScrollBox
Left = 4 Left = 4
Height = 282 Height = 268
Top = 4 Top = 4
Width = 391 Width = 391
HorzScrollBar.Page = 1 HorzScrollBar.Page = 1

View File

@ -119,7 +119,7 @@ begin
tikFindable: tikFindable:
begin begin
pth := exeFullName(fToolName + exeExt); pth := exeFullName(fToolName + exeExt);
if pth = '' then if pth.isEmpty then
begin begin
fStatus.Caption:= ' the tool cannot be found'; fStatus.Caption:= ' the tool cannot be found';
AssignPng(fIco, 'bullet_red'); AssignPng(fIco, 'bullet_red');
@ -133,7 +133,7 @@ begin
tikOptional: tikOptional:
begin begin
pth := exeFullName(fToolName + exeExt); pth := exeFullName(fToolName + exeExt);
if pth = '' then if pth.isEmpty then
begin begin
fStatus.Caption:= ' the tool cannot be found'; fStatus.Caption:= ' the tool cannot be found';
AssignPng(fIco, 'bullet_yellow'); AssignPng(fIco, 'bullet_yellow');
@ -147,7 +147,7 @@ begin
tikRunning: tikRunning:
begin begin
pth := exeFullName(fToolName + exeExt); pth := exeFullName(fToolName + exeExt);
if pth = '' then if pth.isEmpty then
begin begin
fStatus.Caption:= ' the tool cannot be found'; fStatus.Caption:= ' the tool cannot be found';
AssignPng(fIco, 'bullet_red'); AssignPng(fIco, 'bullet_red');

View File

@ -259,7 +259,7 @@ begin
prj.loadFromFile(pth + DirectorySeparator + 'dub.json') prj.loadFromFile(pth + DirectorySeparator + 'dub.json')
else if FileExists(pth + DirectorySeparator + 'package.json') then else if FileExists(pth + DirectorySeparator + 'package.json') then
prj.loadFromFile(pth + DirectorySeparator + 'package.json'); prj.loadFromFile(pth + DirectorySeparator + 'package.json');
if (prj.filename <> '') and (prj.binaryKind = staticlib) then if prj.filename.isNotEmpty and (prj.binaryKind = staticlib) then
begin begin
str := TStringList.Create; str := TStringList.Create;
try try
@ -368,7 +368,7 @@ begin
root := commonFolder(str); root := commonFolder(str);
root := ExtractFileDir(root); root := ExtractFileDir(root);
end; end;
if root = '' then if root.isEmpty then
begin begin
dlgOkInfo('the static library can not be registered because its source files have no common folder'); dlgOkInfo('the static library can not be registered because its source files have no common folder');
exit; exit;
@ -443,7 +443,7 @@ begin
else else
begin begin
List.Selected.SubItems[0] := filename; List.Selected.SubItems[0] := filename;
if (List.Selected.Caption = '') or (List.Selected.Caption = notav) then if (List.Selected.Caption.isEmpty) or (List.Selected.Caption = notav) then
List.Selected.Caption := ChangeFileExt(extractFileName(filename), ''); List.Selected.Caption := ChangeFileExt(extractFileName(filename), '');
end; end;
end; end;

View File

@ -554,7 +554,7 @@ begin
itf := TCEMainForm(aDestination).fProjectInterface; itf := TCEMainForm(aDestination).fProjectInterface;
if (itf <> nil) and (itf.filename = fProject) then if (itf <> nil) and (itf.filename = fProject) then
exit; exit;
if fProject <> '' then if FileExists(fProject) then if fProject.isNotEmpty and FileExists(fProject) then
TCEMainForm(aDestination).openProj(fProject); TCEMainForm(aDestination).openProj(fProject);
end else end else
inherited; inherited;
@ -740,14 +740,14 @@ begin
if application.ParamCount > 0 then if application.ParamCount > 0 then
begin begin
value := application.Params[1]; value := application.Params[1];
if value <> '' then if value.isNotEmpty then
begin begin
lst := TStringList.Create; lst := TStringList.Create;
try try
lst.DelimitedText := value; lst.DelimitedText := value;
for value in lst do for value in lst do
begin begin
if value = '' then continue; if value.isEmpty then continue;
if isEditable(ExtractFileExt(value)) then if isEditable(ExtractFileExt(value)) then
openFile(value) openFile(value)
else if isValidNativeProject(value) or isValidDubProject(value) then else if isValidNativeProject(value) or isValidDubProject(value) then
@ -764,10 +764,10 @@ begin
end; end;
end; end;
value := application.GetOptionValue('p', 'project'); value := application.GetOptionValue('p', 'project');
if (value <> '') and fileExists(value) then if value.isNotEmpty and fileExists(value) then
openProj(value); openProj(value);
value := application.GetOptionValue('f', 'files'); value := application.GetOptionValue('f', 'files');
if value <> '' then if value.isNotEmpty then
begin begin
lst := TStringList.Create; lst := TStringList.Create;
try try
@ -1790,9 +1790,9 @@ begin
RemoveTrailingChars(cur, [#0..#30]); RemoveTrailingChars(cur, [#0..#30]);
fRunnableSw += (cur + #13); fRunnableSw += (cur + #13);
end; end;
if (fRunnableSw <> '') and (fRunnableSw[length(fRunnableSw)] = #13) then if fRunnableSw.isNotEmpty and (fRunnableSw[length(fRunnableSw)] = #13) then
fRunnableSw := fRunnableSw[1..length(fRunnableSw)-1]; fRunnableSw := fRunnableSw[1..length(fRunnableSw)-1];
if fRunnableSw = '' then if fRunnableSw.isEmpty then
fRunnableSw := '-vcolumns'#13'-w'#13'-wi'; fRunnableSw := '-vcolumns'#13'-w'#13'-wi';
// //
form.Free; form.Free;
@ -1846,7 +1846,7 @@ begin
else fDoc.saveTempFile; else fDoc.saveTempFile;
fname := stripFileExt(fDoc.fileName); fname := stripFileExt(fDoc.fileName);
if fRunnableSw = '' then if fRunnableSw.isEmpty then
fRunnableSw := '-vcolumns'#13'-w'#13'-wi'; fRunnableSw := '-vcolumns'#13'-w'#13'-wi';
{$IFDEF RELEASE} {$IFDEF RELEASE}
dmdProc.ShowWindow := swoHIDE; dmdProc.ShowWindow := swoHIDE;
@ -1879,7 +1879,7 @@ begin
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled', fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
fDoc, amcEdit, amkInf); fDoc, amcEdit, amkInf);
fRunProc.CurrentDirectory := extractFileDir(fRunProc.Executable); fRunProc.CurrentDirectory := extractFileDir(fRunProc.Executable);
if runArgs <> '' then if runArgs.isNotEmpty then
begin begin
extraArgs.Clear; extraArgs.Clear;
CommandToList(symbolExpander.get(runArgs), extraArgs); CommandToList(symbolExpander.get(runArgs), extraArgs);
@ -2249,7 +2249,7 @@ end;
procedure TCEMainForm.actProjSaveExecute(Sender: TObject); procedure TCEMainForm.actProjSaveExecute(Sender: TObject);
begin begin
if fProjectInterface = nil then exit; if fProjectInterface = nil then exit;
if fProjectInterface.filename <> '' then saveProj if fProjectInterface.filename.isNotEmpty then saveProj
else actProjSaveAs.Execute; else actProjSaveAs.Execute;
end; end;

View File

@ -24,7 +24,7 @@ inherited CEMessagesWidget: TCEMessagesWidget
Width = 759 Width = 759
Align = alClient Align = alClient
BorderSpacing.Around = 2 BorderSpacing.Around = 2
DefaultItemHeight = 18 DefaultItemHeight = 16
Font.Height = -12 Font.Height = -12
Font.Name = 'Courier New' Font.Name = 'Courier New'
Font.Quality = fqProof Font.Quality = fqProof

View File

@ -374,7 +374,7 @@ end;
procedure TCEMessagesWidget.TreeFilterEdit1AfterFilter(Sender: TObject); procedure TCEMessagesWidget.TreeFilterEdit1AfterFilter(Sender: TObject);
begin begin
fFiltering := TreeFilterEdit1.Filter <> ''; fFiltering := TreeFilterEdit1.Filter.isNotEmpty;
filterMessages(fCtxt); filterMessages(fCtxt);
end; end;
@ -786,7 +786,7 @@ begin
if dat^.demangled then continue; if dat^.demangled then continue;
dat^.demangled := true; dat^.demangled := true;
str := list.Items.Item[i].Text; str := list.Items.Item[i].Text;
if str = '' then continue; if str.isEmpty then continue;
fToDemangleObjs.add(list.Items.Item[i]); fToDemangleObjs.add(list.Items.Item[i]);
fToDemangle.Add(str); fToDemangle.Add(str);
end; end;

View File

@ -608,7 +608,7 @@ procedure TCENativeProject.updateOutFilename;
begin begin
fOutputFilename := currentConfiguration.pathsOptions.outputFilename; fOutputFilename := currentConfiguration.pathsOptions.outputFilename;
// field is specified // field is specified
if fOutputFilename <> '' then if fOutputFilename.isNotEmpty then
begin begin
fOutputFilename := symbolExpander.get(fOutputFilename); fOutputFilename := symbolExpander.get(fOutputFilename);
fOutputFilename := expandFilenameEx(fBasePath, fOutputFilename); fOutputFilename := expandFilenameEx(fBasePath, fOutputFilename);
@ -652,9 +652,9 @@ var
i, j: integer; i, j: integer;
begin begin
pname := symbolExpander.get(processInfo.executable); pname := symbolExpander.get(processInfo.executable);
if (not exeInSysPath(pname)) and (pname <> '') then if (not exeInSysPath(pname)) and pname.isNotEmpty then
exit(false) exit(false)
else if (pname = '') then else if pname.isEmpty then
exit(true); exit(true);
// //
process := TProcess.Create(nil); process := TProcess.Create(nil);
@ -666,7 +666,7 @@ begin
process.Parameters.AddText(symbolExpander.get(process.Parameters.Strings[i])); process.Parameters.AddText(symbolExpander.get(process.Parameters.Strings[i]));
for i:= 0 to j do for i:= 0 to j do
process.Parameters.Delete(0); process.Parameters.Delete(0);
if process.CurrentDirectory <> '' then if process.CurrentDirectory.isNotEmpty then
process.CurrentDirectory := symbolExpander.get(process.CurrentDirectory); process.CurrentDirectory := symbolExpander.get(process.CurrentDirectory);
// else cwd is set to project dir in compile() // else cwd is set to project dir in compile()
ensureNoPipeIfWait(process); ensureNoPipeIfWait(process);
@ -766,13 +766,13 @@ begin
// //
fRunner := TCEProcess.Create(nil); // fRunner can use the input process widget. fRunner := TCEProcess.Create(nil); // fRunner can use the input process widget.
currentConfiguration.runOptions.setProcess(fRunner); currentConfiguration.runOptions.setProcess(fRunner);
if runArgs <> '' then if runArgs.isNotEmpty then
begin begin
i := 1; i := 1;
repeat repeat
prm := ExtractDelimited(i, runArgs, [' ']); prm := ExtractDelimited(i, runArgs, [' ']);
prm := symbolExpander.get(prm); prm := symbolExpander.get(prm);
if prm <> '' then if prm.isNotEmpty then
fRunner.Parameters.AddText(prm); fRunner.Parameters.AddText(prm);
Inc(i); Inc(i);
until prm = ''; until prm = '';
@ -786,7 +786,7 @@ begin
end; end;
// //
fRunner.Executable := outputFilename; fRunner.Executable := outputFilename;
if fRunner.CurrentDirectory = '' then if fRunner.CurrentDirectory.isEmpty then
begin begin
fRunnerOldCwd := GetCurrentDir; fRunnerOldCwd := GetCurrentDir;
cwd := extractFilePath(fRunner.Executable); cwd := extractFilePath(fRunner.Executable);
@ -991,7 +991,7 @@ begin
ldc: NativeProjectCompilerFilename := exeFullName('ldmd2' + exeExt); ldc: NativeProjectCompilerFilename := exeFullName('ldmd2' + exeExt);
end; end;
if (not fileExists(NativeProjectCompilerFilename)) if (not fileExists(NativeProjectCompilerFilename))
or (NativeProjectCompilerFilename = '') then or NativeProjectCompilerFilename.isEmpty then
begin begin
value := dmd; value := dmd;
NativeProjectCompilerFilename:= 'dmd' + exeExt; NativeProjectCompilerFilename:= 'dmd' + exeExt;

View File

@ -421,7 +421,7 @@ begin
// display Imports (-J) // display Imports (-J)
for str in FProject.currentConfiguration.pathsOptions.importStringPaths do for str in FProject.currentConfiguration.pathsOptions.importStringPaths do
begin begin
if str = '' then if str.isEmpty then
continue; continue;
fold := expandFilenameEx(fProject.basePath, str); fold := expandFilenameEx(fProject.basePath, str);
fold := symbolExpander.get(fold); fold := symbolExpander.get(fold);
@ -433,7 +433,7 @@ begin
// display Includes (-I) // display Includes (-I)
for str in FProject.currentConfiguration.pathsOptions.importModulePaths do for str in FProject.currentConfiguration.pathsOptions.importModulePaths do
begin begin
if str = '' then if str.isEmpty then
continue; continue;
fold := expandFilenameEx(fProject.basePath, str); fold := expandFilenameEx(fProject.basePath, str);
fold := symbolExpander.get(fold); fold := symbolExpander.get(fold);
@ -445,7 +445,7 @@ begin
// display extra sources (external .lib, *.a, *.d) // display extra sources (external .lib, *.a, *.d)
for str in FProject.currentConfiguration.pathsOptions.extraSources do for str in FProject.currentConfiguration.pathsOptions.extraSources do
begin begin
if str = '' then if str.isEmpty then
continue; continue;
src := expandFilenameEx(fProject.basePath, str); src := expandFilenameEx(fProject.basePath, str);
src := symbolExpander.get(src); src := symbolExpander.get(src);

View File

@ -129,7 +129,7 @@ inherited CESearchWidget: TCESearchWidget
Align = alClient Align = alClient
BorderSpacing.Around = 4 BorderSpacing.Around = 4
Caption = 'Options' Caption = 'Options'
ClientHeight = 92 ClientHeight = 78
ClientWidth = 382 ClientWidth = 382
TabOrder = 4 TabOrder = 4
object chkWWord: TCheckBox object chkWWord: TCheckBox

View File

@ -463,11 +463,11 @@ end;
procedure TCESearchWidget.updateImperative; procedure TCESearchWidget.updateImperative;
begin begin
btnFind.Enabled := fDoc.isNotNil and (fToFind <> ''); btnFind.Enabled := fDoc.isNotNil and fToFind.isNotEmpty;
btnFindAll.Enabled := fDoc.isNotNil and (fToFind <> ''); btnFindAll.Enabled := fDoc.isNotNil and fToFind.isNotEmpty;
btnReplace.Enabled := fDoc.isNotNil and (chkEnableRep.Checked) and (fToFind <> ''); btnReplace.Enabled := fDoc.isNotNil and chkEnableRep.Checked and fToFind.isNotEmpty;
btnReplaceAll.Enabled := btnReplace.Enabled; btnReplaceAll.Enabled := btnReplace.Enabled;
cbReplaceWth.Enabled := fDoc.isNotNil and (chkEnableRep.Checked); cbReplaceWth.Enabled := fDoc.isNotNil and chkEnableRep.Checked;
cbToFind.Enabled := fDoc.isNotNil; cbToFind.Enabled := fDoc.isNotNil;
end; end;
{$ENDREGION} {$ENDREGION}

View File

@ -299,7 +299,7 @@ begin
begin begin
sh := Shortcut(Key, Shift); sh := Shortcut(Key, Shift);
sht := shortCutToText(sh); sht := shortCutToText(sh);
if sht = '' then if sht.isEmpty then
exit; exit;
for i:= 0 to tree.Selected.Parent.Count-1 do for i:= 0 to tree.Selected.Parent.Count-1 do
if i <> tree.Selected.Index then if i <> tree.Selected.Index then
@ -369,8 +369,8 @@ var
prt: TTreeNode; prt: TTreeNode;
begin begin
// root category // root category
if cat = '' then exit; if cat.isEmpty or idt.isEmpty then
if idt = '' then exit; exit;
prt := findCategory(cat, obs); prt := findCategory(cat, obs);
if prt.isNil then if prt.isNil then
prt := tree.Items.AddObject(nil, cat, obs); prt := tree.Items.AddObject(nil, cat, obs);
@ -413,7 +413,7 @@ begin
begin begin
shc := fShortcuts[i]; shc := fShortcuts[i];
cat := findCategory(shc); cat := findCategory(shc);
if cat = '' then if cat.isEmpty then
continue; continue;
if shc.declarator = nil then if shc.declarator = nil then
continue; continue;

View File

@ -24,7 +24,7 @@ inherited CESymbolListWidget: TCESymbolListWidget
Width = 302 Width = 302
Align = alClient Align = alClient
BorderSpacing.Around = 4 BorderSpacing.Around = 4
DefaultItemHeight = 18 DefaultItemHeight = 16
HideSelection = False HideSelection = False
Images = imgList Images = imgList
ReadOnly = True ReadOnly = True

View File

@ -603,7 +603,7 @@ end;
procedure TCESymbolListWidget.TreeFilterEdit1AfterFilter(Sender: TObject); procedure TCESymbolListWidget.TreeFilterEdit1AfterFilter(Sender: TObject);
begin begin
if TreeFilterEdit1.Filter = '' then if TreeFilterEdit1.Filter.isEmpty then
updateVisibleCat; updateVisibleCat;
end; end;
@ -612,7 +612,7 @@ function TCESymbolListWidget.TreeFilterEdit1FilterItem(Item: TObject; out
begin begin
if not fSmartFilter then exit(false); if not fSmartFilter then exit(false);
// //
if TreeFilterEdit1.Filter <> '' then if TreeFilterEdit1.Filter.isNotEmpty then
tree.FullExpand tree.FullExpand
else if tree.Selected.isNil then else if tree.Selected.isNil then
tree.FullCollapse tree.FullCollapse
@ -769,7 +769,7 @@ begin
if fSmartExpander then if fSmartExpander then
smartExpand; smartExpand;
tree.EndUpdate; tree.EndUpdate;
if flt <> '' then if flt.isNotEmpty then
TreeFilterEdit1.Text := flt; TreeFilterEdit1.Text := flt;
end; end;

View File

@ -175,7 +175,7 @@ begin
fDoc.saveTempFile; fDoc.saveTempFile;
fSymbols[CFF] := fDoc.fileName; fSymbols[CFF] := fDoc.fileName;
fSymbols[CFP] := ExtractFilePath(fDoc.fileName); fSymbols[CFP] := ExtractFilePath(fDoc.fileName);
if fDoc.Identifier <> '' then if fDoc.Identifier.isNotEmpty then
fSymbols[CI] := fDoc.Identifier; fSymbols[CI] := fDoc.Identifier;
end; end;
// project interface // project interface
@ -212,7 +212,7 @@ begin
if fileExists(fProj.fileName) then if fileExists(fProj.fileName) then
begin begin
fSymbols[CPR] := expandFilenameEx(fProj.basePath, fProj.RootFolder); fSymbols[CPR] := expandFilenameEx(fProj.basePath, fProj.RootFolder);
if fSymbols[CPR] = '' then if fSymbols[CPR].isEmpty then
fSymbols[CPR] := fSymbols[CPP]; fSymbols[CPR] := fSymbols[CPP];
end; end;
end; end;
@ -226,7 +226,7 @@ var
i: integer; i: integer;
begin begin
Result := ''; Result := '';
if symString = '' then if symString.isEmpty then
exit; exit;
// //
updateSymbols; updateSymbols;

View File

@ -796,7 +796,7 @@ begin
i -= 1; i -= 1;
end; end;
DcdWrapper.getCallTip(str); DcdWrapper.getCallTip(str);
if str <> '' then if str.isNotEmpty then
begin begin
pnt := ClientToScreen(point(CaretXPix, CaretYPix)); pnt := ClientToScreen(point(CaretXPix, CaretYPix));
fCallTipWin.FontSize := Font.Size; fCallTipWin.FontSize := Font.Size;
@ -818,7 +818,7 @@ begin
fCanShowHint := false; fCanShowHint := false;
DcdWrapper.getDdocFromCursor(str); DcdWrapper.getDdocFromCursor(str);
// //
if str <> '' then if str.isNotEmpty then
begin begin
fDDocWin.FontSize := Font.Size; fDDocWin.FontSize := Font.Size;
fDDocWin.HintRect := fDDocWin.CalcHintRect(0, str, nil); fDDocWin.HintRect := fDDocWin.CalcHintRect(0, str, nil);
@ -885,7 +885,7 @@ var
len: Integer; len: Integer;
begin begin
// empty items can be produced if completion list is too long // empty items can be produced if completion list is too long
if aKey = '' then exit(true); if aKey.isEmpty then exit(true);
// otherwise always at least 20 chars but... // otherwise always at least 20 chars but...
// ... '20' depends on ce_dcd, case knd of, string literals length // ... '20' depends on ce_dcd, case knd of, string literals length
result := true; result := true;

View File

@ -3,6 +3,7 @@ inherited CETodoListWidget: TCETodoListWidget
Height = 337 Height = 337
Top = 196 Top = 196
Width = 584 Width = 584
ActiveControl = btnRefresh
Caption = 'Todo list' Caption = 'Todo list'
ClientHeight = 337 ClientHeight = 337
ClientWidth = 584 ClientWidth = 584

View File

@ -493,7 +493,7 @@ begin
trg.SubItems.Add(src.priority); trg.SubItems.Add(src.priority);
trg.SubItems.Add(shortenPath(src.filename, 25)); trg.SubItems.Add(shortenPath(src.filename, 25));
// //
if flt <> '' then if flt.isNotEmpty then
if flt <> '(filter)' then if flt <> '(filter)' then
if not AnsiContainsText(src.Text, flt) then if not AnsiContainsText(src.Text, flt) then
if not AnsiContainsText(src.category, flt) then if not AnsiContainsText(src.category, flt) then
@ -505,13 +505,13 @@ begin
continue; continue;
end; end;
// //
if src.category <> '' then if src.category.isNotEmpty then
lstItems.Column[1].Visible := True; lstItems.Column[1].Visible := True;
if src.assignee <> '' then if src.assignee.isNotEmpty then
lstItems.Column[2].Visible := True; lstItems.Column[2].Visible := True;
if src.status <> '' then if src.status.isNotEmpty then
lstItems.Column[3].Visible := True; lstItems.Column[3].Visible := True;
if src.priority <> '' then if src.priority.isNotEmpty then
lstItems.Column[4].Visible := True; lstItems.Column[4].Visible := True;
end; end;
end; end;

View File

@ -209,7 +209,7 @@ begin
begin begin
prm := ''; prm := '';
if InputQuery('Parameters', '', prm) then if InputQuery('Parameters', '', prm) then
if prm <> '' then fProcess.Parameters.AddText(symbolExpander.get(prm)); if prm.isNotEmpty then fProcess.Parameters.AddText(symbolExpander.get(prm));
end; end;
ensureNoPipeIfWait(fProcess); ensureNoPipeIfWait(fProcess);
// //
@ -234,7 +234,7 @@ var
str: string; str: string;
nxt: TCEToolItem; nxt: TCEToolItem;
begin begin
if ((not fOutputToNext) or (fNextToolAlias = '')) and (poUsePipes in options) then if ((not fOutputToNext) or fNextToolAlias.isEmpty) and (poUsePipes in options) then
begin begin
getMessageDisplay(fMsgs); getMessageDisplay(fMsgs);
lst := TStringList.Create; lst := TStringList.Create;
@ -246,7 +246,7 @@ begin
lst.Free; lst.Free;
end; end;
end; end;
if (not fProcess.Running) and (fNextToolAlias <> '') then if (not fProcess.Running) and fNextToolAlias.isNotEmpty then
begin begin
nxt := fToolItems.findTool(fNextToolAlias); nxt := fToolItems.findTool(fNextToolAlias);
if nxt.isNotNil then nxt.execute(self); if nxt.isNotNil then nxt.execute(self);