xboard.git
8 years agoFix popdown of Error/Help dialog through window-close button
H.G.Muller [Sun, 13 Mar 2016 08:21:43 +0000]
Fix popdown of Error/Help dialog through window-close button

Closing an Error popup that was a daughter of another dialog (as Help
dialogs would often be) through the window-close button instead of 'OK'
would permanently block popdown of the parent dialog, because the info
that the Error dialog was still up would not have been reset by the Error
dialog's OK function. GenericPopDown now calls the OK function of such
a dialog (actually FatalDlg) even on a REJECT response.

8 years agoMake help clicks resistent to NULL-pointer Label names
H.G.Muller [Sat, 12 Mar 2016 22:32:00 +0000]
Make help clicks resistent to NULL-pointer Label names

This should be needed, but just in case...

8 years agoSilence two warnings
H.G.Muller [Sat, 12 Mar 2016 22:30:20 +0000]
Silence two warnings

8 years agoMake help clicks also work for UCI engines
H.G.Muller [Sat, 12 Mar 2016 15:51:44 +0000]
Make help clicks also work for UCI engines

The help clicks were using the engine command to find the manual,
but this would not work for engines with parameters or using adapters.
Now it used the -fcp/scp arguments, and tidies these to stripp off
directory path and arguments. (cps->tidy could not be used, because
it is overwritten by the name reported by the engine itself, which
usually contains version numbers not in the manual name.)

8 years agoMake location of man file dynamic for OSX
H.G.Muller [Sat, 12 Mar 2016 15:41:38 +0000]
Make location of man file dynamic for OSX

MANDIR is redefined in the case of an OSX App to be a variable, in a
similar way as DATADIR, so it can be determined at startup, and the App
can be 'portable'. The way to concatenate it with the rest of the file
name hd to be made variable-proof.

8 years agoSuppress empty label at top of Edit Tags dialog
H.G.Muller [Sat, 12 Mar 2016 13:33:05 +0000]
Suppress empty label at top of Edit Tags dialog

There is a Label Option above the text memo of the Edit Tags dialog
that can display a message, but it is only used in cmail mode, and
is passed as a NULL pointer otherwise. (On which GenericPopup then
crashed when it wanted to attach a help click.) Now we simply suppress
display of that widget when there is no message.

8 years agoAlso try to get help for engine options
H.G.Muller [Fri, 11 Mar 2016 22:43:48 +0000]
Also try to get help for engine options

Help clicks in the Engine Settings dialogs will try to scan the man page
of the corresponding engine for info about the option. This is a bit
tricky, as it must assume the name of the engine is the same as that
of the engine command and the manual for it is in section 6. In addition
it must look in both /usr/share/man and /usr/local/share/man, as it cannot
know whether the engine was installed from source or repo. Finally it
must hope the man page isn't gzipped.

8 years agoFix recognition of .SS lines in manual
H.G.Muller [Fri, 11 Mar 2016 15:59:41 +0000]
Fix recognition of .SS lines in manual

The logic for recognizing .SS headers was reversed, and .SS lines were
also not tested for to decide whether display should end.

8 years agoLet configure supply path to manual file
H.G.Muller [Fri, 11 Mar 2016 15:54:25 +0000]
Let configure supply path to manual file

A new macro MANDIR is passed fro the configure process to the compiler
in a -D option to inform XBoard where to find its manual page.

8 years agoFix segfault on single-line help text
H.G.Muller [Fri, 11 Mar 2016 14:54:45 +0000]
Fix segfault on single-line help text

The help text itself is displayed in the ErrorPopUp as a label,
and allowing help clicks on a label would apparently trigger some
nfinite recursion of event handlers. Making labels in the ErrorDlg
not sensitive to help clicks solved this.

8 years agoMention item in title bar of help dialog
H.G.Muller [Fri, 11 Mar 2016 14:19:13 +0000]
Mention item in title bar of help dialog

8 years agoMake dialog labels and comboboxes also accept help clicks
H.G.Muller [Fri, 11 Mar 2016 14:02:21 +0000]
Make dialog labels and comboboxes also accept help clicks

Combobaoxes and bare labels had their own code for creating the label,
nd were not yet made sensitive to help clicks. (Which is a bit cumbersome,
as GTK does not allow attaching callbacks to label widgets, so that you
have to wrap them first into something that does.) The bare labels could
furthermore already have a callback specified (used for the clocks);
in this case, and the case of multi-line labels, no help handler is
attached.

8 years agoDo not save ICS password in command history
H.G.Muller [Fri, 11 Mar 2016 13:25:19 +0000]
Do not save ICS password in command history

Blanking out the password while typing it would have little effect if
the arrow keys could recall is. So we don't save any lines in the
history when echo is off.

8 years agoFix file-type combobox of Xaw file-selector dialog
H.G.Muller [Fri, 11 Mar 2016 12:46:55 +0000]
Fix file-type combobox of Xaw file-selector dialog

The list of combobox labels got out of phase with the list of values
after 'Images', because the value for the latter was missing.

8 years agoAllow hyphen in name of help item
H.G.Muller [Thu, 10 Mar 2016 15:28:52 +0000]
Allow hyphen in name of help item

Some dialog items have names with hyphens in them, such as 'Auto-save',
and these would all be confusedif the true name was taken to end before
the hyphen.

8 years agoSuppress echo of password in ICS Chat window (GTK)
H.G.Muller [Thu, 10 Mar 2016 12:03:55 +0000]
Suppress echo of password in ICS Chat window (GTK)

The GTK version uses the set_visibility GTK call to switch echoing
of the ICS input widget. In Xaw this is a dummy. EchoOn/Off had to
be moved to dialogs.c for this.

8 years agoFix popdown of menus on help click
H.G.Muller [Thu, 10 Mar 2016 09:41:07 +0000]
Fix popdown of menus on help click

Because menus by default also react to button3 clicks, using those
clicks for help popup needs to suppress the default action. But this
action was also reponsible for the popdown of the menu, so that it
stayed up, covering the help dialog. Now we do allow the default action,
but flag to the generic menu handler that it should not execute the
menu function.

8 years agoImplement rough help popup
H.G.Muller [Wed, 9 Mar 2016 22:15:22 +0000]
Implement rough help popup

A routine is added that searches a given text header in the man file,
and then displays the following text until the next header (after
skipping additional headers that come before any text) in a message
box. The text uses a simple fill and wrap to line length > 80, and
ignores all control characters, except empty lines. Both .B and .SS
directives are recognized as headers.

8 years agoImplement help clicks
H.G.Muller [Wed, 9 Mar 2016 16:47:55 +0000]
Implement help clicks

A button3 click on the text labels of text-edit, spin, checkbox and
button controls, as well as menu items, now pops up an alert box
with the name of the clicked item. This as a first step to making an
interactive help that would use that name to look up information on the
item in the texi file, and display that.

8 years agoLogout from ICS after fatal error
H.G.Muller [Wed, 9 Mar 2016 09:53:35 +0000]
Logout from ICS after fatal error

Exiting of XBoard after a fatal error such as crashing of the engine
could be delayed by popping up an exit message, which then had to be
confirmed first. This would leave XBoard in zippy mode open for new
challenges, which it would even accept, and lose by forfeit. Now
we send a 'logout' command to the ICS before popping up the exit
message.

8 years agoDeprecate -defaultPathEGTB option
H.G.Muller [Wed, 9 Mar 2016 08:44:45 +0000]
Deprecate -defaultPathEGTB option

The value of the -defaultPathEGTB option is now automatically cleared
at startup, after appending it as "nalimov:" format to -egtFormats.
We also no longer preconfigure a (dummy) value for -defaultPathEGTB,
but instead one for -egtFormats, (which will show up in the EGT path
field of the Common Engine Settings dialog now -defaultPathEGTB is
empty) to serve as an example for the syntax of -egtFormats.

8 years agoMake EOF error conditionally non-fatal (XB)
H.G.Muller [Tue, 8 Mar 2016 22:26:57 +0000]
Make EOF error conditionally non-fatal (XB)

When the ICS Chat window is open, an EOF fromkeyboard is ignored.

8 years agoFix braces problem in texi file
H.G.Muller [Tue, 8 Mar 2016 22:26:05 +0000]
Fix braces problem in texi file

8 years agoDescribe ICS Text Menu in texi file
H.G.Muller [Tue, 8 Mar 2016 20:55:13 +0000]
Describe ICS Text Menu in texi file

8 years agoFix WinBoard compile errors
H.G.Muller [Tue, 8 Mar 2016 19:41:41 +0000]
Fix WinBoard compile errors

8 years agoFix dressed-letter IDs in VariantMen PGN Tag
H.G.Muller [Tue, 8 Mar 2016 19:36:56 +0000]
Fix dressed-letter IDs in VariantMen PGN Tag

Due to sign extension the ID suffxes would never be printed.

8 years agoMake texi file sub-section free
H.G.Muller [Tue, 8 Mar 2016 19:11:37 +0000]
Make texi file sub-section free

Because the sub-sections did not work, all subsections (which occurred
mainly in the Options Menu section, to describe the various menu dialogs)
are now upgraded to sections.

8 years agoDescribe choice command in protocol specs
H.G.Muller [Tue, 8 Mar 2016 18:20:06 +0000]
Describe choice command in protocol specs

8 years agoImprove highlight-arrow pointing and fix its erasure
H.G.Muller [Tue, 8 Mar 2016 18:14:05 +0000]
Improve highlight-arrow pointing and fix its erasure

The code to calculate whether the arrow shoud endnear an edge or corner
of the to-square was buggy, leading to orientation-dependent decisions.
In addition the damage trace wasnot exactly following the arrow, so that
sometimes parts of the arrow were not displayed or erased.

8 years agoImprove triple-leg-move animation
H.G.Muller [Tue, 8 Mar 2016 16:20:21 +0000]
Improve triple-leg-move animation

When both locust squares (kill and kill2) are set, animation now takes
place in three stages. As kill2 is not retreived when stepping through
the game history, this works only for moves just entered or played by
the engine. Replayed moves are still animated in 2 stages, though, which
does look pretty good on 2-out-1-in moves.

8 years agoImplement triple capture
H.G.Muller [Tue, 8 Mar 2016 10:51:29 +0000]
Implement triple capture

Moves can now have two locust squares (and promote even when they are
locust captures). This applies to move entry (but only through click-
click; buttonless dragging does not yet work), as well as sending or
receiving from engine, and generating and parsing SAN.

8 years agoAllow use of context menu in text memos GTK
H.G.Muller [Mon, 7 Mar 2016 15:16:17 +0000]
Allow use of context menu in text memos GTK

Attaching a user handler for button3 events to text memos would suppress
the normal context menu, so you could copy/paste in those  only through
the keyboard. Now a button3 event while there is a non-empty selection,
or through a click behind all text, will pop up the normal context menu.

8 years agoShow moves in Edit Book window as SAN
H.G.Muller [Mon, 7 Mar 2016 12:46:50 +0000]
Show moves in Edit Book window as SAN

The opening moves in the GUI book for the current position shown in the
Edit Book window are converted to SAN before showing them, when they have
the simple form fromSqr toSqr promoChar. (This excludes drop moves and
double moves.)

8 years agoCleanup Edit Tags/Book/EngineList a bit
H.G.Muller [Mon, 7 Mar 2016 11:26:07 +0000]
Cleanup Edit Tags/Book/EngineList a bit

The Tags dialog is also used for two other functions, and this hack
causes some problems. This patch ameliorates these a bit. The Edit
Engine List now displays its own title (instead of "Tags"), and popping
it up pops down which other function was in use first. (Unfortunately
this can result in data loss for uncommitted changes.) The name of the
"save changes" button has been changed to "commit changes", to suggest
less strongly that a change in the Engine List would be immediately
saved to file (which in reality requires Save Settings Now as well).

8 years agoMake OK and Cancel buttons appear in top-level dialogs GTK
H.G.Muller [Mon, 7 Mar 2016 10:50:21 +0000]
Make OK and Cancel buttons appear in top-level dialogs GTK

The OK and Cancel buttons are created in GTK as part of the
dialog_with_buttons call, but to get top-level windows another call
had to be used, which does not automatically provide them.
We now explicitly add the buttons as requested by the EndMark Option,
paying attention to the SAME_ROW requests. (The code for that is currently
a bit messy, as one suspects that the cumbersome testing on Option.type
was done exactly to make the SAME_ROW request of EndMarks ignored.)
The GTK "clicked" signal is translated to a "response" in a kludgy way,
through a PopDownProxy routine.

8 years agoFix spurious clearing of Engine Output during PV walk
H.G.Muller [Sun, 6 Mar 2016 22:52:06 +0000]
Fix spurious clearing of Engine Output during PV walk

Due to messing with forwardMostMove during PV walking the Engine Output
panes couldbe cleared when a new PV arrived.

8 years agoPrevent out-of-turn grabbing of piece in analysis mode
H.G.Muller [Sun, 6 Mar 2016 22:45:54 +0000]
Prevent out-of-turn grabbing of piece in analysis mode

In Analyze modeit was possible to grab pieces for dragging of the side
that did not have the move.

8 years agoFix parent dialog of Error Popup
H.G.Muller [Sat, 5 Mar 2016 21:59:14 +0000]
Fix parent dialog of Error Popup

If the parent dialog of the Error Popup is wrong, the OK button in it
will not manage to pop it down. Migrating the Tourney Options to their
own DialogClass had changed testing for a parent other than the board
window from TransientDlg to MasterDlg, but Toerney Options was not the
only such dialog throwing up errors. (E.g. New Variant coulddo it too.)
So we now test if MasterDlg or TransientDlg is up, and use those as
parent if they are.

8 years agoBeef up variant detection in New Variant dialog WB
H.G.Muller [Sat, 5 Mar 2016 21:42:33 +0000]
Beef up variant detection in New Variant dialog WB

In WinBoard the enabling of radio buttons was still done when the
variant nameon the button was a sub-string of the variants feature,
without requiring a match of the full name (so that 'grande-acedrex'
would enable the 'grand' button of Grand Chess).

8 years agoFix crash in New Variant dialog Xaw
H.G.Muller [Sat, 5 Mar 2016 21:33:07 +0000]
Fix crash in New Variant dialog Xaw

The earlier patch to beef up variant recognition couldnot handle it
that some buttons has -1 as variant value.

8 years agoRemove warning from About box against GTK build
H.G.Muller [Sat, 5 Mar 2016 08:02:11 +0000]
Remove warning from About box against GTK build

It was still mentioned that the GTK build is unstable.

8 years agoSuppress underscores in Xaw menus
H.G.Muller [Thu, 3 Mar 2016 10:11:07 +0000]
Suppress underscores in Xaw menus

The underscores that indicate shortcut keys in GTK menu items were
showing up in the Xaw menus. Now we remove them when creating the menu
button.

8 years agoFix another Xaw compile error
H.G.Muller [Thu, 3 Mar 2016 09:40:17 +0000]
Fix another Xaw compile error

This is what you get when changing code without testing if it at least
compiles...

8 years agoSilence warning
H.G.Muller [Wed, 2 Mar 2016 22:42:43 +0000]
Silence warning

Conversion to use of strncpy had led to the length of a (char*) being
tested, and atypically we got away with that so far because the copied
string was only 2 characters long. Now we use length limit 4, which also
renders the use of strncpy instead of strcpy useless, but at least
does notproduce a warning.

8 years agoFix recognition of title in small layout
H.G.Muller [Wed, 2 Mar 2016 22:39:37 +0000]
Fix recognition of title in small layout

The title handle was set based on invalidation of Options by making
their type -1, while this nowadays is done by setting them to Skip
(as enum types are unsigned).

8 years agoFix compile error in SetComboChoice Xaw
H.G.Muller [Wed, 2 Mar 2016 22:27:59 +0000]
Fix compile error in SetComboChoice Xaw

8 years agoFix crash on changing piece directory
H.G.Muller [Wed, 2 Mar 2016 14:18:58 +0000]
Fix crash on changing piece directory

The loop for deleting the old pieces in ActivateTheme was still assuming
the four promo-Golds were stored behind the normal set, which for the
new piece ordering isn't the case anymore.

8 years agoFix black border around saved diagrams (WB)
H.G.Muller [Wed, 2 Mar 2016 10:14:36 +0000]
Fix black border around saved diagrams (WB)

The 'Save as Diagram' function of WinBoard produced bitmaps with a black
border, because the buffer bitmap used for drawing the board (which was
flushed to file to create the diagram) had a size larger than the board,
including somemargins of the main window. Now we copy it to a board-sized
bitmap first, and flush that.

8 years agoPreserve flip on pasting game when auto-flipView is off
H.G.Muller [Tue, 1 Mar 2016 20:09:49 +0000]
Preserve flip on pasting game when auto-flipView is off

Normally starting a new game would restore the orientation as given by
the -flipView option on the command line, which might flip the view even
when -autoFlipView is off. A new game started through Paste Game now
always preserves the current orientation when -autoFlipView is off.

8 years agoDescribe engine grouping in texi file
H.G.Muller [Tue, 1 Mar 2016 19:39:55 +0000]
Describe engine grouping in texi file

The paragraph on the Edit Engine List menu item now contains a description
of the method for organizing engines in groups by adding "# GROUP" and
"# end" lines.

8 years agoAdd 'divide by 60' checkbox in Time Control dialog XB
H.G.Muller [Tue, 1 Mar 2016 09:35:11 +0000]
Add 'divide by 60' checkbox in Time Control dialog XB

