pas2js: project options: updated layout and added execute run parameters

This commit is contained in:
mattias 2022-04-12 21:53:18 +02:00
parent ba8174b384
commit c046f130e9
17 changed files with 592 additions and 452 deletions

View File

@ -1,13 +1,12 @@
object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Left = 431
Height = 538
Top = 310
Left = 1434
Height = 490
Top = 765
Width = 632
Caption = 'Pas2JS Browser project options'
ClientHeight = 538
ClientHeight = 490
ClientWidth = 632
OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '2.3.0.0'
object CBCreateHTML: TCheckBox
@ -27,11 +26,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
end
object CBUseBrowserApp: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = cbShowUncaughtExceptions
AnchorSideTop.Control = CBUseBrowserConsole
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 122
Top = 151
Width = 198
BorderSpacing.Top = 6
Caption = 'Use Browser Application object'
@ -40,12 +39,13 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
end
object CBUseBrowserConsole: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = edtWasmProgram
AnchorSideTop.Control = cbShowUncaughtExceptions
AnchorSideTop.Side = asrBottom
Left = 6
Left = 38
Height = 23
Top = 216
Top = 122
Width = 313
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Use Browser Console unit to display writeln() output'
TabOrder = 2
@ -53,7 +53,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
object BPHelpOptions: TButtonPanel
Left = 6
Height = 40
Top = 492
Top = 444
Width = 620
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
@ -66,114 +66,44 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
TabOrder = 3
ShowButtons = [pbOK, pbCancel]
end
object SEPort: TSpinEdit
AnchorSideLeft.Control = RBStartServerAt
AnchorSideTop.Control = RBStartServerAt
AnchorSideTop.Side = asrBottom
Left = 70
Height = 30
Top = 303
Width = 128
BorderSpacing.Left = 32
BorderSpacing.Top = 6
MaxValue = 65354
MinValue = 1024
TabOrder = 4
Value = 3000
end
object CBUseHTTPServer: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBUseBrowserConsole
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 245
Width = 182
BorderSpacing.Top = 6
Caption = 'Project needs a HTTP Server'
OnChange = CBUseHTTPServerChange
TabOrder = 5
end
object RBStartServerAt: TRadioButton
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBUseHTTPServer
AnchorSideTop.Side = asrBottom
Left = 38
Height = 23
Top = 274
Width = 168
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Start HTTP Server on port'
Checked = True
TabOrder = 6
TabStop = True
end
object RBUseURL: TRadioButton
AnchorSideLeft.Control = RBStartServerAt
AnchorSideTop.Control = SEPort
AnchorSideTop.Side = asrBottom
Left = 38
Height = 23
Top = 335
Width = 161
BorderSpacing.Top = 2
Caption = 'Use this URL to start app'
TabOrder = 7
end
object CBServerURL: TComboBox
AnchorSideLeft.Control = RBUseURL
AnchorSideTop.Control = RBUseURL
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 70
Height = 30
Top = 364
Width = 556
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 32
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
ItemHeight = 0
TabOrder = 8
end
object CBMaintainPage: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBCreateHTML
AnchorSideTop.Side = asrBottom
Left = 6
Left = 38
Height = 23
Top = 35
Width = 137
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Maintain HTML Page'
TabOrder = 9
TabOrder = 4
end
object CBRunOnReady: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBMaintainPage
AnchorSideTop.Side = asrBottom
Left = 6
Left = 38
Height = 23
Top = 64
Width = 287
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Run rtl when all page resources are fully loaded'
TabOrder = 10
TabOrder = 5
end
object cbShowUncaughtExceptions: TCheckBox
AnchorSideLeft.Control = CBRunOnReady
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBRunOnReady
AnchorSideTop.Side = asrBottom
Left = 6
Left = 38
Height = 23
Top = 93
Width = 209
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Let rtl show uncaught exceptions'
TabOrder = 11
TabOrder = 6
end
object CBUseWASI: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
@ -181,13 +111,13 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrBottom
Left = 38
Height = 23
Top = 151
Top = 180
Width = 176
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Host webassembly program'
Enabled = False
TabOrder = 12
TabOrder = 7
end
object edtWasmProgram: TEdit
AnchorSideLeft.Control = CBUseWASI
@ -197,27 +127,120 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideRight.Side = asrBottom
Left = 70
Height = 30
Top = 180
Top = 209
Width = 556
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 32
BorderSpacing.Top = 6
BorderSpacing.Right = 6
Enabled = False
TabOrder = 13
TabOrder = 8
TextHint = 'Name of your webassembly file'
end
object CBUseModule: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBServerURL
AnchorSideTop.Control = edtWasmProgram
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 400
Top = 245
Width = 272
BorderSpacing.Top = 6
Caption = 'Create a javascript module instead of a script'
OnChange = CBUseHTTPServerChange
TabOrder = 14
TabOrder = 9
end
object RunGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CBUseModule
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 123
Top = 274
Width = 620
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Run'
ClientHeight = 107
ClientWidth = 618
TabOrder = 10
object RBRunServerAt: TRadioButton
AnchorSideLeft.Control = RunGroupBox
AnchorSideTop.Control = SEPort
AnchorSideTop.Side = asrCenter
Left = 6
Height = 23
Top = 10
Width = 168
BorderSpacing.Left = 6
Caption = 'Start HTTP Server on port'
Checked = True
OnChange = RBRunServerAtChange
TabOrder = 4
TabStop = True
end
object SEPort: TSpinEdit
AnchorSideLeft.Control = RBRunServerAt
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RunGroupBox
Left = 180
Height = 30
Top = 6
Width = 76
BorderSpacing.Left = 6
BorderSpacing.Top = 6
MaxValue = 65354
MinValue = 1024
TabOrder = 0
Value = 3000
end
object RBRunBrowserWithURL: TRadioButton
AnchorSideLeft.Control = RBRunServerAt
AnchorSideTop.Control = CBServerURL
AnchorSideTop.Side = asrCenter
Left = 6
Height = 23
Top = 46
Width = 138
Caption = 'Use URL to start app'
OnChange = RBRunBrowserWithURLChange
TabOrder = 1
end
object CBServerURL: TComboBox
AnchorSideLeft.Control = RBRunBrowserWithURL
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SEPort
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = RunGroupBox
AnchorSideRight.Side = asrBottom
Left = 150
Height = 30
Top = 42
Width = 462
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
ItemHeight = 0
TabOrder = 2
end
object RBRunDefault: TRadioButton
AnchorSideTop.Control = CBServerURL
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 78
Width = 162
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
Caption = 'Execute Run Parameters'
OnChange = RBRunDefaultChange
TabOrder = 3
end
end
end

View File

