xboard.git
12 years agoGive the dual-board option a separate board window
H.G. Muller [Wed, 4 Apr 2012 19:55:50 +0000]
Give the dual-board option a separate board window

The second board window pops up whenever an alien board is received
during your game. Moves in it are highlighted by an arrow, irrespective
of the 'Highlight with Arrow' setting. The clocks are displayed, but do
not count down.

12 years agoPort engine grouping to Match Options dialog
H.G. Muller [Thu, 5 Apr 2012 09:23:03 +0000]
Port engine grouping to Match Options dialog

12 years agoChange default directory in Load Engine to "."
H.G. Muller [Thu, 5 Apr 2012 13:18:25 +0000]
Change default directory in Load Engine to "."

12 years agoPort grouping to XBoard Load Engine
H.G. Muller [Thu, 5 Apr 2012 08:49:56 +0000]
Port grouping to XBoard Load Engine
Add highlight to Load Engine grouping

12 years agoFix default file types for browse buttons
H.G. Muller [Fri, 6 Apr 2012 15:19:33 +0000]
Fix default file types for browse buttons

12 years agoNew browser
H.G. Muller [Tue, 3 Apr 2012 07:14:44 +0000]
New browser

Redo file browser with GenericPopUp

This had to solve quite some problems, because it wanted to use a ComboBox
option while a transient dialog could be up, was a non-engine dialog
while an engine dialog is up, and XRaiseWindow does not work properly.
  Sorting is done alphabetically, or for digit groups by numeric value.

12 years agoUse ListBox in stead of ComboBox in Match-Options dialog
H.G. Muller [Mon, 2 Apr 2012 12:43:24 +0000]
Use ListBox in stead of ComboBox in Match-Options dialog

12 years agoUse ListBox in stead of ComboBox in Load Engine dialog
H.G. Muller [Mon, 2 Apr 2012 12:09:15 +0000]
Use ListBox in stead of ComboBox in Load Engine dialog

Make Load Engine listbox sensitive to double-clicking

12 years agoAdd message about enabling in New Variant dialog
H.G. Muller [Mon, 26 Mar 2012 15:06:33 +0000]
Add message about enabling in New Variant dialog

12 years agoMove LoadGamePopUp to menus.c
H.G. Muller [Sat, 31 Mar 2012 18:27:20 +0000]
Move LoadGamePopUp to menus.c

12 years agoMove DisplayMessage to dialogs.c
H.G. Muller [Sat, 31 Mar 2012 18:25:22 +0000]
Move DisplayMessage to dialogs.c

Use the wrapper SetWidgetLabel to make it back-end.

12 years agoFix switching debug option during session.
H.G. Muller [Sat, 31 Mar 2012 13:23:30 +0000]
Fix switching debug option during session.

Switching on debug mode during the session did not create the requested
debug file.

12 years agoCorrect texi file for use of .Xresources
H.G. Muller [Sat, 31 Mar 2012 13:22:57 +0000]
Correct texi file for use of .Xresources

12 years agoFix recent-engines menu
H.G. Muller [Mon, 2 Apr 2012 17:19:30 +0000]
Fix recent-engines menu

A new primitive to create an item in a given menu was added to do this.

12 years agoSwitch back two two-part menu names
H.G. Muller [Sat, 31 Mar 2012 08:54:22 +0000]
Switch back two two-part menu names

The menu code is again completely changed; a handle field is added
to the MenuItem tables to store the widget for the item, and this info
is used to alter sensitivity or marking. MenuToNr is replaced by
MenuNameToItem, which looks up the two-level name directly in the
menu tables. Put all currently unused MenuProcs in noMenu table,
so they are available for key binding through the new method.

12 years agoRedo main board window with generic popup
H.G. Muller [Sat, 24 Mar 2012 17:36:44 +0000]
Redo main board window with generic popup

Some of the improvements in GenericPopUp (committed earlier) were added
especiall for this (menu and box Option types), and the commits that used
them to make a fully functional board, listed below, were collapsed into
this one.

This uses the new box and menu features of the Generic popup.
Make option table shadow board consistent with refactor
Do main menus in shadow board
 The board made by GenericPopUp now also has (functional) menus. The Expose
 callback now also uses the new format (passing coordinates).
Use BoxEnd callback to decide about smallLayout
 The shadow board now dynamically decides whether it should use smallLayout
 positioning of the title-in-window widget, using a callback in the BoxEnd
 option for the menu bar: If no reasonable amount of space is left behind
 the menu bar, the title is forced under the clocks (smallLayout).
Do some mouse handling on shadow board
 Only button 1 events for now. We have to keep track if the button is down!
Connect button 3 to shadow board
 For now only for piece and PV manipulation: no context menus yet
Symbolic reference in option formatting
choice <-> textValue xboard.c
Improve expose callback shadow board
Implement context menus of shadow board
 This uses the new generic PopUp option
TopLevel xboard.c
Make mock-up board available through menu item
Make clocks of shadow board sensitive to clicking
Make button bar of shadow board operational
 The back-end Event functions are specified as user callbacks directly;
 this is not very clean, as they are parameterless, but called with an int
 argument. This should have no bad consequences, though.
Switch to using shadow board as main board
 The menu marking and enabling had to b switched off for this, as it
 only worked on the old menus. Remove HandleUserMove.
Deleting of unused shell variables, clocks to dialogs.c
Move BoardPopUp to dialogs.c
 This required passing on fome front-end vars as parameters, and returning
 apointer to the option list, to make the handles available in xboard.c.
Simplify InitDrawingSizes
 Now that all widgets of the main window are properly chained, there is
 no need to resize them when the board format changes: setting a new width
 for the shell suffices.
Cleanup some unused Xt Args

12 years agoRemove unnecessary menu unmarking for Edit Tags
H.G. Muller [Sat, 31 Mar 2012 08:53:46 +0000]
Remove unnecessary menu unmarking for Edit Tags

12 years agoSplit sync-after options in Match dialog into checkbox + label
H.G. Muller [Thu, 29 Mar 2012 17:09:34 +0000]
Split sync-after options in Match dialog into checkbox + label

Now the checkbox texts are highlighted on hovering, we don't want the
explanatory text behind it to be highlighted with it.

12 years agoMake variant-unsupported-by-second error non-fatal
H.G. Muller [Mon, 26 Mar 2012 15:12:33 +0000]
Make variant-unsupported-by-second error non-fatal

12 years agoRedo Eval Graph with generic popup
H.G. Muller [Fri, 23 Mar 2012 19:06:15 +0000]
Redo Eval Graph with generic popup

The Graph option of the GenericPopUp is used to implement the Eval Graph.
Compared to the previous implementation, which was drawing directly in the
form widget, the new one has one extra widget layer, but that did not
affect the code anywhere. Adapt eval title to width of eval graph.

12 years agoRedo Engine Output window with generic popup
H.G. Muller [Fri, 23 Mar 2012 14:17:14 +0000]
Redo Engine Output window with generic popup

A new file nengineoutput.c holds the X-independent code. This makes use
of new capablities of GenerciPopup, for having Label widgets on same row,
stacking panes after a Break, and chaining Label and Text widgets.

12 years agoRedo Game List with generic popup
H.G. Muller [Wed, 21 Mar 2012 22:00:05 +0000]
Redo Game List with generic popup

Check in ngamelist.c
Redo Game List with generic popup
 The X-independent code (i.e. almost all) is moved to a new file
 ngamelist.c.
Make button in Game List to pop up Game List Options
Fix scrolling game list
Fix popup of existing Game List after loading file
Wheel-scroll game list
Symbolic reference game list
TopLevel game list
Put format flags with listbox options

12 years agoRedo Game List Options with generic popup
H.G. Muller [Wed, 21 Mar 2012 16:58:27 +0000]
Redo Game List Options with generic popup

12 years agoAdd -dialogColor and -buttonColor options
H.G. Muller [Thu, 5 Apr 2012 19:56:52 +0000]
Add -dialogColor and -buttonColor options

These only override system defaults if they are non-empty strings.

12 years agoAdd -topLevel option
H.G. Muller [Wed, 28 Mar 2012 13:52:01 +0000]
Add -topLevel option

This persistent Boolean option determines if the auxiliary windows
(Game List, Move List, Engine Output, Eval Graph, Tags and Comment)
use top-level shells (with their own icon on the task bar, and
independently closable). Other dialogs will always use transient shells.
(Also he modal Error and Promotion dialogs, for which the modality
presumably only serves to pop them down without special attention.)
A control for this was added in the General Options dialog.

12 years agoRedo ErrorPopUp with generic dialog
H.G. Muller [Tue, 20 Mar 2012 14:30:00 +0000]
Redo ErrorPopUp with generic dialog

<Enter> keeps popping down error popup.Multiple Error popups remeain tricky;
add comment to describe problem with multiple ErrorPopUps.

