1244 Commits

Author SHA1 Message Date
d0500732f7 In GTK frontend, bind mouse8/mouse9 to undo/redo.
These button codes are generated by the back/forward button pair on
the sides of some mice, and web browsers treat these as the back and
forward actions in the page history.
2015-10-14 21:22:44 +01:00
ef5c017a5f Add hinting feature to Guess.
Pressing H now suggests the lexicographically first row consistent
with all previous feedback.

The previous function of the H key to toggle a hold marker on the
current peg is now performed by Space / CURSOR_SELECT2, which is more
in line with other puzzles anyway.
2015-10-14 21:21:27 +01:00
cd67072556 Add standalone Fifteen solver, based on the hint feature.
Recall that the hint feature is really an incremental solver.  Apply
it repeatedly until the board is solved. Grade puzzles as solvable
or unsolvable by checking their parity.
2015-10-14 20:29:32 +01:00
12fabc4add Add hinting feature to Fifteen (press 'h' for a hint).
This is really an incremental solver. It alternates between solving
rows and solving columns. Each row and column is solved one piece at
a time. Except for some temporary trickery with the last two pieces
in a row or column, once a piece is solved it is never moved again.

(On non-square grids it first solves some rows or some columns until
the unsolved part is a square, then starts alternating.)
2015-10-14 20:29:32 +01:00
5ddb011a57 Invert the Fifteen cursor if FIFTEEN_INVERT_CURSOR ~= ^[yY].*$
The introduction of flip_cursor allows us to replace some hairy
hand-rolled logic with the standardised and tested move_cursor.
2015-10-14 20:29:32 +01:00
988b16a319 End victory flash on new game and restart game.
Net provides the best demonstration of why. Complete a game of net,
then press N while the victory flash is playing: then the victory
flash keeps playing on the new game board. (Tip: save a game which
but for a redo is completed, then you can reproduce this repeatedly
without having to complete a new game each time.)

The flash timer reset code is placed together with the animation
timer reset code, because the two are conceptually related. Note
that midend_restart_game resets animations via midend_finish_move.
2015-10-14 20:29:32 +01:00
bf81e9c1fa Reset midend animation counters on starting a new game.
This is already done in midend_restart_game via midend_finish_move.
If it's good enough for restarting a game, it ought to also be good
enough for starting new games.
2015-10-14 20:29:32 +01:00
af010d7283 Remove a redundant line of code.
Setting me->anim_time = 0.0 right before calling midend_finish_move is
redundant, since midend_finish_move itself sets me->anim_time = 0.
2015-10-14 20:29:32 +01:00
f3f0f009ff Don't stop animations when restarting an already restarted game.
Restarting a game that is already in the restarted state is meant to
be a no-op.  It stopped animations.  Don't do this.

Also, given that midmidend_restart_game called midend_stop_anim
twice, the invocation we remove was redundant.
2015-10-14 20:29:32 +01:00
156b0c3e23 Stop animations on a new game, no matter how it is started.
Animations were stopped if a new game was initiated with a keyboard
shortcut (n, N, Ctrl-N), but not via menu items such as presets or
custom configurations, nor (perhaps not a problem) on starting the
program. Fix this, so that animations are stopped on a new game no
matter how the new game is started.
2015-10-14 20:29:32 +01:00
11b14a5f44 GTK 3 cleanup: stop using GtkDialog for config boxes.
It's becoming annoying to keep working within the increasing
restrictions on GtkDialog, in particular the fact that not only do we
have to let it have complete control of the button area, but also it's
not clear whether we can intercept a press of the 'OK' button and
display an error message rather than ending the dialog.

So, as I did in PuTTY, I'm resorting to using an ordinary GtkWindow
with controls I laid out myself.
2015-10-04 20:10:41 +01:00
27fe1c9c49 GTK 3 cleanup: use GtkAboutDialog for the About box.
This is again easier than faffing about doing it manually, and as an
added bonus, we get to put the largest of our icons in the box as a
logo :-)
2015-10-04 19:57:25 +01:00
a94dbd27d0 GTK 3 cleanup: use GtkMessageDialog for message_box().
This is a lot easier than faffing about setting up a dialog box
ourself, and also avoids direct access to GtkDialog's action area
(deprecated in GTK 3.16).
2015-10-04 19:56:39 +01:00
2afbcdcc3c GTK 3.16 deprecation: stop using gtk_misc_set_alignment.
The new equivalent is gtk_label_set_{x,y}align. But we can't use that
in all GTK 3 builds, because it's very new.
2015-10-04 19:33:44 +01:00
5e22080bcd Improve Towers error highlighting.
Highlight clues of value n in Towers if its row/column contains an
increasing sequence of length n, the last number of which is not equal
to the number of rows/columns (i.e. such that the sequence will have
to be extended, in violation of the clue).
2015-10-03 18:17:25 +01:00
21b8323b2f Dominosa: Highlight a number when pressed on the keyboard. 2015-10-03 18:16:01 +01:00
a800ff16bb Fix switching to a larger puzzle size under GTK 2.
Commit 8b491946e had a bug: configure_area stopped doing most of its
work if the new size already matched fe->w and fe->h, but in fact the
GTK2 resize_fe() _already_ set up fe->w and fe->h for the new size. I
managed not to notice, because I checked it all worked on GTK 3 but
only tested resizing to a _smaller_ puzzle on GTK 2. Ahem.