@ -8,6 +8,18 @@ uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ButtonPanel,
Spin, strpas2jsdesign;
const
WBBoolCreateHTML = 0;
WBBoolMainHTML = 1;
WBBoolRunOnReady = 2;
WBBoolShowUncaughtExceptions = 3;
WBBoolUseBrowserApp = 4;
WBBoolUseWASI = 5;
WBBoolUseBrowserConsole = 6;
WBBoolUseModule = 7;
WBBoolRunServerAtPort = 8;
WBBoolRunBrowserWithURL = 9;
WBBoolRunDefault = 10;
type
{ TWebBrowserProjectOptionsForm }
@ -15,26 +27,28 @@ type
TWebBrowserProjectOptionsForm = class(TForm)
BPHelpOptions: TButtonPanel;
CBCreateHTML: TCheckBox;
CBServerURL: TComboBox;
CBUseBrowserApp: TCheckBox;
CBUseModule: TCheckBox;
CBUseWASI: TCheckBox;
CBUseBrowserConsole: TCheckBox;
CBUseHTTPServer: TCheckBox;
CBServerURL: TComboBox;
CBMaintainPage: TCheckBox;
CBRunOnReady: TCheckBox;
cbShowUncaughtExceptions: TCheckBox;
edtWasmProgram: TEdit;
RBUseURL: TRadioButton;
RBStartServerAt: TRadioButton;
RBRunDefault: TRadioButton;
RBRunServerAt: TRadioButton;
RBRunBrowserWithURL: TRadioButton;
RunGroupBox: TGroupBox;
SEPort: TSpinEdit;
procedure CBCreateHTMLChange(Sender: TObject);
procedure CBUseBrowserAppChange(Sender: TObject);
procedure CBUseHTTPServerChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure RBRunDefaultChange(Sender: TObject);
procedure RBRunServerAtChange(Sender: TObject);
procedure RBRunBrowserWithURLChange(Sender: TObject);
private
procedure CheckWasi;
function GetB(AIndex: Integer): Boolean;
function GetServerPort: Word;
function GetURL: String;
@ -43,22 +57,30 @@ type
procedure SetServerPort(AValue: Word);
procedure SetURL(AValue: String);
procedure SetWasmProgramURL(AValue: String);
procedure UpdateHTMLControls;
procedure UpdateBrowserAppControls;
procedure UpdateRunControls;
public
procedure HideWASM; virtual;
procedure HideModule; virtual;
property CreateHTML : Boolean Index 0 read GetB Write SetB;
property MaintainHTML : Boolean Index 1 read GetB Write SetB;
property UseBrowserApp : Boolean Index 2 read GetB Write SetB;
property UseBrowserConsole : Boolean Index 3 read GetB Write SetB;
property StartHTTPServer : Boolean Index 4 read GetB Write SetB;
property UseURL : Boolean Index 5 read GetB Write SetB;
property UseRunOnReady : Boolean Index 6 read GetB Write SetB;
property ShowUncaughtExceptions : Boolean Index 7 read GetB Write SetB;
property UseWASI : Boolean Index 8 read GetB Write SetB;
property UseModule : Boolean Index 9 read GetB Write SetB;
Property ServerPort : Word Read GetServerPort Write SetServerPort;
Property URL : String Read GetURL Write SetURL;
Property WasmProgramURL : String Read GetWasmProgramURL Write SetWasmProgramURL;
property CreateHTML : Boolean Index WBBoolCreateHTML read GetB Write SetB;
property MaintainHTML : Boolean Index WBBoolMainHTML read GetB Write SetB;
property UseRunOnReady : Boolean Index WBBoolRunOnReady read GetB Write SetB;
property ShowUncaughtExceptions : Boolean Index WBBoolShowUncaughtExceptions read GetB Write SetB;
property UseBrowserApp : Boolean Index WBBoolUseBrowserApp read GetB Write SetB;
property UseWASI : Boolean Index WBBoolUseWASI read GetB Write SetB;
property WasmProgramURL : String Read GetWasmProgramURL Write SetWasmProgramURL;
property UseBrowserConsole : Boolean Index WBBoolUseBrowserConsole read GetB Write SetB;
property UseModule : Boolean Index WBBoolUseModule read GetB Write SetB;
property RunServerAtPort : Boolean Index WBBoolRunServerAtPort read GetB Write SetB;
property ServerPort : Word Read GetServerPort Write SetServerPort;
property RunBrowserWithURL : Boolean Index WBBoolRunBrowserWithURL read GetB Write SetB;
property URL : String Read GetURL Write SetURL;
property RunDefault : Boolean Index WBBoolRunDefault read GetB Write SetB;
end;
var
@ -81,78 +103,80 @@ procedure TWebBrowserProjectOptionsForm.CBCreateHTMLChange(Sender: TObject);
end;
begin
DoCB(CBRunOnReady);
UpdateHTMLControls;
DoCB(CBMaintainPage);
DoCB(CBRunOnReady);
end;
procedure TWebBrowserProjectOptionsForm.CBUseBrowserAppChange(Sender: TObject);
begin
CheckWASI;
UpdateBrowserAppControls;
end;
procedure TWebBrowserProjectOptionsForm.CheckWasi;
procedure TWebBrowserProjectOptionsForm.CBUseHTTPServerChange(Sender: TObject);
begin
end;
procedure TWebBrowserProjectOptionsForm.UpdateBrowserAppControls;
begin
CBUseWASI.Enabled:=UseBrowserApp;
edtWasmProgram.Enabled:=UseBrowserApp;
end;
procedure TWebBrowserProjectOptionsForm.CBUseHTTPServerChange(Sender: TObject);
procedure disen(C : TControl);
begin
C.Enabled:=CBUseHTTPServer.Checked;
if C is TRadioButton then
if not C.Enabled then
TRadioButton(C).Checked:=False;
end;
begin
disen(RBStartServerAt);
disen(RBUseURL);
disen(SEPort);
disen(CBServerURL);
end;
procedure TWebBrowserProjectOptionsForm.FormCreate(Sender: TObject);
begin
// localize
Caption:=pjsdPas2JSBrowserProjectOptions;
CBCreateHTML.Caption:=pjsdCreateInitialHTMLPage;
CBMaintainPage.Caption:=pjsdMaintainHTMLPage;
CBRunOnReady.Caption:=pjsdRunRTLWhenAllPageResourcesAreFullyLoaded;
cbShowUncaughtExceptions.Caption:=pjsdLetRTLShowUncaughtExceptions;
CBUseBrowserApp.Caption:=pjsdUseBrowserApplicationObject;
CBUseBrowserConsole.Caption:=pjsdUseBrowserConsoleUnitToDisplayWritelnOutput;
CBUseHTTPServer.Caption:=pjsdProjectNeedsAHTTPServer;
RBStartServerAt.Caption:=pjsdStartHTTPServerOnPort;
RBUseURL.Caption:=pjsdUseThisURLToStartApplication;
CBUseWASI.Caption:=pjsdUseWASIApplicationObject;
edtWasmProgram.TextHint:=pjsWasiProgramFileTextHint;
CBUseBrowserConsole.Caption:=pjsdUseBrowserConsoleUnitToDisplayWritelnOutput;
CBUseModule.Caption:=pjsCreateAJavascriptModuleInsteadOfAScript;
RBRunServerAt.Caption:=pjsdStartHTTPServerOnPort;
RBRunBrowserWithURL.Caption:=pjsdUseThisURLToStartApplication;
RBRunDefault.Caption:=pjsExecuteRunParameters;
CBCreateHTMLChange(self);
CBUseHTTPServerChange(Self);
end;
procedure TWebBrowserProjectOptionsForm.FormShow(Sender: TObject);
procedure TWebBrowserProjectOptionsForm.RBRunDefaultChange(Sender: TObject);
begin
// Need to do this again, in case options were set before show
CBCreateHTMLChange(self);
CBUseHTTPServerChange(Self);
UpdateRunControls;
end;
procedure TWebBrowserProjectOptionsForm.RBRunServerAtChange(Sender: TObject);
begin
UpdateRunControls;
end;
procedure TWebBrowserProjectOptionsForm.RBRunBrowserWithURLChange(Sender: TObject);
begin
UpdateRunControls;
end;
function TWebBrowserProjectOptionsForm.GetB(AIndex: Integer): Boolean;
begin
Case Aindex of
0 : Result:=CBCreateHTML.Checked;
1 : Result:=CBMaintainPage.Checked;
2 : Result:=CBUseBrowserApp.Checked;
3 : Result:=CBUseBrowserConsole.Checked;
4 : Result:=RBStartServerAt.Checked;
5 : Result:=RBUseURL.Checked;
6 : Result:=CBRunOnReady.Checked;
7 : Result:=cbShowUncaughtExceptions.Checked;
8 : Result:=cbUseWASI.Checked;
9 : Result:=cbUseModule.Checked;
WBBoolCreateHTML : Result:=CBCreateHTML.Checked;
WBBoolMainHTML : Result:=CBMaintainPage.Checked;
WBBoolRunOnReady : Result:=CBRunOnReady.Checked;
WBBoolShowUncaughtExceptions : Result:=cbShowUncaughtExceptions.Checked;
WBBoolUseBrowserApp : Result:=CBUseBrowserApp.Checked;
WBBoolUseWASI : Result:=cbUseWASI.Checked;
WBBoolUseBrowserConsole : Result:=CBUseBrowserConsole.Checked;
WBBoolUseModule : Result:=cbUseModule.Checked;
WBBoolRunServerAtPort : Result:=RBRunServerAt.Checked;
WBBoolRunBrowserWithURL : Result:=RBRunBrowserWithURL.Checked;
WBBoolRunDefault : Result:=RBRunDefault.Checked;
else
Result:=False;
end;
@ -176,30 +200,17 @@ end;
procedure TWebBrowserProjectOptionsForm.SetB(AIndex: Integer; AValue: Boolean);
begin
Case Aindex of
0 : CBCreateHTML.Checked:=AValue;
1 : CBMaintainPage.Checked:=AValue;
2 :
begin
CBUseBrowserApp.Checked:=AValue;
CheckWASI;
end;
3 : CBUseBrowserConsole.Checked:=AValue;
4 :
begin
RBStartServerAt.Checked:=AValue;
if AValue then
CBUseHTTPServer.Checked:=true
end;
5 :
begin
RBUseURL.Checked:=AValue;
if AValue then
CBUseHTTPServer.Checked:=true
end;
6 : CBRunOnReady.Checked:=Avalue;
7 : cbShowUncaughtExceptions.Checked:=aValue;
8 : cbUseWASI.Checked:=aValue;
9 : cbUseModule.Checked:=aValue;
WBBoolCreateHTML : begin CBCreateHTML.Checked:=AValue; UpdateHTMLControls; end;
WBBoolMainHTML : CBMaintainPage.Checked:=AValue;
WBBoolRunOnReady : CBRunOnReady.Checked:=AValue;
WBBoolShowUncaughtExceptions : cbShowUncaughtExceptions.Checked:=AValue;
WBBoolUseBrowserConsole : CBUseBrowserConsole.Checked:=AValue;
WBBoolUseBrowserApp : begin CBUseBrowserApp.Checked:=AValue; UpdateBrowserAppControls; end;
WBBoolUseWASI : begin cbUseWASI.Checked:=AValue; UpdateBrowserAppControls; end;
WBBoolUseModule : cbUseModule.Checked:=AValue;
WBBoolRunServerAtPort : begin RBRunServerAt.Checked:=AValue; UpdateRunControls; end;
WBBoolRunBrowserWithURL : begin RBRunBrowserWithURL.Checked:=AValue; UpdateRunControls; end;
WBBoolRunDefault : begin RBRunDefault.Checked:=AValue; UpdateRunControls; end;
end;
end;
@ -218,6 +229,23 @@ begin
edtWasmProgram.Text:=aValue;
end;
procedure TWebBrowserProjectOptionsForm.UpdateHTMLControls;
var
aEnabled: Boolean;
begin
aEnabled:=CBCreateHTML.Checked;
CBMaintainPage.Enabled:=aEnabled;
CBRunOnReady.Enabled:=aEnabled;
cbShowUncaughtExceptions.Enabled:=aEnabled;
CBUseBrowserConsole.Enabled:=aEnabled;
end;
procedure TWebBrowserProjectOptionsForm.UpdateRunControls;
begin
SEPort.Enabled:=RBRunServerAt.Enabled and RBRunServerAt.Checked;
CBServerURL.Enabled:=RBRunBrowserWithURL.Enabled and RBRunBrowserWithURL.Checked;
end;
procedure TWebBrowserProjectOptionsForm.HideWASM;
begin
CBUseWASI.Visible:=false;