12 years agoRedo PromotionPopUp with generic dialog
H.G. Muller [Tue, 20 Mar 2012 09:22:46 +0000]
Redo PromotionPopUp with generic dialog

The dialog is no longer modal.

12 years agoRedo AskQuestion dialog with generic popup
H.G. Muller [Mon, 19 Mar 2012 20:56:48 +0000]
Redo AskQuestion dialog with generic popup

12 years agoMajor refactoring of GenericPopUp
H.G. Muller [Mon, 19 Mar 2012 20:55:58 +0000]
Major refactoring of GenericPopUp

Allow more transient dialogs in GenericPopUp
Remove grab from promotion popup
Fix other generic popup over transient popup
 To use the generic dialog generator for 'asynchronous' popups (Ask Qustion
 or Error popup caused by engine), the currentOptions setting has to be
 restored for the combo and checkbox callbacks of the transient to still
 work after the asynchronous dialog returns. Note that only transient dialogs
 can have check and combo controls.
Make generic calcel button suppressible
 Also #define some more symbols for Option.min flags,
 and move them to dialogs.h.
Change TypeInProc to general OK handler
 The move type-in now has its own option list, to distinguish it from
 the ICS input box, and give it its own OK handler. Rather than having
 the translation for <Enter> on the text widget call TypeInEvent directly,
 we let it call GenericCallback, which calls GenericReadout, which calls
 the OK proc, which does the job.
  To be able to call GenericCallback from the TypeInProc, the recognition
 of OK and cancel buttons had to be changed. This because it was too difficult
 to arrange the calling widget had label OK or cancell. So these buttons are
 no longer recognized by name, but by the option number passed as client data.
 (This solves the problem that a user could not make buttons named 'cancel'
 or 'OK'.)
Make Cancel button optional
Fix closing multiple popups of same kind
 The GenericCallback figures out its own shell, so all buttons of
 multiple dialogs keep working. External calls to PopDown only work
 on the lastcreated instance of that kind, though (including those from
 the Delete Window button, which can do 'cross-closing'). shellUp is now
 a counter, and PopDowns are only prevented when it reaches 0 or the
 current shell does not exist. (To know this, PopDown now resets shells[n]
 to NULL when is shell is destroyed.
  Beware of double PopDowns (through OK procs); they wreck the system.
Fix Delete Window button of multipe ErrorPopUps
 The action routine for handling the Delete Window now pays attention
 to the shell widget that the system passes to it, and temporarily
 replaces shells[n] by it to let PopDown act on the proper instance.
Add ListBox dialog type to GenericPopUp
Fix vert sizing of ListBox
Put listbox widgets in viewport
Put listbox in viewport
Improved xoptions.c support for focussing and listboxes
Fix OK-row button positioning
Let GenericPopUp take parent and modality as arguments
 This makes the code a bit more explicit and less kludgy. It also becomes
 possible to call the same dialog (e.g. Load Options) from the main menu
 and from another dialog (e.g. the Game List).
Support scroll function for generic popup listboxes
Fix scrolling
Move HighlightWithScroll to xoptions.c
Change scroll algorithm
Add mouse-wheel scroll to generic list boxes
Implement tabbing between text edits
Implement same-row text labels in generic dialog
Allow labels to specify their chaining in generic popup
 The opt.min variable is used to specify the chaining: 0xF0 are the bits
 for (left, right) chaining of the left side (0xC0) and right side (0x30).
 The 0xC bits determine top or bottom chaining of the entire label.
 Without anything spcified (0), the chaining is XtRubber.
 TextBox options can also specify top-chaining of their top. All this was
 needed to allow decent implementation of the Engine Output window with
 the generic popup. (Although tags and comment popup ca benefit from the
 latter feature.)
Let GenericPopUp support a Graph option
 The Graph option results in an area where one can draw something. It is
 positioned / chained similar to Label options. A handler for expose events
 can be specified in the textValue field of the option.
Implement box widgets and menu buttons in GenericPopup
 To enhance the capabilities of GenericPopUp such that it could create the
 main window, it needs to be able tha packaging of controls into a box widget
 (for mennu and button bar). Menu buttons are also required elements
 (although they do look a lot like comboboxes?) Option types BoxBegin and
 BoxEnd can now be used to bracket a group of controls that will be put
 in a box widget. (Cannot be used recursively!) The positioning of the box
 is similar to that of a Label, and is specified in the BogBegin option.
  The code to shrink the menu buttons to fit is also incorporated, to act
 on any box widget: if the BoxBegin option specifies a width, the elements
 in it are shrunk to meet the requirement. Otherwise the box just gets the
 size of the sum of its children (plus spacings).
  Label options can now specify a font, casted into their textValue field.
 (This is needed to get the proper size for the clock widgets.)
Implement callback in BoxEnd options
 BoxEnd is a pseudo-option, to trigger packing the preceeding ones in
 an earlier-opened box widget. In the process it calculates the size of
 the box widget (and trims it if a size was specified for it in the
 corresponding BoxBegin). The Option.target field of BoxEnd is now
 interpreted as a callback, which can be use to take decisions based
 on the determined size for the remaining options in the list, before
 these are processed b GenericPopUp.
Refactor xoptions.c
 Make a subroutine to set args shared by almost all widgets. Swap meaning
 of '1'-bit in option.min flag of Break option, to be consistent with
 SAME_ROW interpretation in other option types.
Make option tables consistent with refactored GenericPopUp
 The flag for stacking in the Break option needed to be inverted, and
 the BoardPopUp needed to pass the font in another field. Better use was
 made of the improved chaining options too.
Improve Graph-option event handling
 The user-supplied callback now gets 3 arguments passed: the event type
 (0 = pointer motion, 1...5 button press, -1...-5 release, 10 = expose),
 and two coordinates. For ouse events these are the pointer (x,y), while
 for expose events they are the window size (w,h). The callback is now
 specified in the option.target field of the Graph option.
Store engine options in malloc'ed memory
 The Option.name field has been re-declared as (char*),  from (char[MSG_SIZ]).
 There are still MSG_SIZ chars allocated irrespective of actual size, because
 the field is also supposed to store the textValue, which can be changed by
 the user. But at least it means that unused options of the generous list
 now don't waste much space. (And the prparated Option tables in dialogs.c
 will shrink by a large factor as well.)
