From bdb7bec11819f1b27262b0a1749624bf364c191c Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 23 Apr 2022 14:46:51 +0200 Subject: [PATCH] pas2js: added location on simple webserver --- .../pas2js/frmpas2jsbrowserprojectoptions.lfm | 77 +- .../pas2js/frmpas2jsbrowserprojectoptions.pp | 78 +- .../pas2js/languages/strpas2jsdesign.fr.po | 12 + .../pas2js/languages/strpas2jsdesign.hu.po | 12 + .../pas2js/languages/strpas2jsdesign.pot | 12 + .../pas2js/languages/strpas2jsdesign.pt_BR.po | 12 + .../pas2js/languages/strpas2jsdesign.ru.po | 12 + .../pas2js/languages/strpas2jsdesign.tr.po | 12 + .../pas2js/languages/strpas2jsdesign.uk.po | 12 + .../pas2js/languages/strpas2jsdesign.zh_CN.po | 12 + components/pas2js/pjscontroller.pp | 1 + components/pas2js/pjsdsgnregister.pas | 999 +++++++++--------- components/pas2js/pjsprojectoptions.lfm | 77 +- components/pas2js/pjsprojectoptions.pp | 26 +- components/pas2js/strpas2jsdesign.pp | 6 + 15 files changed, 802 insertions(+), 558 deletions(-) diff --git a/components/pas2js/frmpas2jsbrowserprojectoptions.lfm b/components/pas2js/frmpas2jsbrowserprojectoptions.lfm index 0362278624..0e1d91503f 100644 --- a/components/pas2js/frmpas2jsbrowserprojectoptions.lfm +++ b/components/pas2js/frmpas2jsbrowserprojectoptions.lfm @@ -1,7 +1,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm - Left = 1434 + Left = 381 Height = 490 - Top = 765 + Top = 232 Width = 632 Caption = 'Pas2JS Browser project options' ClientHeight = 490 @@ -39,7 +39,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm end object CBUseBrowserConsole: TCheckBox AnchorSideLeft.Control = CBCreateHTML - AnchorSideTop.Control = cbShowUncaughtExceptions + AnchorSideTop.Control = CBShowUncaughtExceptions AnchorSideTop.Side = asrBottom Left = 38 Height = 23 @@ -92,7 +92,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm Caption = 'Run rtl when all page resources are fully loaded' TabOrder = 5 end - object cbShowUncaughtExceptions: TCheckBox + object CBShowUncaughtExceptions: TCheckBox AnchorSideLeft.Control = CBCreateHTML AnchorSideTop.Control = CBRunOnReady AnchorSideTop.Side = asrBottom @@ -157,38 +157,38 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 6 - Height = 123 + Height = 159 Top = 274 Width = 620 Anchors = [akTop, akLeft, akRight] AutoSize = True BorderSpacing.Around = 6 Caption = 'Run' - ClientHeight = 107 + ClientHeight = 143 ClientWidth = 618 TabOrder = 10 object RBRunServerAt: TRadioButton AnchorSideLeft.Control = RunGroupBox - AnchorSideTop.Control = SEPort + AnchorSideTop.Control = SERunPort AnchorSideTop.Side = asrCenter Left = 6 Height = 23 - Top = 10 + Top = 46 Width = 168 BorderSpacing.Left = 6 + BorderSpacing.Top = 6 Caption = 'Start HTTP Server on port' - Checked = True OnChange = RBRunServerAtChange TabOrder = 4 - TabStop = True end - object SEPort: TSpinEdit + object SERunPort: TSpinEdit AnchorSideLeft.Control = RBRunServerAt AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = RunGroupBox + AnchorSideTop.Control = CBRunLocationOnSWS + AnchorSideTop.Side = asrBottom Left = 180 Height = 30 - Top = 6 + Top = 42 Width = 76 BorderSpacing.Left = 6 BorderSpacing.Top = 6 @@ -199,26 +199,26 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm end object RBRunBrowserWithURL: TRadioButton AnchorSideLeft.Control = RBRunServerAt - AnchorSideTop.Control = CBServerURL + AnchorSideTop.Control = CBRunServerURL AnchorSideTop.Side = asrCenter Left = 6 Height = 23 - Top = 46 + Top = 82 Width = 138 Caption = 'Use URL to start app' OnChange = RBRunBrowserWithURLChange TabOrder = 1 end - object CBServerURL: TComboBox + object CBRunServerURL: TComboBox AnchorSideLeft.Control = RBRunBrowserWithURL AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = SEPort + AnchorSideTop.Control = SERunPort AnchorSideTop.Side = asrBottom AnchorSideRight.Control = RunGroupBox AnchorSideRight.Side = asrBottom Left = 150 Height = 30 - Top = 42 + Top = 78 Width = 462 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 6 @@ -229,11 +229,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm TabOrder = 2 end object RBRunDefault: TRadioButton - AnchorSideTop.Control = CBServerURL + AnchorSideTop.Control = CBRunServerURL AnchorSideTop.Side = asrBottom Left = 6 Height = 23 - Top = 78 + Top = 114 Width = 162 BorderSpacing.Left = 6 BorderSpacing.Top = 6 @@ -242,5 +242,42 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm OnChange = RBRunDefaultChange TabOrder = 3 end + object RBRunLocationOnSWS: TRadioButton + AnchorSideLeft.Control = RunGroupBox + AnchorSideTop.Control = CBRunLocationOnSWS + AnchorSideTop.Side = asrCenter + Left = 6 + Height = 23 + Top = 10 + Width = 196 + BorderSpacing.Left = 6 + Caption = 'Location on Simple Web Server' + Checked = True + OnChange = RBRunLocationOnSWSChange + TabOrder = 6 + TabStop = True + end + object CBRunLocationOnSWS: TComboBox + AnchorSideLeft.Control = RBRunLocationOnSWS + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = RunGroupBox + AnchorSideRight.Control = RunGroupBox + AnchorSideRight.Side = asrBottom + Left = 208 + Height = 30 + Top = 6 + Width = 404 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 + BorderSpacing.Right = 6 + ItemHeight = 0 + ItemIndex = 0 + Items.Strings = ( + '$NameOnly($(ProjFile))' + ) + TabOrder = 5 + Text = '$NameOnly($(ProjFile))' + end end end diff --git a/components/pas2js/frmpas2jsbrowserprojectoptions.pp b/components/pas2js/frmpas2jsbrowserprojectoptions.pp index 69be85f3c2..f0a8404e55 100644 --- a/components/pas2js/frmpas2jsbrowserprojectoptions.pp +++ b/components/pas2js/frmpas2jsbrowserprojectoptions.pp @@ -17,9 +17,10 @@ const WBBoolUseWASI = 5; WBBoolUseBrowserConsole = 6; WBBoolUseModule = 7; - WBBoolRunServerAtPort = 8; - WBBoolRunBrowserWithURL = 9; - WBBoolRunDefault = 10; + WBBoolRunLocation = 8; + WBBoolRunServerAtPort = 9; + WBBoolRunBrowserWithURL = 10; + WBBoolRunDefault = 11; type { TWebBrowserProjectOptionsForm } @@ -27,33 +28,38 @@ type TWebBrowserProjectOptionsForm = class(TForm) BPHelpOptions: TButtonPanel; CBCreateHTML: TCheckBox; - CBServerURL: TComboBox; + CBMaintainPage: TCheckBox; + CBRunLocationOnSWS: TComboBox; + CBRunOnReady: TCheckBox; + CBRunServerURL: TComboBox; + CBShowUncaughtExceptions: TCheckBox; CBUseBrowserApp: TCheckBox; + CBUseBrowserConsole: TCheckBox; CBUseModule: TCheckBox; CBUseWASI: TCheckBox; - CBUseBrowserConsole: TCheckBox; - CBMaintainPage: TCheckBox; - CBRunOnReady: TCheckBox; - cbShowUncaughtExceptions: TCheckBox; edtWasmProgram: TEdit; + RBRunLocationOnSWS: TRadioButton; + RBRunBrowserWithURL: TRadioButton; RBRunDefault: TRadioButton; RBRunServerAt: TRadioButton; - RBRunBrowserWithURL: TRadioButton; RunGroupBox: TGroupBox; - SEPort: TSpinEdit; + SERunPort: TSpinEdit; procedure CBCreateHTMLChange(Sender: TObject); procedure CBUseBrowserAppChange(Sender: TObject); procedure CBUseHTTPServerChange(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure RBRunLocationOnSWSChange(Sender: TObject); procedure RBRunDefaultChange(Sender: TObject); procedure RBRunServerAtChange(Sender: TObject); procedure RBRunBrowserWithURLChange(Sender: TObject); private function GetB(AIndex: Integer): Boolean; + function GetLocation: string; function GetServerPort: Word; function GetURL: String; function GetWasmProgramURL: String; procedure SetB(AIndex: Integer; AValue: Boolean); + procedure SetLocation(const AValue: string); procedure SetServerPort(AValue: Word); procedure SetURL(AValue: String); procedure SetWasmProgramURL(AValue: String); @@ -66,6 +72,7 @@ type procedure HideRunOnReady; virtual; procedure HideUseBrowserApp; virtual; procedure HideRunHTTPServer; virtual; + procedure HideRunLocation; virtual; property CreateHTML : Boolean Index WBBoolCreateHTML read GetB Write SetB; property MaintainHTML : Boolean Index WBBoolMainHTML read GetB Write SetB; @@ -79,6 +86,8 @@ type property UseBrowserConsole : Boolean Index WBBoolUseBrowserConsole read GetB Write SetB; property UseModule : Boolean Index WBBoolUseModule read GetB Write SetB; + property RunLocation : Boolean Index WBBoolRunLocation read GetB Write SetB; + property Location : string Read GetLocation Write SetLocation; 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; @@ -135,7 +144,7 @@ begin CBCreateHTML.Caption:=pjsdCreateInitialHTMLPage; CBMaintainPage.Caption:=pjsdMaintainHTMLPage; CBRunOnReady.Caption:=pjsdRunRTLWhenAllPageResourcesAreFullyLoaded; - cbShowUncaughtExceptions.Caption:=pjsdLetRTLShowUncaughtExceptions; + CBShowUncaughtExceptions.Caption:=pjsdLetRTLShowUncaughtExceptions; CBUseBrowserApp.Caption:=pjsdUseBrowserApplicationObject; CBUseWASI.Caption:=pjsdUseWASIApplicationObject; @@ -145,13 +154,22 @@ begin CBUseModule.Caption:=pjsCreateAJavascriptModuleInsteadOfAScript; RunGroupBox.Caption:=pjsdRun; + RBRunLocationOnSWS.Caption:=pjsdLocationOnSimpleWebServer; + RBRunLocationOnSWS.Hint:=pjsdTheSimpleWebServerIsAutomaticallyStartedOnRunTheLo; RBRunServerAt.Caption:=pjsdStartHTTPServerOnPort; RBRunBrowserWithURL.Caption:=pjsdUseThisURLToStartApplication; + RBRunBrowserWithURL.Hint:=pjsdUseThisWhenYouStartYourOwnHttpServer; RBRunDefault.Caption:=pjsExecuteRunParameters; CBCreateHTMLChange(self); end; +procedure TWebBrowserProjectOptionsForm.RBRunLocationOnSWSChange( + Sender: TObject); +begin + UpdateRunControls; +end; + procedure TWebBrowserProjectOptionsForm.RBRunDefaultChange(Sender: TObject); begin UpdateRunControls; @@ -173,11 +191,12 @@ begin WBBoolCreateHTML : Result:=CBCreateHTML.Checked; WBBoolMainHTML : Result:=CBMaintainPage.Checked; WBBoolRunOnReady : Result:=CBRunOnReady.Checked; - WBBoolShowUncaughtExceptions : Result:=cbShowUncaughtExceptions.Checked; + WBBoolShowUncaughtExceptions : Result:=CBShowUncaughtExceptions.Checked; WBBoolUseBrowserApp : Result:=CBUseBrowserApp.Checked; WBBoolUseWASI : Result:=cbUseWASI.Checked; WBBoolUseBrowserConsole : Result:=CBUseBrowserConsole.Checked; WBBoolUseModule : Result:=cbUseModule.Checked; + WBBoolRunLocation : Result:=RBRunLocationOnSWS.Checked; WBBoolRunServerAtPort : Result:=RBRunServerAt.Checked; WBBoolRunBrowserWithURL : Result:=RBRunBrowserWithURL.Checked; WBBoolRunDefault : Result:=RBRunDefault.Checked; @@ -186,14 +205,19 @@ begin end; end; +function TWebBrowserProjectOptionsForm.GetLocation: string; +begin + Result:=CBRunLocationOnSWS.Text; +end; + function TWebBrowserProjectOptionsForm.GetServerPort: Word; begin - Result:=SEPort.Value; + Result:=SERunPort.Value; end; function TWebBrowserProjectOptionsForm.GetURL: String; begin - Result:=CBServerURL.Text; + Result:=CBRunServerURL.Text; end; function TWebBrowserProjectOptionsForm.GetWasmProgramURL: String; @@ -207,25 +231,31 @@ begin WBBoolCreateHTML : begin CBCreateHTML.Checked:=AValue; UpdateHTMLControls; end; WBBoolMainHTML : CBMaintainPage.Checked:=AValue; WBBoolRunOnReady : CBRunOnReady.Checked:=AValue; - WBBoolShowUncaughtExceptions : cbShowUncaughtExceptions.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; + WBBoolRunLocation : begin RBRunLocationOnSWS.Checked:=AValue; UpdateRunControls; end; WBBoolRunServerAtPort : begin RBRunServerAt.Checked:=AValue; UpdateRunControls; end; WBBoolRunBrowserWithURL : begin RBRunBrowserWithURL.Checked:=AValue; UpdateRunControls; end; WBBoolRunDefault : begin RBRunDefault.Checked:=AValue; UpdateRunControls; end; end; end; +procedure TWebBrowserProjectOptionsForm.SetLocation(const AValue: string); +begin + CBRunLocationOnSWS.Text:=AValue; +end; + procedure TWebBrowserProjectOptionsForm.SetServerPort(AValue: Word); begin - SEPort.Value:=AValue; + SERunPort.Value:=AValue; end; procedure TWebBrowserProjectOptionsForm.SetURL(AValue: String); begin - CBServerURL.Text:=AValue; + CBRunServerURL.Text:=AValue; end; procedure TWebBrowserProjectOptionsForm.SetWasmProgramURL(AValue: String); @@ -240,14 +270,15 @@ begin aEnabled:=CBCreateHTML.Checked; CBMaintainPage.Enabled:=aEnabled; CBRunOnReady.Enabled:=aEnabled; - cbShowUncaughtExceptions.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; + CBRunLocationOnSWS.Enabled:=RBRunLocationOnSWS.Enabled and RBRunLocationOnSWS.Checked; + SERunPort.Enabled:=RBRunServerAt.Enabled and RBRunServerAt.Checked; + CBRunServerURL.Enabled:=RBRunBrowserWithURL.Enabled and RBRunBrowserWithURL.Checked; end; procedure TWebBrowserProjectOptionsForm.HideWASM; @@ -276,5 +307,12 @@ begin RunGroupBox.Visible:=false; end; +procedure TWebBrowserProjectOptionsForm.HideRunLocation; +begin + RBRunServerAt.Checked:=true; + RBRunLocationOnSWS.Visible:=false; + CBRunLocationOnSWS.Visible:=false; +end; + end. diff --git a/components/pas2js/languages/strpas2jsdesign.fr.po b/components/pas2js/languages/strpas2jsdesign.fr.po index 1509d9657a..c7ba6a3262 100644 --- a/components/pas2js/languages/strpas2jsdesign.fr.po +++ b/components/pas2js/languages/strpas2jsdesign.fr.po @@ -86,6 +86,10 @@ msgstr "" msgid "Let RTL show uncaught exceptions" msgstr "" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "Gérer la page HTML" @@ -266,6 +270,10 @@ msgstr "" msgid "Start HTTP Server on port" msgstr "Démarrer le serveur HTTP sur le port" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "Utiliser l'objet application du navigateur" @@ -284,6 +292,10 @@ msgstr "Utiliser l'objet application NodeJS" msgid "Use this URL to start application" msgstr "Utiliser cette URL pour démarrer l'application" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "" diff --git a/components/pas2js/languages/strpas2jsdesign.hu.po b/components/pas2js/languages/strpas2jsdesign.hu.po index c96f8e15a1..1ca89cb147 100644 --- a/components/pas2js/languages/strpas2jsdesign.hu.po +++ b/components/pas2js/languages/strpas2jsdesign.hu.po @@ -86,6 +86,10 @@ msgstr "" msgid "Let RTL show uncaught exceptions" msgstr "" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "HTML lap karbantartása" @@ -268,6 +272,10 @@ msgstr "" msgid "Start HTTP Server on port" msgstr "HTTP kiszolgáló indítása ezen a porton" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "Webböngésző alkalmazásobjektum használata" @@ -286,6 +294,10 @@ msgstr "NodeJS alkalmazásobjektum használata" msgid "Use this URL to start application" msgstr "Az alkalmazás indításához ezt az URL-t használja" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "" diff --git a/components/pas2js/languages/strpas2jsdesign.pot b/components/pas2js/languages/strpas2jsdesign.pot index c0d9416999..7f2a3ad3ea 100644 --- a/components/pas2js/languages/strpas2jsdesign.pot +++ b/components/pas2js/languages/strpas2jsdesign.pot @@ -76,6 +76,10 @@ msgstr "" msgid "Let RTL show uncaught exceptions" msgstr "" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "" @@ -256,6 +260,10 @@ msgstr "" msgid "Start HTTP Server on port" msgstr "" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "" @@ -272,6 +280,10 @@ msgstr "" msgid "Use this URL to start application" msgstr "" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "" diff --git a/components/pas2js/languages/strpas2jsdesign.pt_BR.po b/components/pas2js/languages/strpas2jsdesign.pt_BR.po index add525d0da..508dfd6266 100644 --- a/components/pas2js/languages/strpas2jsdesign.pt_BR.po +++ b/components/pas2js/languages/strpas2jsdesign.pt_BR.po @@ -86,6 +86,10 @@ msgstr "" msgid "Let RTL show uncaught exceptions" msgstr "" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "Manter página HTML" @@ -267,6 +271,10 @@ msgstr "" msgid "Start HTTP Server on port" msgstr "Iniciar servidor HTTP na porta" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "Usar objeto \"Browser Application\"" @@ -285,6 +293,10 @@ msgstr "Usar objeto \"NodeJS Application\"" msgid "Use this URL to start application" msgstr "Usar esta URL para iniciar a aplicação" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "" diff --git a/components/pas2js/languages/strpas2jsdesign.ru.po b/components/pas2js/languages/strpas2jsdesign.ru.po index 73e41a5df0..543c124797 100644 --- a/components/pas2js/languages/strpas2jsdesign.ru.po +++ b/components/pas2js/languages/strpas2jsdesign.ru.po @@ -89,6 +89,10 @@ msgstr "Не найден исходный текст HTML" msgid "Let RTL show uncaught exceptions" msgstr "Разрешать RTL показывать необработанные исключения" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "Поддерживать страницу HTML" @@ -269,6 +273,10 @@ msgstr "Программа pas2js, использующаяся в качест msgid "Start HTTP Server on port" msgstr "Запускать сервер HTTP на порту" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "Использовать объект приложения для браузера" @@ -285,6 +293,10 @@ msgstr "Использовать объект приложения для NodeJS msgid "Use this URL to start application" msgstr "Использовать следующий адрес для запуска приложения" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "Запускать программу WebAssembly:" diff --git a/components/pas2js/languages/strpas2jsdesign.tr.po b/components/pas2js/languages/strpas2jsdesign.tr.po index 99ea5d3e6e..b21ccd0c9c 100644 --- a/components/pas2js/languages/strpas2jsdesign.tr.po +++ b/components/pas2js/languages/strpas2jsdesign.tr.po @@ -86,6 +86,10 @@ msgstr "" msgid "Let RTL show uncaught exceptions" msgstr "" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "" @@ -268,6 +272,10 @@ msgstr "" msgid "Start HTTP Server on port" msgstr "" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "" @@ -284,6 +292,10 @@ msgstr "" msgid "Use this URL to start application" msgstr "" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "" diff --git a/components/pas2js/languages/strpas2jsdesign.uk.po b/components/pas2js/languages/strpas2jsdesign.uk.po index a1acae4cc1..42dc227ac7 100644 --- a/components/pas2js/languages/strpas2jsdesign.uk.po +++ b/components/pas2js/languages/strpas2jsdesign.uk.po @@ -88,6 +88,10 @@ msgstr "" msgid "Let RTL show uncaught exceptions" msgstr "" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "Підтримувати HTML-сторінку" @@ -268,6 +272,10 @@ msgstr "" msgid "Start HTTP Server on port" msgstr "Запустити HTTP-сервер на порті" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "Використати об'єкт програми-оглядача" @@ -286,6 +294,10 @@ msgstr "Використати об'єкт застосунку NodeJS" msgid "Use this URL to start application" msgstr "Для запуску застосунку використати цей URL" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "" diff --git a/components/pas2js/languages/strpas2jsdesign.zh_CN.po b/components/pas2js/languages/strpas2jsdesign.zh_CN.po index 30565d17af..2b97ead59a 100644 --- a/components/pas2js/languages/strpas2jsdesign.zh_CN.po +++ b/components/pas2js/languages/strpas2jsdesign.zh_CN.po @@ -87,6 +87,10 @@ msgstr "" msgid "Let RTL show uncaught exceptions" msgstr "" +#: strpas2jsdesign.pjsdlocationonsimplewebserver +msgid "Location on Simple Web Server" +msgstr "" + #: strpas2jsdesign.pjsdmaintainhtmlpage msgid "Maintain HTML page" msgstr "" @@ -269,6 +273,10 @@ msgstr "" msgid "Start HTTP Server on port" msgstr "" +#: strpas2jsdesign.pjsdthesimplewebserverisautomaticallystartedonrunthelo +msgid "The Simple Web Server is automatically started on Run. The location is like a sub folder in the URL serving the disk folder of the html file." +msgstr "" + #: strpas2jsdesign.pjsdusebrowserapplicationobject msgid "Use Browser Application object" msgstr "" @@ -285,6 +293,10 @@ msgstr "" msgid "Use this URL to start application" msgstr "" +#: strpas2jsdesign.pjsdusethiswhenyoustartyourownhttpserver +msgid "Use this when you start your own http server" +msgstr "" + #: strpas2jsdesign.pjsdusewasiapplicationobject msgid "Run WebAssembly program:" msgstr "" diff --git a/components/pas2js/pjscontroller.pp b/components/pas2js/pjscontroller.pp index 69dfa9515b..a01c1516ea 100644 --- a/components/pas2js/pjscontroller.pp +++ b/components/pas2js/pjscontroller.pp @@ -66,6 +66,7 @@ Const PJSProjectMaintainHTML = 'MaintainHTML'; PJSProjectUseBrowserConsole = 'BrowserConsole'; PJSProjectRunAtReady = 'RunAtReady'; + PJSProjectLocation = 'PasJSLocation'; PJSProjectPort = 'PasJSPort'; PJSProjectURL = 'PasJSURL'; PJSProjectHTMLBaseDir = 'HTMLDir'; diff --git a/components/pas2js/pjsdsgnregister.pas b/components/pas2js/pjsdsgnregister.pas index 76d520b30d..0d8364abba 100644 --- a/components/pas2js/pjsdsgnregister.pas +++ b/components/pas2js/pjsdsgnregister.pas @@ -47,6 +47,7 @@ type baoUseWASI, // Use WASI browser app object baoUseBrowserConsole, // use browserconsole unit to display Writeln() baoUseModule, // include as module as opposed to regular script + baoLocationOnSWS, // add location baoStartServer, // Start simple server baoUseURL // Use this URL to run/show project in browser ); @@ -58,6 +59,7 @@ type FMainSrcFileName: string; FMainSrcName: string; FOptions: TBrowserApplicationOptions; + FProjectLocation: string; FProjectPort: integer; FProjectURL: String; FProjectWasmURL : String; @@ -86,8 +88,9 @@ type function InitProject(AProject: TLazProject): TModalResult; override; function CreateStartFiles(AProject: TLazProject): TModalResult; override; property Options : TBrowserApplicationOptions read FOptions Write Foptions; + property ProjectLocation : string Read FProjectLocation Write FProjectLocation; property ProjectPort : integer Read FProjectPort Write FProjectPort; - property ProjectURL : String Read FProjectURL Write FProjectURL; + property ProjectURL : string Read FProjectURL Write FProjectURL; property MainSrcFileName: string read GetMainSrcFileName write FMainSrcFileName; property MainSrcName: string read GetMainSrcName write FMainSrcName; property HTMLFilename: string read GetHTMLFilename write FHTMLFilename; @@ -378,6 +381,508 @@ begin ProjectInspectorItemsMenuRoot.AddHandlerOnShow(@Pas2JSHandler.OnPrjInspPopup); end; +{ TProjectPas2JSWebApp } + +constructor TProjectPas2JSWebApp.Create; +begin + inherited Create; + Name:=ProjDescNamePas2JSWebApp; + Clear; +end; + +procedure TProjectPas2JSWebApp.Clear; +begin + // Reset options + Flags:=DefaultProjectNoApplicationFlags; + FMainSrcName:='Project1'; + FOptions:=[baoCreateHtml,baoMaintainHTML,baoLocationOnSWS]; + ProjectPort:=0; + ProjectURL:=''; +end; + +function TProjectPas2JSWebApp.GetNextPort : Word; + +begin + Result:=PJSOptions.StartAtPort; + if Result>=$ffff then + Result:=1024 + else + inc(Result); + PJSOptions.StartAtPort:=Result; + PJSOptions.Save; +end; + +function TProjectPas2JSWebApp.ShowOptionsDialog : TModalResult; + + Function Co(o : TBrowserApplicationOption) : boolean; + + begin + Result:=O in Options; + end; + + Procedure So(AValue : Boolean; o : TBrowserApplicationOption); + + begin + if AValue then + Include(Foptions,O) + else + Exclude(Foptions,O) + end; + +var + Frm: TWebBrowserProjectOptionsForm; +begin + Frm:=TWebBrowserProjectOptionsForm.Create(Nil); + With Frm do + try + CreateHTML:=CO(baoCreateHtml); + MaintainHTML:=CO(baoCreateHtml) and Co(baoMaintainHTML); + UseRunOnReady:=CO(baoRunOnReady); + ShowUncaughtExceptions:=CO(baoShowException); + UseBrowserConsole:=CO(baoUseBrowserConsole); + + UseBrowserApp:=CO(baoUseBrowserApp); + UseWASI:=CO(baoUseWASI); + WasmProgramURL:=''; + + UseModule:=CO(baoUseModule); + + if CO(baoLocationOnSWS) then + RunLocation:=true + else 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:=''; + + Result:=ShowModalOptions(Frm); + if Result=mrOK then + begin + SO(CreateHTML,baoCreateHtml); + SO(MaintainHTML,baoCreateHtml); + SO(UseRunOnReady,baoRunOnReady); + SO(UseBrowserConsole,baoUseBrowserConsole); + SO(ShowUncaughtExceptions,baoShowException); + + SO(UseBrowserApp,baoUseBrowserApp); + SO(UseWASI,baoUseWASI); + FProjectWasmURL:=WasmProgramURL; + + SO(UseModule,baoUseModule); + + SO(RunLocation,baoLocationOnSWS); + SO(RunServerAtPort,baoStartServer); + SO(RunBrowserWithURL,baoUseURL); + if baoLocationOnSWS in FOptions then + Self.ProjectLocation:=Location + else if baoStartServer in FOptions then + Self.ProjectPort:=ServerPort + else if baoUseURL in FOptions then + Self.ProjectURL:=URL; + + end; + finally + Free; + end; +end; + +function TProjectPas2JSWebApp.ShowModalOptions( + Frm: TWebBrowserProjectOptionsForm): TModalResult; +begin + Result:=Frm.ShowModal; +end; + +procedure TProjectPas2JSWebApp.EnableRunBrowser(AProject: TLazProject); +begin + SetDefaultWebRunParams(AProject.RunParameters.GetOrCreate('Default')); + AProject.CustomData.Values[PJSProject]:='1'; + AProject.CustomData.Values[PJSProjectWebBrowser]:='1'; + if baoLocationOnSWS in Options then + begin + AProject.CustomData.Values[PJSProjectLocation]:=ProjectLocation; + AProject.CustomData.Remove(PJSProjectPort); + AProject.CustomData.Remove(PJSProjectURL); + end + else if baoUseURL in Options then + begin + AProject.CustomData.Remove(PJSProjectLocation); + AProject.CustomData.Remove(PJSProjectPort); + AProject.CustomData.Values[PJSProjectURL]:=ProjectURL; + end + else + begin + AProject.CustomData.Remove(PJSProjectLocation); + AProject.CustomData.Values[PJSProjectPort]:=IntToStr(ProjectPort); + AProject.CustomData.Remove(PJSProjectURL); + end; + With AProject.CustomData do + begin + DebugLn(['Info: (pas2jsdsgn) ',PJSProjectWebBrowser,': ',Values[PJSProjectWebBrowser]]); + DebugLn(['Info: (pas2jsdsgn) ',PJSProjectLocation,': ',Values[PJSProjectLocation]]); + DebugLn(['Info: (pas2jsdsgn) ',PJSProjectPort,': ',Values[PJSProjectPort]]); + DebugLn(['Info: (pas2jsdsgn) ',PJSProjectURL,': ',Values[PJSProjectURL]]); + end; +end; + +function TProjectPas2JSWebApp.DoInitDescriptor: TModalResult; +begin + Clear; + Result:=ShowOptionsDialog; +end; + +function TProjectPas2JSWebApp.GetLocalizedName: string; +begin + Result:=pjsdWebApplication; +end; + +function TProjectPas2JSWebApp.GetLocalizedDescription: string; +begin + Result:=pjsdWebAppDescription; +end; + +function TProjectPas2JSWebApp.GetMainSrcFileName: string; +begin + if FMainSrcFileName='' then + FMainSrcFileName:=AnsiLowerCase(MainSrcName)+'.lpr'; + Result:=FMainSrcFileName; +end; + +function TProjectPas2JSWebApp.GetHTMLFilename: string; +begin + if FHTMLFilename='' then + FHTMLFilename:=ChangeFileExt(MainSrcFileName,'.html'); + Result:=FHTMLFilename; +end; + +function TProjectPas2JSWebApp.GetMainSrcName: string; +begin + if FMainSrcName='' then + FMainSrcName:='project1'; + Result:=FMainSrcName; +end; + +function TProjectPas2JSWebApp.GetScriptFilename: string; +begin + if FScriptFilename='' then + FScriptFilename:=ChangeFileExt(MainSrcFileName,'.js'); + Result:=FScriptFilename; +end; + +procedure TProjectPas2JSWebApp.AddHTMLHead(Src: TStringList); +begin + Src.Add(' '); + Src.Add(' '+MainSrcName+''); + Src.Add(' '); +end; + +procedure TProjectPas2JSWebApp.AddBody(Src: TStringList); +begin + Src.Add(' '); + if baoUseBrowserConsole in Options then + Src.Add('
'); +end; + +function TProjectPas2JSWebApp.CreateHTMLFile(AProject: TLazProject; + aScriptFileName: String): TLazProjectFile; + +Var + HTMLFile: TLazProjectFile; + ScriptType: String; + Src: TStringList; +begin + HTMLFile:=AProject.CreateProjectFile(HTMLFilename); + HTMLFile.IsPartOfProject:=true; + AProject.AddFile(HTMLFile,false); + ScriptType:=''; + if baoUseModule in Options then + ScriptType:=' type="module"'; + Src:=TStringList.Create; + try + Src.Add(''); + Src.Add(''); + Src.Add(''); + AddHTMLHead(Src); + Src.Add(' '); + Src.Add(''); + Src.Add(''); + AddBody(Src); + Src.Add(''); + Src.Add(''); + + HTMLFile.SetSourceText(Src.Text); + finally + Src.Free; + end; + + HTMLFile.CustomData[PJSIsProjectHTMLFile]:='1'; + if baoMaintainHTML in Options then + AProject.CustomData.Values[PJSProjectMaintainHTML]:='1'; + if baoUseBrowserConsole in Options then + AProject.CustomData[PJSProjectUseBrowserConsole]:='1'; + if baoRunOnReady in options then + AProject.CustomData[PJSProjectRunAtReady]:='1'; + + Result:=HTMLFile; +end; + +function TProjectPas2JSWebApp.CreateProjectSource : String; + +Var + Src : TStrings; + units : string; + + Procedure Add(aLine : String); + begin + Src.Add(aLine); + end; + + Procedure AddLn(aLine : String); + begin + if (aLine<>'') then + aLine:=aLine+';'; + Add(aLine); + end; + +begin + Units:=''; + if baoUseBrowserConsole in Options then + Units:=' BrowserConsole,'; + if baoUseBrowserApp in Options then + begin + Units:=Units+' BrowserApp,' ; + if baoUseWASI in options then + Units:=Units+' WASIHostApp,' ; + end; + Units:=Units+' JS, Classes, SysUtils, Web'; + Src:=TStringList.Create; + try + // create program source + AddLn('program '+MainSrcName); + AddLn(''); + Add('{$mode objfpc}'); + Add(''); + Add('uses'); + AddLn(units) ; + Add(''); + if baoUseBrowserApp in Options then + begin + Add('Type'); + if baoUseWASI in Options then + Add(' TMyApplication = Class(TWASIHostApplication)') + else + Add(' TMyApplication = Class(TBrowserApplication)'); + Add(' protected'); + AddLn(' procedure DoRun; override'); + Add(' public'); + AddLn(' end'); + Add(''); + AddLn('Procedure TMyApplication.DoRun'); + Add('begin'); + if ServiceWorkerJSFilename<>'' then + AddLn(' RegisterServiceWorker(''/ServiceWorker.js'')'); + if baoUseWASI in Options then + begin + if FProjectWasmURL='' then + FProjectWasmURL:='yourwebassembly.wasm'; + AddLn(Format(' StartWebAssembly(''%s'')',[FProjectWasmURL])); + end + else + Add(' // Your code here'); + AddLn('end'); + Add(''); + Add('var'); + AddLn(' Application : TMyApplication'); + Add(''); + end; + Add('begin'); + if Not (baoUseBrowserApp in Options) then + Add(' // Your code here') + else + begin + AddLn(' Application:=TMyApplication.Create(Nil)'); + AddLn(' Application.Initialize'); + AddLn(' Application.Run'); + end; + Add('end.'); + Result:=Src.Text; + finally + Src.Free; + end; +end; + +function TProjectPas2JSWebApp.InitProject(AProject: TLazProject): TModalResult; + +var + MainFile: TLazProjectFile; + CompOpts: TLazCompilerOptions; + +begin + Result:=inherited InitProject(AProject); + debugln(['Info: [TProjectPas2JSWebApp.InitProject] MainSrcFileName=',MainSrcFileName]); + MainFile:=AProject.CreateProjectFile(MainSrcFileName); + MainFile.IsPartOfProject:=true; + AProject.AddFile(MainFile,false); + AProject.MainFileID:=0; + CompOpts:=AProject.LazCompilerOptions; + SetDefaultWebCompileOptions(CompOpts); + CompOpts.TargetFilename:=ExtractFileNameOnly(MainFile.Filename); + if baoUseModule in Options then + CompOpts.TargetOS:='module'; + AProject.MainFile.SetSourceText(CreateProjectSource,true); + + EnableRunBrowser(AProject); + + // create html source + if baoCreateHtml in Options then + begin + debugln(['Info: [TProjectPas2JSWebApp.InitProject] HTMLFilename=',HTMLFilename]); + CreateHTMLFile(AProject,ScriptFilename); + end; +end; + +function TProjectPas2JSWebApp.CreateStartFiles(AProject: TLazProject + ): TModalResult; +var + MainFile: TLazProjectFile; +begin + // open lpr in source editor + MainFile:=AProject.MainFile; + Result:=LazarusIDE.DoOpenEditorFile(MainFile.Filename,-1,-1, + [ofProjectLoading,ofRegularFile]); + if Result<>mrOK then + exit; + + // open html in source editor + if baoCreateHtml in Options then + Result:=LazarusIDE.DoOpenEditorFile(HTMLFilename,-1,-1, + [ofProjectLoading,ofRegularFile]); +end; + +{ TProjectPas2JSServiceWorker } + +function TProjectPas2JSServiceWorker.CreateProjectSource: String; +var + Src: TStringList; + + procedure Add(const s: string); + begin + Src.Add(s); + end; + +begin + Src:=TStringList.Create; + try + Add('program ServiceWorker;'); + Add(''); + Add('{$mode objfpc}'); + Add(''); + Add('uses'); + Add(' Classes, ServiceWorkerApp;'); + Add(''); + Add('const'); + Add(' YourCacheName = ''v1''; // usually increased with every version'); + Add(' // The cache is specific to your domain, so no need to include your app name.'); + Add(''); + Add('type'); + Add(''); + Add(' { TApplication }'); + Add(''); + Add(' TApplication = class(TServiceWorkerApplication)'); + Add(' public'); + Add(' constructor Create(AOwner: TComponent); override;'); + Add(' end;'); + Add(''); + Add('{ TApplication }'); + Add(''); + Add('constructor TApplication.Create(AOwner: TComponent);'); + Add('begin'); + Add(' inherited Create(AOwner);'); + Add(''); + Add(' FCacheName:=YourCacheName;'); + Add(' FResources:=['); + Add(' ''/images/error.png'''); + Add(' ];'); + Add(' FallbackURL := ''/images/error.png'';'); + Add('end;'); + Add(''); + Add('var'); + Add(' App: TApplication;'); + Add('begin'); + Add(' App:=TApplication.Create(nil);'); + Add(' App.Run;'); + Add('end.'); + Result:=Src.Text; + finally + Src.Free; + end; +end; + +function TProjectPas2JSServiceWorker.InitServiceWorkerProject( + AProject: TLazProject; LPRFilename: string): TModalResult; +var + MainFile: TLazProjectFile; + CompOpts: TLazCompilerOptions; +begin + MainFile:=AProject.CreateProjectFile(LPRFilename); + MainFile.IsPartOfProject:=true; + AProject.AddFile(MainFile,false); + AProject.MainFileID:=0; + CompOpts:=AProject.LazCompilerOptions; + SetDefaultServiceWorkerCompileOptions(CompOpts); + CompOpts.TargetFilename:=ExtractFileNameOnly(LPRFilename); + SetDefaultServiceWorkerRunParams(AProject.RunParameters.GetOrCreate('Default')); + AProject.MainFile.SetSourceText(CreateProjectSource,true); + AProject.CustomData.Values[PJSProject]:='1'; + Result:=mrOk; +end; + +constructor TProjectPas2JSServiceWorker.Create; +begin + inherited Create; + Name:=ProjDescNamePas2JSServiceWorker; + Flags:=DefaultProjectNoApplicationFlags-[pfRunnable]; +end; + +function TProjectPas2JSServiceWorker.GetLocalizedName: string; +begin + Result:=pjsdServiceWorker; +end; + +function TProjectPas2JSServiceWorker.GetLocalizedDescription: string; +begin + Result:=pjsdServiceWorkerDescription; +end; + +function TProjectPas2JSServiceWorker.InitProject(AProject: TLazProject + ): TModalResult; +begin + Result:=inherited InitProject(AProject); + if Result<>mrOk then + exit; + Result:=InitServiceWorkerProject(AProject,'ServiceWorker.lpr'); +end; + +function TProjectPas2JSServiceWorker.CreateStartFiles(AProject: TLazProject + ): TModalResult; +begin + Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,-1, + [ofProjectLoading,ofRegularFile]); + if Result<>mrOK then + exit; +end; + { TMultiProjectPas2JSWebApp } procedure TMultiProjectPas2JSWebApp.SetOverwrites(const AValue: TStrings); @@ -883,119 +1388,6 @@ begin Result:=mrOk; end; -{ TProjectPas2JSServiceWorker } - -function TProjectPas2JSServiceWorker.CreateProjectSource: String; -var - Src: TStringList; - - procedure Add(const s: string); - begin - Src.Add(s); - end; - -begin - Src:=TStringList.Create; - try - Add('program ServiceWorker;'); - Add(''); - Add('{$mode objfpc}'); - Add(''); - Add('uses'); - Add(' Classes, ServiceWorkerApp;'); - Add(''); - Add('const'); - Add(' YourCacheName = ''v1''; // usually increased with every version'); - Add(' // The cache is specific to your domain, so no need to include your app name.'); - Add(''); - Add('type'); - Add(''); - Add(' { TApplication }'); - Add(''); - Add(' TApplication = class(TServiceWorkerApplication)'); - Add(' public'); - Add(' constructor Create(AOwner: TComponent); override;'); - Add(' end;'); - Add(''); - Add('{ TApplication }'); - Add(''); - Add('constructor TApplication.Create(AOwner: TComponent);'); - Add('begin'); - Add(' inherited Create(AOwner);'); - Add(''); - Add(' FCacheName:=YourCacheName;'); - Add(' FResources:=['); - Add(' ''/images/error.png'''); - Add(' ];'); - Add(' FallbackURL := ''/images/error.png'';'); - Add('end;'); - Add(''); - Add('var'); - Add(' App: TApplication;'); - Add('begin'); - Add(' App:=TApplication.Create(nil);'); - Add(' App.Run;'); - Add('end.'); - Result:=Src.Text; - finally - Src.Free; - end; -end; - -function TProjectPas2JSServiceWorker.InitServiceWorkerProject( - AProject: TLazProject; LPRFilename: string): TModalResult; -var - MainFile: TLazProjectFile; - CompOpts: TLazCompilerOptions; -begin - MainFile:=AProject.CreateProjectFile(LPRFilename); - MainFile.IsPartOfProject:=true; - AProject.AddFile(MainFile,false); - AProject.MainFileID:=0; - CompOpts:=AProject.LazCompilerOptions; - SetDefaultServiceWorkerCompileOptions(CompOpts); - CompOpts.TargetFilename:=ExtractFileNameOnly(LPRFilename); - SetDefaultServiceWorkerRunParams(AProject.RunParameters.GetOrCreate('Default')); - AProject.MainFile.SetSourceText(CreateProjectSource,true); - AProject.CustomData.Values[PJSProject]:='1'; - Result:=mrOk; -end; - -constructor TProjectPas2JSServiceWorker.Create; -begin - inherited Create; - Name:=ProjDescNamePas2JSServiceWorker; - Flags:=DefaultProjectNoApplicationFlags-[pfRunnable]; -end; - -function TProjectPas2JSServiceWorker.GetLocalizedName: string; -begin - Result:=pjsdServiceWorker; -end; - -function TProjectPas2JSServiceWorker.GetLocalizedDescription: string; -begin - Result:=pjsdServiceWorkerDescription; -end; - -function TProjectPas2JSServiceWorker.InitProject(AProject: TLazProject - ): TModalResult; -begin - Result:=inherited InitProject(AProject); - if Result<>mrOk then - exit; - Result:=InitServiceWorkerProject(AProject,'ServiceWorker.lpr'); -end; - -function TProjectPas2JSServiceWorker.CreateStartFiles(AProject: TLazProject - ): TModalResult; -begin - Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,-1, - [ofProjectLoading,ofRegularFile]); - if Result<>mrOK then - exit; -end; - { TProjectPas2JSElectronWebApp } procedure TProjectPas2JSElectronWebApp.AddHTMLHead(Src: TStringList); @@ -1287,7 +1679,7 @@ end; procedure TProjectPas2JSElectronWebApp.Clear; begin inherited Clear; - Options:=Options+[baoRunOnReady]-[baoUseBrowserApp,baoStartServer,baoUseURL]; + Options:=Options+[baoRunOnReady]-[baoUseBrowserApp]; PreloadLPR:='preload.lpr'; RenderLPR:='render.lpr'; HTMLFilename:='index.html'; @@ -1853,382 +2245,6 @@ begin [ofProjectLoading,ofRegularFile]); end; -{ TProjectPas2JSWebApp } - -constructor TProjectPas2JSWebApp.Create; -begin - inherited Create; - Name:=ProjDescNamePas2JSWebApp; - Clear; -end; - -procedure TProjectPas2JSWebApp.Clear; -begin - // Reset options - Flags:=DefaultProjectNoApplicationFlags; - FMainSrcName:='Project1'; - FOptions:=[baoCreateHtml,baoMaintainHTML,baoStartServer]; - ProjectPort:=0; - ProjectURL:=''; -end; - -function TProjectPas2JSWebApp.GetNextPort : Word; - -begin - Result:=PJSOptions.StartAtPort; - if Result>=$ffff then - Result:=1024 - else - inc(Result); - PJSOptions.StartAtPort:=Result; - PJSOptions.Save; -end; - -function TProjectPas2JSWebApp.ShowOptionsDialog : TModalResult; - - Function Co(o : TBrowserApplicationOption) : boolean; - - begin - Result:=O in Options; - end; - - Procedure So(AValue : Boolean; o : TBrowserApplicationOption); - - begin - if AValue then - Include(Foptions,O) - else - Exclude(Foptions,O) - end; - -var - Frm: TWebBrowserProjectOptionsForm; -begin - Frm:=TWebBrowserProjectOptionsForm.Create(Nil); - With Frm do - try - CreateHTML:=CO(baoCreateHtml); - MaintainHTML:=CO(baoCreateHtml) and Co(baoMaintainHTML); - UseRunOnReady:=CO(baoRunOnReady); - 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:=''; - - Result:=ShowModalOptions(Frm); - if Result=mrOK then - begin - SO(CreateHTML,baoCreateHtml); - SO(MaintainHTML,baoCreateHtml); - SO(UseRunOnReady,baoRunOnReady); - SO(UseBrowserConsole,baoUseBrowserConsole); - SO(ShowUncaughtExceptions,baoShowException); - - SO(UseBrowserApp,baoUseBrowserApp); - SO(UseWASI,baoUseWASI); - 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; -end; - -function TProjectPas2JSWebApp.ShowModalOptions( - Frm: TWebBrowserProjectOptionsForm): TModalResult; -begin - Result:=Frm.ShowModal; -end; - -procedure TProjectPas2JSWebApp.EnableRunBrowser(AProject: TLazProject); -begin - SetDefaultWebRunParams(AProject.RunParameters.GetOrCreate('Default')); - AProject.CustomData.Values[PJSProject]:='1'; - AProject.CustomData.Values[PJSProjectWebBrowser]:='1'; - if baoUseURL in Options then - begin - AProject.CustomData.Remove(PJSProjectPort); - AProject.CustomData.Values[PJSProjectURL]:=ProjectURL; - end - else - begin - AProject.CustomData.Values[PJSProjectPort]:=IntToStr(ProjectPort); - AProject.CustomData.Remove(PJSProjectURL); - end; - With AProject.CustomData do - begin - DebugLn(['Info: (pas2jsdsgn) ',PJSProjectWebBrowser,': ',Values[PJSProjectWebBrowser]]); - DebugLn(['Info: (pas2jsdsgn) ',PJSProjectPort,': ',Values[PJSProjectPort]]); - DebugLn(['Info: (pas2jsdsgn) ',PJSProjectURL,': ',Values[PJSProjectURL]]); - end; -end; - -function TProjectPas2JSWebApp.DoInitDescriptor: TModalResult; -begin - Clear; - Result:=ShowOptionsDialog; -end; - -function TProjectPas2JSWebApp.GetLocalizedName: string; -begin - Result:=pjsdWebApplication; -end; - -function TProjectPas2JSWebApp.GetLocalizedDescription: string; -begin - Result:=pjsdWebAppDescription; -end; - -function TProjectPas2JSWebApp.GetMainSrcFileName: string; -begin - if FMainSrcFileName='' then - FMainSrcFileName:=AnsiLowerCase(MainSrcName)+'.lpr'; - Result:=FMainSrcFileName; -end; - -function TProjectPas2JSWebApp.GetHTMLFilename: string; -begin - if FHTMLFilename='' then - FHTMLFilename:=ChangeFileExt(MainSrcFileName,'.html'); - Result:=FHTMLFilename; -end; - -function TProjectPas2JSWebApp.GetMainSrcName: string; -begin - if FMainSrcName='' then - FMainSrcName:='project1'; - Result:=FMainSrcName; -end; - -function TProjectPas2JSWebApp.GetScriptFilename: string; -begin - if FScriptFilename='' then - FScriptFilename:=ChangeFileExt(MainSrcFileName,'.js'); - Result:=FScriptFilename; -end; - -procedure TProjectPas2JSWebApp.AddHTMLHead(Src: TStringList); -begin - Src.Add(' '); - Src.Add(' '+MainSrcName+''); - Src.Add(' '); -end; - -procedure TProjectPas2JSWebApp.AddBody(Src: TStringList); -begin - Src.Add(' '); - if baoUseBrowserConsole in Options then - Src.Add('
'); -end; - -function TProjectPas2JSWebApp.CreateHTMLFile(AProject: TLazProject; - aScriptFileName: String): TLazProjectFile; - -Var - HTMLFile: TLazProjectFile; - ScriptType: String; - Src: TStringList; -begin - HTMLFile:=AProject.CreateProjectFile(HTMLFilename); - HTMLFile.IsPartOfProject:=true; - AProject.AddFile(HTMLFile,false); - ScriptType:=''; - if baoUseModule in Options then - ScriptType:=' type="module"'; - Src:=TStringList.Create; - try - Src.Add(''); - Src.Add(''); - Src.Add(''); - AddHTMLHead(Src); - Src.Add(' '); - Src.Add(''); - Src.Add(''); - AddBody(Src); - Src.Add(''); - Src.Add(''); - - HTMLFile.SetSourceText(Src.Text); - finally - Src.Free; - end; - - HTMLFile.CustomData[PJSIsProjectHTMLFile]:='1'; - if baoMaintainHTML in Options then - AProject.CustomData.Values[PJSProjectMaintainHTML]:='1'; - if baoUseBrowserConsole in Options then - AProject.CustomData[PJSProjectUseBrowserConsole]:='1'; - if baoRunOnReady in options then - AProject.CustomData[PJSProjectRunAtReady]:='1'; - - Result:=HTMLFile; -end; - -function TProjectPas2JSWebApp.CreateProjectSource : String; - -Var - Src : TStrings; - units : string; - - Procedure Add(aLine : String); - begin - Src.Add(aLine); - end; - - Procedure AddLn(aLine : String); - begin - if (aLine<>'') then - aLine:=aLine+';'; - Add(aLine); - end; - -begin - Units:=''; - if baoUseBrowserConsole in Options then - Units:=' BrowserConsole,'; - if baoUseBrowserApp in Options then - begin - Units:=Units+' BrowserApp,' ; - if baoUseWASI in options then - Units:=Units+' WASIHostApp,' ; - end; - Units:=Units+' JS, Classes, SysUtils, Web'; - Src:=TStringList.Create; - try - // create program source - AddLn('program '+MainSrcName); - AddLn(''); - Add('{$mode objfpc}'); - Add(''); - Add('uses'); - AddLn(units) ; - Add(''); - if baoUseBrowserApp in Options then - begin - Add('Type'); - if baoUseWASI in Options then - Add(' TMyApplication = Class(TWASIHostApplication)') - else - Add(' TMyApplication = Class(TBrowserApplication)'); - Add(' protected'); - AddLn(' procedure DoRun; override'); - Add(' public'); - AddLn(' end'); - Add(''); - AddLn('Procedure TMyApplication.DoRun'); - Add('begin'); - if ServiceWorkerJSFilename<>'' then - AddLn(' RegisterServiceWorker(''/ServiceWorker.js'')'); - if baoUseWASI in Options then - begin - if FProjectWasmURL='' then - FProjectWasmURL:='yourwebassembly.wasm'; - AddLn(Format(' StartWebAssembly(''%s'')',[FProjectWasmURL])); - end - else - Add(' // Your code here'); - AddLn('end'); - Add(''); - Add('var'); - AddLn(' Application : TMyApplication'); - Add(''); - end; - Add('begin'); - if Not (baoUseBrowserApp in Options) then - Add(' // Your code here') - else - begin - AddLn(' Application:=TMyApplication.Create(Nil)'); - AddLn(' Application.Initialize'); - AddLn(' Application.Run'); - end; - Add('end.'); - Result:=Src.Text; - finally - Src.Free; - end; -end; - -function TProjectPas2JSWebApp.InitProject(AProject: TLazProject): TModalResult; - -var - MainFile: TLazProjectFile; - CompOpts: TLazCompilerOptions; - -begin - Result:=inherited InitProject(AProject); - debugln(['Info: [TProjectPas2JSWebApp.InitProject] MainSrcFileName=',MainSrcFileName]); - MainFile:=AProject.CreateProjectFile(MainSrcFileName); - MainFile.IsPartOfProject:=true; - AProject.AddFile(MainFile,false); - AProject.MainFileID:=0; - CompOpts:=AProject.LazCompilerOptions; - SetDefaultWebCompileOptions(CompOpts); - CompOpts.TargetFilename:=ExtractFileNameOnly(MainFile.Filename); - if baoUseModule in Options then - CompOpts.TargetOS:='module'; - AProject.MainFile.SetSourceText(CreateProjectSource,true); - - EnableRunBrowser(AProject); - - // create html source - if baoCreateHtml in Options then - begin - debugln(['Info: [TProjectPas2JSWebApp.InitProject] HTMLFilename=',HTMLFilename]); - CreateHTMLFile(AProject,ScriptFilename); - end; -end; - -function TProjectPas2JSWebApp.CreateStartFiles(AProject: TLazProject - ): TModalResult; -var - MainFile: TLazProjectFile; -begin - // open lpr in source editor - MainFile:=AProject.MainFile; - Result:=LazarusIDE.DoOpenEditorFile(MainFile.Filename,-1,-1, - [ofProjectLoading,ofRegularFile]); - if Result<>mrOK then - exit; - - // open html in source editor - if baoCreateHtml in Options then - Result:=LazarusIDE.DoOpenEditorFile(HTMLFilename,-1,-1, - [ofProjectLoading,ofRegularFile]); -end; - { ---------------------------------------------------------------------- Module ----------------------------------------------------------------------} @@ -2254,7 +2270,6 @@ Var Add(Aline); end; - begin Units:=' JS, Classes, SysUtils'; Src:=TStringList.Create; diff --git a/components/pas2js/pjsprojectoptions.lfm b/components/pas2js/pjsprojectoptions.lfm index 34277de497..832f502239 100644 --- a/components/pas2js/pjsprojectoptions.lfm +++ b/components/pas2js/pjsprojectoptions.lfm @@ -6,8 +6,8 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame ClientHeight = 423 ClientWidth = 750 TabOrder = 0 - DesignLeft = 1404 - DesignTop = 244 + DesignLeft = 261 + DesignTop = 222 object CBWebProject: TCheckBox AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner @@ -144,25 +144,25 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 6 - Height = 161 + Height = 155 Top = 175 Width = 738 Anchors = [akTop, akLeft, akRight] AutoSize = True BorderSpacing.Around = 6 Caption = 'Run' - ClientHeight = 145 + ClientHeight = 139 ClientWidth = 736 TabOrder = 8 object RBStartServerAt: TRadioButton AnchorSideLeft.Control = RunGroupBox - AnchorSideTop.Control = RunGroupBox + AnchorSideTop.Control = SEPort + AnchorSideTop.Side = asrCenter Left = 6 Height = 23 - Top = 2 + Top = 42 Width = 168 BorderSpacing.Left = 6 - BorderSpacing.Top = 2 Caption = 'Start HTTP Server on port' Checked = True OnChange = RBStartServerAtChange @@ -171,14 +171,15 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame end object SEPort: TSpinEdit AnchorSideLeft.Control = RBStartServerAt - AnchorSideTop.Control = RBStartServerAt + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = CBLocation AnchorSideTop.Side = asrBottom - Left = 38 + Left = 180 Height = 30 - Top = 27 + Top = 38 Width = 82 - BorderSpacing.Left = 32 - BorderSpacing.Top = 2 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 MaxValue = 65354 MinValue = 1024 TabOrder = 1 @@ -186,29 +187,28 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame end object RBUseURL: TRadioButton AnchorSideLeft.Control = RBStartServerAt - AnchorSideTop.Control = SEPort - AnchorSideTop.Side = asrBottom + AnchorSideTop.Control = CBServerURL + AnchorSideTop.Side = asrCenter Left = 6 Height = 23 - Top = 59 + Top = 78 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.Control = SEPort AnchorSideTop.Side = asrBottom AnchorSideRight.Control = RunGroupBox AnchorSideRight.Side = asrBottom - Left = 38 + Left = 180 Height = 30 - Top = 84 - Width = 692 + Top = 74 + Width = 550 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 2 + BorderSpacing.Top = 6 BorderSpacing.Right = 6 ItemHeight = 0 TabOrder = 3 @@ -218,14 +218,45 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame AnchorSideTop.Side = asrBottom Left = 6 Height = 23 - Top = 116 + Top = 110 Width = 162 BorderSpacing.Left = 6 - BorderSpacing.Top = 2 + BorderSpacing.Top = 6 BorderSpacing.Bottom = 6 Caption = 'Execute Run Parameters' OnChange = RBStartServerAtChange TabOrder = 4 end + object CBLocation: TComboBox + AnchorSideLeft.Control = RBLocation + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = RunGroupBox + AnchorSideRight.Control = RunGroupBox + AnchorSideRight.Side = asrBottom + Left = 208 + Height = 30 + Top = 2 + Width = 522 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 6 + BorderSpacing.Top = 2 + BorderSpacing.Right = 6 + ItemHeight = 0 + TabOrder = 5 + end + object RBLocation: TRadioButton + AnchorSideLeft.Control = RunGroupBox + AnchorSideTop.Control = CBLocation + AnchorSideTop.Side = asrCenter + Left = 6 + Height = 23 + Top = 6 + Width = 196 + BorderSpacing.Left = 6 + BorderSpacing.Top = 2 + Caption = 'Location on Simple Web Server' + OnChange = RBLocationChange + TabOrder = 6 + end end end diff --git a/components/pas2js/pjsprojectoptions.pp b/components/pas2js/pjsprojectoptions.pp index 61a312ce24..127265d789 100644 --- a/components/pas2js/pjsprojectoptions.pp +++ b/components/pas2js/pjsprojectoptions.pp @@ -23,13 +23,16 @@ type BMakePas2jsPoject: TButton; BResetRunCommand: TButton; BResetCompileCommand: TButton; + CBLocation: TComboBox; CBRunOnReady: TCheckBox; CBServerURL: TComboBox; CBUseBrowserConsole: TCheckBox; CBWebProject: TCheckBox; CBHTMLFile: TComboBox; CBMaintainHTMLFile: TCheckBox; + ComboBoxRunLocation: TComboBox; LCBProjectHTMLFile: TLabel; + RBLocation: TRadioButton; RBRunDefault: TRadioButton; RBStartServerAt: TRadioButton; RBUseURL: TRadioButton; @@ -40,6 +43,7 @@ type procedure BResetRunCommandClick(Sender: TObject); procedure CBMaintainHTMLFileChange(Sender: TObject); procedure CBWebProjectChange(Sender: TObject); + procedure RBLocationChange(Sender: TObject); procedure RBStartServerAtChange(Sender: TObject); procedure RBUseURLChange(Sender: TObject); private @@ -172,8 +176,11 @@ begin CBRunOnReady.Caption:=pjsdRunRTLWhenAllPageResourcesAreFullyLoaded; RunGroupBox.Caption:=pjsdRun; + RBLocation.Caption:=pjsdLocationOnSimpleWebServer; + RBLocation.Hint:=pjsdTheSimpleWebServerIsAutomaticallyStartedOnRunTheLo; RBStartServerAt.Caption:=pjsdStartHTTPServerOnPort; RBUseURL.Caption:=pjsdUseThisURLToStartApplication; + RBUseURL.Hint:=pjsdUseThisWhenYouStartYourOwnHttpServer; RBRunDefault.Caption:=pjsExecuteRunParameters; BResetRunCommand.Caption:=pjsdResetRunCommand; @@ -186,6 +193,11 @@ begin CheckAllControls(CBWebProject.Checked); end; +procedure TPas2JSProjectOptionsFrame.RBLocationChange(Sender: TObject); +begin + UpdateRunControls; +end; + procedure TPas2JSProjectOptionsFrame.RBStartServerAtChange(Sender: TObject); begin UpdateRunControls; @@ -291,6 +303,7 @@ end; procedure TPas2JSProjectOptionsFrame.UpdateRunControls; begin + CBLocation.Enabled:=CBWebProject.Enabled and RBLocation.Enabled and RBLocation.Checked; SEPort.Enabled:=CBWebProject.Enabled and RBStartServerAt.Enabled and RBStartServerAt.Checked; CBServerURL.Enabled:=CBWebProject.Enabled and RBUseURL.Enabled and RBUseURL.Checked; end; @@ -302,7 +315,7 @@ Var HFN : String; HTMLIdx : Integer; Port : Word; - URL : String; + URL , Location: String; begin if AOptions=nil then ; @@ -320,11 +333,15 @@ begin CBUseBrowserConsole.Checked:=Prj.CustomData[PJSProjectUseBrowserConsole]='1'; CBRunOnReady.Checked:=Prj.CustomData[PJSProjectRunAtReady]='1'; + Location:=Prj.CustomData[PJSProjectLocation]; Port:=StrToIntDef(Prj.CustomData[PJSProjectPort],0); URL:=Prj.CustomData[PJSProjectURL]; + CBLocation.AddHistoryItem(Location,10,True,False); SEPort.Value:=Min(Max(0,Port),65535); CBServerURL.AddHistoryItem(URL,10,True,False); - if Prj.CustomData.Contains(PJSProjectPort) then + if Prj.CustomData.Contains(PJSProjectLocation) then + RBLocation.Checked:=true + else if Prj.CustomData.Contains(PJSProjectPort) then RBStartServerAt.Checked:=true else if Prj.CustomData.Contains(PJSProjectURL) then RBUseURL.Checked:=true @@ -356,6 +373,7 @@ begin Remove(PJSProjectMaintainHTML); Remove(PJSProjectUseBrowserConsole); Remove(PJSProjectRunAtReady); + Remove(PJSProjectLocation); Remove(PJSProjectPort); Remove(PJSProjectURL); end; @@ -373,7 +391,9 @@ begin DoBool(PJSProjectUseBrowserConsole,CBUseBrowserConsole.Checked); DoBool(PJSProjectRunAtReady,CBRunOnReady.Checked); - if RBStartServerAt.Checked and (SEPort.Value>=0) then + if RBLocation.Checked and (CBLocation.Text<>'') then + Prj.CustomData[PJSProjectLocation]:=CBLocation.Text + else 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; diff --git a/components/pas2js/strpas2jsdesign.pp b/components/pas2js/strpas2jsdesign.pp index 7245f050b6..b5f48401fd 100644 --- a/components/pas2js/strpas2jsdesign.pp +++ b/components/pas2js/strpas2jsdesign.pp @@ -68,10 +68,16 @@ Resourcestring +'resources are fully loaded'; pjsdRun = 'Run'; pjsdStartHTTPServerOnPort = 'Start HTTP Server on port'; + pjsdTheSimpleWebServerIsAutomaticallyStartedOnRunTheLo = 'The Simple Web ' + +'Server is automatically started on Run. The location is like a sub ' + +'folder in the URL serving the disk folder of the html file.'; + pjsdLocationOnSimpleWebServer = 'Location on Simple Web Server'; pjsCreateAJavascriptModuleInsteadOfAScript = 'Create a javascript module ' +'instead of a script'; pjsdUseThisURLToStartApplication = 'Use this URL to start application'; pjsExecuteRunParameters = 'Execute Run Parameters'; + pjsdUseThisWhenYouStartYourOwnHttpServer = 'Use this when you start your own' + +' http server'; pjsdResetRunCommand = 'Reset Run command'; pjsdResetCompileCommand = 'Reset Compile command'; pjsMakePas2jsProject = 'Make pas2js project';