chiark / gitweb /
sgt-puzzles.git
8 years agoFix a comment in Tents (it said 'tents' instead of 'trees').
Jonas Kölker [Sun, 18 Oct 2015 19:05:11 +0000 (21:05 +0200)]
Fix a comment in Tents (it said 'tents' instead of 'trees').

8 years agoHighlight clue errors in Tracks in some more situations.
Jonas Kölker [Tue, 13 Oct 2015 13:47:42 +0000 (15:47 +0200)]
Highlight clue errors in Tracks in some more situations.

 - Count any square as having a track either if the square is marked
   as such (rendered as a different background), or if at least one
   adjacent edge is marked as containing a segment of train track
   (rendered as train tracks if they're placed, else as an '=').

 - Do the same counting in rows and columns.

8 years agoIn Undead, mark clues as errors in a few more situations.
Jonas Kölker [Mon, 12 Oct 2015 18:07:18 +0000 (20:07 +0200)]
In Undead, mark clues as errors in a few more situations.

 - Mark a clue as an error if too many monsters are seen, even if
   some squares are empty.

 - Mark a clue as an error if too few monsters are seen, taking into
   account how many more sightings are possible given the number of
   empty squares and how many times each of them are visited.

8 years agoFix array overruns in the new Filling solver pass.
Simon Tatham [Wed, 21 Oct 2015 17:32:15 +0000 (18:32 +0100)]
Fix array overruns in the new Filling solver pass.

Probably because I wrote a couple of loops up to the maximum cell
value using the non-idiomatic <= for their termination test, I also
managed to use <= inappropriately for iterating over every cell of the
grid, leading to a couple of references just off the end of arrays.

Amusingly, it was the Emscripten front end which pointed this out to
me by actually crashing as a result! Though valgrind found it just
fine too, once I thought to run that. But it comes to something when
running your C program in Javascript detects your memory errors :-)

8 years agoEnhance Filling's solver to handle large ghost regions.
Simon Tatham [Tue, 20 Oct 2015 19:33:53 +0000 (20:33 +0100)]
Enhance Filling's solver to handle large ghost regions.

The previous solver could cope with inferring a '1' in an empty
square, but had no deductions that would enable it to infer the
existence of a '4'-sized region in 5x3:52d5b1a5b3. The new solver can
handle that, and I've made a companion change to the clue-stripping
code so that it aims to erase whole regions where possible so as to
actually present this situation to the player.

Current testing suggests that at the smallest preset a nontrivial
ghost region comes up in about 1/3 of games, and at the largest, more
like 1/2 of games. I may yet decide to introduce a difficulty level at
which it's skewed to happen more often still and one at which it
doesn't happen at all; but for the moment, this at least gets the
basic functionality into the code.

8 years agoAdd the new 'fifteensolver' to .gitignore.
Simon Tatham [Sun, 18 Oct 2015 16:04:35 +0000 (17:04 +0100)]
Add the new 'fifteensolver' to .gitignore.

8 years agoUse \q{} in place of literal quote marks in puzzles.but.
Simon Tatham [Sun, 18 Oct 2015 16:03:10 +0000 (17:03 +0100)]
Use \q{} in place of literal quote marks in puzzles.but.

While checking over the Palisade docs for this sort of error, I
happened to notice that a few were already in the existing games'
documentation.

8 years agoAdd a new puzzle: Palisade.
Jonas Kölker [Fri, 2 Oct 2015 11:13:39 +0000 (13:13 +0200)]
Add a new puzzle: Palisade.

8 years agoFix GTK puzzle resizing, *again*.
Simon Tatham [Sun, 18 Oct 2015 13:22:27 +0000 (14:22 +0100)]
Fix GTK puzzle resizing, *again*.

Jonas Kölker points out that commit a800ff16b (which fixed a bug in
the previous attempt) left in another bug: if the puzzle size was
changed while the window was maximised, the system would fail to
recompute the tile size and would redraw completely wrongly.

