pas2js: started installer dialog

This commit is contained in:
mattias 2024-04-02 15:47:48 +02:00
parent fd9746e2f9
commit 8b0b1fba22
18 changed files with 882 additions and 78 deletions

View File

@ -1,20 +1,20 @@
object AtomPackageSettingsForm: TAtomPackageSettingsForm
Left = 357
Height = 546
Top = 159
Left = 352
Height = 580
Top = 171
Width = 588
Caption = 'New Atom Package'
ClientHeight = 546
ClientHeight = 580
ClientWidth = 588
LCLVersion = '3.99.0.0'
OnShow = FormShow
LCLVersion = '2.1.0.0'
object edtDescription: TEdit
AnchorSideLeft.Control = dePackage
AnchorSideTop.Control = dePackage
AnchorSideTop.Side = asrBottom
Left = 120
Height = 27
Top = 43
Height = 32
Top = 48
Width = 446
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
@ -25,8 +25,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edtDescription
Left = 24
Height = 16
Top = 48
Height = 15
Top = 57
Width = 88
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -40,21 +40,21 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Control = edtDescription
AnchorSideTop.Side = asrBottom
Left = 120
Height = 27
Top = 78
Height = 32
Top = 88
Width = 280
BorderSpacing.Top = 8
TabOrder = 1
OnEditingDone = edtNameEditingDone
OnKeyPress = edtNameKeyPress
TabOrder = 1
end
object lblName: TLabel
AnchorSideTop.Control = edtName
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edtName
Left = 16
Height = 16
Top = 83
Height = 15
Top = 97
Width = 96
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -69,8 +69,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrBottom
Left = 120
Height = 23
Top = 149
Width = 173
Top = 169
Width = 160
BorderSpacing.Top = 8
Caption = 'Link in Atom package dir'
TabOrder = 2
@ -81,7 +81,7 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrBottom
Left = 120
Height = 112
Top = 180
Top = 200
Width = 446
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
@ -102,8 +102,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 38
Top = 502
Height = 56
Top = 518
Width = 576
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
@ -121,8 +121,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edtLicense
Left = 56
Height = 16
Top = 305
Height = 15
Top = 329
Width = 56
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -136,8 +136,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Control = vleCommands
AnchorSideTop.Side = asrBottom
Left = 120
Height = 27
Top = 300
Height = 32
Top = 320
Width = 184
BorderSpacing.Top = 8
TabOrder = 5
@ -146,8 +146,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Control = vleCommands
AnchorSideRight.Control = vleCommands
Left = 32
Height = 16
Top = 180
Height = 15
Top = 200
Width = 80
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -161,8 +161,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edtKeywords
Left = 44
Height = 16
Top = 341
Height = 15
Top = 370
Width = 68
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -176,8 +176,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Control = edtLicense
AnchorSideTop.Side = asrBottom
Left = 120
Height = 27
Top = 336
Height = 32
Top = 361
Width = 445
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 9
@ -187,8 +187,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Control = vleActivationCommands
AnchorSideRight.Control = vleActivationCommands
Left = 23
Height = 32
Top = 371
Height = 30
Top = 401
Width = 89
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -203,7 +203,7 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrBottom
Left = 120
Height = 112
Top = 371
Top = 401
Width = 445
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
@ -224,7 +224,7 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
end
object dePackage: TDirectoryEdit
Left = 120
Height = 27
Height = 32
Top = 8
Width = 447
ShowHidden = False
@ -239,8 +239,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = dePackage
Left = 34
Height = 16
Top = 13
Height = 15
Top = 17
Width = 78
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -254,8 +254,8 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edtClassName
Left = 32
Height = 16
Top = 119
Height = 15
Top = 138
Width = 79
Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight]
@ -269,11 +269,11 @@ object AtomPackageSettingsForm: TAtomPackageSettingsForm
AnchorSideTop.Control = edtName
AnchorSideTop.Side = asrBottom
Left = 120
Height = 27
Top = 114
Height = 32
Top = 129
Width = 280
BorderSpacing.Top = 9
OnKeyPress = edtClassNameKeyPress
TabOrder = 9
OnKeyPress = edtClassNameKeyPress
end
end

View File

