Multiple Rocviews

Windows

In Rocrail larger layouts or single modules can be arranged on different layers to gain a better overview. Doing so, however, it is necessary to switch between the layers frequently in order to see what is happening on a particular part of the layout.
Rocrail's client/server architecture in addition allows a more sophisticated procedure: Multiple instances of Rocview - all connected to the same server - are started, each showing a different part of the layout or user interface.
This chapter explains how to set up multiple instances of Rocview step-by-step.

In this example it is shown how the following four freely arrangeable windows are configured:

Window 1: Locomotive table

Window 2: Modul 1 (Buchrain)

Window 3: Modul 2 (Grabtief)

Window 4: Switch panel (miscellaneous outputs to switch light, etc.)

Only one computer is used in this example but because of Rocrail's architecture it is easily possible to realise a similar approach with more computers, e.g. showing each module on a different (client-) computer.

Step 1: Creating the ini files

Because each window gets a different layout each window requires its own .ini-file. For this reason the existing rocview.ini is copied four times into the working directory of Rocview and renamed accordingly. In the above example the result is:

Step 2: Setting up the windows

In this step the copied .ini-files are customised to the particular demands. To do this a command line window (DOS-Box or terminal) is opened and Rocview is started using the particular ini-file:

rocview -i rocview_locos.ini

The opened window is customized by dragging the window elements according to your needs. In the following screen-shot only the locomotive table is shown for example:

The window showing the switch pane looks like this:

After closing Rocview the window properties are saved in the respective ini-file which can be easily checked by opening the window again using the same command. To display single layers these are in a first step activated manually and the window is arranged in order to show the basic elements of the layer.

Step 3: Linking levels and windows

After finishing the work of the last step it is noticeable Rocrail always opens the first layer of a track-plan.
However, this behaviour can be influenced by the parameter s during program start.

rocview -s 2 -i rocview_panel.ini

With paramter s it is possible to choose the layer to be activated in the window. The argument is the index of the layer which can be seen from the order of the displayed layers. In the example of this manual the layers are shown in the following order:

Buchrain –> Index 0

Grabtief –> Index 1

Panel –> Index 2

Step 4: Creating a startup script for the big view

Server is already running

The server rocrail.exe in this case must already running before starting the Rocview instances on the same or other hardware.
To avoid further starts of instances in all special rocview.ini files the option startdefaultworkspace="false" must be set.

Note: For the case, the start of server should be done with the start of the first Rocview instance, see Server in workspace.

It is possible to create shortcuts for each call of Rocrail, however, a more elegant approach is to use a small script (see following examples for Windows and Linux):

Windows:

If this script is called Rocview is started four times, each window with the corresponding content.
If you get error messages about problems with the "clipboard" while starting the Rocview instances just insert

ping -n 2 127.0.0.1 >NUL

between each call. This will add a delay of 1-2 seconds and the Rocview instances will start smoothly.

Linux:

The notices to insert delays into the Windows start script apply equally well under Linux.

Server in workspace

For the case, the start of server should be done with start of the first Rocview instance1), the option startdefaultworkspace="true"should only be set in the special rocview.ini files for the first Rocview instance.
In all other special rocview.ini files should be set the option startdefaultworkspace="false".
In the startup script above between the first Rocview instance and the start of all other instances should be inserted a delay, that give the server a time of 5-6 sec to start.

ping -n 6 127.0.0.1 >NUL

If this works, shorter time can be tried.
With slowly hardware and / or big layouts the time may have to be extended.

Step 5: Fine tuning the windows positions

As a last step the arrangement of the windows is remaining. In order to do this the windows are simply dragged to their desired positions. If the windows are closed after the fine tuning their respective positions are saved and the arrangement is restored after the next start:

Remark:
with the ping command we give the computer some time to start the Rocrail server and the 2 Rocview screens in a sequential order, this may look slow, but without the timing it doesn’t work well.

Save the Shell program script with a recognisable name like: Start dual Rocview.sh

Step 6: execute the shell program script

After double click the script it starts executing. You may get errors due to the fact that the path's in the script are not correct.

This can only be fixed by getting exaclty the correct paths in the script…and some patience…

Then after a few seconds the two Rocview windows will be opened, like:

Remark:

It may be the case that you have to select manually (tab view) in the Rocview window which Rail plan you want to see in which window. I wasn’t able to get that automated too.

Step 7: Create a shortcut form the Shell program to be placed in the Dock

Create a shortcut of the Shell program which enable you to put that in the Dock.

1. Start the Automator

2. Select in the Automator Library: execute Shellscript

3. Drag the Library script to the right panel

4. Empty the existing content in the script

5. Open in the Start Rocview.sh script (with Terminal)

6. Select the content in the script en copy

7. Past the content in the Automator empthy windown in the right panel

8. Test your Automator script with ‘push’ the execute button in the right uppercorner

9. If it correct works, save your automator script with a valid name

10. Drag the Automator script in the Dock

11. Click on the Automator icon and Rocrail will start with 2 Rocview windows.