So it's not optional after all to run midend_size(), even if the
drawing area size hasn't changed. I've reverted that code to be
unconditional, and now only the refresh of the Cairo-side backing
store system is conditionalised - and that's conditionalised on
changes to either the size of the actual window _or_ the size of the
contained pixmap. (The latter should defend against redraw failure in
the case where the puzzle aspect ratio changes, so that neither the
window size nor the tile size changes but a recentre is still needed.)

I _think_ this now fixes all the cases of resizing: this time I've
tested making an unmaximised puzzle window bigger or smaller, and
within a maximised window, forcing the puzzle to scale up, scale down,
or change its aspect ratio without changing its tile size. All work,
on GTK2 and GTK3, and yet we still don't get the visible flicker on
status line updates that was the reason I started fiddling with this
code in the first place.

(We _do_ still call configure_area on every update of the status line,
at least under GTK3; that's going to cause a forced full redraw on
every timer tick in Mines, which is wasteful of CPU, so it would still
be nice to find a better way of identifying the cases in which no
resizing at all was necessary and we could avoid renewing the game
drawstate. But the current code at least doesn't have any display
_errors_ that I know of, which is an improvement on its previous
state.)

8 years agoProduce shorter Filling descriptions by run-length encoding 0s.
Jonas Kölker [Wed, 7 Oct 2015 20:52:54 +0000 (22:52 +0200)]
Produce shorter Filling descriptions by run-length encoding 0s.

8 years agoExpand keyboard input options in Bridges, for faster entry.
Jonas Kölker [Mon, 5 Oct 2015 15:59:39 +0000 (17:59 +0200)]
Expand keyboard input options in Bridges, for faster entry.

- Lay bridges (crosess) with Control-arrow (Shift-arrow)
- Jump (non-orthogonally) to nearby islands with number keys, a..f
- Mark islands as done with a single tap on the space bar

8 years agoFix two memory leaks in GTK frontend.
Jonas Kölker [Tue, 6 Oct 2015 23:08:11 +0000 (01:08 +0200)]
Fix two memory leaks in GTK frontend.

 - The file selector for loading and saving gets a g_free().
 - The handling of saving (menu_save_event) gets an sfree().
 - It's also slightly restructured to prevent future errors.
 - menu_load_event was already structured to prevent this error.
 - The OLD_FILESEL code seems to not need a g_free().

8 years agoFix a typo in a Bridges error message.
Jonas Kölker [Mon, 5 Oct 2015 10:19:47 +0000 (12:19 +0200)]
Fix a typo in a Bridges error message.

'contain_ER_s' becomes 'contains'.

8 years agoFix Bridges keyboard cursor vertical out-of-bounds error.
Jonas Kölker [Mon, 5 Oct 2015 08:03:57 +0000 (10:03 +0200)]
Fix Bridges keyboard cursor vertical out-of-bounds error.

Position the cursor in the top (bottom) row, press enter and press up
(down).  The game acts as if you had pressed right, both with Enter-
and Space-based dragging.

8 years agoUpdate Sixteen keyboard system for faster entry.
Jonas Kölker [Thu, 1 Oct 2015 14:44:43 +0000 (16:44 +0200)]
Update Sixteen keyboard system for faster entry.

Pressing Ctrl-arrow or Shift-arrow on a tile now moves the row or
column under the tile. With Ctrl, the cursor moves as well so you can
keep making moves that affect the same tile; with Shift, the cursor
stays put so you can keep making moves that affect the same location.

8 years agoIn GTK frontend, bind mouse8/mouse9 to undo/redo.
Jonas Kölker [Fri, 2 Oct 2015 16:17:15 +0000 (18:17 +0200)]
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.

8 years agoAdd hinting feature to Guess.
Jonas Kölker [Thu, 1 Oct 2015 20:53:53 +0000 (22:53 +0200)]
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.

8 years agoAdd standalone Fifteen solver, based on the hint feature.
Jonas Kölker [Thu, 8 Oct 2015 10:55:52 +0000 (12:55 +0200)]
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.

8 years agoAdd hinting feature to Fifteen (press 'h' for a hint).
Jonas Kölker [Thu, 8 Oct 2015 10:20:15 +0000 (12:20 +0200)]
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.)

