moved some lazarus resource code to LResources.pp

git-svn-id: trunk@4703 -
This commit is contained in:
mattias 2003-10-07 14:54:59 +00:00
parent d1b6f316f9
commit dfab5a13b1
8 changed files with 126 additions and 22 deletions

View File

@ -1,8 +1,8 @@
#
# Don't edit, this file is generated by FPCMake Version 1.1 [2003/07/04]
# Don't edit, this file is generated by FPCMake Version 1.1 [2003/10/06]
#
default: all
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom
override PATH:=$(subst \,/,$(PATH))
ifeq ($(findstring ;,$(PATH)),)
inUnix=1
@ -462,6 +462,11 @@ STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=go32
endif
ifeq ($(OS_TARGET),watcom)
STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=watcom
endif
ifeq ($(OS_TARGET),linux)
EXEEXT=
HASSHAREDLIB=1
@ -564,6 +569,11 @@ STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=go32
endif
ifeq ($(OS_TARGET),watcom)
STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=watcom
endif
ifeq ($(OS_TARGET),linux)
EXEEXT=
HASSHAREDLIB=1
@ -1193,6 +1203,16 @@ REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
endif
endif
ifeq ($(OS_TARGET),watcom)
ifeq ($(CPU_TARGET),i386)
REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_FCL=1
REQUIRE_PACKAGES_REGEXPR=1
REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
endif
endif
ifdef REQUIRE_PACKAGES_RTL
PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR))))))
ifneq ($(PACKAGEDIR_RTL),)
@ -1572,7 +1592,7 @@ endif
.PHONY: fpc_examples
ifdef TARGET_EXAMPLES
HASEXAMPLES=1
override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)))
override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES)))
override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))
override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
@ -1597,7 +1617,7 @@ fpc_debug:
$(MAKE) all DEBUG=1
fpc_release:
$(MAKE) all RELEASE=1
.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp .rc .res
.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .dpr .pp .rc .res
%$(PPUEXT): %.pp
$(COMPILER) $<
$(EXECPPAS)
@ -1610,10 +1630,14 @@ fpc_release:
%$(EXEEXT): %.pas
$(COMPILER) $<
$(EXECPPAS)
%$(EXEEXT): %.dpr
$(COMPILER) $<
$(EXECPPAS)
%.res: %.rc
windres -i $< -o $@
vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
ifdef INSTALL_UNITS

View File

