[lazarus] Location of lresources
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Jan 4 05:26:07 EST 2001
Hi all,
I don't think, that resources are IDE specific. Perhaps you can call the
IDE some kind of resource editor.
The LFM files could be IDE specific, because they are only usable by
IDE(s). The LFC files should belong to the LCL, because they are simply streamed
components in resource format. The forms.pp depends on the resources (e.g.
formdata and application icon).
Therefore I would suggest:
-put lresources into the lcl directory
-move LFM procedures into IDE
-add function FormToLCLResource(ResStream:TStream):integer; to
lresources.pp
-rename LazarusResources to LCLResources (Marc)
function FormToLCLResource(AForm:TForm;
ResStream:TStream):integer;
// 0 = ok
// -1 = error while streaming AForm to binary stream
// -2 = error while streaming binary stream
// to resource stream
var BinStream:TMemoryStream;
Driver: TAbstractObjectWriter;
Writer:TWriter;
begin
BinStream:=TMemoryStream.Create;
try
try
Driver:=TBinaryObjectWriter.Create(BinStream,4096);
try
Writer:=TWriter.Create(Driver);
try
Writer.WriteDescendent(AForm,nil);
finally
Writer.Free;
end;
finally
Driver.Free;
end;
except
Result:=-1;
exit;
end;
try
BinStream.Position:=0;
BinaryToLazarusResourceCode(BinStream,ResStream);
except
Result:=-1;
exit;
end;
finally
BinStream.Free;
end;
end;
Mattias
More information about the Lazarus
mailing list