8 years agoInvert the Fifteen cursor if FIFTEEN_INVERT_CURSOR ~= ^[yY].*$
Jonas Kölker [Thu, 8 Oct 2015 09:57:54 +0000 (11:57 +0200)]
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.

8 years agoEnd victory flash on new game and restart game.
Jonas Kölker [Thu, 8 Oct 2015 09:00:29 +0000 (11:00 +0200)]
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.

8 years agoReset midend animation counters on starting a new game.
Jonas Kölker [Thu, 8 Oct 2015 08:54:47 +0000 (10:54 +0200)]
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.

8 years agoRemove a redundant line of code.
Jonas Kölker [Thu, 8 Oct 2015 08:47:11 +0000 (10:47 +0200)]
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.

8 years agoDon't stop animations when restarting an already restarted game.
Jonas Kölker [Thu, 8 Oct 2015 08:43:51 +0000 (10:43 +0200)]
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.

8 years agoStop animations on a new game, no matter how it is started.
Jonas Kölker [Wed, 7 Oct 2015 22:17:19 +0000 (00:17 +0200)]
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.

8 years agoGTK 3 cleanup: stop using GtkDialog for config boxes.
Simon Tatham [Sun, 4 Oct 2015 19:03:50 +0000 (20:03 +0100)]
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.

8 years agoGTK 3 cleanup: use GtkAboutDialog for the About box.
Simon Tatham [Sun, 4 Oct 2015 18:57:25 +0000 (19:57 +0100)]
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 :-)

8 years agoGTK 3 cleanup: use GtkMessageDialog for message_box().
Simon Tatham [Sun, 4 Oct 2015 18:56:39 +0000 (19:56 +0100)]
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).

8 years agoGTK 3.16 deprecation: stop using gtk_misc_set_alignment.
Simon Tatham [Sun, 4 Oct 2015 18:30:08 +0000 (19:30 +0100)]
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.

8 years agoImprove Towers error highlighting.
Jonas Kölker [Thu, 1 Oct 2015 16:47:55 +0000 (18:47 +0200)]
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).

8 years agoDominosa: Highlight a number when pressed on the keyboard.
Jonas Kölker [Thu, 1 Oct 2015 15:35:40 +0000 (17:35 +0200)]
Dominosa: Highlight a number when pressed on the keyboard.

8 years agoFix switching to a larger puzzle size under GTK 2.
Simon Tatham [Sat, 3 Oct 2015 16:57:01 +0000 (17:57 +0100)]
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.

8 years agobuild fix
Simon Tatham [Sat, 3 Oct 2015 16:39:22 +0000 (17:39 +0100)]
build fix

8 years agoInsert a manual reference in the default status bar text.
Jonas Kölker [Sat, 3 Oct 2015 13:01:48 +0000 (15:01 +0200)]
Insert a manual reference in the default status bar text.

To guide developers to the resources they need.

[actual wording tweaked by SGT]

8 years agoRender Filling presets as 'WxH', not 'HxW'.
Jonas Kölker [Fri, 2 Oct 2015 16:23:44 +0000 (18:23 +0200)]
Render Filling presets as 'WxH', not 'HxW'.

8 years agoAdd 'Inshi No Heya' (multiplication only) variant to Keen.
Jonas Kölker [Thu, 1 Oct 2015 20:32:26 +0000 (22:32 +0200)]
Add 'Inshi No Heya' (multiplication only) variant to Keen.

8 years agoFix a display glitch in Keen's pencil-mode cursor.
Jonas Kölker [Thu, 1 Oct 2015 19:59:30 +0000 (21:59 +0200)]
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.

8 years agoRecompute solutions in Inertia if the user strays from the path.
Jonas Kölker [Thu, 1 Oct 2015 19:29:42 +0000 (21:29 +0200)]
Recompute solutions in Inertia if the user strays from the path.

8 years agoFix an instance generation hang in Signpost.
Jonas Kölker [Thu, 1 Oct 2015 19:22:24 +0000 (21:22 +0200)]
Fix an instance generation hang in Signpost.

