From 1f64e2b29d291e104dfe77e30e7bf2b29b7812dc Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 23 Sep 2018 10:33:52 +0000 Subject: [PATCH] lazutils: deprecated ConvertLineEndings in favor of LineBreaksToSystemLineBreaks git-svn-id: trunk@59144 - --- components/ideintf/srceditorintf.pas | 8 ++++---- components/lazutils/graphtype.pp | 2 +- components/lazutils/lazlogger.pas | 4 ++-- components/lazutils/lazstringutils.pas | 2 +- docs/xml/lazutils/lazloggerbase.xml | 11 ----------- docs/xml/lcl/lclproc.xml | 17 ----------------- ide/compileroptions.pp | 6 +++--- ide/fpdoceditwindow.pas | 10 +++++----- lcl/include/messagedialogs.inc | 16 ++++++++-------- lcl/include/promptdialog.inc | 6 +++--- lcl/interfaces/carbon/carbonstrings.pp | 2 +- 11 files changed, 28 insertions(+), 56 deletions(-) diff --git a/components/ideintf/srceditorintf.pas b/components/ideintf/srceditorintf.pas index 392a614c4c..890a19e340 100644 --- a/components/ideintf/srceditorintf.pas +++ b/components/ideintf/srceditorintf.pas @@ -609,8 +609,8 @@ var begin NewName:=IDECodeMacros.CreateUniqueName(Name); Result:=TIDECodeMacro.Create(NewName); - Result.ShortDescription:=ConvertLineEndings(ShortDescription); - Result.LongDescription:=ConvertLineEndings(LongDescription); + Result.ShortDescription:=LineBreaksToSystemLineBreaks(ShortDescription); + Result.LongDescription:=LineBreaksToSystemLineBreaks(LongDescription); Result.OnGetValueProc:=OnGetValueProc; Result.OnGetValueMethod:=OnGetValueMethod; IDECodeMacros.Add(Result); @@ -624,8 +624,8 @@ var begin NewName:=IDECodeMacros.CreateUniqueName(Name); Result:=TIDECodeMacro.Create(NewName); - Result.ShortDescription:=ConvertLineEndings(ShortDescription); - Result.LongDescription:=ConvertLineEndings(LongDescription); + Result.ShortDescription:=LineBreaksToSystemLineBreaks(ShortDescription); + Result.LongDescription:=LineBreaksToSystemLineBreaks(LongDescription); Result.OnGetValueExProc:=OnGetValueProc; Result.OnGetValueExMethod:=OnGetValueMethod; IDECodeMacros.Add(Result); diff --git a/components/lazutils/graphtype.pp b/components/lazutils/graphtype.pp index b84523d19b..2e82269d7a 100644 --- a/components/lazutils/graphtype.pp +++ b/components/lazutils/graphtype.pp @@ -1552,7 +1552,7 @@ begin ADst.ReleaseData; // get intersection - IntersectRect(R, Rect(0, 0, Description.Width, Description.Height), ARect); + IntersectRect(R{%H-}, Rect(0, 0, Description.Width, Description.Height), ARect); ADst.Description.Width := R.Right - R.Left; ADst.Description.Height := R.Bottom - R.Top; if (ADst.Description.Width <= 0) diff --git a/components/lazutils/lazlogger.pas b/components/lazutils/lazlogger.pas index a41aed3f74..530403fcae 100644 --- a/components/lazutils/lazlogger.pas +++ b/components/lazutils/lazlogger.pas @@ -727,9 +727,9 @@ begin end; if FDebugNestAtBOL and (s <> '') then - FileHandle.WriteLnToFile(FDebugIndent + ConvertLineEndings(s)) + FileHandle.WriteLnToFile(FDebugIndent + LineBreaksToSystemLineBreaks(s)) else - FileHandle.WriteLnToFile(ConvertLineEndings(s)); + FileHandle.WriteLnToFile(LineBreaksToSystemLineBreaks(s)); FDebugNestAtBOL := True; end; diff --git a/components/lazutils/lazstringutils.pas b/components/lazutils/lazstringutils.pas index 981c8836d8..5dd30595b4 100644 --- a/components/lazutils/lazstringutils.pas +++ b/components/lazutils/lazstringutils.pas @@ -42,7 +42,7 @@ function LineEndingCount(const Txt: string; var LengthOfLastLine: integer): inte function ChangeLineEndings(const s, NewLineEnding: string): string; function LineBreaksToSystemLineBreaks(const s: string): string; function LineBreaksToDelimiter(const s: string; Delimiter: char): string; -function ConvertLineEndings(const s: string): string; inline; // duplicate of LineBreaksToSystemLineBreaks +function ConvertLineEndings(const s: string): string; inline; deprecated 'use LineBreaksToSystemLineBreaks instead'; // Conversions function TabsToSpaces(const s: string; TabWidth: integer; UseUTF8: boolean): string; diff --git a/docs/xml/lazutils/lazloggerbase.xml b/docs/xml/lazutils/lazloggerbase.xml index 3d85f97562..58dff57379 100644 --- a/docs/xml/lazutils/lazloggerbase.xml +++ b/docs/xml/lazutils/lazloggerbase.xml @@ -2244,17 +2244,6 @@ - - - - - - - - - - - diff --git a/docs/xml/lcl/lclproc.xml b/docs/xml/lcl/lclproc.xml index c85ba70346..5e4bece775 100644 --- a/docs/xml/lcl/lclproc.xml +++ b/docs/xml/lcl/lclproc.xml @@ -1411,23 +1411,6 @@ - - - Converts all line endings in a string into platform LineEnding. - - - - - - - - - - - - - - diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 57d5d043f9..2f0bbe71d6 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -1582,7 +1582,7 @@ begin SrcPath := sp(aXMLConfig.GetValue(p+'SrcPath/Value', '')); { Conditionals } - FConditionals:=ConvertLineEndings(UTF8Trim( + FConditionals:=LineBreaksToSystemLineBreaks(UTF8Trim( aXMLConfig.GetValue(Path+'Conditionals/Value',DefaultConditionals),[])); TIDEBuildMacros(fBuildMacros).LoadFromXMLConfig(aXMLConfig, Path+'BuildMacros/',PathDelimChange); @@ -4520,10 +4520,10 @@ procedure TIDEBuildMacro.LoadFromXMLConfig(AXMLConfig: TXMLConfig; begin FIdentifier:=AXMLConfig.GetValue(Path+'Identifier/Value',''); if not IsValidIdent(FIdentifier) then FIdentifier:=''; - FDescription:=ConvertLineEndings(AXMLConfig.GetValue(Path+'Description/Value','')); + FDescription:=LineBreaksToSystemLineBreaks(AXMLConfig.GetValue(Path+'Description/Value','')); LoadStringList(AXMLConfig,FValues,Path+'Values/'); LoadStringList(AXMLConfig,FValueDescriptions,Path+'ValueDescriptions/'); - FDefaultValue:=ConvertLineEndings(AXMLConfig.GetValue(Path+'Default/Value','')); + FDefaultValue:=LineBreaksToSystemLineBreaks(AXMLConfig.GetValue(Path+'Default/Value','')); while ValueDescriptions.Count>Values.Count do ValueDescriptions.Delete(ValueDescriptions.Count-1); diff --git a/ide/fpdoceditwindow.pas b/ide/fpdoceditwindow.pas index 40ee143d8e..fe79358c17 100644 --- a/ide/fpdoceditwindow.pas +++ b/ide/fpdoceditwindow.pas @@ -852,11 +852,11 @@ begin begin FOldValues:=Element.FPDocFile.GetValuesFromNode(Element.ElementNode); FOldVisualValues[fpdiShort]:=ReplaceLineEndings(FOldValues[fpdiShort],''); - FOldVisualValues[fpdiElementLink]:=ConvertLineEndings(FOldValues[fpdiElementLink]); - FOldVisualValues[fpdiDescription]:=ConvertLineEndings(FOldValues[fpdiDescription]); - FOldVisualValues[fpdiErrors]:=ConvertLineEndings(FOldValues[fpdiErrors]); - FOldVisualValues[fpdiSeeAlso]:=ConvertLineEndings(FOldValues[fpdiSeeAlso]); - FOldVisualValues[fpdiExample]:=ConvertLineEndings(FOldValues[fpdiExample]); + FOldVisualValues[fpdiElementLink]:=LineBreaksToSystemLineBreaks(FOldValues[fpdiElementLink]); + FOldVisualValues[fpdiDescription]:=LineBreaksToSystemLineBreaks(FOldValues[fpdiDescription]); + FOldVisualValues[fpdiErrors]:=LineBreaksToSystemLineBreaks(FOldValues[fpdiErrors]); + FOldVisualValues[fpdiSeeAlso]:=LineBreaksToSystemLineBreaks(FOldValues[fpdiSeeAlso]); + FOldVisualValues[fpdiExample]:=LineBreaksToSystemLineBreaks(FOldValues[fpdiExample]); //DebugLn(['TFPDocEditor.LoadGUIValues Short="',dbgstr(FOldValues[fpdiShort]),'"']); end else diff --git a/lcl/include/messagedialogs.inc b/lcl/include/messagedialogs.inc index 21d094ec2d..31b905ecd0 100644 --- a/lcl/include/messagedialogs.inc +++ b/lcl/include/messagedialogs.inc @@ -130,7 +130,7 @@ var begin Btns := GetPromptUserButtons(Buttons, CancelValue, DefaultIndex, ButtonCount, False, mbYes); - Result := DialogResults[PromptUser(ConvertLineEndings(aMsg), + Result := DialogResults[PromptUser(LineBreaksToSystemLineBreaks(aMsg), DialogIds[DlgType], Btns, ButtonCount, DefaultIndex, CancelValue)]; ReallocMem(Btns, 0); end; @@ -145,7 +145,7 @@ var begin Btns := GetPromptUserButtons(Buttons, CancelValue, DefaultIndex, ButtonCount, False, mbYes); - Result := DialogResults[PromptUser(aCaption, ConvertLineEndings(aMsg), + Result := DialogResults[PromptUser(aCaption, LineBreaksToSystemLineBreaks(aMsg), DialogIds[DlgType], Btns, ButtonCount, DefaultIndex, CancelValue)]; ReallocMem(Btns, 0); end; @@ -160,7 +160,7 @@ var begin Btns := GetPromptUserButtons(Buttons, CancelValue, DefaultIndex, ButtonCount, True, DefaultButton); - Result := DialogResults[PromptUser(aCaption, ConvertLineEndings(aMsg), + Result := DialogResults[PromptUser(aCaption, LineBreaksToSystemLineBreaks(aMsg), DialogIds[DlgType], Btns, ButtonCount, DefaultIndex, CancelValue)]; ReallocMem(Btns, 0); end; @@ -189,7 +189,7 @@ var begin Btns := GetPromptUserButtons(Buttons, CancelValue, DefaultIndex, ButtonCount, False, mbYes); - Result := DialogResults[PromptUserAtXY(ConvertLineEndings(aMsg), + Result := DialogResults[PromptUserAtXY(LineBreaksToSystemLineBreaks(aMsg), DialogIds[DlgType], Btns, ButtonCount, DefaultIndex, CancelValue, X, Y)]; ReallocMem(Btns, 0); end; @@ -205,17 +205,17 @@ end; procedure ShowMessage(const aMsg: string); begin - NotifyUser(ConvertLineEndings(aMsg), idDialogBase); + NotifyUser(LineBreaksToSystemLineBreaks(aMsg), idDialogBase); end; procedure ShowMessageFmt(const aMsg: string; Params: array of const); begin - NotifyUser(ConvertLineEndings(Format(aMsg, Params)), idDialogBase); + NotifyUser(LineBreaksToSystemLineBreaks(Format(aMsg, Params)), idDialogBase); end; procedure ShowMessagePos(const aMsg: string; X, Y: Integer); begin - NotifyUserAtXY(ConvertLineEndings(aMsg), idDialogBase, X, Y); + NotifyUserAtXY(LineBreaksToSystemLineBreaks(aMsg), idDialogBase, X, Y); end; //----------------------------------------------------------------------------// @@ -335,7 +335,7 @@ end; function InputQuery(const ACaption, APrompt : String; MaskInput : Boolean; var Value : String) : Boolean; begin - Result := LCLIntf.RequestInput(ACaption, ConvertLineEndings(APrompt), + Result := LCLIntf.RequestInput(ACaption, LineBreaksToSystemLineBreaks(APrompt), MaskInput, Value); end; diff --git a/lcl/include/promptdialog.inc b/lcl/include/promptdialog.inc index 6ddcdf4a9b..4b0cd38eae 100644 --- a/lcl/include/promptdialog.inc +++ b/lcl/include/promptdialog.inc @@ -138,7 +138,7 @@ begin BorderStyle := bsDialog; Position := poScreenCenter; SetInitialBounds(0,0,200,100); - MSG := ConvertLineEndings(AMSG); + MSG := LineBreaksToSystemLineBreaks(AMSG); Buttons := nil; FBitmap := nil; case DialogType of @@ -827,7 +827,7 @@ begin PopupMode := pmAuto; BorderStyle := bsDialog; Position := poDesigned; - MessageTxt := ConvertLineEndings(aMsg); + MessageTxt := LineBreaksToSystemLineBreaks(aMsg); HelpContext := HelpCtx; KeyPreview := True; @@ -1058,7 +1058,7 @@ begin end; if DialogButtons.DefaultButton = nil then DialogButtons.DefaultButton := DialogButtons.FindButton([mrYes, mrOk, mrYesToAll, mrAll, mrRetry, mrCancel, mrNo, mrNoToAll, mrAbort, mrIgnore]); - Result := WidgetSet.AskUser(aCaption, ConvertLineEndings(aMsg), + Result := WidgetSet.AskUser(aCaption, LineBreaksToSystemLineBreaks(aMsg), DialogIds[DlgType], DialogButtons, HelpCtx); finally DialogButtons.Free; diff --git a/lcl/interfaces/carbon/carbonstrings.pp b/lcl/interfaces/carbon/carbonstrings.pp index 8d18e4e4da..9c4ffe6c81 100644 --- a/lcl/interfaces/carbon/carbonstrings.pp +++ b/lcl/interfaces/carbon/carbonstrings.pp @@ -464,7 +464,7 @@ begin try // don't need to copy Objects, VCL does not support them neither // preserve the last line ending - Text:=ConvertLineEndings(TheStrings.Text); + Text:=LineBreaksToSystemLineBreaks(TheStrings.Text); finally EndUpdate; end;