📄 atbwizard.pas
字号:
function TATBFrmWizard.GetAuthor: string;
begin
Result := 'TMS Team';
end;
//------------------------------------------------------------------------------
function TATBFrmWizard.GetComment: string;
begin
Result := 'Creates a new ToolBar form.'
end;
//------------------------------------------------------------------------------
{
function TATBFrmWizard.GetOwner: IOTAModule;
var
I: Integer;
ModServ: IOTAModuleServices;
Module: IOTAModule;
ProjGrp: IOTAProjectGroup;
begin
Result := nil;
ModServ := BorlandIDEServices as IOTAModuleServices;
for I := 0 to ModServ.ModuleCount - 1 do
begin
Module := ModSErv.Modules[I];
// find current project group
if CompareText(ExtractFileExt(Module.FileName), '.bpg') = 0 then
if Module.QueryInterface(IOTAProjectGroup, ProjGrp) = S_OK then
begin
// return active project of group
Result := ProjGrp.GetActiveProject;
Exit;
end;
end;
end;
//------------------------------------------------------------------------------
function TATBFrmWizard.GetImplFileName: string;
var
CurrDir: array[0..MAX_PATH] of char;
begin
// Note: full path name required!
GetCurrentDirectory(SizeOf(CurrDir), CurrDir);
Result := Format('%s\%s.pas', [CurrDir, FUnitIdent, '.pas']);
end;
}
//------------------------------------------------------------------------------
{ TATBUnitCreator }
constructor TATBUnitCreator.Create(AOwner: IOTAModule; UnitIdent, ClassName, aFileName: string; AIsMainForm: Boolean);
begin
FUnitIdent := UnitIdent;
FClassName := ClassName;
FFileName := aFileName;
inherited Create;
FOwner := AOwner;
FIsMainForm := AIsMainForm;
end;
//------------------------------------------------------------------------------
procedure TATBUnitCreator.FormCreated(const FormEditor: IOTAFormEditor);
begin
//
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetAncestorName: string;
begin
Result := 'TAdvToolBarForm';//'TForm';
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetCreatorType: string;
begin
Result := sForm;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetExisting: Boolean;
begin
Result := False;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetFileSystem: string;
begin
Result := '';
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetFormName: string;
begin
Result := FClassName;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetImplFileName: string;
var
//CurrDir: array[0..MAX_PATH] of char;
ProjectDir: string;
begin
// Note: full path name required!
{GetCurrentDirectory(SizeOf(CurrDir), CurrDir);
Result := Format('%s\%s.pas', [CurrDir, FUnitIdent, '.pas']);
}
ProjectDir := GetIDEProjectPath;
ProjectDir := IncludeTrailingPathDelim(ProjectDir);
{$IFDEF DELPHI9_LVL}
if not FIsMainForm then
begin
//Result := ProjectOptions.FormFile;
//Result := FFileName;
end
else
begin
Result := MakeFileName(ProjectDir, FUnitIdent, 'pas');
end;
{$ELSE}
Result := MakeFileName(ProjectDir, FUnitIdent, 'pas');
{$ENDIF}
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetIntfFileName: string;
begin
Result := '';
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetMainForm: Boolean;
begin
Result := FIsMainForm;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetOwner: IOTAModule;
begin
Result := FOwner;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetShowForm: Boolean;
begin
Result := True;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetShowSource: Boolean;
begin
Result := True;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.GetUnnamed: Boolean;
begin
Result := True;
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.NewFormFile(const FormIdent,
AncestorIdent: string): IOTAFile;
begin
Result := TFormFile.Create('', FormIdent, AncestorIdent);
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.NewImplSource(const ModuleIdent, FormIdent,
AncestorIdent: string): IOTAFile;
begin
Result := TUnitFile.Create(ModuleIdent, FormIdent, AncestorIdent);
end;
//------------------------------------------------------------------------------
function TATBUnitCreator.NewIntfSource(const ModuleIdent, FormIdent,
AncestorIdent: string): IOTAFile;
begin
Result := nil;
end;
//------------------------------------------------------------------------------
{ TATBApplicationWizard }
procedure TATBApplicationWizard.Execute;
var
//LProj : IOTAProject;
LModuleServices : IOTAModuleServices;
ProjectDir: string;
begin
LModuleServices := (BorlandIDEServices as IOTAModuleServices);
FProjectName := FindNewProjectName(GetActiveProjectGroup);
ProjectDir := GetIDEProjectPath;
ProjectDir := IncludeTrailingPathDelim(ProjectDir);
{$IFDEF DELPHI2006_LVL}
LModuleServices.GetNewModuleAndClassName('', FUnitIdent, FClassName, FFileName);
FClassName := 'TMSForm' + Copy(FUnitIdent, 5, Length(FUnitIdent));
{$ELSE}
LModuleServices.GetNewModuleAndClassName('TMSForm', FUnitIdent, FClassName, FFileName);
{$ENDIF}
LModuleServices.CreateModule(TATBProjectCreator.Create(FProjectName, ProjectDir, FUnitIdent, FClassName, FFileName));
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetAuthor: string;
begin
Result := 'TMS Team';
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetComment: string;
begin
Result := 'AdvToolBar Application Wizard';
end;
//------------------------------------------------------------------------------
{$IFDEF DELPHI2006_LVL}
function TATBApplicationWizard.GetGalleryCategory: IOTAGalleryCategory;
begin
if (EasyDelphiCategory = nil) then
EasyDelphiCategory := IOTAGalleryCategoryManager(BorlandIDEServices as IOTAGalleryCategoryManager).AddCategory(
IOTAGalleryCategoryManager(BorlandIDEServices as IOTAGalleryCategoryManager).FindCategory(sCategoryDelphiNew),
'TMS.ATBApplicationWizard', 'TMS Wizard', 0);
Result := EasyDelphiCategory;
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetPersonality: string;
begin
Result := sDelphiPersonality;
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetDesigner: string;
begin
Result := dVCL;
end;
{$ENDIF}
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetGlyph: {$IFDEF DELPHI6_LVL}Cardinal{$ELSE}HICON{$ENDIF};
begin
result := 0;
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetIDString: string;
begin
Result := 'TMS.ATBApplicationWizard';
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetName: string;
begin
Result := 'TMS ToolBar Application Wizard';
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetPage: string;
begin
Result := 'TMS';
end;
//------------------------------------------------------------------------------
function TATBApplicationWizard.GetState: TWizardState;
begin
Result := [wsEnabled];
end;
//------------------------------------------------------------------------------
{ TATBProjectCreator }
constructor TATBProjectCreator.Create(ProjFile, ProjectDir, UnitName, FormClass, aFileName: string);
begin
inherited Create;
FProjectFile := ProjFile;
FProjectDirectory := ProjectDir;
FUnitName := UnitName;
FFormClass := FormClass;
FFileName := aFileName;
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.GetCreatorType: string;
begin
Result := sApplication;
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.GetExisting: Boolean;
begin
Result := False;
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.GetFileName: string;
begin
Result := FProjectDirectory + FProjectFile + '.dpr';
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.GetFileSystem: string;
begin
result := '';
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.GetOptionFileName: string;
begin
Result := '';
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.GetOwner: IOTAModule;
begin
result := nil;
end;
//------------------------------------------------------------------------------
{$IFDEF DELPHI2006_LVL}
function TATBProjectCreator.GetProjectPersonality: string;
begin
{$IFDEF DELPHI2006_LVL}
Result := sDelphiPersonality;
{$ELSE}
Result := 'Delphi.Personality';
{$ENDIF}
end;
{$ENDIF}
//------------------------------------------------------------------------------
function TATBProjectCreator.GetShowSource: Boolean;
begin
result := True; //not FIsBCB;
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.GetUnnamed: Boolean;
begin
result := True;
end;
//------------------------------------------------------------------------------
procedure TATBProjectCreator.NewDefaultModule;
begin
//
end;
//------------------------------------------------------------------------------
procedure TATBProjectCreator.NewDefaultProjectModule( const Project: IOTAProject);
Var
LModuleServices : IOTAModuleServices;
begin
LModuleServices := (BorlandIDEServices as IOTAModuleServices);
LModuleServices.CreateModule(TATBUnitCreator.Create(Project, FUnitName, FFormClass, FFileName, True));
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.NewOptionSource(const ProjectName: string): IOTAFile;
begin
result := nil;
end;
//------------------------------------------------------------------------------
procedure TATBProjectCreator.NewProjectResource(const Project: IOTAProject);
begin
//
end;
//------------------------------------------------------------------------------
function TATBProjectCreator.NewProjectSource(const ProjectName: string): IOTAFile;
begin
result := TATBProjectFile.Create(ProjectName, FUnitName, FFormClass);
end;
//------------------------------------------------------------------------------
{ TATBProjectFile }
constructor TATBProjectFile.Create(ProjName, UnitName, FormClass: string);
begin
inherited Create;
FProjectName := ProjName;
FUnitName := UnitName;
FFormClass := FormClass;
end;
//------------------------------------------------------------------------------
function TATBProjectFile.GetAge: TDateTime;
begin
Result := -1;
end;
//------------------------------------------------------------------------------
function TATBProjectFile.GetSource: string;
begin
Result := 'program ' + FProjectName + ';' + #13#10 + #13#10 +
{$IFDEF DELPHI2006_LVL}
'uses Forms;'+#13#10+
{$ELSE}
'uses Forms,'+#13#10+
' '+FUnitName+' in '''+FUnitName+'.pas'' {'+FFormClass+'};' + #13#10 +
{$ENDIF}
'{$R *.res}' + #13#10 + #13#10 +
'begin' + #13#10 +
' Application.Initialize;'+ #13#10 +
{$IFDEF DELPHI2006_LVL}
{$ELSE}
' Application.CreateForm(T'+FFormClass+', '+FFormClass+');' + #13#10 +
{$ENDIF}
' Application.Run;' + #13#10 +
'end.';
end;
//------------------------------------------------------------------------------
initialization
finalization
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -