|
SciTE Director Interface |
Software development does not occur only at the single file level handled by SciTE. A developer will generally work on a group of related files together in the context of one project. Project manager functionality could be added to SciTE as it has to other editors but this would impose a particular view of how projects are to be managed including the format of project files. Instead, SciTE has an interface that can be used by project managers or similar applications to control SciTE. Any application that controls SciTE is referred to as a "Director".
The current Director interface only works on Windows and GTK/Linux. In the future, it should be possible to replace the low level interface and so make this interface available on other platforms.
There is currently one director application, Filerx, available.
This interface is implemented on top of the SciTE Extension Interface, in the file scite\win32\DirectorExtension.cxx.
One application at a time is the director of SciTE, controlling SciTE as it wishes. To support other communications techniques applications may broadcast to all active director interfaces. When doing so, each message should contain an explicit return address where replies to the broadcast message will be sent.
The Windows WM_COPYDATA message is used to transfer data between SciTE and a Director. The messages are sent between windows created by the two applications. SciTE uses a window that has no other purpose than to receive these messages. The lpData and cbData fields of the COPYDATASTRUCT are used to transfer a string between the two processes, with cbData holding the length of the string pointed to by lpData. The string does not have to be terminated with '\0'. The dwData should be 0.
Before messages can be sent from one application to the other, the window handle of the window to receive the message must be found. This is normally transferred when starting the other application as a command line parameter. Either application may start the other. SciTE makes its window handle available in the WindowID property and accepts a director.hwnd property as the window handle to which it sends data.
As an example of communicating the window handle, to install Filerx in the Tools menu of SciTE these properties could be used:
In the opposite direction, Filerx can start up SciTE with a command line that specifies its window handle as well as the file it wants edited:
Once one application has the window handle of the other application, it should send its window handle to the other application using an identity message as described later. Then both sides are able to send messages.
To broadcast a message on Windows, the set of active director interfaces can be found by broadcasting the "SciTEDirectorInterface" message and seeing which windows reply with the same value as that message. Example broadcast code:
To advertise that a top level window supports the Director interface:
An input fifo for each application supporting the director interface located in the temporary directory (obtained through GLib g_get_tmp_dir() call), with a name using a pattern such as "/tmp/SciTE.<PID>.in". This allows enumerating all active director interfaces and also op