The TC could not be set to fractional minutes (base time) or seconds
(increment) in the GTK version, as the spin controls there do not allow
you to type such numbers. An added checkbox 'Divide entered times by 60'
allows you to enter base time in seconds, and increment in 1/60 sec.
The dialog always pops upwith this checkbox unticked.

8 years agoMerge branch 'v4.8.x'
Arun Persaud [Sun, 6 Mar 2016 00:32:37 +0000]
Merge branch 'v4.8.x'

8 years agoupdated copyright for 2016
Arun Persaud [Sun, 6 Mar 2016 00:30:45 +0000]
updated copyright for 2016

8 years agoMerge branch 'v4.8.x'
Arun Persaud [Sat, 5 Mar 2016 21:04:43 +0000]
Merge branch 'v4.8.x'

8 years agofixed configure script: GTK default was enabled even with --with-Xaw
Arun Persaud [Sat, 5 Mar 2016 21:03:04 +0000]
fixed configure script: GTK default was enabled even with --with-Xaw

8 years agoupdate Russian translation
Arun Persaud [Tue, 27 Oct 2015 06:08:31 +0000]
update Russian translation

8 years agoPrint score with same sign in message and engine output
H.G.Muller [Mon, 29 Feb 2016 21:54:44 +0000]
Print score with same sign in message and engine output

There are two options that affect the score POV (always or analysis only),
but they were only working on the score in the Engine Output window, and
not in the message field of the board window. Now they work for both.

8 years agoFix bugs in previous 3 commits
H.G.Muller [Mon, 29 Feb 2016 21:24:31 +0000]
Fix bugs in previous 3 commits

The commits before this were pushed a bit prematurely, inspired by
the wish tosee if I could push from my new laptop.

8 years agoAdd configure-options section to texi file
H.G.Muller [Mon, 29 Feb 2016 13:24:11 +0000]
Add configure-options section to texi file

The options data, saveDate, addMasterOption, installEngine, installTheme
and autoClose are now described in the manual.

8 years agoUpdate texi file
H.G.Muller [Mon, 29 Feb 2016 12:15:47 +0000]
Update texi file

8 years agoAdd -installTheme option
H.G.Muller [Mon, 29 Feb 2016 11:53:57 +0000]
Add -installTheme option

A new option of type ArgInstall is added, which will add its argument
to the -themeNames list (under the usual restriction it is not already
in there, and that it was not seen before). By appending such a (time-
stamped) option to the master settings file with -addMasterOption,
newly installed themes can be made to trickle their way into the user's
private settings file. All the theme package has to is call XBoard with
the applicable -addMasterOption "-installTheme ...." arguments in its
install script, and copy any associated files to XBoard's datadir.

8 years agoFix disappearance of premoved piece
H.G.Muller [Sun, 28 Feb 2016 11:01:40 +0000]
Fix disappearance of premoved piece

When a premove was done by dragging, (which for expected recaptures would
be the only way, as click-click moving selects the intended target),
the moved piece would disappear from view. This because the from-square
would not be redrawn (in normal move execution it would remain empty).
This could have been an XBoard-only problem. In any case We now force a
complete redraw of the board, which is not very elegant, but should always
fix it.

8 years agoFix bug #43792 (no highlights after rejection of premove)
H.G.Muller [Sun, 28 Feb 2016 10:34:52 +0000]
Fix bug #43792 (no highlights after rejection of premove)

If the sending of a premove fails to add a move to the game, because
XBoard itself judges the move illegal (which could only be determined
after arrival of the opponent move, not when it was entered), XBoard
now re-applies the move highlights for that opponent move.
 This does not solve the problem yet with legality testing off,
when it later turns out the ICS rejects the move.

8 years agoFix bug #45599 (inclusion of keysym.h in Xaw)
H.G.Muller [Sat, 27 Feb 2016 20:59:52 +0000]
Fix bug #45599 (inclusion of keysym.h in Xaw)

8 years agoFix bug #45773 (needless #inclusion of cairo-xlib.h)
H.G.Muller [Sat, 27 Feb 2016 19:50:27 +0000]
Fix bug #45773 (needless #inclusion of cairo-xlib.h)

As this header no longer exists this was causing a compilation error.
In the GTK version they are of course never needed, and the draw.c
that is also part of an Xaw build also does not call any function to
draw on an Xaw surface directly.

8 years agoFix bug #45775 (Infinite loop on nonexistent texture file)
H.G.Muller [Sat, 27 Feb 2016 19:45:01 +0000]
Fix bug #45775 (Infinite loop on nonexistent texture file)

