Commit graph

28 commits

Author SHA1 Message Date
Simon Howard
8b90786fab textscreen: Add API to change color palette.
This is possible under DOS as well by writing to the appropriate VGA
registers, and the vanilla setup tool actually does this in earlier
versions to set "Romero Blue".
2018-12-28 16:27:23 -05:00
Turo Lamminen
8ec41dca6c Make TXT_SetWindowTitle parameter const 2018-03-13 12:31:51 +02:00
Turo Lamminen
14e9e56571 Add format string attribute to TXT_snprintf 2018-02-17 16:15:13 +02:00
Simon Howard
06dd832185 textscreen: Change most strings to UTF-8.
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.
2017-01-21 16:21:27 +00:00
Simon Howard
40d1ce5541 textscreen: Refactor code page mapping.
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.
2017-01-21 15:46:04 +00:00
Simon Howard
0aece203e8 textscreen: Tweak TXT_GetKeyDescription() again.
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.
2017-01-21 02:31:45 +00:00
Simon Howard
30f853b658 textscreen: Fix input of Unicode characters.
For non-ASCII characters we map into a higher range to avoid conflict
with special keys. Restore this behavior.
2016-12-21 15:11:22 +00:00
Simon Howard
d3cb02d810 textscreen: Use SDL API for getting key names.
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.
2016-12-18 01:41:21 -05:00
Simon Howard
c1ff9bfd5b textscreen: Add input mode switching.
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).
2016-12-17 21:14:13 -05:00
Simon Howard
7684ddcfd8 Clean up file headers.
This change rewrites and simplifies the copyright headers at the top
of all source files:

 * Remove "Emacs style mode select" line; this line was included in
   the headers for the originally released source files and appears
   to be to set the file type for old versions of Emacs. I'm not sure
   entirely why it was required but I don't think it is any more.
 * Remove "You should have received a copy of..." text from copyright
   header. This refers to the old 59 Temple Place address where the
   FSF headquarters used to be located and is no longer correct.
   Rather than change to the new address, just remove the paragraph
   as it is superfluous anyway. This fixes #311.
 * Remove ---- separator lines so that the file headers are barer
   and more simplified.
2014-05-05 00:20:54 -04:00
Simon Howard
a9d9335b20 textscreen: Use safe string functions.
Define TXT_{StringCopy,StringConcat,snprintf,vsnprintf} as analogs of
the m_misc.c versions so that the textscreen library does not need a
dependency on the Doom code, and change all textscreen code to use
these instead of unsafe functions. This fixes #372.
2014-04-01 21:49:16 -04:00
Simon Howard
d745a6409c Support Unicode input by mapping typed Unicode characters >= 128 up into
a higher range to avoid conflicts with Doom's key constants.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2490
2012-02-03 21:09:57 +00:00
Simon Howard
eb86fcdf30 Allow the shift key to be held down when changing key/mouse/joystick
bindings to prevent bindings to the same key from being cleared (thanks
myk).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2325
2011-04-11 19:49:45 +00:00
Simon Howard
bc087b49e2 Fix scrollbars so that clicks scroll the pane to a location that matches
the clicked location. Interpret mousewheel events so that scroll panes
can be scrolled.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2307
2011-03-22 21:08:04 +00:00
Simon Howard
410579ec66 Change British English spellings to American English, for consistency.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1699
2009-09-30 23:07:03 +00:00
Simon Howard
e4681dd485 Allow more than the standard three mouse buttons to be defined through
setup (hopefully)

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 939
2007-07-29 23:41:12 +00:00
Simon Howard
9d7126c11b Rename txt_main.c to txt_sdl.c; add txt_sdl.h for SDL-specific API
functions, while keeping txt_main.h for the common API. Add
TXT_SDL_SetEventCallback to allow programs to intercept SDL events in
the textscreen main loop.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 892
2007-06-04 18:32:50 +00:00
Simon Howard
2e3e45cb9b Add TXT_SetWindowTitle function to wrap SDL_WM_SetCaption, so that
txt_desktop.c doesn't need to call SDL functions directly.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 885
2007-05-24 14:29:08 +00:00
Simon Howard
6a36c84b15 <SDL.h> -> "SDL.h"
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 866
2007-03-27 11:40:04 +00:00
Simon Howard
c5a4f04bc2 Fix discrepancy between Doom and setup program when prompting for keys.
Add the ability to enable/disable key mappings so that the raw key can
be read in setup, exactly the same way that it is in Doom.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 846
2007-03-09 12:35:18 +00:00
Simon Howard
7bc72c666d Fix textscreen warnings.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 626
2006-09-19 23:49:20 +00:00
Simon Howard
80cdf0868c Include SDL.h in the textscreen headers; the SDL headers need to be
included where main() is defined.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 600
2006-09-09 16:52:01 +00:00
Simon Howard
c0d6fcfe03 Add missing copyright notices to textscreen and setup files.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 590
2006-08-31 20:40:48 +00:00
Simon Howard
e5d6ce3318 More efficient TXT_Sleep function that puts the textscreen code to sleep
until an event is received or the screen needs to blink.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 570
2006-08-31 18:08:43 +00:00
Simon Howard
517af9477b textscreen: Rejig how the entire drawing process works. Add a recursive
layout method that assigns the position and size of widgets for the whole
window before drawing. Add another method that responds to mouse button
presses. Allow windows to have no title bar by specifying NULL as the
title.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 547
2006-06-02 19:29:24 +00:00
Simon Howard
1d79686ecf Add TXT_GetKeyDescription() to provide descriptions of key codes.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 513
2006-05-23 00:04:27 +00:00
Simon Howard
01a403802e Textscreen getchar() function; remove SDL code from I_Endoom.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 289
2006-01-13 18:23:28 +00:00
Simon Howard
f75826fa71 Text mode emulation code
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 146
2005-10-02 03:16:03 +00:00