📄 jvpluginwizard.pas
字号:
procedure TJvPluginProjectCreator.NewDefaultModule;
var
Module: IOTAModule;
ModuleCreator: TJvPluginModuleCreator;
begin
ModuleCreator := TJvPluginModuleCreator.Create;
ModuleCreator.Wizard := Wizard;
ModuleCreator.PlugType := PlugType;
ModuleCreator.PlugName := PlugName;
ModuleCreator.PlugAuth := PlugAuth;
ModuleCreator.PlugDesc := PlugDesc;
ModuleCreator.PlugCopy := PlugCopy;
ModuleCreator.PlugUID := PlugUID;
ModuleCreator.Project := Project;
Module := (BorlandIDEServices as IOTAModuleServices).CreateModule(ModuleCreator);
end;
function TJvPluginProjectCreator.NewOptionSource(const ProjectName: string): IOTAFile;
begin
Result := nil;
end;
procedure TJvPluginProjectCreator.NewProjectResource(const Project: IOTAProject);
begin
end;
function TJvPluginProjectCreator.NewProjectSource(const ProjectName: string): IOTAFile;
var
S: string;
begin
{ 0 = dll; 1 = dpk }
if PlugType = 0 then
S := 'library ' + ProjectName + ';' + CrLf +
CrLf +
'uses' + CrLf +
' ShareMem,' + cPluginPrefix + PlugName + ';' + CrLf +
CrLf +
'{$R *.res}' + CrLf +
CrLf +
'exports' + CrLf +
' RegisterPlugin;' + CrLf +
CrLf +
'begin' + CrLf +
'end.'
else // Package-Library
S := 'package ' + ProjectName + ';' + CrLf2 +
'{$DESCRIPTION ''JEDI Plugin Package''}' + CrLf +
'{$RUNONLY}' + CrLf +
'{$IMPLICITBUILD ON}' + CrLf2 +
'requires' + CrLf +
{$IFDEF COMPILER5}
' vcl50,' + CrLf + ' JvCoreD5R;' + CrLf2 +
{$ENDIF COMPILER5}
{$IFDEF COMPILER6}
' vcl,' + CrLf + ' JvCoreD6R;' + CrLf2 +
{$ENDIF COMPILER6}
{$IFDEF COMPILER7}
' vcl,' + CrLf + ' JvCoreD7R;' + CrLf2 +
{$ENDIF COMPILER7}
{$IFDEF COMPILER9}
' vcl,' + CrLf + ' JvCoreD9R;' + CrLf2 +
{$ENDIF COMPILER9}
'end.';
Result := TJvOTAFile.Create(S);
end;
function TJvPluginProjectCreator.GetCreatorType: string;
begin
{ 0 = dll; 1 = dpk }
if PlugType = 0 then
Result := sLibrary
else
Result := sPackage;
end;
function TJvPluginProjectCreator.GetExisting: Boolean;
begin
Result := False;
end;
function TJvPluginProjectCreator.GetFileSystem: string;
begin
Result := '';
end;
function GetCurrentProjectGroup: IOTAProjectGroup;
var
IModuleServices: IOTAModuleServices;
IModule: IOTAModule;
IProjectGroup: IOTAProjectGroup;
I: Integer;
begin
Result := nil;
IModuleServices := BorlandIDEServices as IOTAModuleServices;
for I := 0 to IModuleServices.ModuleCount - 1 do
begin
IModule := IModuleServices.Modules[I];
if IModule.QueryInterface(IOTAProjectGroup, IProjectGroup) = S_OK then
begin
Result := IProjectGroup;
Break;
end;
end;
end;
function TJvPluginProjectCreator.GetOwner: IOTAModule;
begin
Result := GetCurrentProjectGroup; // nil
end;
function TJvPluginProjectCreator.GetUnnamed: Boolean;
begin
Result := True;
end;
//=== { TJvOTAFile } =========================================================
// TJvOTAFile - from Stefaan Lesage
constructor TJvOTAFile.Create(const Source: string);
begin
// (rom) added inherited Create;
inherited Create;
FSource := Source;
end;
function TJvOTAFile.GetAge: TDateTime;
begin
Result := -1; // new
end;
function TJvOTAFile.GetSource: string;
begin
Result := FSource;
end;
procedure RegisterContainerModule;
begin
RegisterCustomModule(TJvPlugIn, TCustomModule);
end;
//=== { TJvPluginModuleCreator } =============================================
{*****************************************************************************
Name : TJvPluginModuleCreator.FormCreated
Author : Stefaan Lesage
Arguments : FormEditor - Interface to the IOTAFormEditor for the form
that has been created.
Return Values : None
Exceptions : None
Description : This method will be executed Called the new
form/datamodule/custom module is created. We will use it
to initialise some properties on the TJvPluginDataModule.
History :
Date By Description
---- -- -----------
11/07/2003 slesage Initial creation of the Method.
*****************************************************************************}
procedure TJvPluginModuleCreator.FormCreated(const FormEditor: IOTAFormEditor);
begin
with TJvPlugIn(INTAComponent(FormEditor.GetRootComponent).GetComponent) do
begin
Author := PlugAuth;
Description := PlugDesc;
Copyright := PlugCopy;
PluginID := PlugUID;
end;
end;
{*****************************************************************************
Name : TJvPluginModuleCreator.GetAncestorName
Author : Stefaan Lesage
Arguments : None
Return Values : The name of the Ancestor.
Exceptions : None
Description : Property Getter for the AncestorName property
History :
Date By Description
---- -- -----------
11/07/2003 slesage Initial creation of the Method.
*****************************************************************************}
function TJvPluginModuleCreator.GetAncestorName: string;
begin
Result := 'JvPlugin';
end;
{*****************************************************************************
Name : TJvPluginModuleCreator.GetCreatorType
Author : Stefaan Lesage
Arguments : None
Return Values : Returns the type of the creator as a string. In our case
it returns sForm since we create a DataModule / CustomForm.
Exceptions : None
Description : Property Getter for the CreatorType property.
History :
Date By Description
---- -- -----------
11/07/2003 slesage Initial creation of the Method.
*****************************************************************************}
function TJvPluginModuleCreator.GetCreatorType: string;
begin
Result := sForm;
end;
{*****************************************************************************
Name : TJvPluginModuleCreator.GetExisting
Author : Stefaan Lesage
Arguments : None
Return Values : Returns a Boolean indicating if this is an existing
module. We return False since this is a new Module.
Exceptions : None
Description : Property Getter for the Existing property.
History :
Date By Description
---- -- -----------
11/07/2003 slesage Initial creation of the Method.
*****************************************************************************}
function TJvPluginModuleCreator.GetExisting: Boolean;
begin
Result := False;
end;
{*****************************************************************************
Name : TJvPluginModuleCreator.GetFileSystem
Author : Stefaan Lesage
Arguments : None
Return Values : Return the File system IDString that this module uses for
reading/writing. We return an empty string since our module
doesn't use a virtual file system.
Exceptions : None
Description : Property Getter for the FileSystem property.
History :
Date By Description
---- -- -----------
11/07/2003 slesage Initial creation of the Method.
*****************************************************************************}
function TJvPluginModuleCreator.GetFileSystem: string;
begin
Result := '';
end;
{*****************************************************************************
Name : TJvPluginModuleCreator.GetFormName
Author : Stefaan Lesage
Arguments : None
Return Values : Returns the name of the form ( not the class, but its
actual name property ). We will make sure that each
plugin module always gets the Plugin prefix before its
name.
Exceptions : None
Description : Property getter for the FormName property.
History :
Date By Description
---- -- -----------
11/07/2003 slesage Initial creation of the Method.
*****************************************************************************}
function TJvPluginModuleCreator.GetFormName: string;
begin
Result := cPluginPrefix + PlugName;
end;
{*****************************************************************************
Name : TJvPluginModuleCreator.GetImplFileName
Author : Stefaan Lesage
Arguments : None
Return Values : Returns the complete path to the implementation ( source )
file name, e.g. 揅:\dir\Unit1.pas
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -