diff --git a/src/u_ceproject.pas b/src/u_ceproject.pas index 409c5362..a4fb5dda 100644 --- a/src/u_ceproject.pas +++ b/src/u_ceproject.pas @@ -463,7 +463,7 @@ var rel: string; lst: TStringList; begin - if fConfIx = -1 then + if fConfIx.equals(-1) then exit; exc := TStringList.Create; try diff --git a/src/u_ceprojeditor.pas b/src/u_ceprojeditor.pas index 52f694cb..974a9649 100644 --- a/src/u_ceprojeditor.pas +++ b/src/u_ceprojeditor.pas @@ -153,11 +153,7 @@ end; {$REGION config. things --------------------------------------------------------} procedure TProjectConfigurationWidget.selConfChange(Sender: TObject); begin - if fProj.isNil then - exit; - if Updating then - exit; - if selConf.ItemIndex = -1 then + if fProj.isNil or Updating or selConf.ItemIndex.equals(-1) then exit; beginImperativeUpdate; @@ -188,7 +184,7 @@ var i: Integer; begin i := fSynchroItem.IndexOf(Item); - if i = -1 then + if i.equals(-1) then exit(''); result := fSynchroValue[i]; end; @@ -214,7 +210,7 @@ begin exit; if inspector.TIObject.isNil then exit; - if inspector.ItemIndex = -1 then + if inspector.ItemIndex.equals(-1) then exit; storage := nil; @@ -385,7 +381,7 @@ end; function TProjectConfigurationWidget.getGridTarget: TPersistent; begin - if fProj.isNil or (fProj.ConfigurationIndex = -1) or Tree.Selected.isNil then + if fProj.isNil or fProj.ConfigurationIndex.equals(-1) or Tree.Selected.isNil then exit(nil); // Warning: TTreeNode.StateIndex is usually made for the images...it's not a tag case Tree.Selected.StateIndex of diff --git a/src/u_controls.pas b/src/u_controls.pas index d0919ce7..4b940b9a 100644 --- a/src/u_controls.pas +++ b/src/u_controls.pas @@ -371,7 +371,7 @@ begin exit; pge := TDexedPage(fPages[index]); - if (fSplittedPageIndex = -1) or (index = fSplittedPageIndex) then + if fSplittedPageIndex.equals(-1) or index.equals(fSplittedPageIndex) then pge.Align:=alClient; pge.Visible:=true; pge.Repaint; @@ -390,14 +390,14 @@ begin if (index < 0) then exit; - if (fSplittedPageIndex = -1) or (index = fSplittedPageIndex) then + if fSplittedPageIndex.equals(-1) or index.equals(fSplittedPageIndex) then begin hidePage(fPageIndex); fPageIndex := index; showPage(fPageIndex); fSplitter.Visible:= false; end - else if (fSplittedPageIndex <> -1) then + else if not fSplittedPageIndex.equals(-1) then begin hidePage(fPageIndex); fPageIndex := index; @@ -506,7 +506,7 @@ end; function TDexedPageControl.getSplitPage: TDexedPage; begin - if fSplittedPageIndex = -1 then + if fSplittedPageIndex.equals(-1) then exit(nil) else exit(getPage(fSplittedPageIndex)); diff --git a/src/u_d2synpresets.pas b/src/u_d2synpresets.pas index 9fc13293..0c55520d 100644 --- a/src/u_d2synpresets.pas +++ b/src/u_d2synpresets.pas @@ -758,7 +758,7 @@ procedure TD2SynPresetsLoaderForm.btnCloneClick(sender: TObject); var old: TD2SynPreset; begin - if fList.ItemIndex = -1 then + if fList.ItemIndex.equals(-1) then exit; old := fPresets[fList.ItemIndex]; btnAddClick(nil); @@ -789,7 +789,7 @@ procedure TD2SynPresetsLoaderForm.updateEditor; var p: TD2SynPreset; begin - if fList.ItemIndex = -1 then + if fList.ItemIndex.equals(-1) then exit; p := fPresets[fList.ItemIndex]; fEditor.Color := p.background; diff --git a/src/u_dcd.pas b/src/u_dcd.pas index 7dce49be..430a4dfa 100644 --- a/src/u_dcd.pas +++ b/src/u_dcd.pas @@ -241,7 +241,7 @@ begin for i := 0 to fProj.importsPathCount-1 do begin fold := fProj.importPath(i); - if fold.dirExists and (folds.IndexOf(fold) = -1) then + if fold.dirExists and folds.IndexOf(fold).equals(-1) then folds.Add(fold); end; addImportFolders(folds); @@ -628,7 +628,7 @@ begin processOutputToStrings(fClient, fTempLines); while fClient.Running do ; len := fTempLines.Count-1; - if len = -1 then + if len.equals(-1) then updateServerlistening; for i := 0 to len do begin @@ -678,7 +678,7 @@ begin if str.isNotEmpty then begin i := Pos(#9, str); - if i = -1 then + if i.equals(-1) then exit; loc := str[i+1..str.length]; fname := TrimFilename(str[1..i-1]); diff --git a/src/u_dlang.pas b/src/u_dlang.pas index f8d6d51b..208e7601 100644 --- a/src/u_dlang.pas +++ b/src/u_dlang.pas @@ -1082,7 +1082,7 @@ begin continue; p += byte(t^.Data = ')'); p -= byte(t^.Data = '('); - if p = -1 then + if p.equals(-1) then begin result := t^.position; result.x += 2; @@ -1111,7 +1111,7 @@ begin continue; p += byte(t^.Data = ')'); p -= byte(t^.Data = '('); - if p = -1 then + if p.equals(-1) then break; end; p := 0; @@ -1278,7 +1278,7 @@ begin itm := '' else if (tok^.Data = ';') or (tok^.Data = ':') or (tok^.Data = ',') then begin - if (length(itm) <> 0) and (imports.IndexOf(itm) = -1) then + if not length(itm).equals(0) and imports.IndexOf(itm).equals(-1) then imports.Add(itm); itm := ''; if (tok^.Data = ';') or (tok^.Data = ':') then diff --git a/src/u_dmdwrap.pas b/src/u_dmdwrap.pas index dcb9e318..2e45c927 100644 --- a/src/u_dmdwrap.pas +++ b/src/u_dmdwrap.pas @@ -924,7 +924,7 @@ begin list.Add('-gc'); if fGenMap then list.Add('-map'); - if fGenFrame and (list.IndexOf('-gs') = -1) then + if fGenFrame and list.IndexOf('-gs').equals(-1) then list.Add('-gs'); end else begin @@ -946,7 +946,7 @@ begin list.Add('-gc'); if baseopt.fGenMap or fGenMap then list.Add('-map'); - if (baseopt.fGenFrame or fGenFrame) and (list.IndexOf('-gs') = -1) then + if (baseopt.fGenFrame or fGenFrame) and list.IndexOf('-gs').equals(-1) then list.Add('-gs'); end; end; diff --git a/src/u_gdb.pas b/src/u_gdb.pas index 97b1ee9b..40219be0 100644 --- a/src/u_gdb.pas +++ b/src/u_gdb.pas @@ -1544,7 +1544,7 @@ begin if (fDoc.fileName <> newdocPageCaption) then begin fSynchronizingBreakpoints:= true; - if fSynchronizedDocuments.IndexOf(document.fileName) = -1 then + if fSynchronizedDocuments.IndexOf(document.fileName).equals(-1) then begin fSynchronizedDocuments.Add(document.fileName); for i:= 0 to fBreakPoints.count-1 do @@ -2941,7 +2941,7 @@ const var nme: string; begin - if lstVariables.ItemIndex = -1 then + if lstVariables.ItemIndex.equals(-1) then exit; nme := lstVariables.Items[lstVariables.ItemIndex].Caption; gdbCommand(cmd[fAddWatchPointKind] + nme); @@ -2997,7 +2997,7 @@ begin exit; lne := StrToIntDef(lstThreads.Selected.SubItems[5], -1); nme := lstThreads.Selected.SubItems[4]; - if not nme.fileExists or (lne = -1) then + if not nme.fileExists or lne.equals(-1) then exit; fDocHandler.openDocument(nme); doc := fDocHandler.findDocument(nme); @@ -3061,7 +3061,7 @@ begin cmd := edit1.Text; if cmd.isEmpty then exit; - if edit1.Items.IndexOf(cmd) = -1 then + 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 diff --git a/src/u_libman.pas b/src/u_libman.pas index c30df69d..05385aa9 100644 --- a/src/u_libman.pas +++ b/src/u_libman.pas @@ -523,7 +523,7 @@ procedure TLibraryManager.getLibFiles(aliases, list: TStrings); if (x = 'app.d') or (x = 'main.d') then continue; e := f.extractFileExt; - if ((e = libExt) or (e = '.d')) and (list.IndexOf(f) = -1) then + if ((e = libExt) or (e = '.d')) and list.IndexOf(f).equals(-1) then list.Add(f); end; finally @@ -669,7 +669,7 @@ begin if b.isNotNil and b.enabled then begin s := b.libFile; - if (opts.IndexOf(s) = -1) and (not s.isEmpty) then + if opts.IndexOf(s).equals(-1) and not s.isEmpty then begin opts.Add(s); opts.Add('-I' + b.libSourcePath); diff --git a/src/u_main.pas b/src/u_main.pas index de41f89e..dbd639de 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -1101,7 +1101,7 @@ begin grp := getProjectGroup; if fProjectGroup.isNotEmpty and fProjectGroup.fileExists then grp.openGroup(fProjectGroup); - if (fProjectIndex = -1) and assigned(dst.fFreeProj) then + if fProjectIndex.equals(-1) and assigned(dst.fFreeProj) then dst.fFreeProj.activate else if (fProjectIndex >= 0) and (grp.projectCount > 0) and (fProjectIndex < grp.projectCount) then diff --git a/src/u_miniexplorer.pas b/src/u_miniexplorer.pas index c54facd2..46baf677 100644 --- a/src/u_miniexplorer.pas +++ b/src/u_miniexplorer.pas @@ -731,7 +731,7 @@ procedure TMiniExplorerWidget.lstFilesFileAdded(Sender: TObject; Item: TListItem); begin Item.ImageIndex:=0; - if lstFiles.SortColumn = -1 then + if lstFiles.SortColumn.equals(-1) then lstFIles.SortColumn := 0; lstFiles.Sort; end; diff --git a/src/u_projgroup.pas b/src/u_projgroup.pas index 87862ff8..6058474a 100644 --- a/src/u_projgroup.pas +++ b/src/u_projgroup.pas @@ -667,7 +667,7 @@ procedure TProjectGroupWidget.btnAsyncClick(Sender: TObject); var prj: TProjectGroupItem; begin - if lstProj.ItemIndex = -1 then + if lstProj.ItemIndex.equals(-1) then exit; prj := projectGroup.item[lstProj.ItemIndex]; case prj.asyncMode of @@ -679,7 +679,7 @@ end; procedure TProjectGroupWidget.btnMoveDownClick(Sender: TObject); begin - if (lstProj.ItemIndex = -1) or (lstProj.ItemIndex = lstProj.Items.Count-1) then + if lstProj.ItemIndex.equals(-1) or lstProj.ItemIndex.equals(lstProj.Items.Count-1) then exit; projectGroup.items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex + 1); lstProj.Items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex + 1); @@ -699,7 +699,7 @@ end; procedure TProjectGroupWidget.btnRemProjClick(Sender: TObject); begin - if lstProj.ItemIndex = -1 then + if lstProj.ItemIndex.equals(-1) then exit; projectGroup.items.Delete(lstProj.Selected.Index); updateList; @@ -707,7 +707,7 @@ end; procedure TProjectGroupWidget.lstProjDblClick(Sender: TObject); begin - if lstProj.ItemIndex = -1 then + if lstProj.ItemIndex.equals(-1) then exit; TProjectGroupItem(lstProj.Selected.Data).lazyLoad; subjProjFocused(fProjSubj, TProjectGroupItem(lstProj.Selected.Data).project); @@ -737,7 +737,7 @@ var asc: TProjectAsyncMode; begin idx := lstProj.ItemIndex; - if idx = -1 then + if idx.equals(-1) then begin btnMoveDown.Enabled:= false; btnMoveUp.Enabled:= false; @@ -746,8 +746,8 @@ begin end else begin - btnMoveDown.Enabled:= idx <> projectGroup.projectCount-1; - btnMoveUp.Enabled:= idx <> 0; + btnMoveDown.Enabled:= not idx.equals(projectGroup.projectCount-1); + btnMoveUp.Enabled:= not idx.equals(0); btnRemProj.Enabled:= true; btnAsync.Enabled:= true; asc := projectGroup.item[idx].asyncMode; diff --git a/src/u_projinspect.pas b/src/u_projinspect.pas index cb148002..9b3e09ef 100644 --- a/src/u_projinspect.pas +++ b/src/u_projinspect.pas @@ -524,7 +524,7 @@ begin proj := TNativeProject(fProj.getProject); fname := Tree.Selected.Text; i := proj.Sources.IndexOf(fname); - if i = -1 then + if i.equals(-1) then exit; fname := fProj.sourceAbsolute(i); dir := fname.extractFilePath; diff --git a/src/u_synmemo.pas b/src/u_synmemo.pas index c097278e..c693396b 100644 --- a/src/u_synmemo.pas +++ b/src/u_synmemo.pas @@ -838,7 +838,7 @@ begin // - CollapsedLineForFoldAtLine() does not handle the sub-folding. // - TextView visibility is increased so this is not the standard way of getting the infos. start := fMemo.TextView.CollapsedLineForFoldAtLine(i); - if start = -1 then + if start.equals(-1) then continue; if start = prev then continue; @@ -1765,7 +1765,7 @@ begin exit; leftTokIndex := getIndexOfTokenLeftTo(fLexToks, CaretXY); - if (leftTokIndex = -1) or (leftTokIndex >= fLexToks.Count) then + if leftTokIndex.equals(-1) or (leftTokIndex >= fLexToks.Count) then exit; // goto previous opened brace @@ -1774,7 +1774,7 @@ begin f := fLexToks[i]; b += Byte((f^.kind = ltkSymbol) and (f^.Data[1] = '}')); b -= Byte((f^.kind = ltkSymbol) and (f^.Data[1] = '{')); - if b = -1 then + if b.equals(-1) then break; end; // retrieve the indent of the opened brace @@ -2081,7 +2081,7 @@ begin for i:= high(locs) downto 0 do begin loc := locs[i]; - if loc = -1 then + if loc.equals(-1) then continue; BeginUndoBlock; SelStart := loc + 1; diff --git a/src/u_toolseditor.pas b/src/u_toolseditor.pas index c9563299..c37de8cb 100644 --- a/src/u_toolseditor.pas +++ b/src/u_toolseditor.pas @@ -94,14 +94,14 @@ end; procedure TToolsEditorWidget.lstToolsSelectionChange(Sender: TObject; User: boolean); begin - if lstTools.ItemIndex = -1 then + if lstTools.ItemIndex.equals(-1) then exit; propsEd.TIObject := CustomTools[lstTools.ItemIndex]; end; procedure TToolsEditorWidget.propsEdModified(Sender: TObject); begin - if propsEd.ItemIndex = -1 then + if propsEd.ItemIndex.equals(-1) then exit; case propsEd.Rows[propsEd.ItemIndex].Name of 'toolAlias': updateToolList; @@ -123,7 +123,7 @@ procedure TToolsEditorWidget.btnCloneClick(Sender: TObject); var itm: TToolItem; begin - if lstTools.ItemIndex = -1 then + if lstTools.ItemIndex.equals(-1) then exit; itm := CustomTools.addTool; @@ -159,7 +159,7 @@ procedure TToolsEditorWidget.btnKillClick(Sender: TObject); var p: TDexedProcess; begin - if lstTools.ItemIndex = -1 then + if lstTools.ItemIndex.equals(-1) then exit; p := CustomTools.tool[lstTools.ItemIndex].process; @@ -169,7 +169,7 @@ end; procedure TToolsEditorWidget.btnRemToolClick(Sender: TObject); begin - if lstTools.ItemIndex = -1 then + if lstTools.ItemIndex.equals(-1) then exit; clearInspector; @@ -190,7 +190,7 @@ end; procedure TToolsEditorWidget.btnMoveDownClick(Sender: TObject); begin - if (lstTools.ItemIndex = -1) or (lstTools.ItemIndex = lstTools.Items.Count-1) then + if lstTools.ItemIndex.equals(-1) or lstTools.ItemIndex.equals(lstTools.Items.Count-1) then exit; CustomTools.tools.Exchange(lstTools.ItemIndex, lstTools.ItemIndex + 1); @@ -200,7 +200,7 @@ end; procedure TToolsEditorWidget.executeSelectedTool; begin - if lstTools.ItemIndex = -1 then + if lstTools.ItemIndex.equals(-1) then exit; CustomTools.executeTool(lstTools.ItemIndex);