8 years agoFix bug #45774 (GTK compile bug with ENABLE_NLS)
H.G.Muller [Sat, 27 Feb 2016 19:37:09 +0000]
Fix bug #45774 (GTK compile bug with ENABLE_NLS)

The declaration of an XFontSet function was not protected by

8 years agoMove Common Engine dialog to Engine menu (WB)
H.G.Muller [Sat, 27 Feb 2016 16:06:33 +0000]
Move Common Engine dialog to Engine menu (WB)

The item is renamed to "Common Settings", whith shortut 'C'.
The "Edit Engine List" item is also assigned a shortcut ('E').

8 years agoUse mouse wheel for selecting piece in Edit Position mode (XB)
H.G.Muller [Fri, 26 Feb 2016 22:35:39 +0000]
Use mouse wheel for selecting piece in Edit Position mode (XB)

Rather than calling ForwardEvent() and BackwardEvent() directly from the
mouse-wheel handler, we now call a backend routine Wheel(), which gets
the pointer coordinates passed to it (which we must remember during
mouse move events). This then calls the Forward/Backward event, except
in EditPosition mode, where it changes the piece in the square below the
pointer.

8 years agoAllow promotion choice in engine-defined variants
H.G.Muller [Wed, 17 Feb 2016 19:55:36 +0000]
Allow promotion choice in engine-defined variants

When variant shatranj, courier or makruk, which normally do not have
promotion choice, are used as parent for an engine-defined variant,
we now invoke the piece-selection routine. This to make these variants
also suitable as parent for variants that do have choice (e.g. to give
them the baring rule, which is unique for Shatranj).

8 years agoFix erasing of arrow highlight (XB)
H.G.Muller [Wed, 17 Feb 2016 11:47:45 +0000]
Fix erasing of arrow highlight (XB)

On large board with long-range oblique moves (like in Grande Acedrex)
the head of the arrow was not always erased (and not always drawn either).
This was partly due to the arrow pointing to a corner of the target square
even if the path was nearly orthogonal, while the damage trail is always
assumed to connect the square centers. Having the arrow point more
precisely and widening the damage trail a bit solved the problem.

8 years agoAllow promotion on two-leg move
H.G.Muller [Tue, 9 Feb 2016 09:59:31 +0000]
Allow promotion on two-leg move

After a second-leg of a SAN move the parser now checks for apromotion
suffix, and if any is found this is used by ParseOneMove / LoadGameOneMove
to set the promoChar. In converting to SAN for the parseList the promoChar
is now appended to the second leg, rather than the first, and the Edit Book
window will also show it. The promochar is written behind the kill square
in the moveList, and when sending the move there to the engine it is
appended to the second move of the multi-move pair.

8 years agoFix type-in of hit-and-run captures
H.G.Muller [Tue, 9 Feb 2016 09:25:40 +0000]
Fix type-in of hit-and-run captures

Processing of the move in ParseOneMove (which basically duplicates
the code of LoadGameOneMove) was not yet adapted to ignore ';' as a
promotion character when it is internally used to append 'kill squares'
where locust capture should take place..

8 years agoAllow setting of piece nicknames from pieceToChar string
H.G.Muller [Tue, 9 Feb 2016 08:53:44 +0000]
Allow setting of piece nicknames from pieceToChar string

A piece IDs in the pieceToChar string can now be suffixed by "=L",
with L an arbitrary single letter, to define a nickname for the piece.
Such a nickname would make it possible to specify a complex ID like +I'
as promotion choice, and by indicating this in the pieceToChar string
the engine can configure that through the 'setup' command. This facility
is needed to force promotion after capture of a contageous piece in
variants with Shogi promotion, such as Maka Dai Dai Shogi.

8 years agoSlight speedup of parsing promotion suffix
H.G.Muller [Tue, 9 Feb 2016 08:31:11 +0000]
Slight speedup of parsing promotion suffix

8 years agoFix printing of 'x' in position diagram
H.G.Muller [Mon, 8 Feb 2016 12:21:20 +0000]
Fix printing of 'x' in position diagram

The times where 'x' was used as PieceToChar result for an empty square
are long behind us; 'x' now is a valid piece ID.

8 years agoImprove variant recognition for enabling buttons (XB)
H.G.Muller [Sun, 7 Feb 2016 21:48:34 +0000]
Improve variant recognition for enabling buttons (XB)