@ -2844,15 +2844,15 @@ var
for the OS specific)
For example:
classes.pp can be found in several places
<FPCSrcDir>/fcl/os2/classes.pp
<FPCSrcDir>/fcl/linux/classes.pp
<FPCSrcDir>/fcl/win32/classes.pp
<FPCSrcDir>/fcl/go32v2/classes.pp
<FPCSrcDir>/fcl/freebsd/classes.pp
<FPCSrcDir>/fcl/template/classes.pp
<FPCSrcDir>/fcl/classes/os2/classes.pp
<FPCSrcDir>/fcl/classes/linux/classes.pp
<FPCSrcDir>/fcl/classes/win32/classes.pp
<FPCSrcDir>/fcl/classes/go32v2/classes.pp
<FPCSrcDir>/fcl/classes/freebsd/classes.pp
<FPCSrcDir>/fcl/classes/template/classes.pp
This will result in a single filename:
$(#FPCSrcDir)/fcl/$(#TargetOS)/classes.pp
$(#FPCSrcDir)/fcl/classes/$(#TargetOS)/classes.pp
}
if (FileNameMacroCount(OldUnitLink.Filename)=0)
or (SrcOSMacroUsed) then begin

View File

@ -5875,7 +5875,7 @@ begin
Result:=PkgBoss.DoCompileAutoInstallPackages([]);
if Result<>mrOk then exit;
// create uses addition for IDE
// create uses section addition for lazarus.pp
Result:=PkgBoss.DoSaveAutoInstallConfig;
if Result<>mrOk then exit;
@ -5886,7 +5886,7 @@ begin
// save extra options
IDEBuildFlags:=Flags+[blfOnlyIDE];
Result:=SaveIDEMakeOptions(MiscellaneousOptions.BuildLazOpts,
MacroList,PkgOptions,IDEBuildFlags);
MacroList,PkgOptions,IDEBuildFlags);
if Result<>mrOk then exit;
// make ide
@ -9794,6 +9794,9 @@ end.
{ =============================================================================
$Log$
Revision 1.653 2003/10/07 14:54:58 mattias
moved some lazarus resource code to LResources.pp
Revision 1.652 2003/10/02 12:19:25 mattias
fixed saving before build file

View File

@ -1,8 +1,8 @@
#
# Don't edit, this file is generated by FPCMake Version 1.1 [2003/09/12]
# Don't edit, this file is generated by FPCMake Version 1.1 [2003/10/06]
#
default: all
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom
override PATH:=$(subst \,/,$(PATH))
ifeq ($(findstring ;,$(PATH)),)
inUnix=1
@ -246,7 +246,7 @@ override REQUIRE_PACKAGESDIR+=$(LCLCOMPONENTDIR)
override COMPILER_UNITDIR+=$(LCLUNITDIR)
override TARGET_DIRS+=interfaces
override TARGET_UNITS+=allunits
override TARGET_IMPLICITUNITS+=arrow actnlist buttons calendar clipbrd clistbox comctrls commctrl controls dialogs dynamicarray dynhasharray extctrls extendedstrings filectrl forms graphics graphmath graphtype grids imglist interfacebase lazlinkedlist lclmemmanager lclintf lclstrconsts lcltype lmessages lresources maskedit menus messages registry spin stdctrls stringhashlist toolwin utrace vclglobals printers postscriptprinter intfgraphics dbctrls dbgrids
override TARGET_IMPLICITUNITS+=arrow actnlist buttons calendar clipbrd clistbox comctrls commctrl controls dialogs dynamicarray dynhasharray extctrls extendedstrings filectrl forms graphics graphmath graphtype grids imglist interfacebase lazlinkedlist lclmemmanager lclintf lclstrconsts lcltype lmessages lresources maskedit menus messages registry spin stdctrls stringhashlist toolwin utrace vclglobals printers postscriptprinter dbctrls dbgrids
override TARGET_RSTS+=dialogs
override CLEAN_FILES+=$(wildcard units/*$(OEXT)) $(wildcard units/*$(PPUEXT)) $(wildcard units/*$(RSTEXT))$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
override INSTALL_BUILDUNIT=allunits
@ -484,6 +484,11 @@ STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=go32
endif
ifeq ($(OS_TARGET),watcom)
STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=watcom
endif
ifeq ($(OS_TARGET),linux)
EXEEXT=
HASSHAREDLIB=1
@ -586,6 +591,11 @@ STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=go32
endif
ifeq ($(OS_TARGET),watcom)
STATICLIBPREFIX=
FPCMADE=fpcmade.dos
ZIPSUFFIX=watcom
endif
ifeq ($(OS_TARGET),linux)
EXEEXT=
HASSHAREDLIB=1
@ -1252,6 +1262,17 @@ REQUIRE_PACKAGES_OPENGL=1
REQUIRE_PACKAGES_GTK=1
endif
endif
ifeq ($(OS_TARGET),watcom)
ifeq ($(CPU_TARGET),i386)
REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_FCL=1
REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
REQUIRE_PACKAGES_OPENGL=1
REQUIRE_PACKAGES_GTK=1
endif
endif
ifdef REQUIRE_PACKAGES_RTL
PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR))))))
ifneq ($(PACKAGEDIR_RTL),)
@ -1684,7 +1705,7 @@ fpc_debug:
$(MAKE) all DEBUG=1
fpc_release:
$(MAKE) all RELEASE=1
.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp .rc .res
.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .dpr .pp .rc .res
%$(PPUEXT): %.pp
$(COMPILER) $<
$(EXECPPAS)
@ -1697,10 +1718,14 @@ fpc_release:
%$(EXEEXT): %.pas
$(COMPILER) $<
$(EXECPPAS)
%$(EXEEXT): %.dpr
$(COMPILER) $<
$(EXECPPAS)
%.res: %.rc
windres -i $< -o $@
vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
ifdef INSTALL_UNITS

View File

@ -16,7 +16,7 @@ implicitunits=arrow actnlist buttons calendar clipbrd clistbox comctrls \
imglist interfacebase lazlinkedlist lclmemmanager lclintf lclstrconsts \
lcltype lmessages lresources maskedit menus messages registry spin \
stdctrls stringhashlist toolwin utrace vclglobals printers \
postscriptprinter intfgraphics dbctrls dbgrids
postscriptprinter dbctrls dbgrids
# and do not add allunits. It is just a dummy unit used for compiling.
rsts=dialogs

View File

@ -1205,7 +1205,7 @@ function InitResourceComponent(Instance: TComponent;
end;
end;
finally
ApplyVisible;
//ApplyVisible;
MemStream.Free;
end;
Result:=true;
@ -1219,7 +1219,8 @@ begin
//LocalizedLoading:=(Instance.ComponentState * [csInline,csLoading])=[];
//if LocalizedLoading then BeginGlobalLoading; // push new loadlist onto stack
try
Result:=InitComponent(Instance.ClassType);
Result:=InitLazResourceComponent(Instance,RootAncestor);
//Result:=InitComponent(Instance.ClassType);
//if LocalizedLoading then NotifyGlobalLoading; // call Loaded
finally
//if LocalizedLoading then EndGlobalLoading; // pop loadlist off stack

View File

@ -270,12 +270,13 @@ end;
------------------------------------------------------------------------------}
Procedure TCustomForm.SetVisible(Value : boolean);
Begin
if (Value=(fsVisible in FFormState)) and (Visible=Value) then exit;
//writeln('[TCustomForm.SetVisible] START ',Name,':',ClassName,' Old=',Visible,' New=',Value,' ',(fsCreating in FFormState),' ',FormUpdating);
if Value then
Include(FFormState, fsVisible)
else
Exclude(FFormState, fsVisible);
//writeln('TCustomForm.SetVisible ',Name,':',ClassName,' ',FormUpdating);
//writeln('TCustomForm.SetVisible ',Name,':',ClassName,' FormUpdating=',FormUpdating,' fsCreating=',fsCreating in FFormState);
if (fsCreating in FFormState) {or FormUpdating} then
// will be done when finished loading
else
@ -978,6 +979,7 @@ Begin
FFormStyle:= fsNormal;
inherited Create(AOwner);
Visible := False;
fCompStyle:= csForm;
FMenu := nil;
@ -985,7 +987,6 @@ Begin
ControlStyle := ControlStyle + [csAcceptsControls, csCaptureMouse,
csClickEvents, csSetCaption, csDoubleClicks];
SetInitialBounds(0,0,320,240);
Visible := False;
ParentColor := False;
ParentFont := False;
Ctl3D := True;
@ -1274,6 +1275,9 @@ begin
FActiveControl := nil;
if Control.CanFocus then SetActiveControl(Control);
end;
//writeln('TCustomForm.Loaded ',Name,':',ClassName,' ',FormUpdating,' ',fsCreating in FFormState,' ',Visible,' ',fsVisible in FormState);
if fsVisible in FormState then
Visible:=true;
end;
{------------------------------------------------------------------------------
@ -1435,6 +1439,9 @@ end;
{ =============================================================================
$Log$
Revision 1.116 2003/10/07 14:54:59 mattias
moved some lazarus resource code to LResources.pp
Revision 1.115 2003/09/18 09:21:03 mattias
renamed LCLLinux to LCLIntf

View File

@ -61,6 +61,9 @@ type
destructor Destroy; override;
end;
function InitLazResourceComponent(Instance: TComponent;
RootAncestor: TClass): Boolean;
procedure BinaryToLazarusResourceCode(BinStream,ResStream:TStream;
ResourceName, ResourceType:AnsiString);
function LFMtoLRSfile(LFMfilename:ansistring):boolean;
@ -1321,6 +1324,47 @@ begin
end;
end;
function InitLazResourceComponent(Instance: TComponent;
RootAncestor: TClass): Boolean;
function InitComponent(ClassType: TClass): Boolean;
var
CompResource: TLResource;
MemStream: TMemoryStream;
begin
//writeln('[InitComponent] ',ClassType.Classname,' ',Instance<>nil);
Result:=false;
if (ClassType=TComponent) or (ClassType=RootAncestor) then exit;
if Assigned(ClassType.ClassParent) then
Result:=InitComponent(ClassType.ClassParent);
CompResource:=LazarusResources.Find(ClassType.ClassName);
if (CompResource=nil) or (CompResource.Value='') then exit;
//writeln('[InitComponent] CompResource found for ',ClassType.Classname);
MemStream:=TMemoryStream.Create;
try
MemStream.Write(CompResource.Value[1],length(CompResource.Value));
MemStream.Position:=0;
//writeln('Form Stream "',ClassType.ClassName,'" Signature=',copy(CompResource.Value,1,4));
try
Instance:=MemStream.ReadComponent(Instance);
except
on E: Exception do begin
writeln(Format(rsFormStreamingError,[ClassType.ClassName,E.Message]));
exit;
end;
end;
finally
MemStream.Free;
end;
Result:=true;
end;
begin
Result:=InitComponent(Instance.ClassType);
end;
//------------------------------------------------------------------------------
initialization
LazarusResources:=TLResourceList.Create;