Commit graph

232 commits

Author SHA1 Message Date
Simon Howard
981d972f3d Add missing #includes. 2015-04-10 23:42:01 -04:00
Simon Howard
356554c229 textscreen: Add help URL functionality for windows.
This adds the ability to associate a URL with a window that gives
some extra information about it and the configuration options found
in it.
2015-04-04 21:29:33 -04:00
Simon Howard
833d8a838b textscreen: Remove screen size-based font selection.
This was removed on Windows a while back in favour of a more
conservative approach that examined the system DPI settings, but the
logic still remained for other systems and it really isn't a good
idea. Remove the logic that chooses a large font on large monitors,
and add a TODO comment to add proper Linux font selection in the
future, based on the Gtk+ HiDPI setting.
2015-03-29 23:21:08 -04:00
Simon Howard
01a743cd35 Fix mistaken uses of memcpy() on overlapping memory.
The source and destination arguments to memcpy() cannot be overlapping
as this is undefined behavior. In these situations memmove() must be
used instead, and OpenBSD actually throws an error if this is done.

Thanks to ryan-sg for reporting this. This fixes #510.
2015-02-22 00:28:23 -05:00
Dave Murphy
d66659c606 allow building in subdirectory or outside source directory 2014-12-26 15:40:46 +00:00
Simon Howard
6b217ee03c textscreen: Exit immediately when all windows close.
The main loop should exit when the last window closes, but the loop
code was waiting for one event to be received before this took
effect.

This fixes #474. Thanks to Alexandre-Xavier for the report.
2014-11-27 18:58:58 -05:00
Simon Howard
16c56ea0c4 textscreen: Don't allow input of unprintable characters.
If a Unicode character is not part of the Extended ASCII set that
we can display on screen, don't allow it to be typed (which would
display a backwards question mark). Thanks Alexandre-Xavier for this
suggestion on #229.
2014-10-19 16:52:36 -04:00
Simon Howard
77d7e984d1 textscreen: Fix use-after-free with mouse press.
When propagating mouse button presses to widgets within the window,
return from MouseButtonPress() immediately, or we will fall through
to additional code that references the window structure. If the
handler for the widget we clicked on closes the window, this will
have been freed.

This fixed #439. Thanks to DuClare for telling me about this.
2014-10-14 01:26:14 -04:00
James Haley
0d7f38c751 Warning fixes (23 remain...) 2014-08-16 17:30:00 -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
242fa1ee46 textscreen: Fix jump when clicking on scrollbars.
Clicking on a scrollbar should scroll the cursor to that location, but
the logic for it was buggy because of loss of precision when doing an
integer divide. When dividing by bar_max, seek up to the nearest value
so that the cursor always arrives where we clicked.

Thanks to Alexandre-Xavier for reporting this bug. This fixes #359.
2014-04-29 01:47:13 -04:00
Simon Howard
32803819a0 textscreen: Init screen at native bit depth.
Always call SDL_SetVideoMode with bpp=0 to use the desktop's native
bit depth, and instead draw into an intermediate 8-bit screenbuffer
surface. This ensures that we do not encounter any palette mess-ups
as on some systems true 8-bit screen modes are poorly supported.
2014-04-12 16:31:31 -04:00
Simon Howard
c30f4a2f65 misc: Fix safe vsnprintf() function.
An off-by-one error in the function caused the strings to be truncated
one character too early. Change the return value check so that
negative values are also interpreted as indicating truncation; this is
the behavior of the Win32 API.
2014-04-01 22:06:09 -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
e85edb9e6f textscreen: Add label for PrintScreen key.
Needed to properly fix bug #369.
2014-03-28 00:37:17 -04:00
Simon Howard
8a699c6ebc Define a keyboard scan code for PrintScreen.
There is no real scan code for the PrintScreen key under DOS, but it
is convenient to be able to bind it as a screenshot key. Define a
"fake" scancode (126) to represent PrintScreen so that it can be
represented as a key binding in configuration files. Also add some
comments/notes to the scantokey[] lookup table.

