mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 14:38:01 +02:00
* Refresh of HTML-based classes
This commit is contained in:
parent
c146e71e92
commit
6feea8040b
@ -6,19 +6,19 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
Caption = 'Pas2JS Browser project options'
|
||||
ClientHeight = 538
|
||||
ClientWidth = 635
|
||||
DesignTimePPI = 120
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.3.0.0'
|
||||
object CBCreateHTML: TCheckBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 8
|
||||
Width = 186
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 6
|
||||
Width = 173
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Create initial HTML page'
|
||||
Checked = True
|
||||
OnChange = CBCreateHTMLChange
|
||||
@ -29,11 +29,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = CBCreateHTML
|
||||
AnchorSideTop.Control = cbShowUncaughtExceptions
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 136
|
||||
Width = 229
|
||||
BorderSpacing.Top = 8
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 122
|
||||
Width = 213
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Use Browser Application object'
|
||||
OnChange = CBUseBrowserAppChange
|
||||
TabOrder = 1
|
||||
@ -42,20 +42,19 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = CBCreateHTML
|
||||
AnchorSideTop.Control = edtWasmProgram
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 236
|
||||
Width = 364
|
||||
BorderSpacing.Top = 8
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 213
|
||||
Width = 341
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Use Browser Console unit to display writeln() output'
|
||||
TabOrder = 2
|
||||
end
|
||||
object BPHelpOptions: TButtonPanel
|
||||
Left = 8
|
||||
Left = 6
|
||||
Height = 38
|
||||
Top = 492
|
||||
Width = 619
|
||||
BorderSpacing.Around = 8
|
||||
Top = 494
|
||||
Width = 623
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
@ -71,11 +70,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = edtWasmProgram
|
||||
AnchorSideTop.Control = RBStartServerAt
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 88
|
||||
Height = 28
|
||||
Top = 332
|
||||
Width = 160
|
||||
BorderSpacing.Top = 8
|
||||
Left = 70
|
||||
Height = 27
|
||||
Top = 300
|
||||
Width = 128
|
||||
BorderSpacing.Top = 6
|
||||
MaxValue = 65354
|
||||
MinValue = 1024
|
||||
TabOrder = 4
|
||||
@ -85,11 +84,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = CBCreateHTML
|
||||
AnchorSideTop.Control = CBUseBrowserConsole
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 268
|
||||
Width = 206
|
||||
BorderSpacing.Top = 8
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 242
|
||||
Width = 194
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Project needs a HTTP Server'
|
||||
OnChange = CBUseHTTPServerChange
|
||||
TabOrder = 5
|
||||
@ -98,12 +97,12 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = CBCreateHTML
|
||||
AnchorSideTop.Control = CBUseHTTPServer
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 48
|
||||
Height = 24
|
||||
Top = 300
|
||||
Width = 189
|
||||
BorderSpacing.Left = 40
|
||||
BorderSpacing.Top = 8
|
||||
Left = 38
|
||||
Height = 23
|
||||
Top = 271
|
||||
Width = 180
|
||||
BorderSpacing.Left = 32
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Start HTTP Server on port'
|
||||
Checked = True
|
||||
TabOrder = 6
|
||||
@ -113,10 +112,10 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = RBStartServerAt
|
||||
AnchorSideTop.Control = SEPort
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 48
|
||||
Height = 24
|
||||
Top = 362
|
||||
Width = 183
|
||||
Left = 38
|
||||
Height = 23
|
||||
Top = 329
|
||||
Width = 173
|
||||
BorderSpacing.Top = 2
|
||||
Caption = 'Use this URL to start app'
|
||||
TabOrder = 7
|
||||
@ -127,25 +126,25 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtWasmProgram
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 88
|
||||
Height = 28
|
||||
Top = 394
|
||||
Width = 539
|
||||
Left = 70
|
||||
Height = 27
|
||||
Top = 358
|
||||
Width = 559
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
ItemHeight = 20
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
ItemHeight = 0
|
||||
TabOrder = 8
|
||||
end
|
||||
object CBMaintainPage: TCheckBox
|
||||
AnchorSideLeft.Control = CBCreateHTML
|
||||
AnchorSideTop.Control = CBCreateHTML
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 40
|
||||
Width = 159
|
||||
BorderSpacing.Top = 8
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 151
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Maintain HTML Page'
|
||||
TabOrder = 9
|
||||
end
|
||||
@ -153,11 +152,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = CBCreateHTML
|
||||
AnchorSideTop.Control = CBMaintainPage
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 72
|
||||
Width = 335
|
||||
BorderSpacing.Top = 8
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 64
|
||||
Width = 313
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Run rtl when all page resources are fully loaded'
|
||||
TabOrder = 10
|
||||
end
|
||||
@ -165,11 +164,11 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = CBRunOnReady
|
||||
AnchorSideTop.Control = CBRunOnReady
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 104
|
||||
Width = 237
|
||||
BorderSpacing.Top = 8
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 93
|
||||
Width = 226
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Let rtl show uncaught exceptions'
|
||||
TabOrder = 11
|
||||
end
|
||||
@ -177,12 +176,12 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideLeft.Control = CBCreateHTML
|
||||
AnchorSideTop.Control = CBUseBrowserApp
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 48
|
||||
Height = 24
|
||||
Top = 168
|
||||
Width = 207
|
||||
BorderSpacing.Left = 40
|
||||
BorderSpacing.Top = 8
|
||||
Left = 38
|
||||
Height = 23
|
||||
Top = 151
|
||||
Width = 193
|
||||
BorderSpacing.Left = 32
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Host webassembly program'
|
||||
Enabled = False
|
||||
TabOrder = 12
|
||||
@ -193,14 +192,14 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 88
|
||||
Height = 28
|
||||
Top = 200
|
||||
Width = 539
|
||||
Left = 70
|
||||
Height = 27
|
||||
Top = 180
|
||||
Width = 559
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 40
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Left = 32
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Enabled = False
|
||||
TabOrder = 13
|
||||
TextHint = 'Name of your webassembly file'
|
||||
|
@ -36,6 +36,7 @@ Type
|
||||
Destructor Destroy; override;
|
||||
Procedure Reset; virtual;
|
||||
Procedure toJSON(aObject : TJSONObject);
|
||||
Procedure FromJSON(aJSON : String);
|
||||
Procedure FromJSON(aObject : TJSONObject);
|
||||
Function asJSON(Formatted : Boolean) : String;
|
||||
Property OverrideMethods : TSpecialMethods index 1 Read GetMethods Write SetMethods;
|
||||
@ -431,7 +432,6 @@ begin
|
||||
Add('BelowID',BelowID);
|
||||
Add('HTMLFileName',HTMLFileName);
|
||||
Add('FormClassname',FormClassname);
|
||||
Add('FormClassname',FormClassname);
|
||||
Add('UseDefaultElements',UseDefaultElements);
|
||||
Add('AddHTMLToProject',AddHTMLToProject);
|
||||
arr:=TJSONArray.Create;
|
||||
@ -441,6 +441,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure THTML2ClassOptions.FromJSON(aJSON: String);
|
||||
|
||||
Var
|
||||
D : TJSONData;
|
||||
J : TJSONObject Absolute D;
|
||||
|
||||
begin
|
||||
D:=GetJSON(aJSON);
|
||||
try
|
||||
if D is TJSONObject then
|
||||
FromJSON(J);
|
||||
finally
|
||||
D.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure THTML2ClassOptions.FromJSON(aObject: TJSONObject);
|
||||
|
||||
Function GenFromArray(Arr : TJSONArray) : TSpecialMethods;
|
||||
|
@ -24,6 +24,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr "Navigateur pour ouvrir la page HTML, macro $(Pas2JSBrowser)"
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr "Créer la page initiale HTML"
|
||||
@ -47,6 +55,22 @@ msgstr "le fichier \"%s\" n'est pas exécutable"
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr "fichier \"%s\" non trouvé"
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr "Options de ligne de commande supplémentaires du serveur HTTP (une par ligne)"
|
||||
@ -254,6 +278,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.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr ""
|
||||
|
@ -24,6 +24,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr "Böngésző a HTML lapok megnyitásához, makró $(Pas2JSBrowser)"
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr "Kezdő HTML lap létrehozása"
|
||||
@ -47,6 +55,22 @@ msgstr "a(z) \"%s\" fájl nem futtatható állomány"
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr "a(z) \"%s\" fájl nem található"
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr "Extra parancssori paraméterek a HTTP kiszolgáló számára (soronként egy)"
|
||||
@ -258,6 +282,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.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr ""
|
||||
|
@ -14,6 +14,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr ""
|
||||
@ -37,6 +45,22 @@ msgstr ""
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr ""
|
||||
@ -244,6 +268,14 @@ msgstr ""
|
||||
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr ""
|
||||
|
@ -24,6 +24,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr "Navegador para abrir páginas HTML, macro $(Pas2JSBrowser)"
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr "Criar página HTML inicial"
|
||||
@ -47,6 +55,22 @@ msgstr "arquivo \"%s\" não é executável"
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr "arquivo \"%s\" não encontrado"
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr "Opções extra de linha de comando do servidor HTTP (uma por linha)"
|
||||
@ -257,6 +281,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.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr ""
|
||||
|
@ -24,6 +24,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr "Браузер для открытия страницы HTML, макрос $(Pas2JSBrowser)"
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr "Создать первоначальную страницу HTML"
|
||||
@ -47,6 +55,22 @@ msgstr "файл \"%s\" не является исполнимым"
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr "файл \"%s\" не найден"
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr "Дополнительные параметры команды запуска сервера HTTP (по одному на строку)"
|
||||
@ -254,6 +278,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.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr "Имя файла WebAssembly"
|
||||
|
@ -24,6 +24,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr ""
|
||||
@ -47,6 +55,22 @@ msgstr ""
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr ""
|
||||
@ -258,6 +282,14 @@ msgstr ""
|
||||
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr ""
|
||||
|
@ -26,6 +26,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr "Оглядач для відкривання файлів HTML), макрос $(Pas2JSBrowser)"
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr "Створити початкову HTML-сторінку"
|
||||
@ -49,6 +57,22 @@ msgstr "файл \"%s\" не є виконуваним"
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr "файл \"%s\" не знайдено"
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr "Додаткові параметри командного рядка HTTP-сервера (по одній в рядку)"
|
||||
@ -256,6 +280,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.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr ""
|
||||
|
@ -25,6 +25,14 @@ msgctxt "strpas2jsdesign.pjsdbrowsertoopenhtmlpage"
|
||||
msgid "Browser to open HTML page, macro $(Pas2JSBrowser)"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbtnselectfile
|
||||
msgid "Select the file"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdbuttoncancel
|
||||
msgid "Cancel refresh"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdcreateinitialhtmlpage
|
||||
msgid "Create initial HTML page"
|
||||
msgstr ""
|
||||
@ -48,6 +56,22 @@ msgstr ""
|
||||
msgid "file \"%s\" not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilenotfound
|
||||
#, object-pascal-format
|
||||
msgid ""
|
||||
"Cannot file the HTML Source file for this class:\n"
|
||||
"%s\n"
|
||||
"Would you like to select the file from disk?"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlfilter
|
||||
msgid "HTML Files|*.html|All files|*.*"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhtmlsourcefilenotfound
|
||||
msgid "HTML Source not found"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsdhttpserveroptslabelcaption
|
||||
msgid "HTTP Server extra command-line options (one per line)"
|
||||
msgstr ""
|
||||
@ -259,6 +283,14 @@ msgstr ""
|
||||
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshallclassesfromhtml
|
||||
msgid "Refresh all classes from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjsrefreshclassfromhtml
|
||||
msgid "Refresh class from HTML source"
|
||||
msgstr ""
|
||||
|
||||
#: strpas2jsdesign.pjswasiprogramfiletexthint
|
||||
msgid "Name of your WebAssembly file"
|
||||
msgstr ""
|
||||
|
@ -78,7 +78,12 @@ Type
|
||||
|
||||
Const
|
||||
// Custom settings in .lpi
|
||||
PJSProjectWebBrowser = 'PasJSWebBrowserProject';
|
||||
PJSProject = 'Pas2JSProject'; // Project is pas2js project
|
||||
PJSProjectWebBrowser = 'PasJSWebBrowserProject'; // Web browser project
|
||||
PJSProjectNodeJS = 'PJSProjectNodeJS'; // NodeJS project
|
||||
PJSProjectModule = 'PJSProjectModule'; // Module project
|
||||
PJSProjectVSCode = 'PJSProjectVSCode'; // VS Code project
|
||||
PJSProjectAtom = 'PJSProjectAtom'; // VS Code project
|
||||
PJSProjectHTMLFile = 'PasJSHTMLFile';
|
||||
PJSIsProjectHTMLFile = 'PasJSIsProjectHTMLFile';
|
||||
PJSProjectMaintainHTML = 'MaintainHTML';
|
||||
|
@ -103,6 +103,7 @@ type
|
||||
public
|
||||
constructor Create; override;
|
||||
destructor destroy; override;
|
||||
Function Initialized(NewFile: TLazProjectFile): TModalResult; override;
|
||||
function Init(var {%H-}NewFilename: string; {%H-}NewOwner: TObject;
|
||||
var {%H-}NewSource: string; {%H-}Quiet: boolean): TModalResult; override;
|
||||
function ShowOptionDialog : TModalResult;
|
||||
@ -119,18 +120,25 @@ var
|
||||
Const
|
||||
// Position in project options dialog.
|
||||
Pas2JSOptionsIndex = ProjectOptionsMisc + 100;
|
||||
SHTML2FormOptions = 'HTML2FormOptions';
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
dialogs,
|
||||
frmpas2jswebservers,
|
||||
frmpas2jsnodejsprojectoptions,
|
||||
frmpas2jsbrowserprojectoptions,
|
||||
pjsprojectoptions,
|
||||
frmhtmltoform,
|
||||
pjscontroller, strpas2jsdesign, IDECommands, ToolbarIntf, MenuIntf;
|
||||
fpjson, pjscontroller, srceditorintf, strpas2jsdesign, IDECommands, ToolbarIntf, MenuIntf;
|
||||
|
||||
Var
|
||||
SrcMnuItem,PrjMnuItem,PrjMnuItemAll : TIDEmenuCommand;
|
||||
|
||||
|
||||
|
||||
procedure ShowServerDialog(Sender: TObject);
|
||||
begin
|
||||
@ -138,11 +146,28 @@ begin
|
||||
TPasJSWebserverProcessesForm.Instance.BringToFront;
|
||||
end;
|
||||
|
||||
Type
|
||||
|
||||
{ TPas2JSMenuHandler }
|
||||
|
||||
TPas2JSMenuHandler = Class(TObject)
|
||||
procedure DoConvLog(Sender: TObject; const Msg: String);
|
||||
Procedure OnRefreshHTMLFormContext(Sender : TObject);
|
||||
Procedure OnRefreshProjHTMLFormContext(Sender : TObject);
|
||||
Procedure OnRefreshProjHTMLFormAllContext(Sender : TObject);
|
||||
Procedure OnSrcEditPopup(Sender : TObject);
|
||||
Procedure OnPrjInspPopup(Sender : TObject);
|
||||
private
|
||||
function AskUserFile(aHTMLFileName: String): string;
|
||||
function RefreshHTML(aFile: TLazProjectFile; out aSource: String): Boolean;
|
||||
end;
|
||||
|
||||
Const
|
||||
sPas2JSWebserverName = 'Pas2JSWebservers';
|
||||
|
||||
Var
|
||||
Pas2JSHTMLClassDef : TPas2JSHTMLClassDef;
|
||||
MenuHandler : TPas2JSMenuHandler;
|
||||
|
||||
procedure Register;
|
||||
|
||||
@ -151,6 +176,8 @@ Var
|
||||
IDECommand : TIDECommand;
|
||||
|
||||
begin
|
||||
MenuHandler:=TPas2JSMenuHandler.Create;
|
||||
if Assigned(MenuHandler) then; // Silence compiler warning
|
||||
PJSOptions:=TPas2jsOptions.Create;
|
||||
PJSOptions.Load;
|
||||
TPJSController.Instance.Hook;
|
||||
@ -175,6 +202,216 @@ begin
|
||||
RegisterIdeMenuCommand(itmViewDebugWindows,sPas2JSWebserverName,SPasJSWebserverCaption,nil,@ShowServerDialog);
|
||||
// Add project options frame
|
||||
RegisterIDEOptionsEditor(GroupProject,TPas2JSProjectOptionsFrame, Pas2JSOptionsIndex);
|
||||
SrcMnuItem:=RegisterIDEMenuCommand(SrcEditMenuSectionFirstStatic {SrcEditMenuSectionFirstDynamic},
|
||||
'HTMLFormClassRefresh', pjsRefreshClassFromHTML,@MenuHandler.OnRefreshHTMLFormContext);
|
||||
SourceEditorMenuRoot.AddHandlerOnShow(@MenuHandler.OnSrcEditPopup);
|
||||
PrjMnuItem:=RegisterIDEMenuCommand(ProjInspMenuSectionFiles,
|
||||
'PrjHTMLFormClassRefresh',pjsRefreshClassFromHTML,@MenuHandler.OnRefreshProjHTMLFormContext);
|
||||
PrjMnuItemAll:=RegisterIDEMenuCommand(ProjInspMenuSectionFiles,
|
||||
'PrjHTMLFormClassRefreshAll',pjsRefreshAllClassesFromHTML,@MenuHandler.OnRefreshProjHTMLFormAllContext);
|
||||
ProjectInspectorItemsMenuRoot.AddHandlerOnShow(@MenuHandler.OnPrjInspPopup);
|
||||
|
||||
end;
|
||||
|
||||
{ TPas2JSMenuHandler }
|
||||
|
||||
procedure TPas2JSMenuHandler.DoConvLog(Sender: TObject; const Msg: String);
|
||||
begin
|
||||
IDEMessagesWindow.AddCustomMessage(TMessageLineUrgency.mluProgress,Msg,'',0,0,SMessageViewHTMLToForm);
|
||||
end;
|
||||
|
||||
procedure TPas2JSMenuHandler.OnSrcEditPopup(Sender: TObject);
|
||||
|
||||
Var
|
||||
Editor : TSourceEditorInterface;
|
||||
aFile : TLazProjectFile;
|
||||
IsPas2JS : Boolean;
|
||||
|
||||
begin
|
||||
Editor:=SourceEditorManagerIntf.ActiveEditor;
|
||||
if Editor=nil then exit;
|
||||
aFile:=Editor.GetProjectFile;
|
||||
IsPas2JS:=LazarusIDE.ActiveProject.CustomData.Values[PJSProject]='1';
|
||||
SrcMnuItem.Visible:=IsPas2js and Assigned(AFile) and (aFile.CustomData.Values[SHTML2FormOptions]<>'');
|
||||
end;
|
||||
|
||||
procedure TPas2JSMenuHandler.OnPrjInspPopup(Sender: TObject);
|
||||
|
||||
Var
|
||||
Idx : Integer;
|
||||
isPas2JS, isFile,HasHTMLInfo,AllOK,AnyOK : Boolean;
|
||||
aFile : TLazProjectFile;
|
||||
|
||||
begin
|
||||
AllOK:=False;
|
||||
AnyOK:=False;
|
||||
Idx:=-1;
|
||||
IsPas2JS:=LazarusIDE.ActiveProject.CustomData.Values[PJSProject]='1';
|
||||
if IsPas2JS then
|
||||
begin
|
||||
AllOK:=True;
|
||||
if Assigned(LazarusIDE.GetProjectInspectorSelection) then
|
||||
Idx:=LazarusIDE.GetProjectInspectorSelection.Count-1;
|
||||
While (Idx>=0) do
|
||||
begin
|
||||
HasHTMLInfo:=False;
|
||||
isFile:=TObject(LazarusIDE.GetProjectInspectorSelection[Idx]) is TLazProjectFile;
|
||||
if IsFile then
|
||||
begin
|
||||
aFile:=TLazProjectFile(LazarusIDE.GetProjectInspectorSelection[Idx]);
|
||||
HasHTMLInfo:=(aFile.CustomData.Values[SHTML2FormOptions]<>'');
|
||||
end;
|
||||
AllOK:=AllOK and HasHTMLInfo;
|
||||
Dec(Idx);
|
||||
end;
|
||||
Idx:=LazarusIDE.ActiveProject.FileCount-1;
|
||||
While (not AnyOK) and (Idx>=0) do
|
||||
begin
|
||||
aFile:=LazarusIDE.ActiveProject.Files[Idx];
|
||||
HasHTMLInfo:=(aFile.CustomData.Values[SHTML2FormOptions]<>'');
|
||||
AnyOK:=AnyOK or HasHTMLInfo;
|
||||
Dec(Idx);
|
||||
end;
|
||||
end;
|
||||
PrjMnuItem.Visible:=AllOK;
|
||||
PrjMnuItemAll.Visible:=AnyOK;
|
||||
end;
|
||||
|
||||
function TPas2JSMenuHandler.AskUserFile(aHTMLFileName: String): string;
|
||||
|
||||
Var
|
||||
Dlg : TOpenDialog;
|
||||
|
||||
begin
|
||||
Result:='';
|
||||
if mrOK<>QuestionDlg(pjsdHTMLSourceFileNotFound,
|
||||
Format(pjsdHTMLFileNotFOund,[aHTMLFileName]),mtInformation,
|
||||
[mrOK,pjsdBtnSelectFile,mrCancel,pjsdButtonCancel],0) then
|
||||
Exit;
|
||||
Dlg:=TOpenDialog.Create(Application);
|
||||
try
|
||||
Dlg.Filter:=pjsdHTMLFilter;
|
||||
Dlg.FileName:=aHTMLFileName;
|
||||
Dlg.Options:=[ofFileMustExist];
|
||||
if Dlg.Execute then
|
||||
Result:=Dlg.FileName
|
||||
finally
|
||||
Dlg.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPas2JSMenuHandler.OnRefreshHTMLFormContext(Sender: TObject);
|
||||
Var
|
||||
Editor : TSourceEditorInterface;
|
||||
aFile : TLazProjectFile;
|
||||
aSource : String;
|
||||
|
||||
begin
|
||||
Editor:=SourceEditorManagerIntf.ActiveEditor;
|
||||
if Editor=nil then exit;
|
||||
aFile:=Editor.GetProjectFile;
|
||||
if not (Assigned(AFile) and (aFile.CustomData.Values[SHTML2FormOptions]<>'')) then exit;
|
||||
if RefreshHTML(aFile,aSource) then
|
||||
begin
|
||||
Editor.SourceText:=aSource;
|
||||
Editor.Modified:=True;
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TPas2JSMenuHandler.RefreshHTML(aFile : TLazProjectFile; Out aSource : String) : Boolean;
|
||||
|
||||
Var
|
||||
aOptions: THTML2ClassOptions;
|
||||
CG : TFormCodeGen;
|
||||
Conv : THTMLToFormELements;
|
||||
aFileName : String;
|
||||
|
||||
begin
|
||||
Result:=False;
|
||||
Conv:=Nil;
|
||||
CG:=Nil;
|
||||
aOptions:=THTML2ClassOptions.Create;
|
||||
try
|
||||
aOptions.FromJSON(aFile.CustomData.Values[SHTML2FormOptions]);
|
||||
if Not FileExists(aOptions.HTMLFileName) then
|
||||
begin
|
||||
aFileName:=AskUserFile(aOptions.HTMLFileName);
|
||||
if aFileName='' then
|
||||
exit;
|
||||
aOptions.HTMLFileName:=aFileName;
|
||||
aFile.CustomData.Values[SHTML2FormOptions]:=aOptions.asJSON(False);
|
||||
LazarusIDE.ActiveProject.Modified:=True;
|
||||
end;
|
||||
CG:=TFormCodeGen.Create(Nil);
|
||||
Conv:=THTMLToFormELements.Create(nil);
|
||||
Conv.LoadOptions(aOptions);
|
||||
Conv.LoadFromFile(aoptions.HTMLFileName);
|
||||
Conv.OnLog:=@DoConvLog;
|
||||
CG.LoadOptions(aoptions);
|
||||
CG.FormElements:=Conv.FormElements;
|
||||
Cg.OutputUnitName:=ChangeFileExt(ExtractFileName(aFile.Filename),'');
|
||||
CG.Execute;
|
||||
aSource:=CG.Source.Text;
|
||||
Result:=True;
|
||||
finally
|
||||
CG.Free;
|
||||
Conv.Free;
|
||||
aOPtions.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPas2JSMenuHandler.OnRefreshProjHTMLFormContext(Sender: TObject);
|
||||
|
||||
Var
|
||||
Idx : Integer;
|
||||
isFile,HasHTMLInfo : Boolean;
|
||||
aFile : TLazProjectFile;
|
||||
aSource : string;
|
||||
|
||||
|
||||
begin
|
||||
if not Assigned(LazarusIDE.GetProjectInspectorSelection) then exit;
|
||||
Idx:=LazarusIDE.GetProjectInspectorSelection.Count-1;
|
||||
While (Idx>=0) do
|
||||
begin
|
||||
HasHTMLInfo:=False;
|
||||
isFile:=TObject(LazarusIDE.GetProjectInspectorSelection[Idx]) is TLazProjectFile;
|
||||
if IsFile then
|
||||
begin
|
||||
aFile:=TLazProjectFile(LazarusIDE.GetProjectInspectorSelection[Idx]);
|
||||
HasHTMLInfo:=(aFile.CustomData.Values[SHTML2FormOptions]<>'');
|
||||
if HasHTMLInfo then
|
||||
begin
|
||||
If RefreshHTML(aFile,aSource) then
|
||||
aFile.SetSourceText(aSource);
|
||||
end;
|
||||
end;
|
||||
Dec(Idx);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPas2JSMenuHandler.OnRefreshProjHTMLFormAllContext(Sender: TObject);
|
||||
Var
|
||||
Idx : Integer;
|
||||
HasHTMLInfo : Boolean;
|
||||
aFile : TLazProjectFile;
|
||||
aSource : string;
|
||||
|
||||
|
||||
begin
|
||||
Idx:=LazarusIDE.ActiveProject.FileCount-1;
|
||||
While (Idx>=0) do
|
||||
begin
|
||||
HasHTMLInfo:=False;
|
||||
aFile:=LazarusIDE.ActiveProject.Files[Idx];
|
||||
HasHTMLInfo:=(aFile.CustomData.Values[SHTML2FormOptions]<>'');
|
||||
if HasHTMLInfo then
|
||||
begin
|
||||
If RefreshHTML(aFile,aSource) then
|
||||
aFile.SetSourceText(aSource);
|
||||
end;
|
||||
Dec(Idx);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TPas2JSHTMLClassDef }
|
||||
@ -198,6 +435,14 @@ begin
|
||||
inherited destroy;
|
||||
end;
|
||||
|
||||
function TPas2JSHTMLClassDef.Initialized(NewFile: TLazProjectFile
|
||||
): TModalResult;
|
||||
begin
|
||||
Result:=inherited Initialized(NewFile);
|
||||
if result=mrOK then
|
||||
NewFile.CustomData.Add(SHTML2FormOPtions,FOptions.asJSON(False));
|
||||
end;
|
||||
|
||||
function TPas2JSHTMLClassDef.Init(var NewFilename: string; NewOwner: TObject;
|
||||
var NewSource: string; Quiet: boolean): TModalResult;
|
||||
begin
|
||||
@ -222,6 +467,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function TPas2JSHTMLClassDef.CreateSource(const Filename, SourceName, ResourceName: string): string;
|
||||
|
||||
Var
|
||||
@ -244,7 +491,8 @@ begin
|
||||
Result:=CG.Source.Text;
|
||||
if FOptions.AddHTMLToProject then
|
||||
begin
|
||||
HTMLFile:=LazarusIDE.ActiveProject.CreateProjectFile(Foptions.HTMLFileName);
|
||||
LazarusIDE.DoOpenEditorFile(Foptions.HTMLFileName,-1,-1,[ofAddToProject]);
|
||||
HTMLFile:=LazarusIDE.ActiveProject.FindFile(Foptions.HTMLFileName,[pfsfOnlyProjectFiles]);
|
||||
HTMLFile.IsPartOfProject:=true;
|
||||
HTMLFile.CustomData.Add('HTMLClassFile',SourceName);
|
||||
end;
|
||||
@ -400,6 +648,8 @@ begin
|
||||
MainFile.IsPartOfProject:=true;
|
||||
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:='project1';
|
||||
@ -680,6 +930,7 @@ begin
|
||||
CompOpts.TargetFilename:='project1';
|
||||
SetDefaultWebRunParams(AProject.RunParameters.GetOrCreate('Default'));
|
||||
AProject.MainFile.SetSourceText(CreateProjectSource,true);
|
||||
AProject.CustomData.Values[PJSProject]:='1';
|
||||
AProject.CustomData.Values[PJSProjectWebBrowser]:='1';
|
||||
if baoUseURL in Options then
|
||||
begin
|
||||
@ -815,6 +1066,8 @@ begin
|
||||
MainFile.IsPartOfProject:=true;
|
||||
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';
|
||||
|
@ -10,9 +10,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
DesignTop = 400
|
||||
object CBWebProject: TCheckBox
|
||||
Left = 12
|
||||
Height = 19
|
||||
Height = 23
|
||||
Top = 8
|
||||
Width = 232
|
||||
Width = 267
|
||||
Caption = 'Project is a Web Browser (pas2js) project'
|
||||
OnChange = CBWebProjectChange
|
||||
TabOrder = 0
|
||||
@ -22,12 +22,11 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = CBWebProject
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 33
|
||||
Width = 95
|
||||
Height = 16
|
||||
Top = 37
|
||||
Width = 107
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Project HTML file:'
|
||||
ParentColor = False
|
||||
end
|
||||
object CBHTMLFile: TComboBox
|
||||
AnchorSideLeft.Control = CBWebProject
|
||||
@ -36,13 +35,13 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 23
|
||||
Top = 50
|
||||
Height = 29
|
||||
Top = 55
|
||||
Width = 467
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 16
|
||||
ItemHeight = 15
|
||||
ItemHeight = 0
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
@ -51,9 +50,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = CBHTMLFile
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 79
|
||||
Width = 124
|
||||
Height = 23
|
||||
Top = 90
|
||||
Width = 142
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Maintain HTML File'
|
||||
OnChange = CBMaintainHTMLFileChange
|
||||
@ -64,9 +63,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = CBUseBrowserConsole
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 36
|
||||
Height = 19
|
||||
Top = 129
|
||||
Width = 268
|
||||
Height = 23
|
||||
Top = 148
|
||||
Width = 313
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Run rtl when all page resources are fully loaded'
|
||||
TabOrder = 3
|
||||
@ -76,8 +75,8 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = RBStartServerAt
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 76
|
||||
Height = 23
|
||||
Top = 200
|
||||
Height = 27
|
||||
Top = 231
|
||||
Width = 82
|
||||
BorderSpacing.Left = 32
|
||||
BorderSpacing.Top = 2
|
||||
@ -91,9 +90,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = CBUseHTTPServer
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 44
|
||||
Height = 19
|
||||
Top = 179
|
||||
Width = 154
|
||||
Height = 23
|
||||
Top = 206
|
||||
Width = 180
|
||||
BorderSpacing.Left = 32
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Start HTTP Server on port'
|
||||
@ -109,13 +108,13 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 76
|
||||
Height = 23
|
||||
Top = 246
|
||||
Height = 27
|
||||
Top = 285
|
||||
Width = 403
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 16
|
||||
ItemHeight = 15
|
||||
ItemHeight = 0
|
||||
TabOrder = 6
|
||||
end
|
||||
object RBUseURL: TRadioButton
|
||||
@ -123,9 +122,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = SEPort
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 44
|
||||
Height = 19
|
||||
Top = 225
|
||||
Width = 148
|
||||
Height = 23
|
||||
Top = 260
|
||||
Width = 173
|
||||
BorderSpacing.Top = 2
|
||||
Caption = 'Use this URL to start app'
|
||||
OnChange = RBUseURLChange
|
||||
@ -136,9 +135,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = CBRunOnReady
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 154
|
||||
Width = 168
|
||||
Height = 23
|
||||
Top = 177
|
||||
Width = 194
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Project needs a HTTP Server'
|
||||
OnChange = CBUseHTTPServerChange
|
||||
@ -149,9 +148,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideTop.Control = CBMaintainHTMLFile
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 36
|
||||
Height = 19
|
||||
Top = 104
|
||||
Width = 294
|
||||
Height = 23
|
||||
Top = 119
|
||||
Width = 341
|
||||
BorderSpacing.Left = 24
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Use Browser Console unit to display writeln() output'
|
||||
@ -162,8 +161,8 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 25
|
||||
Top = 341
|
||||
Height = 30
|
||||
Top = 336
|
||||
Width = 138
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
@ -178,9 +177,9 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 156
|
||||
Height = 25
|
||||
Top = 341
|
||||
Width = 160
|
||||
Height = 30
|
||||
Top = 336
|
||||
Width = 161
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 6
|
||||
@ -189,4 +188,21 @@ object Pas2JSProjectOptionsFrame: TPas2JSProjectOptionsFrame
|
||||
OnClick = BResetCompileCommandClick
|
||||
TabOrder = 11
|
||||
end
|
||||
object BMakePas2jsPoject: TButton
|
||||
AnchorSideLeft.Control = BResetCompileCommand
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 323
|
||||
Height = 30
|
||||
Top = 336
|
||||
Width = 133
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'Make pas2js project'
|
||||
OnClick = BMakePas2jsPojectClick
|
||||
TabOrder = 12
|
||||
end
|
||||
end
|
||||
|
@ -18,6 +18,7 @@ type
|
||||
{ TPas2JSProjectOptionsFrame }
|
||||
|
||||
TPas2JSProjectOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||
BMakePas2jsPoject: TButton;
|
||||
BResetRunCommand: TButton;
|
||||
BResetCompileCommand: TButton;
|
||||
CBRunOnReady: TCheckBox;
|
||||
@ -31,6 +32,7 @@ type
|
||||
RBStartServerAt: TRadioButton;
|
||||
RBUseURL: TRadioButton;
|
||||
SEPort: TSpinEdit;
|
||||
procedure BMakePas2jsPojectClick(Sender: TObject);
|
||||
procedure BResetCompileCommandClick(Sender: TObject);
|
||||
procedure BResetRunCommandClick(Sender: TObject);
|
||||
procedure CBMaintainHTMLFileChange(Sender: TObject);
|
||||
@ -204,6 +206,15 @@ begin
|
||||
SetDefaultWebCompileOptions(PRJ.LazCompilerOptions);
|
||||
end;
|
||||
|
||||
procedure TPas2JSProjectOptionsFrame.BMakePas2jsPojectClick(Sender: TObject);
|
||||
Var
|
||||
Prj : TLazProject;
|
||||
|
||||
begin
|
||||
PRJ:=LazarusIDE.ActiveProject;
|
||||
PRJ.CustomData.Values[PJSProject]:='1';
|
||||
end;
|
||||
|
||||
procedure TPas2JSProjectOptionsFrame.CBUseHTTPServerChange(Sender: TObject);
|
||||
begin
|
||||
CheckServerOptions(CBUseHTTPServer.Checked);
|
||||
@ -330,8 +341,9 @@ begin
|
||||
// Clear everything
|
||||
With PRJ.CustomData do
|
||||
begin
|
||||
Remove(PJSProjectWebBrowser);
|
||||
Remove(PJSProject);
|
||||
Remove(PJSProjectHTMLFile);
|
||||
Remove(PJSProjectNodeJS);
|
||||
Remove(PJSProjectMaintainHTML);
|
||||
Remove(PJSProjectWebBrowser);
|
||||
Remove(PJSProjectRunAtReady);
|
||||
@ -341,6 +353,7 @@ begin
|
||||
// Set what is needed
|
||||
if CBWebProject.Checked then
|
||||
begin
|
||||
PRJ.CustomData[PJSProject]:='1';
|
||||
PRJ.CustomData[PJSProjectWebBrowser]:='1';
|
||||
With CBHTMLFile do
|
||||
if ItemIndex<>-1 then
|
||||
|
@ -59,8 +59,7 @@ uses
|
||||
{$IFDEF UNIX}
|
||||
baseunix,
|
||||
{$ENDIF}
|
||||
|
||||
fpjson,frmpas2jsatompackagesettings, CompOptsIntf,
|
||||
fpjson,frmpas2jsatompackagesettings, CompOptsIntf, pjscontroller,
|
||||
NewItemIntf, MenuIntf, pjsprojectoptions, pjsdsgnoptions, strpas2jsdesign;
|
||||
|
||||
Var
|
||||
@ -479,6 +478,8 @@ Var
|
||||
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);
|
||||
|
@ -55,7 +55,7 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
fpjson,frmpas2jsvscodeextensionsettings, CompOptsIntf,
|
||||
fpjson,frmpas2jsvscodeextensionsettings, CompOptsIntf, pjscontroller,
|
||||
NewItemIntf, MenuIntf, pjsprojectoptions, pjsdsgnoptions, strpas2jsdesign;
|
||||
|
||||
Var
|
||||
@ -451,6 +451,8 @@ Var
|
||||
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);
|
||||
|
@ -110,6 +110,16 @@ Resourcestring
|
||||
pjsdDirectoryNotFound = 'directory "%s" not found';
|
||||
pjsdFileNotExecutable = 'file "%s" not executable';
|
||||
pjsdFileNameDoesNotStartWithPas2js = 'filename does not start with "pas2js"';
|
||||
pjsdHTMLFilter = 'HTML Files|*.html|All files|*.*';
|
||||
pjsdHTMLSourceFileNotFound = 'HTML Source not found';
|
||||
pjsdHTMLFileNotFound = 'Cannot file the HTML Source file for this class:'#13#10+
|
||||
'%s'#13#10+
|
||||
'Would you like to select the file from disk?';
|
||||
pjsdBtnSelectFile = 'Select the file';
|
||||
pjsdButtonCancel = 'Cancel refresh';
|
||||
|
||||
pjsRefreshClassFromHTML = 'Refresh class from HTML source';
|
||||
pjsRefreshAllClassesFromHTML = 'Refresh all classes from HTML source';
|
||||
|
||||
function SafeFormat(const Fmt: String; const Args: Array of const): String;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user