Difference between revisions of "lazarus pas2js integration/ru"

From Lazarus wiki
Jump to navigationJump to search
Line 13: Line 13:
 
* [[lazarus_pas2js_integration#Project_Wizards|2 project wizards]]
 
* [[lazarus_pas2js_integration#Project_Wizards|2 project wizards]]
 
* [[lazarus_pas2js_integration#Debug_window|A debug window]]
 
* [[lazarus_pas2js_integration#Debug_window|A debug window]]
== Global options ==
+
== Глобальные настройки ==
In the Tools/Options... dialog, the Pas2JS section allows you to set some options that affect the IDE integration. It looks like this:
+
В диалоговом окне Tools/Options... в разделе Pas2JS можно указать некоторые параметры, которые влияют на интеграцию IDE. Это выглядит так:
  
 
[[File:pas2jsdsgn_globaloptions.png]]
 
[[File:pas2jsdsgn_globaloptions.png]]
  
The following settings are available:
+
Доступны следующие настройки:
  
* Path of pas2js.<br/> This is the compiler binary used when setting up a new project.<br/> It will be searched in the PATH if no absolute path is set. Corresponds to IDE macro ''Pas2JSJS''.
+
* '''Path of pas2js''' (Путь к pas2js)<br/> Это двоичный файл компилятора, используемый при настройке нового проекта. <br/> Он будет найден в переменной PATH, если не указан абсолютный путь. Соответствует макросу IDE ''Pas2JSJS''.
* Path of simpleserver.<br/> This is the webserver that is started when a project is run that needs a webserver.<br/> This is by default the simpleserver application from the FPC project, but can be another webserver, as long as it accepts the -p option to set the path, and it serves files from the directory in which it was started..
+
* '''Path of simpleserver''' (Путь к простому серверу)<br/> Это веб-сервер, который запускается при запуске проекта, для которого требуется веб-сервер. <br/> По умолчанию это приложение simpleserver из проекта FPC, но оно может быть другим веб-сервером, если оно принимает параметр -p для установки пути, и он обслуживает файлы из каталога, в котором он был запущен.
* Port numbers to start allocating from.<br/> Every time you start a new webserver project , a new port number is allocated for the webserver. (you can still edit this in the new project dialog).
+
* '''Port numbers to start allocating from simpleserver''' (Номера портов, чтобы начать размещение от простого сервера)<br/> Каждый раз, когда вы запускаете новый проект веб-сервера, для него назначается новый номер порта. (вы все еще можете редактировать это в новом диалоге проекта).
* Browser to use when opening HTML page.<br/> The IDE will use this browser to open your HTML page.<br/> It will be searched in the PATH if no absolute path is set. Corresponds to IDE macro ''Pas2JSBrowser''.
+
* '''Browser to use when opening HTML page''' (Используемый при открытии HTML-страницы браузер)<br/> Среда IDE будет использовать этот браузер для открытия вашей HTML-страницы. <br/> Будет выполнен поиск в переменной PATH, если не указан абсолютный путь. Соответствует макросу IDE ''Pas2JSBrowser''.
* Node.js executable.<br/> The IDE will use this Node.js executable to start a Node.js project. <br/> It will be searched in the PATH if no absolute path is set. Corresponds to IDE macro ''Pas2JSNodeJS''.
+
* '''Node.js executable''' (Исполняемый файл Node.js)<br/> Среда IDE будет использовать этот исполняемый файл Node.js для запуска Node.js проекта. <br/> Будет выполнен поиск в PATH, если не указан абсолютный путь. Соответствует макросу IDE ''Pas2JSNodeJS''.
  
 
== Project Wizards ==
 
== Project Wizards ==

Revision as of 20:32, 21 December 2018

English (en) русский (ru)

Интеграция pas2JS в Lazarus

Требуется Lazarus 1.9+ и, либо снапшот pas2js, либо svn-архив (см. здесь).

Установите пакет pas2jsdsgn (components/pas2js/pas2jsdsgn.lpk) и перезапустите IDE.

Затем задате путь к pas2js (pas2jsfolder\compiler\utils\pas2js\pas2js.exe) в Tools / Options / Environment / Pas2JS / Path of pas2js.

Интеграция pas2js в Lazarus состоит из 3 частей:

Глобальные настройки

В диалоговом окне Tools/Options... в разделе Pas2JS можно указать некоторые параметры, которые влияют на интеграцию IDE. Это выглядит так:

pas2jsdsgn globaloptions.png

Доступны следующие настройки:

  • Path of pas2js (Путь к pas2js)
    Это двоичный файл компилятора, используемый при настройке нового проекта.
    Он будет найден в переменной PATH, если не указан абсолютный путь. Соответствует макросу IDE Pas2JSJS.
  • Path of simpleserver (Путь к простому серверу)
    Это веб-сервер, который запускается при запуске проекта, для которого требуется веб-сервер.
    По умолчанию это приложение simpleserver из проекта FPC, но оно может быть другим веб-сервером, если оно принимает параметр -p для установки пути, и он обслуживает файлы из каталога, в котором он был запущен.
  • Port numbers to start allocating from simpleserver (Номера портов, чтобы начать размещение от простого сервера)
    Каждый раз, когда вы запускаете новый проект веб-сервера, для него назначается новый номер порта. (вы все еще можете редактировать это в новом диалоге проекта).
  • Browser to use when opening HTML page (Используемый при открытии HTML-страницы браузер)
    Среда IDE будет использовать этот браузер для открытия вашей HTML-страницы.
    Будет выполнен поиск в переменной PATH, если не указан абсолютный путь. Соответствует макросу IDE Pas2JSBrowser.
  • Node.js executable (Исполняемый файл Node.js)
    Среда IDE будет использовать этот исполняемый файл Node.js для запуска Node.js проекта.
    Будет выполнен поиск в PATH, если не указан абсолютный путь. Соответствует макросу IDE Pas2JSNodeJS.

Project Wizards

The pas2js support is in the pas2jsdsgn.lpk package, which you can find in the components/pas2js directory. It registers 2 wizards in the 'New project' dialog:

  • Web Browser Application
  • Node.js Application

Besides creating an initial project source, both options will also

  • Set up the compiler command for compiling with pas2js
  • change the 'Run' command so the 'Run without debugging' option works: it will open a project in the browser or run it with nodejs.

New Web Browser application

This wizard will ask for some options before generating a new project. The dialog is shown below.

webbrowserappoptions.png

The following options are available:

  • Create initial HTML page. This is self-explanatory,
    the IDE will generate a template HTML page which includes all that is necessary to run the pas2js code.
    The page is included in the project description, so you can open and edit it from within the IDE.
  • Maintain HTML page.
    If you change the name of the project, the IDE will update the references in the HTML File.
    (all your changes will be lost)
  • Run rtl in document.onReady. By default the script tag that starts the ball rolling will call rtl.run().
    Checking this option changes the script, so the rtl.run is run in the HTML document.onReady event instead.
    This is necessary if your code contains startup code that references elements in the HTML.
    The elements will only be available after the onReady event.
  • Use Browser Application object.
    This changes the code to use the TBrowserApplication object.
    This is a TCustomApplication descendent which offers support for query parameters etc. as if they were command-line parameters.
  • Use Browser Console unit.
    Checking this will simply include the browserconsole unit in the uses clause.
    This hooks into the system units writeln command: any output will be appended to the HTML.
    the generated HTML has a div with the correct ID to which the output is appended.
  • Project needs a HTTP server.
    If the project needs a HTTP server, then the IDE can start one for you, or you can indicate the URL to use when the 'Run without debugging' command is used.

Project options

You can change the settings chosen in the new project wizard in the Project Settings dialog. It also allows you to convert any existing (simple) project to a web application project.

The project options are located at the bottom "Web Project (pas2js)'

pas2jsprojectoptions.png

The checkbox at the top marks the project as web browser project.

All other options have the same meaning as their counter parts in the 'New project' wizard.

The ```Reset compile command``` and ```Reset run command``` set the respective commands to thei ddefault values.

Debug window

As you start projects from various directories, the IDE will start webservers as needed. After some time, there can be several webservers running. An overview of running webservers can be shown using the the View/Debug Windows/Pas2JS Webservers menu item.

It shows a list of processes started by the IDE:

webservers.png

Support for stopping/starting processes will still be added, as well as statistics for number of requests etc.

Navigation