@ -1,14 +1,14 @@
object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Left = 381
Height = 490
Height = 512
Top = 232
Width = 632
Caption = 'Pas2JS Browser project options'
ClientHeight = 490
ClientHeight = 512
ClientWidth = 632
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '2.3.0.0'
LCLVersion = '3.99.0.0'
OnCreate = FormCreate
object CBCreateHTML: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
@ -20,9 +20,9 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
BorderSpacing.Top = 6
Caption = 'Create initial HTML page'
Checked = True
OnChange = CBCreateHTMLChange
State = cbChecked
TabOrder = 0
OnChange = CBCreateHTMLChange
end
object CBUseBrowserApp: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
@ -34,8 +34,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Width = 198
BorderSpacing.Top = 6
Caption = 'Use Browser Application object'
OnChange = CBUseBrowserAppChange
TabOrder = 1
OnChange = CBUseBrowserAppChange
end
object CBUseBrowserConsole: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
@ -52,8 +52,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
end
object BPHelpOptions: TButtonPanel
Left = 6
Height = 40
Top = 444
Height = 56
Top = 450
Width = 620
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
@ -126,7 +126,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 70
Height = 30
Height = 32
Top = 209
Width = 556
Anchors = [akTop, akLeft, akRight]
@ -143,12 +143,12 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 245
Top = 247
Width = 272
BorderSpacing.Top = 6
Caption = 'Create a javascript module instead of a script'
OnChange = CBUseHTTPServerChange
TabOrder = 9
OnChange = CBUseHTTPServerChange
end
object RunGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
@ -157,14 +157,14 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 159
Top = 274
Height = 165
Top = 276
Width = 620
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Run'
ClientHeight = 143
ClientHeight = 149
ClientWidth = 618
TabOrder = 10
object RBRunServerAt: TRadioButton
@ -173,13 +173,13 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrCenter
Left = 6
Height = 23
Top = 46
Top = 49
Width = 168
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'Start HTTP Server on port'
OnChange = RBRunServerAtChange
TabOrder = 4
OnChange = RBRunServerAtChange
end
object SERunPort: TSpinEdit
AnchorSideLeft.Control = RBRunServerAt
@ -187,8 +187,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Control = CBRunLocationOnSWS
AnchorSideTop.Side = asrBottom
Left = 180
Height = 30
Top = 42
Height = 32
Top = 44
Width = 76
BorderSpacing.Left = 6
BorderSpacing.Top = 6
@ -203,11 +203,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrCenter
Left = 6
Height = 23
Top = 82
Top = 87
Width = 138
Caption = 'Use URL to start app'
OnChange = RBRunBrowserWithURLChange
TabOrder = 1
OnChange = RBRunBrowserWithURLChange
end
object CBRunServerURL: TComboBox
AnchorSideLeft.Control = RBRunBrowserWithURL
@ -217,8 +217,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideRight.Control = RunGroupBox
AnchorSideRight.Side = asrBottom
Left = 150
Height = 30
Top = 78
Height = 32
Top = 82
Width = 462
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
@ -233,14 +233,14 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 114
Top = 120
Width = 162
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
Caption = 'Execute Run Parameters'
OnChange = RBRunDefaultChange
TabOrder = 3
OnChange = RBRunDefaultChange
end
object RBRunLocationOnSWS: TRadioButton
AnchorSideLeft.Control = RunGroupBox
@ -248,14 +248,14 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrCenter
Left = 6
Height = 23
Top = 10
Top = 11
Width = 196
BorderSpacing.Left = 6
Caption = 'Location on Simple Web Server'
Checked = True
OnChange = RBRunLocationOnSWSChange
TabOrder = 6
TabStop = True
OnChange = RBRunLocationOnSWSChange
end
object CBRunLocationOnSWS: TComboBox
AnchorSideLeft.Control = RBRunLocationOnSWS
@ -264,7 +264,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideRight.Control = RunGroupBox
AnchorSideRight.Side = asrBottom
Left = 208
Height = 30
Height = 32
Top = 6
Width = 404
Anchors = [akTop, akLeft, akRight]

View File

@ -0,0 +1,320 @@
object Pas2jsInstallerDialog: TPas2jsInstallerDialog
Left = 317
Height = 547
Top = 243
Width = 574
Caption = 'Pas2jsInstallerDialog'
ClientHeight = 547
ClientWidth = 574
Position = poWorkAreaCenter
LCLVersion = '3.99.0.0'
OnCreate = FormCreate
object BtnPanel: TPanel
Left = 0
Height = 45
Top = 502
Width = 574
Align = alBottom
AutoSize = True
ClientHeight = 45
ClientWidth = 574
TabOrder = 0
object CloseButton: TButton
AnchorSideRight.Control = BtnPanel
AnchorSideRight.Side = asrBottom
Left = 488
Height = 31
Top = 7
Width = 75
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 6
BorderSpacing.Right = 10
BorderSpacing.Bottom = 6
Caption = 'Close'
Constraints.MinWidth = 75
TabOrder = 0
OnClick = CloseButtonClick
end
object ApplyButton: TButton
AnchorSideTop.Control = BtnPanel
AnchorSideRight.Control = CloseButton
AnchorSideBottom.Control = BtnPanel
AnchorSideBottom.Side = asrBottom
Left = 401
Height = 31
Top = 7
Width = 75
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
BorderSpacing.Around = 6
Caption = 'Apply'
Constraints.MinWidth = 75
TabOrder = 1
end
end
object Pas2jsSrcDirGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Pas2jsExeGroupBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 81
Top = 73
Width = 562
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Pas2js Source Directory'
ClientHeight = 65
ClientWidth = 560
TabOrder = 1
object Pas2jsSrcDirComboBox: TComboBox
AnchorSideLeft.Control = Pas2jsSrcDirGroupBox
AnchorSideTop.Control = Pas2jsSrcDirGroupBox
AnchorSideRight.Control = Pas2jsSrcDirBrowseBtn
Left = 6
Height = 32
Top = 6
Width = 523
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
ItemHeight = 0
TabOrder = 0
Text = 'Pas2jsSrcDir'
end
object Pas2jsSrcVersionLabel: TLabel
AnchorSideLeft.Control = Pas2jsSrcDirGroupBox
AnchorSideTop.Control = Pas2jsSrcDirComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 15
Top = 44
Width = 74
BorderSpacing.Around = 6
Caption = 'Version: 0.0.0'
end
object Pas2jsSrcDirBrowseBtn: TButton
AnchorSideTop.Control = Pas2jsSrcDirComboBox
AnchorSideRight.Control = Pas2jsSrcDirGroupBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Pas2jsSrcDirComboBox
AnchorSideBottom.Side = asrBottom
Left = 529
Height = 32
Top = 6
Width = 25
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
Caption = '...'
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
end
object FPCGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Pas2jsSrcDirGroupBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 161
Top = 160
Width = 562
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Free Pascal Compiler used for compiling tools and pas2js itself'
ClientHeight = 145
ClientWidth = 560
Enabled = False
TabOrder = 2
object FPCExeComboBox: TComboBox
AnchorSideLeft.Control = FPCGroupBox
AnchorSideTop.Control = FPCExeLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = FPCExeBrowseButton
Left = 6
Height = 32
Top = 27
Width = 523
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
ItemHeight = 0
TabOrder = 0
Text = 'FPCExe'
end
object FPCExeBrowseButton: TButton
AnchorSideTop.Control = FPCExeComboBox
AnchorSideRight.Control = FPCGroupBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = FPCExeComboBox
AnchorSideBottom.Side = asrBottom
Left = 529
Height = 32
Top = 27
Width = 25
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
Caption = '...'
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object FPCSrcDirVersionLabel: TLabel
AnchorSideLeft.Control = FPCGroupBox
AnchorSideTop.Control = FPCSrcDirComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 15
Top = 124
Width = 74
BorderSpacing.Around = 6
Caption = 'Version: 0.0.0'
end
object FPCSrcDirComboBox: TComboBox
AnchorSideLeft.Control = FPCGroupBox
AnchorSideTop.Control = FPCSrcDirLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = FPCSrcDirBrowseButton
Left = 6
Height = 32
Top = 86
Width = 523
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
ItemHeight = 0
TabOrder = 2
Text = 'FPCSrcDir'
end
object FPCSrcDirBrowseButton: TButton
AnchorSideTop.Control = FPCSrcDirComboBox
AnchorSideRight.Control = FPCGroupBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = FPCSrcDirComboBox
AnchorSideBottom.Side = asrBottom
Left = 529
Height = 32
Top = 86
Width = 25
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
Caption = '...'
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
object FPCExeLabel: TLabel
AnchorSideTop.Control = FPCGroupBox
Left = 6
Height = 15
Top = 6
Width = 87
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'FPC executable:'
end
object FPCSrcDirLabel: TLabel
AnchorSideLeft.Control = FPCGroupBox
AnchorSideTop.Control = FPCExeComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 15
Top = 65
Width = 117
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'FPC source directory:'
end
end
object DetailsGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = FPCGroupBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BtnPanel
Left = 6
Height = 169
Top = 327
Width = 562
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'Details'
ClientHeight = 153
ClientWidth = 560
TabOrder = 3
object DetailsMemo: TMemo
Left = 6
Height = 141
Top = 6
Width = 548
Align = alClient
BorderSpacing.Around = 6
Lines.Strings = (
'DetailsMemo1'
)
TabOrder = 0
end
end
object Pas2jsExeGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 61
Top = 6
Width = 562
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Caption = 'Pas2js Command Executable'
ClientHeight = 45
ClientWidth = 560
TabOrder = 4
object Pas2jsExeComboBox: TComboBox
AnchorSideLeft.Control = Pas2jsExeGroupBox
AnchorSideTop.Control = Pas2jsExeGroupBox
AnchorSideRight.Control = Pas2jsExeBrowseButton
Left = 6
Height = 32
Top = 6
Width = 523
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
ItemHeight = 0
TabOrder = 0
Text = 'Pas2jsExe'
end
object Pas2jsExeBrowseButton: TButton
AnchorSideTop.Control = Pas2jsExeComboBox
AnchorSideRight.Control = Pas2jsExeGroupBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Pas2jsExeComboBox
AnchorSideBottom.Side = asrBottom
Left = 529
Height = 32
Top = 6
Width = 25
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
Caption = '...'
ParentShowHint = False
ShowHint = True
TabOrder = 1
OnClick = Pas2jsExeBrowseButtonClick
end
end
end