Now we don't change fe->w and fe->h at all until configure_area is
called. Also, we initialise them to dummy values at setup time, so
that configure_area won't compare the new size with uninitialised
data.
2015-10-03 18:01:18 +01:00
e22a9c8396 build fix 2015-10-03 17:39:22 +01:00
581becc3aa Insert a manual reference in the default status bar text.
To guide developers to the resources they need.

[actual wording tweaked by SGT]
2015-10-03 17:12:20 +01:00
b94be41445 Render Filling presets as 'WxH', not 'HxW'. 2015-10-03 17:12:20 +01:00
47bc27b0c2 Add 'Inshi No Heya' (multiplication only) variant to Keen. 2015-10-03 17:12:20 +01:00
6482ed0e3c Fix a display glitch in Keen's pencil-mode cursor.
Draw pencil-mode cursor before corners of thick lines in order to make
the thick lines appear on top of the north-west corner of the pencil
cursor, just like they do with the non-pencil cursor.
2015-10-03 17:12:20 +01:00
b9dfef7a12 Recompute solutions in Inertia if the user strays from the path. 2015-10-03 17:12:20 +01:00
bda4a963f4 Fix an instance generation hang in Signpost.
Also expand the set of permissible parameters (add 1xN, Nx1 and 2x2).
2015-10-03 17:12:20 +01:00
d442b830e4 Greatly improve and speed up the Filling instance generation. 2015-10-03 17:12:20 +01:00
a55607ff24 Greatly increase the speed of the Filling solver. 2015-10-03 17:12:20 +01:00
79fe68dc57 Towers: allow marking of clues as done with the keyboard 2015-10-03 17:12:20 +01:00
6179e8df56 Allow marking of clues as exhausted in Unequal. 2015-10-03 17:12:20 +01:00
a79fc46951 Display improvements to Range.
Make the grid look a lot less heavy; enhance highlighting of error
clues; highlight enclosed small regions much more prettily.
2015-10-03 17:12:01 +01:00
8889fafb07 Fix a misrendering in Guess.
When the cursor was visible, redrawing after undo-redo or label
toggling or resizing would draw background over the top of the
circular cursor.
2015-10-03 17:08:21 +01:00
5cb91f28ba Fix a memory error in Guess cursor handling. 2015-10-03 16:59:10 +01:00
ea8da331e3 Cancel dragging in Pearl by pressing Escape or Backspace. 2015-10-03 16:59:10 +01:00
bf8ff09a84 Change Pearl's cursor logic.
Keyboard dragging while holding Control now moves the cursor to the
target square. Shift-Control-arrowkey performs the previous behavior
of Control-arrowkey.
2015-10-03 16:59:04 +01:00
d64a79e2b8 Refactor Pearl's mark_in_direction, and invert a parameter. 2015-10-03 16:59:04 +01:00
8e35087e09 Refactor modifier handling in Pearl's cursor code. 2015-10-03 16:59:04 +01:00
11a394f69b Add more keyboard controls to Slant. 2015-10-03 16:59:04 +01:00
ebf31f52b0 Slant: hide keyboard cursor when using the mouse. 2015-10-03 16:59:04 +01:00
e59f820383 Rectangles: cancel keyboard drag with Escape. 2015-10-03 16:59:04 +01:00
c469bd285c Filling: enable keyboard-driven cursor dragging mode. 2015-10-03 16:59:04 +01:00
d5f7c4f871 Range: add pencil marks to squares by Shift-cursor keys. 2015-10-03 16:58:50 +01:00
7478275c8b Pattern: color multiple squares with Ctrl- or Shift-cursor keys. 2015-10-03 16:58:24 +01:00
9e1a7d87cd Add game_text_format to Tents.
Replaces an inactive stub implementation.
2015-10-03 16:58:18 +01:00
051ab1701e Add game_text_format to Pattern. 2015-10-03 16:58:18 +01:00
d0f88aafa4 Add game_text_format to Inertia. 2015-10-03 16:58:18 +01:00
e4d5b11bd8 Add game_text_format to Flip. 2015-10-03 16:58:18 +01:00
7543082f26 Add game_text_format to Pearl. 2015-10-03 16:58:18 +01:00
02434a6ed1 Add game_text_format to Dominosa. 2015-10-03 16:58:18 +01:00
dc688b1f23 Unequal: stop ignoring keys 'h' and 'm' while cursor active.
At least, so long as 'h' and 'm' are not "numbers".
2015-10-03 16:58:11 +01:00
87b2758b9c Fix a memory leak in Range's find_errors.
Only occurred in invalid instances, such as 3x1:1b when you put a
black in the middle square.
2015-10-03 16:58:05 +01:00
9b1b7e0f3a Don't overallocate colour memory in Loopy. 2015-10-03 16:58:05 +01:00