style modernisation using helpers isNil & isNotNil

This commit is contained in:
Basile Burg 2016-01-11 00:36:10 +01:00
parent 1bbff471ee
commit 3fa80be500
35 changed files with 322 additions and 298 deletions

View File

@ -36,6 +36,18 @@ type
TCEFilename = type string;
TCEEditEvent = type boolean;
// sugar for classes
TObjectHelper = class helper for TObject
function isNil: boolean;
function isNotNil: boolean;
end;
// sugar for pointers
TPointerHelper = type helper for Pointer
function isNil: boolean;
function isNotNil: boolean;
end;
(**
* Workaround for a TAsyncProcess Linux issue: OnTerminate event not called.
* An idle timer is started when executing and trigs the event if necessary.
@ -284,6 +296,26 @@ begin
else inherited;
end;
function TObjectHelper.isNil: boolean;
begin
exit(self = nil);
end;
function TObjectHelper.isNotNil: boolean;
begin
exit(self <> nil);
end;
function TPointerHelper.isNil: boolean;
begin
exit(self = nil);
end;
function TPointerHelper.isNotNil: boolean;
begin
exit(self <> nil);
end;
{$IFDEF LINUX}
constructor TCheckedAsyncProcess.Create(aOwner: TComponent);
begin

View File

@ -95,7 +95,7 @@ begin
fTempLines := TStringList.Create;
fImportCache := TStringList.Create;
if (fServer <> nil) then
if fServer.isNotNil then
fServer.Execute;
updateServerlistening;
//
@ -111,10 +111,11 @@ destructor TCEDcdWrapper.destroy;
begin
EntitiesConnector.removeObserver(self);
fImportCache.Free;
if fTempLines <> nil then
if fTempLines.isNotNil then
fTempLines.Free;
if fServer <> nil then begin
if not fServerWasRunning then killServer;
if fServer.isNotNil then begin
if not fServerWasRunning then
killServer;
fServer.Free;
end;
fClient.Free;

View File

@ -1,2 +1,3 @@
{$MODE OBJFPC}{$H+}
{$INTERFACES CORBA}
{$INTERFACES CORBA}
{$MODESWITCH TYPEHELPERS}

View File

@ -251,7 +251,7 @@ var
prc: TProcess;
str: TStringList;
begin
if not assigned(fDoc) then
if fDoc.isNil then
exit;
if not exeInSysPath('dfmt') then
exit;
@ -283,9 +283,8 @@ end;
procedure TCEDfmtWidget.doCancel(sender: TObject);
begin
if not assigned(fDoc) then
if fDoc.isNil then
exit;
fDoc.Lines.Assign(fBackup);
end;
{$ENDREGION}

View File

@ -372,7 +372,7 @@ procedure TDocOpts.getOpts(aList: TStrings; base: TOptsGroup = nil);
var
baseopt: TDocOpts;
begin
if base = nil then
if base.isNil then
begin
if fGenDoc then
aList.Add('-D');
@ -483,7 +483,7 @@ var
const
DepStr : array[TDepHandling] of string = ('-d', '', '-de');
begin
if base = nil then
if base.isNil then
begin
dep := DepStr[fDepHandling];
if dep <> '' then aList.Add(dep);
@ -609,7 +609,7 @@ const
binKindStr: array[TProjectBinaryKind] of string = ('', '-lib', '-shared', '-c');
bchKindStr: array[TBoundCheckKind] of string = ('on', 'safeonly', 'off');
begin
if base = nil then
if base.isNil then
begin
str := binKindStr[fBinKind];
if str <> '' then aList.Add(str);
@ -796,7 +796,7 @@ var
idt: string;
baseopt: TDebugOpts;
begin
if base = nil then
if base.isNil then
begin
if fDebug then aList.Add('-debug');
if fDbgLevel <> 0 then
@ -926,7 +926,7 @@ var
baseopt: TPathsOpts;
rightList: TStringList;
begin
if base = nil then
if base.isNil then
begin
exts := TStringList.Create;
try
@ -1093,7 +1093,7 @@ var
baseopt: TOtherOpts;
rightList: TStringList;
begin
if base = nil then
if base.isNil then
begin
for str1 in fCustom do if str1 <> '' then
begin

View File

@ -203,6 +203,8 @@ begin
//
FreeAndNil(fJSON);
parser := TJSONParser.Create(loader, true);
//TODO-cDUB: uses parser.options to allow trailing comma (from FPC 3.02)
// http://bugs.freepascal.org/view.php?id=29357
try
try
fJSON := parser.Parse as TJSONObject;
@ -446,7 +448,7 @@ begin
if fConfigIx = 0 then exit;
//
item := fJSON.Find('configurations');
if not assigned(item) then exit;
if item.isNil then exit;
//
confs := TJSONArray(item);
if fConfigIx > confs.Count -1 then exit;
@ -461,7 +463,7 @@ begin
if not assigned(fJSON) then
exit;
value := fJSON.Find('name');
if not assigned(value) then fPackageName := ''
if value.isNil then fPackageName := ''
else fPackageName := value.AsString;
end;
@ -476,7 +478,7 @@ var
begin
fBuildTypes.Clear;
fConfigs.Clear;
if not assigned(fJSON) then
if fJSON.isNil then
exit;
// the CE interface for dub doesn't make the difference between build type
//and config, instead each possible combination type + build is generated.
@ -486,7 +488,7 @@ begin
for i:= 0 to arr.Count-1 do
begin
item := TJSONObject(arr.Items[i]);
if item.Find('name') = nil then
if item.Find('name').isNil then
continue;
fConfigs.Add(item.Strings['name']);
end;
@ -499,7 +501,7 @@ begin
fBuildTypes.AddStrings(DubBuiltTypeName);
dat := fJSON.Find('buildTypes');
if assigned(dat) and (dat.JSONType = jtObject) then
if dat.isNotNil and (dat.JSONType = jtObject) then
begin
obj := fJSON.Objects['buildTypes'];
for i := 0 to obj.Count-1 do
@ -526,7 +528,7 @@ var
i: integer;
begin
item := from.Find('excludedSourceFiles');
if assigned(item) and (item.JSONType = jtArray) then
if item.isNotNil and (item.JSONType = jtArray) then
begin
arr := TJSONArray(item);
for i := 0 to arr.Count-1 do
@ -556,13 +558,13 @@ begin
try
// auto folders & files
item := fJSON.Find('mainSourceFile');
if assigned(item) then
if item.isNotNil then
fSrcs.Add(patchPlateformPath(ExtractRelativepath(fBasePath, item.AsString)));
tryAddFromFolder(fBasePath + 'src');
tryAddFromFolder(fBasePath + 'source');
// custom folders
item := fJSON.Find('sourcePaths');
if assigned(item) then
if item.isNotNil then
begin
arr := TJSONArray(item);
for i := 0 to arr.Count-1 do
@ -576,21 +578,21 @@ begin
end;
// custom files
item := fJSON.Find('sourceFiles');
if assigned(item) then
if item.isNotNil then
begin
arr := TJSONArray(item);
for i := 0 to arr.Count-1 do
fSrcs.Add(patchPlateformPath(ExtractRelativepath(fBasePath, arr.Strings[i])));
end;
conf := getCurrentCustomConfig;
if assigned(conf) then
if conf.isNotNil then
begin
item := conf.Find('mainSourceFile');
if assigned(item) then
if item.isNotNil then
fSrcs.Add(patchPlateformPath(ExtractRelativepath(fBasePath, item.AsString)));
// custom folders in current config
item := conf.Find('sourcePaths');
if assigned(item) then
if item.isNotNil then
begin
arr := TJSONArray(item);
for i := 0 to arr.Count-1 do
@ -604,7 +606,7 @@ begin
end;
// custom files in current config
item := conf.Find('sourceFiles');
if assigned(item) then
if item.isNotNil then
begin
arr := TJSONArray(item);
for i := 0 to arr.Count-1 do
@ -616,7 +618,7 @@ begin
lst.Clear;
getExclusion(fJSON);
conf := getCurrentCustomConfig;
if assigned(conf) then
if conf.isNotNil then
getExclusion(conf);
for i := fSrcs.Count-1 downto 0 do
for j := 0 to lst.Count-1 do
@ -633,13 +635,13 @@ var
tt: TJSONData;
begin
result := true;
if value.Find('mainSourceFile') <> nil then
if value.Find('mainSourceFile').isNotNil then
begin
fBinKind := executable;
exit;
end;
tt := value.Find('targetType');
if tt <> nil then
if tt.isNotNil then
begin
case tt.AsString of
'executable': fBinKind := executable;
@ -658,11 +660,11 @@ var
src: string;
begin
fBinKind := executable;
if not assigned(fJSON) then exit;
if fJSON.isNil then exit;
// note: in Coedit this is only used to known if output can be launched
found := findTargetKindInd(fJSON);
conf := getCurrentCustomConfig;
if assigned(conf) then
if conf.isNotNil then
found := found or findTargetKindInd(conf);
if not found then
begin
@ -700,11 +702,11 @@ procedure TCEDubProject.updateImportPathsFromJson;
var
conf: TJSONObject;
begin
if not assigned(fJSON) then exit;
if fJSON.isNil then exit;
//
addFrom(fJSON);
conf := getCurrentCustomConfig;
if assigned(conf) then addFrom(conf);
if conf.isNotNil then addFrom(conf);
end;
procedure TCEDubProject.updateOutputNameFromJson;
@ -718,20 +720,20 @@ var
begin
p := obj.Find('targetPath');
n := obj.Find('targetName');
if assigned(p) then pathPart := p.AsString;
if assigned(n) then namePart := n.AsString;
if p.isNotNil then pathPart := p.AsString;
if n.isNotNil then namePart := n.AsString;
end;
begin
fOutputFileName := '';
if not assigned(fJSON) then exit;
if fJSON.isNil then exit;
item := fJSON.Find('name');
if not assigned(item) then
exit;
if item.isNil then exit;
namePart := item.AsString;
pathPart := fBasePath;
setFrom(fJSON);
conf := getCurrentCustomConfig;
if assigned(conf) then
if conf.isNotNil then
setFrom(conf);
pathPart := TrimRightSet(pathPart, ['/','\']);
{$IFDEF WINDOWS}
@ -799,7 +801,7 @@ begin
maybe.loadFromFile(filename);
if (maybe.json = nil) or (maybe.filename = '') then
result := false
else if maybe.json.Find('name') = nil then
else if maybe.json.Find('name').isNil then
result := false;
except
result := false;

View File

@ -28,7 +28,7 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
TabOrder = 0
object TabSheet1: TTabSheet
Caption = 'Inspector'
ClientHeight = 388
ClientHeight = 380
ClientWidth = 395
object pnlToolBar1: TPanel
Left = 4
@ -59,7 +59,7 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
end
object treeInspect: TTreeView
Left = 4
Height = 352
Height = 344
Top = 32
Width = 387
Align = alClient
@ -81,7 +81,7 @@ inherited CEDubProjectEditorWidget: TCEDubProjectEditorWidget
end
object TabSheet2: TTabSheet
Caption = 'Editor'
ClientHeight = 388
ClientHeight = 380
ClientWidth = 395
object propTree: TTreeView
Left = 4

View File

@ -169,7 +169,7 @@ end;
procedure TCEDubProjectEditorWidget.projChanged(aProject: ICECommonProject);
begin
if fProj = nil then
if fProj.isNil then
exit;
if aProject.getProject <> fProj then
exit;
@ -182,7 +182,7 @@ end;
procedure TCEDubProjectEditorWidget.projClosing(aProject: ICECommonProject);
begin
if fProj = nil then
if fProj.isNil then
exit;
if aProject.getProject <> fProj then
exit;
@ -219,18 +219,18 @@ begin
fSelectedNode := nil;
btnDelProp.Enabled := false;
btnAddProp.Enabled := false;
if propTree.Selected = nil then exit;
if propTree.Selected.isNil then exit;
//
fSelectedNode := propTree.Selected;
btnDelProp.Enabled := (fSelectedNode.Level > 0) and (fSelectedNode.Text <> 'name')
and (fSelectedNode.data <> nil);
and fSelectedNode.data.isNotNil;
updateValueEditor;
btnAddProp.Enabled := TJSONData(fSelectedNode.Data).JSONType in [jtObject, jtArray];
end;
procedure TCEDubProjectEditorWidget.btnAcceptPropClick(Sender: TObject);
begin
if fSelectedNode = nil then exit;
if fSelectedNode.isNil then exit;
//
setJsonValueFromEditor;
propTree.FullExpand;
@ -240,7 +240,7 @@ procedure TCEDubProjectEditorWidget.btnAddPropClick(Sender: TObject);
var
pnl: TCEDubProjectPropAddPanel;
begin
if fSelectedNode = nil then exit;
if fSelectedNode.isNil then exit;
//
pnl := TCEDubProjectPropAddPanel.construct(@addProp);
pnl.ShowModal;
@ -254,7 +254,7 @@ var
obj: TJSONObject;
nod: TTreeNode;
begin
if fSelectedNode = nil then exit;
if fSelectedNode.isNil then exit;
//
fProj.beginModification;
if TJSONData(fSelectedNode.Data).JSONType = jtArray then
@ -278,9 +278,9 @@ begin
fProj.endModification;
propTree.FullExpand;
nod := propTree.Items.FindNodeWithText('<value>');
if nod = nil then
if nod.isNil then
nod := propTree.Items.FindNodeWithText(propName);
if nod <> nil then
if nod.isNotNil then
begin
propTree.Selected := nod;
propTree.MakeSelectionVisible;
@ -291,11 +291,11 @@ procedure TCEDubProjectEditorWidget.btnDelPropClick(Sender: TObject);
var
prt: TJSONData;
begin
if fSelectedNode = nil then exit;
if fSelectedNode.isNil then exit;
if fSelectedNode.Level = 0 then exit;
if fSelectedNode.Text = 'name' then exit;
if fSelectedNode.Data = nil then exit;
if fSelectedNode.Parent.Data = nil then exit;
if fSelectedNode.Data.isNil then exit;
if fSelectedNode.Parent.Data.isNil then exit;
//
fProj.beginModification;
prt := TJSONData(fSelectedNode.Parent.Data);
@ -316,9 +316,9 @@ var
vInt64: int64;
vBool: boolean;
begin
if fSelectedNode = nil then exit;
if fSelectedNode.Data = nil then exit;
if fProj = nil then exit;
if fSelectedNode.isNil then exit;
if fSelectedNode.Data.isNil then exit;
if fProj.isNil then exit;
//
fProj.beginModification;
dat := TJSONData(fSelectedNode.Data);
@ -349,8 +349,8 @@ var
dat: TJSONData;
begin
edProp.Clear;
if fSelectedNode = nil then exit;
if fSelectedNode.Data = nil then exit;
if fSelectedNode.isNil then exit;
if fSelectedNode.Data.isNil then exit;
//
dat := TJSONData(fSelectedNode.Data);
case dat.JSONType of
@ -416,7 +416,7 @@ procedure TCEDubProjectEditorWidget.updateEditor;
begin
propTree.Items.Clear;
edProp.Clear;
if (fProj = nil) or (fProj.json = nil) then
if fProj.isNil or fProj.json.isNil then
exit;
//
propTree.BeginUpdate;
@ -432,13 +432,13 @@ var
j: integer;
node : TTreeNode;
begin
if (fNodeConfig = nil) or (fNodeSources = nil) then
if fNodeConfig.isNil or fNodeSources.isNil then
exit;
//
fNodeConfig.DeleteChildren;
fNodeSources.DeleteChildren;
//
if (fProj = nil) then
if fProj.isNil then
exit;
//
j := fProj.getActiveConfigurationIndex;
@ -478,8 +478,8 @@ var
node: TTreeNode;
fname: string;
begin
if treeInspect.Selected = nil then exit;
if fProj = nil then exit;
if treeInspect.Selected.isNil then exit;
if fProj.isNil then exit;
node := treeInspect.Selected;
// open file
if node.Parent = fNodeSources then

View File

@ -134,7 +134,7 @@ end;
function TCEEditorWidget.closeQuery: boolean;
begin
result := inherited and (Parent = nil);
result := inherited and Parent.isNil;
end;
{$ENDREGION}
@ -164,7 +164,7 @@ end;
procedure TCEEditorWidget.docClosing(aDoc: TCESynMemo);
begin
if aDoc = nil then
if aDoc.isNil then
exit;
aDoc.Parent := nil;
if aDoc = fDoc then
@ -225,7 +225,7 @@ var
doc: TCESynMemo;
begin
doc := findDocument(aFilename);
if doc <> nil then begin
if doc.isNotNil then begin
PageControl.currentPage := TCEPage(doc.Parent);
exit;
end;
@ -238,7 +238,7 @@ var
doc: TCESynMemo;
begin
doc := getDocument(index);
if not assigned(doc) then exit(false);
if doc.isNil then exit(false);
if (doc.modified or (doc.fileName = doc.tempFilename)) and
(dlgFileChangeClose(doc.fileName) = mrCancel) then exit(false);
pageControl.pageIndex:=index;
@ -251,7 +251,7 @@ var
page: TCEPage = nil;
begin
page := TCEPage(doc.Parent);
if not assigned(page) then
if page.isNil then
exit(false);
exit(closeDocument(page.index));
end;
@ -271,7 +271,7 @@ end;
procedure TCEEditorWidget.focusedEditorChanged;
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
macRecorder.Editor:= fDoc;
fDoc.PopupMenu := mnuEditor;
@ -286,14 +286,14 @@ end;
procedure TCEEditorWidget.PageControlChanged(Sender: TObject);
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
fDoc.hideCallTips;
fDoc.hideDDocs;
end;
procedure TCEEditorWidget.PageControlChanging(Sender: TObject; var AllowChange: Boolean);
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
fDoc.hideCallTips;
fDoc.hideDDocs;
end;

View File

@ -644,10 +644,8 @@ begin
end;
end;
end;
{$ENDREGION}
initialization
EditorOptions := TCEEditorOptions.Create(nil);

View File

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

View File

@ -112,7 +112,7 @@ procedure TToolInfo.refreshStatus;
var
pth: string;
begin
if (fLabel = nil) or (fStatus = nil) then exit;
if fLabel.isNil or fStatus.isNil then exit;
//
fLabel.Caption:= fToolName;
case fKind of

View File

@ -168,7 +168,7 @@ begin
for i := 0 to fCol.Count-1 do
begin
itm := TLibraryItem(fCol.Items[i]);
if someAliases <> nil then
if someAliases.isNotNil then
if someAliases.IndexOf(itm.libAlias) = -1 then
continue;
// single lib files
@ -212,7 +212,7 @@ begin
for i := 0 to fCol.Count-1 do
begin
itm := TLibraryItem(fCol.Items[i]);
if someAliases <> nil then
if someAliases.isNotNil then
if someAliases.IndexOf(itm.libAlias) = -1 then
continue;
//

View File

@ -92,7 +92,7 @@ procedure TCELibManEditorWidget.updateButtonsState;
begin
btnReg.Enabled := (fProj <> nil) and (fProj.binaryKind = staticlib) and
FileExists(fProj.Filename);
btnOpenProj.Enabled := (List.Selected <> nil) and
btnOpenProj.Enabled := (List.Selected.isNotNil) and
(fileExists(List.Selected.SubItems[2]));
end;
@ -168,7 +168,7 @@ var
begin
if not InputQuery('DUB library import', 'please enter the name of the package',
nme) then exit;
if List.Items.FindCaption(0, nme, false, false, false) <> nil then
if List.Items.FindCaption(0, nme, false, false, false).isNotNil then
begin
dlgOkInfo(format('a library item with the alias "%s" already exists, delete it before trying again.',
[nme]));
@ -296,7 +296,7 @@ procedure TCELibManEditorWidget.btnEditAliasClick(Sender: TObject);
var
al: string;
begin
if List.Selected = nil then
if List.Selected.isNil then
exit;
al := List.Selected.Caption;
if inputQuery('library alias', '', al) then
@ -308,7 +308,7 @@ procedure TCELibManEditorWidget.btnOpenProjClick(Sender: TObject);
var
fname: string;
begin
if List.Selected = nil then exit;
if List.Selected.isNil then exit;
fname := List.Selected.SubItems[2];
if not FileExists(fname) then exit;
//
@ -397,7 +397,7 @@ end;
procedure TCELibManEditorWidget.btnRemLibClick(Sender: TObject);
begin
if List.Selected = nil then
if List.Selected.isNil then
exit;
List.Items.Delete(List.Selected.Index);
gridToData;
@ -407,7 +407,7 @@ procedure TCELibManEditorWidget.btnSelProjClick(Sender: TObject);
var
ini: string = '';
begin
if List.Selected = nil then
if List.Selected.isNil then
exit;
if List.Selected.SubItems.Count > 2 then
ini := List.Selected.SubItems[2]
@ -427,7 +427,7 @@ procedure TCELibManEditorWidget.btnSelFileClick(Sender: TObject);
var
ini: string = '';
begin
if List.Selected = nil then
if List.Selected.isNil then
exit;
if List.Selected.SubItems.Count > 0 then
ini := List.Selected.SubItems[0]
@ -457,7 +457,7 @@ procedure TCELibManEditorWidget.btnSelfoldOfFilesClick(Sender: TObject);
var
dir, outdir: string;
begin
if List.Selected = nil then
if List.Selected.isNil then
exit;
if List.Selected.SubItems.Count > 0 then
dir := List.Selected.SubItems[0]
@ -475,7 +475,7 @@ procedure TCELibManEditorWidget.btnSelRootClick(Sender: TObject);
var
dir, outdir: string;
begin
if List.Selected = nil then
if List.Selected.isNil then
exit;
if List.Selected.SubItems.Count > 1 then
dir := List.Selected.SubItems[1]
@ -492,7 +492,7 @@ end;
procedure TCELibManEditorWidget.btnMoveUpClick(Sender: TObject);
begin
if list.Selected = nil then
if list.Selected.isNil then
exit;
if list.Selected.Index = 0 then
exit;
@ -503,7 +503,7 @@ end;
procedure TCELibManEditorWidget.btnMoveDownClick(Sender: TObject);
begin
if list.Selected = nil then
if list.Selected.isNil then
exit;
if list.Selected.Index = list.Items.Count - 1 then
exit;
@ -524,7 +524,7 @@ var
row: TListItem;
i: Integer;
begin
if LibMan = nil then
if LibMan.isNil then
exit;
List.BeginUpdate;
List.Clear;
@ -545,7 +545,7 @@ var
itm: TLibraryItem;
row: TListItem;
begin
if LibMan = nil then
if LibMan.isNil then
exit;
LibMan.libraries.BeginUpdate;
LibMan.libraries.Clear;

View File

@ -715,7 +715,8 @@ begin
EntitiesConnector.forceUpdate;
//
getCMdParams;
if fNativeProject = nil then newNativeProj;
if fNativeProject.isNil then
newNativeProj;
//
fInitialized := true;
end;
@ -1065,7 +1066,7 @@ procedure TCEMainForm.FreeRunnableProc;
var
fname: string;
begin
if fRunProc = nil then
if fRunProc.isNil then
exit;
//
fname := fRunProc.Executable;
@ -1139,7 +1140,7 @@ end;
procedure TCEMainForm.ApplicationProperties1Exception(Sender: TObject;E: Exception);
begin
if fMesgWidg = nil then
if fMesgWidg.isNil then
dlgOkError(E.Message)
else
fMsgs.message(E.Message, nil, amcApp, amkErr);
@ -1163,7 +1164,7 @@ end;
procedure TCEMainForm.updateDocumentBasedAction(sender: TObject);
begin
TAction(sender).Enabled := fDoc <> nil;
TAction(sender).Enabled := fDoc.isNotNil;
end;
procedure TCEMainForm.updateProjectBasedAction(sender: TObject);
@ -1173,7 +1174,7 @@ end;
procedure TCEMainForm.updateDocEditBasedAction(sender: TObject);
begin
if (fDoc <> nil) and fDoc.Focused then
if fDoc.isNotNil and fDoc.Focused then
TAction(sender).Enabled := true
else
TAction(sender).Enabled := false;
@ -1187,7 +1188,7 @@ begin
try
clearActProviderEntries;
collectedActProviderEntries;
if (AAction <> nil ) then
if AAction.isNotNil then
if not AAction.Update then
TAction(AAction).enabled := true;
updateMainMenuProviders;
@ -1235,9 +1236,9 @@ var
i: NativeInt;
begin
srcLst := TCEMruFileList(Sender);
if srcLst = nil then exit;
if srcLst.isNil then exit;
trgMnu := TMenuItem(srcLst.objectTag);
if trgMnu = nil then exit;
if trgMnu.isNil then exit;
if fUpdateCount > 0 then exit;
Inc(fUpdateCount);
@ -1276,7 +1277,7 @@ var
srcLst: TCEMruFileList;
begin
srcLst := TCEMruFileList(TmenuItem(Sender).Tag);
if srcLst = nil then exit;
if srcLst.isNil then exit;
//
srcLst.Clear;
end;
@ -1441,7 +1442,7 @@ procedure TCEMainForm.actFileHtmlExportExecute(Sender: TObject);
var
exp: TSynExporterHTML;
begin
if fDoc = nil then
if fDoc.isNil then
exit;
exp := TSynExporterHTML.Create(nil);
try
@ -1487,8 +1488,6 @@ end;
procedure TCEMainForm.actFileOpenExecute(Sender: TObject);
begin
if fEditWidg = nil then exit;
//
with TOpenDialog.Create(nil) do
try
filter := DdiagFilter;
@ -1533,7 +1532,7 @@ end;
procedure TCEMainForm.actFileSaveAsExecute(Sender: TObject);
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
with TSaveDialog.Create(nil) do
try
@ -1549,7 +1548,7 @@ procedure TCEMainForm.actFileSaveExecute(Sender: TObject);
var
str: string;
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
str := fDoc.fileName;
if (str <> fDoc.tempFilename) and (fileExists(str)) then
@ -1560,7 +1559,7 @@ end;
procedure TCEMainForm.actFileAddToProjExecute(Sender: TObject);
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
if fDoc.isProjectFile then exit;
if fProjectInterface = nil then exit;
//
@ -1576,9 +1575,8 @@ end;
procedure TCEMainForm.actFileCloseExecute(Sender: TObject);
begin
if fDoc = nil then
exit;
getMultiDocHandler.closeDocument(fDoc);
if fDoc.isNotNil then
getMultiDocHandler.closeDocument(fDoc);
end;
procedure TCEMainForm.actFileSaveAllExecute(Sender: TObject);
@ -1610,7 +1608,7 @@ procedure TCEMainForm.actFileSaveCopyAsExecute(Sender: TObject);
var
str: TStringList;
begin
if fDoc = nil then
if fDoc.isNil then
exit;
with TSaveDialog.create(nil) do
try
@ -1635,43 +1633,43 @@ end;
{$REGION edit ------------------------------------------------------------------}
procedure TCEMainForm.actEdCopyExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fDoc.CopyToClipboard;
end;
procedure TCEMainForm.actEdCutExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fDoc.CutToClipboard;
end;
procedure TCEMainForm.actEdPasteExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fDoc.PasteFromClipboard;
end;
procedure TCEMainForm.actEdUndoExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fDoc.Undo;
end;
procedure TCEMainForm.actEdRedoExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fDoc.Redo;
end;
procedure TCEMainForm.actEdMacPlayExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fEditWidg.macRecorder.PlaybackMacro(fDoc);
end;
procedure TCEMainForm.actEdMacStartStopExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
begin
if fEditWidg.macRecorder.State = msRecording then
fEditWidg.macRecorder.Stop
@ -1681,13 +1679,13 @@ end;
procedure TCEMainForm.actEdIndentExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fDoc.ExecuteCommand(ecBlockIndent, '', nil);
end;
procedure TCEMainForm.actEdUnIndentExecute(Sender: TObject);
begin
if assigned(fDoc) then
if fDoc.isNotNil then
fDoc.ExecuteCommand(ecBlockUnIndent, '', nil);
end;
@ -1697,10 +1695,10 @@ var
str: string;
begin
win := DockMaster.GetAnchorSite(fFindWidg);
if win = nil then exit;
if win.isNil then exit;
win.Show;
win.BringToFront;
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
if fDoc.SelAvail then
str := fDoc.SelText
@ -1811,7 +1809,7 @@ begin
fMsgs.clearByData(fDoc);
FreeRunnableProc;
if fDoc = nil then exit;
if fDoc.isNil then exit;
if fDoc.Lines.Count = 0 then exit;
firstlineFlags := fDoc.Lines[0];
@ -1906,34 +1904,33 @@ end;
procedure TCEMainForm.actFileUnittestExecute(Sender: TObject);
begin
if fDoc = nil then exit;
compileAndRunFile(true);
if fDoc.isNotNil then
compileAndRunFile(true);
end;
procedure TCEMainForm.actFileCompAndRunExecute(Sender: TObject);
begin
if fDoc = nil then exit;
compileAndRunFile(false);
if fDoc.isNotNil then
compileAndRunFile(false);
end;
procedure TCEMainForm.actFileCompileAndRunOutExecute(Sender: TObject);
begin
if fDoc = nil then exit;
compileAndRunFile(false, false);
if fDoc.isNotNil then
compileAndRunFile(false, false);
end;
procedure TCEMainForm.actFileCompAndRunWithArgsExecute(Sender: TObject);
var
runargs: string = '';
begin
if fDoc = nil then exit;
if InputQuery('Execution arguments', '', runargs) then
if fDoc.isNotNil and InputQuery('Execution arguments', '', runargs) then
compileAndRunFile(false, true, runargs);
end;
procedure TCEMainForm.actFileOpenContFoldExecute(Sender: TObject);
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
if not fileExists(fDoc.fileName) then exit;
//
DockMaster.GetAnchorSite(fExplWidg).Show;
@ -1991,7 +1988,7 @@ var
widg: TCEWidget;
act: TAction;
begin
if sender = nil then exit;
if sender.isNil then exit;
act := TAction(sender);
if act.Tag = 0 then exit;
//
@ -2012,7 +2009,7 @@ var
widg: TCEWidget;
begin
widg := TCEWidget( TComponent(sender).tag );
if widg = nil then exit;
if widg.isNil then exit;
//
widg.showWidget;
end;
@ -2128,8 +2125,8 @@ var
const
fstyle: array[boolean] of TFormStyle = (fsNormal, fsStayOnTop);
begin
for widg in fWidgList do if (widg.Parent <> nil) and
(widg.Parent.Parent = nil) and widg.isDockable then
for widg in fWidgList do if widg.Parent.isNotNil and
widg.Parent.Parent.isNil and widg.isDockable then
begin
TForm(widg.Parent).FormStyle := fstyle[onTop];
//TODO-bugfix: floating widg on top from true to false, widg remains on top
@ -2277,7 +2274,7 @@ begin
pfNative: win := DockMaster.GetAnchorSite(fPrjCfWidg);
end
else win := DockMaster.GetAnchorSite(fPrjCfWidg);
if assigned(win) then
if win.isNotNil then
begin
win.Show;
win.BringToFront;

View File

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

View File

@ -339,9 +339,9 @@ procedure TCEMessagesWidget.listDeletion(Sender: TObject; Node: TTreeNode);
var
i: integer;
begin
if node.Data <> nil then
if node.data.isNotNil then
Dispose(PMessageData(Node.Data));
if fToDemangleObjs <> nil then
if fToDemangleObjs.isNotNil then
begin
i := fToDemangleObjs.IndexOf(node);
if i <> -1 then if i < fToDemangleObjs.Count then
@ -389,7 +389,7 @@ var
btn: TToolButton;
i: Integer;
begin
if sender = nil then
if sender.isNil then
exit;
//
fCtxt := amcAll;
@ -573,7 +573,7 @@ begin
case fCtxt of
amcAll, amcApp, amcMisc :
clearbyContext(fCtxt);
amcEdit: if fDoc <> nil then
amcEdit: if fDoc.isNotNil then
clearbyData(fDoc);
amcProj: if fProj <> nil then
clearbyData(fProj);
@ -746,7 +746,7 @@ var
i: Integer;
msgdt: PMessageData;
begin
if aData = nil then
if aData.isNil then
exit;
list.BeginUpdate;
for i := List.Items.Count-1 downto 0 do
@ -811,7 +811,7 @@ begin
for i := 0 to fToDemangleObjs.Count -1 do
begin
itm := TTreeNode(fToDemangleObjs.Items[i]);
if itm = nil then continue;
if itm.isNil then continue;
itm.Text := fToDemangle.Strings[i];
end;
freeDemangler;
@ -819,7 +819,7 @@ end;
procedure TCEMessagesWidget.freeDemangler;
begin
if fDemangler = nil then
if fDemangler.isNil then
exit;
//
if fDemangler.Active then
@ -862,7 +862,7 @@ procedure TCEMessagesWidget.scrollToBack;
begin
if not Visible then
exit;
if List.BottomItem <> nil then
if List.BottomItem.isNotNil then
List.BottomItem.MakeVisible;
end;
@ -873,14 +873,14 @@ var
begin
//TODO-cbugfix: AV the the 3rd time a same message is clicked (when option singleClick is set),
// click to open matching file, back to editor, click (nothing, item is null), then click again: AV
if List.Selected = nil then
if List.Selected.isNil then
exit;
msg := List.Selected.Text;
if not openFileFromDmdMessage(msg) then
exit;
// from here, since a doc has the focus, List.Selected is nil
pos := getLineFromMessage(msg);
if fDoc = nil then
if fDoc.isNil then
exit;
fDoc.CaretXY := pos;
fDoc.SelectLine;

View File

@ -62,7 +62,7 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
Top = 32
Width = 335
Align = alTop
DefaultItemHeight = 16
DefaultItemHeight = 18
Images = imgList
ReadOnly = True
ScrollBars = ssAutoBoth

View File

@ -206,7 +206,7 @@ end;
procedure TCEMiniExplorerWidget.lstDeletion(Sender: TObject; Item: TListItem);
begin
if Item.Data <> nil then
if Item.Data.isNotNil then
DisposeStr(PString(Item.Data));
end;
{$ENDREGION}
@ -281,7 +281,7 @@ procedure TCEMiniExplorerWidget.btnRemFavClick(Sender: TObject);
var
i: Integer;
begin
if lstFav.Selected = nil then exit;
if lstFav.Selected.isNil then exit;
i := fFavorites.IndexOf(PString(lstFav.Selected.Data)^);
if i <> -1 then fFavorites.Delete(i);
lstFiles.Clear;
@ -294,13 +294,13 @@ end;
procedure TCEMiniExplorerWidget.btnAddFavClick(Sender: TObject);
begin
if Tree.Selected = nil then exit;
if Tree.Selected.isNil then exit;
fFavorites.Add(PString(Tree.Selected.Data)^);
end;
procedure TCEMiniExplorerWidget.lstFavDblClick(Sender: TObject);
begin
if lstFav.Selected = nil then exit;
if lstFav.Selected.isNil then exit;
lstFiles.Items.Clear;
expandPath(lstFav.Selected.Caption);
tree.MakeSelectionVisible;
@ -343,8 +343,8 @@ var
fname: string;
proj: boolean = false;
begin
if lstFiles.Selected = nil then exit;
if lstFiles.Selected.Data = nil then exit;
if lstFiles.Selected.isNil then exit;
if lstFiles.Selected.Data.isNil then exit;
fname := PString(lstFiles.Selected.Data)^;
if not fileExists(fname) then exit;
{$IFNDEF WINDOWS}
@ -394,19 +394,19 @@ var
begin
if fLastListOrTree = lstFiles then
begin
if lstFiles.Selected = nil then exit;
if lstFiles.Selected.Data = nil then exit;
if lstFiles.Selected.isNil then exit;
if lstFiles.Selected.data.isNil then exit;
fname := PString(lstFiles.Selected.Data)^;
end else if fLastListOrTree = Tree then
begin
if tree.Selected = nil then exit;
if tree.Selected.Data = nil then exit;
if tree.Selected.isNil then exit;
if tree.Selected.Data.isNil then exit;
fname := PString(tree.Selected.Data)^;
end
else if fLastListOrTree = lstFav then
begin
if lstFav.Selected = nil then exit;
if lstFav.Selected.Data = nil then exit;
if lstFav.Selected.isNil then exit;
if lstFav.Selected.Data.isNil then exit;
fname := PString(lstFav.Selected.Data)^;
end;
if fileExists(fname) then if not shellOpen(fname) then
@ -428,7 +428,7 @@ end;
procedure TCEMiniExplorerWidget.treeDeletion(Sender: TObject; Item: TTreeNode);
begin
if Item.Data <> nil then
if Item.Data.isNotNil then
DisposeStr(PString(Item.Data));
end;
@ -458,7 +458,7 @@ var
lst: TStringList;
pth: string;
begin
if Tree.Selected = nil then exit;
if Tree.Selected.isNil then exit;
//
lst := TStringList.Create;
try
@ -499,14 +499,14 @@ end;
procedure TCEMiniExplorerWidget.treeExpanding(Sender: TObject; Node: TTreeNode; var allow: boolean);
begin
if Node <> nil then
if Node.isNotNil then
treeScanSubFolders(Node);
allow := true;
end;
procedure TCEMiniExplorerWidget.treeChanged(Sender: TObject; Node: TTreeNode);
begin
if Node = nil then exit;
if Node.isNil then exit;
Node.DeleteChildren;
treeScanSubFolders(Node);
lstFilesFromTree;
@ -519,7 +519,7 @@ end;
procedure TCEMiniExplorerWidget.treeClick(sender: TObject);
begin
if Tree.Selected = nil then exit;
if Tree.Selected.isNil then exit;
if Tree.Selected.Expanded then exit;
treeScanSubFolders(Tree.Selected);
end;
@ -540,7 +540,7 @@ begin
{$ENDIF}
for i := 0 to aRoot.Count-1 do
begin
if aRoot.Items[i].Data = nil then
if aRoot.Items[i].Data.isNil then
continue;
str := PString(aRoot.Items[i].Data)^;
if SameText(LeftStr(aPath, length(str)), str) then

View File

@ -691,7 +691,7 @@ begin
result := false;
config := currentConfiguration;
msgs := getMessageDisplay;
if config = nil then
if config.isNil then
begin
msgs.message('unexpected project error: no active configuration',
self as ICECommonProject, amcProj, amkErr);

View File

@ -97,7 +97,7 @@ var
ed: ICEEditableOptions;
sel: string = '';
begin
if selCat.Selected <> nil then
if selCat.Selected.isNotNil then
sel := selCat.Selected.Text;
fUpdatingCat := true;
inspector.TIObject := nil;
@ -127,7 +127,7 @@ end;
procedure TCEOptionEditorWidget.selCatDeletion(Sender: TObject; Node: TTreeNode);
begin
if node.Data <> nil then
if node.Data.isNotNil then
Dispose(PCategoryData(node.Data));
end;
@ -138,8 +138,8 @@ begin
result := true;
if fUpdatingCat then exit;
if csDestroying in ComponentState then exit;
if selCat.Selected = nil then exit;
if selCat.Selected.Data = nil then exit;
if selCat.Selected.isNil then exit;
if selCat.Selected.Data.isNil then exit;
// accept/cancel is relative to a single category
dt := PCategoryData(selCat.Selected.Data);
// generic editor, changes are tracked directly here
@ -155,7 +155,7 @@ begin
end else
begin
dt := PCategoryData(selCat.Selected.Data);
if dt^.container = nil then exit;
if dt^.container.isNil then exit;
if dt^.observer = nil then exit;
if dt^.observer.optionedOptionsModified() then
begin
@ -180,11 +180,11 @@ begin
if pnlEd.ControlCount > 0 then
pnlEd.Controls[0].Parent := nil;
//
if selCat.Selected = nil then exit;
if selCat.Selected.Data = nil then exit;
if selCat.Selected.isNil then exit;
if selCat.Selected.Data.isNil then exit;
//
dt := PCategoryData(selCat.Selected.Data);
if dt^.container = nil then exit;
if dt^.container.isNil then exit;
case dt^.kind of
oekControl:
begin
@ -213,8 +213,8 @@ end;
procedure TCEOptionEditorWidget.inspectorModified(Sender: TObject);
begin
if selCat.Selected = nil then exit;
if selcat.Selected.Data = nil then exit;
if selCat.Selected.isNil then exit;
if selcat.Selected.Data.isNil then exit;
//
fCatChanged := true;
PCategoryData(selCat.Selected.Data)^
@ -224,11 +224,11 @@ end;
procedure TCEOptionEditorWidget.btnCancelClick(Sender: TObject);
begin
if selCat.Selected = nil then exit;
if selcat.Selected.Data = nil then exit;
if selCat.Selected.isNil then exit;
if selcat.Selected.Data.isNil then exit;
//
fCatChanged := false;
if inspector.Parent <> nil then
if inspector.Parent.isNotNil then
inspector.ItemIndex := -1;
PCategoryData(selCat.Selected.Data)^
.observer
@ -263,11 +263,11 @@ end;
procedure TCEOptionEditorWidget.btnAcceptClick(Sender: TObject);
begin
if selCat.Selected = nil then exit;
if selcat.Selected.Data = nil then exit;
if selCat.Selected.isNil then exit;
if selcat.Selected.Data.isNil then exit;
//
fCatChanged := false;
if inspector.Parent <> nil then
if inspector.Parent.isNotNil then
inspector.ItemIndex := -1;
PCategoryData(selCat.Selected.Data)^
.observer

View File

@ -81,18 +81,18 @@ begin
// TODO-cfeature: process list, imply that each TCESynMemo must have its own runnable TProcess
// currently they share the CEMainForm.fRunProc variable.
if fProc <> nil then
if fProc.isNotNil then
if fProc.Running then
fProc.Terminate(0);
txtExeName.Caption := 'no process';
fProc := nil;
if aProcess = nil then
if aProcess.isNil then
exit;
if not (poUsePipes in aProcess.Options) then
exit;
fProc := aProcess;
if fProc <> nil then Panel1.Enabled:=true;
if fProc.isNotNil then Panel1.Enabled:=true;
txtExeName.Caption := shortenPath(fProc.Executable);
end;
@ -125,9 +125,8 @@ end;
procedure TCEProcInputWidget.btnSendClick(Sender: TObject);
begin
if fProc = nil then
exit;
sendInput;
if fProc.isNotNil then
sendInput;
end;
procedure TCEProcInputWidget.txtInpKeyDown(Sender: TObject; var Key: Word;
@ -135,7 +134,7 @@ procedure TCEProcInputWidget.txtInpKeyDown(Sender: TObject; var Key: Word;
begin
case Key of
VK_RETURN:
if fProc <> nil then sendInput;
if fProc.isNotNil then sendInput;
VK_UP: begin
fMruPos += 1;
if fMruPos > fMru.Count-1 then fMruPos := 0;

View File

@ -31,14 +31,14 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
TabOrder = 0
object selConf: TComboBox
Left = 0
Height = 23
Height = 25
Hint = 'select a configuration'
Top = 1
Width = 324
Align = alClient
BorderSpacing.Top = 1
BorderSpacing.Right = 1
ItemHeight = 15
ItemHeight = 0
OnChange = selConfChange
Style = csDropDownList
TabOrder = 0

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, RTTIGrids, RTTICtrls, Forms, Controls, Graphics,
Dialogs, ExtCtrls, ComCtrls, StdCtrls, Menus, Buttons, rttiutils, typinfo,
PropEdits, ObjectInspector, ce_dmdwrap, ce_nativeproject, ce_widget,
ce_interfaces, ce_observer, ce_sharedres;
ce_interfaces, ce_observer, ce_sharedres, ce_common;
type
@ -112,7 +112,7 @@ end;
procedure TCEProjectConfigurationWidget.projClosing(aProject: ICECommonProject);
begin
if fProj = nil then exit;
if fProj.isNil then exit;
if fProj <> aProject.getProject then
exit;
inspector.TIObject := nil;
@ -125,7 +125,7 @@ end;
procedure TCEProjectConfigurationWidget.projChanged(aProject: ICECommonProject);
begin
if fProj = nil then exit;
if fProj.isNil then exit;
if fProj <> aProject.getProject then
exit;
if Visible then updateImperative;
@ -151,7 +151,7 @@ end;
{$REGION config. things --------------------------------------------------------}
procedure TCEProjectConfigurationWidget.selConfChange(Sender: TObject);
begin
if fProj = nil then exit;
if fProj.isNil then exit;
if Updating then exit;
if selConf.ItemIndex = -1 then exit;
//
@ -164,7 +164,7 @@ procedure TCEProjectConfigurationWidget.TreeChange(Sender: TObject;
Node: TTreeNode);
begin
inspector.TIObject := getGridTarget;
selconf.Enabled := (inspector.TIObject <> fProj) and (fProj <> nil);
selconf.Enabled := (inspector.TIObject <> fProj) and fProj.isNotNil;
end;
procedure TCEProjectConfigurationWidget.setSyncroMode(aValue: boolean);
@ -200,9 +200,9 @@ var
trg_obj: TPersistent;
i: Integer;
begin
if fProj = nil then exit;
if fProj.isNil then exit;
if not fSyncroMode then exit;
if inspector.TIObject = nil then exit;
if inspector.TIObject.isNil then exit;
if inspector.ItemIndex = -1 then exit;
//
storage := nil;
@ -270,7 +270,7 @@ var
nme: string;
cfg: TCompilerConfiguration;
begin
if fProj = nil then exit;
if fProj.isNil then exit;
//
nme := '';
beginImperativeUpdate;
@ -283,7 +283,7 @@ end;
procedure TCEProjectConfigurationWidget.btnDelConfClick(Sender: TObject);
begin
if fProj = nil then exit;
if fProj.isNil then exit;
if fProj.OptionsCollection.Count = 1 then exit;
//
beginImperativeUpdate;
@ -300,7 +300,7 @@ var
nme: string;
trg,src: TCompilerConfiguration;
begin
if fProj = nil then exit;
if fProj.isNil then exit;
//
nme := '';
beginImperativeUpdate;
@ -318,14 +318,14 @@ procedure TCEProjectConfigurationWidget.btnSyncEditClick(Sender: TObject);
begin
fSynchroValue.Clear;
fSynchroItem.Clear;
if fProj = nil then exit;
if fProj.isNil then exit;
syncroMode := not syncroMode;
end;
procedure TCEProjectConfigurationWidget.GridFilter(Sender: TObject; aEditor: TPropertyEditor;
var aShow: boolean);
begin
if fProj = nil then exit;
if fProj.isNil then exit;
// filter TComponent things.
if getGridTarget = fProj then
@ -361,9 +361,9 @@ end;
function TCEProjectConfigurationWidget.getGridTarget: TPersistent;
begin
if fProj = nil then exit(nil);
if fProj.isNil then exit(nil);
if fProj.ConfigurationIndex = -1 then exit(nil);
if Tree.Selected = nil then exit(nil);
if Tree.Selected.isNil then exit(nil);
// Warning: TTreeNode.StateIndex is usually made for the images...it's not a tag
case Tree.Selected.StateIndex of
1: exit( fProj );
@ -387,8 +387,8 @@ var
begin
selConf.ItemIndex:= -1;
selConf.Clear;
selconf.Enabled := (inspector.TIObject <> fProj) and (fProj <> nil);
if fProj = nil then exit;
selconf.Enabled := (inspector.TIObject <> fProj) and fProj.isNotNil;
if fProj.isNil then exit;
//
for i:= 0 to fProj.OptionsCollection.Count-1 do
selConf.Items.Add(fProj.configuration[i].name);

View File

@ -150,7 +150,7 @@ end;
procedure TCEProjectInspectWidget.projClosing(aProject: ICECommonProject);
begin
if fProject = nil then exit;
if fProject.isNil then exit;
if fProject <> aProject.getProject then
exit;
fProject := nil;
@ -174,7 +174,7 @@ end;
procedure TCEProjectInspectWidget.projChanged(aProject: ICECommonProject);
begin
if fProject = nil then exit;
if fProject.isNil then exit;
if fProject <> aProject.getProject then
exit;
if Visible then beginDelayedUpdate;
@ -195,9 +195,7 @@ end;
procedure TCEProjectInspectWidget.TreeSelectionChanged(Sender: TObject);
begin
actUpdate(sender);
if fProject = nil then
exit;
if Tree.Selected = nil then
if fProject.isNil or Tree.Selected.isNil then
exit;
if (Tree.Selected.Parent = fFileNode) then
fLastFileOrFolder := expandFilenameEx(fProject.basePath,tree.Selected.Text)
@ -210,8 +208,8 @@ var
fname: string;
i: NativeInt;
begin
if fProject = nil then exit;
if Tree.Selected = nil then exit;
if fProject.isNil or Tree.Selected.isNil then
exit;
//
if (Tree.Selected.Parent = fFileNode) or (Tree.Selected.Parent = fXtraNode) then
begin
@ -234,14 +232,14 @@ procedure TCEProjectInspectWidget.actUpdate(sender: TObject);
begin
fActSelConf.Enabled := false;
fActOpenFile.Enabled := false;
if Tree.Selected = nil then exit;
if Tree.Selected.isNil then exit;
fActSelConf.Enabled := Tree.Selected.Parent = fConfNode;
fActOpenFile.Enabled := Tree.Selected.Parent = fFileNode;
end;
procedure TCEProjectInspectWidget.btnAddFileClick(Sender: TObject);
begin
if fProject = nil then exit;
if fProject.isNil then exit;
//
with TOpenDialog.Create(nil) do
try
@ -267,7 +265,7 @@ var
lst: TStringList;
i: NativeInt;
begin
if fProject = nil then exit;
if fProject.isNil then exit;
//
dir := '';
if FileExists(fLastFileOrFolder) then
@ -300,8 +298,8 @@ var
dir, fname: string;
i: Integer;
begin
if fProject = nil then exit;
if Tree.Selected = nil then exit;
if fProject.isNil or Tree.Selected.isNil then
exit;
if Tree.Selected.Parent <> fFileNode then exit;
//
fname := Tree.Selected.Text;
@ -323,8 +321,8 @@ var
fname: string;
i: NativeInt;
begin
if fProject = nil then exit;
if Tree.Selected = nil then exit;
if fProject.isNil or Tree.Selected.isNil then
exit;
//
if Tree.Selected.Parent = fFileNode then
begin
@ -355,7 +353,7 @@ var
fname, direntry: string;
lst: TStringList;
begin
if fProject = nil then exit;
if fProject.isNil then exit;
lst := TStringList.Create;
fProject.beginUpdate;
try for fname in Filenames do
@ -392,7 +390,7 @@ begin
fInclNode.DeleteChildren;
fXtraNode.DeleteChildren;
//
if not assigned(fProject) then
if fProject.isNil then
exit;
//
Tree.BeginUpdate;

View File

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

View File

@ -282,7 +282,7 @@ var
i: integer;
res: array of TPoint = nil;
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
fSearchMru.Insert(0,fToFind);
cbToFind.Items.Assign(fSearchMru);
@ -320,7 +320,7 @@ end;
procedure TCESearchWidget.actFindNextExecute(sender: TObject);
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
fSearchMru.Insert(0,fToFind);
cbToFind.Items.Assign(fSearchMru);
@ -356,7 +356,7 @@ end;
procedure TCESearchWidget.actReplaceNextExecute(sender: TObject);
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
fSearchMru.Insert(0, fToFind);
fReplaceMru.Insert(0, fReplaceWth);
@ -389,7 +389,7 @@ procedure TCESearchWidget.actReplaceAllExecute(sender: TObject);
var
opts: TSynSearchOptions;
begin
if fDoc = nil then exit;
if fDoc.isNil then exit;
cbReplaceWth.Items.Assign(fReplaceMru);
opts := getOptions + [ssoReplace];
opts -= [ssoBackwards];
@ -463,12 +463,12 @@ end;
procedure TCESearchWidget.updateImperative;
begin
btnFind.Enabled := (fDoc <> nil) and (fToFind <> '');
btnFindAll.Enabled := (fDoc <> nil) and (fToFind <> '');
btnReplace.Enabled := (fDoc <> nil) and (chkEnableRep.Checked) and (fToFind <> '');
btnFind.Enabled := fDoc.isNotNil and (fToFind <> '');
btnFindAll.Enabled := fDoc.isNotNil and (fToFind <> '');
btnReplace.Enabled := fDoc.isNotNil and (chkEnableRep.Checked) and (fToFind <> '');
btnReplaceAll.Enabled := btnReplace.Enabled;
cbReplaceWth.Enabled := (fDoc <> nil) and (chkEnableRep.Checked);
cbToFind.Enabled := fDoc <> nil;
cbReplaceWth.Enabled := fDoc.isNotNil and (chkEnableRep.Checked);
cbToFind.Enabled := fDoc.isNotNil;
end;
{$ENDREGION}

View File

@ -6,8 +6,6 @@ object CEShortcutEditor: TCEShortcutEditor
ClientHeight = 463
ClientWidth = 424
TabOrder = 0
DesignLeft = 759
DesignTop = 225
object Panel1: TPanel
Left = 0
Height = 463

View File

@ -258,18 +258,18 @@ end;
procedure TCEShortcutEditor.btnActivateClick(Sender: TObject);
begin
if tree.Selected = nil then exit;
if tree.Selected.isNil then exit;
if tree.Selected.Level = 0 then exit;
if tree.Selected.Data = nil then exit;
if tree.Selected.Data.isNil then exit;
//
shortcutCatcher.Enabled := not shortcutCatcher.Enabled;
end;
procedure TCEShortcutEditor.btnClearClick(Sender: TObject);
begin
if tree.Selected = nil then exit;
if tree.Selected.isNil then exit;
if tree.Selected.Level = 0 then exit;
if tree.Selected.Data = nil then exit;
if tree.Selected.Data.isNil then exit;
//
if TShortcutItem(tree.Selected.Data).data <> 0 then
begin
@ -289,9 +289,9 @@ var
const
msg = '"%s" is already assigned in the same category by "%s". The new shortcut will be ignored';
begin
if tree.Selected = nil then exit;
if tree.Selected.isNil then exit;
if tree.Selected.Level = 0 then exit;
if tree.Selected.Data = nil then exit;
if tree.Selected.Data.isNil then exit;
//
if Key = VK_RETURN then
shortcutCatcher.Enabled := false
@ -305,7 +305,7 @@ begin
if i <> tree.Selected.Index then
if TShortcutItem(tree.Selected.Parent.Items[i].Data).data = sh then
dup := TShortcutItem(tree.Selected.Parent.Items[i].Data);
if assigned(dup) then
if dup.isNotNil then
dlgOkInfo(format(msg,[ShortCutToText(sh), dup.identifier]))
else if TShortcutItem(tree.Selected.Data).data <> sh then
begin
@ -321,9 +321,9 @@ procedure TCEShortcutEditor.updateEditCtrls;
begin
schrtText.Caption := '';
//
if tree.Selected = nil then exit;
if tree.Selected.isNil then exit;
if tree.Selected.Level = 0 then exit;
if tree.Selected.Data = nil then exit;
if tree.Selected.Data.isNil then exit;
//
schrtText.Caption := TShortcutItem(tree.Selected.Data).combination;
shortcutCatcher.Text := '';
@ -372,7 +372,7 @@ begin
if cat = '' then exit;
if idt = '' then exit;
prt := findCategory(cat, obs);
if prt = nil then
if prt.isNil then
prt := tree.Items.AddObject(nil, cat, obs);
// item as child
itm := TShortcutItem(fShortcuts.items.Add);

View File

@ -387,13 +387,13 @@ end;
procedure TCEStaticEditorMacro.Execute;
begin
if fDoc <> nil then
if fDoc.isNotNil then
fCompletor.Execute(fDoc.Identifier, fDoc);
end;
procedure TCEStaticEditorMacro.Execute(aEditor: TCustomSynEdit; const aToken: string);
begin
if aEditor <> nil then
if aEditor.isNotNil then
fCompletor.Execute(aToken, aEditor);
end;
{$ENDREGION}

View File

@ -458,8 +458,8 @@ end;
procedure TCESymbolListWidget.actCopyIdentExecute(Sender: TObject);
begin
if Tree.Selected = nil then exit;
Clipboard.AsText:= Tree.Selected.Text;
if Tree.Selected.isNotNil then
Clipboard.AsText:= Tree.Selected.Text;
end;
{$ENDREGION}
@ -551,7 +551,7 @@ end;
procedure TCESymbolListWidget.updateVisibleCat;
begin
if (fDoc <> nil) then
if fDoc.isNotNil then
begin
ndAlias.Visible := ndAlias.Count > 0;
ndClass.Visible := ndClass.Count > 0;
@ -614,7 +614,7 @@ begin
//
if TreeFilterEdit1.Filter <> '' then
tree.FullExpand
else if tree.Selected = nil then
else if tree.Selected.isNil then
tree.FullCollapse
else tree.MakeSelectionVisible;
result := false;
@ -636,9 +636,9 @@ procedure TCESymbolListWidget.TreeDblClick(Sender: TObject);
var
line: NativeUint;
begin
if fDoc = nil then exit;
if Tree.Selected = nil then exit;
if Tree.Selected.Data = nil then exit;
if fDoc.isNil then exit;
if Tree.Selected.isNil then exit;
if Tree.Selected.Data.isNil then exit;
//
{$HINTS OFF}
line := NativeUInt(Tree.Selected.Data);
@ -658,7 +658,7 @@ var
str: string;
begin
if not fHasToolExe then exit;
if fDoc = nil then exit;
if fDoc.isNil then exit;
if fDoc.Lines.Count = 0 then exit;
if not fDoc.isDSource then exit;
//
@ -682,12 +682,13 @@ function getCatNode(node: TTreeNode; stype: TSymbolType ): TTreeNode;
function newCat(const aCat: string): TTreeNode;
begin
result := node.FindNode(aCat);
if result = nil then result := node.TreeNodes.AddChild(node, aCat);
if result.isNil then
result := node.TreeNodes.AddChild(node, aCat);
end;
//
begin
result := nil;
if node = nil then case stype of
if node.isNil then case stype of
_alias : exit(ndAlias);
_class : exit(ndClass);
_enum : exit(ndEnum);
@ -738,10 +739,10 @@ var
i: Integer;
flt: string;
begin
if ndAlias = nil then exit;
if ndAlias.isNil then exit;
clearTree;
updateVisibleCat;
if fDoc = nil then exit;
if fDoc.isNil then exit;
//
fToolProc.OnTerminate := nil;
fToolProc.OnReadData := nil;
@ -786,9 +787,9 @@ var
begin
for i := 0 to root.Count-1 do
begin
if root.Items[i].Data = nil then
if root.Items[i].Data.isNil then
continue;
if root.Items[i].Parent = nil then
if root.Items[i].Parent.isNil then
continue;
case root.Items[i].Parent.Text of
'Alias', 'Enum', 'Import', 'Variable':
@ -808,12 +809,12 @@ var
end;
begin
if not assigned(fDoc) then exit;
if fDoc.isNil then exit;
//
target := fDoc.CaretY;
for i := 0 to tree.Items.Count-1 do
look(tree.Items[i]);
if assigned(toExpand) then
if toExpand.isNotNil then
begin
tree.Selected := toExpand;
toExpand.MakeVisible;

View File

@ -127,7 +127,7 @@ end;
procedure TCESymbolExpander.docFocused(aDoc: TCESynMemo);
begin
if (aDoc <> nil) and (fDoc = aDoc) then
if (aDoc.isNotNil) and (fDoc = aDoc) then
exit;
fDoc := aDoc;
fNeedUpdate := true;
@ -158,9 +158,9 @@ begin
if not fNeedUpdate then exit;
fNeedUpdate := false;
//
hasNativeProj := fProj <> nil;
hasNativeProj := fProj.isNotNil;
hasProjItf := fProjInterface <> nil;
hasDoc := fDoc <> nil;
hasDoc := fDoc.isNotNil;
//
for e := low(TCESymbol) to high(TCESymbol) do
fSymbols[e] := na;
@ -259,7 +259,7 @@ begin
elem := '';
for i := 0 to elems.Count - 1 do
begin
if elems.Objects[i] = nil then
if elems.Objects[i].isNil then
Result += elems.Strings[i]
else
case elems.Strings[i] of

View File

@ -271,7 +271,7 @@ procedure TCESynMemoCache.writeBreakpoints(str: TStream);
var
i: integer;
begin
if fMemo = nil then exit;
if fMemo.isNil then exit;
{$HINTS OFF}
for i:= 0 to fMemo.fBreakPoints.Count-1 do
str.Write(PtrUint(fMemo.fBreakPoints.Items[i]), sizeOf(PtrUint));
@ -283,7 +283,7 @@ var
i, cnt: integer;
line: ptrUint = 0;
begin
if fMemo = nil then exit;
if fMemo.isNil then exit;
cnt := str.Size div sizeOf(PtrUint);
for i := 0 to cnt-1 do
begin
@ -297,7 +297,7 @@ var
i, start, prev: Integer;
itm : TCEFoldCache;
begin
if fMemo = nil then exit;
if fMemo.isNil then exit;
//
fCaretPosition := fMemo.SelStart;
fSourceFilename := fMemo.fileName;
@ -329,7 +329,7 @@ var
i: integer;
itm : TCEFoldCache;
begin
if fMemo = nil then exit;
if fMemo.isNil then exit;
//
if fFontSize > 0 then
fMemo.Font.Size := fFontSize;
@ -762,13 +762,13 @@ end;
{$REGION DDoc & CallTip --------------------------------------------------------}
procedure TCESynMemo.InitHintWins;
begin
if fCallTipWin = nil then
if fCallTipWin.isNil then
begin
fCallTipWin := TCEEditorHintWindow.Create(self);
fCallTipWin.Color := clInfoBk + $01010100;
fCallTipWin.Font.Color:= clInfoText;
end;
if fDDocWin = nil then
if fDDocWin.isNil then
begin
fDDocWin := TCEEditorHintWindow.Create(self);
fDDocWin.Color := clInfoBk + $01010100;
@ -1247,7 +1247,7 @@ procedure TCESynMemo.removeBreakPoint(line: integer);
begin
if not findBreakPoint(line) then
exit;
if (marks.Line[line] <> nil) and (marks.Line[line].Count > 0) then
if marks.Line[line].isNotNil and (marks.Line[line].Count > 0) then
marks.Line[line].Clear(true);
{$WARNINGS OFF}
fBreakPoints.Remove(pointer(line));

View File

@ -378,11 +378,11 @@ end;
{$REGION Todo list things ------------------------------------------------------}
function TCETodoListWidget.getContext: TTodoContext;
begin
if ((fProj = nil) and (fDoc = nil)) then
if (fProj = nil) and fDoc.isNil then
exit(tcNone);
if ((fProj = nil) and (fDoc <> nil)) then
if (fProj = nil) and fDoc.isNotNil then
exit(tcFile);
if ((fProj <> nil) and (fDoc = nil)) then
if (fProj <> nil) and fDoc.isNil then
exit(tcProject);
//
if fProj.isSource(fDoc.fileName) then
@ -393,7 +393,7 @@ end;
procedure TCETodoListWidget.killToolProcess;
begin
if fToolProc = nil then
if fToolProc.isNil then
exit;
//
fToolProc.Terminate(0);
@ -521,9 +521,7 @@ var
itm: TTodoItem;
fname, ln: string;
begin
if lstItems.Selected = nil then
exit;
if lstItems.Selected.Data = nil then
if lstItems.Selected.isNil or lstItems.Selected.Data.isNil then
exit;
// the collection will be cleared if a file is opened
// docFocused->callToolProcess->fTodos....clear
@ -533,7 +531,7 @@ begin
ln := itm.line;
getMultiDocHandler.openDocument(fname);
//
if fDoc = nil then
if fDoc.isNil then
exit;
fDoc.CaretY := StrToInt(ln);
fDoc.SelectLine;
@ -549,7 +547,7 @@ procedure TCETodoListWidget.lstItemsColumnClick(Sender: TObject; Column: TListCo
var
curr: TListItem;
begin
if lstItems.Selected = nil then
if lstItems.Selected.isNil then
exit;
lstItems.BeginUpdate;
curr := lstItems.Selected;
@ -630,8 +628,8 @@ end;
procedure TCETodoListWidget.refreshVisibleColumns;
begin
if lstItems = nil then exit;
if lstItems.Columns = nil then exit;
if lstItems.isNil then exit;
if lstItems.Columns.isNil then exit;
if lstItems.ColumnCount <> 6 then exit;
//
lstItems.Column[1].Visible := TTodoColumn.category in fColumns ;

View File

@ -178,7 +178,7 @@ procedure TCEToolItem.setToolAlias(value: string);
var
i: integer = 0;
begin
while fToolItems.findTool(value) <> nil do
while fToolItems.findTool(value).isNotNil do
begin
value += intToStr(i);
i += 1;
@ -216,7 +216,7 @@ begin
if FileExists(fProcess.Executable) then
begin
fProcess.Execute;
if (previous <> nil) and (previous.outputToNext)
if previous.isNotNil and previous.outputToNext
and (poUsePipes in previous.Options) and (poUsePipes in Options) then
begin
setLength(inp, previous.process.OutputStack.Size);
@ -249,7 +249,7 @@ begin
if (not fProcess.Running) and (fNextToolAlias <> '') then
begin
nxt := fToolItems.findTool(fNextToolAlias);
if assigned(nxt) then nxt.execute(self);
if nxt.isNotNil then nxt.execute(self);
end;
end;
{$ENDREGION --------------------------------------------------------------------}
@ -313,7 +313,7 @@ var
colitm: TCEToolItem;
mnuitm: TMenuItem;
begin
if item = nil then exit;
if item.isNil then exit;
if item.Count <> tools.Count then
menuDeclare(item)
else for i:= 0 to tools.Count-1 do
@ -404,11 +404,11 @@ procedure TCETools.executeTool(aTool: TCEToolItem);
var
txt: string;
begin
if aTool = nil then exit;
if aTool.isNil then exit;
//
aTool.execute(nil);
if aTool.editorToInput and assigned(fDoc) and (poUsePipes in aTool.options)
and (aTool.fProcess.Input <> nil) then
if aTool.editorToInput and fDoc.isNotNil and (poUsePipes in aTool.options)
and aTool.fProcess.Input.isNotNil then
begin
txt := fDoc.Text;
aTool.fProcess.Input.Write(txt[1], length(txt));