View File

@ -0,0 +1,3 @@
{"version":1,"strings":[
{"hash":5073155,"name":"tform3.caption","sourcebytes":[70,111,114,109,51],"value":"Form3"}
]}

View File

@ -0,0 +1,197 @@
unit FrmPas2jsInstaller;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
StrPas2JSDesign, PJSDsgnOptions, IDEUtils, LazFileUtils;
type
{ TPas2jsInstallerDialog }
TPas2jsInstallerDialog = class(TForm)
ApplyButton: TButton;
BtnPanel: TPanel;
FPCExeLabel: TLabel;
FPCSrcDirBrowseButton: TButton;
CloseButton: TButton;
DetailsGroupBox: TGroupBox;
DetailsMemo: TMemo;
FPCExeBrowseButton: TButton;
FPCExeComboBox: TComboBox;
FPCSrcDirComboBox: TComboBox;
FPCGroupBox: TGroupBox;
FPCSrcDirLabel: TLabel;
FPCSrcDirVersionLabel: TLabel;
Pas2jsExeBrowseButton: TButton;
Pas2jsExeComboBox: TComboBox;
Pas2jsExeGroupBox: TGroupBox;
Pas2jsSrcDirBrowseBtn: TButton;
Pas2jsSrcDirComboBox: TComboBox;
Pas2jsSrcDirGroupBox: TGroupBox;
Pas2jsSrcVersionLabel: TLabel;
procedure CloseButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Pas2jsExeBrowseButtonClick(Sender: TObject);
private
FLastCheckedPas2jsExe: String;
FLastCheckedPas2jsSrcDir: String;
FLastCheckedPas2js: boolean;
FOldPas2jsExe: string;
FOldPas2jsSrcDir: string;
FOldFPCExe: string;
FOldFPCSrcDir: string;
procedure UpdateButtons;
function NeedsApply: boolean;
function CheckPas2js: boolean;
public
procedure Init;
end;
var
Pas2jsInstallerDialog: TPas2jsInstallerDialog;
function ShowPas2jsInstallerDialog: boolean; // returns true if pas2js looks ok and user did not cancel
implementation
function ShowPas2jsInstallerDialog: boolean;
begin
Pas2jsInstallerDialog:=TPas2jsInstallerDialog.Create(nil);
try
Pas2jsInstallerDialog.Init;
Result:=Pas2jsInstallerDialog.ShowModal=mrOk;
finally
Pas2jsInstallerDialog.Free;
end;
end;
{$R *.lfm}
{ TPas2jsInstallerDialog }
procedure TPas2jsInstallerDialog.FormCreate(Sender: TObject);
begin
Caption:='Pas2js Installer';
Pas2jsExeGroupBox.Caption:='Pas2js executable';
Pas2jsExeBrowseButton.Hint:='Browse';
Pas2jsSrcDirComboBox.Caption:='Pas2js source directory';
Pas2jsSrcDirBrowseBtn.Hint:='Browse';
FPCGroupBox.Caption:='Free Pascal Compiler used for compiling tools and pas2js itself';
FPCExeLabel.Caption:='FPC executable:';
FPCExeBrowseButton.Hint:='Browse';
FPCSrcDirLabel.Caption:='FPC source directory:';
FPCSrcDirBrowseButton.Hint:='Browse';
DetailsGroupBox.Caption:='Details';
DetailsMemo.Clear;
ApplyButton.Caption:='Apply';
CloseButton.Caption:='Close';
end;
procedure TPas2jsInstallerDialog.CloseButtonClick(Sender: TObject);
begin
// restore options
PJSOptions.CompilerFilename:=FOldPas2jsExe;
PJSOptions.Pas2jsSrcDir:=FOldPas2jsSrcDir;
PJSOptions.FPCExe:=FOldFPCExe;
PJSOptions.FPCSrcDir:=FOldFPCSrcDir;
if NeedsApply then
ModalResult:=mrCancel
else if CheckPas2js then
ModalResult:=mrOk
else
ModalResult:=mrCancel;
end;
procedure TPas2jsInstallerDialog.Pas2jsExeBrowseButtonClick(Sender: TObject);
var
OpenDialog: TOpenDialog;
AFilename: String;
begin
OpenDialog:=TOpenDialog.Create(nil);
try
//InputHistories.ApplyFileDialogSettings(OpenDialog);
OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist];
OpenDialog.Title:=pjsdSelectPas2jsExecutable;
if OpenDialog.Execute then begin
AFilename:=CleanAndExpandFilename(OpenDialog.Filename);
SetComboBoxText(Pas2jsExeComboBox,AFilename,cstFilename,30);
// ToDo CheckCompiler([mbOk]);
end;
finally
OpenDialog.Free;
end;
end;
procedure TPas2jsInstallerDialog.UpdateButtons;
begin
if NeedsApply then
begin
ApplyButton.Enabled:=true;
CloseButton.Caption:='Cancel';
end else begin
ApplyButton.Enabled:=false;
CloseButton.Caption:='Close';
end;
end;
function TPas2jsInstallerDialog.NeedsApply: boolean;
var
CurPas2jsExe, CurPas2jsSrcDir, CurFPCExe, CurFPCSrcDir: TCaption;
begin
CurPas2jsExe:=Pas2jsExeComboBox.Text;
CurPas2jsSrcDir:=Pas2jsSrcDirComboBox.Text;
CurFPCExe:=FPCExeComboBox.Text;
CurFPCSrcDir:=FPCSrcDirComboBox.Text;
Result:=(CurPas2jsExe<>FOldPas2jsExe)
or (CurPas2jsSrcDir<>FOldPas2jsSrcDir)
or (CurFPCExe<>FOldFPCExe)
or (CurFPCSrcDir<>FOldFPCSrcDir);
end;
function TPas2jsInstallerDialog.CheckPas2js: boolean;
var
NewPas2jsExe, NewPas2jsSrcDir: String;
begin
NewPas2jsExe:=PJSOptions.GetParsedCompilerFilename;
NewPas2jsSrcDir:=PJSOptions.GetParsedPas2jsSrcDir;
if (NewPas2jsExe<>FLastCheckedPas2jsExe)
or (NewPas2jsSrcDir<>FLastCheckedPas2jsSrcDir) then
begin
FLastCheckedPas2js:=false;
FLastCheckedPas2jsExe:=NewPas2jsExe;
FLastCheckedPas2jsSrcDir:=NewPas2jsSrcDir;
if (NewPas2jsExe='') or not FileExistsUTF8(NewPas2jsExe) then
else if not FileIsExecutable(NewPas2jsExe) then
else
FLastCheckedPas2js:=true;
end;
Result:=FLastCheckedPas2js;
end;
procedure TPas2jsInstallerDialog.Init;
begin
FOldPas2jsExe:=PJSOptions.CompilerFilename;
FOldPas2jsSrcDir:=PJSOptions.Pas2jsSrcDir;
FOldFPCExe:=PJSOptions.FPCExe;
FOldFPCSrcDir:=PJSOptions.FPCSrcDir;
SetComboBoxText(Pas2jsExeComboBox,PJSOptions.CompilerFilename,cstFilename,30);
SetComboBoxText(Pas2jsSrcDirComboBox,PJSOptions.Pas2jsSrcDir,cstFilename,30);
SetComboBoxText(FPCExeComboBox,PJSOptions.FPCExe,cstFilename,30);
SetComboBoxText(FPCSrcDirComboBox,PJSOptions.FPCSrcDir,cstFilename,30);
UpdateButtons;
end;
end.

View File

@ -158,6 +158,11 @@ msgstr "URL du projet en cours Pas2JS"
msgid "Pas2JS executable"
msgstr "Exécutable Pas2JS"
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr "Exécutable du navigateur sélectionné de Pas2JS"
@ -236,6 +241,10 @@ msgstr "Sélectionner le répertoire du modèle de paquet Atom"
msgid "Select browser executable"
msgstr "Sélectionner l'exécutable du navigateur"
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr "Sélectionner l'exécutable Node.js"
@ -270,10 +279,20 @@ msgstr ""
msgid "Start HTTP Server on port"
msgstr "Démarrer le serveur HTTP sur le port"
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr ""
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr "Utiliser l'objet application du navigateur"
@ -304,6 +323,10 @@ msgstr ""
msgid "Visual Studio Code extension template directory"
msgstr "Répertoire des modèles d'extension de code Visual Studio"
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
msgid "A pas2js program running in the browser."
msgstr "Un programme pas2js en cours d'exécution dans le navigateur."

View File

@ -160,6 +160,11 @@ msgstr "Pas2JS aktuális projekt URL"
msgid "Pas2JS executable"
msgstr "Pas2JS alkalmazás"
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr "Pas2JS kiválasztott böngésző alkalmazás"
@ -238,6 +243,10 @@ msgstr ""
msgid "Select browser executable"
msgstr "A böngésző alkalmazás kiválasztása"
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr "A Node.js alkalmazás kiválasztása"
@ -272,10 +281,20 @@ msgstr ""
msgid "Start HTTP Server on port"
msgstr "HTTP kiszolgáló indítása ezen a porton"
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr ""
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr "Webböngésző alkalmazásobjektum használata"
@ -306,6 +325,10 @@ msgstr ""
msgid "Visual Studio Code extension template directory"
msgstr ""
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
#, fuzzy
#| msgid "A pas2js program running in the browser"

