Commit Graph

53 Commits

Author SHA1 Message Date
martin d8297eb873 Menu 0 does not exist anymore (it is now OPT_NOMENU), so emit an empty
menu defintion for it.
2019-06-23 11:31:10 +00:00
christos 4cd30f5b0c Conserve space: make ints to shorts and make OPT_NOMENU 0 instead of -1
so we don't require initializing it.
2019-06-22 20:44:54 +00:00
martin a7fc6d1692 Add an option to supress the vertical space between menu title and
menu items.
2019-02-25 20:47:37 +00:00
martin fbb0a702e6 Provide an accessor for the menu description structure by manu identifier.
Usefull for dynamic menus where you want to change details on the
fly "from the outside" (i.e. while not in one of the callback functions).
2019-02-06 20:08:15 +00:00
martin 8a7549a99f Allow argument expansion in menu titles as well. 2019-01-09 19:43:37 +00:00
martin b8b0f2eea4 Add an option for single (disabled) menu lines to have no shortcut. 2019-01-04 15:27:19 +00:00
martin 34c5a1a313 Add (optional) support for expanded static menu texts - that is: whatever
the application programmer defines as expansion, e.g. to implement
parameter substitution.
While here add rudimentary documentation of the dynamic messages
feature (so at least the parser and the syntax documented here
are in sync).
The man page could use some typesetting help...
2018-11-21 20:04:48 +00:00
mbalmer 5cd43bc624 Remove the advertising clause and appease the eye a bit (still not good, but
better).  Almost no functional change.
2012-03-06 16:55:18 +00:00
joerg 2eacf5d5a2 Mark __menu_initerror as dead in the output. 2011-09-06 18:16:38 +00:00
tls 2a6850b9a9 Fix PR37377 from Devon O'Dell: num_menus can be referenced without being
emitted if dynamic menus are not enabled.
2008-01-16 09:21:33 +00:00
he d59cb8e7b8 Fully initialize the last element of menu_def[]. 2006-10-23 19:29:48 +00:00
dsl 2acc3971af Allow menu entry option names to be code fragments that (should) call
wprintw(menu->mw, ftm, args) to generate the menu label.
Allows static menu labels to contain the current value (like a lot of the
dynamic menus do).
Correct width calculations, and bound menu table lookup.
2006-02-20 21:06:40 +00:00
dsl f5b2286ba1 Support menu windows that preserve the underlying screen contents.
(Needs a libcurses fix as well).
No need to ponce about with __m_endwin (to remember we've done endwin()),
   the old recovery was wrong in any case - but I've left something that
   will do an explicit redraw.
Allow the 'help' text to be from a variable (and hence translated).
Fix the display of help so that the screen underneath is actually cleared.
Preserve the screen contents while displaying help - redraw is too hard.
Use endwin(); doupdate(); to do the full refresh when ^L is typed.
Move menus up the screen if they would hit the bottom with too few lines
   to show an item and the scroll text (happens with big titles).
Make 'y=0' center the window vertically - use of 0 means you can't have
   a menu starting on the topline, but this is unlikely to be a problem.
Make all the menu options settable from the control file, not just from
   dynamic menus.
Redo menu option list part of man page.
2004-08-02 21:29:07 +00:00
jmc b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
dsl 51fe540362 Add an MC_ALWAYS_SCROLL to mean "always allow space for 'scrolltext'".
All scrolltext to be #defined so it can be translated.
2003-10-18 18:26:53 +00:00
dsl 048dfb4fde More tweaks for sysinst.
Let 'display action' routine set menu->cursel (ie default menu item).
Remove 'opt' parameter I added to action routine (not that useful).
Make man page slightly closer to reality.
2003-07-27 07:21:57 +00:00
dsl 2304abbd2b Spinkle some consts and remove/change parameter names so that sysinst
will compile with WARNS=3.
2003-07-25 07:22:05 +00:00
lukem abcf838dab only use __RCSID() if it is #defined 2003-07-17 08:33:03 +00:00
dsl f19029a851 Add OPT_IGNORE flag which makes menu item inactive.
Add menu-dependant function to draw menu lines (when opt_name NULL).
2003-07-07 12:20:56 +00:00
agc a8d6388e6f Add NetBSD RCS Ids. 2003-06-23 13:05:47 +00:00
dsl 19605a628c Add extra command 'allow dynamic messages' which will push all texts through
the msgc translation service.
Allow for texts being NULL as well as "", don't use strlen() to test for "".
2003-06-10 17:19:04 +00:00
dsl 3c95a92e07 More changes to improve sysinst:
- pass 'menudesc' and 'arg' values to post_act() and exit_act()
- add set_menu_numopt() for variable length menus
- fix (badly broken) allocation/free of dynamic menus
- option to allow default selection to be the exit line
2003-06-09 18:48:40 +00:00
dsl 3f8c566477 Add 'exit' (for exit text) parameter to new_menu() for dynamic menus.
Correct calculation of menu height and whether scrolling needs (was wrong
if a height was specified that was smaller that the number of lines needed).
Move keypad(m->mw, TRUE) to stop core dump when newwin() fails.
Allow for calling code hacking m->h (to reduce number of lines displayed).
Add a MC_NOCLEAR option to leave menu text showing when doing action.
2003-06-04 19:07:39 +00:00
dsl 6af8425f81 Add a 'void *' argument to process_menu() so that some more global variables
can be killed.
2003-06-03 11:51:56 +00:00
dsl 826d79a6f7 Re-instate last change, the sysinst I've just commited doesn't stand
a chance unless those fields are const char *.
2003-05-16 19:57:22 +00:00
lukem b86763939b Revert part of previous, and remove "const" from "char *opt_name" and
"char *title", since it causes compile problems for the only program
that uses menuc (sysinst).
2003-05-09 12:07:53 +00:00
dsl 13d47d34ac Finger trouble in previous commit. 2003-05-09 10:21:43 +00:00
dsl 7eb71f323d Update man page for recent changes, update code to match man page... 2003-05-09 07:30:50 +00:00
dsl b143b30e1c Accept variable names for menu titles and options to allow internationalisation.
Allow user code to define a hook to lookup message texts before any get used.
It is now possible to have a langauge independant menu file.
2003-05-08 16:20:56 +00:00
christos c3e2d898b4 produce lint free code. 2003-01-10 20:00:50 +00:00
tv 081041f2f7 MAX has special meaning in host tools. #undef it first. 2002-03-07 20:43:29 +00:00
bjh21 e0b2c4633d Move hard-coded /usr/share/misc from mdb.c to pathnames.h, in accordance
with KNF.
2001-10-15 22:20:03 +00:00
cgd c2bdafab79 use getprogname() 2001-02-20 23:51:59 +00:00
phil 0e57605760 Improve a parameter list, add the actual documentation for menuc. 2001-01-07 06:09:19 +00:00
mrg c5ce287448 fix oversight in previous. 2000-12-28 02:07:00 +00:00
mrg 775b57cd01 say "<progname>: Could not initialize curses", with the progname 2000-12-22 02:52:47 +00:00
phil 94c7405838 Tweek the "no shortcut" code.
MC_NOSHORTKEY to NOSHORTCUT
   added option "shortcut" to menuc input language.
   added example of this kind of menu in testm.
2000-08-15 02:09:11 +00:00
hubertf 4e87e20dda Changes:
* bring closer to KNF
 * when selecting a item in a menu, call the opt_action() callback with
   a pointer to the struct menudesc, so the callback has a chance to find
   out which item was selected. Having a seperate callback for each
   item is ok for small menus, but not for ones with many objects.
 * Add menu-option MC_NOSHORTCUT to not print letters ("a: ", ...)
   in front of list items. Again, this is for menues with lots of entries
   as e.g. the upcoming sysinst set_timezone() function composes.
 * Fix a long-standing bug WRT pagewise scrolling - the cursor is now
   properly placed one page up/down
2000-08-15 01:01:41 +00:00
wiz 563d6ee1be Add format string to fprintf(). 2000-07-23 22:18:44 +00:00
cgd b12d2926fa provide a way to set the string used for the 'Exit' menu item. 1999-06-20 02:07:18 +00:00
cgd 96c4c464ea * be more descriptive with the windor/screen too small for menu messages
(say width or height).
* work harder to make menu fit width-wise.  (if necessary, move the menu
  further left, and if that's not good enough exit with an error.)
* move menu system initialization out of process_menu() so that it can
  be called earlier (e.g. by the sysinst main()), since it initializes
  curses and other code might want to access the curses data structures
  before process_menu() is invoked.
1999-06-19 06:38:49 +00:00
phil 11c7d5d3b1 Put back "return value" meaning in option actions accidentally removed
in chanages for dynamic menus.  (Return !=0 means to exit menu dynamically.)
1998-07-23 17:56:00 +00:00
phil d20940b940 Major restructuring of the runtime code, now supports dynamic menus.
Fixed a bug is scrolling.  Added dynamic menu to test meuns in testm.
1998-07-16 07:08:26 +00:00
phil d6e31d7e9d Small tweeks, redoing language for dynamic menus. 1998-07-02 21:46:18 +00:00
phil 5aa748c608 Bug fixes, tweeks to scrolling, beginnings of dynamic menus. 1998-07-01 07:46:02 +00:00
phil b30b562845 Bug fixes in scrolling menues, better error detection with small screens,
bettern keypad support with suport form multiple key "commands" like
ESC-v for previous page.
1998-06-29 08:46:37 +00:00
phil 0c35cc0adb Tweeks to option lettering ... to allow 51 options per menu. Also
to generate an error if there are more.  (Checkpoint before furthur
changes to recognize more keypad keys.)
1998-06-25 19:57:10 +00:00
phil 1063113ca9 Add scrollable menus. Tweek testm's Makefile to remake if menu_sys.def
is modified.
1998-06-25 09:58:57 +00:00
phil 21fceead47 Add a online help facility. Each menu can specify a help screen associated
with that menu.  The help screen is scrollable for long help screens.
The char '?' accesses the help screen as a menu command.  Help screen text
is specified in the menu definition file with the menu.
1998-06-24 06:46:23 +00:00
mrg 9fe37f17a0 use static int instead of static 1998-03-30 02:28:37 +00:00