View File

@ -11,6 +11,10 @@ msgstr ""
"Language: fr\n"
"X-Generator: Poedit 3.0\n"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr "Répertoire des modèles de paquets Atom"
@ -191,10 +195,6 @@ msgstr "Page du projet HTML :"
msgid "Project is a Web Browser (pas2js) project"
msgstr "Le projet est un projet de navigateur Web (pas2js)"
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr "Le projet requiert un serveur HTTP"
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr "Réinitialiser la commande de compilation"
@ -254,7 +254,9 @@ msgid "Use Browser Application object"
msgstr "Utiliser l'objet application du navigateur"
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
#, fuzzy
#| msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr "Utiliser l'unité de la console du navigateur pour afficher la sortie writeln ()"
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -294,6 +296,14 @@ msgstr "Projet Web (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Vous pouvez utiliser des macros de l'EDI comme $MakeExe(). Sans chemin complet, %s est recherché dans PATH."
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr ""

View File

@ -11,6 +11,10 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.6\n"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr ""
@ -193,10 +197,6 @@ msgstr "A projekt HTML lapja:"
msgid "Project is a Web Browser (pas2js) project"
msgstr "A projekt egy webböngészős (pas2js) projekt"
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr "A projektnek egy HTTP kiszolgálóra van szüksége"
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr "A fordítás parancs alaphelyzetbe állítása"
@ -256,7 +256,9 @@ msgid "Use Browser Application object"
msgstr "Webböngésző alkalmazásobjektum használata"
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
#, fuzzy
#| msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr "Böngészőkonzol használata a writeln() kimenet megjelenítésére"
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -298,6 +300,14 @@ msgstr "Web projekt (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Használhatók az IDE makrók, mint a $MakeExe(). Teljes útvonal nélkül a PATH-ban felsorolt helyeken lesz keresve a(z) %s."
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr ""