View File

@ -148,6 +148,11 @@ msgstr ""
msgid "Pas2JS executable"
msgstr ""
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr ""
@ -226,6 +231,10 @@ msgstr ""
msgid "Select browser executable"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr ""
@ -260,10 +269,20 @@ msgstr ""
msgid "Start HTTP Server on port"
msgstr ""
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr ""
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr ""
@ -292,6 +311,10 @@ msgstr ""
msgid "Visual Studio Code extension template directory"
msgstr ""
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
msgid "A pas2js program running in the browser."
msgstr ""

View File

@ -163,6 +163,11 @@ msgstr "URL atual de projeto Pas2JS"
msgid "Pas2JS executable"
msgstr "Executável Pas2JS"
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr "Executável selecionado do navegador Pas2JS"
@ -241,6 +246,10 @@ msgstr "Selecionar diretório de modelos de pacote do Atom"
msgid "Select browser executable"
msgstr "Selecionar executável do navegador"
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr "Selecionar executável Node.js"
@ -274,10 +283,20 @@ msgstr "Um programa pas2js executando como cache para um app web. Ele não execu
msgid "Start HTTP Server on port"
msgstr "Iniciar servidor HTTP na porta"
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr "Um Servidor Web Simples é automaticamente iniciado no Executar. A localização é como um subpasta na URL servindo a pasta no disco do arquivo HTML."
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr "Usar objeto \"Browser Application\""
@ -306,6 +325,10 @@ msgstr "Executar programa WebAssembly:"
msgid "Visual Studio Code extension template directory"
msgstr "Diretório de modelos de extensão de código do Visual Studio"
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
msgctxt "strpas2jsdesign.pjsdwebappdescription"
msgid "A pas2js program running in the browser."

View File

@ -161,6 +161,11 @@ msgstr "Адрес текущего проекта Pas2JS"
msgid "Pas2JS executable"
msgstr "Исполнимый файл Pas2JS"
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr "Выбранный исполнимый файл браузера для Pas2JS"
@ -239,6 +244,10 @@ msgstr "Выберите каталог шаблона пакета Atom"
msgid "Select browser executable"
msgstr "Выберите исполнимый файл браузера"
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr "Выберите исполнимый файл Node.js"
@ -273,10 +282,20 @@ msgstr "Программа pas2js, использующаяся в качест
msgid "Start HTTP Server on port"
msgstr "Запускать сервер HTTP на порту"
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr "Простой веб-сервер вызывается автоматически при запуске. Расположение по поведению похоже на подкаталог в адресе, соответствующий каталогу файла HTML на диске."
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr "Использовать объект приложения для браузера"
@ -305,6 +324,10 @@ msgstr "Запускать программу WebAssembly:"
msgid "Visual Studio Code extension template directory"
msgstr "Каталог шаблона расширения Visual Studio Code"
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
msgid "A pas2js program running in the browser."
msgstr "Программа pas2js, запускаемая в браузере."

View File

@ -160,6 +160,11 @@ msgstr ""
msgid "Pas2JS executable"
msgstr ""
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr ""
@ -238,6 +243,10 @@ msgstr ""
msgid "Select browser executable"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr ""
@ -272,10 +281,20 @@ msgstr ""
msgid "Start HTTP Server on port"
msgstr ""
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr ""
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr ""
@ -304,6 +323,10 @@ msgstr ""
msgid "Visual Studio Code extension template directory"
msgstr ""
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
#, fuzzy
#| msgid "A pas2js program running in the browser"

View File

@ -163,6 +163,11 @@ msgstr "URL поточного проєкту Pas2JS"
msgid "Pas2JS executable"
msgstr "Виконуваний файл Pas2JS"
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr "Виконуваний файл вибраного оглядача Pas2JS"
@ -241,6 +246,10 @@ msgstr "Виберіть теку шаблонів пакунка Atom"
msgid "Select browser executable"
msgstr "Вибрати виконуваний файл оглядача"
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr "Вибрати виконуваний файл Node.js"
@ -275,10 +284,20 @@ msgstr "Програма на pas2js, що працює як кеш для ве
msgid "Start HTTP Server on port"
msgstr "Запустити HTTP-сервер на порті"
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr "Простий вебсервер автоматично стартує під час запуску. Розташування схоже на вкладену теку в URL-адресі, яка обслуговує дискову теку файлу HTML."
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr "Використати об'єкт програми-оглядача"
@ -307,6 +326,10 @@ msgstr "Запустити програму WebAssembly:"
msgid "Visual Studio Code extension template directory"
msgstr "Теку шаблонів розширень Visual Studio Code"
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
msgid "A pas2js program running in the browser."
msgstr "Програма pas2js, що запускається в оглядачі."

View File

