1
0
mirror of synced 2024-11-21 13:43:49 +00:00

Fixed: GUI

This commit is contained in:
Mark van Renswoude 2008-04-14 19:20:55 +00:00
parent dba905ace4
commit e1f35e9999
5 changed files with 65 additions and 12 deletions

View File

@ -3,7 +3,7 @@ object MainForm: TMainForm
Top = 81
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsDialog
Caption = 'X'#178'Software XML Data Binding Wizard for Delphi'
Caption = 'X'#178'Software XML Data Binding for Delphi'
ClientHeight = 244
ClientWidth = 438
Color = clBtnFace
@ -56,6 +56,7 @@ object MainForm: TMainForm
Checked = True
TabOrder = 0
TabStop = True
OnClick = OutputTypeClick
end
object rbFolder: TRadioButton
Left = 8
@ -63,15 +64,15 @@ object MainForm: TMainForm
Width = 149
Height = 17
Caption = 'Output to separate &files'
Enabled = False
TabOrder = 1
OnClick = OutputTypeClick
end
object plOutput: TJvPageList
Left = 3
Top = 72
Width = 416
Height = 87
ActivePage = spFile
ActivePage = spFolder
PropagateEnable = False
ShowDesignCaption = sdcBottomRight
Anchors = [akLeft, akTop, akRight, akBottom]
@ -135,7 +136,6 @@ object MainForm: TMainForm
DialogKind = dkWin32
Anchors = [akLeft, akTop, akRight]
TabOrder = 0
Text = 'F:\XTxXSD\Output\'
end
object edtFolderPrefix: TEdit
Left = 88
@ -151,6 +151,7 @@ object MainForm: TMainForm
Width = 121
Height = 21
TabOrder = 2
Text = '.pas'
end
end
end

View File

@ -39,6 +39,9 @@ type
procedure btnCloseClick(Sender: TObject);
procedure btnGenerateClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure OutputTypeClick(Sender: TObject);
private
procedure GetFileName(Sender: TObject; const SchemaName: String; var Path, FileName: String);
end;
@ -47,6 +50,8 @@ uses
SysUtils,
Windows,
X2UtTempFile,
DelphiXMLDataBindingGenerator,
XMLDataBindingGenerator;
@ -56,8 +61,32 @@ uses
{ TMainForm }
procedure TMainForm.FormCreate(Sender: TObject);
var
schemaFile: String;
begin
plOutput.ActivePageIndex := 0;
if ParamCount() > 0 then
begin
schemaFile := ParamStr(1);
if FileExists(schemaFile) then
begin
feSchema.Text := schemaFile;
feFile.Text := ChangeFileExt(schemaFile, '.pas');
deFolder.Text := ExtractFilePath(schemaFile);
end;
end;
end;
procedure TMainForm.OutputTypeClick(Sender: TObject);
begin
if Sender = rbFile then
plOutput.ActivePage := spFile
else if Sender = rbFolder then
plOutput.ActivePage := spFolder;
end;
@ -74,9 +103,17 @@ begin
with TDelphiXMLDataBindingGenerator.Create() do
try
if rbFile.Checked then
begin
OutputType := otSingle;
OutputPath := feFile.FileName;
end else if rbFolder.Checked then
begin
OutputType := otMultiple;
OutputPath := deFolder.Text;
end;
OnGetFileName := GetFileName;
Execute(feSchema.FileName);
finally
Free();
@ -89,4 +126,11 @@ begin
Close();
end;
procedure TMainForm.GetFileName(Sender: TObject; const SchemaName: String; var Path, FileName: String);
begin
FileName := edtFolderPrefix.Text + FileName + edtFolderPostfix.Text;
CheckValidFileName(FileName);
end;
end.

View File

@ -13,7 +13,7 @@ uses
type
TGetFileNameEvent = procedure(Sender: TObject; const SchemaName: String; var Result: String) of object;
TGetFileNameEvent = procedure(Sender: TObject; const SchemaName: String; var Path, FileName: String) of object;
TDelphiXMLDataBindingGenerator = class(TXMLDataBindingGenerator)
@ -1023,14 +1023,21 @@ end;
function TDelphiXMLDataBindingGenerator.DoGetFileName(const ASchemaName: String): String;
var
path: String;
fileName: String;
begin
Result := OutputPath;
if OutputType = otMultiple then
begin
Result := IncludeTrailingPathDelimiter(Result) + ASchemaName + '.pas';
path := IncludeTrailingPathDelimiter(Result);
fileName := ASchemaName + '.pas';
if Assigned(FOnGetFileName) then
FOnGetFileName(Self, ASchemaName, Result);
FOnGetFileName(Self, ASchemaName, path, fileName);
Result := IncludeTrailingPathDelimiter(path) + fileName;
end;
end;

View File

@ -130,7 +130,7 @@
<Directories Name="UsePackages">False</Directories>
</Directories>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="RunParams">"F:\Archive\2007\XMLDataBinding\Tests\Data\02. Collection.xsd"</Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>

View File

@ -7,7 +7,8 @@ uses
MainFrm in 'Forms\MainFrm.pas' {MainForm},
XMLDataBindingGenerator in 'Units\XMLDataBindingGenerator.pas',
DelphiXMLDataBindingGenerator in 'Units\DelphiXMLDataBindingGenerator.pas',
XMLDataBindingHelpers in 'Units\XMLDataBindingHelpers.pas';
XMLDataBindingHelpers in 'Units\XMLDataBindingHelpers.pas',
DelphiXMLDataBindingResources in 'Units\DelphiXMLDataBindingResources.pas';
{$R *.res}
@ -20,7 +21,7 @@ begin
{$ENDIF}
Application.Initialize;
Application.Title := 'X²Software XML Data Binding Wizard for Delphi';
Application.Title := 'X²Software XML Data Binding for Delphi';
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.