Buttons for variants were enabled when the name of the variant they
selected was a sub-string of waht the engine could play, so that
Grand Chess (variant grand) would be enabled by Fairy-Max' grande-acedrex.
Now we test if the matched sub-string of the engine's variants feature
is immediately followed by a comma (or at the end).

8 years agoFix using VariantMen PGN tag for both colors
H.G.Muller [Sat, 6 Feb 2016 17:18:29 +0000]
Fix using VariantMen PGN tag for both colors

Black pieces were not recognized as the same as white pieces.

8 years agoAlways assume FEN in variant-fairy PGN game is initial position
H.G.Muller [Sat, 6 Feb 2016 15:19:52 +0000]
Always assume FEN in variant-fairy PGN game is initial position

As variant fairy is a catch-all without a defined initial position,
the FEN tag n a PGN game for this variant must be considered an initial
position. So we copy over the FEN position to the initial one in this
case. Otherwise castling would always be thought illegal in fairy games
loaded from PGN.

8 years agoProcess VariantMen PGN tag
H.G.Muller [Sat, 6 Feb 2016 14:12:19 +0000]
Process VariantMen PGN tag

On loading a PGN game the VariantMen tag is now parsed, and the
move definitions are assigned to the mentioned pieces.
This only works when the pieceToCharTable is defined in advance!

8 years agoLet VarianMen PGN tag work with dressed letters
H.G.Muller [Sat, 6 Feb 2016 12:46:43 +0000]
Let VarianMen PGN tag work with dressed letters

The internal 'character' codes > 127 are now printed as letter + suffix.

8 years agoRemove debug printf
H.G.Muller [Sat, 6 Feb 2016 09:25:27 +0000]
Remove debug printf

8 years agoFix spurious promotion partners
H.G.Muller [Sat, 6 Feb 2016 09:21:21 +0000]
Fix spurious promotion partners

When defining a new promotion pairing through ^L the default partners
of L and +L must be made partnerless, or they would still promote to +L
or demote to L.

8 years agoFix printing of piece ID in illegal SAN moves
H.G.Muller [Fri, 5 Feb 2016 10:26:51 +0000]
Fix printing of piece ID in illegal SAN moves

Illegal SAN moves did not add ' or ! suffixes to the piece ID,
and printed shogi-promoted pieces as a '+' without ID.

8 years agoFix clipping of GTK menu-bar labels for broad boards
H.G.Muller [Fri, 5 Feb 2016 09:06:09 +0000]
Fix clipping of GTK menu-bar labels for broad boards

The number of characters kept in the menu-bar labels was dependent on
square size, but did not take into account the number of files of the
board. So when there were more than 8 files, the label texts were often
clipped while there was in fact plenty of room to display them fully.
Now the adjustment of square size based on number of board files is done
after the other window parameters have been picked based on the window
width calculated as 8*squareSize. Only the default line gap is then
adapted to the actual square size (consistent with what is done during
user sizing of the board later).

8 years agoChange the piece order again
H.G.Muller [Thu, 4 Feb 2016 18:43:14 +0000]
Change the piece order again

The internal piece encoding is now altered such that the uninteresting
ones (promoted Shogi pieces and symmetry partners) are all at the end,
just before King. These now start with the PromoBishop. A slash in the
pieceToChar string skips to this new 'promoted series', so that strings
can be made 'future proof' (for when new pieces are added before it).
The promoted Chu pieces all get new book keys by this, but as it is
unlikely that they occurin opening lines, this was considered acceptable.
The +L, +T in Chu are now represented by Pegasus and Gnu rather than
Knight and Chancellor, but the latter two are defined as fall-backs to
remain compatible with old Chu themes.
The +N, +L, +S replacements in Shogi are now also taken from amongst the
regular pieces, rather than extra images stored beyond King.

8 years agoAdapt Chu-Shogi pieceToCharTable to new piece order
H.G.Muller [Wed, 3 Feb 2016 09:24:17 +0000]
Adapt Chu-Shogi pieceToCharTable to new piece order

8 years agoFix demoting in Edit Position mode
H.G.Muller [Wed, 3 Feb 2016 08:34:42 +0000]
Fix demoting in Edit Position mode

A click on an already selected demotable piece will now cause demotion,
rather than disappearance of that piece, similar to how clicks on a
selected promotable piece will promote it.

8 years agoClear highlights after moving piece in Edit Position
H.G.Muller [Wed, 3 Feb 2016 08:23:15 +0000]
Clear highlights after moving piece in Edit Position