@ -162,6 +162,11 @@ msgstr "Pas2JS 当前项目 URL"
msgid "Pas2JS executable"
msgstr "Pas2JS 可执行文件"
#: strpas2jsdesign.pjsdpas2jsisnotexecutableat
#, object-pascal-format
msgid "pas2js is not executable at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdpas2jsselectedbrowserexecutable
msgid "Pas2JS selected browser executable"
msgstr "Pas2JS 所选浏览器可执行文件"
@ -240,6 +245,10 @@ msgstr "选择 Atom 软件包模板目录"
msgid "Select browser executable"
msgstr "选择浏览器可执行文件"
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""
#: strpas2jsdesign.pjsdselectnodejsexecutable
msgid "Select Node.js executable"
msgstr "选择 Node.js 可执行文件"
@ -274,10 +283,20 @@ msgstr "作为网页应用程序缓存运行的 pas2js 程序。它不能独立
msgid "Start HTTP Server on port"
msgstr "启动 HTTP 服务器在端口"
#: strpas2jsdesign.pjsdthepas2jsexecutablefilenamedoesnotlooklikepas2js
#, object-pascal-format
msgid "The pas2js executable filename \"%s\" does not look like pas2js"
msgstr ""
#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo
msgid "The Simple Web Server is automatically started on Run. The location is like a subfolder in the URL serving the disk folder of the HTML file."
msgstr "运行时会自动启动简易网站服务器。路径就像 URL 中的一个子文件夹,为 HTML 文件的磁盘文件夹提供服务。"
#: strpas2jsdesign.pjsdunabletofindpas2jsat
#, object-pascal-format
msgid "Unable to find pas2js at \"%s\""
msgstr ""
#: strpas2jsdesign.pjsdusebrowserapplicationobject
msgid "Use Browser Application object"
msgstr "使用浏览器应用程序对象"
@ -306,6 +325,10 @@ msgstr "运行 WebAssembly 程序:"
msgid "Visual Studio Code extension template directory"
msgstr "Visual Studio Code 扩展模板目录"
#: strpas2jsdesign.pjsdwarning
msgid "Warning"
msgstr ""
#: strpas2jsdesign.pjsdwebappdescription
msgid "A pas2js program running in the browser."
msgstr "在浏览器中运行的 pas2js 程序。"

View File

@ -14,11 +14,14 @@
<AllowLabel Value="False"/>
</SyntaxOptions>
</Parsing>
<Other>
<CustomOptions Value="$(IDEBuildOptions)"/>
</Other>
</CompilerOptions>
<Description Value="Adds a Lazarus project for pas2js (Pascal to JavaScript transpiler) browser applications."/>
<License Value="GPL-2"/>
<Version Major="1" Release="2"/>
<Files Count="20">
<Files Count="21">
<Item1>
<Filename Value="pjsdsgnregister.pas"/>
<HasRegisterProc Value="True"/>
@ -102,6 +105,11 @@
<Filename Value="idehtmltools.pas"/>
<UnitName Value="idehtmltools"/>
</Item20>
<Item21>
<Filename Value="frmpas2jsinstaller.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="FrmPas2jsInstaller"/>
</Item21>
</Files>
<CompatibilityMode Value="True"/>
<i18n>

View File

@ -21,6 +21,9 @@ uses
const
PJSDsgnOptsFile = 'pas2jsdsgnoptions.xml';
PJSDefaultCompiler = '$MakeExe(IDE,pas2js)';
PJSDefaultPas2jsSrcDir = '';
PJSDefaultFPCSrcDir = '$(Pas2jsSrcDir)/compiler';
PJSDefaultFPCExe= '';
PJSDefaultDTS2Pas = '$MakeExe(IDE,dts2pas)';
PJSDefaultDTS2PasService = 'https://www.freepascal.org/~michael/service/dts2pas.cgi';
PJSDefaultStartAtPort = 3000; // compileserver default port
@ -32,6 +35,9 @@ const
Type
TPas2jsCachedOption = (
p2jcoCompilerFilename,
p2jcoPas2jsSrcDir,
p2jcoFPCSrcDir, // fpc source directory used for compiling tools and pas2js
p2jcoFPCExe, // fpc used for compiling tools
p2jcoNodeJSFilename,
p2jcoElectronFilename,
p2jcoAtomTemplateDir,
@ -44,12 +50,17 @@ Type
const
p2jcoFilenames = [
p2jcoCompilerFilename,
p2jcoFPCExe,
p2jcoNodeJSFilename,
p2jcoElectronFilename,
p2jcoAtomTemplateDir,
p2jcoVSCodeTemplateDir,
p2jcoDTSToPas
];
p2jcoDirectories = [
p2jcoPas2jsSrcDir,
p2jcoFPCSrcDir
];
type
TPas2jsCachedValue = record
@ -74,6 +85,9 @@ type
function GetDTS2Pas: String;
function GetDTS2PasService: String;
function GetElectronFileName: string;
function GetFPCExe: string;
function GetFPCSrcDir: string;
function GetPas2jsSrcDir: string;
function GetVSCodeTemplateDir: String;
function GetModified: boolean;
function GetNodeJSFileName: string;
@ -82,6 +96,9 @@ type
procedure SetDTS2Pas(AValue: String);
procedure SetDTS2PasService(AValue: String);
procedure SetElectronFileName(AValue: string);
procedure SetFPCExe(AValue: string);
procedure SetFPCSrcDir(AValue: string);
procedure SetPas2jsSrcDir(AValue: string);
procedure SetVSCodeTemplateDir(AValue: String);
procedure SetModified(AValue: boolean);
procedure SetCompilerFilename(AValue: string);
@ -95,6 +112,7 @@ type
procedure Load;
procedure Save;
function GetParsedCompilerFilename: string;
function GetParsedPas2jsSrcDir: string;
function GetParsedNodeJSFilename: string;
function GetParsedElectronExe: string;
procedure LoadFromConfig(Cfg: TConfigStorage);
@ -103,6 +121,9 @@ type
property ChangeStamp: int64 read FChangeStamp;
property Modified: boolean read GetModified write SetModified;
property CompilerFilename: string read GetCompilerFilename write SetCompilerFilename;
property Pas2jsSrcDir: string read GetPas2jsSrcDir write SetPas2jsSrcDir; // with trailing pathdelim
property FPCSrcDir: string read GetFPCSrcDir write SetFPCSrcDir; // used for compiling tools and pas2js, with trailing pathdelim
property FPCExe: string read GetFPCExe write SetFPCExe; // used for compiling tools
property NodeJSFileName : string Read GetNodeJSFileName Write SetNodeJSFileName;
property ElectronFileName : string Read GetElectronFileName Write SetElectronFileName;
property AtomTemplateDir : String Read GetAtomTemplateDir Write SetAtomTemplateDir;
@ -218,6 +239,21 @@ begin
Result:=FCachedOptions[p2jcoElectronFilename].RawValue;
end;
function TPas2jsOptions.GetFPCExe: string;
begin
Result:=FCachedOptions[p2jcoFPCExe].RawValue;
end;
function TPas2jsOptions.GetFPCSrcDir: string;
begin
Result:=FCachedOptions[p2jcoFPCSrcDir].RawValue;
end;
function TPas2jsOptions.GetPas2jsSrcDir: string;
begin
Result:=FCachedOptions[p2jcoPas2jsSrcDir].RawValue;
end;
function TPas2jsOptions.GetVSCodeTemplateDir: String;
begin
Result:=FCachedOptions[p2jcoVSCodeTemplateDir].RawValue;
@ -292,6 +328,9 @@ end;
Const
KeyCompiler = 'compiler/value';
KeyPas2jsSrcDir = 'sources/value';
KeyFPCSrcDir = 'fpcsrcdir/value';
KeyFPCExe= 'fpc/value';
KeyHTTPServer = 'webserver/value';
KeyBrowser = 'webbrowser/value';
KeyNodeJS = 'nodejs/value';
@ -306,6 +345,9 @@ procedure TPas2jsOptions.LoadFromConfig(Cfg: TConfigStorage);
begin
CompilerFilename:=Cfg.GetValue(KeyCompiler,PJSDefaultCompiler);
Pas2jsSrcDir:=Cfg.GetValue(KeyPas2jsSrcDir,PJSDefaultPas2jsSrcDir);
FPCSrcDir:=Cfg.GetValue(KeyFPCSrcDir,PJSDefaultFPCSrcDir);
FPCExe:=Cfg.GetValue(KeyFPCExe,PJSDefaultFPCExe);
NodeJSFileName:=Cfg.GetValue(KeyNodeJS,PJSDefaultNodeJS);
ElectronFileName:=Cfg.GetValue(KeyElectronExe,PJSDefaultElectronExe);
AtomTemplateDir:=Cfg.GetValue(KeyAtomTemplate,'');
@ -325,6 +367,9 @@ procedure TPas2jsOptions.SaveToConfig(Cfg: TConfigStorage);
begin
Cfg.SetDeleteValue(KeyCompiler,CompilerFilename,PJSDefaultCompiler);
Cfg.SetDeleteValue(KeyPas2jsSrcDir,Pas2jsSrcDir,PJSDefaultPas2jsSrcDir);
Cfg.SetDeleteValue(KeyFPCSrcDir,FPCSrcDir,PJSDefaultFPCSrcDir);
Cfg.SetDeleteValue(KeyFPCExe,FPCExe,PJSDefaultFPCExe);
Cfg.SetDeleteValue(KeyStartPortAt,StartAtPort,PJSDefaultStartAtPort);
Cfg.SetDeleteValue(KeyNodeJS,NodeJSFileName,PJSDefaultNodeJS);
Cfg.SetDeleteValue(KeyElectronExe,ElectronFileName,PJSDefaultElectronExe);
@ -345,6 +390,11 @@ begin
Result:=GetParsedOptionValue(p2jcoCompilerFilename);
end;
function TPas2jsOptions.GetParsedPas2jsSrcDir: string;
begin
Result:=GetParsedOptionValue(p2jcoPas2jsSrcDir);
end;
function TPas2jsOptions.GetParsedNodeJSFilename: string;
begin
Result:=GetParsedOptionValue(p2jcoNodeJSFilename);
@ -359,7 +409,7 @@ function TPas2jsOptions.GetParsedOptionValue(Option: TPas2jsCachedOption
): string;
var
p: PPas2jsCachedValue;
IsFilename: Boolean;
IsFilename, IsDirectory: Boolean;
begin
p:=@FCachedOptions[Option];
if p^.Stamp<>IDEMacros.BaseTimeStamp then
@ -368,6 +418,7 @@ begin
p^.ParsedValue:=p^.RawValue;
IDEMacros.SubstituteMacros(p^.ParsedValue);
IsFilename:=Option in p2jcoFilenames;
IsDirectory:=Option in p2jcoDirectories;
if IsFilename then
begin
p^.ParsedValue:=TrimFilename(p^.ParsedValue);
@ -380,6 +431,15 @@ begin
p^.ParsedValue:=''; // not found
end;
end;
if IsDirectory then
begin
p^.ParsedValue:=TrimFilename(p^.ParsedValue);
if (p^.ParsedValue<>'')
and not FilenameIsAbsolute(p^.ParsedValue) then
begin
p^.ParsedValue:=''; // not found
end;
end;
if p^.ParsedValue='' then
begin
case Option of
@ -423,6 +483,24 @@ begin
SetCachedOption(p2jcoElectronFilename,AValue);
end;
procedure TPas2jsOptions.SetFPCExe(AValue: string);
begin
AValue:=TrimFilename(AValue);
SetCachedOption(p2jcoFPCExe,AValue);
end;
procedure TPas2jsOptions.SetFPCSrcDir(AValue: string);
begin
AValue:=AppendPathDelim(TrimFilename(AValue));
SetCachedOption(p2jcoFPCSrcDir,AValue);
end;
procedure TPas2jsOptions.SetPas2jsSrcDir(AValue: string);
begin
AValue:=AppendPathDelim(TrimFilename(AValue));
SetCachedOption(p2jcoPas2jsSrcDir,AValue);
end;
procedure TPas2jsOptions.SetVSCodeTemplateDir(AValue: String);
begin
AValue:=TrimFilename(AValue);

View File

@ -130,7 +130,7 @@ begin
try
InitIDEFileDialog(OpenDialog);
OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist];
OpenDialog.Title:='Select Electron executable';
OpenDialog.Title:=pjsdSelectElectronExecutable;
if OpenDialog.Execute then begin
AFilename:=CleanAndExpandFilename(OpenDialog.Filename);
SetComboBoxText(ElectronExeComboBox,AFilename,cstFilename,30);
@ -175,19 +175,21 @@ begin
PJSOptions.CompilerFilename:=NewExe;
NewExe:=PJSOptions.GetParsedCompilerFilename;
if (NewExe='') or not FileExistsUTF8(NewExe) then
ErrMsg:='Unable to find pas2js at "'+PJSOptions.CompilerFilename+'"'
ErrMsg:=Format(pjsdUnableToFindPas2jsAt, [PJSOptions.CompilerFilename])
else if not FileIsExecutable(NewExe) then
ErrMsg:='pas2js is not executable at "'+PJSOptions.CompilerFilename+'"'
ErrMsg:=Format(pjsdPas2jsIsNotExecutableAt, [PJSOptions.CompilerFilename])
else
ErrMsg:='';
if ErrMsg<>'' then
begin
IDEMessageDialog('Error',ErrMsg,mtError,[mbOk]);
IDEMessageDialog(pjsdError, ErrMsg, mtError, [mbOk]);
exit(false);
end;
if PosI('pas2js',ExtractFileNameOnly(NewExe))<1 then
begin
IDEMessageDialog('Warning','The pas2js executable filename "'+NewExe+'" does not look like pas2js',mtWarning,[mbOk]);
IDEMessageDialog(pjsdWarning, Format(
pjsdThePas2jsExecutableFilenameDoesNotLookLikePas2js, [NewExe]),
mtWarning, [mbOk]);
exit(true);
end;
// todo: run and check if this pas2js returns macros

