Commit graph

51 commits

Author SHA1 Message Date
Simon Howard
8c43337af2 textscreen: Allow any widget in action area.
It may be desirable to wrap a window action in a txt_conditional_t
sometimes so that actions dynamically appear based on how the config
changes. So change the TXT_SetWindowAction() API to accept any widget
instead of mandating a txt_window_action_t.
2018-10-21 17:40:18 -04:00
Turo Lamminen
94d85c51b0 Make TXT_SetWindowHelpURL help_url parameter const 2018-03-13 19:44:25 +02:00
Turo Lamminen
592edc0d87 Make TXT_OpenURL parameter const 2018-03-13 19:33:51 +02:00
Turo Lamminen
10fda2ac53 Make TXT_MessageBox title character const 2018-03-13 19:33:51 +02:00
Turo Lamminen
334232d3b4 Make TXT_MessageBox message parameter const 2018-03-13 19:33:51 +02:00
Turo Lamminen
19a0939300 Make TXT_NewWindow parameter const 2018-03-13 19:33:51 +02:00
Turo Lamminen
5e2df0a52e textscreen: Don't ignore return value of system() call 2018-01-27 16:46:04 +02:00
David Carlier
5409a57f13 Tiny memory leak fix in call error path. 2017-06-20 15:16:11 +01:00
Simon Howard
ef4c73fc81 textscreen: Refactor TXT_OpenURL() to simplify.
In the Windows scenario we don't need to allocate any buffers; it's
just a thin wrapper around ShellExecute().
2015-06-07 19:17:12 -04:00
Mike Swanson
b44b84beb3 textscreen: Pass url directly to ShellExecute, snprintf unneeded 2015-06-06 10:52:33 -07:00
Mike Swanson
7265f8d9b9 textscreen: use ShellExecute on Windows to open URLs
Trying to use the cmd.exe built-in has been causing nothing but
troubles, this is the officially supported way to open them.
2015-06-05 22:49:27 -07:00
Simon Howard
f30f390e51 textscreen: Tweak to command line to open URL.
Alexandre-Xavier commented in #520 that the 'start' command line to
open help URLs doesn't work. According to this page, 'start' is
actually a cmd.exe built-in and can't be shelled out to directly:

http://www.dwheeler.com/essays/open-files-urls.html

This prepends cmd /c to the 'start' command; hopefully this should
work. It might still be non-ideal if it causes a cmd.exe window to
briefly pop up; in the long term we should probably switch to the
ShellExecute() API function instead.
2015-06-04 01:07:36 -04:00
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
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
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
993315afc4 Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2537
2012-10-28 23:45:08 +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
379d372c65 Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2464
2011-10-23 20:07:40 +00:00
Simon Howard
8ee96dadb9 Fix crash when closing a window.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2462
2011-10-23 19:42:43 +00:00
Simon Howard
dd52766c7b Rework textscreen focus handling so that input boxes will stop editing
when they lose their focus (thanks Twelve).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2460
2011-10-23 19:25:55 +00:00
Simon Howard
4fba2ab2dd Add TXT_MessageBox convenience function.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2388
2011-09-20 20:47:19 +00:00
Simon Howard
d4ef7c3772 Fix action area minimum width calculation.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2324
2011-04-09 00:27:13 +00:00
Simon Howard
fe9fc9e107 Fix crash.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2321
2011-04-04 20:09:42 +00:00
Simon Howard
9f3f6683d9 Change the background color when hovering over widgets.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2320
2011-04-04 20:07:07 +00:00
Simon Howard
af3e4412d3 Change alignment of actions in a window's action area so that there is
equal space either side of the center widget. This is more aesthetically
pleasing.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2208
2010-12-10 20:43:05 +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
7216263bb7 Shut up compiler warnings
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 695
2006-10-11 23:03:19 +00:00
Simon Howard
a825be92fb Rename Accept to Select.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 648
2006-09-21 18:25:55 +00:00
Simon Howard
0cff90defc Fix some warnings in textscreen code.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 645
2006-09-21 16:25:10 +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
d7ef9e1512 'widgets' variable was used uninitialised. For some reason this didn't
always crash!

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 624
2006-09-19 23:20:14 +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
5e303c43da Add window listener functions to allow spying on keys and mouse buttons
received by windows. Emit a 'closed' signal when a window is closed.
Allow windows to have no action buttons.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 576
2006-08-31 18:11:26 +00:00
Simon Howard
cef6abcea6 Always add a bit of padding inside windows (removes the need to add padding
explicitly in labels). Set the window title from the desktop title. 
Only draw widget selection highlight in the window with focus (top window).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 560
2006-06-20 18:48:21 +00:00
Simon Howard
48d2fd26ca Make clicking on "accept" action buttons send enter keypresses to the window.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 554
2006-06-02 20:50:51 +00:00
Simon Howard
ef92ce016e Make mouse button presses on widgets actually do useful things
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 553
2006-06-02 20:14:39 +00:00
Simon Howard
02f4a0dcf4 Add utility functions to create "Abort" and "Accept" window actions
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 551
2006-06-02 19:45:41 +00:00
Simon Howard
e9619f83e9 Draw the bottom separator in windows at the full window width.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 550
2006-06-02 19:36:37 +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
240a1cfcca Add a default action to close windows when escape is pressed. Do not
make escape quit the program unless there are no open windows. Add
TXT_ExitMainLoop().

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 518
2006-05-23 19:33:35 +00:00
Simon Howard
1de18c1397 Add window action class for action area labels at the bottom of windows.
Adjust txt_table_t to expand tables to their maximum width when they
only have one column (ensures separators reach the window edges).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 515
2006-05-23 00:07:02 +00:00
Simon Howard
56912a4dcc Make all windows be tables with one column.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 493
2006-05-20 21:01:04 +00:00
Simon Howard
8741ed0339 Add table class. Allow widgets with heights of more than one line.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 492
2006-05-20 20:49:50 +00:00
Simon Howard
62b5f95367 Add main loop function and forward key presses to widgets.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 490
2006-05-20 16:34:34 +00:00
Simon Howard
f761f821f9 Add selectable and visible properties to widgets. Allow the position of
windows to be set based on position of top/bottom/center,left/right,center
coordinates.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 486
2006-05-20 15:15:17 +00:00
Simon Howard
344823214b Split off text mode gui desktop code into a separate file. Rename some
of the functions in txt_gui.c.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 483
2006-05-19 19:57:59 +00:00
Simon Howard
aaf96ab501 Add TXT_SetDesktopTitle()
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 482
2006-05-18 19:48:03 +00:00
Simon Howard
f6e8d4c46e Make TXT_AddWidget take a NULL pointer so different widget types can
be passed to it.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 481
2006-05-18 18:55:24 +00:00