View File

@ -1,6 +1,10 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr ""
@ -181,10 +185,6 @@ msgstr ""
msgid "Project is a Web Browser (pas2js) project"
msgstr ""
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr ""
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr ""
@ -244,7 +244,7 @@ msgid "Use Browser Application object"
msgstr ""
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr ""
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -284,6 +284,14 @@ msgstr ""
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr ""
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr ""

View File

@ -11,6 +11,10 @@ msgstr ""
"Language: pt_BR\n"
"X-Generator: Poedit 1.8.13\n"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr "Diretório de modelos de pacote do Atom"
@ -193,10 +197,6 @@ msgstr "Página HTML do projeto:"
msgid "Project is a Web Browser (pas2js) project"
msgstr "Projeto é uma Navegador Web (pas2js)"
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr "Projeto precisa de um servidor HTTP"
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr "Comando redefinir compilação"
@ -255,7 +255,9 @@ msgid "Use Browser Application object"
msgstr "Usar objeto \"Browser Application\""
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
#, fuzzy
#| msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr "Usar a unidade \"Browser Console\" para exibir saídas \"writeln()\""
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -297,6 +299,14 @@ msgstr "Projeto Web (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Você pode usar macros IDE como \"$MakeExe()\". Sem um caminho completo, %s é pesquisado em \"PATH\""
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr ""

View File

@ -11,6 +11,10 @@ msgstr ""
"Language: ru\n"
"X-Generator: Poedit 2.4.3\n"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr "Каталог шаблона пакета Atom"
@ -194,10 +198,6 @@ msgstr "Страница HTML проекта:"
msgid "Project is a Web Browser (pas2js) project"
msgstr "Проект предназначен для веб-браузера (pas2js)"
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr "Проекту требуется сервер HTTP"
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr "Сбросить команду компиляции"
@ -257,7 +257,9 @@ msgid "Use Browser Application object"
msgstr "Использовать объект приложения для браузера"
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
#, fuzzy
#| msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr "Отображать вывод writeln() посредством модуля консоли браузера"
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -297,6 +299,14 @@ msgstr "Веб-проект (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Можно использовать макросы IDE, например, $MakeExe(). Если полный путь не указан, поиск %s производится при помощи переменной окружения PATH."
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr "Обновить все классы из исходного текста HTML"

View File

@ -11,6 +11,10 @@ msgstr ""
"Language: tr\n"
"X-Generator: Poedit 2.2.3\n"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr ""
@ -193,10 +197,6 @@ msgstr ""
msgid "Project is a Web Browser (pas2js) project"
msgstr ""
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr ""
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr ""
@ -256,7 +256,7 @@ msgid "Use Browser Application object"
msgstr ""
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr ""
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -298,6 +298,14 @@ msgstr ""
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr ""
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr ""

View File

@ -13,6 +13,10 @@ msgstr ""
"X-Generator: Lokalize 19.12.3\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr "Тека шаблонів пакунка Atom"
@ -193,10 +197,6 @@ msgstr "HTML-сторінка проєкту:"
msgid "Project is a Web Browser (pas2js) project"
msgstr "Це проєкт веб-оглядача (pas2js)"
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr "Проєкту потрібен HTTP-сервер"
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr "Скинути команду компіляції"
@ -256,7 +256,9 @@ msgid "Use Browser Application object"
msgstr "Використати об'єкт програми-оглядача"
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
#, fuzzy
#| msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr "Для виведення команди writeln() використати модуль консолі оглядача"
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -296,6 +298,14 @@ msgstr "Веб-проєкт (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Можна використовувати макроси ІСР на зразок $MakeExe(). Без повного шляху %s буде шукатись у PATH."
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr ""

View File

@ -12,6 +12,10 @@ msgstr ""
"X-Generator: Poedit 1.8.7.1\n"
"X-Poedit-SourceCharset: UTF-8\n"
#: strpas2jsdesign.pjscreateajavascriptmoduleinsteadofascript
msgid "Create a javascript module instead of a script"
msgstr ""
#: strpas2jsdesign.pjsdatompackagetemplatedirectory
msgid "Atom package template directory"
msgstr ""
@ -194,10 +198,6 @@ msgstr ""
msgid "Project is a Web Browser (pas2js) project"
msgstr ""
#: strpas2jsdesign.pjsdprojectneedsahttpserver
msgid "Project needs a HTTP server"
msgstr ""
#: strpas2jsdesign.pjsdresetcompilecommand
msgid "Reset Compile command"
msgstr ""
@ -257,7 +257,7 @@ msgid "Use Browser Application object"
msgstr ""
#: strpas2jsdesign.pjsdusebrowserconsoleunittodisplaywritelnoutput
msgid "Use Browser Console unit to display writeln() output"
msgid "Use BrowserConsole unit to display writeln() output"
msgstr ""
#: strpas2jsdesign.pjsdusenodejsapplicationobject
@ -299,6 +299,14 @@ msgstr ""
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr ""
#: strpas2jsdesign.pjsexecuterunparameters
msgid "Execute Run Parameters"
msgstr ""
#: strpas2jsdesign.pjsmakepas2jsproject
msgid "Make pas2js project"
msgstr ""
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
msgid "Refresh all classes from HTML source"
msgstr ""

View File

@ -54,11 +54,6 @@ Const
// Custom settings in .lpi
PJSProject = 'Pas2JSProject'; // Project is pas2js project
PJSProjectWebBrowser = 'PasJSWebBrowserProject'; // Web browser project
PJSProjectServiceWorker = 'PJSProjectServiceWorker'; // Service Worker project
PJSProjectNodeJS = 'PJSProjectNodeJS'; // NodeJS project
PJSProjectModule = 'PJSProjectModule'; // Module project
PJSProjectVSCode = 'PJSProjectVSCode'; // VS Code project
PJSProjectAtom = 'PJSProjectAtom'; // Atom project
PJSProjectHTMLFile = 'PasJSHTMLFile';
PJSIsProjectHTMLFile = 'PasJSIsProjectHTMLFile';
PJSProjectMaintainHTML = 'MaintainHTML';

View File