This fixes #369.
2014-03-27 20:52:09 -04:00
Simon Howard
9c1b1ff290 Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2742
2013-11-03 06:23:21 +00:00
Simon Howard
162ba0b777 Change gradient characters of 'large' textscreen font to be direct
scale-ups of the standard res versions of the characters: in addition to
giving a more 'authentic' retro look, this fixes a problem where the
high-frequency dot patterns can cause weird moire effects on some
monitors.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2735
2013-10-31 02:59:07 +00:00
Simon Howard
387fcd4fa4 Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2731
2013-10-28 05:02:36 +00:00
Simon Howard
5387e91e31 Use system DPI setting on Windows to determine whether to use the large
font.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2730
2013-10-28 05:01:33 +00:00
Simon Howard
ee40db2fcd Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2725
2013-10-28 01:27:15 +00:00
Simon Howard
552d300e26 Determine which textscreen font to use by looking at the current desktop
screen resolution, not the largest fullscreen resolution offered by SDL.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2724
2013-10-28 01:23:10 +00:00
Simon Howard
ead4a7a8bd Oops.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2717
2013-10-20 20:37:48 +00:00
Simon Howard
c5defc73af Disable file selector dialog on Windows.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2716
2013-10-20 20:28:47 +00:00
Simon Howard
f2c204ccca Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2639
2013-09-08 19:10:40 +00:00
Simon Howard
e10af52152 Fix file select widget to emit "changed" signal properly. Reset variable
value to empty string rather than NULL if cancel is pressed in dialog
(thanks Alexandre Xavier).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2638
2013-09-08 18:57:20 +00:00
Simon Howard
58fba3477d Add textscreen functions to raise and lower windows.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2628
2013-08-31 00:12:09 +00:00
Simon Howard
63acb55b18 Remove Windows CE support.
What support exists is for obsolete devices I no longer possess; I've
never been contacted about the port and it's been several years since
I even bothered to build a new version. All the extra overrides are
clutter that can just be removed.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2615
2013-08-11 17:32:29 +00:00
Simon Howard
ba1c027718 Remove use of WINAPI macro to fix compile under MSVC.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2602
2013-05-27 17:56:06 +00:00
Simon Howard
ce8a95a5b9 Correct incorrect doc comment.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2579
2013-04-01 16:38:55 +00:00
Simon Howard
47af28e168 Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2577
2013-04-01 14:59:34 +00:00
Simon Howard
bd0f386997 Fix Doxygen comments.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2576
2013-03-31 20:38:03 +00:00
Simon Howard
f346e3391d Add back call to TXT_Delay to fix OS X freeze.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2575
2013-03-31 19:38:04 +00:00
Simon Howard
daa0897ec9 Allow backspace or delete to clear the contents of an input box.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2574
2013-03-31 19:32:49 +00:00
Simon Howard
9963de836f Don't hog the CPU while waiting for the file selector.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2573
2013-03-31 19:32:22 +00:00
Simon Howard
fdd021c565 Fix file selector issues with Windows build.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2571
2013-03-31 19:09:45 +00:00
Simon Howard
3ac144025a Add file selector widget to textscreen library.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2570
2013-03-31 18:46:25 +00:00
Simon Howard
f1934e990d Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2553
2012-12-24 00:03:41 +00:00
Simon Howard
7b9cfe4a61 Fix up weird looking '9' character in large font.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2549
2012-12-23 01:43:41 +00:00
Simon Howard
a42a4824fa Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2546
2012-12-14 01:18:38 +00:00
Simon Howard
9f1a64f856 Add high-resolution font for textscreen.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2543
2012-11-18 21:56:18 +00:00
Simon Howard
993315afc4 Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2537
2012-10-28 23:45:08 +00:00
Simon Howard
003c82ce37 Remove some calls to TXT_FGColor by using the new TXT_SaveColors system
instead. Remove the unused "embedded color code" system from TXT_Puts.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2508
2012-03-04 12:06:29 +00:00
Simon Howard
9ffd1cc4d4 Rework the way that window background colors are set, and change the
background color of inactive windows to black, to give better contrast
when viewing many layered windows.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2507
2012-03-01 20:26:56 +00:00
Simon Howard
c6b8f11637 Fix crash when typing lots of Unicode characters into a number input
box.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2494
2012-02-03 22:05:49 +00:00
Simon Howard
20f405ec54 Fix CP437-Unicode mapping of cedilla character.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2492
2012-02-03 21:38:06 +00:00
Simon Howard
85b5a7487d Upgrade the input box and label widgets to use UTF-8 strings.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2491
2012-02-03 21:10:36 +00: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
c818fb0216 Split off UTF-8 code into separate file and add extra functions.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2489
2012-02-03 20:21:17 +00:00
Simon Howard
d4df22aa1e Beginnings of limited textscreen UTF-8 support.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2487
2012-02-02 23:35:16 +00:00