Various Bugfixes for Filename Input
This commit is contained in:
parent
6d0265862d
commit
5e1fa91e85
@ -69,6 +69,9 @@ object MainForm: TMainForm
|
|||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object spFile: TTabSheet
|
object spFile: TTabSheet
|
||||||
TabVisible = False
|
TabVisible = False
|
||||||
|
DesignSize = (
|
||||||
|
408
|
||||||
|
83)
|
||||||
object lblFile: TLabel
|
object lblFile: TLabel
|
||||||
Left = 4
|
Left = 4
|
||||||
Top = 7
|
Top = 7
|
||||||
@ -76,13 +79,15 @@ object MainForm: TMainForm
|
|||||||
Height = 13
|
Height = 13
|
||||||
Caption = 'Output file:'
|
Caption = 'Output file:'
|
||||||
end
|
end
|
||||||
object feFile: TEdit
|
object feFile: TJvFilenameEdit
|
||||||
Left = 76
|
Left = 89
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 316
|
Width = 316
|
||||||
Height = 21
|
Height = 21
|
||||||
|
DialogOptions = [ofHideReadOnly, ofCreatePrompt]
|
||||||
|
Anchors = [akLeft, akTop, akRight]
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'D:\Temp\test.pas'
|
Text = ''
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object spFolder: TTabSheet
|
object spFolder: TTabSheet
|
||||||
@ -114,7 +119,6 @@ object MainForm: TMainForm
|
|||||||
Width = 316
|
Width = 316
|
||||||
Height = 21
|
Height = 21
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
end
|
||||||
object edtFolderPostfix: TEdit
|
object edtFolderPostfix: TEdit
|
||||||
Left = 89
|
Left = 89
|
||||||
@ -122,22 +126,22 @@ object MainForm: TMainForm
|
|||||||
Width = 316
|
Width = 316
|
||||||
Height = 21
|
Height = 21
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
Text = 'Edit1'
|
|
||||||
end
|
end
|
||||||
object deFolder: TEdit
|
object deFolder: TEdit
|
||||||
Left = 89
|
Left = 89
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 256
|
Width = 245
|
||||||
Height = 21
|
Height = 21
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object BrowseOutputFolderButton: TButton
|
object deFolderPropertiesButton: TButton
|
||||||
Left = 351
|
Left = 340
|
||||||
Top = 4
|
Top = 3
|
||||||
Width = 64
|
Width = 65
|
||||||
Height = 22
|
Height = 22
|
||||||
Caption = 'BrowseOutputFolderButton'
|
Caption = 'Properties'
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
|
OnClick = deFolderPropertiesButtonClick
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -202,19 +206,21 @@ object MainForm: TMainForm
|
|||||||
Top = 8
|
Top = 8
|
||||||
Width = 316
|
Width = 316
|
||||||
Height = 21
|
Height = 21
|
||||||
|
OnAfterDialog = feSchemaAfterDialog
|
||||||
|
DialogOptions = [ofHideReadOnly, ofFileMustExist]
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
Text = 'feSchema'
|
Text = ''
|
||||||
end
|
end
|
||||||
object dlgSchema: TOpenDialog
|
object dlgSchema: TOpenDialog
|
||||||
Filter = 'W3C XML Schema files (*.xsd)|*.xsd|All files (*.*)|*.*'
|
Filter = 'W3C XML Schema files (*.xsd)|*.xsd|All files (*.*)|*.*'
|
||||||
Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
|
Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
|
||||||
Left = 212
|
Left = 284
|
||||||
Top = 40
|
Top = 40
|
||||||
end
|
end
|
||||||
object dlgOutputFile: TSaveDialog
|
object dlgOutputFile: TSaveDialog
|
||||||
Filter = 'Delphi source files (*.pas)|*.pas|All files (*.*)|*.*'
|
Filter = 'Delphi source files (*.pas)|*.pas|All files (*.*)|*.*'
|
||||||
Options = [ofHideReadOnly, ofPathMustExist, ofEnableSizing]
|
Options = [ofHideReadOnly, ofPathMustExist, ofEnableSizing]
|
||||||
Left = 323
|
Left = 387
|
||||||
Top = 45
|
Top = 37
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -50,20 +50,22 @@ type
|
|||||||
cbGenerateGetOptionalOrDefault: TCheckBox;
|
cbGenerateGetOptionalOrDefault: TCheckBox;
|
||||||
edtFolderPrefix: TEdit;
|
edtFolderPrefix: TEdit;
|
||||||
edtFolderPostfix: TEdit;
|
edtFolderPostfix: TEdit;
|
||||||
feFile: TEdit;
|
|
||||||
deFolder: TEdit;
|
deFolder: TEdit;
|
||||||
feSchema: TJvFilenameEdit;
|
feSchema: TJvFilenameEdit;
|
||||||
BrowseOutputFolderButton: TButton;
|
deFolderPropertiesButton: TButton;
|
||||||
|
feFile: TJvFilenameEdit;
|
||||||
|
|
||||||
procedure btnCloseClick(Sender: TObject);
|
procedure btnCloseClick(Sender: TObject);
|
||||||
procedure btnGenerateClick(Sender: TObject);
|
procedure btnGenerateClick(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure OutputTypeClick(Sender: TObject);
|
procedure OutputTypeClick(Sender: TObject);
|
||||||
procedure feFilePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
procedure feFilePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||||||
procedure deFolderPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
procedure deFolderPropertiesButtonClick(Sender: TObject);
|
||||||
procedure feSchemaPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
procedure feSchemaPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||||||
procedure feSchemaPropertiesChange(Sender: TObject);
|
procedure feSchemaPropertiesChange(Sender: TObject);
|
||||||
procedure btnHintsClick(Sender: TObject);
|
procedure btnHintsClick(Sender: TObject);
|
||||||
|
procedure feSchemaAfterDialog(Sender: TObject; var AName: string;
|
||||||
|
var AAction: Boolean);
|
||||||
private
|
private
|
||||||
function CheckValidSchemaFile: Boolean;
|
function CheckValidSchemaFile: Boolean;
|
||||||
function CheckReadOnly(const AFileName: String): Boolean;
|
function CheckReadOnly(const AFileName: String): Boolean;
|
||||||
@ -174,11 +176,11 @@ begin
|
|||||||
|
|
||||||
if rbFile.Checked then
|
if rbFile.Checked then
|
||||||
begin
|
begin
|
||||||
if not CheckReadOnly(feFile.Text) then
|
if not CheckReadOnly(feFile.FileName) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
generator.OutputType := otSingle;
|
generator.OutputType := otSingle;
|
||||||
generator.OutputPath := feFile.Text;
|
generator.OutputPath := feFile.FileName;
|
||||||
end else if rbFolder.Checked then
|
end else if rbFolder.Checked then
|
||||||
begin
|
begin
|
||||||
generator.OutputType := otMultiple;
|
generator.OutputType := otMultiple;
|
||||||
@ -188,9 +190,9 @@ begin
|
|||||||
generator.HasChecksEmpty := cbHasChecksEmpty.Checked;
|
generator.HasChecksEmpty := cbHasChecksEmpty.Checked;
|
||||||
generator.HasGenerateGetOptionalOrDefault := cbGenerateGetOptionalOrDefault.Checked;
|
generator.HasGenerateGetOptionalOrDefault := cbGenerateGetOptionalOrDefault.Checked;
|
||||||
generator.OnGetFileName := GetFileName;
|
generator.OnGetFileName := GetFileName;
|
||||||
generator.Execute(feSchema.Text);
|
generator.Execute(feSchema.Filename);
|
||||||
|
|
||||||
SaveSettings(feSchema.Text);
|
SaveSettings(feSchema.FileName);
|
||||||
|
|
||||||
ShowMessage('The data binding has been generated.');
|
ShowMessage('The data binding has been generated.');
|
||||||
finally
|
finally
|
||||||
@ -223,7 +225,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMainForm.deFolderPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
procedure TMainForm.deFolderPropertiesButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
directory: String;
|
directory: String;
|
||||||
|
|
||||||
@ -233,6 +235,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMainForm.feSchemaAfterDialog(Sender: TObject; var AName: string;
|
||||||
|
var AAction: Boolean);
|
||||||
|
begin
|
||||||
|
feFile.FileName := ChangeFileExt(AName, '.pas');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.feSchemaPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
procedure TMainForm.feSchemaPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||||||
begin
|
begin
|
||||||
if dlgSchema.Execute then
|
if dlgSchema.Execute then
|
||||||
@ -331,7 +339,7 @@ end;
|
|||||||
|
|
||||||
function TMainForm.CheckValidSchemaFile: Boolean;
|
function TMainForm.CheckValidSchemaFile: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := FileExists(feSchema.Text);
|
Result := FileExists(feSchema.FileName);
|
||||||
|
|
||||||
if not Result then
|
if not Result then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user