@ -40,13 +40,13 @@ type
TBrowserApplicationOption = (baoCreateHtml, // Create template HTML page
baoMaintainHTML, // Maintain the template HTML page
baoRunOnReady, // Run in document.onReady
baoUseBrowserApp, // Use browser app object
baoUseBrowserConsole, // use browserconsole unit to display Writeln()
baoStartServer, // Start simple server
baoUseURL, // Use this URL to run/show project in browser
baoShowException, // let RTL show uncaught exceptions
baoUseBrowserApp, // Use browser app object
baoUseWASI, // Use WASI browser app object
baoUseModule // include as module as opposed to regular script
baoUseBrowserConsole, // use browserconsole unit to display Writeln()
baoUseModule, // include as module as opposed to regular script
baoStartServer, // Start simple server
baoUseURL // Use this URL to run/show project in browser
);
TBrowserApplicationOptions = set of TBrowserApplicationOption;
@ -677,8 +677,6 @@ begin
AProject.MainFileID:=-1;
AProject.RemoveUnit(0,false);
AProject.CustomData.Remove(PJSProjectServiceWorker);
// initialize PWA project
AProject.ProjectInfoFile:=ChangeFileExt(MainSrcFileName,'.lpi');
// create PWA lpr and index.html
@ -795,7 +793,6 @@ begin
SetDefaultServiceWorkerRunParams(AProject.RunParameters.GetOrCreate('Default'));
AProject.MainFile.SetSourceText(CreateProjectSource,true);
AProject.CustomData.Values[PJSProject]:='1';
AProject.CustomData.Values[PJSProjectServiceWorker]:='1';
Result:=mrOk;
end;
@ -1312,7 +1309,6 @@ begin
AProject.AddFile(MainFile,false);
AProject.MainFileID:=0;
AProject.CustomData.Values[PJSProject]:='1';
AProject.CustomData.Values[PJSProjectNodeJS]:='1';
CompOpts:=AProject.LazBuildModes.BuildModes[0].LazCompilerOptions;
SetDefaultNodeJSCompileOptions(CompOpts);
CompOpts.TargetFilename:=ExtractFileNameOnly(MainFile.Filename);
@ -1389,44 +1385,51 @@ begin
try
CreateHTML:=CO(baoCreateHtml);
MaintainHTML:=CO(baoCreateHtml) and Co(baoMaintainHTML);
UseBrowserApp:=CO(baoUseBrowserApp);
UseBrowserConsole:=CO(baoUseBrowserConsole);
StartHTTPServer:=CO(baoStartServer);
UseRunOnReady:=CO(baoRunOnReady);
UseWASI:=CO(baoUseWASI);
UseModule:=CO(baoUseModule);
ShowUncaughtExceptions:=CO(baoShowException);
UseBrowserConsole:=CO(baoUseBrowserConsole);
UseBrowserApp:=CO(baoUseBrowserApp);
UseWASI:=CO(baoUseWASI);
WasmProgramURL:='';
UseModule:=CO(baoUseModule);
if CO(baoStartServer) then
RunServerAtPort:=true
else if CO(baoUseURL) then
RunBrowserWithURL:=true
else
RunDefault:=true;
// We allocate the new port in all cases.
ServerPort:=GetNextPort;
URL:='';
WasmProgramURL:='';
if Not CO(baoStartServer) then
UseURL:=CO(baoUseURL);
Result:=ShowModalOptions(Frm);
if Result=mrOK then
begin
SO(CreateHTML,baoCreateHtml);
SO(MaintainHTML,baoCreateHtml);
SO(UseBrowserApp,baoUseBrowserApp);
SO(UseBrowserConsole,baoUseBrowserConsole);
SO(StartHTTPServer,baoStartServer);
SO(UseRunOnReady,baoRunOnReady);
SO(UseBrowserConsole,baoUseBrowserConsole);
SO(ShowUncaughtExceptions,baoShowException);
SO(UseBrowserApp,baoUseBrowserApp);
SO(UseWASI,baoUseWASI);
SO(UseModule,baoUseModule);
Self.ProjectPort:=ServerPort;
SO(UseURL,baoUseURL);
if baoStartServer in FOptions then
begin
DebugLN(['Info: Start server port: ', Self.ProjectPort,' from: ',ServerPort]);
end
else
begin
if baoUseURL in Options then
FProjectURL:=URL;
end;
end;
FProjectWasmURL:=WasmProgramURL;
SO(UseModule,baoUseModule);
Self.ProjectPort:=ServerPort;
SO(RunServerAtPort,baoStartServer);
SO(RunBrowserWithURL,baoUseURL);
if baoStartServer in FOptions then
DebugLN(['Info: Start server port: ', Self.ProjectPort,' from: ',ServerPort])
else if baoUseURL in FOptions then
FProjectURL:=URL;
end;
finally
Free;
end;
@ -1566,12 +1569,12 @@ Var
begin
Units:='';
if baoUseBrowserConsole in Options then
Units:=' browserconsole,';
Units:=' BrowserConsole,';
if baoUseBrowserApp in Options then
begin
Units:=Units+' browserapp,' ;
Units:=Units+' BrowserApp,' ;
if baoUseWASI in options then
Units:=Units+' wasihostapp,' ;
Units:=Units+' WASIHostApp,' ;
end;
Units:=Units+' JS, Classes, SysUtils, Web';
Src:=TStringList.Create;
@ -1782,7 +1785,6 @@ begin
AProject.AddFile(MainFile,false);
AProject.MainFileID:=0;
AProject.CustomData.Values[PJSProject]:='1';
AProject.CustomData.Values[PJSProjectModule]:='1';
CompOpts:=AProject.LazBuildModes.BuildModes[0].LazCompilerOptions;
SetDefaultModuleCompileOptions(CompOpts);
CompOpts.TargetFilename:='js/project1';

View File