Also expand the set of permissible parameters (add 1xN, Nx1 and 2x2).

8 years agoGreatly improve and speed up the Filling instance generation.
Jonas Kölker [Thu, 1 Oct 2015 19:12:13 +0000 (21:12 +0200)]
Greatly improve and speed up the Filling instance generation.

8 years agoGreatly increase the speed of the Filling solver.
Jonas Kölker [Thu, 1 Oct 2015 17:57:49 +0000 (19:57 +0200)]
Greatly increase the speed of the Filling solver.

8 years agoTowers: allow marking of clues as done with the keyboard
Jonas Kölker [Thu, 1 Oct 2015 16:41:15 +0000 (18:41 +0200)]
Towers: allow marking of clues as done with the keyboard

8 years agoAllow marking of clues as exhausted in Unequal.
Jonas Kölker [Thu, 1 Oct 2015 16:26:50 +0000 (18:26 +0200)]
Allow marking of clues as exhausted in Unequal.

8 years agoDisplay improvements to Range.
Jonas Kölker [Thu, 1 Oct 2015 15:50:59 +0000 (17:50 +0200)]
Display improvements to Range.

Make the grid look a lot less heavy; enhance highlighting of error
clues; highlight enclosed small regions much more prettily.

8 years agoFix a misrendering in Guess.
Jonas Kölker [Thu, 1 Oct 2015 15:42:48 +0000 (17:42 +0200)]
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.

8 years agoFix a memory error in Guess cursor handling.
Jonas Kölker [Thu, 1 Oct 2015 12:00:47 +0000 (14:00 +0200)]
Fix a memory error in Guess cursor handling.

8 years agoCancel dragging in Pearl by pressing Escape or Backspace.
Jonas Kölker [Tue, 22 Sep 2015 09:41:41 +0000 (11:41 +0200)]
Cancel dragging in Pearl by pressing Escape or Backspace.

8 years agoChange Pearl's cursor logic.
Jonas Kölker [Tue, 22 Sep 2015 09:37:17 +0000 (11:37 +0200)]
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.

8 years agoRefactor Pearl's mark_in_direction, and invert a parameter.
Jonas Kölker [Tue, 22 Sep 2015 09:19:53 +0000 (11:19 +0200)]
Refactor Pearl's mark_in_direction, and invert a parameter.

8 years agoRefactor modifier handling in Pearl's cursor code.
Jonas Kölker [Tue, 22 Sep 2015 09:18:31 +0000 (11:18 +0200)]
Refactor modifier handling in Pearl's cursor code.

8 years agoAdd more keyboard controls to Slant.
Jonas Kölker [Mon, 21 Sep 2015 16:34:53 +0000 (18:34 +0200)]
Add more keyboard controls to Slant.

8 years agoSlant: hide keyboard cursor when using the mouse.
Jonas Kölker [Mon, 21 Sep 2015 16:22:34 +0000 (18:22 +0200)]
Slant: hide keyboard cursor when using the mouse.

8 years agoRectangles: cancel keyboard drag with Escape.
Jonas Kölker [Mon, 21 Sep 2015 15:44:50 +0000 (17:44 +0200)]
Rectangles: cancel keyboard drag with Escape.

8 years agoFilling: enable keyboard-driven cursor dragging mode.
Jonas Kölker [Mon, 21 Sep 2015 15:41:10 +0000 (17:41 +0200)]
Filling: enable keyboard-driven cursor dragging mode.

8 years agoRange: add pencil marks to squares by Shift-cursor keys.
Jonas Kölker [Mon, 21 Sep 2015 15:39:47 +0000 (17:39 +0200)]
Range: add pencil marks to squares by Shift-cursor keys.

8 years agoPattern: color multiple squares with Ctrl- or Shift-cursor keys.
Jonas Kölker [Mon, 21 Sep 2015 15:33:02 +0000 (17:33 +0200)]
Pattern: color multiple squares with Ctrl- or Shift-cursor keys.

8 years agoAdd game_text_format to Tents.
Jonas Kölker [Mon, 21 Sep 2015 15:14:55 +0000 (17:14 +0200)]
Add game_text_format to Tents.

