From 4b677e782a265b536f6b12b20887da047bfdca79 Mon Sep 17 00:00:00 2001 From: Philipp Winkel Date: Fri, 19 Mar 2021 17:51:09 +0100 Subject: [PATCH] remove JEDI dependency --- Forms/MainFrm.dfm | 43 ++++++++++++++++++++++++++----------------- Forms/MainFrm.pas | 42 +++++++++++++++++++++++++++--------------- README.md | 1 - 3 files changed, 53 insertions(+), 33 deletions(-) diff --git a/Forms/MainFrm.dfm b/Forms/MainFrm.dfm index adf8064..f9c6125 100644 --- a/Forms/MainFrm.dfm +++ b/Forms/MainFrm.dfm @@ -63,15 +63,12 @@ object MainForm: TMainForm Top = 68 Width = 416 Height = 93 - ActivePage = spFolder + ActivePage = spFile Anchors = [akLeft, akTop, akRight] Style = tsButtons TabOrder = 2 object spFile: TTabSheet TabVisible = False - DesignSize = ( - 408 - 83) object lblFile: TLabel Left = 4 Top = 7 @@ -79,15 +76,21 @@ object MainForm: TMainForm Height = 13 Caption = 'Output file:' end - object feFile: TJvFilenameEdit - Left = 89 - Top = 3 - Width = 316 + object feFile: TEdit + Left = 65 + Top = 4 + Width = 269 Height = 21 - DialogOptions = [ofHideReadOnly, ofCreatePrompt] - Anchors = [akLeft, akTop, akRight] TabOrder = 0 - Text = '' + end + object ButtonOutputFileBrowseButton: TButton + Left = 340 + Top = 4 + Width = 65 + Height = 21 + Caption = 'Browse' + TabOrder = 1 + OnClick = ButtonOutputFileBrowseButtonClick end end object spFolder: TTabSheet @@ -201,15 +204,21 @@ object MainForm: TMainForm TabOrder = 1 OnClick = btnHintsClick end - object feSchema: TJvFilenameEdit - Left = 104 + object feSchema: TEdit + Left = 72 Top = 8 - Width = 316 + Width = 289 Height = 21 - OnAfterDialog = feSchemaAfterDialog - DialogOptions = [ofHideReadOnly, ofFileMustExist] TabOrder = 4 - Text = '' + end + object SchmeFileBrowseButton: TButton + Left = 367 + Top = 8 + Width = 65 + Height = 21 + Caption = 'Browse' + TabOrder = 5 + OnClick = SchmeFileBrowseButtonClick end object dlgSchema: TOpenDialog Filter = 'W3C XML Schema files (*.xsd)|*.xsd|All files (*.*)|*.*' diff --git a/Forms/MainFrm.pas b/Forms/MainFrm.pas index 5bbfecc..42c8c9e 100644 --- a/Forms/MainFrm.pas +++ b/Forms/MainFrm.pas @@ -51,9 +51,11 @@ type edtFolderPrefix: TEdit; edtFolderPostfix: TEdit; deFolder: TEdit; - feSchema: TJvFilenameEdit; deFolderPropertiesButton: TButton; - feFile: TJvFilenameEdit; + feSchema: TEdit; + SchmeFileBrowseButton: TButton; + feFile: TEdit; + ButtonOutputFileBrowseButton: TButton; procedure btnCloseClick(Sender: TObject); procedure btnGenerateClick(Sender: TObject); @@ -64,8 +66,8 @@ type procedure feSchemaPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure feSchemaPropertiesChange(Sender: TObject); procedure btnHintsClick(Sender: TObject); - procedure feSchemaAfterDialog(Sender: TObject; var AName: string; - var AAction: Boolean); + procedure SchmeFileBrowseButtonClick(Sender: TObject); + procedure ButtonOutputFileBrowseButtonClick(Sender: TObject); private function CheckValidSchemaFile: Boolean; function CheckReadOnly(const AFileName: String): Boolean; @@ -176,11 +178,11 @@ begin if rbFile.Checked then begin - if not CheckReadOnly(feFile.FileName) then + if not CheckReadOnly(feFile.Text) then Exit; generator.OutputType := otSingle; - generator.OutputPath := feFile.FileName; + generator.OutputPath := feFile.Text; end else if rbFolder.Checked then begin generator.OutputType := otMultiple; @@ -190,9 +192,9 @@ begin generator.HasChecksEmpty := cbHasChecksEmpty.Checked; generator.HasGenerateGetOptionalOrDefault := cbGenerateGetOptionalOrDefault.Checked; generator.OnGetFileName := GetFileName; - generator.Execute(feSchema.Filename); + generator.Execute(feSchema.Text); - SaveSettings(feSchema.FileName); + SaveSettings(feSchema.Text); ShowMessage('The data binding has been generated.'); finally @@ -235,12 +237,6 @@ begin 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); begin if dlgSchema.Execute then @@ -337,9 +333,17 @@ begin end; +procedure TMainForm.SchmeFileBrowseButtonClick(Sender: TObject); +begin + if dlgSchema.Execute then + begin + feSchema.Text := dlgSchema.FileName; + end; +end; + function TMainForm.CheckValidSchemaFile: Boolean; begin - Result := FileExists(feSchema.FileName); + Result := FileExists(feSchema.Text); if not Result then begin @@ -392,6 +396,14 @@ begin end; +procedure TMainForm.ButtonOutputFileBrowseButtonClick(Sender: TObject); +begin + if dlgOutputFile.Execute then + begin + feFile.Text := dlgOutputFile.FileName; + end; +end; + { THintsDelphiXMLDataBindingGenerator } procedure THintsDelphiXMLDataBindingGenerator.GenerateDataBinding; begin diff --git a/README.md b/README.md index 0f040f8..95a9d97 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ - Influence the generator by using a Hints file ## Dependencies - - JEDI Component Library (jcl /jvcl) - x2utils (https://github.com/MvRens/x2utils.git) (git submodule) - x2log (https://github.com/MvRens/x2log.git) (git submodule)