@ -1,18 +1,22 @@
object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
Left = 0
Height = 372
Height = 423
Top = 0
Width = 492
ClientHeight = 372
ClientWidth = 492
Width = 750
ClientHeight = 423
ClientWidth = 750
TabOrder = 0
DesignLeft = 473
DesignTop = 400
DesignLeft = 1404
DesignTop = 244
object CBWebProject: TCheckBox
Left = 12
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 6
Height = 23
Top = 8
Top = 6
Width = 250
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'Project is a Web Browser (pas2js) project'
OnChange = CBWebProjectChange
TabOrder = 0
@ -21,9 +25,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
AnchorSideLeft.Control = CBWebProject
AnchorSideTop.Control = CBWebProject
AnchorSideTop.Side = asrBottom
Left = 12
Left = 6
Height = 15
Top = 37
Top = 35
Width = 98
BorderSpacing.Top = 6
Caption = 'Project HTML file:'
@ -35,10 +39,10 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 12
Left = 6
Height = 30
Top = 54
Width = 464
Top = 52
Width = 728
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
BorderSpacing.Right = 16
@ -50,9 +54,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
AnchorSideLeft.Control = CBWebProject
AnchorSideTop.Control = CBHTMLFile
AnchorSideTop.Side = asrBottom
Left = 12
Left = 6
Height = 23
Top = 90
Top = 88
Width = 129
BorderSpacing.Top = 6
Caption = 'Maintain HTML File'
@ -63,123 +67,50 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
AnchorSideLeft.Control = CBUseBrowserConsole
AnchorSideTop.Control = CBUseBrowserConsole
AnchorSideTop.Side = asrBottom
Left = 36
Left = 30
Height = 23
Top = 148
Top = 146
Width = 287
BorderSpacing.Top = 6
Caption = 'Run rtl when all page resources are fully loaded'
TabOrder = 3
end
object SEPort: TSpinEdit
AnchorSideLeft.Control = RBStartServerAt
AnchorSideTop.Control = RBStartServerAt
AnchorSideTop.Side = asrBottom
Left = 76
Height = 30
Top = 231
Width = 82
BorderSpacing.Left = 32
BorderSpacing.Top = 2
MaxValue = 65354
MinValue = 1024
TabOrder = 4
Value = 3000
end
object RBStartServerAt: TRadioButton
AnchorSideLeft.Control = CBUseHTTPServer
AnchorSideTop.Control = CBUseHTTPServer
AnchorSideTop.Side = asrBottom
Left = 44
Height = 23
Top = 206
Width = 168
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Start HTTP Server on port'
Checked = True
OnChange = RBStartServerAtChange
TabOrder = 5
TabStop = True
end
object CBServerURL: TComboBox
AnchorSideLeft.Control = SEPort
AnchorSideTop.Control = RBUseURL
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 76
Height = 30
Top = 288
Width = 400
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
BorderSpacing.Right = 16
ItemHeight = 0
TabOrder = 6
end
object RBUseURL: TRadioButton
AnchorSideLeft.Control = RBStartServerAt
AnchorSideTop.Control = SEPort
AnchorSideTop.Side = asrBottom
Left = 44
Height = 23
Top = 263
Width = 161
BorderSpacing.Top = 2
Caption = 'Use this URL to start app'
OnChange = RBUseURLChange
TabOrder = 7
end
object CBUseHTTPServer: TCheckBox
AnchorSideLeft.Control = CBMaintainHTMLFile
AnchorSideTop.Control = CBRunOnReady
AnchorSideTop.Side = asrBottom
Left = 12
Height = 23
Top = 177
Width = 182
BorderSpacing.Top = 6
Caption = 'Project needs a HTTP Server'
OnChange = CBUseHTTPServerChange
TabOrder = 8
end
object CBUseBrowserConsole: TCheckBox
AnchorSideLeft.Control = CBMaintainHTMLFile
AnchorSideTop.Control = CBMaintainHTMLFile
AnchorSideTop.Side = asrBottom
Left = 36
Left = 30
Height = 23
Top = 119
Top = 117
Width = 313
BorderSpacing.Left = 24
BorderSpacing.Top = 6
Caption = 'Use Browser Console unit to display writeln() output'
TabOrder = 9
TabOrder = 4
end
object BResetRunCommand: TButton
AnchorSideLeft.Control = CBWebProject
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 12
Left = 6
Height = 31
Top = 335
Top = 386
Width = 130
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Bottom = 6
Caption = 'Reset Run Command'
OnClick = BResetRunCommandClick
TabOrder = 10
TabOrder = 5
end
object BResetCompileCommand: TButton
AnchorSideLeft.Control = BResetRunCommand
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 148
Left = 142
Height = 31
Top = 335
Top = 386
Width = 150
Anchors = [akLeft, akBottom]
AutoSize = True
@ -187,16 +118,16 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
BorderSpacing.Bottom = 6
Caption = 'Reset compile Command'
OnClick = BResetCompileCommandClick
TabOrder = 11
TabOrder = 6
end
object BMakePas2jsPoject: TButton
AnchorSideLeft.Control = BResetCompileCommand
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 304
Left = 298
Height = 31
Top = 335
Top = 386
Width = 124
Anchors = [akLeft, akBottom]
AutoSize = True
@ -204,6 +135,97 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
BorderSpacing.Bottom = 6
Caption = 'Make pas2js project'
OnClick = BMakePas2jsPojectClick
TabOrder = 12
TabOrder = 7
end
object RunGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CBRunOnReady
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 161
Top = 175
Width = 738
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Run'
ClientHeight = 145
ClientWidth = 736
TabOrder = 8
object RBStartServerAt: TRadioButton
AnchorSideLeft.Control = RunGroupBox
AnchorSideTop.Control = RunGroupBox
Left = 6
Height = 23
Top = 2
Width = 168
BorderSpacing.Left = 6
BorderSpacing.Top = 2
Caption = 'Start HTTP Server on port'
Checked = True
OnChange = RBStartServerAtChange
TabOrder = 0
TabStop = True
end
object SEPort: TSpinEdit
AnchorSideLeft.Control = RBStartServerAt
AnchorSideTop.Control = RBStartServerAt
AnchorSideTop.Side = asrBottom
Left = 38
Height = 30
Top = 27
Width = 82
BorderSpacing.Left = 32
BorderSpacing.Top = 2
MaxValue = 65354
MinValue = 1024
TabOrder = 1
Value = 3000
end
object RBUseURL: TRadioButton
AnchorSideLeft.Control = RBStartServerAt
AnchorSideTop.Control = SEPort
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 59
Width = 161
BorderSpacing.Top = 2
Caption = 'Use this URL to start app'
OnChange = RBUseURLChange
TabOrder = 2
end
object CBServerURL: TComboBox
AnchorSideLeft.Control = SEPort
AnchorSideTop.Control = RBUseURL
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = RunGroupBox
AnchorSideRight.Side = asrBottom
Left = 38
Height = 30
Top = 84
Width = 692
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
ItemHeight = 0
TabOrder = 3
end
object RBRunDefault: TRadioButton
AnchorSideTop.Control = CBServerURL
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 116
Width = 162
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Bottom = 6
Caption = 'Execute Run Parameters'
OnChange = RBStartServerAtChange
TabOrder = 4
end
end
end

View File