Replaces an inactive stub implementation.

8 years agoAdd game_text_format to Pattern.
Jonas Kölker [Mon, 21 Sep 2015 15:02:47 +0000 (17:02 +0200)]
Add game_text_format to Pattern.

8 years agoAdd game_text_format to Inertia.
Jonas Kölker [Mon, 21 Sep 2015 14:57:14 +0000 (16:57 +0200)]
Add game_text_format to Inertia.

8 years agoAdd game_text_format to Flip.
Jonas Kölker [Mon, 21 Sep 2015 14:54:38 +0000 (16:54 +0200)]
Add game_text_format to Flip.

8 years agoAdd game_text_format to Pearl.
Jonas Kölker [Mon, 21 Sep 2015 14:53:20 +0000 (16:53 +0200)]
Add game_text_format to Pearl.

8 years agoAdd game_text_format to Dominosa.
Jonas Kölker [Mon, 21 Sep 2015 14:49:56 +0000 (16:49 +0200)]
Add game_text_format to Dominosa.

8 years agoUnequal: stop ignoring keys 'h' and 'm' while cursor active.
Jonas Kölker [Mon, 21 Sep 2015 14:41:03 +0000 (16:41 +0200)]
Unequal: stop ignoring keys 'h' and 'm' while cursor active.

At least, so long as 'h' and 'm' are not "numbers".

8 years agoFix a memory leak in Range's find_errors.
Jonas Kölker [Mon, 21 Sep 2015 14:21:48 +0000 (16:21 +0200)]
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.

8 years agoDon't overallocate colour memory in Loopy.
Jonas Kölker [Mon, 21 Sep 2015 14:24:10 +0000 (16:24 +0200)]
Don't overallocate colour memory in Loopy.

8 years agoFix segfault in Range's game_text_format.
Jonas Kölker [Mon, 21 Sep 2015 13:55:53 +0000 (15:55 +0200)]
Fix segfault in Range's game_text_format.

Occurred on Nx1 puzzles, etc.

8 years agoFix typo in undo key handling.
Jonas Kölker [Mon, 21 Sep 2015 14:26:53 +0000 (16:26 +0200)]
Fix typo in undo key handling.

Now we can undo with both 'u' and 'U', symmetrically with redoing with
both 'r' and 'R'.

8 years agoInclude an example of Range's text_format in the comments.
Jonas Kölker [Mon, 21 Sep 2015 13:48:29 +0000 (15:48 +0200)]
Include an example of Range's text_format in the comments.

8 years agoFix a typo in the comments of Pearl.
Jonas Kölker [Mon, 21 Sep 2015 13:51:06 +0000 (15:51 +0200)]
Fix a typo in the comments of Pearl.

Each stone can have 2 lines radiating from its centre, not 3.

8 years agoAdd '-set colorspace RGB' to some icon convert commands.
Simon Tatham [Sat, 3 Oct 2015 12:15:59 +0000 (13:15 +0100)]
Add '-set colorspace RGB' to some icon convert commands.

Its absence was breaking the icon build on Ubuntu 14.04, because you
ask convert to map an image into a specific 16-colour palette, and it
does so and _then_ nonconsensually maps those colours in turn through
a colourspace transformation you didn't ask for, causing icon.pl to
fail an assertion when it finds an RGB value not in the palette.

8 years agoGTK 3 port: arrange configure.ac support for GTK 2/3 detection.
Simon Tatham [Sat, 3 Oct 2015 11:28:28 +0000 (12:28 +0100)]
GTK 3 port: arrange configure.ac support for GTK 2/3 detection.

GTK 3 is the default, falling back to GTK 2 if 3 isn't available; you
can also say --with-gtk=2 to force GTK 2.

8 years agoGTK 3 port: don't turn off drawing area double buffering.
Simon Tatham [Sat, 3 Oct 2015 11:28:26 +0000 (12:28 +0100)]
GTK 3 port: don't turn off drawing area double buffering.

