From e6e0dc6215b76c4e0047b81894b73225da819543 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 5 Feb 2019 19:08:09 +0100 Subject: [PATCH] style, remove all occurences of `then\ [a-z,A-Z]` --- src/u_ceproject.pas | 59 ++++--- src/u_ceprojeditor.pas | 92 ++++++----- src/u_common.pas | 15 +- src/u_controls.pas | 3 +- src/u_d2syn.pas | 102 +++++++----- src/u_dcd.pas | 15 +- src/u_dfmt.pas | 4 +- src/u_dlang.pas | 18 ++- src/u_dmdwrap.pas | 348 ++++++++++++++++++++++++++-------------- src/u_dubproject.pas | 22 ++- src/u_dubprojeditor.pas | 25 +-- src/u_editor.pas | 24 +-- src/u_editoroptions.pas | 36 +++-- src/u_infos.pas | 5 +- src/u_inspectors.pas | 9 +- src/u_lcldragdrop.pas | 9 +- src/u_libman.pas | 3 +- src/u_libmaneditor.pas | 3 +- src/u_main.pas | 38 +++-- src/u_messages.pas | 16 +- src/u_optionseditor.pas | 53 +++--- src/u_processes.pas | 6 +- src/u_procinput.pas | 12 +- src/u_projgroup.lfm | 2 +- src/u_projgroup.pas | 22 +-- src/u_search.pas | 40 +++-- src/u_symlist.pas | 13 +- src/u_synmemo.pas | 30 ++-- src/u_todolist.pas | 6 +- src/u_tools.pas | 18 +-- src/u_widget.lfm | 1 + src/u_widget.pas | 13 +- 32 files changed, 660 insertions(+), 402 deletions(-) diff --git a/src/u_ceproject.pas b/src/u_ceproject.pas index 76b0a65c..78930aae 100644 --- a/src/u_ceproject.pas +++ b/src/u_ceproject.pas @@ -237,9 +237,12 @@ begin expand := fBasePath.dirExists; for relSrc in fSrcs do begin - if not expand then absSrc := relSrc - else absSrc := expandFilenameEx(fBasePath, relsrc); - if SameFileName(fname, absSrc) then exit; + if not expand then + absSrc := relSrc + else + absSrc := expandFilenameEx(fBasePath, relsrc); + if SameFileName(fname, absSrc) then + exit; end; relSrc := ExtractRelativePath(fBasePath, fname); fSrcs.Add(relSrc); @@ -247,7 +250,8 @@ end; procedure TNativeProject.setRoot(const value: string); begin - if fRootFolder = value then exit; + if fRootFolder = value then + exit; beginUpdate; fRootFolder := value; endUpdate; @@ -457,7 +461,8 @@ var rel: string; lst: TStringList; begin - if fConfIx = -1 then exit; + if fConfIx = -1 then + exit; exc := TStringList.Create; try cfg := currentConfiguration; @@ -471,7 +476,8 @@ begin for rel in fSrcs do if rel <> '' then opts.Add(expandFilenameEx(fBasePath, rel)); // note: process.inc ln 249. double quotes are added if there's a space. // exclusions - if exc.Count > 0 then with TRegExpr.Create do + if exc.Count > 0 then + with TRegExpr.Create do try for str in exc do begin @@ -574,15 +580,18 @@ var src: string; i: Integer; begin - if fSrcs.Count = 0 then exit; + if fSrcs.Count = 0 then + exit; allMissing := true; for i:= 0 to fSrcs.Count-1 do if sourceAbsolute(i).fileExists then allMissing := false; - if not allMissing then exit; + if not allMissing then + exit; if dlgYesNo( 'The project source(s) are all missing. ' + LineEnding + 'This can be encountered if the project file has been moved from its original location.' + LineEnding + LineEnding + - 'Do you wish to select the new root folder ?') <> mrYes then exit; + 'Do you wish to select the new root folder ?') <> mrYes then + exit; // TODO-cimprovement: use commonFolder() when it'll be compat. with the rel. paths. // hint for the common dir dirHint := fSrcs[i]; @@ -611,12 +620,14 @@ var for i:= fSrcs.Count-1 downto 0 do begin oldsrc := sourceAbsolute(i); - if oldsrc.fileExists then continue; + if oldsrc.fileExists then + continue; if dlgYesNo(format('a particular project source file ("%s") is missing. ' + LineEnding + 'This happends if a source file has been moved, renamed ' + 'or deleted.' + LineEnding + LineEnding + - 'Do you wish to select its new location?', [fSrcs[i]])) <> mrYes then exit; - // + 'Do you wish to select its new location?', [fSrcs[i]])) <> mrYes then + exit; + opendlg := TOpenDialog.Create(nil); try opendlg.InitialDir := fFilename.extractFilePath; @@ -723,11 +734,15 @@ begin ext := fOutputFilename.extractFileExt; case currentConfiguration.outputOptions.binaryKind of {$IFDEF WINDOWS} - executable: if ext <> exeExt then fOutputFilename += exeExt; + executable: if ext <> exeExt then + fOutputFilename += exeExt; {$ENDIF} - staticlib: if ext <> libExt then fOutputFilename += libExt; - sharedlib: if ext <> dynExt then fOutputFilename += dynExt; - obj: if ext <> dynExt then fOutputFilename += objExt; + staticlib: if ext <> libExt then + fOutputFilename += libExt; + sharedlib: if ext <> dynExt then + fOutputFilename += dynExt; + obj: if ext <> dynExt then + fOutputFilename += objExt; end; end; // @@ -984,10 +999,12 @@ var i: integer; begin result := false; - if not fOutputFilename.fileExists then exit; + if not fOutputFilename.fileExists then + exit; dt := FileAge(fOutputFilename); for i := 0 to fSrcs.Count-1 do - if fileAge(sourceAbsolute(i)) > dt then exit; + if fileAge(sourceAbsolute(i)) > dt then + exit; result := true; end; @@ -1013,8 +1030,10 @@ end; function TNativeProject.configurationName(index: integer): string; begin - if index > fConfigs.Count -1 then index := fConfigs.Count -1; - if index < 0 then index := 0; + if index > fConfigs.Count -1 then + index := fConfigs.Count -1; + if index < 0 then + index := 0; result := getConfig(index).name; end; diff --git a/src/u_ceprojeditor.pas b/src/u_ceprojeditor.pas index 5fcaf5b0..82237b7e 100644 --- a/src/u_ceprojeditor.pas +++ b/src/u_ceprojeditor.pas @@ -89,7 +89,8 @@ end; procedure TProjectConfigurationWidget.SetVisible(value: boolean); begin inherited; - if Visible then updateImperative; + if Visible then + updateImperative; end; {$ENDREGION --------------------------------------------------------------------} @@ -101,16 +102,16 @@ begin if project.getFormat <> pfDEXED then exit; enabled := true; - // + fProj := TNativeProject(project.getProject); - if Visible then updateImperative; + if Visible then + updateImperative; syncroMode := false; end; procedure TProjectConfigurationWidget.projClosing(project: ICommonProject); begin - if fProj.isNil then exit; - if fProj <> project.getProject then + if fProj.isNil or (fProj <> project.getProject) then exit; inspector.TIObject := nil; inspector.ItemIndex := -1; @@ -122,10 +123,10 @@ end; procedure TProjectConfigurationWidget.projChanged(project: ICommonProject); begin - if fProj.isNil then exit; - if fProj <> project.getProject then + if fProj.isNil or (fProj <> project.getProject) then exit; - if Visible then updateImperative; + if Visible then + updateImperative; end; procedure TProjectConfigurationWidget.projFocused(project: ICommonProject); @@ -135,9 +136,9 @@ begin if project.getFormat <> pfDEXED then exit; enabled := true; - // fProj := TNativeProject(project.getProject); - if Visible then updateImperative; + if Visible then + updateImperative; end; procedure TProjectConfigurationWidget.projCompiling(project: ICommonProject); @@ -152,10 +153,13 @@ end; {$REGION config. things --------------------------------------------------------} procedure TProjectConfigurationWidget.selConfChange(Sender: TObject); begin - if fProj.isNil then exit; - if Updating then exit; - if selConf.ItemIndex = -1 then exit; - // + if fProj.isNil then + exit; + if Updating then + exit; + if selConf.ItemIndex = -1 then + exit; + beginImperativeUpdate; fProj.ConfigurationIndex := selConf.ItemIndex; endImperativeUpdate; @@ -184,7 +188,8 @@ var i: Integer; begin i := fSynchroItem.IndexOf(Item); - if i = -1 then exit(''); + if i = -1 then + exit(''); result := fSynchroValue[i]; end; @@ -203,11 +208,15 @@ var trg_obj: TPersistent; i: Integer; begin - if fProj.isNil then exit; - if not fSyncroMode then exit; - if inspector.TIObject.isNil then exit; - if inspector.ItemIndex = -1 then exit; - // + if fProj.isNil then + exit; + if not fSyncroMode then + exit; + if inspector.TIObject.isNil then + exit; + if inspector.ItemIndex = -1 then + exit; + storage := nil; src_prop:= nil; trg_prop:= nil; @@ -220,13 +229,15 @@ begin fProj.beginUpdate; try src_prop := src_list.Find(propstr); - if src_prop = nil then exit; + if src_prop = nil then + exit; storage.AObject := getGridTarget; storage.StoreAnyProperty(src_prop); for i:= 0 to fProj.OptionsCollection.Count-1 do begin // skip current config - if i = fProj.ConfigurationIndex then continue; + if i = fProj.ConfigurationIndex then + continue; // find target persistent if inspector.TIObject = fProj.currentConfiguration.messagesOptions then trg_obj := fProj.configuration[i].messagesOptions else @@ -273,22 +284,23 @@ var nme: string; cfg: TCompilerConfiguration; begin - if fProj.isNil then exit; - // + if fProj.isNil then + exit; nme := ''; beginImperativeUpdate; cfg := fProj.addConfiguration; // note: Cancel is actually related to the conf. name not to the add operation. - if InputQuery('Configuration name', '', nme) then cfg.name := nme; + if InputQuery('Configuration name', '', nme) then + cfg.name := nme; fProj.ConfigurationIndex := cfg.Index; endImperativeUpdate; end; procedure TProjectConfigurationWidget.btnDelConfClick(Sender: TObject); begin - if fProj.isNil then exit; - if fProj.OptionsCollection.Count = 1 then exit; - // + if fProj.isNil or (fProj.OptionsCollection.Count = 1) then + exit; + beginImperativeUpdate; inspector.TIObject := nil; inspector.Clear; @@ -303,15 +315,16 @@ var nme: string; trg, src: TCompilerConfiguration; begin - if fProj.isNil then exit; - // + if fProj.isNil then + exit; nme := ''; beginImperativeUpdate; fProj.beginUpdate; src := fProj.currentConfiguration; trg := fProj.addConfiguration; trg.assign(src); - if InputQuery('Configuration name', '', nme) then trg.name := nme; + if InputQuery('Configuration name', '', nme) then + trg.name := nme; fProj.ConfigurationIndex := trg.Index; fProj.endUpdate; endImperativeUpdate; @@ -321,15 +334,16 @@ procedure TProjectConfigurationWidget.btnSyncEditClick(Sender: TObject); begin fSynchroValue.Clear; fSynchroItem.Clear; - if fProj.isNil then exit; + if fProj.isNil then + exit; syncroMode := not syncroMode; end; procedure TProjectConfigurationWidget.GridFilter(Sender: TObject; aEditor: TPropertyEditor; var aShow: boolean); begin - if fProj.isNil then exit; - + if fProj.isNil then + exit; // filter TComponent things. if getGridTarget = fProj then begin @@ -371,9 +385,8 @@ end; function TProjectConfigurationWidget.getGridTarget: TPersistent; begin - if fProj.isNil then exit(nil); - if fProj.ConfigurationIndex = -1 then exit(nil); - if Tree.Selected.isNil then exit(nil); + if fProj.isNil or (fProj.ConfigurationIndex = -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 1: exit( fProj ); @@ -398,8 +411,9 @@ begin selConf.ItemIndex:= -1; selConf.Clear; selconf.Enabled := (inspector.TIObject <> fProj) and fProj.isNotNil; - if fProj.isNil then exit; - // + if fProj.isNil then + exit; + for i:= 0 to fProj.OptionsCollection.Count-1 do selConf.Items.Add(fProj.configuration[i].name); selConf.ItemIndex := fProj.ConfigurationIndex; diff --git a/src/u_common.pas b/src/u_common.pas index b67ba637..cc566024 100644 --- a/src/u_common.pas +++ b/src/u_common.pas @@ -236,7 +236,7 @@ type function exeFullName(fname: string): string; (** - * Clears then fills aList with aProcess output stream. + * Clears and fills aList with aProcess output stream. *) procedure processOutputToStrings(process: TProcess; list: TStrings); @@ -812,7 +812,7 @@ begin try repeat tryAdd; - if recursive then if isFolder(sr) then + if recursive and isFolder(sr) then listFiles(list, path + directorySeparator + sr.Name, recursive); until findNext(sr) <> 0; @@ -869,8 +869,9 @@ begin pth := path[1..path.length-1]; if pth[pth.length] in ['/', '\'] then pth := pth[1..pth.length-1]; - if not pth.dirExists then exit(false); - // + if not pth.dirExists then + exit(false); + files := TStringList.Create; try listFiles(files, pth, true); @@ -1132,7 +1133,8 @@ var cnt: integer; begin result := ''; - if files.Count = 0 then exit; + if files.Count = 0 then + exit; sink := TStringList.Create; try sink.Assign(files); @@ -1360,7 +1362,8 @@ var str: string = ''; begin if (proc.ExitStatus <> 0) and (poUsePipes in proc.Options) and not - (poStderrToOutPut in proc.Options) then with TStringList.Create do + (poStderrToOutPut in proc.Options) then + with TStringList.Create do try LoadFromStream(proc.Stderr); Insert(0, format('%s crashed with code: %d', diff --git a/src/u_controls.pas b/src/u_controls.pas index 1d878828..cc2b1c14 100644 --- a/src/u_controls.pas +++ b/src/u_controls.pas @@ -347,7 +347,8 @@ end; procedure TDexedPageControl.tabsChanging(Sender: TObject; var AllowChange: Boolean); begin - if assigned(fOnChanging) then fOnChanging(self, AllowChange); + if assigned(fOnChanging) then + fOnChanging(self, AllowChange); end; procedure TDexedPageControl.hidePage(index: integer); diff --git a/src/u_d2syn.pas b/src/u_d2syn.pas index 42e800d6..c0564efc 100644 --- a/src/u_d2syn.pas +++ b/src/u_d2syn.pas @@ -141,13 +141,16 @@ const begin result := inherited Compare(range); assert(range <> nil); - if result <> 0 then exit; - // + if result <> 0 then + exit; + if range is TSynD2SynRange then begin src_t := TSynD2SynRange(range); - if src_t.rangeKinds <> rangeKinds then exit(1); - if src_t.rString <> rString then exit(1); + if src_t.rangeKinds <> rangeKinds then + exit(1); + if src_t.rString <> rString then + exit(1); if src_t.nestedCommentsCount <> nestedCommentsCount then exit(cmpRes[src_t.nestedCommentsCount > nestedCommentsCount]); if src_t.namedRegionCount <> namedRegionCount then @@ -421,17 +424,18 @@ begin fTokStop := fTokStart; // EOL - if fTokStop > length(fLineBuf) then exit; + if fTokStop > length(fLineBuf) then + exit; readerReset; // script line - if LineIndex = 0 then if fTokStart = 1 then - if readDelim(reader, fTokStop, '#!') then - begin - fTokKind := tkCommt; - readLine(reader, fTokStop); - exit; - end else readerReset; + if (LineIndex = 0) and (fTokStart = 1) and readDelim(reader, fTokStop, '#!') then + begin + fTokKind := tkCommt; + readLine(reader, fTokStop); + exit; + end + else readerReset; // spaces if (isWhite(reader^)) then @@ -449,8 +453,8 @@ begin fCurrRange := TSynD2SynRange.Create(nil); // line comments / region beg-end - if (fCurrRange.rangeKinds = []) or (fCurrRange.rangeKinds = [rkAsm]) - then if readDelim(reader, fTokStop, '//') then + if (fCurrRange.rangeKinds = []) or (fCurrRange.rangeKinds = [rkAsm]) then + if readDelim(reader, fTokStop, '//') then begin fTokKind := tkCommt; if readDelim(reader, fTokStop, '/') then @@ -486,8 +490,10 @@ begin begin fTokKind := tkCommt; if readDelim(reader, fTokStop, '*') then - if readDelim(reader, fTokStop, '/') then exit - else fTokKind := tkDDocs; + if readDelim(reader, fTokStop, '/') then + exit + else + fTokKind := tkDDocs; if readUntil(reader, fTokStop, '*/') then exit; if fTokKind = tkDDocs then @@ -503,8 +509,10 @@ begin end else readerReset; if (rkBlockCom1 in fCurrRange.rangeKinds) or (rkBlockDoc1 in fCurrRange.rangeKinds) then begin - if (rkBlockDoc1 in fCurrRange.rangeKinds) then fTokKind := tkDDocs - else fTokKind := tkCommt; + if (rkBlockDoc1 in fCurrRange.rangeKinds) then + fTokKind := tkDDocs + else + fTokKind := tkCommt; if readUntil(reader, fTokStop, '*/') then begin if (fTokKind = tkCommt) then @@ -565,8 +573,10 @@ begin end else readerReset; if (rkBlockCom2 in fCurrRange.rangeKinds) or (rkBlockDoc2 in fCurrRange.rangeKinds) then begin - if (rkBlockDoc2 in fCurrRange.rangeKinds) then fTokKind := tkDDocs - else fTokKind := tkCommt; + if (rkBlockDoc2 in fCurrRange.rangeKinds) then + fTokKind := tkDDocs + else + fTokKind := tkCommt; while (reader^ <> #10) and (fCurrRange.nestedCommentsCount > 0) do begin if readUntilAmong(reader, fTokStop, ['+', '/']) then @@ -616,13 +626,15 @@ begin fTokKind := tkStrng; while(true) do begin - if not readUntilAmong(reader, fTokStop, stringStopChecks) then break; + if not readUntilAmong(reader, fTokStop, stringStopChecks) then + break; if (reader^ = '\') then begin readerNext; if reader^ <> #10 then begin - if fCurrRange.rString then continue; + if fCurrRange.rString then + continue; readerNext; end; end @@ -643,13 +655,15 @@ begin fTokKind := tkStrng; while(true) do begin - if not readUntilAmong(reader, fTokStop, stringStopChecks) then break; + if not readUntilAmong(reader, fTokStop, stringStopChecks) then + break; if reader^ = '\' then begin readerNext; if reader^ <> #10 then begin - if fCurrRange.rString then continue; + if fCurrRange.rString then + continue; readerNext; end; end @@ -728,7 +742,8 @@ begin end else readerReset; // bin & hex literals - if reader^ = '0' then if readerNext^ in ['b','B', 'x', 'X'] then + if reader^ = '0' then + if readerNext^ in ['b','B', 'x', 'X'] then begin fTokKind:= tkNumbr; readerNext; @@ -736,18 +751,18 @@ begin readWhile(reader, fTokStop, ['0','1','_']) else readWhile(reader, fTokStop, hexaChars + ['.']); - // exponent, sign tokenized later as op then value as number + // exponent, sign tokenized later as op and the value as number if reader^ in ['P','p'] then begin readerNext; exit; end; - if not tryReadDelim(reader, fTokStop, 'uL') - then if not tryReadDelim(reader, fTokStop, 'UL') - then if not tryReadDelim(reader, fTokStop, 'Lu') - then if not tryReadDelim(reader, fTokStop, 'LU') - then if reader^ in ['U', 'L', 'u', 'i'] then - readerNext; + if not tryReadDelim(reader, fTokStop, 'uL') + and not tryReadDelim(reader, fTokStop, 'UL') + and not tryReadDelim(reader, fTokStop, 'Lu') + and not tryReadDelim(reader, fTokStop, 'LU') + and (reader^ in ['U', 'L', 'u', 'i']) then + readerNext; if not isWhite(reader^) and not isOperator1(reader^) and not isSymbol(reader^) then begin @@ -801,22 +816,22 @@ begin end; readerPrev; end; - // exponent, sign tokenized later as op then value as number + // exponent, sign tokenized later as op and the value as number if reader^ in ['E','e'] then begin readerNext; exit; end; // try valid suffixes - if not tryReadDelim(reader, fTokStop, 'uL') - then if not tryReadDelim(reader, fTokStop, 'UL') - then if not tryReadDelim(reader, fTokStop, 'Lu') - then if not tryReadDelim(reader, fTokStop, 'LU') - then if not tryReadDelim(reader, fTokStop, 'fi') - then if not tryReadDelim(reader, fTokStop, 'Fi') - then if not tryReadDelim(reader, fTokStop, 'Li') - then if reader^ in ['U','L','u', 'i', 'f','F'] then - readerNext; + if not tryReadDelim(reader, fTokStop, 'uL') + and not tryReadDelim(reader, fTokStop, 'UL') + and not tryReadDelim(reader, fTokStop, 'Lu') + and not tryReadDelim(reader, fTokStop, 'LU') + and not tryReadDelim(reader, fTokStop, 'fi') + and not tryReadDelim(reader, fTokStop, 'Fi') + and not tryReadDelim(reader, fTokStop, 'Li') + and (reader^ in ['U','L','u', 'i', 'f','F']) then + readerNext; if not isWhite(reader^) and not isOperator1(reader^) and (not isSymbol(reader^) or (reader^ = '.')) then begin @@ -952,7 +967,8 @@ begin exit; end; - if fLineBuf[fTokStop] = #10 then exit; + if fLineBuf[fTokStop] = #10 then + exit; readUntilAmong(reader, fTokStop, [#9, #10, ' ']); fTokKind := tkError; diff --git a/src/u_dcd.pas b/src/u_dcd.pas index 2e955977..fb43d01d 100644 --- a/src/u_dcd.pas +++ b/src/u_dcd.pas @@ -297,12 +297,14 @@ end; procedure TDcdWrapper.docChanged(document: TDexedMemo); begin - if fDoc <> document then exit; + if fDoc <> document then + exit; end; procedure TDcdWrapper.docClosing(document: TDexedMemo); begin - if fDoc <> document then exit; + if fDoc <> document then + exit; fDoc := nil; end; {$ENDREGION} @@ -510,7 +512,8 @@ begin updateServerlistening; exit; end; - if not (fTempLines[0] = 'calltips') then exit; + if not (fTempLines[0] = 'calltips') then + exit; fTempLines.Delete(0); tips := fTempLines.Text; @@ -561,7 +564,8 @@ begin updateServerlistening; exit; end; - if not (fTempLines[0] = 'identifiers') then exit; + if not (fTempLines[0] = 'identifiers') then + exit; list.Clear; for i := 1 to fTempLines.Count-1 do @@ -607,7 +611,8 @@ begin exit; i := fDoc.MouseBytePosition; - if i = 0 then exit; + if i = 0 then + exit; terminateClient; fClient.Parameters.Clear; diff --git a/src/u_dfmt.pas b/src/u_dfmt.pas index 23e89673..e4fdde74 100644 --- a/src/u_dfmt.pas +++ b/src/u_dfmt.pas @@ -244,8 +244,8 @@ end; procedure TDfmtWidget.docFocused(document: TDexedMemo); begin - if document = fDoc - then exit; + if document = fDoc then + exit; fDoc := document; end; diff --git a/src/u_dlang.pas b/src/u_dlang.pas index 8b9311e0..910b6b93 100644 --- a/src/u_dlang.pas +++ b/src/u_dlang.pas @@ -344,7 +344,8 @@ var begin - if text = '' then exit; + if text = '' then + exit; noComment := lxoNoComments in Options; @@ -684,7 +685,8 @@ begin else if (expSet) then while reader.Next^ in ['0'..'9', '_'] do identifier += reader.head^; - if not expSet then expSet:= reader.head^ in ['p','P']; + if not expSet then + expSet:= reader.head^ in ['p','P']; if (expSet) then while reader.Next^ in ['0'..'9', '_'] do identifier += reader.head^; @@ -771,8 +773,10 @@ begin identifier += reader.head^; end; expSet := reader.head^ in ['e','E']; - if expSet then identifier += reader.head^; - if decSet then while isNumber(reader.Next^) or (reader.head^ = '_') do + if expSet then + identifier += reader.head^; + if decSet then + while isNumber(reader.Next^) or (reader.head^ = '_') do begin if isOutOfBound then exit; @@ -781,9 +785,11 @@ begin if not expSet then begin expSet := reader.head^ in ['e','E']; - if expSet then identifier += reader.head^; + if expSet then + identifier += reader.head^; end; - if expSet then while isNumber(reader.Next^) or (reader.head^ = '_') do + if expSet then + while isNumber(reader.Next^) or (reader.head^ = '_') do begin if isOutOfBound then exit; diff --git a/src/u_dmdwrap.pas b/src/u_dmdwrap.pas index 0359e4bd..99865fd5 100644 --- a/src/u_dmdwrap.pas +++ b/src/u_dmdwrap.pas @@ -393,7 +393,8 @@ end; procedure TOptsGroup.doChanged; begin - if assigned(fOnChange) then fOnChange(self); + if assigned(fOnChange) then + fOnChange(self); end; {$REGION TDocOpts --------------------------------------------------------------} @@ -440,7 +441,6 @@ begin if (source is TDocOpts) then begin src := TDocOpts(source); - // fGenDoc := src.fGenDoc; fGenJson := src.fGenJson; fDocDir := patchPlateformPath(src.fDocDir); @@ -456,7 +456,6 @@ begin fGenDoc := true; exit; end; - // if fGenDoc = value then exit; fGenDoc := value; @@ -470,7 +469,6 @@ begin fGenJson := true; exit; end; - // if fGenJson = value then exit; fGenJson := value; @@ -516,27 +514,45 @@ begin if base.isNil then begin dep := DepStr[fDepHandling]; - if dep.isNotEmpty then list.Add(dep); - if fVerbose then list.Add('-v'); - if fWarnings then list.Add('-w'); - if fWarnInfo then list.Add('-wi'); - if fVtls then list.Add('-vtls'); - if fQuiet then list.Add('-quiet'); - if fVgc then list.Add('-vgc'); - if fCol then list.Add('-vcolumns'); + if dep.isNotEmpty then + list.Add(dep); + if fVerbose then + list.Add('-v'); + if fWarnings then + list.Add('-w'); + if fWarnInfo then + list.Add('-wi'); + if fVtls then + list.Add('-vtls'); + if fQuiet then + list.Add('-quiet'); + if fVgc then + list.Add('-vgc'); + if fCol then + list.Add('-vcolumns'); end else begin baseopt := TMsgOpts(base); dep := DepStr[fDepHandling]; depbase := DepStr[baseopt.fDepHandling]; - if dep <> depbase then list.Add(dep) else list.Add(depbase); - if baseopt.fVerbose or fVerbose then list.Add('-v'); - if baseopt.fWarnings or fWarnings then list.Add('-w'); - if baseopt.fWarnInfo or fWarnInfo then list.Add('-wi'); - if baseopt.fVtls or fVtls then list.Add('-vtls'); - if baseopt.fQuiet or fQuiet then list.Add('-quiet'); - if baseopt.fVgc or fVgc then list.Add('-vgc'); - if baseopt.fCol or fCol then list.Add('-vcolumns'); + if dep <> depbase then + list.Add(dep) + else + list.Add(depbase); + if baseopt.fVerbose or fVerbose then + list.Add('-v'); + if baseopt.fWarnings or fWarnings then + list.Add('-w'); + if baseopt.fWarnInfo or fWarnInfo then + list.Add('-wi'); + if baseopt.fVtls or fVtls then + list.Add('-vtls'); + if baseopt.fQuiet or fQuiet then + list.Add('-quiet'); + if baseopt.fVgc or fVgc then + list.Add('-vgc'); + if baseopt.fCol or fCol then + list.Add('-vcolumns'); end; end; @@ -562,56 +578,64 @@ end; procedure TMsgOpts.setDepHandling(const value: TDepHandling); begin - if fDepHandling = value then exit; + if fDepHandling = value then + exit; fDepHandling := value; doChanged; end; procedure TMsgOpts.setVerbose(const value: boolean); begin - if fVerbose = value then exit; + if fVerbose = value then + exit; fVerbose := value; doChanged; end; procedure TMsgOpts.setWarnings(const value: boolean); begin - if fWarnings = value then exit; + if fWarnings = value then + exit; fWarnings := value; doChanged; end; procedure TMsgOpts.setWarnInfo(const value: boolean); begin - if fWarnInfo = value then exit; + if fWarnInfo = value then + exit; fWarnInfo := value; doChanged; end; procedure TMsgOpts.setVtls(const value: boolean); begin - if fVtls = value then exit; + if fVtls = value then + exit; fVtls := value; doChanged; end; procedure TMsgOpts.setQuiet(const value: boolean); begin - if fQuiet = value then exit; + if fQuiet = value then + exit; fQuiet := value; doChanged; end; procedure TMsgOpts.setVgc(const value: boolean); begin - if fVgc = value then exit; + if fVgc = value then + exit; fVgc := value; doChanged; end; procedure TMsgOpts.setCol(const value: boolean); begin - if fCol = value then exit; + if fCol = value then + exit; fCol := value; doChanged; end; @@ -643,23 +667,32 @@ begin if base.isNil then begin str := binKindStr[fBinKind]; - if str.isNotEmpty then list.Add(str); + if str.isNotEmpty then + list.Add(str); {$IFNDEF WINDOWS} if fBinKind = sharedlib then list.Add('-fPIC'); {$ENDIF} str := trgKindStr[fTrgKind]; - if str.isNotEmpty then list.Add(str); - if fUnittest then list.Add('-unittest'); - if fInline then list.Add('-inline'); - if fOptimz then list.Add('-O'); - if fStackStomp then list.Add('-gx'); - if fAllInst then list.Add('-allinst'); - if fAddMain then list.Add('-main'); - if fRelease then list.Add('-release'); + if str.isNotEmpty then + list.Add(str); + if fUnittest then + list.Add('-unittest'); + if fInline then + list.Add('-inline'); + if fOptimz then + list.Add('-O'); + if fStackStomp then + list.Add('-gx'); + if fAllInst then + list.Add('-allinst'); + if fAddMain then + list.Add('-main'); + if fRelease then + list.Add('-release'); for str in fVerIds do - if not isStringDisabled(str) then list.Add('-version=' + str); - // + if not isStringDisabled(str) then + list.Add('-version=' + str); if fRelease then begin if fBoundsCheck <> safeOnly then @@ -691,18 +724,32 @@ begin end; str := trgKindStr[fTrgKind]; strbase := trgKindStr[baseopt.fTrgKind]; - if (str <> strbase) then list.Add(str) else list.Add(strbase); - if baseopt.fUnittest or fUnittest then list.Add('-unittest'); - if baseopt.fInline or fInline then list.Add('-inline'); - if baseopt.fOptimz or fOptimz then list.Add('-O'); - if baseopt.fStackStomp or fStackStomp then list.Add('-gx'); - if baseopt.fAllInst or fAllInst then list.Add('-allinst'); - if baseopt.fAddMain or fAddMain then list.Add('-main'); - if baseopt.fRelease or fRelease then list.Add('-release'); - if (fVerIds.Count = 0) then for str in baseopt.fVerIds do begin - if not isStringDisabled(str) then list.Add('-version=' + str); + if (str <> strbase) then + list.Add(str) + else + list.Add(strbase); + if baseopt.fUnittest or fUnittest then + list.Add('-unittest'); + if baseopt.fInline or fInline then + list.Add('-inline'); + if baseopt.fOptimz or fOptimz then + list.Add('-O'); + if baseopt.fStackStomp or fStackStomp then + list.Add('-gx'); + if baseopt.fAllInst or fAllInst then + list.Add('-allinst'); + if baseopt.fAddMain or fAddMain then + list.Add('-main'); + if baseopt.fRelease or fRelease then + list.Add('-release'); + if (fVerIds.Count = 0) then + for str in baseopt.fVerIds do + begin + if not isStringDisabled(str) then + list.Add('-version=' + str); end else for str in fVerIds do - if not isStringDisabled(str) then list.Add('-version=' + str); + if not isStringDisabled(str) then + list.Add('-version=' + str); // default values are not handled here, TODO if fBoundsCheck <> baseopt.fBoundsCheck then list.Add('-boundscheck=' + bchKindStr[fBoundsCheck] ) @@ -718,7 +765,6 @@ begin if (source is TOutputOpts) then begin src := TOutputOpts(source); - // fVerIds.Assign(src.fVerIds); fBinKind := src.fBinKind; fTrgKind := src.fTrgKind; @@ -738,21 +784,24 @@ end; procedure TOutputOpts.setUnittest(const value: boolean); begin - if fUnittest = value then exit; + if fUnittest = value then + exit; fUnittest := value; doChanged; end; procedure TOutputOpts.setAllInst(const value: boolean); begin - if fAllinst = value then exit; + if fAllinst = value then + exit; fAllinst := value; doChanged; end; procedure TOutputOpts.setAlwaysLinkLibs(const value: boolean); begin - if fAlwayLinkLibs = value then exit; + if fAlwayLinkLibs = value then + exit; fAlwayLinkLibs := value; doChanged; end; @@ -765,63 +814,72 @@ end; procedure TOutputOpts.setTrgKind(const value: TTargetSystem); begin - if fTrgKind = value then exit; + if fTrgKind = value then + exit; fTrgKind := value; doChanged; end; procedure TOutputOpts.setBinKind(const value: TProjectBinaryKind); begin - if fBinKind = value then exit; + if fBinKind = value then + exit; fBinKind := value; doChanged; end; procedure TOutputOpts.setInline(const value: boolean); begin - if fInline = value then exit; + if fInline = value then + exit; fInline := value; doChanged; end; procedure TOutputOpts.setBoundsCheck(const value: TBoundCheckKind); begin - if fBoundsCheck = value then exit; + if fBoundsCheck = value then + exit; fBoundsCheck := value; doChanged; end; procedure TOutputOpts.setOptims(const value: boolean); begin - if fOptimz = value then exit; + if fOptimz = value then + exit; fOptimz := value; doChanged; end; procedure TOutputOpts.setGenStack(const value: boolean); begin - if fGenStack = value then exit; + if fGenStack = value then + exit; fGenStack := value; doChanged; end; procedure TOutputOpts.setAddMain(const value: boolean); begin - if fAddMain = value then exit; + if fAddMain = value then + exit; fAddMain := value; doChanged; end; procedure TOutputOpts.setRelease(const value: boolean); begin - if fRelease = value then exit; + if fRelease = value then + exit; fRelease := value; doChanged; end; procedure TOutputOpts.setStackStomp(const value: boolean); begin - if fStackStomp = value then exit; + if fStackStomp = value then + exit; fStackStomp := value; doChanged; end; @@ -847,30 +905,42 @@ var begin if base.isNil then begin - if fDebugConditions then list.Add('-debug'); + if fDebugConditions then + list.Add('-debug'); if fDbgLevel <> 0 then list.Add('-debug=' + intToStr(fDbgLevel)); for idt in fDbgIdents do list.Add('-debug=' + idt); - if fGenInfos then list.Add('-g'); - if fDbgC then list.Add('-gc'); - if fGenMap then list.Add('-map'); - if fGenFrame and (list.IndexOf('-gs') = -1) then list.Add('-gs'); + if fGenInfos then + list.Add('-g'); + if fDbgC then + list.Add('-gc'); + if fGenMap then + list.Add('-map'); + if fGenFrame and (list.IndexOf('-gs') = -1) then + list.Add('-gs'); end else begin baseopt := TDebugOpts(base); - if baseopt.fDebugConditions or fDebugConditions then list.Add('-debug'); + if baseopt.fDebugConditions or fDebugConditions then + list.Add('-debug'); if (baseopt.fDbgLevel <> 0) and (fDbgLevel = 0) then list.Add('-debug=' + intToStr(baseopt.fDbgLevel)) else if fDbgLevel <> 0 then list.Add('-debug=' + intToStr(fDbgLevel)); if fDbgIdents.Count = 0 then - for idt in baseopt.fDbgIdents do list.Add('-debug=' + idt) - else for idt in fDbgIdents do list.Add('-debug=' + idt); - if baseopt.fGenInfos or fGenInfos then list.Add('-g'); - if baseopt.fDbgC or fDbgC then list.Add('-gc'); - if baseopt.fGenMap or fGenMap then list.Add('-map'); - if (baseopt.fGenFrame or fGenFrame) and (list.IndexOf('-gs') = -1) then list.Add('-gs'); + for idt in baseopt.fDbgIdents do + list.Add('-debug=' + idt) + else for idt in fDbgIdents do + list.Add('-debug=' + idt); + if baseopt.fGenInfos or fGenInfos then + list.Add('-g'); + if baseopt.fDbgC or fDbgC then + list.Add('-gc'); + if baseopt.fGenMap or fGenMap then + list.Add('-map'); + if (baseopt.fGenFrame or fGenFrame) and (list.IndexOf('-gs') = -1) then + list.Add('-gs'); end; end; @@ -881,7 +951,6 @@ begin if (source is TDebugOpts) then begin src := TDebugOpts(source); - // fDbgIdents.Assign(src.fDbgIdents); fDebugConditions := src.fDebugConditions; fDbgLevel := src.fDbgLevel; @@ -896,7 +965,8 @@ end; procedure TDebugOpts.updateForceDbgBool; begin fForceDbgBool := (fDbgLevel > 0) or (fDbgIdents.Count > 0); - if fForceDbgBool then setDebugConditions(true); + if fForceDbgBool then + setDebugConditions(true); end; procedure TDebugOpts.setDebugConditions(const value: boolean); @@ -906,44 +976,51 @@ begin fDebugConditions := true; exit; end; - if fDebugConditions = value then exit; + if fDebugConditions = value then + exit; fDebugConditions := value; doChanged; end; procedure TDebugOpts.setGenFrame(const value: boolean); begin - if fGenFrame = value then exit; + if fGenFrame = value then + exit; fGenFrame:=value; doChanged; end; procedure TDebugOpts.setGenInfos(const value: boolean); begin - if fGenInfos = value then exit; + if fGenInfos = value then + exit; fGenInfos := value; doChanged; end; procedure TDebugOpts.setDbgC(const value: boolean); begin - if fDbgC = value then exit; + if fDbgC = value then + exit; fDbgC := value; doChanged; end; procedure TDebugOpts.setGenMap(const value: boolean); begin - if fGenMap = value then exit; + if fGenMap = value then + exit; fGenMap := value; doChanged; end; procedure TDebugOpts.setDbgLevel(const value: Integer); begin - if fDbgLevel = value then exit; + if fDbgLevel = value then + exit; fDbgLevel := value; - if fDbgLevel < 0 then fDbgLevel := 0; + if fDbgLevel < 0 then + fDbgLevel := 0; updateForceDbgBool; doChanged; end; @@ -1036,8 +1113,10 @@ begin end else begin baseopt := TPathsOpts(base); - if fExtraSrcs.Count = 0 then rightList := baseopt.fExtraSrcs - else rightList := fExtraSrcs; + if fExtraSrcs.Count = 0 then + rightList := baseopt.fExtraSrcs + else + rightList := fExtraSrcs; exts := TStringList.Create; try exts.AddStrings(['.d', '.di', '.dd']); @@ -1053,25 +1132,37 @@ begin exts.Free; end; // - if fImpMod.Count = 0 then rightList := baseopt.fImpMod - else rightList := fImpMod; - for str in rightList do if not isStringDisabled(str) then - list.Add('-I'+ fSymStringExpander.expand(str)); + if fImpMod.Count = 0 then + rightList := baseopt.fImpMod + else + rightList := fImpMod; + for str in rightList do + if not isStringDisabled(str) then + list.Add('-I'+ fSymStringExpander.expand(str)); // - if fImpStr.Count = 0 then rightList := baseopt.fImpStr - else rightList := fImpStr; - for str in rightList do if not isStringDisabled(str) then - list.Add('-J'+ fSymStringExpander.expand(str)); + if fImpStr.Count = 0 then + rightList := baseopt.fImpStr + else + rightList := fImpStr; + for str in rightList do + if not isStringDisabled(str) then + list.Add('-J'+ fSymStringExpander.expand(str)); // str := ''; - if fFname <> '' then str := fFname else - if baseopt.fFname <> '' then str := baseopt.fFname; - if str.isNotEmpty then list.Add('-of' + fSymStringExpander.expand(str)); + if fFname <> '' then + str := fFname + else if baseopt.fFname <> '' then + str := baseopt.fFname; + if str.isNotEmpty then + list.Add('-of' + fSymStringExpander.expand(str)); // str := ''; - if fObjDir <> '' then str := fObjDir else - if baseopt.fObjDir <> '' then str := baseopt.fObjDir; - if str.isNotEmpty then list.Add('-od' + fSymStringExpander.expand(str)); + if fObjDir <> '' then + str := fObjDir + else if baseopt.fObjDir <> '' then + str := baseopt.fObjDir; + if str.isNotEmpty then + list.Add('-od' + fSymStringExpander.expand(str)); end; end; @@ -1082,7 +1173,7 @@ begin if (source is TPathsOpts) then begin src := TPathsOpts(source); - // + fExtraSrcs.Assign(src.fExtraSrcs); fImpMod.Assign(src.fImpMod); fImpStr.Assign(src.fImpStr); @@ -1105,14 +1196,16 @@ end; procedure TPathsOpts.setForceExt(value: boolean); begin - if fForceExt = value then exit; + if fForceExt = value then + exit; fForceExt:=value; doChanged; end; procedure TPathsOpts.setFname(const value: TFilename); begin - if fFname = value then exit; + if fFname = value then + exit; fFname := patchPlateformPath(value); fFname := patchPlateformExt(fFname); doChanged; @@ -1120,7 +1213,8 @@ end; procedure TPathsOpts.setObjDir(const value: TPathname); begin - if fObjDir = value then exit; + if fObjDir = value then + exit; fObjDir := patchPlateformPath(value); doChanged; end; @@ -1266,7 +1360,8 @@ begin ldc, ldmd: lst := fLdcOthers; gdc, gdmd: lst := fGdcOthers; end; - if lst.isNotNil then for i := 0 to lst.Count-1 do + if lst.isNotNil then + for i := 0 to lst.Count-1 do begin str := lst[i]; if str.isEmpty or isStringDisabled(str) then @@ -1295,7 +1390,8 @@ begin else lst := fGdcOthers; end; - if lst.isNotNil then for i := 0 to lst.Count-1 do + if lst.isNotNil then + for i := 0 to lst.Count-1 do begin str := lst[i]; if str.isEmpty or isStringDisabled(str) then @@ -1402,21 +1498,24 @@ end; procedure TCustomProcOptions.setExecutable(const value: TFilename); begin - if fExecutable = value then exit; + if fExecutable = value then + exit; fExecutable := value; doChanged; end; procedure TCustomProcOptions.setWorkDir(const value: TPathname); begin - if fWorkDir = value then exit; + if fWorkDir = value then + exit; fWorkDir := value; doChanged; end; procedure TCustomProcOptions.setOptions(const value: TProcessOptions); begin - if fOptions = value then exit; + if fOptions = value then + exit; fOptions := value; doChanged; end; @@ -1435,7 +1534,8 @@ end; procedure TCustomProcOptions.setShowWin(value: TShowWindowOptions); begin - if fShowWin = value then exit; + if fShowWin = value then + exit; fShowWin := value; doChanged; end; @@ -1549,18 +1649,19 @@ begin ext := nme.extractFileExt; nme := '-of' + nme; i := list.IndexOf(nme); - if i <> -1 then case fOutputOpts.binaryKind of - {$IFDEF WINDOWS} - executable: if ext <> exeExt then - list[i] := list[i] + exeExt; - {$ENDIF} - obj: if ext <> objExt then - list[i] := list[i] + objExt; - sharedlib: if ext <> dynExt then - list[i] := list[i] + dynExt; - staticlib: if ext <> libExt then - list[i] := list[i] + libExt; - end; + if i <> -1 then + case fOutputOpts.binaryKind of + {$IFDEF WINDOWS} + executable: if ext <> exeExt then + list[i] := list[i] + exeExt; + {$ENDIF} + obj: if ext <> objExt then + list[i] := list[i] + objExt; + sharedlib: if ext <> dynExt then + list[i] := list[i] + dynExt; + staticlib: if ext <> libExt then + list[i] := list[i] + libExt; + end; end; end; @@ -1581,7 +1682,8 @@ end; procedure TCompilerConfiguration.doChanged; begin - if assigned(fOnChanged) then fOnChanged(self); + if assigned(fOnChanged) then + fOnChanged(self); end; procedure TCompilerConfiguration.setDocOpts(const value: TDocOpts); diff --git a/src/u_dubproject.pas b/src/u_dubproject.pas index 729b5fa5..aaf1cf91 100644 --- a/src/u_dubproject.pas +++ b/src/u_dubproject.pas @@ -1256,7 +1256,8 @@ begin end; fBuildTypes.AddStrings(DubBuiltTypeName); - if fJSON.findObject('buildTypes', obj) then for i := 0 to obj.Count-1 do + if fJSON.findObject('buildTypes', obj) then + for i := 0 to obj.Count-1 do begin itemname := obj.Names[i]; // defaults build types can be overridden @@ -1335,7 +1336,8 @@ begin tryAddFromFolder(fBasePath + 'src'); tryAddFromFolder(fBasePath + 'source'); // custom folders - if fJSON.findArray('sourcePaths', arr) then for i := 0 to arr.Count-1 do + if fJSON.findArray('sourcePaths', arr) then + for i := 0 to arr.Count-1 do begin pth := TrimRightSet(arr.Strings[i], ['/','\']); if pth.dirExists and FilenameIsAbsolute(pth) then @@ -1344,8 +1346,9 @@ begin tryAddFromFolder(expandFilenameEx(fBasePath, pth)); end; // custom files - if fJSON.findArray('sourceFiles', arr) then for i := 0 to arr.Count-1 do - tryAddRelOrAbsFile(arr.Strings[i]); + if fJSON.findArray('sourceFiles', arr) then + for i := 0 to arr.Count-1 do + tryAddRelOrAbsFile(arr.Strings[i]); conf := getCurrentCustomConfig; if conf.isNotNil then begin @@ -1358,7 +1361,8 @@ begin fSrcs.Add(patchPlateformPath(pth)); end; // custom folders in current config - if conf.findArray('sourcePaths', arr) then for i := 0 to arr.Count-1 do + if conf.findArray('sourcePaths', arr) then + for i := 0 to arr.Count-1 do begin pth := TrimRightSet(arr.Strings[i], ['/','\']); if pth.dirExists and FilenameIsAbsolute(pth) then @@ -1367,8 +1371,9 @@ begin tryAddFromFolder(expandFilenameEx(fBasePath, pth)); end; // custom files in current config - if conf.findArray('sourceFiles', arr) then for i := 0 to arr.Count-1 do - tryAddRelOrAbsFile(arr.Strings[i]); + if conf.findArray('sourceFiles', arr) then + for i := 0 to arr.Count-1 do + tryAddRelOrAbsFile(arr.Strings[i]); end; // exclusions : not managed anymore because of other IDE features that rely // on the full list (scan TODOs, , search in project, etc) @@ -1467,7 +1472,8 @@ procedure TDubProject.updateImportPathsFromJson; pth: string; i: integer; begin - if obj.findArray('importPaths', arr) then for i := 0 to arr.Count-1 do + if obj.findArray('importPaths', arr) then + for i := 0 to arr.Count-1 do begin pth := TrimRightSet(arr.Strings[i], ['/','\']); if pth.dirExists and FilenameIsAbsolute(pth) then diff --git a/src/u_dubprojeditor.pas b/src/u_dubprojeditor.pas index d7fbc831..f2bdf1b8 100644 --- a/src/u_dubprojeditor.pas +++ b/src/u_dubprojeditor.pas @@ -455,11 +455,16 @@ var prt: TJSONData; sel: TTreeNode; begin - if fSelectedNode.isNil then exit; - if fSelectedNode.Level = 0 then exit; - if fSelectedNode.Text = 'name' then exit; - if fSelectedNode.Data.isNil then exit; - if fSelectedNode.Parent.Data.isNil then exit; + if fSelectedNode.isNil then + exit; + if fSelectedNode.Level = 0 then + exit; + if fSelectedNode.Text = 'name' then + exit; + if fSelectedNode.Data.isNil then + exit; + if fSelectedNode.Parent.Data.isNil then + exit; fProj.beginModification; prt := TJSONData(fSelectedNode.Parent.Data); @@ -588,8 +593,8 @@ var dat: TJSONData; begin edProp.Clear; - if fSelectedNode.isNil then exit; - if fSelectedNode.Data.isNil then exit; + if fSelectedNode.isNil or fSelectedNode.Data.isNil then + exit; dat := TJSONData(fSelectedNode.Data); case dat.JSONType of @@ -617,7 +622,8 @@ procedure TDubProjectEditorWidget.updateEditor; c: TTreeNode; begin node.Data:= data; - if data.JSONType = jtObject then for i := 0 to data.Count-1 do + if data.JSONType = jtObject then + for i := 0 to data.Count-1 do begin node.ImageIndex:=0; node.SelectedIndex:=0; @@ -633,7 +639,8 @@ procedure TDubProjectEditorWidget.updateEditor; c.StateIndex:=2; end; end; - end else if data.JSONType = jtArray then for i := 0 to data.Count-1 do + end else if data.JSONType = jtArray then + for i := 0 to data.Count-1 do begin node.ImageIndex:=1; node.SelectedIndex:=1; diff --git a/src/u_editor.pas b/src/u_editor.pas index 9750a236..0369e903 100644 --- a/src/u_editor.pas +++ b/src/u_editor.pas @@ -518,7 +518,8 @@ begin if fDoc.isNotNil and pageControl.currentPage.isNotNil and (pageControl.currentPage.Caption = '') then updatePageCaption(pageControl.currentPage); - if document = fDoc then exit; + if document = fDoc then + exit; fDoc := document; fDoc.Visible:=true; focusedEditorChanged; @@ -668,8 +669,8 @@ end; procedure TEditorWidget.focusedEditorChanged; begin - if fDoc.isNil then exit; - // + if fDoc.isNil then + exit; macRecorder.Editor:= fDoc; fDoc.PopupMenu := mnuEditor; fDoc.hideCallTips; @@ -684,14 +685,16 @@ end; procedure TEditorWidget.PageControlChanged(Sender: TObject); begin - if fDoc.isNil then exit; + if fDoc.isNil then + exit; fDoc.hideCallTips; fDoc.hideDDocs; end; procedure TEditorWidget.PageControlChanging(Sender: TObject; var AllowChange: Boolean); begin - if fDoc.isNil then exit; + if fDoc.isNil then + exit; fDoc.hideCallTips; fDoc.hideDDocs; end; @@ -754,7 +757,8 @@ end; procedure TEditorWidget.memoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin - if not (ssLeft in Shift) then exit; + if not (ssLeft in Shift) then + exit; beginDelayedUpdate; end; @@ -770,8 +774,9 @@ var fname: string; len: byte; begin - if not DcdWrapper.available then exit; - // + if not DcdWrapper.available then + exit; + DcdWrapper.getDeclFromCursor(fname, srcpos); if (fname <> fDoc.fileName) and fname.fileExists then begin @@ -1143,7 +1148,8 @@ end; procedure TEditorWidget.mnuedDdocClick(Sender: TObject); begin - if fDoc.isNil then exit; + if fDoc.isNil then + exit; mnuEditor.Close; fDoc.hideCallTips; if not fDoc.IsDSource and not fDoc.alwaysAdvancedFeatures then diff --git a/src/u_editoroptions.pas b/src/u_editoroptions.pas index 0bd9b5bd..e2c39893 100644 --- a/src/u_editoroptions.pas +++ b/src/u_editoroptions.pas @@ -363,36 +363,46 @@ end; procedure TEditorOptionsBase.setDDocDelay(value: Integer); begin - if value > 2000 then value := 2000 - else if value < 20 then value := 20; + if value > 2000 then + value := 2000 + else if value < 20 then + value := 20; fDDocDelay:=value; end; procedure TEditorOptionsBase.setDscannerDelay(value: Integer); begin - if value > 10000 then value := 10000 - else if value < 500 then value := 500; + if value > 10000 then + value := 10000 + else if value < 500 then + value := 500; fDscannerDelay:=value; end; procedure TEditorOptionsBase.setAutoDotDelay(value: Integer); begin - if value > 2000 then value := 2000 - else if value < 0 then value := 0; + if value > 2000 then + value := 2000 + else if value < 0 then + value := 0; fAutoDotDelay:=value; end; procedure TEditorOptionsBase.setCompletionMenuLines(value: byte); begin - if value < 5 then value := 5 - else if value > 64 then value := 64; + if value < 5 then + value := 5 + else if value > 64 then + value := 64; fCompletionMenuLines := value; end; procedure TEditorOptionsBase.setLineNumEvery(value: integer); begin - if value < 1 then value := 1 - else if value > 10 then value := 10; + if value < 1 then + value := 1 + else if value > 10 then + value := 10; fLineNumEvery := value; end; @@ -586,7 +596,7 @@ begin if identifier.length > 2 then identifier := identifier[3..identifier.length]; aShortcut := shrct.shortcut; - // + fShortcutCount += 1; result := fShortcutCount < fShortCuts.Count; end; @@ -596,8 +606,8 @@ var i: Integer; shc: TPersistentShortcut; begin - if category <> 'Code editor' then exit; - // + if category <> 'Code editor' then + exit; for i:= 0 to fShortCuts.Count-1 do begin shc := TPersistentShortcut(fShortCuts.Items[i]); diff --git a/src/u_infos.pas b/src/u_infos.pas index 42d898b8..591e7990 100644 --- a/src/u_infos.pas +++ b/src/u_infos.pas @@ -120,8 +120,9 @@ var pth: string; cmp: DCompiler; begin - if fLabel.isNil or fStatus.isNil then exit; - // + if fLabel.isNil or fStatus.isNil then + exit; + fPresent := false; fLabel.Caption:= fToolName; case fKind of diff --git a/src/u_inspectors.pas b/src/u_inspectors.pas index f201513c..6e63788a 100644 --- a/src/u_inspectors.pas +++ b/src/u_inspectors.pas @@ -146,7 +146,8 @@ begin rc := Rect(vRight, ARect.Top, ARect.Right, ARect.Bottom); FillChar(Style{%H-},SizeOf(Style),0); - With Style do begin + With Style do + begin Alignment := taLeftJustify; Layout := tlCenter; Opaque := false; @@ -157,9 +158,11 @@ begin SystemFont := true; end; If (pedsInComboList in AState) and not (pedsInEdit in AState) - then begin + then + begin OldColor := ACanvas.Brush.Color; - If pedsSelected in AState then begin + If pedsSelected in AState then + begin ACanvas.Brush.Color := clHighlight; ACanvas.Font.Color := clHighlightText; end diff --git a/src/u_lcldragdrop.pas b/src/u_lcldragdrop.pas index d012e0ec..4e1b2fa4 100644 --- a/src/u_lcldragdrop.pas +++ b/src/u_lcldragdrop.pas @@ -93,7 +93,8 @@ var trv: TTreeView; begin result := ''; - if src.isNil then exit; + if src.isNil then + exit; // from mini-explorer if src is TShellListView then begin @@ -132,9 +133,11 @@ var fname: string; fmt: TProjectFileFormat; begin - if Source.isNil then exit; + if Source.isNil then + exit; fname := getFilename(Source); - if not fname.fileExists then exit; + if not fname.fileExists then + exit; fmt := projectFormat(fname); if fmt in [pffDexed, pffDub] then diff --git a/src/u_libman.pas b/src/u_libman.pas index 06bbb3a7..1d344c99 100644 --- a/src/u_libman.pas +++ b/src/u_libman.pas @@ -625,7 +625,8 @@ begin end; end; // add the library files and the import paths for the selection - if not sel.IsEmpty then with sel.Iterator do + if not sel.IsEmpty then + with sel.Iterator do begin while true do begin diff --git a/src/u_libmaneditor.pas b/src/u_libmaneditor.pas index 2b5c1e55..29367db1 100644 --- a/src/u_libmaneditor.pas +++ b/src/u_libmaneditor.pas @@ -151,7 +151,8 @@ end; procedure TLibManEditorWidget.projChanged(project: ICommonProject); begin - if fProj = nil then exit; + if fProj = nil then + exit; if fProj <> project then exit; diff --git a/src/u_main.pas b/src/u_main.pas index 9d4f6390..950ad2a9 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -1325,7 +1325,8 @@ begin lst.DelimitedText := value; for value in lst do begin - if value.isEmpty then continue; + if value.isEmpty then + continue; if isEditable(value.extractFileExt) then openFile(value) else if isValidNativeProject(value) or isValidDubProject(value) then @@ -1802,7 +1803,8 @@ var begin // project and files MRU fname := getDocPath + 'mostrecent.txt'; - if fname.fileExists then with TPersistentMainMrus.create(nil) do + if fname.fileExists then + with TPersistentMainMrus.create(nil) do try setTargets(fFileMru, fProjMru, fPrjGrpMru); loadFromFile(fname); @@ -1811,7 +1813,8 @@ begin end; // shortcuts for the actions standing in the main action list fname := getDocPath + 'mainshortcuts.txt'; - if fname.fileExists then with TPersistentMainShortcuts.create(nil) do + if fname.fileExists then + with TPersistentMainShortcuts.create(nil) do try loadFromFile(fname); assignTo(self); @@ -1870,11 +1873,13 @@ begin exit; DockMaster.RestoreLayouts.Clear; - if WindowState = wsMinimized then WindowState := wsNormal; + if WindowState = wsMinimized then + WindowState := wsNormal; // does not save minimized/undocked windows to prevent bugs for i:= 0 to fWidgList.Count-1 do begin - if not fWidgList.widget[i].isDockable then continue; + if not fWidgList.widget[i].isDockable then + continue; if DockMaster.GetAnchorSite(fWidgList.widget[i]).WindowState = wsMinimized then DockMaster.GetAnchorSite(fWidgList.widget[i]).Close else if not DockMaster.GetAnchorSite(fWidgList.widget[i]).HasParent then @@ -2348,7 +2353,8 @@ begin if trgMnu.isNil then exit; - if fUpdateCount > 0 then exit; + if fUpdateCount > 0 then + exit; Inc(fUpdateCount); try if srcLst = fFileMru then @@ -2951,8 +2957,9 @@ begin lst := TStringList.Create; try proc.getFullLines(lst); - if proc = fRunProc then for str in lst do - fMsgs.message(str, fDoc, amcEdit, amkBub) + if proc = fRunProc then + for str in lst do + fMsgs.message(str, fDoc, amcEdit, amkBub) else // dmd used to compile runnable for str in lst do fMsgs.message(str, fDoc, amcEdit, amkAuto); @@ -3557,8 +3564,8 @@ begin dlgOkInfo('Non executable projects cant be run') else begin - if (not fProject.targetUpToDate) then if - dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes then + if not fProject.targetUpToDate and + (dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes) then begin if fAppliOpts.autoSaveProjectFiles then saveModifiedProjectFiles(fProject); @@ -3718,7 +3725,7 @@ begin TForm(widg.Parent).FormStyle := fstyle[onTop]; //TODO-cbugfix: floating widg on top from true to false, widg remains on top // OK on linux (LCL 1.6.0), initially observed on win & LCL 1.4.2 - if TForm(widg.Parent).Visible then if not onTop then + if TForm(widg.Parent).Visible and not onTop then TForm(widg.Parent).SendToBack; end; end; @@ -3979,10 +3986,11 @@ procedure TMainForm.actProjEditorExecute(Sender: TObject); var win: TControl = nil; begin - if assigned(fProject) then case fProject.getFormat of - pfDUB: win := DockMaster.GetAnchorSite(fDubProjWidg); - pfDEXED: win := DockMaster.GetAnchorSite(fPrjCfWidg); - end + if assigned(fProject) then + case fProject.getFormat of + pfDUB: win := DockMaster.GetAnchorSite(fDubProjWidg); + pfDEXED: win := DockMaster.GetAnchorSite(fPrjCfWidg); + end else win := DockMaster.GetAnchorSite(fPrjCfWidg); if win.isNotNil then begin diff --git a/src/u_messages.pas b/src/u_messages.pas index 0250a5d0..94c4c638 100644 --- a/src/u_messages.pas +++ b/src/u_messages.pas @@ -499,7 +499,8 @@ begin else clearbyContext(amcAll); end; VK_UP, VK_DOWN: - if fOptions.singleMessageClick then handleMessageClick(nil); + if fOptions.singleMessageClick then + handleMessageClick(nil); VK_RETURN: handleMessageClick(nil); end; @@ -787,7 +788,6 @@ procedure TMessagesWidget.projClosing(project: ICommonProject); begin if fProj <> project then exit; - // clearbyData(fProj); fProj := nil; filterMessages(fCtxt); @@ -795,7 +795,8 @@ end; procedure TMessagesWidget.projFocused(project: ICommonProject); begin - if fProj = project then exit; + if fProj = project then + exit; fProj := project; filterMessages(fCtxt); end; @@ -833,7 +834,8 @@ end; procedure TMessagesWidget.docClosing(document: TDexedMemo); begin - if document <> fDoc then exit; + if document <> fDoc then + exit; clearbyData(fDoc); fEditorMessagePos.Remove(fDoc.fileName); fDoc := nil; @@ -844,8 +846,8 @@ procedure TMessagesWidget.docFocused(document: TDexedMemo); var i: integer; begin - if fDoc = document then exit; - + if fDoc = document then + exit; if fDoc.isNotNil and fOptions.fAutoSelect and (fCtxt = amcEdit) then begin if list.Selected.isNotNil then @@ -922,7 +924,7 @@ begin dt := new(PMessageData); dt^.data := aData; dt^.ctxt := aCtxt; - if fAutoSelect then if fCtxt <> aCtxt then + if fAutoSelect and (fCtxt <> aCtxt) then fBtns[aCtxt].Click; if fastDisplay then IncLoopUpdate; diff --git a/src/u_optionseditor.pas b/src/u_optionseditor.pas index 4645534c..84df1eb8 100644 --- a/src/u_optionseditor.pas +++ b/src/u_optionseditor.pas @@ -184,10 +184,14 @@ var dt: PCategoryData; begin result := true; - if fUpdatingCat then exit; - if csDestroying in ComponentState then exit; - if selCat.Selected.isNil then exit; - if selCat.Selected.Data.isNil then exit; + if fUpdatingCat then + exit; + if csDestroying in ComponentState then + exit; + if selCat.Selected.isNil then + exit; + if selCat.Selected.Data.isNil then + exit; // accept/cancel is relative to a single category dt := PCategoryData(selCat.Selected.Data); // generic editor, changes are tracked directly here @@ -197,18 +201,20 @@ begin begin result := dlgYesNo(msg_mod) = mrYes; fCatChanged := not result; - if result then btnCancelClick(nil); + if result then + btnCancelClick(nil); end; // custom editor, changes are notified by optionedOptionsModified() end else begin dt := PCategoryData(selCat.Selected.Data); - if dt^.container.isNil then exit; - if dt^.observer = nil then exit; + if dt^.container.isNil or (dt^.observer = nil) then + exit; if dt^.observer.optionedOptionsModified() then begin result := dlgYesNo(msg_mod) = mrYes; - if result then btnCancelClick(nil); + if result then + btnCancelClick(nil); end; end; end; @@ -230,12 +236,13 @@ begin pnlEd.Controls[0].Visible:=false; pnlEd.Controls[0].Parent := nil; end; - // - if selCat.Selected.isNil then exit; - if selCat.Selected.Data.isNil then exit; - // + + if selCat.Selected.isNil or selcat.Selected.Data.isNil then + exit; + dt := PCategoryData(selCat.Selected.Data); - if dt^.container.isNil then exit; + if dt^.container.isNil then + exit; case dt^.kind of oekControl: begin @@ -261,7 +268,7 @@ begin inspector.Visible:=true; end; end; - // + PCategoryData(selCat.Selected.Data)^ .observer .optionedEvent(oeeSelectCat); @@ -269,9 +276,9 @@ end; procedure TOptionEditorWidget.inspectorModified(Sender: TObject); begin - if selCat.Selected.isNil then exit; - if selcat.Selected.Data.isNil then exit; - // + if selCat.Selected.isNil or selcat.Selected.Data.isNil then + exit; + fCatChanged := true; PCategoryData(selCat.Selected.Data)^ .observer @@ -280,9 +287,9 @@ end; procedure TOptionEditorWidget.btnCancelClick(Sender: TObject); begin - if selCat.Selected.isNil then exit; - if selcat.Selected.Data.isNil then exit; - // + if selCat.Selected.isNil or selcat.Selected.Data.isNil then + exit; + fCatChanged := false; if inspector.Parent.isNotNil then inspector.ItemIndex := -1; @@ -318,9 +325,9 @@ end; procedure TOptionEditorWidget.btnAcceptClick(Sender: TObject); begin - if selCat.Selected.isNil then exit; - if selcat.Selected.Data.isNil then exit; - // + if selCat.Selected.isNil or selcat.Selected.Data.isNil then + exit; + fCatChanged := false; if inspector.Parent.isNotNil then inspector.ItemIndex := -1; diff --git a/src/u_processes.pas b/src/u_processes.pas index f4af9d05..49d01890 100644 --- a/src/u_processes.pas +++ b/src/u_processes.pas @@ -272,7 +272,8 @@ begin begin lastTerm := fStdoutEx.Position; while fStdoutEx.Read(buff, 1) = 1 do - if buff = 10 then lastTerm := fStdoutEx.Position; + if buff = 10 then + lastTerm := fStdoutEx.Position; fStdoutEx.Position := stored; if lastTerm <> stored then begin @@ -313,7 +314,8 @@ procedure TDexedProcess.internalDoOnTerminate(sender: TObject); begin fHasRead := false; fTerminateChecker.Enabled := false; - if fDoneTerminated then exit; + if fDoneTerminated then + exit; fDoneTerminated := true; // restore if same proc is called again, diff --git a/src/u_procinput.pas b/src/u_procinput.pas index b53e30fe..ed7f5791 100644 --- a/src/u_procinput.pas +++ b/src/u_procinput.pas @@ -131,7 +131,8 @@ begin if not (poUsePipes in process.Options) then exit; fProc := process; - if fProc.isNotNil then Panel1.Enabled:=true; + if fProc.isNotNil then + Panel1.Enabled:=true; txtExeName.Caption := shortenPath(fProc.Executable); end; @@ -189,15 +190,18 @@ procedure TProcInputWidget.txtInpKeyDown(Sender: TObject; var Key: Word; begin case Key of VK_RETURN: - if fProc.isNotNil then sendInput; + if fProc.isNotNil then + sendInput; VK_UP: begin fMruPos += 1; - if fMruPos > fMru.Count-1 then fMruPos := 0; + if fMruPos > fMru.Count-1 then + fMruPos := 0; txtInp.Text := fMru[fMruPos]; end; VK_DOWN: begin fMruPos -= 1; - if fMruPos < 0 then fMruPos := fMru.Count-1; + if fMruPos < 0 then + fMruPos := fMru.Count-1; txtInp.Text := fMru[fMruPos]; end; end; diff --git a/src/u_projgroup.lfm b/src/u_projgroup.lfm index 1446b2b5..d0ac7957 100644 --- a/src/u_projgroup.lfm +++ b/src/u_projgroup.lfm @@ -159,7 +159,7 @@ inherited ProjectGroupWidget: TProjectGroupWidget end object button0: TDexedToolButton[5] Left = 113 - Height = 28 + Height = 5 Top = 0 AutoSize = True Caption = 'button0' diff --git a/src/u_projgroup.pas b/src/u_projgroup.pas index f00a490a..723606dd 100644 --- a/src/u_projgroup.pas +++ b/src/u_projgroup.pas @@ -424,8 +424,9 @@ begin end else if fBasePath = '' then c := true; - if c then for i:= 0 to projectCount-1 do - getItem(i).fFilename := ExtractRelativepath(n, getItem(i).fFilename); + if c then + for i:= 0 to projectCount-1 do + getItem(i).fFilename := ExtractRelativepath(n, getItem(i).fFilename); fBasePath := n; f := ChangeFileExt(f, '.dgrp'); saveToFile(f); @@ -666,8 +667,8 @@ procedure TProjectGroupWidget.btnAsyncClick(Sender: TObject); var prj: TProjectGroupItem; begin - if lstProj.ItemIndex = -1 then exit; - // + if lstProj.ItemIndex = -1 then + exit; prj := projectGroup.item[lstProj.ItemIndex]; case prj.asyncMode of amSequential: prj.asyncMode := amParallel; @@ -678,9 +679,8 @@ end; procedure TProjectGroupWidget.btnMoveDownClick(Sender: TObject); begin - if lstProj.ItemIndex = -1 then exit; - if lstProj.ItemIndex = lstProj.Items.Count-1 then exit; - // + if (lstProj.ItemIndex = -1) or (lstProj.ItemIndex = lstProj.Items.Count-1) then + exit; projectGroup.items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex + 1); lstProj.Items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex + 1); projectGroup.index:=projectGroup.index+1; @@ -689,9 +689,8 @@ end; procedure TProjectGroupWidget.btnMoveUpClick(Sender: TObject); begin - if lstProj.ItemIndex = -1 then exit; - if lstProj.ItemIndex = 0 then exit; - // + if (lstProj.ItemIndex = -1) or (lstProj.ItemIndex = 0) then + exit; projectGroup.items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex - 1); lstProj.Items.Exchange(lstProj.ItemIndex, lstProj.ItemIndex - 1); projectGroup.index:=projectGroup.index-1; @@ -700,7 +699,8 @@ end; procedure TProjectGroupWidget.btnRemProjClick(Sender: TObject); begin - if lstProj.ItemIndex = -1 then exit; + if lstProj.ItemIndex = -1 then + exit; projectGroup.items.Delete(lstProj.Selected.Index); updateList; end; diff --git a/src/u_search.pas b/src/u_search.pas index 783aa866..cc6a226d 100644 --- a/src/u_search.pas +++ b/src/u_search.pas @@ -239,7 +239,8 @@ begin fReplaceMru:= TMruList.Create; fname := getDocPath + OptsFname; - if fname.fileExists then with TSearchOptions.create(nil) do + if fname.fileExists then + with TSearchOptions.create(nil) do try loadFromFile(fname); assignTo(self); @@ -304,11 +305,16 @@ end; function TSearchWidget.getOptions: TSynSearchOptions; begin result := []; - if chkRegex.Checked then result += [ssoRegExpr]; - if chkWWord.Checked then result += [ssoWholeWord]; - if chkBack.Checked then result += [ssoBackwards]; - if chkCaseSens.Checked then result += [ssoMatchCase]; - if chkPrompt.Checked then result += [ssoPrompt]; + if chkRegex.Checked then + result += [ssoRegExpr]; + if chkWWord.Checked then + result += [ssoWholeWord]; + if chkBack.Checked then + result += [ssoBackwards]; + if chkCaseSens.Checked then + result += [ssoMatchCase]; + if chkPrompt.Checked then + result += [ssoPrompt]; end; function dlgReplaceAll: TModalResult; @@ -530,12 +536,13 @@ begin fSearchMru.Insert(0, fToFind); fReplaceMru.Insert(0, fReplaceWth); - if chkPrompt.Checked then fDoc.OnReplaceText := @replaceEvent; + if chkPrompt.Checked then + fDoc.OnReplaceText := @replaceEvent; fDoc.CaretXY := Point(0,0); while(true) do begin - if fDoc.SearchReplace(fToFind, fReplaceWth, opts) = 0 - then break; + if fDoc.SearchReplace(fToFind, fReplaceWth, opts) = 0 then + break; if fCancelAll then begin fCancelAll := false; @@ -589,13 +596,15 @@ end; procedure TSearchWidget.docClosing(document: TDexedMemo); begin - if fDoc = document then fDoc := nil; + if fDoc = document then + fDoc := nil; updateImperative; end; procedure TSearchWidget.docFocused(document: TDexedMemo); begin - if fDoc = document then exit; + if fDoc = document then + exit; fDoc := document; updateImperative; end; @@ -608,7 +617,8 @@ end; {$REGION Misc. -----------------------------------------------------------------} procedure TSearchWidget.cbToFindChange(Sender: TObject); begin - if Updating then exit; + if Updating then + exit; fToFind := cbToFind.Text; fHasSearched := false; updateImperative; @@ -623,13 +633,15 @@ end; procedure TSearchWidget.chkEnableRepChange(Sender: TObject); begin - if Updating then exit; + if Updating then + exit; updateImperative; end; procedure TSearchWidget.cbReplaceWthChange(Sender: TObject); begin - if Updating then exit; + if Updating then + exit; fReplaceWth := cbReplaceWth.Text; fHasSearched := false; updateImperative; diff --git a/src/u_symlist.pas b/src/u_symlist.pas index 2ecdcd18..d3ee8fe0 100644 --- a/src/u_symlist.pas +++ b/src/u_symlist.pas @@ -584,9 +584,10 @@ begin fDoc := document; if not Visible then exit; - - if fAutoRefresh then beginDelayedUpdate - else if fRefreshOnFocus then callToolProc; + if fAutoRefresh then + beginDelayedUpdate + else if fRefreshOnFocus then + callToolProc; end; procedure TSymbolListWidget.docChanged(document: TDexedMemo); @@ -607,7 +608,8 @@ end; {$REGION Symbol-tree things ----------------------------------------------------} procedure TSymbolListWidget.updateDelayed; begin - if not fAutoRefresh then exit; + if not fAutoRefresh then + exit; callToolProc; end; @@ -796,7 +798,8 @@ procedure TSymbolListWidget.toolTerminated(sender: TObject); begin result := nil; - if node.isNil then case stype of + if node.isNil then + case stype of _alias : exit(ndAlias); _class : exit(ndClass); _enum : exit(ndEnum); diff --git a/src/u_synmemo.pas b/src/u_synmemo.pas index 46455fb2..321d7775 100644 --- a/src/u_synmemo.pas +++ b/src/u_synmemo.pas @@ -905,7 +905,8 @@ begin if fList.Count > 0 then begin delta := fMemo.CaretY - NativeInt(fList.Items[fPos]); - if (delta > -thresh) and (delta < thresh) then exit; + if (delta > -thresh) and (delta < thresh) then + exit; end; fList.Insert(0, Pointer(NativeInt(fMemo.CaretY))); {$POP} @@ -1882,7 +1883,8 @@ begin LogicalCaretXY := point(x, LogicalCaretXY.Y); ExecuteCommand(ecWordLeft, #0, nil); x0 := LogicalCaretXY.X - 1; - if (x0 > 1) then while true do + if (x0 > 1) then + while true do begin if (x0 > 1) and (str[x0] in ['*', '+']) and (str[x0-1] = '/') then begin @@ -1999,7 +2001,8 @@ begin p := CaretXY; line := lineText; if (CaretX = 1) or not (line[LogicalCaretXY.X] in IdentChars) or - not (line[LogicalCaretXY.X-1] in IdentChars) then exit; + not (line[LogicalCaretXY.X-1] in IdentChars) then + exit; old := GetWordAtRowCol(LogicalCaretXY); DcdWrapper.getLocalSymbolUsageFromCursor(locs); if length(locs) = 0 then @@ -2660,7 +2663,8 @@ begin str := LineText[1..CaretX]; x := CaretX; i := min(x, str.length); - if findOpenParen then while true do + if findOpenParen then + while true do begin if i = 1 then break; @@ -3578,10 +3582,13 @@ begin hideDDocs; end; end; - if not (Shift = [ssCtrl]) then exit; + if not (Shift = [ssCtrl]) then + exit; case Key of - VK_ADD: if Font.Size < 50 then Font.Size := Font.Size + 1; - VK_SUBTRACT: if Font.Size > 3 then Font.Size := Font.Size - 1; + VK_ADD: if Font.Size < 50 then + Font.Size := Font.Size + 1; + VK_SUBTRACT: if Font.Size > 3 then + Font.Size := Font.Size - 1; VK_DECIMAL: Font.Size := fDefaultFontSize; end; fCanShowHint:=false; @@ -3640,7 +3647,8 @@ begin '[': if autoCloseSquareBracket in fAutoClosedPairs then autoClosePair(autoCloseSquareBracket); '(': showCallTips(false); - ')': if fCallTipWin.Visible then decCallTipsLvl; + ')': if fCallTipWin.Visible then + decCallTipsLvl; '{': if (fAutoCloseCurlyBrace = autoCloseLexically) and (GetKeyShiftState <> [ssShift]) then begin @@ -3673,9 +3681,9 @@ begin dx := X - fOldMousePos.x; dy := Y - fOldMousePos.y; fCanShowHint:=false; - if (shift = []) then if - ((dx < 0) and (dx > -5) or (dx > 0) and (dx < 5)) or - ((dy < 0) and (dy > -5) or (dy > 0) and (dy < 5)) then + if (shift = []) and + (((dx < 0) and (dx > -5) or (dx > 0) and (dx < 5)) or + ((dy < 0) and (dy > -5) or (dy > 0) and (dy < 5))) then fCanShowHint:=true; fOldMousePos := Point(X, Y); fMousePos := PixelsToRowColumn(fOldMousePos); diff --git a/src/u_todolist.pas b/src/u_todolist.pas index d9b53110..d09e48c6 100644 --- a/src/u_todolist.pas +++ b/src/u_todolist.pas @@ -431,8 +431,10 @@ begin ctxt := getContext; case ctxt of tcNone: exit; - tcProject: if (fProj = nil) or (fProj.sourcesCount = 0) then exit; - tcFile: if fDoc = nil then exit; + tcProject: if (fProj = nil) or (fProj.sourcesCount = 0) then + exit; + tcFile: if fDoc = nil then + exit; end; fToolProc := TDexedProcess.Create(nil); diff --git a/src/u_tools.pas b/src/u_tools.pas index eed33bf0..d28433e1 100644 --- a/src/u_tools.pas +++ b/src/u_tools.pas @@ -361,7 +361,7 @@ begin category := 'Tools'; identifier:= tool[fShctCount].toolAlias; aShortcut := tool[fShctCount].shortcut; - // + fShctCount += 1; result := fShctCount < fTools.Count; end; @@ -370,8 +370,8 @@ procedure TTools.scedSendItem(const category, identifier: string; aShortcut: TSh var i: Integer; begin - if category <> 'Tools' then exit; - // + if category <> 'Tools' then + exit; for i := 0 to tools.Count-1 do if tool[i].toolAlias = identifier then begin tool[i].shortcut := aShortcut; @@ -401,7 +401,8 @@ end; procedure TTools.docClosing(document: TDexedMemo); begin - if fDoc <> document then exit; + if fDoc <> document then + exit; fDoc := nil; end; {$ENDREGION} @@ -426,8 +427,8 @@ procedure TTools.executeTool(tool: TToolItem); var txt: string = ''; begin - if tool.isNil then exit; - // + if tool.isNil then + exit; tool.execute(nil); if (tool.pipeInputKind <> pikNone) and fDoc.isNotNil and (poUsePipes in tool.options) and tool.fProcess.Input.isNotNil then @@ -445,9 +446,8 @@ end; procedure TTools.executeTool(index: Integer); begin - if index < 0 then exit; - if index > fTools.Count-1 then exit; - // + if (index < 0) or (index > fTools.Count-1) then + exit; executeTool(tool[index]); end; {$ENDREGION} diff --git a/src/u_widget.lfm b/src/u_widget.lfm index 9220c13c..3e91ff70 100644 --- a/src/u_widget.lfm +++ b/src/u_widget.lfm @@ -9,6 +9,7 @@ object DexedWidget: TDexedWidget ClientWidth = 332 ShowHint = True ShowInTaskBar = stNever + LCLVersion = '2.0.0.3' object Back: TPanel Left = 0 Height = 121 diff --git a/src/u_widget.pas b/src/u_widget.pas index 5bff33e5..e5668dd3 100644 --- a/src/u_widget.pas +++ b/src/u_widget.pas @@ -205,7 +205,9 @@ begin end else begin - if isModal then ShowModal else + if isModal then + ShowModal + else begin Show; BringToFront; @@ -271,8 +273,10 @@ end; {$REGION Updaters---------------------------------------------------------------} procedure TDexedWidget.setDelayDur(value: Integer); begin - if value < 100 then value := 100; - if fDelayDur = value then exit; + if value < 100 then + value := 100; + if fDelayDur = value then + exit; fDelayDur := value; fUpdaterDelay.Interval := fDelayDur; end; @@ -304,7 +308,8 @@ end; procedure TDexedWidget.endImperativeUpdate; begin Dec(fImperativeUpdateCount); - if fImperativeUpdateCount > 0 then exit; + if fImperativeUpdateCount > 0 then + exit; fUpdating := true; updateImperative; fUpdating := false;