added lazdaemon from Michael Van Canneyt

git-svn-id: trunk@10555 -
This commit is contained in:
mattias 2007-02-01 10:17:44 +00:00
parent 346794aaae
commit e0705d3b83
5 changed files with 337 additions and 0 deletions

4
.gitattributes vendored
View File

@ -149,6 +149,9 @@ components/customform/demo/dbappform.pas svneol=native#text/plain
components/customform/demo/regappforms.pp svneol=native#text/plain
components/customform/lazcustforms.lpk svneol=native#text/plain
components/customform/lazcustforms.pas svneol=native#text/plain
components/daemon/lazdaemon.lpk svneol=native#text/plain
components/daemon/lazdaemon.pas svneol=native#text/plain
components/daemon/reglazdaemon.pp svneol=native#text/plain
components/fpcunit/Makefile svneol=native#text/plain
components/fpcunit/Makefile.fpc svneol=native#text/plain
components/fpcunit/blueball.xpm svneol=native#text/plain
@ -2780,6 +2783,7 @@ packager/globallinks/demopackagewithhelp-0.lpl svneol=native#text/plain
packager/globallinks/fpcunitconsolerunner-1.lpl svneol=native#text/plain
packager/globallinks/h2paswizard-0.lpl svneol=native#text/plain
packager/globallinks/lazcustomform-0.lpl svneol=native#text/plain
packager/globallinks/lazdaemon-0.lpl svneol=native#text/plain
packager/globallinks/lazopenglcontext-0.lpl svneol=native#text/plain
packager/globallinks/macosfiles-0.lpl svneol=native#text/plain
packager/globallinks/popupnotifierlaz-0.lpl svneol=native#text/plain

View File

@ -0,0 +1,56 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="2">
<Name Value="lazdaemon"/>
<Author Value="Michael Van Canneyt"/>
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
<IncludeFiles Value="unix/"/>
<OtherUnitFiles Value="unix/"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Description Value="Lazarus Service (Daemon) Support"/>
<License Value="Modified LGPL as in FCL or RTL"/>
<Version Minor="9" Release="9"/>
<Files Count="2">
<Item1>
<Filename Value="reglazdaemon.pp"/>
<HasRegisterProc Value="True"/>
<UnitName Value="reglazdaemon"/>
</Item1>
<Item2>
<Filename Value="daemonapp.pp"/>
<Type Value="Virtual Unit"/>
<UnitName Value="daemonapp"/>
</Item2>
</Files>
<Type Value="DesignTime"/>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="LCL"/>
</Item1>
<Item2>
<PackageName Value="IDEIntf"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,21 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit lazdaemon;
interface
uses
reglazdaemon, daemonapp, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('reglazdaemon', @reglazdaemon.Register);
end;
initialization
RegisterPackage('lazdaemon', @Register);
end.

View File

