Commit Graph

13 Commits

Author SHA1 Message Date
PatR
d4dfb1765c curses menu revision
Redo menu sizing to eliminate one of the analyzer hacks.  There's no
need to loop through the menu entries a second time to find the last
one.  The first time can remember it.

Also, some routines were taking arguments with
 some_function(WINDOW *win, nhmenu *menu, ...)
and others with
 other_function(nhmenu *menu, WINDOW *win, ...).
Change them all to have the window pointer 1st and menu pointer 2nd.
2023-12-29 18:16:14 -08:00
Pasi Kallinen
dd5ca5b058 Change menu_headings to accept color and attribute
Instead of just accepting an attribute, it's now possible to
use a color, or both color and attribute, for example:

OPTIONS=menu_headings:inverse
OPTIONS=menu_headings:red
OPTIONS=menu_headings:red&underline

Default is still just inverse.
This lets the player change the menu heading color without
needing to use menu colors for them.

Also makes it so the core uses NO_COLOR instead of 0, for all
the menu lines which don't have any prefedefined color.

Tested for tty, curses, x11, qt, and win32
2023-11-13 07:33:56 +02:00
PatR
dd49431296 \#perminv, 1 of 2: groundwork
Give the window-port side of *_update_inventory() an argument.
Calls in the core still omit that; invent.c's update_inventory()
is the only place that cares.
2021-03-13 18:17:00 -08:00
nhmall
f963c5aca7 switch source tree from k&r to c99 2021-01-26 21:06:16 -05:00
nhmall
c9673b3d9e more window port interface adjustments
further adjustments to the window port interface to pass a pointer
to a glyph_info struct which describes not just the glyph number
itself, but also the ttychar, the color, the glyphflags, and the
symset index.

This affects two existing window port calls that get passed glyphs
and does the parameter consistently for both of them using the
glyph_info struct pointer:
	print_glyph()
	add_menu().

The recently added glyphmod parameter is now unnecessary and has been
removed.
2021-01-05 10:09:37 -05:00
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
PatR
cff63b5b4c fix curses' create_nhmenu() warning
The extra flags argument to create_nhmenu() wasn't propagated to
anywhere useful.  It still doesn't do anything yet.
2020-02-25 16:18:58 -08:00
nhmall
7012e7046f add support for MENU_ITEMFLAGS_SKIPINVERT
Able to test:
win/tty
win/win32
win/curses

Unable to test:
win/X11
win/Qt
win/Qt3
win/gem
win/gnome
2019-12-23 08:36:44 -05:00
PatR
be966cfe5a curses ^P msg_window:Full
This changes the recently added msg_window:f for curses to start
viewing the old messages on the last page rather than the first.  For
msg_window:Reversed (the default for curses) and for either direction
when all of the message history happens to fit on one page, there's
no change.  But for multiple pages, the FIFO feedback now pads the top
of the first page with blank lines so that the last page is full, and
it starts out showing that last page first.  So if you only want to go
back few or several messages, they will be in view immediately.

Old layout:
|first message (oldest)   |  |1st message of last page |
|2nd message of 1st page  |  | ...                     |
| ...                     |  |final (most recent) mesg |
| ...                     |  | (blank filler)          |
|last message of 1st page |  | (blank filler)          |
|             (1 of 2) => |  |          <= (2 of 2)    |
and ^P started with first page visible and needed normal menu handling,
<space> or '>' or '|', to go forward to view the most recent messages.

New layout:
|1st message of last page |  | (blank filler)          |
|2nd message of last page |  | (blank filler)          |
| ...                     |  |first message (oldest)   |
| ...                     |  | ...                     |
|final (most recent)      |  |last message of 1st page |
| <= (2 of 2)             |  |    (1 of 2) =>          |
and ^P starts on last page (two of two in this example) but can go
back with '<' and '^'.

So if the total size takes one and third pages (which isn't uncommon
for the default number of kept messages), you'll see 3/4 of the most
recent messages on the initial screen, then you can page backward if
you want to see the other 1/4.

The page indicator is deliberately drawn a bit differently just to
draw attention to the fact you're starting on the last page.  I'm not
sure whether that is actually worthwhile but it was trivial to do.
2019-04-02 01:11:59 -07:00
PatR
ee53a9fea6 curses message recall, memory leaks
Using ^P right after resize or 'O' of align_message, align_status,
statuslines, or windowborders would result in
'curses_display_nhmenu: attempt to display empty menu'
because some memory cleanup I added several weeks back was being
executed when the curses interface tore down and recreated its
internal windows.

This fixes ^P handling by making sure that that menu (which is just
text but uses a menu to support '>'/'<'/'^'/'|' scrolling) will never
be empty and it also fixes the window deletion to not throw away
message history until it's final deletion at exit time.

^P uses a popup window to display previous messages and it was never
deleting that window, just creating a new one each time.  Same with
the routine which displays an external help file.  Using either or
combination of both close to 5000 times would probably make internal
window creation get stuck in an infinite loop.  Delete those windows
after they're used so it'll never be put to the test.

The memory cleanup I added for map/status/messages/invent was only
being preformed at end of game, not when saving.  Fix that too.
2019-03-24 17:50:26 -07:00
nhmall
c258f9c3f8 update header on cursdial 2018-12-05 17:40:33 -05:00
nhmall
bf4bb47518 Update header at the top of the curses files
Place the copyright notice within the win/curses files as confirmed
by the original curses port author on November 28, 2018.
2018-11-28 20:00:20 -05:00
nhmall
748280d5dc curses new file additions 2018-11-16 20:53:38 -05:00