Improve GenericPopUp ComboBox handling.
 The dialog type is now passed to the combobox callback as well, and this is
 used to really figure out what option it is called for.
Allow numeric comboboxes
 When no list of strings is given in Option.choice, the target is assumed
 to be (int), and the number of the slected entry is stored there. Also
 adapts the Label options that act as fillers to the new method for making
 dummies (namely NULL in the Option.name field).
Put comboCallback in Option struct
 Rather than having a general comboCallback variable for the entire current
 dialog, each ComboBox option can now specify its own callback in the
 target field of the option: the COMBO_CALLBACK bit of Option.min indicates
 whether the target is a variable to be set or a callback. The callback can
 still fetch the choice from the values array.
Allow generic CreateComboPopup also to do main menus
 An extra parameter to CreateComboPopup determines if the menu texts
 should be taken from a list of strings (the old method with engine-
 supplied choices), or from a menu table of MenuItems. It can now also
 recognize "----" as a menu break, and keeps margins (for the marking).
Make subroutine for determining curren combo selection
Various fixes to GenericPopUp
Delete one border-width setting
Fix max nr of args in GenerocPopUp
Fix button release events of Graph options
Fix generic Graph callback pointer motion coordinates
Make all format referencing in Option tables symbolic
Let Option.choice define menu texts, rather than Option.textValue
 This is more logical than ussing textValue for it, because choice already
 has the correct (char**) type, while textValue was (char*), and needed
 casting everywhere. Note that for engine options, the fields were the
 same anyway, so no back-end change was required. The textValue now
 contains the (casted) list of actual string values, where these are
 needed. (But for numeric and function menus they aren't.)
Add PopUp Option type
 An new pseudo-Option is defined, to add a popup menu to a previous Graph
 option. The actual popping up is done by the expose handler.
 The function XUngrabPointer is the key to success here. A PopUp option
 specifies a callback for handling the selection from the menu, which will
 be called with the option number, exacty as with ComboBox options.
Update option explanation in dialogs.h
Make Spin and CheckBox callbacks pass dialog number
 No longer rely on 'currentOptions' for getting the option belonging to
 the callback, but get it out of the dialogOptions array indexed by dialog
 type. This way things cannot be messed up by an asynchrounous error popup.
 It also means that it is now save for non-modal dialogs to use these options.
Use button widget for text behind checkbox
Let listboxes use general formatting hints
Let GenericPopUp option always finish last pane after Break
Allow LisBox to specify select callback in Option.textValue
Use double-click to trigger ListBox callback
Make ListBox callback re-entrant
Fix multi-line Label options
Separate CreateMenuItem out from CreateComboPopup
Chain checkbox texts entirely left
Allow a user-specified callback to Label options
 This is needed to implement the clocks. Let the CheckBox callback handle
 it. For now ther is no distinction between different mouse buttons.

12 years agoPrevent double PopDowns
H.G. Muller [Wed, 21 Mar 2012 10:15:01 +0000]
Prevent double PopDowns

Some DialogOK functions ordered an early PopDown themselves. This,
however, resulted in PopDown being called twice when they returned TRUE.
This interfered with the new system for allowing multiple instances of
the same dialog. So these functions are now fixed to suppress the
standard PopDown by always returning FALSE.

12 years agoSplit usounds.c and usystem.c from xboard.c
H.G. Muller [Tue, 20 Mar 2012 18:10:50 +0000]
Split usounds.c and usystem.c from xboard.c

X-independent code was moved to separate files. The nef file usound.c
contains the sound handling, which in XBoard is trivial, because it uses
an external player, but could be replaced by a complex one on platforms
that have to handle the sound themselves.
  The usystem.c file contains all non-X Unix-like stuff, such as fork,
pipe, system, getenv. I also contains some color parsing for the xterm
colors. This stuff could be useful on platforms that support Unix-like
system calls.

12 years agoMake routine to probe shift keys
H.G. Muller [Mon, 26 Mar 2012 17:03:19 +0000]
Make routine to probe shift keys

The code to probe Alt keys was taken out of MoveTypeInProc, and extended
to probing Ctrl and Shift keys too. These are now returned in the 6 LSB
of an int by ShiftKeys().

12 years agoRemove one level of indirection on ICSInputBoxPopUp
H.G. Muller [Mon, 19 Mar 2012 12:15:11 +0000]
Remove one level of indirection on ICSInputBoxPopUp

12 years agoCleanup of xboard.c
H.G. Muller [Tue, 10 Apr 2012 08:26:24 +0000]
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

12 years agoMove some back-endish routines from xboard.c to dialogs.c
H.G. Muller [Mon, 19 Mar 2012 10:38:17 +0000]
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.

12 years agoSplit back-endish part off xoptions.c, and move to dialogs.c
H.G. Muller [Sun, 18 Mar 2012 19:10:35 +0000]
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.

12 years agoDeclare some shared global variables in backend.h
H.G. Muller [Sun, 18 Mar 2012 14:33:18 +0000]
Declare some shared global variables in backend.h

The vlobals twoBoards and partnerUp were only shared through an extern
declaration in xboard.c

12 years agoSplit back-endish part off drawing code and move to board.c
H.G. Muller [Sun, 18 Mar 2012 11:34:42 +0000]
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

12 years agoContract some awful code replication
H.G. Muller [Sun, 18 Mar 2012 09:08:55 +0000]
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.

12 years agoMove more back-endish menu-related stuff from xboard.c to menus.c
H.G. Muller [Sun, 18 Mar 2012 07:34:54 +0000]
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.

12 years agoSwitch to use of short menu references
H.G. Muller [Sun, 18 Mar 2012 07:17:53 +0000]
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

12 years agoRefactor menu code, and move it to menu.c
H.G. Muller [Sat, 17 Mar 2012 09:47:04 +0000]
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.

12 years agoRemove some unused (exclude-moves) variables
H.G. Muller [Sat, 7 Apr 2012 13:59:50 +0000]
Remove some unused (exclude-moves) variables

12 years agoInstall engine within current group
H.G. Muller [Sat, 7 Apr 2012 13:57:54 +0000]
Install engine within current group

12 years agoSwitch to using listboxes for engine-selection in WinBoard
H.G. Muller [Sat, 7 Apr 2012 13:53:29 +0000]
Switch to using listboxes for engine-selection in WinBoard

12 years agoImplement Narrow button in WB Game List
H.G. Muller [Sat, 7 Apr 2012 13:36:02 +0000]
Implement Narrow button in WB Game List

12 years agoSilence unjust warning
H.G. Muller [Thu, 5 Apr 2012 13:15:09 +0000]
Silence unjust warning

12 years agoFix memory corruption through InitString and second-engine loading
H.G. Muller [Wed, 4 Apr 2012 10:18:43 +0000]
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.

12 years agoFix PV sorting during fail low
H.G. Muller [Sun, 1 Apr 2012 18:51:53 +0000]
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.

12 years agoExtend smallLayout regime up to size Medium
H.G. Muller [Fri, 30 Mar 2012 18:09:58 +0000]
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.

12 years agoFix parsing crazyhouse promotions with legality testing off
H.G. Muller [Fri, 30 Mar 2012 08:38:27 +0000]
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.

12 years agoFix browsing for save file in WB
H.G. Muller [Fri, 30 Mar 2012 08:07:04 +0000]
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.

12 years agoLet clicking on header line exclude moves
H.G. Muller [Mon, 2 Apr 2012 08:18:37 +0000]
Let clicking on header line exclude moves

The exclude header in the Engine-Output window can now be clicked, to
toggle the exlusion of the listed move. Clicking on 'none' resets all
exclusions, clicking on 'best' excludes the first move of the latest PV.
The pseudo-move 'tail' represents all non-listed moves.

12 years agoKeep list of excluded moves in Engine Output header
H.G. Muller [Sun, 1 Apr 2012 20:39:55 +0000]
Keep list of excluded moves in Engine Output header

As long as there is still space, excluded or included moves are added
to a new header line in the Engine Output window (prefixed with + or -
depending on whether they are currently excluded or included). Future
in/exclusions of that same move then alter the prefix.

12 years agoFix focus of Game List
H.G. Muller [Wed, 21 Mar 2012 22:12:20 +0000]
Fix focus of Game List

After focus was transferred to the filter text-edit, it was impossible
to get it back on the game list (to make the arrow keys working again).
A translation to left down-click is now used to assign focus, just as
it would for text edits. For unknown reason this only worked if the
translations were instated by Overriding, rather than Augmenting,
which again required the normal translation of downclick, Set(), which
selects the clicked item, to be explicitly mentioned as well.

12 years agoFix taking effect of some option changes
H.G. Muller [Fri, 16 Mar 2012 21:41:19 +0000]
Fix taking effect of some option changes

This fixes a bug reported at Ubuntu: when switching off move highlighting
in Two Machines mode, the last move before the switch stayed highlighted.
The GeneralOptionsOK() now clears any remaining highlights when highlighing
is off. Similar problems with blind-fold mode and coordinates, which require
a total board redraw to take effect, are now solved by also forcing such a
redraw in GeneralOptionsOK() when they change.

12 years agoAdd exclude and setscore to protocol specs
H.G. Muller [Fri, 16 Mar 2012 20:58:55 +0000]
Add exclude and setscore to protocol specs

12 years agoFix clock stop after dragging
H.G. Muller [Fri, 16 Mar 2012 13:47:25 +0000]
Fix clock stop after dragging

DelayedDrag always cancelled the previous drag timeout event, even when
this was no longer pending because it had already taken place, and the
event ID was resused by some other timeout (usually a clock tick).

12 years agoImplement exclude moves
H.G. Muller [Wed, 14 Mar 2012 20:06:28 +0000]
Implement exclude moves

Dragging a piece by double-clicking it on the from-square in analysis mode
will not perform the entered move, but send an exclude or include command
to the engine for that move (provided the engine enabled this with
feature exclude=1), depending on if the move was already excluded or not.
To this end a map of excluded moves is kept, and cleared when we move to
another position through moving, undo, setboard or new. The user can see
whether he included or excluded the move, as exclude uses premove highlights.
  Commands "exclude|include all" are sent when we throw a double-clicked
piece off board (vertically or horizontally, respectively), but after
exclude all the most recent PV move is included again.
  Remaining problem is that promotions can only be excluded.

12 years agoMark new text "Click clock to clear board" for translation
Byrial Jensen [Wed, 14 Mar 2012 14:13:18 +0000]
Mark new text "Click clock to clear board" for translation

12 years agoMore thorough switch to -ncp on engine failure
H.G. Muller [Tue, 13 Mar 2012 20:46:55 +0000]
More thorough switch to -ncp on engine failure

The ProcRef and InputSource are now also cleared, and just to be sure there
are no surviving adapters, the child is killed when engine startup fails.

12 years agoInstall engines as ./exefile in XBoard
H.G. Muller [Tue, 13 Mar 2012 20:25:22 +0000]
Install engines as ./exefile in XBoard

When a path name is split into directory and filename, the latter in Linux
must be preceded by ./ in order to make it executable in the directory
XBoard starts it in.

12 years agoInform user in EditPosition mode how to clear board
H.G. Muller [Tue, 13 Mar 2012 13:11:18 +0000]
Inform user in EditPosition mode how to clear board

With -pieceMenu false the board is cleared by clicking the clock, but
since this is impossible to guess, it is now printed in the message field.

12 years agoFix fall-back on -ncp mode
H.G. Muller [Tue, 13 Mar 2012 13:06:32 +0000]
Fix fall-back on -ncp mode

When the requested engine could not be started, the user still had to
wait for the feature timeout to expire before the UI was re-enabled,
and the now-useless loading action would continue. In stead we now
cancel any scheduled continuation, thaw the UI immediately, and switch
the menus and gameMode to ncp straight away.

12 years agoupdated po/pot files
Arun Persaud [Sun, 11 Mar 2012 02:55:24 +0000]
updated po/pot files

12 years agonew version number for developer release
Arun Persaud [Sun, 11 Mar 2012 02:54:32 +0000]
new version number for developer release

12 years agoMerge branch 'v4.6.x' into tmp
Arun Persaud [Sun, 11 Mar 2012 02:51:07 +0000]
Merge branch 'v4.6.x' into tmp

12 years agoLimit premove cancelling to click on from square
H.G. Muller [Thu, 8 Mar 2012 10:11:03 +0000]
Limit premove cancelling to click on from square

On second thought it might be better to limit cancellation of the
premove to up-clicks on the premove from-square. (Presumably this
will be a static click, but if the down-click was elsewhere, a new move
most have been entered, which would clear the existing premove anyway.)
This allows the user to already grab another piece that he wants to move
after premove, or when premove is rejected.

12 years agoFix clearing of premove
H.G. Muller [Thu, 8 Mar 2012 09:02:00 +0000]
Fix clearing of premove

Any left-clicking on the board now clears an existing premove, in addition
to what it normally does.

12 years agoFix seek-graph race condition
H.G. Muller [Thu, 8 Mar 2012 08:56:51 +0000]
Fix seek-graph race condition

When a game started just after the user requested a seek graph, so that
the game start message would be received between sending 'sought' and
receiving the seek-ad list, an empty graph would pop up on the prompt,
and it was not possible to take it down, because the gameMode was no longer
IcsIdle.
  This patch cancels a sought command on receiving a board of your own game
to prevent this situation. In addition the system is made more robust by
always accepting a left-click as pop-down request, even when the seek graph
cannot be up, when it is up anyway.

12 years agoFix typo (seach) in string. It is already fixed in branch v4.6.x
Byrial Jensen [Tue, 6 Mar 2012 15:37:02 +0000]
Fix typo (seach) in string. It is already fixed in branch v4.6.x

12 years agoFix typo (seach) found by Yuri Chornoivan in source, pot and po files
Byrial Jensen [Tue, 6 Mar 2012 15:19:27 +0000]
Fix typo (seach) found by Yuri Chornoivan in source, pot and po files

12 years agoUpdated Danish and Ukrainian translations
Byrial Jensen [Tue, 6 Mar 2012 15:10:58 +0000]
Updated Danish and Ukrainian translations

12 years agoadded some documentation about what's need to be done for a release and a bash-releas...
Arun Persaud [Sun, 4 Mar 2012 22:52:34 +0000]
added some documentation about what's need to be done for a release and a bash-release script

12 years agonew developer release
Arun Persaud [Sun, 4 Mar 2012 22:07:06 +0000]
new developer release

12 years agoupdated po/pot files
Arun Persaud [Sun, 4 Mar 2012 22:07:40 +0000]
updated po/pot files

12 years agoAdd disambiguation of move with unique piece
H.G. Muller [Sat, 3 Mar 2012 22:32:11 +0000]
Add disambiguation of move with unique piece

If no pseudo-legal move of type Xa1 can be found, and only a single
piece of type X is on the board, successfully disambiguate the move
using that piece.

12 years agoFix layout in Disambiguate
H.G. Muller [Sat, 3 Mar 2012 22:20:56 +0000]
Fix layout in Disambiguate

To make it more obvious what next patch is.

12 years agoMake system open command configurable
H.G. Muller [Sat, 3 Mar 2012 13:04:07 +0000]
Make system open command configurable

A new volatile string option -openCommand has been added, which defaults
to "xdg-open". It is intended for use in the master settings file for
distributions that need another command for this.

12 years agoFix name of bug-report menu item
H.G. Muller [Sat, 3 Mar 2012 12:49:14 +0000]
Fix name of bug-report menu item

12 years agoMerge branch 'v4.6.x' of git.sv.gnu.org:/srv/git/xboard
H.G. Muller [Fri, 2 Mar 2012 11:31:32 +0000]
Merge branch 'v4.6.x' of git.sv.gnu.org:/srv/git/xboard

12 years agoMerge branch 'master' into v4.6.x
Arun Persaud [Wed, 29 Feb 2012 06:00:27 +0000]
Merge branch 'master' into v4.6.x

12 years agoFix suspected bug in Makefile
H.G. Muller [Tue, 28 Feb 2012 20:09:18 +0000]
Fix suspected bug in Makefile

12 years agoadded icons for mime-types to pixmap directory, so that rpm packages can use them
Arun Persaud [Tue, 28 Feb 2012 04:31:46 +0000]
added icons for mime-types to pixmap directory, so that rpm packages can use them

12 years agoFix suspected bug in Makefile
H.G. Muller [Tue, 28 Feb 2012 20:09:18 +0000]
Fix suspected bug in Makefile

12 years agoConfigure -stickyWindows off
H.G. Muller [Tue, 28 Feb 2012 12:46:09 +0000]
Configure -stickyWindows off

There are too many systems for which this feature does not work.

12 years agoMake web section in Help menu
H.G. Muller [Tue, 28 Feb 2012 12:40:54 +0000]
Make web section in Help menu

Items for the XBoard Home Page, User Guide, News Page and reporting bugs
were added. They all rely on xdg-open to invoke the browser or mailer on
the given links.

12 years agoIncrease buffer size in AboutProc() to accommodate for larger text.
Byrial Jensen [Mon, 27 Feb 2012 15:56:26 +0000]
Increase buffer size in AboutProc() to accommodate for larger text.

The Danish version of the about text was truncated due to a too small
buffer size.

12 years agoMerge branch 'master' into v4.6.x
Arun Persaud [Mon, 27 Feb 2012 03:38:01 +0000]
Merge branch 'master' into v4.6.x

Conflicts:
configure.ac
po/de.po
po/es.po
po/it.po
po/ru.po
po/tr.po
po/vi.po
po/xboard.pot
po/zh_CN.po
po/zh_HK.po
po/zh_TW.po
winboard/config.h

fixed version number for 4.6.0 and ran "make update-po" afterwards (first ./autogen.sh and configure)

12 years agonew developer release
Arun Persaud [Mon, 27 Feb 2012 03:11:59 +0000]
new developer release

12 years agoupdated po/pot files
Arun Persaud [Mon, 27 Feb 2012 03:14:34 +0000]
updated po/pot files

12 years agoupdated Changelog, NEWS, etc.
Arun Persaud [Mon, 27 Feb 2012 03:19:31 +0000]
updated Changelog, NEWS, etc.

12 years agoMerge branch 'master' into v4.6.x
Arun Persaud [Mon, 27 Feb 2012 03:07:54 +0000]
Merge branch 'master' into v4.6.x

12 years agoadd information about our webpage and were to report bugs into the help menu
Arun Persaud [Mon, 27 Feb 2012 02:55:10 +0000]
add information about our webpage and were to report bugs into the help menu

12 years agofixed "make install-pdf": missing target for recursive make in po directory
Arun Persaud [Mon, 27 Feb 2012 02:40:27 +0000]
fixed "make install-pdf": missing target for recursive make in po directory

12 years agoSuppress recent-engines menu items in ICS mode
H.G. Muller [Sun, 26 Feb 2012 22:06:33 +0000]
Suppress recent-engines menu items in ICS mode

12 years agoFix 50-move counter in ICS mode
H.G. Muller [Sun, 26 Feb 2012 21:45:12 +0000]
Fix 50-move counter in ICS mode

Marking irreversible moves in the EP_STATUS did not work in ICS mode,
as ApplyMove,which did that is never executed there. Only the boards
sent by ICS are displayed,especially in observing mode. Now the status is
derived from the ICS mov strings (x in the SAN move, or P in the long move.

12 years agoFix two 64-bit warnings
H.G. Muller [Sun, 26 Feb 2012 16:18:39 +0000]
Fix two 64-bit warnings

Passing the engine number in a pointer variable to the callback needed
a two-step cast.

12 years agoFix piece symbols on switch back to variant normal
H.G. Muller [Sun, 26 Feb 2012 15:53:24 +0000]
Fix piece symbols on switch back to variant normal

Variant switches were not properly detected, meaning the variable pieces
could keep a form belonging to a previous variant. (E.g. Queen remained
a Lance image after switching from shogi to normal.)

12 years agoKeep XBoard windows attached on resize
H.G. Muller [Sun, 26 Feb 2012 13:07:50 +0000]
Keep XBoard windows attached on resize

Windows attached to bottom or right are displaced with the size increase.
Their perpendicular dimension is also scaled, to keep their edges at the same
fraction of the main window, unless they stick out. In the latter case the
fraction is clipped to 1, so that edge moves with the full size increase.