Fix browsing for save file in WB

The generic popup browse buttons used the wrong flavor of browser,
which would only accept existing files. This was inconvenient when browsing
for a save file. The other flavor of browser is now used by default (so that
engine options also use it), and a new flag is added in the option.max field
(which was already indicating file type) to request readonly browsing for a
save file.
Fix parsing crazyhouse promotions with legality testing off

With legality testing off, any promotion suffixes in a move are taken
'on faith'. But in crazyhouse the piece ID for normal pieces is used as
promotion suffix for promoted pieces, so this would Loop Chess rather than
Crazyhouse. Now attention is payed to presence of ID-less promotion pieces
(indicated by ~ in the pieceToCharTable), and if there are, these prevail
ovr the specified type.
Extend smallLayout regime up to size Medium

Because of the increase number of menus, there is not enough space for a
title next to the menu bar at smaller sizes. In fact it is questionable if
the title should ever go on the same line as the menu bar.
Fix PV sorting during fail low

When an engine reports a fail low as thinking output, and then re-searches
the same move with larger window, it now gets a lower score. This line
would then be sorted below the earlier fail low, because it was mistaken
for a multi-PV line for an inferior move. This patch suppresses PVs
overtaking each other if they start with the same move.
Fix memory corruption through InitString and second-engine loading

The InitString and ComputerString options were not swapped when replacing
the second engine, so that the ChessProgramStates of the first engine
could point to an invalid (already freed) init string. Also make sure
that appData.directory contains its value in allocated memory, even
when hand-loading engines.
  Some of the rare options were not swapped either, and would thus
always be loaded for the first engine when -singleEngineList was true.
They are now also all reset to their default, before engine load,
to prevent options of one engine to linger on for a next that does
not specify them. The intentional exception is -firstHost.
Silence unjust warning
Implement Narrow button in WB Game List
Switch to using listboxes for engine-selection in WinBoard
Install engine within current group
Remove some unused (exclude-moves) variables
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.
Switch to use of short menu references

The prefixes menuXxxx. for the item names are abolished. This made it
necessary to also add a MarkMenuItem function that can handle short names
for putting the xMarkPixmap on the items, as the names returned by
ModeToWidgetName are used for both enabling and check-marking.
Let MarkMenu use MarkMenuItem wrapper
Move more back-endish menu-related stuff from xboard.c to menus.c

Move menu enabling to menus.c
 Only the wrapper EnableMenuItem stays in xboard.c. A new wrapper
 EnableButtonBar was necessary, because Training mode wants to enable/disable
 that too.
Move all back-endish MenuProcs to menus.c
 Many if the MenuProcs that could not be eliminated by listing the
 corresponding back-end MenuEvent function as handler directly, are
 still completely plactform indpendent. (E.g. when the MenuEvent needs
 a parameter.) These are all moved to menus.c now.
Convert all dead MenuProcs to using MarkMenuItem
 The MenuProcs for the option items that no longer exist were also
 converted for check-marking their item in the new way, because we
 might revive them for key binding.
Move the dead MenuProcs also to menus.c
Revive dead menu procs
Move GreyRevert to menus.c
Move ModeToWidgetName to menus.c
Move initial menu marking to menus.c

A new function InitMenuMarkers was split off from main() to do this.
Contract some awful code replication

The code for making an X-color was replicated 6 times, and is now made
into a subroutine. The code for creating GCs was quite repetitive as well.
Split back-endish part off drawing code and move to board.c

Split DrawSquare in front-end and back-end part
Back-endize DrawHighlights and DrawPosition
 The already existing wrapper FlashDelay is used as a kludge to do an XSync.
 We now pass a code for the line color GC to the highight routine. New
 wrappers are DrawGrid() and DrawBorder().
Back-endize atomic explosions
Back-endize DrawArrow and DrawDragPiece
 DrawDragPiece now calls DrawOneSquare with argument EmptySquare in stead
 of the X-type referring BlankSquare. A new wrapper DrawPolygon fixes
 DrawArrowBetweenPoints.
Move board-drawing logic to new file board.c
 All X-independent drawing logic (board, squares, arrows, highlights,
 some animation stuff) has been extracted from xboard.c, and moved to
 a new file board.c, which is back-end (but unshared with WinBoard).
 A new header board.h defines the cross-references (which of course
 required some functions to be no longer declared as static).
  A bit of code was moved from DragPieceBegin to BeginAnimation, which
 now has an extra argument to indicate which piece should appear from
 under a dragged piece. This makes DragPieceBegin free of XCopyArea calls,
 so it could be moved too.
Make board.c truly back-end
 Get rid of all X data types. For this the AnimState struct had to be
 redefined: the GC and Pixmap was taken out and put in front-end arrays
 indexed by anim agent (game and player). For this indexing a new enum
 was defined. The XPoint type was also replaced by our own type of an
 int pair (which is nasty, because the int size could be different).
Move more animation code to board.c
Declare some shared global variables in backend.h

The vlobals twoBoards and partnerUp were only shared through an extern
declaration in xboard.c
Split back-endish part off xoptions.c, and move to dialogs.c

Some MenuProcs for dialogs were also moved to dialogs.c from menus.c.
MoveTypeInProc which is an event handler for the board widget,
was moved to xboard.c, where it can be static.

Identify dialogs by enum type
 A new header dialogs.h is created, which defines an enum type DialogClass
 that is now used to identify the various dialogs done by GenericPopUp.
 The prototypes for GenericPopUp/PopDown, and other globals shared by the
 dialogs code and other modules can go in here as well.
Remove ClearTextWidget
 This did the same as SetWidgetText with an empty string.
Split X-code from PutText
Split back-end part from MoveTypeInProc
Take set-title out of comment popup
Sort MenuProcs in dialogs.c with their support functions
Declare globals in dialogs.c with functions where they belong
Add prototypes to dialogs.h
Move prototypes and globals from xoptions.c to dialogs.h
Make accessor DialogExists for dialog shells
Add dialogs.c to makefile: compiles and runs!
Combine 3 calls into front-end to InitDrawingParams
Move EditCommentProc and ICSInputBoxProc to dialogs.c
Pass option list as argument to GenericUpdate and GenericReadOut
Shorten argument name from currentOption to opts
 This to prevent confusing it with the global variable of that name.
Move some back-endish routines from xboard.c to dialogs.c

Move ICS input-history handling to dialogs.c
Move ICS Input Box text handling to dialogs.c
Move DisplayXxxx routines to dialogs.c
Move DisplayTitle to dialogs.c
 A wrapper SetWindowTitle remains in xboard.c.
Cleanup of xboard.c

Remove AskQuestionProc
A bit of cleanup on xboard.c prototypes
Remove dead file-browser code
Delete vestigial jail code
 All the stuff about jailColor was deleted. Only one fishy thing remains:
 xpmJailSquare seems under some conditions used in BlankSquare to draw a
 'neutral' square. it is set to a copy of a light square image. But in the
 current design 'neutral' means blacked out between board and holdings,
 and even with image use, it should not resemble a light square...
Remove registering of CommentPopDown and TagsPopDown
Merge CopyGameSelection into CopyPositionSelection
Remove one level of indirection on ICSInputBoxPopUp