Refactor menu code, and move it to menu.c
Supply new method for key binding
It is annoying that every menu item needs its X-specific handler routine,
because this handler has to be registered to X for becoming eligible as
a key binding. Another disadvantage of this method is that the user wanting
to make the binding has to know the name under which the menu function
is registered (e.g. FlipViewProc).
A new method is now made available, which uses only a single (X-specific)
routine, registered with X as "MenuItem", as generic key-binding handler.
The bindings can then be made by the user specifying "MenuItem(FlipView)".
This requires a new list of potential bindings, which should be filled
by the menu-creation routines. (Currently only contains only a predeficed
example.)
No longer register all MenuProcs with X
The list with available menu procs is moved to the user-maintained
menuItemList. Only QuitProc had to stay registered with X, because it is
used in CatchDeleteWindow. (So it is in both lists now.) In the future,
most of the list can be built automatically from the menu tables.
Alter type of MenuProcs to void(void)
By getting rid of the argument list with X-types, most menu procs can
become back-end. In the cases of ManProc and QuitProc the original
version had to be kept as well, because in ManProc the argument was
actually used (with key binding), while QuitProc is used for delete window.
Remove now unnecessary menu wrappers
Now the MenuProc have an empty argument list, those that also call a
single 'MenuEvent' without arguments have become completely redundant,
and have been taken out of the loop by calling the corresponding MenuEvent
directly.
Build menuItemList from menu tables
Rather than having an initialized table of name-proc associations (which
used to be the X registrations) for the menu items, we now build the list
during menu cration from the menu tables. The menu "ref" is now used as
proc name. This means the old MenuProc names used in the predefined
key bindings had to be changed to conform to this. Note that the bindings
would slice up names containing spaces in several parameters, so in the
translations the spaces were squeezed out of the item names. This requires
a hand-written comparison routine Equal() to identify the binding.
Remove prototypes of deleted MenuProcs
Move prototypes of platform-independent MenuProcs to menus.h
Create a new header file for the menu stuff, so that we can move
the corresponding handler routines out of xboard.c to a back-end file.
Extract back-end code from menu creation
The menu tables and code to interpret them is moved to a new file menu.c.
Only basic fuctions for creating a pop-down list and for adding an item
to it remain in xboard.c.