I think I did this in GTK2 on the basis that our server-side cache
pixmap was double-buffering enough for us - any puzzle which erased a
big area with a background rectangle and then redrew over the top of
it would do so only on the off-screen pixmap, and the updates would
only be copied to the visible window after it was all done.

In GTK3, I don't think there's any need - this is all the usual way
things are done anyway, as far as I can see. So I've turned this call
back off, at least until I hear of a reason why I need it again.

8 years agoGTK 3 port: change API functions for widget sizing.
Simon Tatham [Sat, 3 Oct 2015 11:28:24 +0000 (12:28 +0100)]
GTK 3 port: change API functions for widget sizing.

set_usize is deprecated, and get_preferred_size is the GTK 3 thing we
should use in place of size_request.

8 years agoGTK 3 port: use GtkBox directly, not GtkHBox and GtkVBox.
Simon Tatham [Sat, 3 Oct 2015 11:28:21 +0000 (12:28 +0100)]
GTK 3 port: use GtkBox directly, not GtkHBox and GtkVBox.

I've done this by #defining the old names in terms of the new ones,
because the old ones are still more concise!

8 years agoGTK 3 port: be prepared not to use GtkStock.
Simon Tatham [Sat, 3 Oct 2015 11:28:19 +0000 (12:28 +0100)]
GTK 3 port: be prepared not to use GtkStock.

GTK 3 has deprecated it in favour of just making you specify fixed
strings as button labels, which seems like a step backwards to me but
there we go.

8 years agoGTK 3 port: use GdkRGBA for the window background colour.
Simon Tatham [Sat, 3 Oct 2015 11:28:17 +0000 (12:28 +0100)]
GTK 3 port: use GdkRGBA for the window background colour.

Suits our internal API better, anyway, with RGB components being
floats ranging from 0 to 1.

8 years agoGTK 3 port: stop getting default bg colour from the window style.
Simon Tatham [Sat, 3 Oct 2015 11:28:15 +0000 (12:28 +0100)]
GTK 3 port: stop getting default bg colour from the window style.

GTK3 window styles don't reliably provide one, so we have to fall back
to just making one up.

8 years agoGTK 3 port: condition out the complicated window resize code.
Simon Tatham [Sat, 3 Oct 2015 11:28:13 +0000 (12:28 +0100)]
GTK 3 port: condition out the complicated window resize code.

In GTK 2, we had a big pile of horrible code to deal with the fact
that it's very hard to open a window in such a way as to make it easy
to resize smaller as well as bigger.

Essentially, we'd open the window with the drawing area's minimum size
request set to the desired _initial_ window size; then we'd wait until
GTK had finished creating other window components (menu bar, status
line) and the window's size allocation had settled down, and finally
reduce the size request to the real minimum size so that now the
window was resizable in both directions. This also involved some
deliberate checking of the Ubuntu Unity GTK extension which steals the
menu bar and put it elsewhere (see commit 8f8333a35), to avoid us
waiting forever for a menu bar that wasn't going to show up.

But in GTK3, this has all become actually sensible! All we now have to
do is to set the window's geometry hints to indicate the drawing area
itself as the base widget (probably a good plan anyway), and then we
can set the initial size using gtk_window_set_default_geometry() and
resize it later using gtk_window_resize_to_geometry(). So now we can
completely condition out all of the previous horrors, and consider
them to be legacy GTK2 compatibility code only. Phew.

8 years agoGTK 3 port: provide a 'draw' handler.
Simon Tatham [Sat, 3 Oct 2015 11:28:11 +0000 (12:28 +0100)]
GTK 3 port: provide a 'draw' handler.

This is what GTK 3 uses in place of 'expose_event'. Also I've arranged
here for my internal USE_CAIRO_WITHOUT_PIXMAP setting to be enabled in
GTK3, as well as in GTK2 with deprecated functions disabled.

8 years agoGTK 3 port: use GtkGrid as an alternative to GtkTable.
Simon Tatham [Sat, 3 Oct 2015 11:28:09 +0000 (12:28 +0100)]
GTK 3 port: use GtkGrid as an alternative to GtkTable.

