Commit Graph

58 Commits

Author SHA1 Message Date
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
wrstuden
699e5d41fb In procese_menu, make sure we initializie the menus
_before_ we access the MENUS macro. Otherwise we get a segfault.
2004-09-17 18:27:28 +00:00
wrstuden
3f87739bc4 Add parenthesis to silence a compiler warning. 2004-09-17 18:15:01 +00:00
dsl
c4d2d498a2 Call doupdate() before copying out of stdscr (avoids PR 26660)
Delete a diagnostic variable.
2004-08-14 15:51:08 +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
dsl
273835431b Allow menu boxes to be forced down the screen if the message text is long. 2004-02-29 23:13:23 +00:00
dsl
e2be127214 Use an array of pointers to menu definitions so the array can grow without
leaving code having stale pointers to menu ites.
2003-12-21 21:42:48 +00:00
dsl
092f7d2e16 Add '[no] clear' to lex/yacc spec.
Fix some menu sizing bugs for menus where the user code changes the size.
Don't reduce the size of a menu with 'scroll' every timeit is displayed.
2003-11-30 09:22:25 +00:00
dsl
1cedefc117 - Call delwin() when we stop displaying a window, saves space and newwin
is fast enough anyway.  Lets the calling code change some fields (eg
  the title for the 'yes/no' menu) between calls.
- Don't update m->x, m->y, m->w the changed values aren't needed once
  the window has been created.
- Allow the window title to span multiple lines.
- Fix a nasty bug caused by having pointers into the memory area freed
  by realloc when creating lots of dynamic menus.
- Fix check that ought to have allowed dynamic menus to be deleted.
2003-11-22 22:18:32 +00:00
dsl
33dbb7eda9 Fix box width calculation for menus without a 'shortcut' ("a: "). 2003-11-20 13:03:44 +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
0795bf3e7a Allow -ve integer constants in menu file.
Make y == -1 => after current messages (if msg_defs.h included).
Defer menu initialisation until after post_act() called (so function can
fiddle with more things.)
2003-09-27 09:44:13 +00:00
takemura
ffd38d4b14 Fixed array index checking to avoid segmentation fault problem. 2003-09-21 02:17:39 +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
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
dsl
e28e42e092 Improve diagnostic message 2003-06-27 22:06:14 +00:00
dsl
18439070c7 Do not let the cursor sit on menu lines that do nothing.
(Maybe page up/down should behave similarly - but that one is harder)
2003-06-16 20:57:43 +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
76c4788c16 More trivial changes...
Exclude '<: page up, >: page down' line from m->h count to simplify code.
2003-06-03 08:49:53 +00:00
dsl
99778eca69 Whitespace and other layout stuff.
Change an elsif sequence to switch()
2003-06-02 21:19:35 +00:00
dsl
66fb8e715d Need 'const' on local variable - since I added const to the structure field. 2003-05-09 10:24: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
dsl
f579b0bca7 Let page up/down go to first/last menu item when it is already showing. 2003-05-07 16:54:39 +00:00
dsl
13bfd47102 Add left and right arrows to list of keys that page menes up/down.
Make 'page down' go to 'exit' extry on menu (not stop one short).
Make 'exitstring' imply 'exit'.
2003-05-07 16:39:45 +00:00
christos
c3e2d898b4 produce lint free code. 2003-01-10 20:00:50 +00:00
blymn
19f21e4357 Modified input key handling to use libcurses keypad mode to assemble
multi-byte key sequences instead of doing it itself.
2002-04-04 14:11:23 +00:00
ross
a15e9b5f48 tweak previous for lp64 so sysinst will compile on alpha 2001-12-08 01:10:37 +00:00
christos
5c04ef3caa Fix for the new curses code. Inspired by changes from MINOURA Makoto. 2001-12-06 16:38:30 +00:00
perry
c50182835e 1) Use standard box drawing characters. It looks a whole lot better
than *'s.
2) On displays that handle color, do a cheesy white-on-blue theme.

As silly as it may seem, many people seem to respond better to color
and nice borders for sysinst.

XXX will rig up a way to do this more cleanly.
2001-11-17 01:12:47 +00:00
phil
0e57605760 Improve a parameter list, add the actual documentation for menuc. 2001-01-07 06:09:19 +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
thorpej
0687dad67e Make this work again now that curses no longer does an implicit tgetent()
via initscr() by calling t_getstr() with curses' internal terminal info
initialized in setterm() (which is called by initscr()).

XXX THIS IS A HORRIBLE KLUDGE!  ...and I'm almost embarassed to commit it.
XXX It really should be fixed by using normal curses facilities.
2000-04-22 21:34:25 +00:00
cgd
da4d528c80 need to provide an exit string for dynamic menus. hardcodes "Exit".
not pretty, but no worse than what the code did before.
1999-06-20 20:21:03 +00:00
cgd
8c3bc73ea2 provide the ability to do horizontal centering of menus, and make that
the default.  XXX: currently can't be turned back on for individual menus
if overridden by the menu definition's default setting.
1999-06-20 05:41:45 +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
27ddbc286a size menus without titles correctly. also, correctly position titles so
that they don't have to be coded to include leading spaces.
1999-06-20 01:20:14 +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
simonb
9bdbe15263 Don't frob the interals of a WINDOW*, use the getmaxy() macro. 1999-04-18 03:29:18 +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
4229b1a8cc Fix bugs found in scrolling, make scrolling never leave blank
lines in the menu.
1998-07-03 15:20:30 +00:00
phil
3ff44f8429 Stop scrolling of a non-scrolling menu using arrow keys. 1998-07-01 23:02:50 +00:00
phil
5aa748c608 Bug fixes, tweeks to scrolling, beginnings of dynamic menus. 1998-07-01 07:46:02 +00:00
phil
8f97042b69 Fixed a couple of simple bugs, added data returned for arrow keys for
xterm that is different than xterm termcap entry states.  (Does curses
change what is returned for arrow keys?)
1998-06-30 06:57:57 +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