@ -0,0 +1,255 @@
unit reglazdaemon;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FormEditingIntf, projectintf,newitemintf, lazideintf,
controls, forms;
Type
{ TDaemonFileDescriptor }
{ TDaemonMapperDescriptor }
TDaemonMapperDescriptor = Class(TFileDescPascalUnitWithResource)
Public
Constructor Create; override;
Function GetLocalizedName : String; override;
Function GetLocalizedDescription : String; override;
Function GetInterfaceUsesSection : String; override;
function GetImplementationSource(const Filename, SourceName, ResourceName: string): string; override;
end;
TDaemonFileDescriptor = Class(TFileDescPascalUnitWithResource)
Public
Constructor Create; override;
Function GetLocalizedName : String; override;
Function GetLocalizedDescription : String; override;
Function GetInterfaceUsesSection : String; override;
function GetImplementationSource(const Filename, SourceName, ResourceName: string): string; override;
end;
{ TDaemonProjectDescriptor }
TDaemonProjectDescriptor = class(TProjectDescriptor)
public
constructor create; override;
function GetLocalizedName: string; override;
function GetLocalizedDescription: string; override;
function InitProject(AProject: TLazProject) : TModalResult; override;
function CreateStartFiles(AProject: TLazProject) : TModalResult; override;
published
{ Published declarations }
end;
Procedure Register;
implementation
uses daemonapp;
Resourcestring
SDaemonApps = 'Daemon (service) applications';
SDaemonAppName = 'Daemon (service) application';
SDaemonAppDescr = 'Daemon (service) application are non-gui applications that run in the backrgound.';
SDaemonName = 'Daemon Module';
SDaemonDescr = 'Daemon Module for inclusion in a daemon application';
SDaemonMapperName = 'Daemon mapper';
SDaemonMapperDescr = 'Daemon mapper for inclusion in a daemon application.'+LineEnding+
'Only one daemon mapper may exist in a daemon application.';
Procedure Register;
begin
RegisterNewItemCategory(SDaemonApps);
RegisterProjectDescriptor(TDaemonProjectDescriptor.Create,SDaemonApps);
RegisterProjectFileDescriptor(TDaemonFileDescriptor.Create,SDaemonApps);
RegisterProjectFileDescriptor(TDaemonMapperDescriptor.Create,SDaemonApps);
FormEditingHook.RegisterDesignerBaseClass(TDaemonMapper);
end;
{ TDaemonFileDescriptor }
constructor TDaemonFileDescriptor.Create;
begin
inherited Create;
ResourceClass:=TDaemon;
Name:='Daemon Module';
UseCreateFormStatements:=False;
end;
function TDaemonFileDescriptor.GetLocalizedName: String;
begin
Result:=SDaemonName;
end;
function TDaemonFileDescriptor.GetLocalizedDescription: String;
begin
Result:=SDaemonDescr;
end;
function TDaemonFileDescriptor.GetInterfaceUsesSection: String;
begin
Result:=inherited GetInterfaceUsesSection+', LResources, daemonapp';
end;
function TDaemonFileDescriptor.GetImplementationSource(const Filename,
SourceName, ResourceName: string): string;
Var
Src : TStrings;
begin
Src:=TStringList.Create;
try
Result:=inherited GetImplementationSource(Filename, SourceName, ResourceName);
With Src do
begin
Add('Procedure RegisterDaemon;');
Add('begin');
Add(' RegisterDaemonClass(T'+ResourceName+')');
Add('end;');
Add('');
Add(Result);
Add(' RegisterDaemon;');
Result:=Text;
end;
finally
Src.Free;
end;
end;
{ TDaemonProjectDescriptor }
constructor TDaemonProjectDescriptor.create;
begin
Inherited;
Flags:=Flags - [pfMainUnitHasCreateFormStatements];
Name:='Daemon Application';
end;
function TDaemonProjectDescriptor.GetLocalizedName: string;
begin
Result:=SDaemonAppName;
end;
function TDaemonProjectDescriptor.GetLocalizedDescription: string;
begin
Result:=SDaemonAppDescr;
end;
function TDaemonProjectDescriptor.InitProject(AProject: TLazProject
): TModalResult;
Var
F : TLazProjectFile;
Src : TStrings;
begin
Result:=Inherited InitProject(AProject);
If (Result=mrOK) then
begin
AProject.AddPackageDependency('FCL');
AProject.AddPackageDependency('LCL');
AProject.AddPackageDependency('LazDaemon');
AProject.Title:='Daemon application';
AProject.LazCompilerOptions.Win32GraphicApp:=False;
AProject.ProjectInfoFile:='project1.lpi';
F:=AProject.CreateProjectFile('project1.lpr');
F.IsPartOfProject:=True;
AProject.AddFile(F,False);
AProject.MainFileID:=0;
Src:=TStringList.Create;
try
With Src do
begin
Add('Program project1;');
Add('');
Add('Uses');
Add('{$IFDEF UNIX}{$IFDEF UseCThreads}');
Add(' cthreads,');
Add(' {$ENDIF}{$ENDIF}');
Add(' daemonapp');
Add(' { add your units here };');
Add('');
Add('begin');
Add(' Application.Initialize;');
Add(' Application.Run;');
Add('end.');
end;
F.SetSourceText(Src.Text);
finally
Src.Free;
end;
end;
end;
function TDaemonProjectDescriptor.CreateStartFiles(AProject: TLazProject): TModalResult;
Var
FD : TProjectFileDescriptor;
O : TNewFlags;
begin
FD:=ProjectFileDescriptors.FindByName('Daemon Mapper');
O:=[nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc];
Result:=LazarusIDE.DoNewEditorFile(FD,'','',O);
FD:=ProjectFileDescriptors.FindByName('Daemon Module');
Result:=LazarusIDE.DoNewEditorFile(FD,'','',O );
end;
{ TDaemonMapperDescriptor }
constructor TDaemonMapperDescriptor.Create;
begin
inherited Create;
Name:='Daemon Mapper';
ResourceClass:=TDaemonMapper;
UseCreateFormStatements:=False;
end;
function TDaemonMapperDescriptor.GetLocalizedName: String;
begin
Result:=SDaemonMapperName;
end;
function TDaemonMapperDescriptor.GetLocalizedDescription: String;
begin
Result:=SDaemonMapperDescr;
end;
function TDaemonMapperDescriptor.GetInterfaceUsesSection: String;
begin
Result:=inherited GetInterfaceUsesSection+', LResources, daemonapp';
end;
function TDaemonMapperDescriptor.GetImplementationSource(const Filename,
SourceName, ResourceName: string): string;
Var
Src : TStrings;
begin
Src:=TStringList.Create;
try
Result:=inherited GetImplementationSource(Filename, SourceName, ResourceName);
With Src do
begin
Add('Procedure RegisterMapper;');
Add('begin');
Add(' RegisterDaemonMapper(T'+ResourceName+')');
Add('end;');
Add('');
Add(Result);
Add(' RegisterMapper;');
Result:=Text;
end;
finally
Src.Free;
end;
end;
end.

View File

@ -0,0 +1 @@
$(LazarusDir)/components/daemon/lazdaemon.lpk