lazutils: deprecated ConvertLineEndings in favor of LineBreaksToSystemLineBreaks

git-svn-id: trunk@59144 -
This commit is contained in:
mattias 2018-09-23 10:33:52 +00:00
parent f14e40c50d
commit 1f64e2b29d
11 changed files with 28 additions and 56 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -2244,17 +2244,6 @@
<short></short>
</element>
<!-- function Visibility: default -->
<element name="ConvertLineEndings">
<short></short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="ConvertLineEndings.Result">
<short></short>

View File

@ -1411,23 +1411,6 @@
<element name="DebugLnExit.s16"/>
<element name="DebugLnExit.s17"/>
<element name="DebugLnExit.s18"/>
<!-- function Visibility: default -->
<element name="ConvertLineEndings">
<short>Converts all line endings in a string into platform LineEnding.
</short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<element name="ConvertLineEndings.Result">
<short/>
</element>
<element name="ConvertLineEndings.s">
<short/>
</element>
<!-- procedure Visibility: default -->
<element name="DbgOut">
<short/>

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;