@ -5,13 +5,15 @@ unit PJSProjectOptions;
interface
uses
Classes, SysUtils,
Classes, SysUtils, Math,
// LCL
StdCtrls, Spin,
// LazUtils
LazLoggerBase, LazFileUtils, LazUTF8,
// IdeIntf
LazIDEIntf, ProjectIntf, CompOptsIntf, IDEOptionsIntf, IDEOptEditorIntf;
LazIDEIntf, ProjectIntf, CompOptsIntf, IDEOptionsIntf, IDEOptEditorIntf,
// pas2js
PJSDsgnOptions, PJSController, StrPas2JSDesign;
type
@ -24,29 +26,27 @@ type
CBRunOnReady: TCheckBox;
CBServerURL: TComboBox;
CBUseBrowserConsole: TCheckBox;
CBUseHTTPServer: TCheckBox;
CBWebProject: TCheckBox;
CBHTMLFile: TComboBox;
CBMaintainHTMLFile: TCheckBox;
LCBProjectHTMLFile: TLabel;
RBRunDefault: TRadioButton;
RBStartServerAt: TRadioButton;
RBUseURL: TRadioButton;
RunGroupBox: TGroupBox;
SEPort: TSpinEdit;
procedure BMakePas2jsPojectClick(Sender: TObject);
procedure BResetCompileCommandClick(Sender: TObject);
procedure BResetRunCommandClick(Sender: TObject);
procedure CBMaintainHTMLFileChange(Sender: TObject);
procedure CBUseHTTPServerChange(Sender: TObject);
procedure CBWebProjectChange(Sender: TObject);
procedure RBStartServerAtChange(Sender: TObject);
procedure RBUseURLChange(Sender: TObject);
private
procedure CheckAllControls(aEnabled: Boolean);
procedure CheckHTMLOptions(aEnabled: Boolean);
procedure CheckServerOptions(aEnabled: Boolean);
procedure UpdateHTMLControls;
function FillFilesCombo(PRJ: TLazProject): Integer;
procedure ToggleCB(CB: TCheckBox; aEnabled: Boolean);
procedure UpdateRunControls;
public
function GetTitle: string; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
@ -66,7 +66,7 @@ Procedure SetDefaultModuleCompileOptions(CompOpts: TLazCompilerOptions);
implementation
uses pjsdsgnoptions, pjscontroller, strpas2jsdesign;
{$R *.lfm}
Procedure ResetRunParams(RunParams : TAbstractRunParamsOptionsMode);
@ -156,9 +156,6 @@ begin
SetPasJSCompileOptions(CompOpts,'module','-Jeutf-8 -Jirtl.js -Jc -Jminclude');
end;
{$R *.lfm}
{ TPas2JSProjectOptionsFrame }
function TPas2JSProjectOptionsFrame.GetTitle: string;
@ -173,11 +170,14 @@ begin
CBMaintainHTMLFile.Caption:=pjsdMaintainHTMLPage;
CBUseBrowserConsole.Caption:=pjsdUseBrowserConsoleUnitToDisplayWritelnOutput;
CBRunOnReady.Caption:=pjsdRunRTLWhenAllPageResourcesAreFullyLoaded;
CBUseHTTPServer.Caption:=pjsdProjectNeedsAHTTPServer;
RBStartServerAt.Caption:=pjsdStartHTTPServerOnPort;
RBUseURL.Caption:=pjsdUseThisURLToStartApplication;
RBRunDefault.Caption:=pjsExecuteRunParameters;
BResetRunCommand.Caption:=pjsdResetRunCommand;
BResetCompileCommand.Caption:=pjsdResetCompileCommand;
BMakePas2jsPoject.Caption:=pjsMakePas2jsProject;
end;
procedure TPas2JSProjectOptionsFrame.CBWebProjectChange(Sender: TObject);
@ -187,17 +187,17 @@ end;
procedure TPas2JSProjectOptionsFrame.RBStartServerAtChange(Sender: TObject);
begin
SEPort.Enabled:=RBStartServerAt.Enabled and RBStartServerAt.Checked;;
UpdateRunControls;
end;
procedure TPas2JSProjectOptionsFrame.RBUseURLChange(Sender: TObject);
begin
CBServerURL.Enabled:=RBUseURL.Enabled and RBUseURL.Checked;
UpdateRunControls;
end;
procedure TPas2JSProjectOptionsFrame.CBMaintainHTMLFileChange(Sender: TObject);
begin
CheckHTMLOptions(CBMaintainHTMLFile.Checked);
UpdateHTMLControls;
end;
procedure TPas2JSProjectOptionsFrame.BResetRunCommandClick(Sender: TObject);
@ -230,54 +230,34 @@ begin
PRJ.CustomData.Values[PJSProject]:='1';
end;
procedure TPas2JSProjectOptionsFrame.CBUseHTTPServerChange(Sender: TObject);
procedure TPas2JSProjectOptionsFrame.UpdateHTMLControls;
begin
CheckServerOptions(CBUseHTTPServer.Checked);
end;
procedure TPas2JSProjectOptionsFrame.ToggleCB(CB : TCheckBox; aEnabled: Boolean);
begin
With CB do
begin
Enabled:=aEnabled;
if not AEnabled then
Checked:=False;
end;
end;
procedure TPas2JSProjectOptionsFrame.CheckHTMLOptions(aEnabled : Boolean);
begin
ToggleCB(CBUseBrowserConsole,aEnabled);
ToggleCB(CBRunOnReady,aEnabled);
end;
procedure TPas2JSProjectOptionsFrame.CheckServerOptions(aEnabled : Boolean);
begin
RBStartServerAt.Enabled:=aEnabled;
RBUseURL.Enabled:=aEnabled;
SEPort.Enabled:=aEnabled and RBStartServerAt.Checked;
CBServerURL.Enabled:=aEnabled and RBUseURL.Checked;
CBUseBrowserConsole.Enabled:=CBWebProject.Enabled and CBMaintainHTMLFile.Enabled;
CBRunOnReady.Enabled:=CBUseBrowserConsole.Enabled;
end;
procedure TPas2JSProjectOptionsFrame.CheckAllControls(aEnabled : Boolean);
begin
CBHTMLFile.Enabled:=aEnabled;
CBMaintainHTMLFile.Enabled:=aEnabled;
CBUseBrowserConsole.Enabled:=aEnabled;
CBRunOnReady.Enabled:=aEnabled;
RBStartServerAt.Enabled:=aEnabled;
SEPort.Enabled:=aEnabled and RBStartServerAt.Checked;
RBUseURL.Enabled:=aEnabled;
CBServerURL.Enabled:=aEnabled and RBUseURL.Checked;
RBRunDefault.Enabled:=aEnabled;
BResetRunCommand.enabled:=aEnabled;
BResetCompileCommand.Enabled:=aEnabled;
CBHTMLFile.Enabled:=aEnabled;
ToggleCB(CBMaintainHTMLFile,aEnabled);
CheckHTMLOptions(CBMaintainHTMLFile.Checked);
ToggleCB(CBUseHTTPServer,aEnabled);
CheckServerOptions(CBUseHTTPServer.Checked)
end;
// Fill combo with HTM(L) files.
// Return index of file that has IsProjectHTMLFile set.
Function TPas2JSProjectOptionsFrame.FillFilesCombo(PRJ : TLazProject) : Integer;
function TPas2JSProjectOptionsFrame.FillFilesCombo(PRJ: TLazProject): Integer;
Var
I : integer;
@ -299,8 +279,8 @@ begin
HPF:=PF;
end;
end;
L.Sort;
CBHTMLFile.Items:=L;
L.Sort;
CBHTMLFile.Items:=L;
finally
L.Free;
end;
@ -308,6 +288,12 @@ begin
Result:=CBHTMLFile.Items.IndexOfObject(HPF);
end;
procedure TPas2JSProjectOptionsFrame.UpdateRunControls;
begin
SEPort.Enabled:=CBWebProject.Enabled and RBStartServerAt.Enabled and RBStartServerAt.Checked;
CBServerURL.Enabled:=CBWebProject.Enabled and RBUseURL.Enabled and RBUseURL.Checked;
end;
procedure TPas2JSProjectOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
Var
@ -319,48 +305,56 @@ Var
begin
if AOptions=nil then ;
PRJ:=LazarusIDE.ActiveProject;
HTMLIdx:=FillFilesCombo(PRJ);
CBWebProject.Checked:=PRJ.CustomData[PJSProjectWebBrowser]='1';
Prj:=LazarusIDE.ActiveProject;
HTMLIdx:=FillFilesCombo(Prj);
CBWebProject.Checked:=Prj.CustomData[PJSProjectWebBrowser]='1';
if HTMLIdx=-1 then
begin
HFN:=PRJ.CustomData[PJSProjectHTMLFile];
HFN:=Prj.CustomData[PJSProjectHTMLFile];
HTMLIdx:=CBHTMLFile.Items.IndexOf(HFN);
end;
CBHTMLFile.ItemIndex:=HTMLIdx;
CBMaintainHTMLFile.Checked:=PRJ.CustomData[PJSProjectMaintainHTML]='1';
CBUseBrowserConsole.Checked:=PRJ.CustomData[PJSProjectWebBrowser]='1';
CBRunOnReady.Checked:=PRJ.CustomData[PJSProjectRunAtReady]='1';
Port:=StrToIntDef(PRJ.CustomData[PJSProjectPort],0);
URL:=PRJ.CustomData[PJSProjectURL];
CBUseHTTPServer.Checked:=(Port>0) or (URL<>'');
SEPort.Value:=Port;
CBMaintainHTMLFile.Checked:=Prj.CustomData[PJSProjectMaintainHTML]='1';
CBUseBrowserConsole.Checked:=Prj.CustomData[PJSProjectUseBrowserConsole]='1';
CBRunOnReady.Checked:=Prj.CustomData[PJSProjectRunAtReady]='1';
Port:=StrToIntDef(Prj.CustomData[PJSProjectPort],0);
URL:=Prj.CustomData[PJSProjectURL];
SEPort.Value:=Min(Max(0,Port),65535);
CBServerURL.AddHistoryItem(URL,10,True,False);
if Prj.CustomData.Contains(PJSProjectPort) then
RBStartServerAt.Checked:=true
else if Prj.CustomData.Contains(PJSProjectURL) then
RBUseURL.Checked:=true
else
RBRunDefault.Checked:=true;
UpdateHTMLControls;
UpdateRunControls;
end;
procedure TPas2JSProjectOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
Var
Prj : TLazProject;
Procedure DoBool(N : String; AValue : Boolean);
begin
if AValue then
PRJ.CustomData[N]:='1';
Prj.CustomData[N]:='1';
end;
begin
if AOptions=nil then ;
PRJ:=LazarusIDE.ActiveProject;
Prj:=LazarusIDE.ActiveProject;
// Clear everything
With PRJ.CustomData do
With Prj.CustomData do
begin
Remove(PJSProject);
Remove(PJSProjectHTMLFile);
Remove(PJSProjectNodeJS);
Remove(PJSProjectMaintainHTML);
Remove(PJSProjectWebBrowser);
Remove(PJSProjectHTMLFile);
Remove(PJSProjectMaintainHTML);
Remove(PJSProjectUseBrowserConsole);
Remove(PJSProjectRunAtReady);
Remove(PJSProjectPort);
Remove(PJSProjectURL);
@ -368,21 +362,22 @@ begin
// Set what is needed
if CBWebProject.Checked then
begin
PRJ.CustomData[PJSProject]:='1';
PRJ.CustomData[PJSProjectWebBrowser]:='1';
Prj.CustomData[PJSProject]:='1';
Prj.CustomData[PJSProjectWebBrowser]:='1';
With CBHTMLFile do
if ItemIndex<>-1 then
(Items.Objects[ItemIndex] as TLazProjectFile).CustomData[PJSIsProjectHTMLFile]:='1';
DoBool(PJSProjectMaintainHTML,CBMaintainHTMLFile.Checked);
DoBool(PJSProjectWebBrowser,CBUseBrowserConsole.Checked);
DoBool(PJSProjectUseBrowserConsole,CBUseBrowserConsole.Checked);
DoBool(PJSProjectRunAtReady,CBRunOnReady.Checked);
if CBUseHTTPServer.Checked then
begin
if RBStartServerAt.Checked and (SEPort.Value>0) then
PRJ.CustomData[PJSProjectPort]:=IntToStr(SEPort.Value);
if RBUseURL.Checked and (CBServerURL.Text<>'') then
PRJ.CustomData[PJSProjectURL]:=CBServerURL.Text;
end;
if RBStartServerAt.Checked and (SEPort.Value>=0) then
Prj.CustomData[PJSProjectPort]:=IntToStr(SEPort.Value)
else if RBUseURL.Checked and (CBServerURL.Text<>'') then
Prj.CustomData[PJSProjectURL]:=CBServerURL.Text;
end;
end;

