From 891690410ffdc37601430c8288236f0c94bf5160 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sat, 11 Jul 2020 23:29:08 +0200 Subject: [PATCH] rename isNil/NotNil Assigned/NotAssigned and add them for interfaces FPC 3.2.0 required from now --- CHANGELOG.md | 4 + lazproj/dexed.lpi | 1 + src/u_ceproject.pas | 13 ++- src/u_ceprojeditor.pas | 28 ++--- src/u_common.pas | 69 +++++++++--- src/u_compilers.lfm | 29 +++--- src/u_compilers.pas | 2 +- src/u_controls.pas | 12 +-- src/u_d2syn.pas | 13 ++- src/u_dcd.pas | 24 ++--- src/u_dfmt.pas | 4 +- src/u_diff.pas | 2 +- src/u_dmdwrap.pas | 18 ++-- src/u_dubproject.pas | 51 +++++---- src/u_dubprojeditor.lfm | 4 +- src/u_dubprojeditor.pas | 68 ++++++------ src/u_editor.lfm | 12 +-- src/u_editor.pas | 100 +++++++++--------- src/u_gdb.lfm | 24 ++--- src/u_gdb.pas | 92 ++++++++-------- src/u_halstead.pas | 24 ++--- src/u_infos.pas | 2 +- src/u_interfaces.pas | 4 +- src/u_lcldragdrop.pas | 14 +-- src/u_libman.pas | 34 +++--- src/u_libmaneditor.lfm | 2 +- src/u_libmaneditor.pas | 54 +++++----- src/u_main.lfm | 11 +- src/u_main.pas | 213 +++++++++++++++++++------------------- src/u_messages.pas | 26 ++--- src/u_miniexplorer.lfm | 8 +- src/u_miniexplorer.pas | 28 ++--- src/u_observer.pas | 6 +- src/u_optionseditor.lfm | 4 +- src/u_optionseditor.pas | 28 ++--- src/u_processes.pas | 8 +- src/u_procinput.pas | 16 +-- src/u_profileviewer.lfm | 28 ++--- src/u_profileviewer.pas | 2 +- src/u_projgroup.lfm | 4 +- src/u_projgroup.pas | 18 ++-- src/u_projinspect.lfm | 4 +- src/u_projinspect.pas | 64 ++++++------ src/u_projutils.pas | 4 +- src/u_search.pas | 16 +-- src/u_shortcutseditor.pas | 16 +-- src/u_symlist.pas | 26 ++--- src/u_symstring.pas | 10 +- src/u_synmemo.pas | 30 +++--- src/u_term.pas | 2 +- src/u_todolist.lfm | 4 +- src/u_todolist.pas | 18 ++-- src/u_tools.pas | 16 +-- src/u_toolseditor.pas | 2 +- src/u_widget.pas | 14 +-- 55 files changed, 683 insertions(+), 647 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd34134..8b0795be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # v3.9.7-dev +## Other + +- compilation: FPC 3.2.0 now required to compile dexed. + ## Enhancements - Project menu, git: add the first line of last commit message as additional information, between square brackets, to the items of the list of branches. (#53) diff --git a/lazproj/dexed.lpi b/lazproj/dexed.lpi index a43e899d..dc73ed7e 100644 --- a/lazproj/dexed.lpi +++ b/lazproj/dexed.lpi @@ -859,6 +859,7 @@ + diff --git a/src/u_ceproject.pas b/src/u_ceproject.pas index 1cd04cb7..d127163a 100644 --- a/src/u_ceproject.pas +++ b/src/u_ceproject.pas @@ -153,7 +153,7 @@ var constructor TNativeProject.create(aOwner: TComponent); begin inherited create(aOwner); - if not assigned (fCompilerSelector) then + if fCompilerSelector.isNotAssigned then fCompilerSelector := getCompilerSelector; fAsProjectItf := self as ICommonProject; fSymStringExpander := getSymStringExpander; @@ -698,7 +698,7 @@ begin fOutputFilename := currentConfiguration.pathsOptions.outputFilename; fe := currentConfiguration.pathsOptions.forceExtension; if currentConfiguration.isOverriddenConfiguration and fOutputFilename.isEmpty and - fBaseConfig.isNotNil then + fBaseConfig.isAssigned then begin fOutputFilename := fBaseConfig.pathsOptions.outputFilename; fe := fBaseConfig.pathsOptions.forceExtension; @@ -830,7 +830,7 @@ end; procedure TNativeProject.stopCompilation; begin - if fCompilProc.isNotNil and fCompilProc.Running then + if fCompilProc.isAssigned and fCompilProc.Running then fCompilProc.Terminate(1); end; @@ -840,7 +840,7 @@ var prjpath: string; prjname: string; begin - if fCompilProc.isNotNil and fCompilProc.Active then + if fCompilProc.isAssigned and fCompilProc.Active then begin fMsgs.message('the project is already being compiled', fAsProjectItf, amcProj, amkWarn); @@ -849,7 +849,7 @@ begin killProcess(fCompilProc); fCompiled := false; config := currentConfiguration; - if config.isNil then + if config.isNotAssigned then begin fMsgs.message('unexpected project error: no active configuration', fAsProjectItf, amcProj, amkErr); @@ -961,7 +961,7 @@ begin begin fMsgs.message(format('error: the process (%s) has returned the status %s', [proc.Executable, prettyReturnStatus(proc)]), fAsProjectItf, amcProj, amkErr); - if dproc.isNotNil and dproc.autoKilled then + if dproc.isAssigned and dproc.autoKilled then fMsgs.message(format('the process was autokilled because the size of its output exceeded %d', [dproc.autoKillProcThreshold]), nil, amcProj, amkWarn); end; @@ -1150,7 +1150,6 @@ var sel: ICompilerSelector; begin sel := getCompilerSelector; - assert(assigned(sel)); if value = gdc then value := gdmd else if value = ldc then diff --git a/src/u_ceprojeditor.pas b/src/u_ceprojeditor.pas index 974a9649..8cce7ee5 100644 --- a/src/u_ceprojeditor.pas +++ b/src/u_ceprojeditor.pas @@ -111,7 +111,7 @@ end; procedure TProjectConfigurationWidget.projClosing(project: ICommonProject); begin - if fProj.isNil or (fProj <> project.getProject) then + if fProj.isNotAssigned or (fProj <> project.getProject) then exit; inspector.TIObject := nil; inspector.ItemIndex := -1; @@ -123,7 +123,7 @@ end; procedure TProjectConfigurationWidget.projChanged(project: ICommonProject); begin - if fProj.isNil or (fProj <> project.getProject) then + if fProj.isNotAssigned or (fProj <> project.getProject) then exit; if Visible then updateImperative; @@ -153,7 +153,7 @@ end; {$REGION config. things --------------------------------------------------------} procedure TProjectConfigurationWidget.selConfChange(Sender: TObject); begin - if fProj.isNil or Updating or selConf.ItemIndex.equals(-1) then + if fProj.isNotAssigned or Updating or selConf.ItemIndex.equals(-1) then exit; beginImperativeUpdate; @@ -165,7 +165,7 @@ procedure TProjectConfigurationWidget.TreeChange(Sender: TObject; Node: TTreeNode); begin inspector.TIObject := getGridTarget; - selconf.Enabled := (inspector.TIObject <> fProj) and fProj.isNotNil; + selconf.Enabled := (inspector.TIObject <> fProj) and fProj.isAssigned; end; procedure TProjectConfigurationWidget.setSyncroMode(value: boolean); @@ -204,11 +204,11 @@ var trg_obj: TPersistent; i: Integer; begin - if fProj.isNil then + if fProj.isNotAssigned then exit; if not fSyncroMode then exit; - if inspector.TIObject.isNil then + if inspector.TIObject.isNotAssigned then exit; if inspector.ItemIndex.equals(-1) then exit; @@ -280,7 +280,7 @@ var nme: string; cfg: TCompilerConfiguration; begin - if fProj.isNil then + if fProj.isNotAssigned then exit; nme := ''; beginImperativeUpdate; @@ -294,7 +294,7 @@ end; procedure TProjectConfigurationWidget.btnDelConfClick(Sender: TObject); begin - if fProj.isNil or (fProj.OptionsCollection.Count = 1) then + if fProj.isNotAssigned or (fProj.OptionsCollection.Count = 1) then exit; beginImperativeUpdate; @@ -311,7 +311,7 @@ var nme: string; trg, src: TCompilerConfiguration; begin - if fProj.isNil then + if fProj.isNotAssigned then exit; nme := ''; beginImperativeUpdate; @@ -330,7 +330,7 @@ procedure TProjectConfigurationWidget.btnSyncEditClick(Sender: TObject); begin fSynchroValue.Clear; fSynchroItem.Clear; - if fProj.isNil then + if fProj.isNotAssigned then exit; syncroMode := not syncroMode; end; @@ -338,7 +338,7 @@ end; procedure TProjectConfigurationWidget.GridFilter(Sender: TObject; aEditor: TPropertyEditor; var aShow: boolean); begin - if fProj.isNil then + if fProj.isNotAssigned then exit; // filter TComponent things. if getGridTarget = fProj then @@ -381,7 +381,7 @@ end; function TProjectConfigurationWidget.getGridTarget: TPersistent; begin - if fProj.isNil or fProj.ConfigurationIndex.equals(-1) or Tree.Selected.isNil then + if fProj.isNotAssigned or fProj.ConfigurationIndex.equals(-1) or Tree.Selected.isNotAssigned then exit(nil); // Warning: TTreeNode.StateIndex is usually made for the images...it's not a tag case Tree.Selected.StateIndex of @@ -406,8 +406,8 @@ var begin selConf.ItemIndex:= -1; selConf.Clear; - selconf.Enabled := (inspector.TIObject <> fProj) and fProj.isNotNil; - if fProj.isNil then + selconf.Enabled := (inspector.TIObject <> fProj) and fProj.isAssigned; + if fProj.isNotAssigned then exit; for i:= 0 to fProj.OptionsCollection.Count-1 do diff --git a/src/u_common.pas b/src/u_common.pas index 6d4c71f8..2e5a3098 100644 --- a/src/u_common.pas +++ b/src/u_common.pas @@ -64,14 +64,29 @@ type // sugar for classes TObjectHelper = class helper for TObject - function isNil: boolean; - function isNotNil: boolean; + function isNotAssigned: boolean; + function isAssigned: boolean; end; + IDexedBaseInterface = interface + end; + + // sugar for interfaces + TDexedInterfaceHelper = type helper for IDexedBaseInterface + function isNotAssigned: boolean; + function isAssigned: boolean; + end; + + // maybe one day, sugar for events + {TNotifyEventHelper = type helper for TNotifyEvent + function isNotAssigned: boolean; + function isAssigned: boolean; + end;} + // sugar for pointers TPointerHelper = type helper for Pointer - function isNil: boolean; - function isNotNil: boolean; + function isNotAssigned: boolean; + function isAssigned: boolean; end; // sugar for strings @@ -434,24 +449,44 @@ begin else inherited; end; -function TObjectHelper.isNil: boolean; +function TDexedInterfaceHelper.isNotAssigned: boolean; begin - exit(self = nil); + result := not assigned(self); end; -function TObjectHelper.isNotNil: boolean; +function TDexedInterfaceHelper.isAssigned: boolean; begin - exit(self <> nil); + result := assigned(self); end; -function TPointerHelper.isNil: boolean; +{function TNotifyEventHelper.isNotAssigned: boolean; begin - exit(self = nil); + result := not assigned(self); end; -function TPointerHelper.isNotNil: boolean; +function TNotifyEventHelper.isAssigned: boolean; begin - exit(self <> nil); + result := assigned(self); +end;} + +function TObjectHelper.isNotAssigned: boolean; +begin + result := not assigned(self); +end; + +function TObjectHelper.isAssigned: boolean; +begin + result := assigned(self); +end; + +function TPointerHelper.isNotAssigned: boolean; +begin + result := not assigned(self); +end; + +function TPointerHelper.isAssigned: boolean; +begin + result := assigned(self); end; function TDexedStringHelper.isEmpty: boolean; @@ -550,7 +585,7 @@ var v: TJSONData; begin v := self.Find(key); - if v.isNotNil then + if v.isAssigned then begin result := v.JSONType = jtObject; if result then @@ -565,7 +600,7 @@ var v: TJSONData; begin v := self.Find(key); - if v.isNotNil then + if v.isAssigned then begin result := v.JSONType = jtArray; if result then @@ -578,7 +613,7 @@ end; function TJSONObjectHelper.findAny(const key: TJSONStringType; out value: TJSONData): boolean; begin value := self.Find(key); - result := value.isNotNil; + result := value.isAssigned; end; function TListItemsHelper.findCaption(const value: string; out res: TListItem): boolean; @@ -1023,7 +1058,7 @@ begin if additionalPath.isNotEmpty then env += PathSeparator + additionalPath; {$IFNDEF CEBUILD} - if Application.isNotNil then + if Application.isAssigned then env += PathSeparator + ExtractFileDir(application.ExeName.ExtractFilePath); {$ENDIF} exit(ExeSearch(fname, env)); @@ -1089,7 +1124,7 @@ end; procedure killProcess(var process: TAsyncProcess); begin - if process.isNil then + if process.isNotAssigned then exit; if process.Running then process.Terminate(0); diff --git a/src/u_compilers.lfm b/src/u_compilers.lfm index 7b7175aa..e25a5349 100644 --- a/src/u_compilers.lfm +++ b/src/u_compilers.lfm @@ -6,6 +6,7 @@ object CompilersPathsEditor: TCompilersPathsEditor Caption = 'CompilersPathsEditor' ClientHeight = 900 ClientWidth = 460 + LCLVersion = '2.0.10.0' object ScrollBox1: TScrollBox Left = 0 Height = 900 @@ -26,8 +27,8 @@ object CompilersPathsEditor: TCompilersPathsEditor Align = alTop AutoSize = True Caption = 'DMD' - ClientHeight = 168 - ClientWidth = 443 + ClientHeight = 167 + ClientWidth = 441 TabOrder = 0 object selDMDexe: TFileNameEdit Left = 2 @@ -120,8 +121,8 @@ object CompilersPathsEditor: TCompilersPathsEditor Align = alTop AutoSize = True Caption = 'GDC' - ClientHeight = 168 - ClientWidth = 443 + ClientHeight = 167 + ClientWidth = 441 TabOrder = 1 object selGDCexe: TFileNameEdit Left = 2 @@ -216,8 +217,8 @@ object CompilersPathsEditor: TCompilersPathsEditor Align = alTop AutoSize = True Caption = 'LDC' - ClientHeight = 168 - ClientWidth = 443 + ClientHeight = 167 + ClientWidth = 441 TabOrder = 2 object selLDCexe: TFileNameEdit Left = 2 @@ -312,8 +313,8 @@ object CompilersPathsEditor: TCompilersPathsEditor Align = alTop AutoSize = True Caption = 'User 1' - ClientHeight = 168 - ClientWidth = 443 + ClientHeight = 167 + ClientWidth = 441 TabOrder = 3 object selUSER1exe: TFileNameEdit Left = 2 @@ -406,8 +407,8 @@ object CompilersPathsEditor: TCompilersPathsEditor Align = alTop AutoSize = True Caption = 'User 2' - ClientHeight = 168 - ClientWidth = 443 + ClientHeight = 167 + ClientWidth = 441 TabOrder = 4 object selUSER2exe: TFileNameEdit Left = 2 @@ -500,8 +501,8 @@ object CompilersPathsEditor: TCompilersPathsEditor Align = alTop AutoSize = True Caption = 'Compiler paths used for intellisense' - ClientHeight = 40 - ClientWidth = 443 + ClientHeight = 39 + ClientWidth = 441 TabOrder = 5 object selDefault: TComboBox Left = 4 @@ -524,8 +525,8 @@ object CompilersPathsEditor: TCompilersPathsEditor Align = alTop AutoSize = True Caption = 'Compiler selected as "global"' - ClientHeight = 40 - ClientWidth = 443 + ClientHeight = 39 + ClientWidth = 441 TabOrder = 6 object selGlobal: TComboBox Left = 4 diff --git a/src/u_compilers.pas b/src/u_compilers.pas index e3b73f5f..60410847 100644 --- a/src/u_compilers.pas +++ b/src/u_compilers.pas @@ -568,7 +568,7 @@ begin DCDWrapper.relaunch; updateDCD; LibMan.updateDCD; - if assigned(fProj) then + if fProj.isAssigned then fProj.activate; end; end; diff --git a/src/u_controls.pas b/src/u_controls.pas index 4b940b9a..2c64eae6 100644 --- a/src/u_controls.pas +++ b/src/u_controls.pas @@ -709,7 +709,7 @@ var i: integer; begin result := ''; - if not assigned(item) then + if item.isNotAssigned then exit; result := item.Caption; @@ -727,7 +727,7 @@ var i: integer; begin result := ''; - if not assigned(item) then + if item.isNotAssigned then exit; result := item.Caption; @@ -740,7 +740,7 @@ var s: string = ''; c: integer; begin - if not assigned(fList) or not assigned(fList.Selected) then + if fList.isNotAssigned or fList.Selected.isNotAssigned then exit; c := getColumnIndex; @@ -754,7 +754,7 @@ end; procedure TListViewCopyMenu.copyLine(sender: TObject); begin - if not assigned(fList) or not assigned(fList.Selected) then + if fList.isNotAssigned or fList.Selected.isNotAssigned then exit; Clipboard.AsText := getLine(fList.Selected); @@ -762,7 +762,7 @@ end; procedure TListViewCopyMenu.copyLineAsList(sender: TObject); begin - if not assigned(fList) or not assigned(fList.Selected) then + if fList.isNotAssigned or fList.Selected.isNotAssigned then exit; Clipboard.AsText := getLineAsList(fList.Selected); @@ -774,7 +774,7 @@ var c: integer; i: integer; begin - if not assigned(fList) or not assigned(fList.Selected) then + if fList.isNotAssigned or fList.Selected.isNotAssigned then exit; c := getColumnIndex; diff --git a/src/u_d2syn.pas b/src/u_d2syn.pas index d7fdce51..08aca8f2 100644 --- a/src/u_d2syn.pas +++ b/src/u_d2syn.pas @@ -182,7 +182,7 @@ end; procedure TSynD2SynRange.copyFrom(source: TSynD2SynRange); begin - if assigned(source) then + if source.isAssigned then begin nestedCommentsCount := source.nestedCommentsCount; namedRegionCount := source.namedRegionCount; @@ -476,7 +476,7 @@ begin end; end; - if not assigned(fCurrRange) then + if fCurrRange.isNotAssigned then fCurrRange := TSynD2SynRange.Create(nil); // line comments / region beg-end @@ -1184,9 +1184,8 @@ var begin inherited SetRange(value); stored := TSynD2SynRange(CodeFoldRange.RangeType); - if not assigned(fCurrRange) or not Assigned(stored) then - exit; - fCurrRange.copyFrom(stored); + if fCurrRange.isAssigned and stored.isAssigned then + fCurrRange.copyFrom(stored); end; function TSynD2Syn.GetRange: Pointer; @@ -1194,10 +1193,10 @@ var stored: TSynD2SynRange; begin stored := TSynD2SynRange(inherited GetRange); - if (stored = nil) then + if stored.isNotAssigned then stored := TSynD2SynRange.Create(nil); stored.copyFrom(fCurrRange); - // + CodeFoldRange.RangeType := Pointer(stored); Result := inherited GetRange; end; diff --git a/src/u_dcd.pas b/src/u_dcd.pas index b3ce082d..5e507abc 100644 --- a/src/u_dcd.pas +++ b/src/u_dcd.pas @@ -147,7 +147,7 @@ begin r.patch := 10; fCanRemove := fVersion > r; - if fServer.isNotNil then + if fServer.isAssigned then begin fServer.Execute; while true do @@ -183,7 +183,7 @@ end; function TDcdWrapper.getIfLaunched: boolean; begin - result := fServer.isNotNil; + result := fServer.isAssigned; end; procedure TDcdWrapper.updateServerlistening; @@ -198,9 +198,9 @@ begin saveToFile(getDocPath + optsname); EntitiesConnector.removeObserver(self); fImportCache.Free; - if fTempLines.isNotNil then + if fTempLines.isAssigned then fTempLines.Free; - if fServer.isNotNil then + if fServer.isAssigned then begin if not fServerWasRunning then begin @@ -227,7 +227,7 @@ var fold: string; folds: TStringList; begin - if not assigned(fProj) then + if fProj.isNotAssigned then exit; folds := TStringList.Create; @@ -254,7 +254,7 @@ end; procedure TDcdWrapper.projChanged(project: ICommonProject); begin - if (fProj = nil) or (fProj <> project) then + if fProj.isNotAssigned or (fProj <> project) then exit; updateImportPathsFromProject(); end; @@ -485,7 +485,7 @@ end; procedure TDcdWrapper.getCallTip(out tips: string); begin - if not fAvailable or not fServerListening or fDoc.isNil then + if not fAvailable or not fServerListening or fDoc.isNotAssigned then exit; terminateClient; @@ -536,7 +536,7 @@ var item: string; kindObj: TObject = nil; begin - if not fAvailable or not fServerListening or fDoc.isNil then + if not fAvailable or not fServerListening or fDoc.isNotAssigned then exit; terminateClient; @@ -597,7 +597,7 @@ var len: Integer; str: string; begin - if not fAvailable or not fServerListening or fDoc.isNil then + if not fAvailable or not fServerListening or fDoc.isNotAssigned then exit; i := fDoc.MouseBytePosition; @@ -645,7 +645,7 @@ var i: Integer; str, loc: string; begin - if not fAvailable or not fServerListening or fDoc.isNil then + if not fAvailable or not fServerListening or fDoc.isNotAssigned then exit; terminateClient; @@ -680,7 +680,7 @@ var i: Integer; str: string; begin - if not fAvailable or not fServerListening or fDoc.isNil then + if not fAvailable or not fServerListening or fDoc.isNotAssigned then exit; terminateClient; @@ -709,7 +709,7 @@ end; function DCDWrapper: TDcdWrapper; begin - if fDcdWrapper.isNil then + if fDcdWrapper.isNotAssigned then fDcdWrapper := TDcdWrapper.create(nil); exit(fDcdWrapper); end; diff --git a/src/u_dfmt.pas b/src/u_dfmt.pas index e4fdde74..ac922262 100644 --- a/src/u_dfmt.pas +++ b/src/u_dfmt.pas @@ -305,7 +305,7 @@ var majv: byte = 0; minv: byte = 4; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if not exeInSysPath('dfmt') then exit; @@ -351,7 +351,7 @@ end; procedure TDfmtWidget.doCancel(sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fDoc.Lines.Assign(fBackup); end; diff --git a/src/u_diff.pas b/src/u_diff.pas index 1a36c4f7..e14ccc90 100644 --- a/src/u_diff.pas +++ b/src/u_diff.pas @@ -40,7 +40,7 @@ begin editor.Gutter.LineNumberPart.Visible:=false; - if ed.isNotNil then + if ed.isAssigned then editor.Font.Assign(ed.Font); p := TProcess.Create(self); diff --git a/src/u_dmdwrap.pas b/src/u_dmdwrap.pas index 52d43452..a1988990 100644 --- a/src/u_dmdwrap.pas +++ b/src/u_dmdwrap.pas @@ -409,7 +409,7 @@ procedure TDocOpts.getOpts(list: TStrings; base: TOptsGroup = nil); var baseopt: TDocOpts; begin - if base.isNil then + if base.isNotAssigned then begin if fGenDoc then list.Add('-D'); @@ -518,7 +518,7 @@ var const DepStr : array[TDepHandling] of string = ('-d', '', '-de'); begin - if base.isNil then + if base.isNotAssigned then begin dep := DepStr[fDepHandling]; if dep.isNotEmpty then @@ -671,7 +671,7 @@ const binKindStr: array[TProjectBinaryKind] of string = ('', '-lib', '-shared', '-c'); bchKindStr: array[TBoundCheckKind] of string = ('on', 'safeonly', 'off'); begin - if base.isNil then + if base.isNotAssigned then begin str := binKindStr[fBinKind]; if str.isNotEmpty then @@ -910,7 +910,7 @@ var idt: string; baseopt: TDebugOpts; begin - if base.isNil then + if base.isNotAssigned then begin if fDebugConditions then list.Add('-debug'); @@ -1100,7 +1100,7 @@ var c: string; begin c := fSymStringExpander.expand('') + DirectorySeparator; - if base.isNil then + if base.isNotAssigned then begin exts := TStringList.Create; try @@ -1371,7 +1371,7 @@ var baseopt: TOtherOpts; rightList: TStringList; begin - if base.isNil then + if base.isNotAssigned then begin for i := 0 to fCustom.Count-1 do begin @@ -1417,14 +1417,14 @@ var baseopt: TOtherOpts; lst: TStringList = nil; begin - if base.isNil then + if base.isNotAssigned then begin case compiler of dmd: lst := fDmdOthers; ldc, ldmd: lst := fLdcOthers; gdc, gdmd: lst := fGdcOthers; end; - if lst.isNotNil then + if lst.isAssigned then for i := 0 to lst.Count-1 do begin str := lst[i]; @@ -1454,7 +1454,7 @@ begin else lst := fGdcOthers; end; - if lst.isNotNil then + if lst.isAssigned then for i := 0 to lst.Count-1 do begin str := lst[i]; diff --git a/src/u_dubproject.pas b/src/u_dubproject.pas index 300052e8..7b5af5d3 100644 --- a/src/u_dubproject.pas +++ b/src/u_dubproject.pas @@ -291,7 +291,7 @@ begin end; finally m.Free; - if r.isNotNil then + if r.isAssigned then r.Free; end; end; @@ -405,9 +405,9 @@ var begin - if not assigned(Lfm) then + if Lfm.isNotAssigned then Lfm := getLifeTimeManager; - if not assigned(Lfm) or not (Lfm.getLifetimeStatus = lfsLoaded) then + if Lfm.isNotAssigned or not (Lfm.getLifetimeStatus = lfsLoaded) then begin if fDoneFirstUpdate and (not fNeedUpdate) then exit; @@ -674,9 +674,8 @@ end; constructor TDubProject.create(aOwner: TComponent); begin inherited; - if not assigned(fCompilerSelector) then + if fCompilerSelector.isNotAssigned then fCompilerSelector := getCompilerSelector; - assert(assigned(fCompilerSelector)); fAsProjectItf := self as ICommonProject; fSaveAsUtf8 := true; fJSON := TJSONObject.Create(); @@ -824,7 +823,7 @@ begin try fJSON := parser.Parse as TJSONObject; except - if assigned(fJSON) then + if fJSON.isAssigned then FreeAndNil(fJSON); fFilename := ''; end; @@ -839,13 +838,13 @@ begin begin FreeAndNil(fJSON); fJSON := sdl2json(fFilename); - if fJSON.isNil then + if fJSON.isNotAssigned then fFilename := '' else fIsSdl := true; end; - if not assigned(fJSON) then + if fJSON.isNotAssigned then begin fHasLoaded := false; fJson := TJSONObject.Create(['name','invalid json']) @@ -1057,7 +1056,7 @@ end; {$REGION ICommonProject: actions ---------------------------------------------} procedure TDubProject.stopCompilation; begin - if fDubProc.isNotNil and fDubProc.Running then + if fDubProc.isAssigned and fDubProc.Running then fDubProc.Terminate(1); end; @@ -1114,7 +1113,7 @@ var e: string; d: string; begin - if fDubProc.isNotNil and fDubProc.Active then + if fDubProc.isAssigned and fDubProc.Active then begin fMsgs.message('the project is already being processed by DUB', fAsProjectItf, amcProj, amkWarn); exit; @@ -1233,7 +1232,7 @@ var d: TJSONData; begin result := nil; - if value.isBlank or fJSON.isNil or not fJSON.findArray('subPackages', a) then + if value.isBlank or fJSON.isNotAssigned or not fJSON.findArray('subPackages', a) then exit; for i := 0 to a.Count-1 do begin @@ -1263,7 +1262,7 @@ procedure TDubProject.updatePackageNameFromJson; var value: TJSONData; begin - if fJSON.isNil then + if fJSON.isNotAssigned then exit; if not fJSON.findAny('name', value) then fPackageName := '' @@ -1282,7 +1281,7 @@ var begin fBuildTypes.Clear; fConfigs.Clear; - if fJSON.isNil then + if fJSON.isNotAssigned 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. @@ -1366,7 +1365,7 @@ var //glb: TRegExpr; begin fSrcs.Clear; - if not assigned(fJSON) then + if fJSON.isNotAssigned then exit; lst := TStringList.Create; try @@ -1396,7 +1395,7 @@ begin for i := 0 to arr.Count-1 do tryAddRelOrAbsFile(arr.Strings[i]); conf := getCurrentCustomConfig; - if conf.isNotNil then + if conf.isAssigned then begin if conf.findAny('mainSourceFile', item) then begin @@ -1426,7 +1425,7 @@ begin {lst.Clear; getExclusion(fJSON); conf := getCurrentCustomConfig; - if conf.isNotNil then + if conf.isAssigned then getExclusion(conf); if lst.Count > 0 then begin @@ -1459,7 +1458,7 @@ var tt: TJSONData; begin result := true; - if value.Find('mainSourceFile').isNotNil then + if value.Find('mainSourceFile').isAssigned then fBinKind := executable else if value.findAny('targetType', tt) then begin @@ -1482,11 +1481,11 @@ var s: string; begin fBinKind := executable; - if fJSON.isNil then + if fJSON.isNotAssigned then exit; a := findTargetKindInd(fJSON); c := getCurrentCustomConfig; - if c.isNotNil then + if c.isAssigned then b := findTargetKindInd(c); if a or b then exit; @@ -1693,7 +1692,7 @@ procedure TDubProject.updateImportPathsFromJson; var conf: TJSONObject; begin - if fJSON.isNil then + if fJSON.isNotAssigned then exit; addFrom(fJSON); @@ -1712,7 +1711,7 @@ begin {$ENDIF} conf := getCurrentCustomConfig; - if conf.isNotNil then + if conf.isAssigned then begin addFrom(conf); addDepsFrom(conf); @@ -1747,14 +1746,14 @@ var end; begin fOutputFileName := ''; - if fJSON.isNil or not fJSON.findAny('name', item) then + if fJSON.isNotAssigned or not fJSON.findAny('name', item) then exit; namePart := item.AsString; pathPart := fBasePath; setFrom(fJSON); conf := getCurrentCustomConfig; - if conf.isNotNil then + if conf.isAssigned then setFrom(conf); pathPart := TrimRightSet(pathPart, ['/','\']); {$IFNDEF WINDOWS} @@ -1841,7 +1840,7 @@ begin try jsn := prs.Parse; try - if jsn.isNotNil then + if jsn.isAssigned then result := TJSONObject(jsn.Clone) else result := nil; @@ -1879,9 +1878,9 @@ begin try try maybe.loadFromFile(filename); - if maybe.json.isNil or maybe.filename.isEmpty then + if maybe.json.isNotAssigned or maybe.filename.isEmpty then result := false - else if maybe.json.Find('name').isNil then + else if maybe.json.Find('name').isNotAssigned then result := false; except result := false; diff --git a/src/u_dubprojeditor.lfm b/src/u_dubprojeditor.lfm index 08a4212d..4397ed8b 100644 --- a/src/u_dubprojeditor.lfm +++ b/src/u_dubprojeditor.lfm @@ -138,8 +138,8 @@ inherited DubProjectEditorWidget: TDubProjectEditorWidget end end inherited contextMenu: TPopupMenu - left = 248 - top = 8 + Left = 248 + Top = 8 object MenuItem1: TMenuItem[0] Caption = 'Refresh' OnClick = MenuItem1Click diff --git a/src/u_dubprojeditor.pas b/src/u_dubprojeditor.pas index 7d4b759b..13c9b601 100644 --- a/src/u_dubprojeditor.pas +++ b/src/u_dubprojeditor.pas @@ -195,7 +195,7 @@ end; procedure TDubProjectPropAddPanel.selTypeChanged(sender: TObject); begin - if fJson.isNotNil then + if fJson.isAssigned then fEdName.Enabled := fJson.JSONType <> TJSONtype.jtArray; end; @@ -308,7 +308,7 @@ end; procedure TDubProjectEditorWidget.projChanged(project: ICommonProject); begin - if fProj.isNil then + if fProj.isNotAssigned then exit; if project.getProject <> fProj then exit; @@ -320,7 +320,7 @@ end; procedure TDubProjectEditorWidget.projClosing(project: ICommonProject); begin - if fProj.isNil then + if fProj.isNotAssigned then exit; if project.getProject <> fProj then exit; @@ -374,13 +374,13 @@ begin btnDelProp.Enabled := false; btnAddProp.Enabled := false; btnCloneObject.Enabled := false; - if propTree.Selected.isNil then + if propTree.Selected.isNotAssigned then exit; fSelectedNode := propTree.Selected; tpe := TJSONData(fSelectedNode.Data).JSONType; btnDelProp.Enabled := (fSelectedNode.Level > 0) and (fSelectedNode.Text <> 'name') - and fSelectedNode.data.isNotNil; + and fSelectedNode.data.isAssigned; btnAddProp.Enabled := tpe in [jtObject, jtArray]; btnCloneObject.Enabled := (tpe = jtObject) and (fSelectedNode.Level > 0); updateValueEditor; @@ -393,7 +393,7 @@ end; procedure TDubProjectEditorWidget.btnAcceptPropClick(Sender: TObject); begin - if fSelectedNode.isNil then + if fSelectedNode.isNotAssigned then exit; setJsonValueFromEditor; propTree.FullExpand; @@ -403,7 +403,7 @@ procedure TDubProjectEditorWidget.btnAddPropClick(Sender: TObject); var pnl: TDubProjectPropAddPanel; begin - if fSelectedNode.isNil then + if fSelectedNode.isNotAssigned then exit; pnl := TDubProjectPropAddPanel.construct(@addProp, TJSONData(fSelectedNode.Data)); pnl.ShowModal; @@ -420,7 +420,7 @@ var obj: TJSONObject; nod: TTreeNode; begin - if fSelectedNode.isNil then + if fSelectedNode.isNotAssigned then exit; dat := TJSONData(fSelectedNode.Data); if dat.JSONType = jtObject then @@ -454,9 +454,9 @@ begin fProj.endModification; propTree.FullExpand; nod := propTree.Items.FindNodeWithText(''); - if nod.isNil then + if nod.isNotAssigned then nod := propTree.Items.FindNodeWithText(propName); - if nod.isNotNil then + if nod.isAssigned then begin propTree.Selected := nod; propTree.MakeSelectionVisible; @@ -468,15 +468,15 @@ var prt: TJSONData; sel: TTreeNode; begin - if fSelectedNode.isNil then + if fSelectedNode.isNotAssigned then exit; if fSelectedNode.Level.equals(0) then exit; if (fSelectedNode.Text = 'name') and fSelectedNode.Level.equals(0) then exit; - if fSelectedNode.Data.isNil then + if fSelectedNode.Data.isNotAssigned then exit; - if fSelectedNode.Parent.Data.isNil then + if fSelectedNode.Parent.Data.isNotAssigned then exit; fProj.beginModification; @@ -486,11 +486,11 @@ begin else if prt.JSONType = jtArray then TJSONArray(prt).Delete(fSelectedNode.Index); sel := fSelectedNode.GetPrevSibling; - if sel.isNil then + if sel.isNotAssigned then sel := fSelectedNode.GetNextSibling; - if sel.isNil then + if sel.isNotAssigned then sel := fSelectedNode.Parent; - if sel.isNotNil then + if sel.isAssigned then sel.Selected:=true; fProj.endModification; @@ -501,16 +501,16 @@ procedure TDubProjectEditorWidget.btnRefreshClick(Sender: TObject); var f: string; begin - if assigned(fProj) then - begin - f := fProj.filename; - if not f.fileExists then - exit; - if fProj.modified and - (dlgYesNo('The project seems to be modified, save before reloading') = mrYes) then - fProj.saveToFile(f); - fProj.loadFromFile(f); - end; + if fProj.isNotAssigned then + exit; + + f := fProj.filename; + if not f.fileExists then + exit; + if fProj.modified and + (dlgYesNo('The project seems to be modified, save before reloading') = mrYes) then + fProj.saveToFile(f); + fProj.loadFromFile(f); end; procedure TDubProjectEditorWidget.btnCloneObjectClick(Sender: TObject); @@ -523,8 +523,8 @@ var inm: string; idx: integer = 0; begin - if fSelectedNode.isNil or fSelectedNode.Data.isNil or fProj.isNil or - fSelectedNode.Parent.Data.isNil then + if fSelectedNode.isNotAssigned or fSelectedNode.Data.isNotAssigned or fProj.isNotAssigned or + fSelectedNode.Parent.Data.isNotAssigned then exit; dat := TJSONData(fSelectedNode.Data); @@ -561,7 +561,7 @@ end; procedure TDubProjectEditorWidget.MenuItem1Click(Sender: TObject); begin - if fProj.isNil or not fProj.filename.fileExists then + if fProj.isNotAssigned or not fProj.filename.fileExists then exit; fProj.loadFromFile(fProj.filename); end; @@ -574,7 +574,7 @@ var vInt64: int64; vBool: boolean; begin - if fSelectedNode.isNil or fSelectedNode.Data.isNil or fProj.isNil then + if fSelectedNode.isNotAssigned or fSelectedNode.Data.isNotAssigned or fProj.isNotAssigned then exit; fProj.beginModification; @@ -606,7 +606,7 @@ var dat: TJSONData; begin edProp.Clear; - if fSelectedNode.isNil or fSelectedNode.Data.isNil then + if fSelectedNode.isNotAssigned or fSelectedNode.Data.isNotAssigned then exit; dat := TJSONData(fSelectedNode.Data); @@ -676,12 +676,12 @@ var rcl: TTreeNode; begin - if propTree.Selected.isNotNil then + if propTree.Selected.isAssigned then str := propTree.Selected.GetTextPath; propTree.Items.Clear; edProp.Clear; - if fProj.isNil or fProj.json.isNil then + if fProj.isNotAssigned or fProj.json.isNotAssigned then exit; propTree.BeginUpdate; @@ -689,7 +689,7 @@ begin if str.isNotEmpty then begin rcl := propTree.Items.FindNodeWithTextPath(str); - if rcl.isNotNil then + if rcl.isAssigned then begin rcl.Selected := true; rcl.MakeVisible; diff --git a/src/u_editor.lfm b/src/u_editor.lfm index 581d1482..b87337f3 100644 --- a/src/u_editor.lfm +++ b/src/u_editor.lfm @@ -54,19 +54,19 @@ inherited EditorWidget: TEditorWidget end end inherited contextMenu: TPopupMenu - left = 24 - top = 16 + Left = 24 + Top = 16 end object macRecorder: TSynMacroRecorder[2] RecordShortCut = 0 PlaybackShortCut = 0 - left = 80 - top = 16 + Left = 80 + Top = 16 end object mnuEditor: TPopupMenu[3] OnPopup = mnuEditorPopup - left = 152 - top = 16 + Left = 152 + Top = 16 object mnuedCopy: TMenuItem Caption = 'Copy' OnClick = mnuedCopyClick diff --git a/src/u_editor.pas b/src/u_editor.pas index 05e57a8f..ca927b75 100644 --- a/src/u_editor.pas +++ b/src/u_editor.pas @@ -453,11 +453,11 @@ end; function TEditorWidget.closeQuery: boolean; begin - result := inherited and (Parent.isNil or + result := inherited and (Parent.isNotAssigned or // already set as dockable but not docked // necessary because it has te closed programmatically during loading sequence // otherwise the layout reloading has no effect. - Parent is TAnchorDockHostSite and Parent.Parent.isNil); + Parent is TAnchorDockHostSite and Parent.Parent.isNotAssigned); end; procedure TEditorWidget.setToolBarFlat(value: boolean); @@ -503,7 +503,7 @@ end; procedure TEditorWidget.docClosing(document: TDexedMemo); begin - if document.isNil then + if document.isNotAssigned then exit; document.Parent := nil; if document = fDoc then @@ -514,7 +514,7 @@ end; procedure TEditorWidget.docFocused(document: TDexedMemo); begin - if fDoc.isNotNil and pageControl.currentPage.isNotNil and + if fDoc.isAssigned and pageControl.currentPage.isAssigned and (pageControl.currentPage.Caption = newdocPageCaption) then updatePageCaption(pageControl.currentPage); if document = fDoc then @@ -598,14 +598,14 @@ var begin showWidget; doc := findDocument(fname); - if doc.isNotNil then + if doc.isAssigned then begin PageControl.currentPage := TDexedPage(doc.Parent); exit; end; doc := TDexedMemo.Create(nil); fDoc.loadFromFile(TrimFilename(fname)); - if assigned(fProj) and (fProj.filename = fDoc.fileName) then + if fProj.isAssigned and (fProj.filename = fDoc.fileName) then begin if fProj.getFormat = pfDEXED then fDoc.Highlighter := LfmSyn @@ -619,7 +619,7 @@ var doc: TDexedMemo; begin doc := getDocument(index); - if doc.isNil then + if doc.isNotAssigned then exit(false); if promptOnChanged and (doc.modified or (doc.fileName = doc.tempFilename)) and (dlgFileChangeClose(doc.fileName, UnsavedFile) = mrCancel) then @@ -636,7 +636,7 @@ var page: TDexedPage = nil; begin page := TDexedPage(doc.Parent); - if page.isNil then + if page.isNotAssigned then exit(false); exit(closeDocument(page.index, promptOnChanged)); end; @@ -668,7 +668,7 @@ end; procedure TEditorWidget.focusedEditorChanged; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; macRecorder.Editor:= fDoc; fDoc.PopupMenu := mnuEditor; @@ -684,7 +684,7 @@ end; procedure TEditorWidget.PageControlChanged(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fDoc.hideCallTips; fDoc.hideDDocs; @@ -692,7 +692,7 @@ end; procedure TEditorWidget.PageControlChanging(Sender: TObject; var AllowChange: Boolean); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fDoc.hideCallTips; fDoc.hideDDocs; @@ -780,7 +780,7 @@ begin if (fname <> fDoc.fileName) and fname.fileExists then begin page := pageControl.splitPage; - if assigned(page) then + if page.isAssigned then begin fDoc := TDexedMemo(page.Controls[0]); if fDoc.fileName <> fname then @@ -846,15 +846,15 @@ var dc1: TDexedMemo = nil; dc2: TDexedMemo = nil; begin - if page.isNil or page.ControlCount.equals(0) then + if page.isNotAssigned or page.ControlCount.equals(0) then exit; - if pageControl.splitPage.isNotNil and + if pageControl.splitPage.isAssigned and (page <> pageControl.splitPage) then begin txt := ''; dc1 := TDexedMemo(page.Controls[0]); dc2 := TDexedMemo(pageControl.splitPage.Controls[0]); - if dc1.isNotNil and dc2.isNotNil then + if dc1.isAssigned and dc2.isAssigned then txt := dc1.pageCaption(fDetectModuleName) + ' - ' + dc2.pageCaption(fDetectModuleName); end @@ -878,7 +878,7 @@ end; procedure TEditorWidget.updateImperative; begin updateStatusBar; - if fDoc.isNotNil then + if fDoc.isAssigned then updatePageCaption(pageControl.currentPage); end; @@ -889,7 +889,7 @@ begin updateStatusBar; if not fKeyChanged then exit; - if pageControl.currentPage.isNotNil then + if pageControl.currentPage.isAssigned then updatePageCaption(pageControl.currentPage); end; {$ENDREGION} @@ -897,13 +897,13 @@ end; {$REGION Editor context menu ---------------------------------------------------} procedure TEditorWidget.mnuedCopyClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.ExecuteCommand(ecCopy, '', nil); end; procedure TEditorWidget.mnuedCallTipClick(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; mnuEditor.Close; fDoc.hideDDocs; @@ -914,25 +914,25 @@ end; procedure TEditorWidget.mnuedCommClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecCommentSelection, '', nil); end; procedure TEditorWidget.mnuedPrevClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecPreviousLocation, '', nil); end; procedure TEditorWidget.mnuedNextClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecNextLocation, '', nil); end; procedure TEditorWidget.mnuedInvAllNoneClick(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if not fDoc.IsDSource and not fDoc.alwaysAdvancedFeatures then exit; @@ -941,7 +941,7 @@ end; procedure TEditorWidget.MenuItem5Click(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if not fDoc.IsDSource and not fDoc.alwaysAdvancedFeatures then exit; @@ -961,37 +961,37 @@ end; procedure TEditorWidget.mnuedUpcaseClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecUpperCaseWordOrSel, #0, nil); end; procedure TEditorWidget.mnuedLowcaseClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecLowerCaseWordOrSel, #0, nil); end; procedure TEditorWidget.mnuedPrevWarnClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.previousWarning; end; procedure TEditorWidget.mnuEdSetSpacesClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.Options := fDoc.Options + [eoTabsToSpaces]; end; procedure TEditorWidget.mnuEdSetTabsClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.Options := fDoc.Options - [eoTabsToSpaces]; end; procedure TEditorWidget.mnuEdShowSpecClick(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if mnuEdShowSpec.Checked then fDoc.Options := fDoc.Options + [eoShowSpecialChars] @@ -1001,13 +1001,13 @@ end; procedure TEditorWidget.mnuedSortLinesClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecSortLines, #0, nil); end; procedure TEditorWidget.mnuEdTabWidth2Click(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fDoc.TabWidth:= TMenuItem(sender).Tag; @@ -1025,19 +1025,19 @@ end; procedure TEditorWidget.mnuedNextCareaClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.nextChangedArea; end; procedure TEditorWidget.mnuedPrevProtGrpClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.previousProtectionGroup; end; procedure TEditorWidget.mnuedDdocTmpClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.insertDdocTemplate; end; @@ -1074,31 +1074,31 @@ end; procedure TEditorWidget.FormShow(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.Visible:=true; end; procedure TEditorWidget.mnuedGotolineClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.gotoLinePrompt; end; procedure TEditorWidget.mnuedNextWarnClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.nextWarning; end; procedure TEditorWidget.mnuedNextProtGrpClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.nextProtectionGroup; end; procedure TEditorWidget.mnuedPrevCareaClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.previousChangedArea; end; @@ -1106,7 +1106,7 @@ procedure TEditorWidget.MenuItem8Click(Sender: TObject); var str: TStringList; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if not fDoc.IsDSource and not fDoc.alwaysAdvancedFeatures then exit; @@ -1129,25 +1129,25 @@ end; procedure TEditorWidget.MenuItem6Click(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecCommentIdentifier, '', nil); end; procedure TEditorWidget.mnuedRenameClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CommandProcessor(ecRenameIdentifier, '', nil); end; procedure TEditorWidget.mnuedCutClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.ExecuteCommand(ecCut, '', nil); end; procedure TEditorWidget.mnuedDdocClick(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; mnuEditor.Close; fDoc.hideCallTips; @@ -1158,31 +1158,31 @@ end; procedure TEditorWidget.mnuedPasteClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.ExecuteCommand(ecPaste, '', nil); end; procedure TEditorWidget.mnuedUndoClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.ExecuteCommand(ecUndo, '', nil); end; procedure TEditorWidget.mnuedRedoClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.ExecuteCommand(ecRedo, '', nil); end; procedure TEditorWidget.mnuedJum2DeclClick(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then getSymbolLoc; end; procedure TEditorWidget.mnuEditorPopup(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; mnuedCut.Enabled:=fDoc.SelAvail; diff --git a/src/u_gdb.lfm b/src/u_gdb.lfm index a43b7143..79cc96f1 100644 --- a/src/u_gdb.lfm +++ b/src/u_gdb.lfm @@ -472,12 +472,12 @@ inherited GdbWidget: TGdbWidget ResizeAnchor = akTop end inherited contextMenu: TPopupMenu[2] - left = 56 - top = 64 + Left = 56 + Top = 64 end object mnuProjRunnable: TPopupMenu[3] - left = 56 - top = 112 + Left = 56 + Top = 112 object mnuSelProj: TMenuItem AutoCheck = True Caption = 'Debug project' @@ -496,8 +496,8 @@ inherited GdbWidget: TGdbWidget end end object mnuWatch: TPopupMenu[4] - left = 56 - top = 160 + Left = 56 + Top = 160 object mnuReadW: TMenuItem AutoCheck = True Caption = 'On read' @@ -516,24 +516,24 @@ inherited GdbWidget: TGdbWidget end end object mnuNext: TPopupMenu[5] - left = 152 - top = 112 + Left = 152 + Top = 112 object mnuNextMachine: TMenuItem AutoCheck = True Caption = 'machine instruction' end end object mnuStep: TPopupMenu[6] - left = 152 - top = 160 + Left = 152 + Top = 160 object mnuStepMachine: TMenuItem AutoCheck = True Caption = 'machine instruction' end end object mnuEval: TPopupMenu[7] - left = 216 - top = 168 + Left = 216 + Top = 168 object mnuEvalSelected: TMenuItem AutoCheck = True Caption = 'Evaluate selected variable' diff --git a/src/u_gdb.pas b/src/u_gdb.pas index 8ea35703..727f622f 100644 --- a/src/u_gdb.pas +++ b/src/u_gdb.pas @@ -354,7 +354,7 @@ type TDebugOptions = class(TDebugOptionsBase, IEditableOptions) private - FonChangesApplied: TNotifyEvent; + fOnChangesApplied: TNotifyEvent; fBackup: TDebugOptionsBase; function optionedWantCategory(): string; function optionedWantEditorKind: TOptionEditorKind; @@ -364,7 +364,7 @@ type public constructor create(aOwner: TComponent); override; destructor destroy; override; - property onChangesApplied: TNotifyEvent read FonChangesApplied write FonChangesApplied; + property onChangesApplied: TNotifyEvent read fOnChangesApplied write fOnChangesApplied; end; TGdbState = (gsNone, gsRunning, gsPaused); @@ -835,8 +835,8 @@ begin oeeAccept: begin fBackup.assign(self); - if assigned(FonChangesApplied) then - FonChangesApplied(self); + if assigned(fOnChangesApplied) then + fOnChangesApplied(self); end; end; end; @@ -1333,10 +1333,10 @@ var bmp: TBitmap; begin mnu := getMainMenu; - if not assigned(mnu) then + if mnu.isNotAssigned then exit; - if fMenu.isNil then + if fMenu.isNotAssigned then begin fMenu := mnu.mnuAdd; fMenu.Caption:='Debugger'; @@ -1580,7 +1580,7 @@ end; {$REGION Unsorted Debugging things ---------------------------------------------} function TGdbWidget.running: boolean; begin - if assigned(fGdb) then + if fGdb.isAssigned then exit(fGdb.Running) else exit(false); @@ -1593,7 +1593,7 @@ end; procedure TGdbWidget.killGdb; begin - if not assigned(fGdb) then + if fGdb.isNotAssigned then exit; if fGdb.Running then fGdb.Terminate(0); @@ -1615,9 +1615,9 @@ var begin if fSynchronizingBreakpoints then exit; - if assigned(fBreakPoints) then + if fBreakPoints.isAssigned then a := fBreakPoints.addItem(fname, line, kind); - if not a or fGdb.isNil or not fGdb.Running then + if not a or fGdb.isNotAssigned or not fGdb.Running then exit; r := fGdbState = gsRunning; if r then @@ -1648,9 +1648,9 @@ var v: TJSONData; i: integer; begin - if assigned(fBreakPoints) then + if fBreakPoints.isAssigned then d := fBreakPoints.deleteItem(fname, line, kind); - if not d or fGdb.isNil or not fGdb.Running then + if not d or fGdb.isNotAssigned or not fGdb.Running then exit; r := fGdbState = gsRunning; @@ -1926,7 +1926,7 @@ begin dlgOkInfo('No project to debug', 'GDB commander'); exit; end; - if (fDebugTargetKind = dtkRunnable) and fDoc.isNil then + if (fDebugTargetKind = dtkRunnable) and fDoc.isNotAssigned then begin dlgOkInfo('No runnable to debug', 'GDB commander'); exit; @@ -2086,7 +2086,7 @@ begin case fDebugTargetKind of dtkProject : if fProj <> nil then nme := fProj.filename; - dtkRunnable : if fDoc.isNotNil then + dtkRunnable : if fDoc.isAssigned then nme := fDoc.filename; dtkCustom : if fCustomTargetFile.fileExists then nme := fCustomTargetFile; @@ -2440,7 +2440,7 @@ begin infoAsm(fLastFilename); fLastFunction := val.AsString; end; - if fDocHandler.findDocument(fLastFilename).isNil and fLastFilename.fileExists then + if fDocHandler.findDocument(fLastFilename).isNotAssigned and fLastFilename.fileExists then fDocHandler.openDocument(fLastFilename); setState(gsPaused); autoGetStuff; @@ -2487,7 +2487,7 @@ begin if fCatchPause then begin fCatchPause := false; - if fDocHandler.findDocument(fLastFilename).isNil and fLastFilename.fileExists then + if fDocHandler.findDocument(fLastFilename).isNotAssigned and fLastFilename.fileExists then fDocHandler.openDocument(fLastFilename); autoGetStuff; setState(gsPaused); @@ -2505,7 +2505,7 @@ begin end else begin - if not fDocHandler.findDocument(fLastFilename).isNil and fLastFilename.fileExists then + if not fDocHandler.findDocument(fLastFilename).isNotAssigned and fLastFilename.fileExists then fDocHandler.openDocument(fLastFilename); autoGetStuff; setState(gsPaused); @@ -2539,7 +2539,7 @@ begin for i := 0 to arr.Count-1 do begin obj := TJSONObject(arr.Objects[i]); - if obj.isNil then + if obj.isNotAssigned then break; if obj.findAny('number', val) then number := val.AsInteger; @@ -2592,13 +2592,13 @@ begin for i := 0 to arr.Count-1 do begin obj := arr.Objects[i]; - if obj.isNil then + if obj.isNotAssigned then break; val := obj.Find('fullname'); - if val.isNotNil then + if val.isAssigned then fLastFilename:= val.AsString; val := obj.Find('func'); - if val.isNotNil then + if val.isAssigned then begin if fOptions.autoDemangle then func:= demangle(val.AsString) @@ -2606,10 +2606,10 @@ begin func := val.AsString; end; val := obj.Find('addr'); - if val.isNotNil then + if val.isAssigned then addr := val.AsInt64; val := obj.Find('line'); - if val.isNotNil then + if val.isAssigned then line := val.AsInteger; fStackItems.addItem(addr, fLastFilename, func, line); end; @@ -2617,9 +2617,9 @@ begin end; val := fJson.Find('variables'); - if val.isNil then + if val.isNotAssigned then val := fJson.Find('locals'); - if val.isNotNil and (val.JSONType = jtArray) then + if val.isAssigned and (val.JSONType = jtArray) then begin j := lstVariables.ItemIndex; lstVariables.BeginUpdate; @@ -2632,11 +2632,11 @@ begin continue; obj := TJSONObject(val); val := obj.Find('name'); - if val.isNil then + if val.isNotAssigned then continue; nme := val.AsString; val := obj.Find('value'); - if val.isNil then + if val.isNotAssigned then continue; lstVariables.AddItem(nme, nil); with lstVariables.Items[lstVariables.Items.Count-1] do @@ -2655,12 +2655,12 @@ begin begin obj := arr.Objects[i]; val := obj.Find('address'); - if val.isNotNil then + if val.isAssigned then nme := val.AsString; //val := obj.Find('func-name'); //val := obj.Find('offset'); val := obj.Find('inst'); - if val.isNotNil then + if val.isAssigned then begin lstAsm.AddItem(nme, nil); if nme = fLastOffset then @@ -2671,7 +2671,7 @@ begin lstAsm.Items[lstAsm.Items.Count-1].SubItems.Add(val.AsString); end; end; - if lstAsm.Selected.isNotNil then + if lstAsm.Selected.isAssigned then lstAsm.Selected.MakeVisible(false); lstAsm.EndUpdate; selectAsmInstr; @@ -2693,7 +2693,7 @@ begin if obj.findAny('core', val) then k.SubItems.Add(val.AsString); val := obj.Find('frame'); - if val.isNotNil and (val.JSONType = jtObject) then + if val.isAssigned and (val.JSONType = jtObject) then begin obj := TJSONObject(val); if obj.findAny('func', val) then @@ -2753,14 +2753,14 @@ var begin if (fGdbState = gsNone) or not fOptions.showOutput then exit; - if fOutput.isNil and fOutputName.fileExists then + if fOutput.isNotAssigned and fOutputName.fileExists then try fOutput := TFileStream.Create(fOutputName, 0); except - if fOutput.isNotNil then + if fOutput.isAssigned then FreeAndNil(fOutput); end; - if fOutput.isNil then + if fOutput.isNotAssigned then exit; str := TMemoryStream.Create; lst := TStringList.Create; @@ -2787,7 +2787,7 @@ end; {$REGION GDB commands & actions ------------------------------------------------} procedure TGdbWidget.gdbCommand(aCommand: string; gdbOutProcessor: TNotifyEvent = nil); begin - if fGdb.isNil or not fGdb.Running then + if fGdb.isNotAssigned or not fGdb.Running then exit; fCommandProcessed := false; aCommand += #10; @@ -2840,7 +2840,7 @@ end; procedure TGdbWidget.continueDebugging; begin gdbCommand('-exec-continue --all', @gdboutJsonize); - if assigned(fGdb) and fgdb.Running then + if fGdb.isAssigned and fgdb.Running then begin setState(gsRunning); subjDebugContinue(fSubj); @@ -2861,7 +2861,7 @@ procedure TGdbWidget.btnEvalClick(Sender: TObject); var e: string = ''; begin - if fGdb.isNil or not fGdb.Running then + if fGdb.isNotAssigned or not fGdb.Running then exit; case fEvalKind of gekCustom: @@ -2893,7 +2893,7 @@ const cmd: array[boolean] of string = ('-exec-step','-exec-step-instruction'); begin gdbCommand(cmd[mnuNextMachine.Checked], @gdboutJsonize); - if assigned(fGdb) and fgdb.Running then + if fGdb.isAssigned and fgdb.Running then setState(gsRunning); end; @@ -2902,13 +2902,13 @@ const cmd: array[boolean] of string = ('-exec-next','-exec-next-instruction'); begin gdbCommand(cmd[mnuStepMachine.Checked], @gdboutJsonize); - if assigned(fGdb) and fgdb.Running then + if fGdb.isAssigned and fgdb.Running then setState(gsRunning); end; procedure TGdbWidget.btnPauseClick(Sender: TObject); begin - if assigned(fGdb) and fGdb.Running then + if fGdb.isAssigned and fGdb.Running then fCatchPause:=true; gdbCommand('-exec-interrupt --all', @gdboutJsonize); end; @@ -2969,7 +2969,7 @@ var nme: string; doc: TDexedMemo; begin - if lstCallStack.Selected.isNil or lstCallStack.Selected.Data.isNil then + if lstCallStack.Selected.isNotAssigned or lstCallStack.Selected.Data.isNotAssigned then exit; itm := TStackItem(lstCallStack.Selected.Data); nme := itm.filename; @@ -2977,7 +2977,7 @@ begin exit; fDocHandler.openDocument(nme); doc := fDocHandler.findDocument(nme); - if doc.isNotNil then + if doc.isAssigned then doc.CaretY:= itm.line; {gdbCommand('-stack-select-frame ' + intToStr(lstCallStack.ItemIndex)); if fOptions.autoGetVariables then @@ -2992,7 +2992,7 @@ var nme: string; doc: TDexedMemo = nil; begin - if (lstThreads.Selected.isNil) or (lstThreads.Selected.SubItems.Count < 6) then + if lstThreads.Selected.isNotAssigned or (lstThreads.Selected.SubItems.Count < 6) then exit; lne := StrToIntDef(lstThreads.Selected.SubItems[5], -1); nme := lstThreads.Selected.SubItems[4]; @@ -3000,7 +3000,7 @@ begin exit; fDocHandler.openDocument(nme); doc := fDocHandler.findDocument(nme); - if doc.isNotNil then + if doc.isAssigned then doc.CaretY:= lne; end; @@ -3011,7 +3011,7 @@ var begin p := lstVariables.ScreenToControl(mouse.CursorPos); i := lstVariables.GetItemAt(p.x, p.y); - if assigned(i) and (i.SubItems.Count > 0) then + if i.isAssigned and not i.SubItems.Count.equals(0) then HintInfo^.HintStr:= i.SubItems[0]; end; @@ -3063,7 +3063,7 @@ begin if edit1.Items.IndexOf(cmd).equals(-1) then edit1.Items.Add(cmd); cmd := fSyms.expand(cmd); - if (cmd.length > 1) and (cmd[1] = '>') and assigned(fInput) then + if (cmd.length > 1) and (cmd[1] = '>') and fInput.isAssigned then begin cmd := cmd[2..cmd.length] + #10; fInput.Write(cmd[1], cmd.length); diff --git a/src/u_halstead.pas b/src/u_halstead.pas index f206a030..a78ac1bf 100644 --- a/src/u_halstead.pas +++ b/src/u_halstead.pas @@ -60,7 +60,7 @@ const function metrics: THalsteadMetrics; begin - if fMetrics.isNil then + if fMetrics.isNotAssigned then fMetrics := THalsteadMetrics.create(nil); result := fMetrics; end; @@ -75,7 +75,7 @@ begin prs := TJSONParser.Create(str, [joIgnoreTrailingComma, joUTF8]); try jps := prs.Parse(); - if jps.isNotNil and (jps.JSONType = jtObject) then + if jps.isAssigned and (jps.JSONType = jtObject) then jsn := TJSONObject(jps.Clone); jps.Free; finally @@ -193,35 +193,35 @@ procedure THalsteadMetrics.Measure(document: TDexedMemo); begin result := true; val := obj.Find('n1Count'); - if val.isNil then + if val.isNotAssigned then exit; n1 := val.AsInteger; if n1.equals(0) then exit; val := obj.Find('n1Sum'); - if val.isNil then + if val.isNotAssigned then exit; sn1 := val.AsInteger; val := obj.Find('n2Count'); - if val.isNil then + if val.isNotAssigned then exit; n2 := val.AsInteger; if n2.equals(0) then exit; val := obj.Find('n2Sum'); - if val.isNil then + if val.isNotAssigned then exit; sn2 := val.AsInteger; val := obj.Find('line'); - if val.isNil then + if val.isNotAssigned then exit; line := val.AsInteger; val := obj.Find('name'); - if val.isNil then + if val.isNotAssigned then exit; voc := max(1, n1 + n2); @@ -272,21 +272,21 @@ begin and (maxBugsPerFunction = 0) and (maxBugsPerModule = 0) and (maxVolumePerFunction = 0) then exit; - if not assigned(fMsgs) then + if fMsgs.isNotAssigned then fMSgs := getMessageDisplay; getHalsteadMetrics(document.Lines, jsn); - if jsn.isNil then + if jsn.isNotAssigned then exit; val := jsn.Find('functions'); - if val.isNil or (val.JSONType <> jtArray) then + if val.isNotAssigned or (val.JSONType <> jtArray) then exit; arr := TJSONArray(val); for i := 0 to arr.Count-1 do begin fnc := TJSONObject(arr.Objects[i]); - if fnc.isNotNil then + if fnc.isAssigned then begin fnW := checkFunction(fnc, bgS); noW := noW and fnW; diff --git a/src/u_infos.pas b/src/u_infos.pas index 7dadac7c..22886b07 100644 --- a/src/u_infos.pas +++ b/src/u_infos.pas @@ -120,7 +120,7 @@ var pth: string; cmp: DCompiler; begin - if fLabel.isNil or fStatus.isNil then + if fLabel.isNotAssigned or fStatus.isNotAssigned then exit; fPresent := false; diff --git a/src/u_interfaces.pas b/src/u_interfaces.pas index b617cdfa..489ae121 100644 --- a/src/u_interfaces.pas +++ b/src/u_interfaces.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, actnList, menus, process, - u_synmemo, u_observer; + u_synmemo, u_observer, u_common; type @@ -19,7 +19,7 @@ type (** * Common project interface. *) - ICommonProject = interface + ICommonProject = interface(IDexedBaseInterface) ['ICommonProject'] // general properties ------------------------------------------------------ diff --git a/src/u_lcldragdrop.pas b/src/u_lcldragdrop.pas index 4e1b2fa4..84830322 100644 --- a/src/u_lcldragdrop.pas +++ b/src/u_lcldragdrop.pas @@ -93,23 +93,23 @@ var trv: TTreeView; begin result := ''; - if src.isNil then + if src.isNotAssigned then exit; // from mini-explorer if src is TShellListView then begin lst := TShellListView(src); - if lst.Selected.isNotNil then + if lst.Selected.isAssigned then result := lst.GetPathFromItem(lst.Selected); end // from CE/DUB project inspector else if src is TTreeView then begin trv := TTreeView(src); - if trv.Selected.isNotNil then + if trv.Selected.isAssigned then begin result := trv.Selected.Text; - if not result.fileExists and assigned(fProj) then + if not result.fileExists and fProj.isAssigned then result := fProj.filename.extractFilePath + result; end; end; @@ -133,7 +133,7 @@ var fname: string; fmt: TProjectFileFormat; begin - if Source.isNil then + if Source.isNotAssigned then exit; fname := getFilename(Source); if not fname.fileExists then @@ -142,7 +142,7 @@ begin fmt := projectFormat(fname); if fmt in [pffDexed, pffDub] then begin - if assigned(fFreeProj) then + if fFreeProj.isAssigned then begin if fFreeProj.modified and (dlgFileChangeClose(fFreeProj.filename, UnsavedProj) = mrCancel) then exit; @@ -160,7 +160,7 @@ end; function ddHandler: TDDHandler; begin - if fDdHandler.isNil then + if fDdHandler.isNotAssigned then fDdHandler:= TDDHandler.create; result := fDdHandler; end; diff --git a/src/u_libman.pas b/src/u_libman.pas index 05385aa9..439d6669 100644 --- a/src/u_libman.pas +++ b/src/u_libman.pas @@ -252,7 +252,7 @@ begin if hasValidLibProject then begin prj := loadProject(fLibProject, true); - if not assigned(prj) then + if prj.isNotAssigned then exit; str := TStringList.Create; try @@ -278,7 +278,7 @@ begin fModulesByName.insert(lne, mdi); end else begin - if not lne.isEmpty and mdi.isNotNil then + if not lne.isEmpty and mdi.isAssigned then mdi.imports.Add(lne); end; end; @@ -314,7 +314,7 @@ begin fModulesByName.insert(lne, mdi); end else begin - if not lne.isEmpty and mdi.isNotNil then + if not lne.isEmpty and mdi.isAssigned then mdi.imports.Add(lne); end; end; @@ -342,7 +342,7 @@ begin begin lb2 := libraryByIndex[i]; lb1 := libraryByAlias[lb2.libAlias]; - if lb1.isNotNil and (lb1.Index < lb2.Index) then + if lb1.isAssigned and (lb1.Index < lb2.Index) then begin fCollection.Delete(i); continue; @@ -385,7 +385,7 @@ var cli: TLibraryItem; dep: TLibraryItem; begin - if data.isNil then + if data.isNotAssigned then exit; if operation <> ooDeleteItem then @@ -399,7 +399,7 @@ begin for i:= 0 to lib.dependencies.Count-1 do begin dep := libraryByAlias[lib.dependencies[i]]; - if assigned(dep) then + if dep.isAssigned then begin j := dep.clients.IndexOf(lib.libAlias); if j <> -1 then @@ -409,7 +409,7 @@ begin for i:= 0 to lib.clients.Count-1 do begin cli := libraryByAlias[lib.clients[i]]; - if assigned(cli) then + if cli.isAssigned then begin j := cli.dependencies.IndexOf(lib.libAlias); if j <> -1 then @@ -538,7 +538,7 @@ var i: Integer; begin // no selector = all libs - if aliases.isNil then + if aliases.isNotAssigned then begin for i:= 0 to librariesCount-1 do begin @@ -551,7 +551,7 @@ begin else for i := 0 to aliases.Count-1 do begin lib := libraryByAlias[aliases[i]]; - if lib.isNotNil and lib.enabled then + if lib.isAssigned and lib.enabled then add(lib); end; end; @@ -564,7 +564,7 @@ begin if fMsgs = nil then fMsgs := getMessageDisplay; // no selector = all libs - if aliases.isNil then + if aliases.isNotAssigned then begin for i:= 0 to librariesCount-1 do begin @@ -585,7 +585,7 @@ begin for i := 0 to aliases.Count-1 do begin lib := libraryByAlias[aliases[i]]; - if lib.isNotNil and lib.enabled and lib.hasValidLibSourcePath then + if lib.isAssigned and lib.enabled and lib.hasValidLibSourcePath then list.Add('-I' + lib.libSourcePath); end; end; @@ -609,7 +609,7 @@ begin begin // get library for import I itm := libraryByImport[imp[i]]; - if itm.isNotNil then + if itm.isAssigned then begin if sel.contains(itm) then continue; @@ -618,7 +618,7 @@ begin for j:= itm.dependencies.Count-1 downto 0 do begin dep := libraryByAlias[itm.dependencies[j]]; - if dep.isNotNil then + if dep.isAssigned then sel.insert(dep) else //auto update: item removed, detect on usage that it has disapeared @@ -633,7 +633,7 @@ begin while true do begin itm := Data; - if itm.isNil then + if itm.isNotAssigned then break; if itm.hasValidLibFile then begin @@ -666,7 +666,7 @@ begin for i := 0 to imports.Count-1 do begin b := libraryByImport[imports[i]]; - if b.isNotNil and b.enabled then + if b.isAssigned and b.enabled then begin s := b.libFile; if opts.IndexOf(s).equals(-1) and not s.isEmpty then @@ -704,7 +704,7 @@ begin continue; dep := libraryByImport[imp]; // std / core / etc ... - if dep.isNil then + if dep.isNotAssigned then continue; // ... this should not happen if dep = lib then @@ -726,7 +726,7 @@ end; function LibMan: TLibraryManager; begin - if fLibMan.isNil then + if fLibMan.isNotAssigned then fLibMan := TLibraryManager.create(nil); result := fLibMan; end; diff --git a/src/u_libmaneditor.lfm b/src/u_libmaneditor.lfm index c4cce26c..3ac08e8f 100644 --- a/src/u_libmaneditor.lfm +++ b/src/u_libmaneditor.lfm @@ -200,6 +200,6 @@ inherited LibManEditorWidget: TLibManEditorWidget end end inherited contextMenu: TPopupMenu - left = 400 + Left = 400 end end diff --git a/src/u_libmaneditor.pas b/src/u_libmaneditor.pas index 226525ac..dc3b41ea 100644 --- a/src/u_libmaneditor.pas +++ b/src/u_libmaneditor.pas @@ -114,10 +114,10 @@ var i: TIconScaledSize; begin btnReg.Enabled := (fProj <> nil) and fProj.Filename.fileExists; - btnOpenProj.Enabled := List.Selected.isNotNil and + btnOpenProj.Enabled := List.Selected.isAssigned and List.Selected.SubItems[2].fileExists; i := GetIconScaledSize; - if List.Selected.isNotNil and itemForRow(List.Selected).isNotNil and + if List.Selected.isAssigned and itemForRow(List.Selected).isAssigned and itemForRow(List.Selected).enabled then begin case i of @@ -194,7 +194,7 @@ end; procedure TLibManEditorWidget.ListEdited(Sender: TObject; Item: TListItem; var value: string); begin - if Item.isNotNil then + if Item.isAssigned then RowToLibrary(item); end; @@ -332,10 +332,10 @@ end; procedure TDubPackageQueryForm.getList(sender: TObject); begin - if assigned(fList) then + if fList.isAssigned then fList.free; simpleGet('https://code.dlang.org/api/packages/search', fList); - if assigned(fList) then + if fList.isAssigned then fillList else dlgOkError('could not get the package list, ' + simpleGetErrMsg); @@ -347,14 +347,14 @@ var i: integer; begin cbb.Clear; - if fList.isNotNil and (fList.JSONType = jtArray) then + if fList.isAssigned and (fList.JSONType = jtArray) then for i := 0 to fList.Count -1 do begin itm := fList.Items[i].FindPath('version'); - if itm.isNil then + if itm.isNotAssigned then continue; itm := fList.Items[i].FindPath('name'); - if itm.isNil then + if itm.isNotAssigned then continue; cbb.Items.AddObject(itm.AsString, fList.Items[i]); end; @@ -373,8 +373,8 @@ begin if not fGetLatestTag then exit; // list is updated - if fList.isNotNil and (cbb.ItemIndex <> -1) and - cbb.Items.Objects[cbb.ItemIndex].isNotNil then + if fList.isAssigned and (cbb.ItemIndex <> -1) and + cbb.Items.Objects[cbb.ItemIndex].isAssigned then begin jsn := TJSONData(cbb.Items.Objects[cbb.ItemIndex]); jsn := jsn.FindPath('version'); @@ -395,11 +395,11 @@ procedure TDubPackageQueryForm.updateHint(sender: TObject); var jsn: TJSONData; begin - if (cbb.ItemIndex <> -1) and cbb.Items.Objects[cbb.ItemIndex].isNotNil then + if (cbb.ItemIndex <> -1) and cbb.Items.Objects[cbb.ItemIndex].isAssigned then try jsn := TJSONData(cbb.Items.Objects[cbb.ItemIndex]); jsn := jsn.FindPath('description'); - if jsn.isNotNil then + if jsn.isAssigned then cbb.Hint:= jsn.AsString; except end; @@ -543,13 +543,13 @@ begin prj := TDubProject.create(nil); try prj.loadFromFile(dfn); - if prj.json.isNotNil and TJSONObject(prj.json).Find('targetType').isNotNil + if prj.json.isAssigned and TJSONObject(prj.json).Find('targetType').isAssigned and (TJSONObject(prj.json).Find('targetType').AsString = 'sourceLibrary') then begin if (ovw and not List.items.findCaption(nme, row)) or not ovw then row := List.Items.Add; - if row.Data.isNil then + if row.Data.isNotAssigned then row.Data := fLibman.libraries.Add; row.Caption:= nme; row.SubItems.Clear; @@ -582,7 +582,7 @@ begin begin if (ovw and not List.items.findCaption(nme, row)) or not ovw then row := List.Items.Add; - if row.Data.isNil then + if row.Data.isNotAssigned then row.Data := fLibman.libraries.Add; row.Caption := nme; row.SubItems.Clear; @@ -616,7 +616,7 @@ var al: string; i: integer; begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; al := List.Selected.Caption; @@ -638,7 +638,7 @@ end; procedure TLibManEditorWidget.btnEnabledClick(Sender: TObject); begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; if List.Selected.SubItems[3] = 'true' then @@ -654,7 +654,7 @@ var fname: string; fmt: TProjectFileFormat; begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; fname := List.Selected.SubItems[2]; if not fname.fileExists then @@ -663,7 +663,7 @@ begin fmt := projectFormat(fname); if fmt in [pffDexed, pffDub] then begin - if assigned(fFreeProj) then + if fFreeProj.isAssigned then begin if fFreeProj.modified and (dlgFileChangeClose(fFreeProj.filename, UnsavedProj) = mrCancel) then exit; @@ -747,7 +747,7 @@ end; procedure TLibManEditorWidget.btnRemLibClick(Sender: TObject); begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; flibman.libraries.Delete(List.Selected.Index); @@ -759,7 +759,7 @@ procedure TLibManEditorWidget.btnSelProjClick(Sender: TObject); var ini: string; begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; ini := List.Selected.SubItems[2]; @@ -779,7 +779,7 @@ procedure TLibManEditorWidget.btnSelFileClick(Sender: TObject); var ini: string = ''; begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; ini := List.Selected.SubItems[0]; @@ -809,7 +809,7 @@ procedure TLibManEditorWidget.btnSelfoldOfFilesClick(Sender: TObject); var dir, outdir: string; begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; dir := List.Selected.SubItems[0]; @@ -822,7 +822,7 @@ procedure TLibManEditorWidget.btnSelRootClick(Sender: TObject); var dir: string; begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; dir := List.Selected.SubItems[1]; @@ -843,7 +843,7 @@ procedure TLibManEditorWidget.btnMoveUpClick(Sender: TObject); var i: integer; begin - if list.Selected.isNil or list.Selected.Index.equals(0) then + if list.Selected.isNotAssigned or list.Selected.Index.equals(0) then exit; i := list.Selected.Index; @@ -855,7 +855,7 @@ procedure TLibManEditorWidget.btnMoveDownClick(Sender: TObject); var i: integer; begin - if list.Selected.isNil or (list.Selected.Index = list.Items.Count - 1) then + if list.Selected.isNotAssigned or (list.Selected.Index = list.Items.Count - 1) then exit; i := list.Selected.Index; @@ -896,7 +896,7 @@ var itm: TLibraryItem; begin itm := itemForRow(row); - if itm.isNil then + if itm.isNotAssigned then exit; itm.libAlias := row.Caption; diff --git a/src/u_main.lfm b/src/u_main.lfm index b025e119..e82b4842 100644 --- a/src/u_main.lfm +++ b/src/u_main.lfm @@ -11,8 +11,9 @@ object MainForm: TMainForm OnDropFiles = FormDropFiles OnResize = FormResize ShowHint = True + LCLVersion = '2.0.10.0' object mainMenu: TMainMenu - top = 1 + Top = 1 object MenuItem1: TMenuItem Caption = 'File' object MenuItem5: TMenuItem @@ -413,8 +414,8 @@ object MainForm: TMainForm end end object Actions: TActionList - left = 32 - top = 1 + Left = 32 + Top = 1 object actEdCopy: TAction Category = 'Edit' Caption = 'Copy' @@ -857,7 +858,7 @@ object MainForm: TMainForm object ApplicationProperties1: TApplicationProperties OnActivate = ApplicationProperties1Activate OnException = ApplicationProperties1Exception - left = 64 - top = 1 + Left = 64 + Top = 1 end end diff --git a/src/u_main.pas b/src/u_main.pas index db1974f0..7d38b51d 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -1060,11 +1060,11 @@ begin grp := getProjectGroup; pix := grp.reloadedProjectIndex; prj := MainForm.fFreeProj; - if assigned(prj) then + if prj.isAssigned then fProjName := prj.filename; fProjectGroup := getProjectGroup.groupFilename; if prj = MainForm.fProj then - fProjectIndex :=- 1 + fProjectIndex := -1 else fProjectIndex := pix; end else @@ -1087,29 +1087,31 @@ begin if fProjName.isNotEmpty and fProjName.fileExists then begin dst.openProj(fProjName); - if not assigned(dst.fProj) then + if dst.fProj.isNotAssigned then exit; hdl := getMultiDocHandler; - if assigned(hdl) then + if hdl.isAssigned then mem := hdl.findDocument(dst.fProj.filename); - if mem.isNotNil then + if mem.isAssigned then + begin if dst.fProj.getFormat = pfDEXED then mem.Highlighter := LfmSyn else mem.Highlighter := JsSyn; + end; end; grp := getProjectGroup; if fProjectGroup.isNotEmpty and fProjectGroup.fileExists then grp.openGroup(fProjectGroup); - if fProjectIndex.equals(-1) and assigned(dst.fFreeProj) then + if fProjectIndex.equals(-1) and dst.fFreeProj.isAssigned then dst.fFreeProj.activate else if (fProjectIndex >= 0) and (grp.projectCount > 0) and (fProjectIndex < grp.projectCount) then - begin - grp.setProjectIndex(fProjectIndex); - grp.getProject(grp.getProjectIndex).activate; - end; + begin + grp.setProjectIndex(fProjectIndex); + grp.getProject(grp.getProjectIndex).activate; + end; end else inherited; end; @@ -1127,7 +1129,7 @@ var str: string; begin docHandler := getMultiDocHandler; - if not assigned(docHandler) then + if docHandler.isNotAssigned then exit; for i:= 0 to docHandler.documentCount-1 do @@ -1151,7 +1153,7 @@ var i: integer; begin docHandler := getMultiDocHandler; - if not assigned(docHandler) then + if docHandler.isNotAssigned then exit; for i := 0 to fDocuments.Count-1 do @@ -1695,7 +1697,7 @@ begin begin if site is TAnchorDockHostSite then begin - if TAnchorDockHostSite(site).BoundSplitter.isNotNil then + if TAnchorDockHostSite(site).BoundSplitter.isAssigned then TAnchorDockHostSite(site).BoundSplitter.OnMouseWheel:= @DockSplitterMw; end else if site is TAnchorDockSplitter then @@ -1756,7 +1758,7 @@ begin if w = fEditWidg then continue; h := DockMaster.GetAnchorSite(w); - if h.isNotNil then + if h.isAssigned then h.ManualFloat(w.ClientRect, false); end; end; @@ -1974,7 +1976,7 @@ procedure TMainForm.FreeRunnableProc; var f: string; begin - if fRunProc.isNil then + if fRunProc.isNotAssigned then exit; f := fRunProc.Executable; @@ -2039,7 +2041,7 @@ begin dat := arr.Objects[0]; tgg := dat.FindPath('name'); end; - if tgg.isNotNil then + if tgg.isAssigned then begin url := 'https://gitlab.com/basile.b/dexed/-/releases/' + tgg.AsString; res:= TResourceStream.Create(HINSTANCE, 'VERSION', RT_RCDATA); @@ -2075,7 +2077,7 @@ begin // see: http://forum.lazarus.freepascal.org/index.php/topic,30616.0.htm if fAppliOpts.reloadLastDocuments then LoadLastDocsAndProj; - if not assigned(fProj) then + if fProj.isNotAssigned then newDubProj; DockMaster.ResetSplitters; @@ -2170,7 +2172,7 @@ end; procedure TMainForm.ApplicationProperties1Exception(Sender: TObject;E: Exception); begin - if fMesgWidg.isNil then + if fMesgWidg.isNotAssigned then dlgOkError(E.Message) else fMsgs.message(E.Message, nil, amcApp, amkErr); @@ -2198,7 +2200,7 @@ begin (dlgOkCancel('A project is still being compiled, close anyway ?') <> mrOK) then exit; - if assigned(fFreeProj) and fFreeProj.modified then + if fFreeProj.isAssigned and fFreeProj.modified then begin p += #9 + fFreeProj.filename + LineEnding; c := true; @@ -2274,7 +2276,7 @@ begin if d.modified and not d.isTemporary then d.save; end; - if assigned(fProj) and fProj.modified then + if fProj.isAssigned and fProj.modified then fProj.saveToFile(fProj.filename); for i := 0 to fProjectGroup.projectCount-1 do if fProjectGroup.projectModified(i) then @@ -2291,7 +2293,7 @@ begin SaveLastDocsAndProj; CanClose:= true; fProjectGroup.closeGroup; - if assigned(fFreeProj) then + if fFreeProj.isAssigned then fFreeProj.getProject.Free; for i:= fMultidoc.documentCount-1 downto 0 do fMultidoc.closeDocument(i, false); @@ -2299,17 +2301,17 @@ end; procedure TMainForm.updateDocumentBasedAction(sender: TObject); begin - TAction(sender).Enabled := fDoc.isNotNil; + TAction(sender).Enabled := fDoc.isAssigned; end; procedure TMainForm.updateProjectBasedAction(sender: TObject); begin - TAction(sender).Enabled := assigned(fProj) {and not fProjActionsLock}; + TAction(sender).Enabled := fProj.isAssigned {and not fProjActionsLock}; end; procedure TMainForm.updateDocEditBasedAction(sender: TObject); begin - if fDoc.isNotNil and fDoc.Focused then + if fDoc.isAssigned and fDoc.Focused then TAction(sender).Enabled := true else TAction(sender).Enabled := false; @@ -2326,10 +2328,10 @@ var s: string; begin srcLst := TMRUFileList(Sender); - if srcLst.isNil then + if srcLst.isNotAssigned then exit; trgMnu := TMenuItem(srcLst.objectTag); - if trgMnu.isNil then + if trgMnu.isNotAssigned then exit; if fUpdateCount > 0 then @@ -2385,7 +2387,7 @@ var srcLst: TMRUFileList; begin srcLst := TMRUFileList(TmenuItem(Sender).Tag); - if srcLst.isNotNil then + if srcLst.isAssigned then srcLst.Clear; end; @@ -2395,7 +2397,7 @@ var i: integer; begin srcLst := TMRUFileList(TmenuItem(Sender).Tag); - if srcLst.isNil then + if srcLst.isNotAssigned then exit; srcLst.BeginUpdate; for i := srcLst.Count-1 downto 0 do @@ -2470,7 +2472,7 @@ begin else if project = fFreeProj then fFreeProj := nil; - if assigned(fProj) and mnuGitBranch.Count.equals(0) then + if fProj.isAssigned and mnuGitBranch.Count.equals(0) then actProjGitBranchesUpdExecute(nil); showProjTitle; @@ -2498,7 +2500,7 @@ begin fMsgs.message('Build duration: ' + formatTicksAsDuration(GetTickCount64 - fCompStart), project, amcProj, amkInf); end; - if fRunProjAfterCompile and assigned(fProj) then + if fRunProjAfterCompile and fProj.isAssigned then begin if not success then runprev := dlgYesNo('last build failed, continue and run ?') = mrYes; @@ -2533,7 +2535,7 @@ begin fMsgs.message('Group build duration: ' + formatTicksAsDuration(GetTickCount64 - fCompStart), nil, amcAll, amkInf); end; - if assigned(fProjBeforeGroup) then + if fProjBeforeGroup.isAssigned then fProjBeforeGroup.activate; fProjBeforeGroup := nil; fIsCompilingGroup := false; @@ -2584,7 +2586,7 @@ procedure TMainForm.mnuDelete(value: TMenuItem); var i: integer; begin - if value.isNil then + if value.isNotAssigned then exit; i := mainMenu.Items.IndexOf(value); if i <> -1 then @@ -2597,7 +2599,7 @@ procedure TMainForm.actFileHtmlExportExecute(Sender: TObject); var exp: TSynExporterHTML; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; exp := TSynExporterHTML.Create(nil); try @@ -2649,7 +2651,7 @@ var begin with TOpenDialog.Create(nil) do try - if fDoc.isNotNil and not fDoc.isTemporary and fDoc.fileName.fileExists then + if fDoc.isAssigned and not fDoc.isTemporary and fDoc.fileName.fileExists then initialDir := fDoc.fileName.extractFileDir; options := options + [ofAllowMultiSelect]; filter := DdiagFilter; @@ -2663,7 +2665,7 @@ end; procedure TMainForm.actProjOpenContFoldExecute(Sender: TObject); begin - if not assigned(fProj) or not fProj.filename.fileExists then + if fProj.isNotAssigned or not fProj.filename.fileExists then exit; getExplorer.browse(fProj.filename.extractFilePath); fExplWidg.showWidget; @@ -2700,7 +2702,7 @@ end; procedure TMainForm.actFileSaveAsExecute(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; with TSaveDialog.Create(nil) do try @@ -2718,7 +2720,7 @@ procedure TMainForm.actFileSaveExecute(Sender: TObject); var str: string; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; str := fDoc.fileName; @@ -2730,7 +2732,7 @@ end; procedure TMainForm.actFileAddToProjExecute(Sender: TObject); begin - if fDoc.isNil or not assigned(fProj) then + if fDoc.isNotAssigned or fProj.isNotAssigned then exit; if fProj.filename = fDoc.fileName then exit; @@ -2747,7 +2749,7 @@ end; procedure TMainForm.actFileCloseExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then getMultiDocHandler.closeDocument(fDoc); end; @@ -2780,7 +2782,7 @@ procedure TMainForm.actFileSaveCopyAsExecute(Sender: TObject); var str: TStringList; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; with TSaveDialog.create(nil) do try @@ -2823,43 +2825,43 @@ end; {$REGION edit ------------------------------------------------------------------} procedure TMainForm.actEdCopyExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CopyToClipboard; end; procedure TMainForm.actEdCutExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.CutToClipboard; end; procedure TMainForm.actEdPasteExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.PasteFromClipboard; end; procedure TMainForm.actEdUndoExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.Undo; end; procedure TMainForm.actEdRedoExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.Redo; end; procedure TMainForm.actEdMacPlayExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fEditWidg.macRecorder.PlaybackMacro(fDoc); end; procedure TMainForm.actEdMacStartStopExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then begin if fEditWidg.macRecorder.State = msRecording then fEditWidg.macRecorder.Stop @@ -2869,13 +2871,13 @@ end; procedure TMainForm.actEdIndentExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.ExecuteCommand(ecBlockIndent, '', nil); end; procedure TMainForm.actEdUnIndentExecute(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.ExecuteCommand(ecBlockUnIndent, '', nil); end; @@ -2883,7 +2885,7 @@ procedure TMainForm.actEdFindExecute(Sender: TObject); var str: string; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fFindWidg.showWidget; @@ -2909,7 +2911,7 @@ var of_no: string; begin result := ''; - if fDoc.isNil then + if fDoc.isNotAssigned then exit; of_no := fDoc.fileName.stripFileExt + exeExt; @@ -2930,7 +2932,7 @@ begin if fDoc.isTemporary then result := of_yes; end - else if assigned(fProj) then + else if fProj.isAssigned then begin if ifInProject in fRunnablesOptions.outputFolderConditions then begin @@ -2978,7 +2980,7 @@ begin proc := TDexedProcess(sender); asyncprocOutput(sender); inph := EntitiesConnector.getSingleService('IProcInputHandler'); - if inph.isNotNil then + if inph.isAssigned then (inph as IProcInputHandler).removeProcess(proc); if not proc.ExitStatus.equals(0) then begin @@ -3014,7 +3016,7 @@ end; procedure TMainForm.ApplicationProperties1Activate(Sender: TObject); begin - if fDoc.isNotNil then + if fDoc.isAssigned then fDoc.checkFileDate; end; @@ -3038,7 +3040,7 @@ begin result := false; fMsgs.clearByData(fDoc); FreeRunnableProc; - if fDoc.isNil or fDoc.Lines.Count.equals(0) then + if fDoc.isNotAssigned or fDoc.Lines.Count.equals(0) then exit; firstlineFlags := fDoc.Lines[0]; @@ -3112,11 +3114,11 @@ begin dmdproc.Parameters.Add('-of' + fname + objExt); dmdproc.Parameters.Add('-J' + fDoc.fileName.extractFilePath); dmdproc.Parameters.AddStrings(fRunnablesOptions.staticSwitches); - if lst.isNotNil and not lst.Count.equals(0) then + if lst.isAssigned and not lst.Count.equals(0) then dmdproc.Parameters.AddStrings(lst); {$ifdef WINDOWS} {$ifdef CPUX86_64} - if lst.isNotNil and (lst.IndexOf('-m32') <> -1) then + if lst.isAssigned and (lst.IndexOf('-m32') <> -1) then begin i := dmdproc.Parameters.IndexOf('-m64'); if i <> -1 then @@ -3201,7 +3203,7 @@ begin finally dmdproc.Free; - if lst.isNotNil then + if lst.isAssigned then lst.Free; end; end; @@ -3212,7 +3214,7 @@ var lst: TStringList; fname: string; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fname := runnableExename; if not fname.fileExists then @@ -3263,7 +3265,7 @@ const ic : array[boolean] of TAppMessageKind = (amkWarn, amkInf); begin asyncprocTerminate(sender); - if fCovModUt and assigned(fRunProc) and fRunProc.ExitStatus.equals(0) then + if fCovModUt and fRunProc.isAssigned and fRunProc.ExitStatus.equals(0) then begin fname := fDoc.fileName.stripFileExt; fullcov := true; @@ -3301,7 +3303,7 @@ end; procedure TMainForm.actFileUnittestExecute(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if compileRunnable(true) then executeRunnable(true, true); @@ -3309,7 +3311,7 @@ end; procedure TMainForm.actFileCompAndRunExecute(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if compileRunnable(false) then executeRunnable(false, true); @@ -3317,7 +3319,7 @@ end; procedure TMainForm.actFileCompileAndRunOutExecute(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if compileRunnable(false) then executeRunnable(false, false); @@ -3327,7 +3329,7 @@ procedure TMainForm.actFileCompAndRunWithArgsExecute(Sender: TObject); var runargs: string = ''; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if compileRunnable(false) and InputQuery('Execution arguments', '', runargs) then executeRunnable(false, true, runargs); @@ -3344,7 +3346,7 @@ var d: TDexedMemo; c: TDexedMemo; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; c := fDoc; for i := fMultidoc.documentCount-1 downto 0 do @@ -3359,7 +3361,7 @@ procedure TMainForm.actFileCloseAllExecute(Sender: TObject); var i: integer; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; for i := fMultidoc.documentCount-1 downto 0 do fMultidoc.closeDocument(i); @@ -3367,7 +3369,7 @@ end; procedure TMainForm.actEdFormatExecute(Sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; getCodeFormatting.formatCurrent(); end; @@ -3379,7 +3381,7 @@ var pth: string; msg: string; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if fDoc.isTemporary and fDoc.modified then fDoc.saveTempFile; @@ -3408,7 +3410,7 @@ end; procedure TMainForm.actFileMetricsHalsteadExecute(Sender: TObject); begin - if fDoc.isNil or not fDoc.isDSource then + if fDoc.isNotAssigned or not fDoc.isDSource then exit; metrics.measure(fDoc); end; @@ -3449,7 +3451,7 @@ procedure TMainForm.dubFile(outside: boolean); var d: string; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; FreeRunnableProc; fMsgs.clearByData(fDoc); @@ -3498,7 +3500,7 @@ const messg2: string = 'The binary produced for a runnable that is not explicitly saved ' + 'must be recompiled after each execution.' + LineEnding + 'Do you wish to recompile it now ?'; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; FreeRunnableProc; fname := runnableExename; @@ -3532,7 +3534,7 @@ end; procedure TMainForm.actFileOpenContFoldExecute(Sender: TObject); begin - if fDoc.isNil or not fDoc.fileName.fileExists then + if fDoc.isNotAssigned or not fDoc.fileName.fileExists then exit; getExplorer.browse(fDoc.fileName.extractFilePath); fExplWidg.showWidget; @@ -3595,7 +3597,7 @@ var widg: TDexedWidget; act: TAction; begin - if sender.isNil then + if sender.isNotAssigned then exit; act := TAction(sender); if act.Tag.equals(0) then @@ -3617,7 +3619,7 @@ var widg: TDexedWidget; begin widg := TDexedWidget( TComponent(sender).tag ); - if widg.isNotNil then + if widg.isAssigned then widg.showWidget; end; @@ -3650,7 +3652,7 @@ begin if not w.isDockable then continue; h := DockMaster.GetAnchorSite(w); - if h.isNotNil and ((h.WindowState = wsMinimized) or (not h.HasParent)) then + if h.isAssigned and ((h.WindowState = wsMinimized) or (not h.HasParent)) then h.Close; end; @@ -3723,8 +3725,8 @@ var const fstyle: array[boolean] of TFormStyle = (fsNormal, fsStayOnTop); begin - for widg in fWidgList do if widg.Parent.isNotNil and - widg.Parent.Parent.isNil and widg.isDockable then + for widg in fWidgList do if widg.Parent.isAssigned and + widg.Parent.Parent.isNotAssigned and widg.isDockable then TForm(widg.Parent).FormStyle := fstyle[onTop]; end; @@ -3738,13 +3740,13 @@ begin if not fDockingIsInitialized then exit; edtSite := DockMaster.GetSite(fEditWidg); - if edtSite.isNil then + if edtSite.isNotAssigned then exit; if GetDockSplitterOrParent(edtSite, akTop, topSite) then begin if topSite is TAnchorDockHostSite then topHost := TAnchorDockHostSite(topSite); - if topHost.isNotNil and topHost.BoundSplitter.isNotNil and + if topHost.isAssigned and topHost.BoundSplitter.isAssigned and (topHost.BoundSplitter.Top > 0) then begin topHost.BoundSplitter.OnCanOffset:=nil; @@ -3775,7 +3777,7 @@ end; procedure TMainForm.showProjTitle; begin - if assigned(fProj) and fProj.filename.fileExists then + if fProj.isAssigned and fProj.filename.fileExists then caption := format('dexed - %s', [shortenPath(fProj.filename, 30)]) else caption := 'dexed'; @@ -3785,8 +3787,7 @@ procedure TMainForm.saveProjSource(const document: TDexedMemo); var fname: string; begin - if not assigned(fProj) or checkProjectLock or - (fProj.filename <> document.fileName) then + if fProj.isNotAssigned or checkProjectLock or (fProj.filename <> document.fileName) then exit; fname := fProj.filename; @@ -3796,7 +3797,7 @@ end; function TMainForm.closeProj: boolean; begin - if not assigned(fProj) then + if fProj.isNotAssigned then exit(true); result := false; @@ -3818,7 +3819,7 @@ procedure TMainForm.actProjNewDialogExecute(Sender: TObject); var r: TModalResult; begin - if assigned(fProj) and not fProj.inGroup and fProj.modified and + if fProj.isAssigned and not fProj.inGroup and fProj.modified and (dlgFileChangeClose(fProj.filename, UnsavedProj) = mrCancel) then exit; if not closeProj then @@ -3835,7 +3836,7 @@ end; procedure TMainForm.actProjNewDubJsonExecute(Sender: TObject); begin - if assigned(fProj) and not fProj.inGroup and fProj.modified and + if fProj.isAssigned and not fProj.inGroup and fProj.modified and (dlgFileChangeClose(fProj.filename, UnsavedProj) = mrCancel) then exit; if not closeProj then @@ -3845,7 +3846,7 @@ end; procedure TMainForm.actProjNewNativeExecute(Sender: TObject); begin - if assigned(fProj) and not fProj.inGroup and fProj.modified and + if fProj.isAssigned and not fProj.inGroup and fProj.modified and (dlgFileChangeClose(fProj.filename, UnsavedProj) = mrCancel) then exit; if not closeProj then @@ -3905,7 +3906,7 @@ procedure TMainForm.mruProjItemClick(Sender: TObject); begin if checkProjectLock then exit; - if assigned(fProj) and not fProj.inGroup and fProj.modified and + if fProj.isAssigned and not fProj.inGroup and fProj.modified and (dlgFileChangeClose(fProj.filename, UnsavedProj) = mrCancel) then exit; openProj(TMenuItem(Sender).Hint); @@ -3926,7 +3927,7 @@ end; procedure TMainForm.actProjCloseExecute(Sender: TObject); begin - if assigned(fProj) and not fProj.inGroup and fProj.modified and + if fProj.isAssigned and not fProj.inGroup and fProj.modified and (dlgFileChangeClose(fProj.filename, UnsavedProj) = mrCancel) then exit; closeProj; @@ -3955,7 +3956,7 @@ end; procedure TMainForm.actProjSaveExecute(Sender: TObject); begin - if not assigned(fProj) then + if fProj.isNotAssigned then exit; if (fProj.getFormat = pfDUB) and TDubProject(fProj.getProject).isSDL then begin @@ -3974,7 +3975,7 @@ procedure TMainForm.actProjOpenExecute(Sender: TObject); begin if checkProjectLock then exit; - if assigned(fProj) and fProj.modified and + if fProj.isAssigned and fProj.modified and (dlgFileChangeClose(fProj.filename, UnsavedProj) = mrCancel) then exit; with TOpenDialog.Create(nil) do @@ -3991,13 +3992,13 @@ procedure TMainForm.actProjEditorExecute(Sender: TObject); var win: TControl = nil; begin - if assigned(fProj) then + if fProj.isAssigned then case fProj.getFormat of pfDUB: win := DockMaster.GetAnchorSite(fDubProjWidg); pfDEXED: win := DockMaster.GetAnchorSite(fPrjCfWidg); end else win := DockMaster.GetAnchorSite(fPrjCfWidg); - if win.isNotNil then + if win.isAssigned then begin win.Show; win.BringToFront; @@ -4006,7 +4007,7 @@ end; procedure TMainForm.actProjSourceExecute(Sender: TObject); begin - if not assigned(fProj) or not fProj.filename.fileExists then + if fProj.isNotAssigned or not fProj.filename.fileExists then exit; if (fProj.getFormat = pfDUB) and TDubProject(fProj.getProject).isSDL then @@ -4025,25 +4026,21 @@ end; procedure TMainForm.actProjOptViewExecute(Sender: TObject); begin - if not assigned(fProj) then - exit; - dlgOkInfo(fProj.getCommandLine, 'Compilation command line'); + if fProj.isAssigned then + dlgOkInfo(fProj.getCommandLine, 'Compilation command line'); end; procedure TMainForm.actProjTestExecute(Sender: TObject); begin - if not assigned(fProj) then - exit; - if checkProjectLock then + if fProj.isNotAssigned or checkProjectLock then exit; fProj.test; end; procedure TMainForm.actProjStopCompExecute(Sender: TObject); begin - if fProj = nil then - exit; - fProj.stopCompilation(); + if fProj.isAssigned then + fProj.stopCompilation(); end; procedure TMainForm.actProjDscanExecute(Sender: TObject); @@ -4132,7 +4129,7 @@ var i: integer; b: string; begin - if not assigned(fProj) then + if fProj.isNotAssigned then exit; p := TProcess.Create(nil); r := TStringList.Create; @@ -4167,7 +4164,7 @@ var m: TMenuItem; a: boolean; begin - if not assigned(fProj) then + if fProj.isNotAssigned then exit; a := mnuGitBranch.Count >= 2; if a then @@ -4280,7 +4277,7 @@ end; procedure TMainForm.actProjSelUngroupedExecute(Sender: TObject); begin - if assigned(fFreeProj) then + if fFreeProj.isAssigned then fFreeProj.activate; end; @@ -4290,7 +4287,7 @@ var e: TStrings; s: string; begin - if not assigned(fProj) or (fProj.getFormat <> pfDUB) then + if fProj.isNotAssigned or (fProj.getFormat <> pfDUB) then exit; p := TDubProject(fProj.getProject); e := p.getPersistentEnvironment; @@ -4314,7 +4311,7 @@ end; procedure TMainForm.actProjAddToGroupExecute(Sender: TObject); begin - if not assigned(fFreeProj) or fFreeProj.inGroup or + if fFreeProj.isNotAssigned or fFreeProj.inGroup or not fFreeProj.filename.fileExists then exit; fProjectGroup.addProject(fFreeProj); @@ -4390,7 +4387,7 @@ begin (dlgFileChangeClose(fProjectGroup.groupFilename, UnsavedPGrp) = mrCancel) then exit; fProjectGroup.closeGroup; - if assigned(fFreeProj) then + if fFreeProj.isAssigned then fFreeProj.activate; end; {$ENDREGION} diff --git a/src/u_messages.pas b/src/u_messages.pas index b76683fa..d2d2dfd6 100644 --- a/src/u_messages.pas +++ b/src/u_messages.pas @@ -485,7 +485,7 @@ end; procedure TMessagesWidget.listDeletion(Sender: TObject; Node: TTreeNode); begin - if node.data.isNotNil then + if node.data.isAssigned then Dispose(PMessageData(Node.Data)); end; @@ -540,7 +540,7 @@ var i: Integer; o: TAppMessageCtxt; begin - if sender.isNil then + if sender.isNotAssigned then exit; // o := fCtxt; @@ -774,7 +774,7 @@ begin case fCtxt of amcAll, amcApp, amcMisc : clearbyContext(fCtxt); - amcEdit: if fDoc.isNotNil then + amcEdit: if fDoc.isAssigned then clearbyData(fDoc); amcProj: if fProj <> nil then clearbyData(fProj); @@ -878,9 +878,9 @@ end; procedure TMessagesWidget.docNew(document: TDexedMemo); begin - if fDoc.isNotNil and fOptions.fAutoSelect and (fCtxt = amcEdit) then + if fDoc.isAssigned and fOptions.fAutoSelect and (fCtxt = amcEdit) then begin - if list.Selected.isNotNil then + if list.Selected.isAssigned then fEditorMessagePos[fDoc.fileName] := list.Selected.Index else fEditorMessagePos[fDoc.fileName] := -1; @@ -906,9 +906,9 @@ var begin if fDoc = document then exit; - if fDoc.isNotNil and fOptions.fAutoSelect and (fCtxt = amcEdit) then + if fDoc.isAssigned and fOptions.fAutoSelect and (fCtxt = amcEdit) then begin - if list.Selected.isNotNil then + if list.Selected.isAssigned then fEditorMessagePos[fDoc.fileName] := list.Selected.Index else fEditorMessagePos[fDoc.fileName] := -1; @@ -1040,9 +1040,9 @@ var d: PMessageData; n: TTreeNode; begin - if data.isNil then + if data.isNotAssigned then exit; - if (TObject(data) = fDoc) and (fDoc.isNotNil) then + if (TObject(data) = fDoc) and (fDoc.isAssigned) then fEditorMessagePos[fDoc.fileName] := -1; list.BeginUpdate; TreeFilterEdit1.Filter := ''; @@ -1102,7 +1102,7 @@ begin else begin i := List.BottomItem; - fMustScrollToBack := i.isNotNil and i.IsVisible; + fMustScrollToBack := i.isAssigned and i.IsVisible; end; end; @@ -1110,7 +1110,7 @@ procedure TMessagesWidget.scrollToBack; begin if not Visible or not fMustScrollToBack then exit; - if List.BottomItem.isNotNil then + if List.BottomItem.isAssigned then List.BottomItem.MakeVisible; end; @@ -1121,7 +1121,7 @@ var dat: PMessageData; old: TDexedMemo; begin - if List.Selected.isNil then + if List.Selected.isNotAssigned then exit; if ssCtrl in GetKeyShiftState then exit; @@ -1137,7 +1137,7 @@ begin // from here, since a doc has the focus, List.Selected is nil pos := getLineFromMessage(msg); - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fDoc.setFocus; fDoc.CaretXY := pos; diff --git a/src/u_miniexplorer.lfm b/src/u_miniexplorer.lfm index f72020e3..332ead17 100644 --- a/src/u_miniexplorer.lfm +++ b/src/u_miniexplorer.lfm @@ -194,11 +194,11 @@ inherited MiniExplorerWidget: TMiniExplorerWidget end end inherited contextMenu: TPopupMenu - left = 40 - top = 48 + Left = 40 + Top = 48 end object mnuDrives: TPopupMenu[2] - left = 8 - top = 48 + Left = 8 + Top = 48 end end diff --git a/src/u_miniexplorer.pas b/src/u_miniexplorer.pas index 46baf677..87aed67b 100644 --- a/src/u_miniexplorer.pas +++ b/src/u_miniexplorer.pas @@ -481,7 +481,7 @@ procedure TMiniExplorerWidget.lstFavSelect(Sender: TObject; Item: TListItem; Sel var d: string; begin - if not Selected or Item.Data.isNil then + if not Selected or Item.Data.isNotAssigned then exit; d := PString(Item.Data)^; if d.dirExists then @@ -492,7 +492,7 @@ procedure TMiniExplorerWidget.btnRemFavClick(Sender: TObject); var i: Integer; begin - if lstFav.Selected.isNil then + if lstFav.Selected.isNotAssigned then exit; i := fFavorites.IndexOf(PString(lstFav.Selected.Data)^); if i <> -1 then @@ -504,7 +504,7 @@ procedure TMiniExplorerWidget.lstFavClick(Sender: TObject); var d: string; begin - if lstFav.Selected.isNil or lstFav.Selected.Data.isNil then + if lstFav.Selected.isNotAssigned or lstFav.Selected.Data.isNotAssigned then exit; d := PString(lstFav.Selected.Data)^; if not d.dirExists and (dlgYesNo('The favorite folder `' + d + @@ -517,7 +517,7 @@ end; procedure TMiniExplorerWidget.lstFavDeletion(Sender: TObject; Item: TListItem); begin - if Item.isNotNil and item.Data.isNotNil then + if Item.isAssigned and item.Data.isAssigned then dispose(PString(item.Data)); end; @@ -528,7 +528,7 @@ end; procedure TMiniExplorerWidget.lstFilesColumnClick(Sender: TObject;Column: TListColumn); begin - if Column.isNotNil then + if Column.isAssigned then begin if Column.Index = fFileListSortedColumnIndex then begin @@ -543,14 +543,14 @@ end; procedure TMiniExplorerWidget.btnAddFavClick(Sender: TObject); begin - if treeFolders.Selected.isNil then + if treeFolders.Selected.isNotAssigned then exit; fFavorites.Add(treeFolders.GetPathFromNode(treeFolders.Selected).extractFileDir); end; procedure TMiniExplorerWidget.lstFavDblClick(Sender: TObject); begin - if lstFav.Selected.isNil then + if lstFav.Selected.isNotAssigned then exit; treeFolders.Root := lstFav.Selected.Caption; end; @@ -673,7 +673,7 @@ var fname: string; fmt: TProjectFileFormat; begin - if lstFiles.Selected.isNil then + if lstFiles.Selected.isNotAssigned then exit; fname := lstFiles.GetPathFromItem(lstFiles.Selected); if not fname.fileExists then @@ -681,7 +681,7 @@ begin fmt := projectFormat(fname); if fmt in [pffDexed, pffDub] then begin - if assigned(fFreeProj) then + if fFreeProj.isAssigned then begin if fFreeProj.modified and (dlgFileChangeClose(fFreeProj.filename, UnsavedProj) = mrCancel) then exit; @@ -779,18 +779,18 @@ var begin if fLastListOrTree = lstFiles then begin - if lstFiles.Selected.isNil then + if lstFiles.Selected.isNotAssigned then exit; fname := lstFiles.GetPathFromItem(lstFiles.Selected); end else if fLastListOrTree = treeFolders then begin - if treeFolders.Selected.isNil then + if treeFolders.Selected.isNotAssigned then exit; fname := treeFolders.GetPathFromNode(treeFolders.Selected).extractFileDir; end else if fLastListOrTree = lstFav then begin - if lstFav.Selected.isNil or lstFav.Selected.Data.isNil then + if lstFav.Selected.isNotAssigned or lstFav.Selected.Data.isNotAssigned then exit; fname := PString(lstFav.Selected.Data)^; end; @@ -809,7 +809,7 @@ end; procedure TMiniExplorerWidget.treeFoldersChange(Sender: TObject; Node: TTreeNode); begin - if treeFolders.Selected.isNil then + if treeFolders.Selected.isNotAssigned then exit; fLastFold := treeFolders.Path.extractFileDir; // trailing path sep subjMnexDirectoryChanged(fMnxSubj, fLastFold); @@ -817,7 +817,7 @@ end; procedure TMiniExplorerWidget.treeFoldersDblClick(Sender: TObject); begin - if treeFolders.Selected.isNil then + if treeFolders.Selected.isNotAssigned then exit; treeFolders.Root := treeFolders.GetPathFromNode(treeFolders.Selected) .extractFileDir; // trailing path sep diff --git a/src/u_observer.pas b/src/u_observer.pas index c419669e..97cfb904 100644 --- a/src/u_observer.pas +++ b/src/u_observer.pas @@ -15,7 +15,7 @@ type * is mostly designed to avoid messy uses clauses or to limit * the visibility of the implementer methods. *) - ISingleService = interface + ISingleService = interface(IDexedBaseInterface) function singleServiceName: string; end; @@ -59,7 +59,7 @@ type (** * Interface for a subject. Basically designed to hold a list of observer *) - ISubject = interface + ISubject = interface(IDexedBaseInterface) // an observer is proposed. anObserver is not necessarly compatible. procedure addObserver(observer: TObject); // anObserver must be removed. @@ -71,7 +71,7 @@ type * Base type used as constraint for an interface that contains * the methods called by a ISubject. *) - IObserverType = interface + IObserverType = interface(IDexedBaseInterface) end; (** diff --git a/src/u_optionseditor.lfm b/src/u_optionseditor.lfm index a0b1aa48..45c9879d 100644 --- a/src/u_optionseditor.lfm +++ b/src/u_optionseditor.lfm @@ -126,7 +126,7 @@ inherited OptionEditorWidget: TOptionEditorWidget end end inherited contextMenu: TPopupMenu - left = 144 - top = 24 + Left = 144 + Top = 24 end end diff --git a/src/u_optionseditor.pas b/src/u_optionseditor.pas index ff1340b6..db46cb11 100644 --- a/src/u_optionseditor.pas +++ b/src/u_optionseditor.pas @@ -122,12 +122,12 @@ procedure TOptionEditorWidget.showOptionEditor(observer: IEditableOptions = nil) var n: TTreeNode; begin - if assigned(observer) then + if observer.isAssigned then begin if selCat.Items.Count.equals(0) then updateCategories; n := selCat.Items.FindNodeWithText(observer.optionedWantCategory()); - if n.isNotNil then + if n.isAssigned then selCat.Selected := n; end; showWidget; @@ -145,7 +145,7 @@ var ed: IEditableOptions; sel: string = ''; begin - if selCat.Selected.isNotNil then + if selCat.Selected.isAssigned then sel := selCat.Selected.Text; fUpdatingCat := true; inspector.TIObject := nil; @@ -175,7 +175,7 @@ end; procedure TOptionEditorWidget.selCatDeletion(Sender: TObject; Node: TTreeNode); begin - if node.Data.isNotNil then + if node.Data.isAssigned then Dispose(PCategoryData(node.Data)); end; @@ -188,9 +188,9 @@ begin exit; if csDestroying in ComponentState then exit; - if selCat.Selected.isNil then + if selCat.Selected.isNotAssigned then exit; - if selCat.Selected.Data.isNil then + if selCat.Selected.Data.isNotAssigned then exit; // accept/cancel is relative to a single category dt := PCategoryData(selCat.Selected.Data); @@ -208,7 +208,7 @@ begin end else begin dt := PCategoryData(selCat.Selected.Data); - if dt^.container.isNil or (dt^.observer = nil) then + if dt^.container.isNotAssigned or (dt^.observer = nil) then exit; if dt^.observer.optionedOptionsModified() then begin @@ -237,11 +237,11 @@ begin pnlEd.Controls[0].Parent := nil; end; - if selCat.Selected.isNil or selcat.Selected.Data.isNil then + if selCat.Selected.isNotAssigned or selcat.Selected.Data.isNotAssigned then exit; dt := PCategoryData(selCat.Selected.Data); - if dt^.container.isNil then + if dt^.container.isNotAssigned then exit; case dt^.kind of oekControl: @@ -276,7 +276,7 @@ end; procedure TOptionEditorWidget.inspectorModified(Sender: TObject); begin - if selCat.Selected.isNil or selcat.Selected.Data.isNil then + if selCat.Selected.isNotAssigned or selcat.Selected.Data.isNotAssigned then exit; fCatChanged := true; @@ -287,11 +287,11 @@ end; procedure TOptionEditorWidget.btnCancelClick(Sender: TObject); begin - if selCat.Selected.isNil or selcat.Selected.Data.isNil then + if selCat.Selected.isNotAssigned or selcat.Selected.Data.isNotAssigned then exit; fCatChanged := false; - if inspector.Parent.isNotNil then + if inspector.Parent.isAssigned then inspector.ItemIndex := -1; PCategoryData(selCat.Selected.Data)^ .observer @@ -325,11 +325,11 @@ end; procedure TOptionEditorWidget.btnAcceptClick(Sender: TObject); begin - if selCat.Selected.isNil or selcat.Selected.Data.isNil then + if selCat.Selected.isNotAssigned or selcat.Selected.Data.isNotAssigned then exit; fCatChanged := false; - if inspector.Parent.isNotNil then + if inspector.Parent.isAssigned then inspector.ItemIndex := -1; PCategoryData(selCat.Selected.Data)^ .observer diff --git a/src/u_processes.pas b/src/u_processes.pas index dd22db32..5f80d683 100644 --- a/src/u_processes.pas +++ b/src/u_processes.pas @@ -5,7 +5,7 @@ unit u_processes; interface uses - Classes, SysUtils, ExtCtrls, process, asyncprocess, pipes; + Classes, SysUtils, ExtCtrls, process, asyncprocess, pipes, u_common; type @@ -240,9 +240,9 @@ begin if not (poUsePipes in Options) then exit; - if assigned(Output) then + if Output.isAssigned then fill(Output, StdoutEx); - if assigned(Stderr) then + if Stderr.isAssigned then fill(Stderr, stderrEx); end; @@ -342,7 +342,7 @@ procedure TDexedProcess.checkTerminated(sender: TObject); begin if Running then begin - if assigned(Output) and assigned(StdErr) then + if Output.isAssigned and StdErr.isAssigned then if Output.NumBytesAvailable + Stderr.NumBytesAvailable > 0 then internalDoOnReadData(self); exit; diff --git a/src/u_procinput.pas b/src/u_procinput.pas index f8a8051b..ce4e3ac2 100644 --- a/src/u_procinput.pas +++ b/src/u_procinput.pas @@ -120,18 +120,18 @@ begin // TODO-cfeature: process list, imply that each TDexedMemo must have its own runnable TProcess // currently they share the CEMainForm.fRunProc variable. - if fProc.isNotNil then + if fProc.isAssigned then if fProc.Running then fProc.Terminate(0); txtExeName.Caption := 'no process'; fProc := nil; - if process.isNil then + if process.isNotAssigned then exit; if not (poUsePipes in process.Options) then exit; fProc := process; - if fProc.isNotNil then + if fProc.isAssigned then Panel1.Enabled:=true; txtExeName.Caption := shortenPath(fProc.Executable); end; @@ -153,7 +153,7 @@ procedure TProcInputWidget.sendInput; var inp: string; begin - if fProc.Input.isNil or fProc.Input.Handle.equals(0) then + if fProc.Input.isNotAssigned or fProc.Input.Handle.equals(0) then exit; fMru.Insert(0,txtInp.Text); @@ -168,20 +168,20 @@ end; procedure TProcInputWidget.btnSendClick(Sender: TObject); begin - if fProc.isNotNil then + if fProc.isAssigned then sendInput; end; procedure TProcInputWidget.btnCloseClick(Sender: TObject); begin - if fProc.isNotNil and fProc.Input.isNotNil and + if fProc.isAssigned and fProc.Input.isAssigned and (fProc.Input.Handle <> 0) then fProc.CloseInput; end; procedure TProcInputWidget.btnKillClick(Sender: TObject); begin - if fProc.isNotNil then + if fProc.isAssigned then fProc.Terminate(0); end; @@ -190,7 +190,7 @@ procedure TProcInputWidget.txtInpKeyDown(Sender: TObject; var Key: Word; begin case Key of VK_RETURN: - if fProc.isNotNil then + if fProc.isAssigned then sendInput; VK_UP: begin fMruPos += 1; diff --git a/src/u_profileviewer.lfm b/src/u_profileviewer.lfm index f36b31ed..7fcbb0db 100644 --- a/src/u_profileviewer.lfm +++ b/src/u_profileviewer.lfm @@ -205,36 +205,36 @@ inherited ProfileViewerWidget: TProfileViewerWidget end end inherited contextMenu: TPopupMenu - left = 8 - top = 48 + Left = 8 + Top = 48 end object datNumCalls: TListChartSource[2] Sorted = True - left = 192 - top = 56 + Left = 192 + Top = 56 end object datTreeTime: TListChartSource[3] Sorted = True - left = 232 - top = 56 + Left = 232 + Top = 56 end object datFuncTime: TListChartSource[4] Sorted = True - left = 272 - top = 56 + Left = 272 + Top = 56 end object datPerCall: TListChartSource[5] Sorted = True - left = 312 - top = 56 + Left = 312 + Top = 56 end object ImageList1: TImageList[6] - left = 192 - top = 120 + Left = 192 + Top = 120 end object ChartToolset1: TChartToolset[7] - left = 232 - top = 120 + Left = 232 + Top = 120 object ChartToolset1DataPointHintTool1: TDataPointHintTool end end diff --git a/src/u_profileviewer.pas b/src/u_profileviewer.pas index 2d75cd06..7aa9c9d9 100644 --- a/src/u_profileviewer.pas +++ b/src/u_profileviewer.pas @@ -291,7 +291,7 @@ procedure TProfileViewerWidget.btnProjClick(Sender: TObject); var fname: string; begin - if assigned(fProj) then + if fProj.isAssigned then begin fname := fProj.outputFilename.extractFileDir + DirectorySeparator + 'trace.log'; if fileExists(fname) then diff --git a/src/u_projgroup.lfm b/src/u_projgroup.lfm index d0ac7957..0e46fd23 100644 --- a/src/u_projgroup.lfm +++ b/src/u_projgroup.lfm @@ -169,7 +169,7 @@ inherited ProjectGroupWidget: TProjectGroupWidget end end inherited contextMenu: TPopupMenu - left = 272 - top = 56 + Left = 272 + Top = 56 end end diff --git a/src/u_projgroup.pas b/src/u_projgroup.pas index 6058474a..4475135f 100644 --- a/src/u_projgroup.pas +++ b/src/u_projgroup.pas @@ -194,7 +194,7 @@ end; procedure TProjectGroup.projNew(project: ICommonProject); begin - if (project <> nil) and not project.inGroup then + if project.isAssigned and not project.inGroup then fFreeStanding := project; end; @@ -202,11 +202,11 @@ procedure TProjectGroup.projChanged(project: ICommonProject); var itm: TProjectGroupItem; begin - if assigned(project) and project.inGroup and (project.getFormat = pfDUB) then + if project.isAssigned and project.inGroup and (project.getFormat = pfDUB) then begin itm := Self.addItem(project.filename); - if assigned(itm) then - itm.configurationIndex:=project.getActiveConfigurationIndex; + if itm.isAssigned then + itm.configurationIndex := project.getActiveConfigurationIndex; end; end; @@ -270,7 +270,7 @@ begin result.fFilename := fname else result.fFilename := ExtractRelativepath(fBasePath, fname); - if assigned(fFreeStanding) and SameFileName(fname, fFreeStanding.filename) then + if fFreeStanding.isAssigned and SameFileName(fname, fFreeStanding.filename) then begin result.fProj := fFreeStanding; fFreeStanding.inGroup(true); @@ -294,7 +294,7 @@ var begin result := false; p := item[ix].project; - if assigned(p) and (p.modified) then + if p.isAssigned and p.modified then result := true end; @@ -329,7 +329,7 @@ begin p := item[i]; p.fGroup := self; p.filename := patchPlateformPath(p.filename); - if assigned(fFreeStanding) and (p.absoluteFilename = fFreeStanding.filename) then + if fFreeStanding.isAssigned and (p.absoluteFilename = fFreeStanding.filename) then begin p.fProj := fFreeStanding; fFreeStanding.inGroup(true); @@ -344,13 +344,13 @@ begin end; end; if fProjectIndex > projectCount -1 then - fProjectIndex:= projectCount -1; + fProjectIndex := projectCount -1; fSavedIndex := fProjectIndex; fModified := b; if b then dlgOkError('the following projects are missing and are removed from the group:' + f, 'Project group error'); - if not assigned(fFreeStanding) then + if fFreeStanding.isNotAssigned then begin item[fSavedIndex].lazyLoad; item[fSavedIndex].project.activate; diff --git a/src/u_projinspect.lfm b/src/u_projinspect.lfm index 4704e51c..928c9269 100644 --- a/src/u_projinspect.lfm +++ b/src/u_projinspect.lfm @@ -131,7 +131,7 @@ inherited ProjectInspectWidget: TProjectInspectWidget end end inherited contextMenu: TPopupMenu - left = 128 - top = 48 + Left = 128 + Top = 48 end end diff --git a/src/u_projinspect.pas b/src/u_projinspect.pas index 9b3e09ef..d0dc29d1 100644 --- a/src/u_projinspect.pas +++ b/src/u_projinspect.pas @@ -279,7 +279,7 @@ end; procedure TProjectInspectWidget.projClosing(project: ICommonProject); begin - if not assigned(fProj) then + if fProj.isNotAssigned then exit; if project <> fProj then exit; @@ -301,7 +301,7 @@ end; procedure TProjectInspectWidget.projChanged(project: ICommonProject); begin - if not assigned(fProj) then + if fProj.isNotAssigned then exit; if fProj <> project then exit; @@ -359,7 +359,7 @@ end; procedure TProjectInspectWidget.TreeClick(Sender: TObject); begin - if Tree.Selected.isNotNil then + if Tree.Selected.isAssigned then begin Tree.MultiSelect := Tree.Selected.Parent = fFileNode; if not (Tree.Selected.Parent = fFileNode) then @@ -379,14 +379,14 @@ end; procedure TProjectInspectWidget.TreeDeletion(Sender: TObject; Node: TTreeNode ); begin - if Node.isNotNil and Node.Data.isNotNil then + if Node.isAssigned and Node.Data.isAssigned then dispose(PString(Node.Data)); end; procedure TProjectInspectWidget.TreeSelectionChanged(Sender: TObject); begin actUpdate(sender); - if not assigned(fProj) or Tree.Selected.isNil then + if fProj.isNotAssigned or Tree.Selected.isNotAssigned then exit; if (Tree.Selected.Parent = fFileNode) then fLastFileOrFolder := expandFilenameEx(fProj.basePath,tree.Selected.Text) @@ -399,12 +399,12 @@ var fname: string; i: integer; begin - if not assigned(fProj) or Tree.Selected.isNil then + if fProj.isNotAssigned or Tree.Selected.isNotAssigned then exit; if Tree.Selected.Parent <> fConfNode then begin - if Tree.Selected.Data.isNotNil then + if Tree.Selected.Data.isAssigned then begin fname := PString(Tree.Selected.Data)^; if isEditable(fname.extractFileExt) and fname.fileExists then @@ -424,7 +424,7 @@ begin fActSelConf.Enabled := false; fActOpenFile.Enabled := false; fActBuildConf.Enabled:= false; - if Tree.Selected.isNil then + if Tree.Selected.isNotAssigned then exit; fActSelConf.Enabled := Tree.Selected.Parent = fConfNode; fActBuildConf.Enabled := Tree.Selected.Parent = fConfNode; @@ -434,9 +434,9 @@ end; procedure TProjectInspectWidget.DetectNewDubSources(const document: TDexedMemo ); begin - if not assigned(fProj) or (fProj.getFormat <> pfDUB) then + if fProj.isNotAssigned or (fProj.getFormat <> pfDUB) then exit; - if document.isNotNil then + if document.isAssigned then begin if document.fileName.contains(fProj.basePath) then TDubProject(fProj.getProject).updateSourcesList; @@ -450,7 +450,7 @@ var fname: string; proj: TNativeProject; begin - if not assigned(fProj) or (fProj.getFormat = pfDUB) then + if fProj.isNotAssigned or (fProj.getFormat = pfDUB) then exit; proj := TNativeProject(fProj.getProject); @@ -481,7 +481,7 @@ var proj: TNativeProject; i: integer; begin - if not assigned(fProj) or (fProj.getFormat = pfDUB) then + if fProj.isNotAssigned or (fProj.getFormat = pfDUB) then exit; dir := ''; @@ -517,8 +517,8 @@ var proj: TNativeProject; i: Integer; begin - if not assigned(fProj) or (fProj.getFormat = pfDUB) - or Tree.Selected.isNil or (Tree.Selected.Parent <> fFileNode) then + if fProj.isNotAssigned or (fProj.getFormat = pfDUB) + or Tree.Selected.isNotAssigned or (Tree.Selected.Parent <> fFileNode) then exit; proj := TNativeProject(fProj.getProject); @@ -547,16 +547,16 @@ procedure TProjectInspectWidget.btnReloadClick(Sender: TObject); var f: string; begin - if assigned(fProj) then - begin - f := fProj.filename; - if not f.fileExists then - exit; - if fProj.modified and - (dlgYesNo('The project seems to be modified, save before reloading') = mrYes) then - fProj.saveToFile(f); - fProj.loadFromFile(f); - end; + if fProj.isNotAssigned then + exit; + + f := fProj.filename; + if not f.fileExists then + exit; + if fProj.modified and + (dlgYesNo('The project seems to be modified, save before reloading') = mrYes) then + fProj.saveToFile(f); + fProj.loadFromFile(f); end; procedure TProjectInspectWidget.btnRemFileClick(Sender: TObject); @@ -565,8 +565,8 @@ var proj: TNativeProject; i, j: integer; begin - if not assigned(fProj) or (fProj.getFormat = pfDUB) - or Tree.Selected.isNil or (Tree.Selected.Parent <> fFileNode) then + if fProj.isNotAssigned or (fProj.getFormat = pfDUB) + or Tree.Selected.isNotAssigned or (Tree.Selected.Parent <> fFileNode) then exit; proj := TNativeProject(fProj.getProject); @@ -612,7 +612,7 @@ begin getMultiDocHandler.openDocument(value); end; begin - if not assigned(fProj) or (fProj.getFormat = pfDUB) then + if fProj.isNotAssigned or (fProj.getFormat = pfDUB) then exit; proj := TNativeProject(fProj.getProject); @@ -654,12 +654,12 @@ var fld: string; rng: TStringRange = (ptr:nil; pos:0; len:0); begin - if Tree.Selected.isNotNil then + if Tree.Selected.isAssigned then sel := Tree.Selected.GetTextPath; fConfNode.DeleteChildren; fFileNode.DeleteChildren; - if not assigned(fProj) then + if fProj.isNotAssigned then exit; Tree.BeginUpdate; @@ -685,9 +685,9 @@ begin chd := nil; fld := rng.takeUntil(['/','\']).yield; chd := itm.FindNode(fld); - if chd.isNil and ((rng.empty and j.equals(1)) or (not rng.empty and j.equals(0))) then + if chd.isNotAssigned and ((rng.empty and j.equals(1)) or (not rng.empty and j.equals(0))) then chd := Tree.Items.AddChild(itm, fld); - if chd.isNotNil then + if chd.isAssigned then itm := chd; // reached fname if rng.empty and j.equals(1) then @@ -728,7 +728,7 @@ begin if sel.isNotEmpty then begin itm := Tree.Items.FindNodeWithTextPath(sel); - if itm.isNotNil then + if itm.isAssigned then begin itm.Selected := true; itm.MakeVisible; diff --git a/src/u_projutils.pas b/src/u_projutils.pas index 27d739c3..b5db3c91 100644 --- a/src/u_projutils.pas +++ b/src/u_projutils.pas @@ -129,7 +129,7 @@ begin for i:= 0 to project.sourcesCount-1 do begin doc := mdh.findDocument(project.sourceAbsolute(i)); - if doc.isNotNil and doc.modified then + if doc.isAssigned and doc.modified then doc.save; end; end; @@ -166,7 +166,7 @@ begin result := ''; - if clbck.isNil then + if clbck.isNotAssigned then clbck := TLexNameCallback.Create; // 1 source, same folder diff --git a/src/u_search.pas b/src/u_search.pas index fb57c6da..3d0424c8 100644 --- a/src/u_search.pas +++ b/src/u_search.pas @@ -389,7 +389,7 @@ var m: IMessagesDisplay; h: IMultiDocHandler; begin - if (fDoc.isNil and (fFindScope <> scProj)) or + if (fDoc.isNotAssigned and (fFindScope <> scProj)) or ((fProj = nil) and (fFindScope = scProj)) then exit; @@ -561,7 +561,7 @@ const var s: string; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fSearchMru.Insert(0, fToFind); @@ -606,7 +606,7 @@ end; procedure TSearchWidget.actReplaceNextExecute(sender: TObject); begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fSearchMru.Insert(0, fToFind); @@ -640,7 +640,7 @@ procedure TSearchWidget.actReplaceAllExecute(sender: TObject); var opts: TSynSearchOptions; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fDocSelStart := fDoc.BlockBegin; @@ -828,14 +828,14 @@ var canAll: boolean; hasTxt: boolean; begin - canAll := ((fDoc.isNotNil and (fFindScope <> scProj)) or + canAll := ((fDoc.isAssigned and (fFindScope <> scProj)) or ((fFindScope = scProj) and (fProj <> nil))); hasTxt := fToFind.isNotEmpty and not fToFind.isBlank; - btnFind.Enabled := fDoc.isNotNil and hasTxt; + btnFind.Enabled := fDoc.isAssigned and hasTxt; btnFindAll.Enabled := canAll and hasTxt; - btnReplace.Enabled := fDoc.isNotNil and chkEnableRep.Checked and fToFind.isNotEmpty; + btnReplace.Enabled := fDoc.isAssigned and chkEnableRep.Checked and fToFind.isNotEmpty; btnReplaceAll.Enabled := btnReplace.Enabled; - cbReplaceWth.Enabled := fDoc.isNotNil and chkEnableRep.Checked; + cbReplaceWth.Enabled := fDoc.isAssigned and chkEnableRep.Checked; cbToFind.Enabled := canAll; end; {$ENDREGION} diff --git a/src/u_shortcutseditor.pas b/src/u_shortcutseditor.pas index 6138bd5c..dcf2b84b 100644 --- a/src/u_shortcutseditor.pas +++ b/src/u_shortcutseditor.pas @@ -239,7 +239,7 @@ end; function TShortcutEditor.anItemIsSelected: boolean; begin result := true; - if tree.Selected.isNil or tree.Selected.Level.equals(0) or tree.Selected.Data.isNil then + if tree.Selected.isNotAssigned or tree.Selected.Level.equals(0) or tree.Selected.Data.isNotAssigned then result := false; end; {$ENDREGION} @@ -336,7 +336,7 @@ begin for j := 0 to n.Count-1 do begin o := n.Items[j]; - if o.Data.isNil then + if o.Data.isNotAssigned then continue; if TShortcutItem(o.Data).data = s then begin @@ -352,12 +352,12 @@ begin if i = tree.Selected.Index then continue; o := tree.Selected.Parent.Items[i]; - if o.Data.isNil then + if o.Data.isNotAssigned then continue; if TShortcutItem(o.Data).data = s then d := TShortcutItem(o.Data); end; - if d.isNotNil then + if d.isAssigned then dlgOkInfo(format(m2,[t, d.identifier])) else if TShortcutItem(tree.Selected.Data).data <> s then begin @@ -395,11 +395,11 @@ begin exit(true); // keep categories - if ItemNode.Parent.isNil then + if ItemNode.Parent.isNotAssigned then exit(true); b := AnsiContainsText(ItemNode.Text, fltItems.Filter); - if ItemNode.Data.isNil then + if ItemNode.Data.isNotAssigned then exit(b); s := TShortcutItem(ItemNode.Data); result := AnsiContainsText(s.combination, fltItems.Filter) or b; @@ -469,7 +469,7 @@ var if item.category.isEmpty or item.identifier.isEmpty then exit; prt := findCategory(item.category, o); - if prt.isNil then + if prt.isNotAssigned then prt := tree.Items.AddObject(nil, item.category, o); // item as child s := TShortcutItem(fShortcuts.items.Add); @@ -511,7 +511,7 @@ begin s := fShortcuts[i]; d := s.declarator; c := findCategory(s); - if not assigned(d) or c.isEmpty() then + if d.isNotAssigned or c.isEmpty() then continue; n.identifier:= s.identifier; n.category := c; diff --git a/src/u_symlist.pas b/src/u_symlist.pas index 9e84cd0b..1ec58edc 100644 --- a/src/u_symlist.pas +++ b/src/u_symlist.pas @@ -523,7 +523,7 @@ end; procedure TSymbolListWidget.actCopyIdentExecute(Sender: TObject); begin - if Tree.Selected.isNotNil then + if Tree.Selected.isAssigned then Clipboard.AsText:= Tree.Selected.Text; end; {$ENDREGION} @@ -630,7 +630,7 @@ end; procedure TSymbolListWidget.updateVisibleCat; begin - if fDoc.isNotNil and fDoc.isDSource then + if fDoc.isAssigned and fDoc.isDSource then begin ndAlias.Visible := ndAlias.Count > 0; ndClass.Visible := ndClass.Count > 0; @@ -697,7 +697,7 @@ begin if TreeFilterEdit1.Filter.isNotEmpty then tree.FullExpand - else if tree.Selected.isNil then + else if tree.Selected.isNotAssigned then tree.FullCollapse else tree.MakeSelectionVisible; result := false; @@ -721,7 +721,7 @@ procedure TSymbolListWidget.TreeDblClick(Sender: TObject); var line: PtrUInt; begin - if fDoc.isNil or Tree.Selected.isNil or Tree.Selected.Data.isNil then + if fDoc.isNotAssigned or Tree.Selected.isNotAssigned or Tree.Selected.Data.isNotAssigned then exit; {$PUSH}{$WARNINGS OFF}{$HINTS OFF} @@ -736,7 +736,7 @@ procedure TSymbolListWidget.getSymbols; begin if fLockThreadedParsing then exit; - if fDoc.isNil then + if fDoc.isNotAssigned then exit; if fDoc.Lines.Count.equals(0) or not fDoc.isDSource then begin @@ -760,7 +760,7 @@ procedure TSymbolListWidget.threadedParsingFinished(sender: TObject); function newCat(const aCat: string): TTreeNode; begin result := node.FindNode(aCat); - if result.isNil then + if result.isNotAssigned then result := node.TreeNodes.AddChild(node, aCat); case stype of _alias : begin result.ImageIndex:=0; result.SelectedIndex:=0; end; @@ -782,7 +782,7 @@ procedure TSymbolListWidget.threadedParsingFinished(sender: TObject); begin result := nil; - if node.isNil then + if node.isNotAssigned then case stype of _alias : exit(ndAlias); _class : exit(ndClass); @@ -841,10 +841,10 @@ var n: TTreeNode; begin fLockThreadedParsing := false; - if fDoc.isNil then + if fDoc.isNotAssigned then exit; - if fTreeDataFromThread.isEmpty or ndAlias.isNil then + if fTreeDataFromThread.isEmpty or ndAlias.isNotAssigned then exit; tree.BeginUpdate; @@ -893,9 +893,9 @@ var for i := 0 to root.Count-1 do begin n := root.Items[i]; - if n.Data.isNil then + if n.Data.isNotAssigned then continue; - if n.Parent.isNil then + if n.Parent.isNotAssigned then continue; if (n.Parent = ndAlias) or (n.Parent = ndEnum) @@ -916,13 +916,13 @@ var end; begin - if fDoc.isNil then + if fDoc.isNotAssigned then exit; target := fDoc.CaretY; for i := 0 to tree.Items.Count-1 do look(tree.Items[i]); - if toExpand.isNotNil then + if toExpand.isAssigned then begin tree.Selected := toExpand; toExpand.MakeVisible; diff --git a/src/u_symstring.pas b/src/u_symstring.pas index 34f6e61a..d1250cb2 100644 --- a/src/u_symstring.pas +++ b/src/u_symstring.pas @@ -153,7 +153,7 @@ end; procedure TSymbolExpander.docFocused(document: TDexedMemo); begin - if (document.isNotNil) and (fDoc = document) then + if document.isAssigned and (fDoc = document) then exit; fDoc := document; fNeedUpdate := true; @@ -189,16 +189,16 @@ begin exit; fNeedUpdate := false; - hasNativeProj := fProj.isNotNil; + hasNativeProj := fProj.isAssigned; hasProjItf := fProjInterface <> nil; - hasDoc := fDoc.isNotNil; - if not assigned(fExp) then + hasDoc := fDoc.isAssigned; + if fExp.isNotAssigned then fExp := getExplorer; for e := FirstVariableSymbol to high(TExpandableSymbol) do fSymbols[e] := na; - if assigned(fExp) then + if fExp.isAssigned then fSymbols[MEP] := fExp.currentLocation; // document diff --git a/src/u_synmemo.pas b/src/u_synmemo.pas index c36fe26c..d92d43a4 100644 --- a/src/u_synmemo.pas +++ b/src/u_synmemo.pas @@ -823,7 +823,7 @@ var i, start, prev: Integer; itm : TFoldCache; begin - if fMemo.isNil then + if fMemo.isNotAssigned then exit; fCaretPosition := fMemo.SelStart; @@ -854,7 +854,7 @@ var i: integer; itm : TFoldCache; begin - if fMemo.isNil then + if fMemo.isNotAssigned then exit; if fFontSize > 0 then @@ -1008,12 +1008,12 @@ begin fMemo.Font.Assign(fSource.Font); fMemo.Lines := fSource.Lines; width := fSource.Width div 2; - if fSource.Highlighter.isNotNil then + if fSource.Highlighter.isAssigned then begin fMemo.Color:= fSource.Color; fMemo.LineHighlightColor.Assign(fSource.LineHighlightColor); fMemo.SelectedColor.Assign(fSource.SelectedColor); - if fMemo.Highlighter.isNil then + if fMemo.Highlighter.isNotAssigned then begin fD2Hl.Assign(fSource.Highlighter); fTxtHl.Assign(fSource.Highlighter); @@ -2573,7 +2573,7 @@ end; procedure TDexedMemo.sortLines; begin - if not assigned(fSortDialog) then + if fSortDialog.isNotAssigned then fSortDialog := TSortDialog.construct(self); fSortDialog.Show; end; @@ -2683,14 +2683,14 @@ end; {$REGION DDoc & CallTip --------------------------------------------------------} procedure TDexedMemo.InitHintWins; begin - if fCallTipWin.isNil then + if fCallTipWin.isNotAssigned then begin fCallTipWin := TEditorCallTipWindow.Create(self); fCallTipWin.Color := clInfoBk + $01010100; fCallTipWin.Font.Color:= clInfoText; fCallTipWin.AutoHide:=false; end; - if fDDocWin.isNil then + if fDDocWin.isNotAssigned then begin fDDocWin := TEditorHintWindow.Create(self); fDDocWin.Color := clInfoBk + $01010100; @@ -2768,7 +2768,7 @@ begin if not fIsDSource and not alwaysAdvancedFeatures then exit; - if assigned(fDebugger) and fDebugger.running then + if fDebugger.isAssigned and fDebugger.running then begin lexWholeText([TLexOption.lxoNoComments]); exp := getExpressionAt(fLexToks, fMouseLogical); @@ -3129,7 +3129,7 @@ begin begin if fSmartDdocNewline and not (eoAutoIndent in Options) then Options := Options + [eoAutoIndent]; - if Beautifier.isNotNil and (Beautifier is TSynBeautifier) then + if Beautifier.isAssigned and (Beautifier is TSynBeautifier) then begin if not (eoTabsToSpaces in Options) and not (eoSpacesToTabs in Options) then TSynBeautifier(Beautifier).IndentType := sbitConvertToTabOnly @@ -3819,7 +3819,7 @@ var s: integer; t: integer; begin - if fLifeTimeManager.isNotNil and not fIdentDialShown and (lines.Count <> 0) and + if fLifeTimeManager.isAssigned and not fIdentDialShown and (lines.Count <> 0) and ((fLifeTimeManager as ILifetimeManager).getLifetimeStatus = lfsLoaded) then begin @@ -3873,7 +3873,7 @@ begin if findBreakPoint(line) then exit; addGutterIcon(line, giBreakSet); - if assigned(fDebugger) then + if fDebugger.isAssigned then fDebugger.addBreakPoint(fFilename, line, bpkBreak); end; @@ -3887,7 +3887,7 @@ begin removeGutterIcon(line, giBreakSet); if fDscannerEnabled and lineHasDscannerWarning(line) then addGutterIcon(line, giWarn); - if assigned(fDebugger) then + if fDebugger.isAssigned then begin fDebugger.removeBreakPoint(fFilename, line); if break2step and fDebugger.running then @@ -3928,7 +3928,7 @@ begin result := false; if line <= lines.count then m := marks.Line[line]; - if m.isNotNil then + if m.isAssigned then for i := 0 to m.count - 1 do if (m[i].ImageIndex = integer(value)) then exit(true); @@ -3957,7 +3957,7 @@ var s: boolean = false; begin m := Marks.Line[line]; - if m.isNotNil then + if m.isAssigned then for i := 0 to m.Count-1 do begin n := m.Items[i]; @@ -3982,7 +3982,7 @@ var i: integer; begin m := Marks.Line[line]; - if m.isNotNil then + if m.isAssigned then for i := m.Count-1 downto 0 do begin n := m.Items[i]; diff --git a/src/u_term.pas b/src/u_term.pas index 24ecca6b..22921388 100644 --- a/src/u_term.pas +++ b/src/u_term.pas @@ -339,7 +339,7 @@ procedure TTermWidget.updateScrollBar(); var i: TTerminalScrollInfo; begin - if fDisableScrollBarSync or not visible or fTerm.isNil then + if fDisableScrollBarSync or not visible or fTerm.isNotAssigned then exit; i := fTerm.getVScrollInfo(); ScrollBar1.SetParams(i.value, i.min, i.max, i.pageSize); diff --git a/src/u_todolist.lfm b/src/u_todolist.lfm index 57ef302c..6a3d678d 100644 --- a/src/u_todolist.lfm +++ b/src/u_todolist.lfm @@ -99,8 +99,8 @@ inherited TodoListWidget: TTodoListWidget end end inherited contextMenu: TPopupMenu - left = 40 - top = 72 + Left = 40 + Top = 72 object mnuAutoRefresh: TMenuItem[0] AutoCheck = True Caption = 'Auto resfresh' diff --git a/src/u_todolist.pas b/src/u_todolist.pas index ac58db2b..d8a9326a 100644 --- a/src/u_todolist.pas +++ b/src/u_todolist.pas @@ -343,7 +343,7 @@ begin if fDoc = document then exit; fDoc := document; - if fDoc.isNotNil and Visible and fAutoRefresh then + if fDoc.isAssigned and Visible and fAutoRefresh then scanTodoItems(true); end; @@ -405,11 +405,11 @@ end; {$REGION Todo list things ------------------------------------------------------} function TTodoListWidget.getContext: TTodoContext; begin - if (fProj = nil) and fDoc.isNil then + if fProj.isNotAssigned and fDoc.isNotAssigned then exit(tcNone); - if (fProj = nil) and fDoc.isNotNil then + if fProj.isNotAssigned and fDoc.isAssigned then exit(tcFile); - if (fProj <> nil) and fDoc.isNil then + if fProj.isAssigned and fDoc.isNotAssigned then exit(tcProject); if fProj.isSource(fDoc.fileName) then @@ -557,7 +557,7 @@ var itm: TTodoItem; fname, ln: string; begin - if lstItems.Selected.isNil or lstItems.Selected.Data.isNil then + if lstItems.Selected.isNotAssigned or lstItems.Selected.Data.isNotAssigned then exit; // the collection will be cleared if a file is opened @@ -568,7 +568,7 @@ begin ln := itm.line; getMultiDocHandler.openDocument(fname); - if fDoc.isNil then + if fDoc.isNotAssigned then exit; fDoc.setFocus; @@ -591,7 +591,7 @@ procedure TTodoListWidget.lstItemsColumnClick(Sender: TObject; Column: TListColu var curr: TListItem; begin - if lstItems.Selected.isNil then + if lstItems.Selected.isNotAssigned then exit; lstItems.BeginUpdate; curr := lstItems.Selected; @@ -673,9 +673,9 @@ end; procedure TTodoListWidget.refreshVisibleColumns; begin - if lstItems.isNil then + if lstItems.isNotAssigned then exit; - if lstItems.Columns.isNil then + if lstItems.Columns.isNotAssigned then exit; if lstItems.ColumnCount <> 6 then exit; diff --git a/src/u_tools.pas b/src/u_tools.pas index 797399db..e492e6f5 100644 --- a/src/u_tools.pas +++ b/src/u_tools.pas @@ -200,7 +200,7 @@ procedure TToolItem.setToolAlias(value: string); var i: integer = 0; begin - while fToolItems.findTool(value).isNotNil do + while fToolItems.findTool(value).isAssigned do begin value += intToStr(i); i += 1; @@ -256,7 +256,7 @@ begin if fProcess.Executable.fileExists then begin fProcess.Execute; - if previous.isNotNil and previous.outputToNext + if previous.isAssigned and previous.outputToNext and (poUsePipes in previous.Options) and (poUsePipes in Options) then begin setLength(inp, previous.process.StdoutEx.Size); @@ -310,7 +310,7 @@ begin if fNextToolAlias.isNotEmpty then begin nxt := fToolItems.findTool(fNextToolAlias); - if nxt.isNotNil then + if nxt.isAssigned then nxt.execute(self); end; end; @@ -351,10 +351,10 @@ var colitm: TToolItem; i: integer; begin - if fMenu.isNil then + if fMenu.isNotAssigned then begin mnu := getMainMenu; - if not assigned(mnu) then + if mnu.isNotAssigned then exit; fMenu := mnu.mnuAdd; fMenu.Caption:='Custom tools'; @@ -492,11 +492,11 @@ procedure TTools.executeTool(tool: TToolItem); var txt: string = ''; begin - if tool.isNil then + if tool.isNotAssigned then exit; tool.execute(nil); - if (tool.pipeInputKind <> pikNone) and fDoc.isNotNil - and (poUsePipes in tool.options) and tool.fProcess.Input.isNotNil then + if (tool.pipeInputKind <> pikNone) and fDoc.isAssigned + and (poUsePipes in tool.options) and tool.fProcess.Input.isAssigned then begin case tool.pipeInputKind of pikEditor: txt := fDoc.Text; diff --git a/src/u_toolseditor.pas b/src/u_toolseditor.pas index c37de8cb..c5eb9636 100644 --- a/src/u_toolseditor.pas +++ b/src/u_toolseditor.pas @@ -163,7 +163,7 @@ begin exit; p := CustomTools.tool[lstTools.ItemIndex].process; - if p.isNotNil and p.Running then + if p.isAssigned and p.Running then p.Terminate(1); end; diff --git a/src/u_widget.pas b/src/u_widget.pas index b56c6de3..f5ec80dc 100644 --- a/src/u_widget.pas +++ b/src/u_widget.pas @@ -249,13 +249,13 @@ var begin inherited; s := DockMaster.GetAnchorSite(self); - if s.isNotNil then + if s.isAssigned then n := s.Parent; if fOldSiteParent <> n then begin - if fOldSiteParent.isNil and n.isNotNil and assigned(fOnDockingChanged) then + if fOldSiteParent.isNotAssigned and n.isAssigned and assigned(fOnDockingChanged) then fOnDockingChanged(self, wdsDocked) - else if fOldSiteParent.isNotNil and n.isNil and assigned(fOnDockingChanged) then + else if fOldSiteParent.isAssigned and n.isNotAssigned and assigned(fOnDockingChanged) then fOnDockingChanged(self, wdsUndocked) else fOnDockingChanged(self, wdsRedocked); @@ -289,13 +289,13 @@ begin fTimerUpdateKind := value; if fTimerUpdateKind = tukNone then begin - if fUpdateTimer.isNil then + if fUpdateTimer.isNotAssigned then exit; FreeAndNil(fUpdateTimer); end else begin - if fUpdateTimer.isNil then + if fUpdateTimer.isNotAssigned then fUpdateTimer := TTimer.Create(nil); if fTimerUpdateKind = tukDelay then begin @@ -317,7 +317,7 @@ begin if fDelayDur = value then exit; fDelayDur := value; - if fUpdateTimer.isNotNil and (fTimerUpdateKind = tukDelay) then + if fUpdateTimer.isAssigned and (fTimerUpdateKind = tukDelay) then fUpdateTimer.Interval := fDelayDur; end; @@ -326,7 +326,7 @@ begin if fLoopInter = value then exit; fLoopInter := value; - if fUpdateTimer.isNotNil and (fTimerUpdateKind = tukLoop) then + if fUpdateTimer.isAssigned and (fTimerUpdateKind = tukLoop) then fUpdateTimer.Interval := fLoopInter; end;