This also involves setting some "hexpand" properties on the widgets
contained in the GtkGrid, to achieve effects which GtkTable did by
setting flags in gtk_table_attach.

8 years agoGTK 3 prep: use g_timeout_add, not gtk_timeout_add.
Simon Tatham [Sat, 3 Oct 2015 11:28:06 +0000 (12:28 +0100)]
GTK 3 prep: use g_timeout_add, not gtk_timeout_add.

8 years agoGTK 3 prep: use GTK instead of GDK window-icon functions.
Simon Tatham [Sat, 3 Oct 2015 11:28:04 +0000 (12:28 +0100)]
GTK 3 prep: use GTK instead of GDK window-icon functions.

We now build cleanly with -DGDK_DISABLE_DEPRECATED.

8 years agoGTK 3 prep: make the server-side backing pixmap optional.
Simon Tatham [Sat, 3 Oct 2015 11:28:02 +0000 (12:28 +0100)]
GTK 3 prep: make the server-side backing pixmap optional.

When GDK_DISABLE_DEPRECATED is defined, we now don't have fe->pixmap;
instead we just maintain our client-side window contents in fe->image,
and draw from there directly to the window in the expose handler.

8 years agoGTK 3 prep: use gtk_radio_menu_item_get_group().
Simon Tatham [Sat, 3 Oct 2015 11:28:00 +0000 (12:28 +0100)]
GTK 3 prep: use gtk_radio_menu_item_get_group().

Replaces the previous deprecated spelling. We now build cleanly with
-DGTK_DISABLE_DEPRECATED.

8 years agoGTK 3 prep: use GtkComboBox for drop-down lists.
Simon Tatham [Sat, 3 Oct 2015 11:27:58 +0000 (12:27 +0100)]
GTK 3 prep: use GtkComboBox for drop-down lists.

The previous GtkOptionMenu was long since deprecated.

8 years agoGTK 3 prep: use the glib names for base object types.
Simon Tatham [Sat, 3 Oct 2015 11:27:56 +0000 (12:27 +0100)]
GTK 3 prep: use the glib names for base object types.

8 years agoGTK 3 prep: use GTK_KEY_* constants.
Simon Tatham [Sat, 3 Oct 2015 11:27:54 +0000 (12:27 +0100)]
GTK 3 prep: use GTK_KEY_* constants.

8 years agoGTK 3 prep: use accessors instead of direct field access.
Simon Tatham [Sat, 3 Oct 2015 11:27:51 +0000 (12:27 +0100)]
GTK 3 prep: use accessors instead of direct field access.

We now build cleanly with -DGSEAL_ENABLE.

8 years agoFix packing direction of config boxes.
Simon Tatham [Sat, 3 Oct 2015 11:27:49 +0000 (12:27 +0100)]
Fix packing direction of config boxes.

We were packing the GtkTable into the dialog's content area using
gtk_box_pack_end, which had the slightly silly effect that resizing
the config box vertically would keep all the controls aligned to the
_bottom_ rather than the top.

8 years agoDon't refresh backing store on a no-op configure event.
Simon Tatham [Sat, 3 Oct 2015 11:27:47 +0000 (12:27 +0100)]
Don't refresh backing store on a no-op configure event.

Sometimes, we can get a "configure_area" event telling us that the
drawing area has changed size to the same size it already was. This
can happen when we change puzzle presets in a way that doesn't change
the size, and also sometimes seems to happen as a side effect of
changing the text in the status line.

In that situation, it's a waste of effort - and can cause visible
on-screen flicker - to throw away the window's backing image and
pixmap and regenerate them from scratch. So now we detect a non-resize
and avoid doing all that.

The only thing we retain unconditionally in configure_area is the
midend_force_redraw, because that's the place where a puzzle redraw is
forced when changing presets or loading a new game.

8 years agoEnforce more than one dot in Galaxies puzzles.
Chris Boyle [Sat, 26 Sep 2015 17:54:15 +0000 (18:54 +0100)]
Enforce more than one dot in Galaxies puzzles.

At minimum size (3x3) Galaxies can generate a pre-solved single dot
game.

