Adjust the pattern passed to zenity to be case-insensitive
(e.g., if the input pattern was "wad", generate "[Ww][Aa][Dd]").
This means the chooser will show the following, which would otherwise
be hidden:
* TEST2.WAD
* test3.WAD
This pops up the file select dialog immediately rather than waiting for
the user to activate the application. But really the current file select
code for OS X based on AppleScript is garbage and should just be
replaced.
When creating a table widget is is often convenient to be able to create
and populate it in a single function call. It's possible to do this with
"horizontal boxes" already but there wasn't a more generic mechanism for
making a table. So add one as TXT_MakeTable().
Remove Tango colors - this is just a half-baked idea left over from
long ago. Remove some leftover comments and commented-out code, and
add some comments for global tables.
Rename TXT_DrawString() to TXT_DrawCodePageString() and rename
TXT_DrawUTF8String() to TXT_DrawString(). It's better to just assume
everything is UTF8 and deal with the exceptions, as this is less likely
to cause bugs. There is only a small handful of places where we want to
draw a specific character from the native code page.
Add a window containing one of each type of widget that uses string
labels, and include something in Italian that uses at least one Unicode
character, for testing the UTF8 change.
If we are to accept arbitrary labels, window names etc., then it makes
sense for these to be in UTF-8 format rather than strings in the code
page extended ASCII format. This should make the API more interoperable
with other data sources.
We were duplicating the Unicode/code page mapping table between
txt_gui.c and txt_sdl.c, but in an incomplete and inconsistent way. It
makes sense that the code page mapping should be kept with the font
files that represent the code page anyway, as there may be projects like
Julian Nechaevsky's Russian Doom which may want to change the code page.
We use the SDL APIs to get a localized name for keys now. However, we
must consider that SDL's key names are in UTF8 format and can therefore
contain non-ASCII characters which cannot be displayed on the CP437 text
screen. So double-check if key names contain any unprintable characters
and if they do, use a fallback set of default key names instead.
This fixes#840. Thanks to Julian Nechaevsky for the report.
SDL2 has an API for getting a string description of a key. Change the
textscreen API which does the same to use it. This has the added bonus
that the setup tool will now adjust to show key descriptions that match
the system keyboard layout.
It's not enough to simply return the first byte from the buffer, since
it may be a non-ASCII character. Decode the whole first character using
the UTF8 library.
This replaces the old control over whether key mapping is enabled. We
have three different modes used in different situations: "normal" (used
when navigating windows, etc.); "raw" (used when configuring a key and
we want something derived from the scancode) and "text" (used when typing
something into an input box widget).
When using a tiling window manager, the window dimensions as passed
to SDL_CreateWindow() can potentially be ignored, and we can end up
with a different window size even though we didn't ask for the window
to be resizeable.
In this situation, we were scaling the textscreen image to always fill
the window, regardless of size or aspect ratio. This led to some nasty
looking, distorted views in some cases. Instead, always render the
textscreen image at the intended size and center the image within the
window if it is not the requested size.
Don't bother trying to override the OS on the mouse wheel
axis inversion, to be consistent with SDL1.
Fix mixing up the up/down button numbers.
Rename some variables for clarity.
SDL2 treats mouse wheel events as different from buttons.
Assuming we want the wheel to emulate buttons as per SDL1,
map the mouse wheel events to buttons. Use the mappings in
textscreen (down = 3, up = 4).
Fixes#722.
We rely on the parent pointer to determine if the widget is being
hovered over. Set the parent pointer so that the background is set
properly for a widget in a conditional container.