Skip to content

Commit

Permalink
Adding a IDE Wizard that creates a simple MARS Server Application
Browse files Browse the repository at this point in the history
* Adding a IDE Wizard that creates a simple MARS Server Application
  • Loading branch information
ortuagustin authored and andrea-magni committed Apr 3, 2016
1 parent 4fd9702 commit b127137
Show file tree
Hide file tree
Showing 13 changed files with 1,651 additions and 0 deletions.
129 changes: 129 additions & 0 deletions Source/IDE Wizard/MARS.Wizards.Modules.MainForm.pas
@@ -0,0 +1,129 @@
unit MARS.Wizards.Modules.MainForm;

interface

uses
MARS.Wizards.Utils,
ToolsAPI;

resourcestring
SMARSServerMainFormSRC = 'MARSServerMainFormSRC';
SMARSServerMainFormDFM = 'MARSServerMainFormDFM';
SMainFormFileName = 'ServerMainForm';

type
TMarsServerMainFormCreator = class(TInterfacedObject, IOTACreator, IOTAModuleCreator)
public
// IOTACreator
function GetCreatorType: string;
function GetExisting: Boolean;
function GetFileSystem: string;
function GetOwner: IOTAModule;
function GetUnnamed: Boolean;

// IOTAModuleCreator
function GetAncestorName: string;
function GetImplFileName: string;
function GetIntfFileName: string;
function GetFormName: string;
function GetMainForm: Boolean;
function GetShowForm: Boolean;
function GetShowSource: Boolean;
function NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile;
function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
function NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
procedure FormCreated(const FormEditor: IOTAFormEditor);
end;

implementation

uses
System.SysUtils;

{$REGION 'IOTACreator'}

function TMarsServerMainFormCreator.GetCreatorType: string;
begin
Result := sForm;
end;

function TMarsServerMainFormCreator.GetExisting: Boolean;
begin
Result := False;
end;

function TMarsServerMainFormCreator.GetFileSystem: string;
begin
Result := '';
end;

function TMarsServerMainFormCreator.GetOwner: IOTAModule;
begin
Result := ActiveProject;
end;

function TMarsServerMainFormCreator.GetUnnamed: Boolean;
begin
Result := True;
end;

{$ENDREGION}
{$REGION 'IOTAModuleCreator'}

function TMarsServerMainFormCreator.GetAncestorName: string;
begin
Result := 'TForm';
end;

function TMarsServerMainFormCreator.GetImplFileName: string;
begin
Result := GetCurrentDir + '\' + SMainFormFileName + '.pas';
end;

function TMarsServerMainFormCreator.GetIntfFileName: string;
begin
Result := '';
end;

function TMarsServerMainFormCreator.GetFormName: string;
begin
Result := 'MainForm';
end;

function TMarsServerMainFormCreator.GetMainForm: Boolean;
begin
Result := True;
end;

function TMarsServerMainFormCreator.GetShowForm: Boolean;
begin
Result := True;
end;

function TMarsServerMainFormCreator.GetShowSource: Boolean;
begin
Result := True;
end;

function TMarsServerMainFormCreator.NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile;
begin
Result := TMarsSourceFile.Create(SMARSServerMainFormDFM);
end;

function TMarsServerMainFormCreator.NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
begin
Result := TMarsSourceFile.Create(SMARSServerMainFormSRC);
end;

function TMarsServerMainFormCreator.NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
begin
Result := NIL;
end;

procedure TMarsServerMainFormCreator.FormCreated(const FormEditor: IOTAFormEditor);
begin
end;

{$ENDREGION}

end.
128 changes: 128 additions & 0 deletions Source/IDE Wizard/MARS.Wizards.Modules.Resources.pas
@@ -0,0 +1,128 @@
unit MARS.Wizards.Modules.Resources;

interface

uses
MARS.Wizards.Utils,
ToolsAPI;

resourcestring
SMARSServerResources = 'MARSServerResources';
SServerResourcesFileName = 'ServerResources';

type
TMarsServerResourcesCreator = class(TInterfacedObject, IOTACreator, IOTAModuleCreator)
public
// IOTACreator
function GetCreatorType: string;
function GetExisting: Boolean;
function GetFileSystem: string;
function GetOwner: IOTAModule;
function GetUnnamed: Boolean;

// IOTAModuleCreator
function GetAncestorName: string;
function GetImplFileName: string;
function GetIntfFileName: string;
function GetFormName: string;
function GetMainForm: Boolean;
function GetShowForm: Boolean;
function GetShowSource: Boolean;
function NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile;
function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
function NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
procedure FormCreated(const FormEditor: IOTAFormEditor);
end;

implementation

uses
System.SysUtils;

{$REGION 'IOTACreator'}

function TMarsServerResourcesCreator.GetCreatorType: string;
begin
Result := sUnit;
end;

function TMarsServerResourcesCreator.GetExisting: Boolean;
begin
Result := False;
end;

function TMarsServerResourcesCreator.GetFileSystem: string;
begin
Result := '';
end;

function TMarsServerResourcesCreator.GetOwner: IOTAModule;
begin
Result := ActiveProject;
end;

function TMarsServerResourcesCreator.GetUnnamed: Boolean;
begin
Result := True;
end;

{$ENDREGION}
{$REGION 'IOTAModuleCreator'}

function TMarsServerResourcesCreator.GetAncestorName: string;
begin
Result := '';
end;

function TMarsServerResourcesCreator.GetImplFileName: string;
begin
Result := GetCurrentDir + '\' + SServerResourcesFileName + '.pas';
end;

function TMarsServerResourcesCreator.GetIntfFileName: string;
begin
Result := '';
end;

function TMarsServerResourcesCreator.GetFormName: string;
begin
Result := '';
end;

function TMarsServerResourcesCreator.GetMainForm: Boolean;
begin
Result := False;
end;

function TMarsServerResourcesCreator.GetShowForm: Boolean;
begin
Result := False;
end;

function TMarsServerResourcesCreator.GetShowSource: Boolean;
begin
Result := False;
end;

function TMarsServerResourcesCreator.NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile;
begin
Result := NIL;
end;

function TMarsServerResourcesCreator.NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
begin
Result := TMarsSourceFile.Create(SMARSServerResources);
end;

function TMarsServerResourcesCreator.NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
begin
Result := NIL;
end;

procedure TMarsServerResourcesCreator.FormCreated(const FormEditor: IOTAFormEditor);
begin
end;

{$ENDREGION}

end.

0 comments on commit b127137

Please sign in to comment.