You have to add and remove a line to get the victory flash which is a
bit weird, so just prevent this.

8 years agoFix OS X build failure due to a deprecated method.
Simon Tatham [Fri, 18 Sep 2015 11:20:32 +0000 (12:20 +0100)]
Fix OS X build failure due to a deprecated method.

Apple upgraded me to Xcode 7 yesterday, and now [NSString cString]
gives a deprecation warning, which -Werror turns into a full-on build
failure. Explicitly specify an encoding.

(I mention in a comment that there's an alternative piece of API that
I possibly ought to be using instead, but until I make a concrete
decision about where my backwards compatibility threshold is, I'll
leave it as it is for the moment.)

8 years agoImplement osx_draw_thick_line
Bo Lindbergh [Wed, 2 Sep 2015 19:58:55 +0000 (21:58 +0200)]
Implement osx_draw_thick_line

8 years agoTypo in the OS X Info plist
Bo Lindbergh [Tue, 25 Aug 2015 13:45:07 +0000 (15:45 +0200)]
Typo in the OS X Info plist

8 years agoemcc frontend: stop indiscriminately squashing mouseups.
Simon Tatham [Fri, 14 Aug 2015 18:42:42 +0000 (19:42 +0100)]
emcc frontend: stop indiscriminately squashing mouseups.

The mouseup listener was calling event.preventDefault(), as part of
the mechanism for making mouse clicks and drags on the puzzle's resize
handle have resizing effects _instead_ of the normal browser
behaviour. However, calling event.preventDefault() on _every_ mouseup,
rather than just the ones associated with the resize handle, was
overkill, and I've recently noticed that it's breaking attempts to
select from the game type dropdown by clicking the mouse. So now I'm
only calling preventDefault() on the mouseups that I have reason to
think are actually relevant to what I'm trying to do.

(I don't know why I've only just noticed this. I suppose a change of
behaviour between Firefox versions is the most likely cause.)

8 years agoReplace a TCHAR with a WCHAR.
Simon Tatham [Sat, 1 Aug 2015 10:14:30 +0000 (11:14 +0100)]
Replace a TCHAR with a WCHAR.

MultiByteToWideChar expects a WCHAR[256] output buffer if you pass it
an output length of 256. TCHAR[256] is entirely the wrong size, though
for some reason Visual Studio seems not to have thrown a compile error
pointing that out.

Thanks to Jason Hood for spotting this.

8 years agoSolo, Undead: support 'm' to fill in all pencils.
Simon Tatham [Mon, 13 Jul 2015 18:06:53 +0000 (19:06 +0100)]
Solo, Undead: support 'm' to fill in all pencils.

Keen, Towers and Unequal (and Group) already have this feature in
common: pressing m while no square is selected, causes a full set of
pencil marks to be filled in for every square without a real number/
letter/whatever in it. Solo and Undead share the basic UI principles
(left-click to select a square then type a thing to go in it, vs
right-click to select a square then type things to pencil-mark in it),
but did not have that same feature. Now they do.

8 years agoFix redrawing of Undead 'done' clues after a resize.
Simon Tatham [Sun, 5 Jul 2015 20:57:38 +0000 (21:57 +0100)]
Fix redrawing of Undead 'done' clues after a resize.

The is_hint_stale() function has the side effect of copying a path
hint's new colour-relevant information into the game_drawstate, where
draw_path_hint will then use it. But it returns TRUE early in some
situations, notably !ds->started, which can happen after the actual
game start if the window is resized and a fresh drawstate is created.

This patch, thanks to Chris Boyle, fixes it by eliminating the early
returns from is_hint_stale - the return value is unchanged, but now
the side effects happen reliably.

8 years agoMagnets: you can now mark clues as done
Kevin Lyles [Mon, 8 Jun 2015 20:47:09 +0000 (15:47 -0500)]
Magnets: you can now mark clues as done

8 years agoRemoved an extra layer of complexity for count colors
Kevin Lyles [Mon, 8 Jun 2015 21:42:31 +0000 (16:42 -0500)]
Removed an extra layer of complexity for count colors