1201 Commits

Author SHA1 Message Date
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
1380b55b5b Fix segfault in Range's game_text_format.
Occurred on Nx1 puzzles, etc.
2015-10-03 16:58:00 +01:00
c4198948a8 Fix typo in undo key handling.
Now we can undo with both 'u' and 'U', symmetrically with redoing with
both 'r' and 'R'.
2015-10-03 16:57:49 +01:00
6c71b459a6 Include an example of Range's text_format in the comments. 2015-10-03 16:57:49 +01:00
4fb9776d83 Fix a typo in the comments of Pearl.
Each stone can have 2 lines radiating from its centre, not 3.
2015-10-03 16:57:44 +01:00
c0308c9319 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.
2015-10-03 16:07:20 +01:00
9df80d7587 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.
2015-10-03 16:07:20 +01:00
41cc7c868f 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.
2015-10-03 16:07:20 +01:00
1b2e4d525f 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.
2015-10-03 16:07:20 +01:00
90b73ebcb7 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!
2015-10-03 16:07:19 +01:00
2fb189cc36 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.
2015-10-03 16:07:19 +01:00
88b38f5168 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.
2015-10-03 16:07:19 +01:00
d6210656b8 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.
2015-10-03 16:07:19 +01:00
4e1cc65701 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.
2015-10-03 16:07:18 +01:00
37232c3c30 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.
2015-10-03 16:07:04 +01:00
62c6312982 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.
2015-10-03 16:07:04 +01:00
64d0a70e13 GTK 3 prep: use g_timeout_add, not gtk_timeout_add. 2015-10-03 16:07:04 +01:00
3d0d54e3b4 GTK 3 prep: use GTK instead of GDK window-icon functions.
We now build cleanly with -DGDK_DISABLE_DEPRECATED.
2015-10-03 16:07:04 +01:00
fd7882fb45 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.
2015-10-03 16:07:04 +01:00
07906104a2 GTK 3 prep: use gtk_radio_menu_item_get_group().
Replaces the previous deprecated spelling. We now build cleanly with
-DGTK_DISABLE_DEPRECATED.
2015-10-03 16:07:04 +01:00
2c1b00086d GTK 3 prep: use GtkComboBox for drop-down lists.
The previous GtkOptionMenu was long since deprecated.
2015-10-03 16:07:04 +01:00
71c7bcd981 GTK 3 prep: use the glib names for base object types. 2015-10-03 16:07:04 +01:00
0dc2fd1ea3 GTK 3 prep: use GTK_KEY_* constants. 2015-10-03 16:07:04 +01:00
238cd9dc83 GTK 3 prep: use accessors instead of direct field access.
We now build cleanly with -DGSEAL_ENABLE.
2015-10-03 16:07:04 +01:00
7242dcc4ef 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.
2015-10-03 16:07:04 +01:00
8b491946ef 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.
2015-10-03 16:07:01 +01:00
f9027226a0 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.
2015-09-26 20:02:02 +01:00
ba9e0d586e 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.)
2015-09-18 12:20:32 +01:00
eda5a86787 Implement osx_draw_thick_line 2015-09-02 22:24:47 +01:00
6f5386c4b9 Typo in the OS X Info plist 2015-08-25 20:01:37 +01:00
dd9e24a42f 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.)
2015-08-14 19:42:42 +01:00
c296301a06 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.
2015-08-01 11:14:30 +01:00
5e1c335eea 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.
2015-07-13 19:06:53 +01:00
aa1a9375be 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.
2015-07-05 21:57:38 +01:00
f306b9db55 Magnets: you can now mark clues as done 2015-06-10 21:58:59 +01:00
ecbf5f627f Removed an extra layer of complexity for count colors 2015-06-10 21:58:59 +01:00
92635a2f9d Factored out some of the color logic for the clues 2015-06-10 21:58:59 +01:00
26b5e2c6bf Removed DS_FULL (it wasn't used) 2015-06-10 21:58:59 +01:00
6bbfa6fe28 Updated name/size of clues_done in Towers 2015-05-26 22:04:47 +01:00
f0750894ff Undead: you can now mark clues as done 2015-05-26 22:04:35 +01:00
c3285318e6 Reworked draw_path_hint 2015-05-26 22:04:25 +01:00
9def49ae9a Factored out a portion of game_redraw 2015-05-26 22:04:16 +01:00
486d2c8a76 Towers: you can now mark clues done 2015-05-22 08:18:53 +01:00
7c52202bc4 Split out the text color portion of draw_tile 2015-05-22 08:18:45 +01:00