When moving a piece during Edit position the from-square remained
highlighted, but the to square was not highlighted, which would
create the erroneous impression that the (now-empty) from-square
was selected (and ready to obliterate a piece on the next click).
Now this highlight is cleared. This was preferred over also highlighting
the to-square, because this is not really a move in a game.

8 years agoFix aborted detour under-promotion XB
H.G.Muller [Tue, 2 Feb 2016 18:18:13 +0000]
Fix aborted detour under-promotion XB

When a dragged Pawn was released before the promotion piece was fixed,
this would fake a release on the from-square. But the repair of animation
damage would take place on the to-square derived from the actual mouse
coordinates. When this was different from the from-square, the animation
damage (consisting of removalof the piece) would thus not be repaired
by redrawing that square, as normally (when the to-square is different)
it should remain empty. Now we mark the from-square as damaged when the
detour under-promotion changes the dragged piece.

8 years agoFix default piece in Shogi promotions
H.G.Muller [Tue, 2 Feb 2016 16:34:53 +0000]
Fix default piece in Shogi promotions

In Shogi the default should be promotion, but it was using Queen like
the other variants. As the +/= issue was decided based on comparing this
default promotion piece with the moved piece, the Lance (which internally
is represented by Queen) would by default defer. Now the up-click of
a drag-drop move (which would bypass sweep selection) sets the default
choice to the promoted partner if the pieceToCharTable specifies one.

8 years agoFix sweep promotions to Tokin
H.G.Muller [Tue, 2 Feb 2016 16:31:41 +0000]
Fix sweep promotions to Tokin

Sweep promotions of multiple pieces to Tokin were not working, because
once the promoted version was shown it would always demote to Pawn.
Now the toggle always demotes to the selected piece.

8 years agoFix setting default piece from 'choice' command
H.G.Muller [Tue, 2 Feb 2016 12:10:24 +0000]
Fix setting default piece from 'choice' command

PieceToCharwas used instead of CharToPiece. In addition it is important
to deduce the color from currentMoe rather than forwardMostMove, as
one could be entering a move in the middle of a game (e.g. when editing
or starting a variation).

8 years agoFix two compiler warnings
H.G.Muller [Tue, 2 Feb 2016 11:09:17 +0000]
Fix two compiler warnings

8 years agoAllow pieces with dressed-letter ID as promotion choice
H.G.Muller [Tue, 2 Feb 2016 08:27:34 +0000]
Allow pieces with dressed-letter ID as promotion choice

Testing for the occurrence of a piece in the promotion set specified
through the 'choice' command now takes dressing of the piece IDs into
account.

8 years agoFix castling rights
H.G.Muller [Mon, 1 Feb 2016 20:51:04 +0000]
Fix castling rights

The expansion of the number of piece types to > 64 had broken the
accounting of castling rights, because the code for NoRights is also
a piece code (as it is stored in the board), and had gotten a value
so high that it could no longer be stored as signed char. This is
solved by declaring the initialRights array as unsigned char instead.

8 years agoImplement engine-requested settings-popup WB
H.G.Muller [Mon, 1 Feb 2016 19:45:14 +0000]
Implement engine-requested settings-popup WB

8 years agoAllow O1 as Betza castling descriptor
H.G.Muller [Mon, 1 Feb 2016 16:32:05 +0000]
Allow O1 as Betza castling descriptor

The notation On is now also recognized as castling for n=1, but this
uses the same system as non-royal castling ('guarding'), which is
performed as hit-and-run capture of the Rook (or whatever you want to
castle with) while moving to the destination (one square away here).
This to avoid the ambiguity with normal King moves (which for the
guarding always existed).

8 years agoAllow engine to force popup of its settings dialog
H.G.Muller [Sun, 31 Jan 2016 23:12:41 +0000]
Allow engine to force popup of its settings dialog

An engine can now force popping up of its settings dialog by sending
'feature done=3' to the GUI. It can clear its option list (e.g. for the
purpose of resending it because of altered settings) by sending
'feature done=0'. Such resending would cause the dialog to be updated
when it was already open, or close it and pop up a new one when the
engine specifies it has to be redesigned by ending the list with
'feature done=2'.

8 years agoChange pieceToCharTable order of pieces beyond Lion
H.G.Muller [Sun, 31 Jan 2016 16:28:40 +0000]
Change pieceToCharTable order of pieces beyond Lion

The positions in the pieceToCharstring no longer correspond to internal
piece type, but are remapped such that more useful symbols reside near
the beginning. The piece types themselves could not be re-ordered,
as this would alter the calculation of the opening-book hash key.