Introduction
This chapter offers a small example to illustrate some of the possibilites
of Neo. Before we embark on a tour through Neo to explain how to create
interactive visual programs like this one, we first explain a few basic
things:
Neo windows
Neo is a graphical "workbench" to assemble applications at a high level
of abstraction by connecting pre-fabricated objects, called "NST-units"
into data flow diagrams or "circuits". A circuit is displayed and
edited in the large, lower circuit window, using commands at the
Neo command level (this is the level you are currently in). As a
first illustration, load example#1
(first click at the hyperlink, then move the cursor into any of Neo's windows:
a short loading message should pop up, then the loaded circuit should appear.
If this does not happen, consult the previous
chapter to see what might have gone wrong [did you have a running Neo
instance, started with neo -i :netscape ?]).
Most Neo commands are issued by selecting a button from the leftmost,
tall command menue window. Two further Neo windows are the folder
window (left adjacent to the circuit window; it allows to fetch NST-units
from a folder, which is a library of NST objects) and the wire edit
window (to the right of the circuit window; it allows to display and
edit the internals of a Neo wire). These together are comprise the main
Neo windows. The folder, circuit and wire edit window can be hidden by
selecting the
"Hide" button in the command menue (try it). The remaining
windows (if there are any) belong to the currently displayed application.
As long as you are at the Neo command level, these windows will be unresponsive,
since the application is not active in this mode and you can only use the
above described Neo windows.
How to activate an application
To activate the application (execute its circuit) you select "Step"
from the command menue. This (temporarily) leaves Neo command level (all
Neo windows become unresponsive) and passes control to the application
(and its windows, if it has any). The similar command "Run" will
repeatedly "Step" an application a fixed number of times (which can be
set with the "Prefs" command). In the present example, you will
be able to change with the vertical sliders on the right two graphics parameters
that control the generated rosetta pattern (try it).
To return back to Neo command level, you must end the application. The
necessary command will be application specific (in the present case, select
the "End" button in the application window). If the application
is non-interactive, you may simply have to wait until the application has
completed (if this takes only a fraction of a second you may fail to notice
that you temporarily had left Neo command mode).
How to interrupt a
running application
If you select in the "Prefs" command menu the option "Allow
user interrupt in loops", you can cleanly escape from long loops in a running
application by pressing the ESC button. However, activation of this feature
may incur a significant performance penalty. No matter whether this feature
is set or not, there is always a "dirty way" to interrupt an application
forcefully by typing CTRL-C in the shell from which Neo was started.
However, this may leave "dead" data objects in memory, so you may wish
to save the current session and reload it into a newly started Neo process.
Neo circuit buffers
Neo has five "circuit buffers" to hold up to 5 different application
circuits in memory. You can step through these applications (i.e., fetch
their circuit diagrams into the circuit window and their application windows
on the screen) by toggling the topmost command menu button that is labelled
"Circuit#0"
initially (clicking on its right/left for the next/previous buffer) or
by pressing ALT-i (with i=0..4) from the keyboard.
All operations (edits, "Step" etc.) always refer only to the application
whose buffer is currently selected by this button. The "Prefs" command
allows you to set preferences for each of the five buffers individually.
How to
select, cut, copy and move circuit objects
Most selections in Neo are done with the left mouse button. To select
a single icon, wire or annotation in the circuit window, just touch it
with the mouse pointer and click the left mouse button. To select an entire
group of objects, first "anchor" one corner point of a suitable bounding
rectangle, then (while holding the mouse button down) stretch out the bounding
rectangle to a suitable size and shape. When you then leave the left mouse
button, all objects within the bounding rectangle will have become selected
(you can unselect the group by tracing out a mini-rectangle that encloses
nothing). Alternatively, you can select on an individual basis by holding
the left Shift key while selecting objects with the left mouse pointer.
Once a selection is ok, you can translate the selected group (again with
the left mouse button - hold it down while translating), or you can invoke
the Neo "Move" command (from the command menue) to "transplant"
the entire group to, e.g., a different circuit buffer or into a different
container. The Copy command will create a copy of the currently
selected group and make the copy the newly selected set of objects (so
that the copied set can be easily transported with a subsequent Move).
Finally, the "Clear" command allows to clear (delete) all selected
objects (or even all objects in the current circuit window). Note that
there is no Undo operation! (However, you can at least activate
a warning against attempts to delete containers that enclose a subcircuit;
the warning is enabled or disabled in the Prefs menu).
How to save and load
an application
To save the currently selected application, choose "Save_As" from
the command menu or type ALT-S from the keyboard and enter a file
name in the dialog box that appears. Usually, you don't need to specify
a suffix, Neo will add the default suffix
".NST" and, in case the
"gzip" dialog button is on, another ".gz" suffix to indicate compressed
(gzipped) storage. The tutorial circuits, however, all end on the non-standard
suffix ".HNST" (to distinguish them from files for the .nstplugin,
which uses the suffix ".NST" for a different way of loading). Apart
from the compression-option, you can store the program in three different
ways:
(i) without data (i.e., the values of state variables, such as the
current settings of the application window sliders or the window positions
on the screen),
(ii) with data saved in the same file or
(iii) with data saved in a separate file (which then will have a
".nst" suffix instead).
The recommended choice is (ii), i.e., data in the same file. You can now
load the saved program back with the "Load" command (ALT-L
from the keyboard). This opens a little browser, showing the contents of
the current directory. You can now either select the desired circuit file
from the browser, or enter its name directly in the bottommost input line.
Note that the listing of displayed files is a subset that is filtered
by the string pattern given in the Filter entry. When you change
the filter string, you must click at the topmost line of the listing (this
line shows the name of the displayed directory) in order to re-filter the
directory with the new filter string.
Selecting "Ok" will load the specified file (if instead of a
file name you entered a
directory name with a '/'
end character,
"Ok" will re-initialize the browser contents with
that directory). If the currently selected circuit is not empty and there
is still an unoccupied buffer, Neo will load the circuit into that buffer
and make it the new selected buffer. The current circuit is only overwritten,
if no further free buffer is available (in this case, Neo first asks for
permission to perform the "Load" command).
How to bring
up information about a NST unit
Almost all NST units have a detailed manual page in both HTML and nroff
format. You can display the manual page by clicking at the little '?'-mark
in the unit's icon in the folder window. When you have started Neo with
the option -netscape (the recommended way; you may wish
to specify it as a permanent option in your .neo configuration file) and
a Netscape instance is running, Neo will automatically send the HTML manual
page into the Netscape window. Otherwise, Neo will open up a text viewer
for the nroff manual page version (the current Neo viewer is blocking,
i.e., you must close it to continue with other Neo commands). The same
happens when you press CTRL-Q while the text cursor is
inside a text entry field of the creation or parameter dialog window of
a particular unit.
When you instead click at the little 'e' of an icon in the example
window, Neo will load an example circuit that illustrates the unit's behavior.
Unlike the examples in the present tutorial, the 'e'-examples are
not connected by hyperlinks in a particular "trail"; so it is recommended
to inspect them later, when you have already gained some familiarity with
Neo/NST.