View File

@ -481,7 +481,6 @@ begin
AProject.Title:=FPackageName;
AProject.ProjectInfoFile:=FPackageDir+StripNonIdentifierChars(FPackageName)+'.lpi';
AProject.CustomData.Values[PJSProject]:='1';
AProject.CustomData.Values[PJSProjectAtom]:='1';
CreateProjectDirs;
CompOpts:=AProject.LazCompilerOptions;
SetDefaultNodeJSCompileOptions(CompOpts);

View File

@ -452,7 +452,6 @@ begin
AProject.Title:=FPackageName;
AProject.ProjectInfoFile:=FPackageDir+StripNonIdentifierChars(FPackageName)+'.lpi';
AProject.CustomData.Values[PJSProject]:='1';
AProject.CustomData.Values[PJSProjectVSCode]:='1';
CreateProjectDirs;
CompOpts:=AProject.LazCompilerOptions;
SetDefaultNodeJSCompileOptions(CompOpts);

View File

@ -56,15 +56,18 @@ Resourcestring
+'project';
pjsdProjectHTMLPage = 'Project HTML page:';
pjsdMaintainHTMLPage = 'Maintain HTML page';
pjsdUseBrowserConsoleUnitToDisplayWritelnOutput = 'Use Browser Console unit '
pjsdUseBrowserConsoleUnitToDisplayWritelnOutput = 'Use BrowserConsole unit '
+'to display writeln() output';
pjsdRunRTLWhenAllPageResourcesAreFullyLoaded = 'Run RTL when all page '
+'resources are fully loaded';
pjsdProjectNeedsAHTTPServer = 'Project needs a HTTP server';
pjsdStartHTTPServerOnPort = 'Start HTTP Server on port';
pjsCreateAJavascriptModuleInsteadOfAScript = 'Create a javascript module '
+'instead of a script';
pjsdUseThisURLToStartApplication = 'Use this URL to start application';
pjsExecuteRunParameters = 'Execute Run Parameters';
pjsdResetRunCommand = 'Reset Run command';
pjsdResetCompileCommand = 'Reset Compile command';
pjsMakePas2jsProject = 'Make pas2js project';
// New browser project options form
pjsdPas2JSBrowserProjectOptions = 'Pas2JS Browser project options';