View File

@ -18,9 +18,9 @@ uses
IDEDialogs, ProjectGroupIntf, IDEExternToolIntf, MacroIntf, PackageIntf,
// Pas2js
idehtml2class, PJSDsgnOptions, PJSDsgnOptsFrame, idedtstopas,
frmpas2jsnodejsprojectoptions,
frmpas2jsbrowserprojectoptions, PJSProjectOptions, idehtmltools,
frmhtmltoform, PJSController, StrPas2JSDesign, ProjectGroup;
frmpas2jsnodejsprojectoptions, frmpas2jsbrowserprojectoptions,
PJSProjectOptions, idehtmltools, frmhtmltoform, PJSController,
StrPas2JSDesign, FrmPas2jsInstaller, ProjectGroup;
const
ProjDescNamePas2JSWebApp = 'Web Application';
@ -314,6 +314,7 @@ Type
Procedure OnRefreshProjHTMLFormAllContext(Sender : TObject); virtual;
Procedure OnSrcEditPopup(Sender : TObject); virtual;
Procedure OnPrjInspPopup(Sender : TObject); virtual;
Procedure OnInstallPas2js(Sender : TObject); virtual;
end;
Var
@ -350,7 +351,7 @@ begin
{$IFDEF EnablePas2jsInstall}
// register menu item
RegisterIDEMenuCommand(itmCustomTools,'Pas2jsInstall','Install/Update Pas2js',@OnInstallPas2js);
RegisterIDEMenuCommand(itmOptionsDialogs,'Pas2jsInstall','Install/Update Pas2js',@Pas2JSHandler.OnInstallPas2js);
{$ENDIF}
// register new-project items
@ -1859,6 +1860,11 @@ begin
PrjMnuItemAll.Visible:=AnyOK;
end;
procedure TPas2JSHandler.OnInstallPas2js(Sender: TObject);
begin
ShowPas2jsInstallerDialog;
end;
function TPas2JSHandler.AskUserFile(aUnitName,aHTMLFileName: String): string;
Var

View File

@ -16,6 +16,9 @@ Resourcestring
+'using Electron to run as desktop application.';
pjsdOverwrite = 'Overwrite?';
pjsdError = 'Error';
pjsdWarning = 'Warning';
pjsdThePas2jsExecutableFilenameDoesNotLookLikePas2js = 'The pas2js '
+'executable filename "%s" does not look like pas2js';
pjsdNewProjectFile = 'New project file';
pjsdProjectPascalFile = 'Project Pascal file';
pjsdPleaseChooseAFileWithFullPath = 'Please choose a file with full path.';
@ -36,8 +39,11 @@ Resourcestring
pjsdSelectPas2jsExecutable = 'Select pas2js executable';
pjsdSelectXExecutable = 'Select %s executable';
pjsdSelectNodeJSExecutable = 'Select Node.js executable';
pjsdUnableToFindPas2jsAt = 'Unable to find pas2js at "%s"';
pjsdPas2jsIsNotExecutableAt = 'pas2js is not executable at "%s"';
pjsdSelectBrowserExecutable = 'Select browser executable';
pjsdSelectAtomTemplateDir = 'Select Atom package template directory';
pjsdSelectElectronExecutable = 'Select Electron executable';
pjsdSelectVSCodeTemplateDir = 'Select Visual Studio Code extension template directory';
pjsdYouCanUseIDEMacrosLikeMakeExeWithoutAFullPathIsSea = 'You can use IDE '
+'macros like $MakeExe(). Without a full path, %s is searched in PATH.';