mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 14:29:36 +02:00
Converter: Remove unused code. Turn a private method FixWideString into a function.
git-svn-id: trunk@60032 -
This commit is contained in:
parent
abbb0f061a
commit
411c7643fd
@ -58,8 +58,6 @@ type
|
|||||||
private
|
private
|
||||||
fSettings: TConvertSettings;
|
fSettings: TConvertSettings;
|
||||||
fOrigFormat: TLRSStreamOriginalFormat;
|
fOrigFormat: TLRSStreamOriginalFormat;
|
||||||
function FixWideString(aInStream, aOutStream: TMemoryStream): TModalResult;
|
|
||||||
function GetLFMFilename(const DfmFilename: string; KeepCase: boolean): string;
|
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -147,54 +145,7 @@ begin
|
|||||||
and (TLFMObjectNode(Node).TypeName<>'');
|
and (TLFMObjectNode(Node).TypeName<>'');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDFMConverter }
|
function FixWideString(aInStream, aOutStream: TMemoryStream): TModalResult;
|
||||||
|
|
||||||
constructor TDFMConverter.Create;
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TDFMConverter.Destroy;
|
|
||||||
begin
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TDFMConverter.Convert(const DfmFilename: string): TModalResult;
|
|
||||||
var
|
|
||||||
s: String;
|
|
||||||
Urgency: TMessageLineUrgency;
|
|
||||||
begin
|
|
||||||
Result:=ConvertDfmToLfm(DfmFilename);
|
|
||||||
if Result=mrOK then begin
|
|
||||||
if fOrigFormat=sofBinary then begin
|
|
||||||
s:=Format(lisFileSIsConvertedToTextFormat, [DfmFilename]);
|
|
||||||
Urgency:=mluHint;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
s:=Format(lisFileSHasIncorrectSyntax, [DfmFilename]);
|
|
||||||
Urgency:=mluError;
|
|
||||||
end;
|
|
||||||
if Assigned(fSettings) then
|
|
||||||
fSettings.AddLogLine(Urgency, s, DfmFilename)
|
|
||||||
else
|
|
||||||
ShowMessage(s);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TDFMConverter.GetLFMFilename(const DfmFilename: string;
|
|
||||||
KeepCase: boolean): string;
|
|
||||||
begin
|
|
||||||
if DfmFilename<>'' then begin
|
|
||||||
// platform and fpc independent unitnames are lowercase, so are the lfm files
|
|
||||||
Result:=lowercase(ExtractFilenameOnly(DfmFilename));
|
|
||||||
if KeepCase then
|
|
||||||
Result:=ExtractFilenameOnly(DfmFilename);
|
|
||||||
Result:=ExtractFilePath(DfmFilename)+Result+'.lfm';
|
|
||||||
end else
|
|
||||||
Result:='';
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TDFMConverter.FixWideString(aInStream, aOutStream: TMemoryStream): TModalResult;
|
|
||||||
// Convert Windows WideString syntax (#xxx) to UTF8
|
// Convert Windows WideString syntax (#xxx) to UTF8
|
||||||
|
|
||||||
function UnicodeNumber(const InS: string; var Ind: integer): string;
|
function UnicodeNumber(const InS: string; var Ind: integer): string;
|
||||||
@ -285,6 +236,40 @@ begin
|
|||||||
aOutStream.Write(OutS[1], Length(OutS));
|
aOutStream.Write(OutS[1], Length(OutS));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TDFMConverter }
|
||||||
|
|
||||||
|
constructor TDFMConverter.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TDFMConverter.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDFMConverter.Convert(const DfmFilename: string): TModalResult;
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
Urgency: TMessageLineUrgency;
|
||||||
|
begin
|
||||||
|
Result:=ConvertDfmToLfm(DfmFilename);
|
||||||
|
if Result=mrOK then begin
|
||||||
|
if fOrigFormat=sofBinary then begin
|
||||||
|
s:=Format(lisFileSIsConvertedToTextFormat, [DfmFilename]);
|
||||||
|
Urgency:=mluHint;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
s:=Format(lisFileSHasIncorrectSyntax, [DfmFilename]);
|
||||||
|
Urgency:=mluError;
|
||||||
|
end;
|
||||||
|
if Assigned(fSettings) then
|
||||||
|
fSettings.AddLogLine(Urgency, s, DfmFilename)
|
||||||
|
else
|
||||||
|
ShowMessage(s);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TDFMConverter.ConvertDfmToLfm(const aFilename: string): TModalResult;
|
function TDFMConverter.ConvertDfmToLfm(const aFilename: string): TModalResult;
|
||||||
var
|
var
|
||||||
DFMStream, LFMStream, Utf8LFMStream: TMemoryStreamUTF8;
|
DFMStream, LFMStream, Utf8LFMStream: TMemoryStreamUTF8;
|
||||||
|
Loading…
Reference in New Issue
Block a user