diff options
43 files changed, 1241 insertions, 696 deletions
diff --git a/lib/libmenu/Makefile b/lib/libmenu/Makefile index dc9882854bb..3eb1c6b50c4 100644 --- a/lib/libmenu/Makefile +++ b/lib/libmenu/Makefile @@ -4,10 +4,11 @@ SRCS= m_attribs.c m_cursor.c m_driver.c m_format.c m_global.c m_hook.c \ m_item_val.c m_item_vis.c m_items.c m_new.c m_opts.c m_post.c \ m_userptr.c m_win.c HDRS= menu.h eti.h -CFLAGS+=-I. -I${.CURDIR} -DHAVE_EXTERN_ERRNO -MAN= menu.3 menu_driver.3 menu_items.3 menu_opts.3 menu_userptr.3 \ - menu_attribs.3 menu_format.3 menu_mark.3 menu_pattern.3 menu_win.3 \ - menu_cursor.3 menu_hook.3 menu_new.3 menu_post.3 +CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../libcurses -DHAVE_CONFIG_H +MAN= menu.3 menu_attribs.3 menu_cursor.3 menu_driver.3 menu_format.3 \ + menu_hook.3 menu_items.3 menu_mark.3 menu_new.3 menu_opts.3 \ + menu_pattern.3 menu_post.3 menu_requestname.3 menu_spacing.3 \ + menu_userptr.3 menu_win.3 includes: @cd ${.CURDIR}; for i in ${HDRS}; do \ diff --git a/lib/libmenu/eti.h b/lib/libmenu/eti.h index c1bc876def9..63028e849bc 100644 --- a/lib/libmenu/eti.h +++ b/lib/libmenu/eti.h @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses Extended Terminal Interface (ETI) is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ #ifndef _ETI_ERRNO_H_ #define _ETI_ERRNO_H_ diff --git a/lib/libmenu/m_attribs.c b/lib/libmenu/m_attribs.c index 6361f74b93f..36a7758ed1e 100644 --- a/lib/libmenu/m_attribs.c +++ b/lib/libmenu/m_attribs.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_attribs * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_attribs.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ if ( (menu) && ((menu)->status & _POSTED) )\ diff --git a/lib/libmenu/m_cursor.c b/lib/libmenu/m_cursor.c index 8eb1ffebf47..3d9c7f7c4ef 100644 --- a/lib/libmenu/m_cursor.c +++ b/lib/libmenu/m_cursor.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_cursor * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_cursor.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : pos_menu_cursor @@ -52,8 +55,8 @@ int pos_menu_cursor(const MENU * menu) item = menu->curitem; assert(item); - x = item->x * (1 + menu->itemlen); - y = item->y - menu->toprow; + x = item->x * (menu->spc_cols + menu->itemlen); + y = (item->y - menu->toprow) * menu->spc_rows; win = menu->userwin ? menu->userwin : stdscr; sub = menu->usersub ? menu->usersub : win; assert(win && sub); diff --git a/lib/libmenu/m_driver.c b/lib/libmenu/m_driver.c index db0f8cd9919..1194bcc78fc 100644 --- a/lib/libmenu/m_driver.c +++ b/lib/libmenu/m_driver.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_driver and menu_pattern * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_driver.c,v 1.8 1997/05/01 16:47:26 juergen Exp $") + /* Macros */ /* Remove the last character from the match pattern buffer */ @@ -329,7 +332,7 @@ int menu_driver(MENU * menu, int c) case REQ_SCR_DLINE: /*=================*/ my_top_row++; - if ((menu->rows - menu->height)>0) + if ((menu->rows - menu->arows)>0) { /* only if the menu has less items than rows, we can deny the request. Otherwise the epilogue of this routine adjusts the @@ -343,9 +346,9 @@ int menu_driver(MENU * menu, int c) case REQ_SCR_DPAGE: /*=================*/ - rdiff = menu->rows - menu->height - my_top_row; - if (rdiff > menu->height) - rdiff = menu->height; + rdiff = menu->rows - menu->arows - my_top_row; + if (rdiff > menu->arows) + rdiff = menu->arows; if (rdiff==0) result = E_REQUEST_DENIED; else @@ -358,8 +361,8 @@ int menu_driver(MENU * menu, int c) case REQ_SCR_UPAGE: /*=================*/ - rdiff = (menu->height < my_top_row) ? - menu->height : my_top_row; + rdiff = (menu->arows < my_top_row) ? + menu->arows : my_top_row; if (rdiff==0) result = E_REQUEST_DENIED; else @@ -416,7 +419,7 @@ int menu_driver(MENU * menu, int c) { if (menu->curitem->opt & O_SELECTABLE) { - menu->curitem->value = TRUE; + menu->curitem->value = !menu->curitem->value; Move_And_Post_Item(menu,menu->curitem); _nc_Show_Menu(menu); } @@ -498,8 +501,8 @@ int menu_driver(MENU * menu, int c) doesn't appear in the menu window */ if ( item->y < my_top_row ) my_top_row = item->y; - else if ( item->y >= (my_top_row + menu->height) ) - my_top_row = item->y - menu->height + 1; + else if ( item->y >= (my_top_row + menu->arows) ) + my_top_row = item->y - menu->arows + 1; _nc_New_TopRow_and_CurrentItem( menu, my_top_row, item ); diff --git a/lib/libmenu/m_format.c b/lib/libmenu/m_format.c index 10564106134..351bc420410 100644 --- a/lib/libmenu/m_format.c +++ b/lib/libmenu/m_format.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_format * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_format.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + #define minimum(a,b) ((a)<(b) ? (a): (b)) /*--------------------------------------------------------------------------- @@ -76,7 +79,7 @@ int set_menu_format(MENU *menu, int rows, int cols) menu->rows = total_rows; menu->cols = total_cols; - menu->height = minimum(total_rows,rows); + menu->arows = minimum(total_rows,rows); menu->toprow = 0; menu->curitem = *(menu->items); assert(menu->curitem); diff --git a/lib/libmenu/m_global.c b/lib/libmenu/m_global.c index 050100dc00b..ea3bfcfdcab 100644 --- a/lib/libmenu/m_global.c +++ b/lib/libmenu/m_global.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_global * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_global.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + MENU _nc_Default_Menu = { 16, /* Nr. of chars high */ 1, /* Nr. of chars wide */ @@ -33,10 +36,14 @@ MENU _nc_Default_Menu = { 1, /* Nr. of items wide */ 16, /* Nr. of formatted items high */ 1, /* Nr. of formatted items wide */ + 16, /* Nr. of items high (actual) */ 0, /* length of widest name */ 0, /* length of widest description */ 1, /* length of mark */ 1, /* length of one item */ + 1, /* Spacing for descriptor */ + 1, /* Spacing for columns */ + 1, /* Spacing for rows */ (char *)0, /* buffer used to store match chars */ 0, /* Index into pattern buffer */ (WINDOW *)0, /* Window containing entire menu */ @@ -176,7 +183,7 @@ bool _nc_Connect_Items(MENU *menu, ITEM **items) else return(FALSE); - if (ItemCount > 0) + if (ItemCount != 0) { menu->items = items; menu->nitems = ItemCount; @@ -225,18 +232,18 @@ void _nc_Calculate_Item_Length_and_Width(MENU * menu) int l; assert(menu); - if (menu->items && *(menu->items)) - { - l = menu->namelen + menu->marklen; - if ( (menu->opt & O_SHOWDESC) && (menu->desclen > 0) ) - l += (menu->desclen + 1); - - menu->itemlen = l; - l *= menu->cols; - l += (menu->cols-1); /* for the padding between the columns */ - menu->width = l; - } -} + + menu->height = 1 + menu->spc_rows * (menu->arows - 1); + + l = menu->namelen + menu->marklen; + if ( (menu->opt & O_SHOWDESC) && (menu->desclen > 0) ) + l += (menu->desclen + menu->spc_desc); + + menu->itemlen = l; + l *= menu->cols; + l += (menu->cols-1)*menu->spc_cols; /* for the padding between the columns */ + menu->width = l; +} /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -384,7 +391,7 @@ void _nc_Show_Menu(const MENU *menu) { /* adjust the internal subwindow to start on the current top */ assert(menu->sub); - mvderwin(menu->sub,menu->toprow,0); + mvderwin(menu->sub,menu->spc_rows * menu->toprow,0); win = Get_Menu_Window(menu); maxy = getmaxy(win); diff --git a/lib/libmenu/m_hook.c b/lib/libmenu/m_hook.c index 891005abf31..65fe0e9b59a 100644 --- a/lib/libmenu/m_hook.c +++ b/lib/libmenu/m_hook.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_hook * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_hook.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ int set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ diff --git a/lib/libmenu/m_item_cur.c b/lib/libmenu/m_item_cur.c index b9b43acd7e2..0af44e3ef80 100644 --- a/lib/libmenu/m_item_cur.c +++ b/lib/libmenu/m_item_cur.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_item_cur * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_item_cur.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int set_current_item(MENU *menu, const ITEM *item) @@ -83,11 +86,11 @@ ITEM *current_item(const MENU * menu) | | Description : Return the logical index of this item. | -| Return Values : The index or -1 if this is an invalid item pointer +| Return Values : The index or ERR if this is an invalid item pointer +--------------------------------------------------------------------------*/ int item_index(const ITEM *item) { - return (item && item->imenu) ? item->index : -1; + return (item && item->imenu) ? item->index : ERR; } /*--------------------------------------------------------------------------- @@ -111,7 +114,7 @@ int set_top_row(MENU * menu, int row) if (menu->items == (ITEM **)0) RETURN(E_NOT_CONNECTED); - if ((row<0) || (row>=(menu->rows - menu->height))) + if ((row<0) || (row > (menu->rows - menu->arows))) RETURN(E_BAD_ARGUMENT); } else @@ -137,7 +140,7 @@ int set_top_row(MENU * menu, int row) | | Description : Return the top row of the menu | -| Return Values : The row number or -1 if there is no row +| Return Values : The row number or ERR if there is no row +--------------------------------------------------------------------------*/ int top_row(const MENU * menu) { @@ -147,7 +150,7 @@ int top_row(const MENU * menu) return menu->toprow; } else - return(-1); + return(ERR); } /* m_item_cur.c ends here */ diff --git a/lib/libmenu/m_item_nam.c b/lib/libmenu/m_item_nam.c index 3eac4ee0343..876cf05a777 100644 --- a/lib/libmenu/m_item_nam.c +++ b/lib/libmenu/m_item_nam.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_item_nam * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_item_nam.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : char *item_name(const ITEM *item) @@ -34,7 +37,7 @@ | | Return Values : See above; returns NULL if item is invalid +--------------------------------------------------------------------------*/ -char *item_name(const ITEM * item) +const char *item_name(const ITEM * item) { return ((item) ? item->name.str : (char *)0); } @@ -47,7 +50,7 @@ char *item_name(const ITEM * item) | | Return Values : See above; Returns NULL if item is invalid +--------------------------------------------------------------------------*/ -char *item_description(const ITEM * item) +const char *item_description(const ITEM * item) { return ((item) ? item->description.str : (char *)0); } diff --git a/lib/libmenu/m_item_new.c b/lib/libmenu/m_item_new.c index 8ef123f580c..5d06576fd08 100644 --- a/lib/libmenu/m_item_new.c +++ b/lib/libmenu/m_item_new.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_item_new * @@ -27,6 +28,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_item_new.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : bool Is_Printable_String(const char *s) @@ -59,7 +62,7 @@ static bool Is_Printable_String(const char *s) | | Return Values : The item pointer or NULL if creation failed. +--------------------------------------------------------------------------*/ -ITEM *new_item(char *name, char *description) +ITEM *new_item(const char *name, const char *description) { ITEM *item; @@ -75,12 +78,37 @@ ITEM *new_item(char *name, char *description) { *item = _nc_Default_Item; /* hope we have struct assignment */ - item->name.str = name; item->name.length = strlen(name); + item->name.str = (char *)malloc(1 + item->name.length); + if (item->name.str) + { + strcpy(item->name.str, name); + } + else + { + free(item); + SET_ERROR( E_SYSTEM_ERROR ); + return (ITEM *)0; + } - item->description.str = description; - if (description && Is_Printable_String(description)) - item->description.length = strlen(description); + if (description && (*description != '\0') && + Is_Printable_String(description)) + { + item->description.length = strlen(description); + item->description.str = + (char *)malloc(1 + item->description.length); + if (item->description.str) + { + strcpy(item->description.str, description); + } + else + { + free(item->name.str); + free(item); + SET_ERROR( E_SYSTEM_ERROR ); + return (ITEM *)0; + } + } else { item->description.length = 0; @@ -112,13 +140,18 @@ int free_item(ITEM * item) if (item->imenu) RETURN( E_CONNECTED ); + if (item->name.str) + free(item->name.str); + if (item->description.str) + free (item->description.str); free(item); + RETURN( E_OK ); } /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int set_menu_mark( MENU *menu, char *mark ) +| Function : int set_menu_mark( MENU *menu, const char *mark ) | | Description : Set the mark string used to indicate the current | item (single-valued menu) or the selected items @@ -131,18 +164,22 @@ int free_item(ITEM * item) | | Return Values : E_OK - success | E_BAD_ARGUMENT - an invalid value has been passed +| E_SYSTEM_ERROR - no memory to store mark +--------------------------------------------------------------------------*/ -int set_menu_mark(MENU * menu, char * mark) +int set_menu_mark(MENU * menu, const char * mark) { int l; - - if ( mark && *mark && Is_Printable_String(mark) ) + + if ( mark && (*mark != '\0') && Is_Printable_String(mark) ) l = strlen(mark); else l = 0; - + if ( menu ) { + char *old_mark = menu->mark; + unsigned short old_status = menu->status; + if (menu->status & _POSTED) { /* If the menu is already posted, the geometry is fixed. Then @@ -150,9 +187,27 @@ int set_menu_mark(MENU * menu, char * mark) if (menu->marklen != l) RETURN(E_BAD_ARGUMENT); } - menu->mark = l ? mark : (char *)0; menu->marklen = l; + if (l) + { + menu->mark = (char *)malloc(l+1); + if (menu->mark) + { + strcpy(menu->mark, mark); + menu->status |= _MARK_ALLOCATED; + } + else + { + menu->mark = old_mark; + RETURN(E_SYSTEM_ERROR); + } + } + else + menu->mark = (char *)0; + if ((old_status & _MARK_ALLOCATED) && old_mark) + free(old_mark); + if (menu->status & _POSTED) { _nc_Draw_Menu( menu ); @@ -166,8 +221,7 @@ int set_menu_mark(MENU * menu, char * mark) } else { - _nc_Default_Menu.mark = l ? mark : (char *)0; - _nc_Default_Menu.marklen = l; + return set_menu_mark(&_nc_Default_Menu, mark); } RETURN(E_OK); } @@ -180,7 +234,7 @@ int set_menu_mark(MENU * menu, char * mark) | | Return Values : The marker string pointer or NULL if no marker defined +--------------------------------------------------------------------------*/ -char *menu_mark(const MENU * menu) +const char *menu_mark(const MENU * menu) { return Normalize_Menu( menu )->mark; } diff --git a/lib/libmenu/m_item_opt.c b/lib/libmenu/m_item_opt.c index 00dd3a78d3e..f3b53f37436 100644 --- a/lib/libmenu/m_item_opt.c +++ b/lib/libmenu/m_item_opt.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_item_opt * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_item_opt.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int set_item_opts(ITEM *item, Item_Options opts) diff --git a/lib/libmenu/m_item_use.c b/lib/libmenu/m_item_use.c index b12d573a1e7..9efb0601390 100644 --- a/lib/libmenu/m_item_use.c +++ b/lib/libmenu/m_item_use.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_item_use * @@ -26,16 +27,18 @@ #include "menu.priv.h" +MODULE_ID("Id: m_item_use.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int set_item_userptr(ITEM *item, char *userptr) +| Function : int set_item_userptr(ITEM *item, const void *userptr) | | Description : Set the pointer that is reserved in any item to store | application relevant informations. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_item_userptr(ITEM * item, char * userptr) +int set_item_userptr(ITEM * item, const void * userptr) { Normalize_Item(item)->userptr = userptr; RETURN( E_OK ); @@ -43,7 +46,7 @@ int set_item_userptr(ITEM * item, char * userptr) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : char *item_userptr(const ITEM *item) +| Function : const void *item_userptr(const ITEM *item) | | Description : Return the pointer that is reserved in any item to store | application relevant informations. @@ -51,7 +54,7 @@ int set_item_userptr(ITEM * item, char * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned. +--------------------------------------------------------------------------*/ -char *item_userptr(const ITEM * item) +const void *item_userptr(const ITEM * item) { return Normalize_Item(item)->userptr; } diff --git a/lib/libmenu/m_item_val.c b/lib/libmenu/m_item_val.c index fdc57214e1d..bc5afdcbcff 100644 --- a/lib/libmenu/m_item_val.c +++ b/lib/libmenu/m_item_val.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_item_val * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_item_val.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int set_item_value(ITEM *item, int value) diff --git a/lib/libmenu/m_item_vis.c b/lib/libmenu/m_item_vis.c index 36eeaeb6887..3829be4a33c 100644 --- a/lib/libmenu/m_item_vis.c +++ b/lib/libmenu/m_item_vis.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_item_vis * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_item_vis.c,v 1.6 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : bool item_visible(const ITEM *item) @@ -43,7 +46,7 @@ bool item_visible(const ITEM * item) if ( item && (menu=item->imenu) && (menu->status & _POSTED) && - ( (menu->toprow + menu->height - 1) >= (item->y) ) && + ( (menu->toprow + menu->arows) > (item->y) ) && ( item->y >= menu->toprow) ) return TRUE; else diff --git a/lib/libmenu/m_items.c b/lib/libmenu/m_items.c index 9c4c532a834..0387adbc355 100644 --- a/lib/libmenu/m_items.c +++ b/lib/libmenu/m_items.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_items * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_items.c,v 1.4 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int set_menu_items(MENU *menu, ITEM **items) diff --git a/lib/libmenu/m_new.c b/lib/libmenu/m_new.c index a9845544dd0..03955a37cc2 100644 --- a/lib/libmenu/m_new.c +++ b/lib/libmenu/m_new.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_new * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_new.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : MENU *new_menu(ITEM **items) @@ -84,6 +87,9 @@ int free_menu(MENU * menu) if (menu->items) _nc_Disconnect_Items(menu); + if ((menu->status & _MARK_ALLOCATED) && menu->mark) + free(menu->mark); + free(menu); RETURN(E_OK); } diff --git a/lib/libmenu/m_opts.c b/lib/libmenu/m_opts.c index d0422e97764..cbfbf05d230 100644 --- a/lib/libmenu/m_opts.c +++ b/lib/libmenu/m_opts.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_opts * @@ -26,10 +27,12 @@ #include "menu.priv.h" +MODULE_ID("Id: m_opts.c,v 1.6 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int set_menu_opts(MENU *menu, Menu_Options opts) -| +| | Description : Set the options for this menu. If the new settings | end up in a change of the geometry of the menu, it | will be recalculated. This operation is forbidden if @@ -43,12 +46,12 @@ int set_menu_opts(MENU * menu, Menu_Options opts) { if (opts & ~ALL_MENU_OPTS) RETURN(E_BAD_ARGUMENT); - + if (menu) { if ( menu->status & _POSTED ) RETURN(E_POSTED); - + if ( (opts&O_ROWMAJOR) != (menu->opt&O_ROWMAJOR)) { /* we need this only if the layout really changed ... */ @@ -59,32 +62,32 @@ int set_menu_opts(MENU * menu, Menu_Options opts) assert(menu->curitem); set_menu_format( menu, menu->frows, menu->fcols ); } - } - + } + menu->opt = opts; - + if (opts & O_ONEVALUE) { ITEM **item; - - if ( (item=menu->items) ) - for(;*item;item++) + + if ( ((item=menu->items) != (ITEM**)0) ) + for(;*item;item++) (*item)->value = FALSE; } - + if (opts & O_SHOWDESC) /* this also changes the geometry */ _nc_Calculate_Item_Length_and_Width( menu ); } else _nc_Default_Menu.opt = opts; - + RETURN(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int menu_opts_off(MENU *menu, Menu_Options opts) -| +| | Description : Switch off the options for this menu. If the new settings | end up in a change of the geometry of the menu, it | will be recalculated. This operation is forbidden if @@ -98,7 +101,7 @@ int menu_opts_off(MENU *menu, Menu_Options opts) { MENU *cmenu = menu; /* use a copy because set_menu_opts must detect NULL menu itself to adjust its behaviour */ - + if (opts & ~ALL_MENU_OPTS) RETURN(E_BAD_ARGUMENT); else @@ -107,12 +110,12 @@ int menu_opts_off(MENU *menu, Menu_Options opts) opts = cmenu->opt & ~opts; return set_menu_opts( menu, opts ); } -} +} /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int menu_opts_on(MENU *menu, Menu_Options opts) -| +| | Description : Switch on the options for this menu. If the new settings | end up in a change of the geometry of the menu, it | will be recalculated. This operation is forbidden if @@ -126,7 +129,7 @@ int menu_opts_on(MENU * menu, Menu_Options opts) { MENU *cmenu = menu; /* use a copy because set_menu_opts must detect NULL menu itself to adjust its behaviour */ - + if (opts & ~ALL_MENU_OPTS) RETURN(E_BAD_ARGUMENT); else @@ -134,13 +137,13 @@ int menu_opts_on(MENU * menu, Menu_Options opts) Normalize_Menu(cmenu); opts = cmenu->opt | opts; return set_menu_opts(menu, opts); - } + } } /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : Menu_Options menu_opts(const MENU *menu) -| +| | Description : Return the options for this menu. | | Return Values : Menu options diff --git a/lib/libmenu/m_post.c b/lib/libmenu/m_post.c index fe4ed566447..b7bcdc66276 100644 --- a/lib/libmenu/m_post.c +++ b/lib/libmenu/m_post.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_post * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_post.c,v 1.12 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : void _nc_Post_Item(MENU *menu, ITEM *item) @@ -39,10 +42,47 @@ void _nc_Post_Item(const MENU * menu, const ITEM * item) { int i; chtype ch; + int item_x, item_y; + int count = 0; bool isfore = FALSE, isback=FALSE, isgrey = FALSE; assert(menu->win); + getyx(menu->win,item_y,item_x); + + /* We need a marker iff + - it is a onevalued menu and it is the current item + - or it has a selection value + */ + wattron(menu->win,menu->back); + if (item->value || (item==menu->curitem)) + { + if (menu->marklen) + { + /* In a multi selection menu we use the fore attribute + for a selected marker that is not the current one. + This improves visualization of the menu, because now + always the 'normal' marker denotes the current + item. */ + if (!(menu->opt & O_ONEVALUE) && item->value && item!=menu->curitem) + { + wattron(menu->win,menu->fore); + isfore = TRUE; + } + waddstr(menu->win,menu->mark); + if (isfore) + { + wattron(menu->win,menu->fore); + isfore = FALSE; + } + } + } + else /* otherwise we have to wipe out the marker area */ + for(ch=' ',i=menu->marklen;i>0;i--) + waddch(menu->win,ch); + wattroff(menu->win,menu->back); + count += menu->marklen; + /* First we have to calculate the attribute depending on selectability and selection status */ @@ -64,36 +104,62 @@ void _nc_Post_Item(const MENU * menu, const ITEM * item) isback = TRUE; } } - - /* We need a marker iff - - it is a onevalued menu and it is the current item - - or it has a selection value - */ - if (item->value || ((menu->opt&O_ONEVALUE) && (item==menu->curitem)) ) - { - if (menu->marklen) - waddstr(menu->win,menu->mark); - } - else /* otherwise we have to wipe out the marker area */ - for(ch=menu->pad,i=menu->marklen;i>0;i--) - waddch(menu->win,ch); - + waddnstr(menu->win,item->name.str,item->name.length); - for(ch=menu->pad,i=menu->namelen-item->name.length;i>0;i--) + for(ch=' ',i=menu->namelen-item->name.length;i>0;i--) { waddch(menu->win,ch); } - + count += menu->namelen; + /* Show description if required and available */ if ( (menu->opt & O_SHOWDESC) && menu->desclen>0 ) { - waddch(menu->win,menu->pad); + int m = menu->spc_desc/2; + int cy = -1, cx = -1; + + for(ch=' ',i=0; i < menu->spc_desc; i++) + { + if (i==m) + { + waddch(menu->win,menu->pad); + getyx(menu->win,cy,cx); + } + else + waddch(menu->win,ch); + } if (item->description.length) waddnstr(menu->win,item->description.str,item->description.length); - for(ch=menu->pad,i=menu->desclen-item->description.length; i>0; i--) + for(ch=' ',i=menu->desclen-item->description.length; i>0; i--) { waddch(menu->win,ch); } + count += menu->desclen + menu->spc_desc; + + if (menu->spc_rows > 1) + { + int j, k, ncy, ncx; + + assert(cx>=0 && cy>=0); + getyx(menu->win,ncy,ncx); + if (isgrey) wattroff(menu->win,menu->grey); + else if (isfore) wattroff(menu->win,menu->fore); + wattron(menu->win,menu->back); + for(j=1; j < menu->spc_rows;j++) + { + if ((item_y+j) < getmaxy(menu->win)) + { + wmove (menu->win,item_y+j,item_x); + for(k=0;k<count;k++) + waddch(menu->win,' '); + } + if ((cy+j) < getmaxy(menu->win)) + mvwaddch(menu->win,cy+j,cx-1,menu->pad); + } + wmove(menu->win,ncy,ncx); + if (!isback) + wattroff(menu->win,menu->back); + } } /* Remove attributes */ @@ -119,30 +185,52 @@ void _nc_Draw_Menu(const MENU * menu) ITEM *lasthor, *lastvert; ITEM *hitem; int y = 0; - + chtype s_bkgd; + assert(item && menu->win); - + + s_bkgd = getbkgd(menu->win); + wbkgdset(menu->win,menu->back); + werase(menu->win); + wbkgdset(menu->win,s_bkgd); + lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : item; - + do { - wmove(menu->win,y++,0); - + wmove(menu->win,y,0); + hitem = item; lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : hitem; do { _nc_Post_Item( menu, hitem); + + wattron(menu->win,menu->back); if ( ((hitem = hitem->right) != lasthor) && hitem ) { - waddch( menu->win,menu->pad); + int i,j, cy, cx; + chtype ch = ' '; + + getyx(menu->win,cy,cx); + for(j=0;j<menu->spc_rows;j++) + { + wmove(menu->win,cy+j,cx); + for(i=0; i < menu->spc_cols; i++) + { + waddch( menu->win,ch); + } + } + wmove(menu->win,cy,cx+menu->spc_cols); } } while (hitem && (hitem != lasthor)); + wattroff(menu->win,menu->back); item = item->down; + y += menu->spc_rows; - } while( item && (item != lastvert) ); + } while( item && (item != lastvert) ); } /*--------------------------------------------------------------------------- @@ -173,6 +261,8 @@ int post_menu(MENU * menu) if (menu->items && *(menu->items)) { int y; + int h = 1 + menu->spc_rows * (menu->rows - 1); + WINDOW *win = Get_Menu_Window(menu); int maxy = getmaxy(win); int maxx = getmaxx(win); @@ -180,9 +270,9 @@ int post_menu(MENU * menu) if (maxx < menu->width || maxy < menu->height) RETURN(E_NO_ROOM); - if ( (menu->win = newpad(menu->rows,menu->width)) ) + if ( (menu->win = newpad(h,menu->width)) ) { - y = (maxy >= menu->rows) ? menu->rows : maxy; + y = (maxy >= h) ? h : maxy; if (y>=menu->height) y = menu->height; if(!(menu->sub = subpad(menu->win,y,menu->width,0,0))) diff --git a/lib/libmenu/m_req_name.c b/lib/libmenu/m_req_name.c new file mode 100644 index 00000000000..dfc8a36c9fd --- /dev/null +++ b/lib/libmenu/m_req_name.c @@ -0,0 +1,109 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_request_name * +* Routines to handle external names of menu requests * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("Id: m_req_name.c,v 1.8 1997/05/01 16:47:26 juergen Exp $") + +static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { + "LEFT_ITEM" , + "RIGHT_ITEM" , + "UP_ITEM" , + "DOWN_ITEM" , + "SCR_ULINE" , + "SCR_DLINE" , + "SCR_DPAGE" , + "SCR_UPAGE" , + "FIRST_ITEM" , + "LAST_ITEM" , + "NEXT_ITEM" , + "PREV_ITEM" , + "TOGGLE_ITEM" , + "CLEAR_PATTERN", + "BACK_PATTERN" , + "NEXT_MATCH" , + "PREV_MATCH" +}; +#define A_SIZE (sizeof(request_names)/sizeof(request_names[0])) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : const char * menu_request_name (int request); +| +| Description : Get the external name of a menu request. +| +| Return Values : Pointer to name - on success +| NULL - on invalid request code ++--------------------------------------------------------------------------*/ +const char *menu_request_name( int request ) +{ + if ( (request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND) ) + { + SET_ERROR(E_BAD_ARGUMENT); + return (const char *)0; + } + else + return request_names[ request - MIN_MENU_COMMAND ]; +} + + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_request_by_name (const char *str); +| +| Description : Search for a request with this name. +| +| Return Values : Request Id - on success +| E_NO_MATCH - request not found ++--------------------------------------------------------------------------*/ +int menu_request_by_name( const char *str ) +{ + /* because the table is so small, it doesn't really hurt + to run sequentially through it. + */ + unsigned int i = 0; + char buf[16]; + + if (str) + { + strncpy(buf,str,sizeof(buf)); + while( (i<sizeof(buf)) && (buf[i] != '\0') ) + { + buf[i] = toupper(buf[i]); + i++; + } + + for (i=0; i < A_SIZE; i++) + { + if (strncmp(request_names[i],buf,sizeof(buf))==0) + return MIN_MENU_COMMAND + i; + } + } + RETURN(E_NO_MATCH); +} + +/* m_req_name.c ends here */ diff --git a/lib/libmenu/m_spacing.c b/lib/libmenu/m_spacing.c new file mode 100644 index 00000000000..3b5b313d26e --- /dev/null +++ b/lib/libmenu/m_spacing.c @@ -0,0 +1,88 @@ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ + +/*************************************************************************** +* Module menu_spacing * +* Routines to handle spacing between entries * +***************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("Id: m_spacing.c,v 1.7 1997/05/01 16:47:26 juergen Exp $") + +#define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) +#define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) +#define MAX_SPC_ROWS (3) + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int set_menu_spacing(MENU *menu,int desc, int r, int c); +| +| Description : Set the spacing between entried +| +| Return Values : E_OK - on success ++--------------------------------------------------------------------------*/ +int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col ) +{ + MENU *m; /* split for ATAC workaround */ + m = Normalize_Menu(menu); + + assert(m); + if (m->status & _POSTED) + RETURN(E_POSTED); + + if (((s_desc < 0) || (s_desc > MAX_SPC_DESC)) || + ((s_row < 0) || (s_row > MAX_SPC_ROWS)) || + ((s_col < 0) || (s_col > MAX_SPC_COLS))) + RETURN(E_BAD_ARGUMENT); + + m->spc_desc = s_desc ? s_desc : 1; + m->spc_rows = s_row ? s_row : 1; + m->spc_cols = s_col ? s_col : 1; + _nc_Calculate_Item_Length_and_Width(m); + + RETURN(E_OK); +} + + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int menu_spacing (const MENU *,int *,int *,int *); +| +| Description : Retrieve info about spacing between the entries +| +| Return Values : E_OK - on success ++--------------------------------------------------------------------------*/ +int menu_spacing( const MENU *menu, int* s_desc, int* s_row, int* s_col) +{ + const MENU *m; /* split for ATAC workaround */ + m = Normalize_Menu(menu); + + assert(m); + if (s_desc) *s_desc = m->spc_desc; + if (s_row) *s_row = m->spc_rows; + if (s_col) *s_col = m->spc_cols; + + RETURN(E_OK); +} + +/* m_spacing.c ends here */ diff --git a/lib/libmenu/m_userptr.c b/lib/libmenu/m_userptr.c index 634b4b2b29a..e04ce7951f8 100644 --- a/lib/libmenu/m_userptr.c +++ b/lib/libmenu/m_userptr.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_userptr * @@ -26,16 +27,18 @@ #include "menu.priv.h" +MODULE_ID("Id: m_userptr.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int set_menu_userptr(MENU *menu, char *userptr) +| Function : int set_menu_userptr(MENU *menu, const void *userptr) | | Description : Set the pointer that is reserved in any menu to store | application relevant informations. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -int set_menu_userptr(MENU * menu, char * userptr) +int set_menu_userptr(MENU * menu, const void * userptr) { Normalize_Menu(menu)->userptr = userptr; RETURN( E_OK ); @@ -51,7 +54,7 @@ int set_menu_userptr(MENU * menu, char * userptr) | Return Values : Value of the pointer. If no such pointer has been set, | NULL is returned +--------------------------------------------------------------------------*/ -char *menu_userptr(const MENU * menu) +const void *menu_userptr(const MENU * menu) { return( Normalize_Menu(menu)->userptr); } diff --git a/lib/libmenu/m_win.c b/lib/libmenu/m_win.c index 7baad40c5d8..7107e76bb99 100644 --- a/lib/libmenu/m_win.c +++ b/lib/libmenu/m_win.c @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu_win * @@ -26,6 +27,8 @@ #include "menu.priv.h" +MODULE_ID("Id: m_win.c,v 1.5 1997/05/01 16:47:26 juergen Exp $") + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int set_menu_win(MENU *menu, WINDOW *win) @@ -60,7 +63,8 @@ int set_menu_win(MENU *menu, WINDOW *win) +--------------------------------------------------------------------------*/ WINDOW *menu_win(const MENU *menu) { - return Normalize_Menu(menu)->userwin; + const MENU* m = Normalize_Menu(menu); + return (m->userwin ? m->userwin : stdscr); } /*--------------------------------------------------------------------------- @@ -97,7 +101,8 @@ int set_menu_sub(MENU *menu, WINDOW *win) +--------------------------------------------------------------------------*/ WINDOW *menu_sub(const MENU * menu) { - return Normalize_Menu(menu)->usersub; + const MENU* m = Normalize_Menu(menu); + return Get_Menu_Window(m); } /*--------------------------------------------------------------------------- diff --git a/lib/libmenu/menu.3 b/lib/libmenu/menu.3 index 99b3a962973..725c04742cd 100644 --- a/lib/libmenu/menu.3 +++ b/lib/libmenu/menu.3 @@ -1,4 +1,5 @@ '\" t +.\" Id: menu.3x,v 1.9 1997/01/05 01:23:39 tom Exp $ .TH menus 3X "" .SH NAME \fBmenus\fR - curses extension for programming menus @@ -13,7 +14,7 @@ menus, display menus on the screen, and handle interaction with the user. The \fBmenus\fR library uses the \fBcurses\fR libraries, and a curses initialization routine such as \fBinitscr\fR must be called before using any of -these functions. To use the \Bmenus\fR library, link with the options +these functions. To use the \fBmenus\fR library, link with the options \fB-lmenu -lcurses\fR. .SS Current Default Values for Item Attributes @@ -29,70 +30,75 @@ rendering of items already created. The following table lists each \fBmenu\fR routine and the name of the manual page on which it is described. -.nf -\fBcurses\fR Routine Name Manual Page Name -_________________________________________ -\fBcurrent_item\fR mitem_current(3X) -\fBfree_item\fR mitem_new(3X) -\fBfree_menu\fR menu_new(3X) -\fBitem_count\fR menu_items(3X) -\fBitem_description\fR mitem_name(3X) -\fBitem_index\fR mitem_current(3X) -\fBitem_init\fR menu_hook(3X) -\fBitem_name\fR mitem_name(3X) -\fBitem_opts\fR mitem_opts(3X) -\fBitem_opts_off\fR mitem_opts(3X) -\fBitem_opts_on\fR mitem_opts(3X) -\fBitem_term\fR menu_hook(3X) -\fBitem_userptr\fR mitem_userptr(3X) -\fBitem_value\fR mitem_value(3X) -\fBitem_visible\fR mitem_visible(3X) -\fBmenu_back\fR menu_attribs(3X) -\fBmenu_driver\fR menu_driver(3X) -\fBmenu_fore\fR menu_fore(3X) -\fBmenu_format\fR menu_format(3X) -\fBmenu_grey\fR menu_attribs(3X) -\fBmenu_init\fR menu_hook(3X) -\fBmenu_items\fR menu_items(3X) -\fBmenu_mark\fR menu_mark(3X) -\fBmenu_opts\fR menu_opts(3X) -\fBmenu_opts_off\fR menu_opts(3X) -\fBmenu_opts_on\fR menu_opts(3X) -\fBmenu_pad\fR menu_attribs(3X) -\fBmenu_pattern\fR menu_pattern(3X) -\fBmenu_sub\fR menu_win(3X) -\fBmenu_term\fR menu_hook(3X) -\fBmenu_userptr\fR menu_userptr(3X) -\fBmenu_win\fR menu_win(3X) -\fBnew_item\fR mitem_new(3X) -\fBnew_menu\fR menu_new(3X) -\fBpos_menu_cursor\fR menu_cursor(3X) -\fBpost_menu\fR menu_post(3X) -\fBscale_menu\fR menu_win(3X) -\fBset_current_item\fR menu_current_item(3X) -\fBset_item_init\fR menu_hook(3X) -\fBset_item_opts\fR mitem_opts(3X) -\fBset_item_term\fR menu_hook(3X) -\fBset_item_userptr\fR mitem_userptr(3X) -\fBset_item_value\fR mitem_value(3X) -\fBset_menu_back\fR menu_attribs(3X) -\fBset_menu_fore\fR menu_attribs(3X) -\fBset_menu_format\fR menu_format(3X) -\fBset_menu_grey\fR menu_attribs(3X) -\fBset_menu_init\fR menu_hook(3X) -\fBset_menu_items\fR menu_items(3X) -\fBset_menu_mark\fR menu_mark(3X) -\fBset_menu_opts\fR mitem_opts(3X) -\fBset_menu_pad\fR menu_attribs(3X) -\fBset_menu_pattern\fR menu_pattern(3X) -\fBset_menu_sub\fR menu_win(3X) -\fBset_menu_term\fR menu_hook(3X) -\fBset_menu_userptr\fR menu_userptr(3X) -\fBset_menu_win\fR menu_win(3X) -\fBset_top_row\fR mitem_current(3X) -\fBtop_row\fR mitem_current(3X) -\fBunpost_menu\fR menu_post(3X) -.fi +.TS +l l . +\fBcurses\fR Routine Name Manual Page Name += +\fBcurrent_item\fR mitem_current(3X) +\fBfree_item\fR mitem_new(3X) +\fBfree_menu\fR menu_new(3X) +\fBitem_count\fR menu_items(3X) +\fBitem_description\fR mitem_name(3X) +\fBitem_index\fR mitem_current(3X) +\fBitem_init\fR menu_hook(3X) +\fBitem_name\fR mitem_name(3X) +\fBitem_opts\fR mitem_opts(3X) +\fBitem_opts_off\fR mitem_opts(3X) +\fBitem_opts_on\fR mitem_opts(3X) +\fBitem_term\fR menu_hook(3X) +\fBitem_userptr\fR mitem_userptr(3X) +\fBitem_value\fR mitem_value(3X) +\fBitem_visible\fR mitem_visible(3X) +\fBmenu_back\fR menu_attribs(3X) +\fBmenu_driver\fR menu_driver(3X) +\fBmenu_fore\fR menu_attribs(3X) +\fBmenu_format\fR menu_format(3X) +\fBmenu_grey\fR menu_attribs(3X) +\fBmenu_init\fR menu_hook(3X) +\fBmenu_items\fR menu_items(3X) +\fBmenu_mark\fR menu_mark(3X) +\fBmenu_opts\fR menu_opts(3X) +\fBmenu_opts_off\fR menu_opts(3X) +\fBmenu_opts_on\fR menu_opts(3X) +\fBmenu_pad\fR menu_attribs(3X) +\fBmenu_pattern\fR menu_pattern(3X) +\fBmenu_request_by_name\fR menu_requestname(3X) +\fBmenu_request_name\fR menu_requestname(3X) +\fBmenu_spacing\fR menu_spacing(3X) +\fBmenu_sub\fR menu_win(3X) +\fBmenu_term\fR menu_hook(3X) +\fBmenu_userptr\fR menu_userptr(3X) +\fBmenu_win\fR menu_win(3X) +\fBnew_item\fR mitem_new(3X) +\fBnew_menu\fR menu_new(3X) +\fBpos_menu_cursor\fR menu_cursor(3X) +\fBpost_menu\fR menu_post(3X) +\fBscale_menu\fR menu_win(3X) +\fBset_current_item\fR menu_current_item(3X) +\fBset_item_init\fR menu_hook(3X) +\fBset_item_opts\fR mitem_opts(3X) +\fBset_item_term\fR menu_hook(3X) +\fBset_item_userptr\fR mitem_userptr(3X) +\fBset_item_value\fR mitem_value(3X) +\fBset_menu_back\fR menu_attribs(3X) +\fBset_menu_fore\fR menu_attribs(3X) +\fBset_menu_format\fR menu_format(3X) +\fBset_menu_grey\fR menu_attribs(3X) +\fBset_menu_init\fR menu_hook(3X) +\fBset_menu_items\fR menu_items(3X) +\fBset_menu_mark\fR menu_mark(3X) +\fBset_menu_opts\fR mitem_opts(3X) +\fBset_menu_pad\fR menu_attribs(3X) +\fBset_menu_pattern\fR menu_pattern(3X) +\fBset_menu_spacing\fR menu_spacing(3X) +\fBset_menu_sub\fR menu_win(3X) +\fBset_menu_term\fR menu_hook(3X) +\fBset_menu_userptr\fR menu_userptr(3X) +\fBset_menu_win\fR menu_win(3X) +\fBset_top_row\fR mitem_current(3X) +\fBtop_row\fR mitem_current(3X) +\fBunpost_menu\fR menu_post(3X) +.TE .SH RETURN VALUE Routines that return pointers return \fBNULL\fR on error. Routines that return an integer return one of the following error codes: @@ -139,8 +145,8 @@ descriptions of the entry points. The header file \fB<menu.h>\fR automatically includes the header files \fB<curses.h>\fR and \fB<eti.h>\fR. -In your library list, libmenu.a should be before libncurses.a; that is, -you want to say `-lmenu -lncurses', not the other way around (which would +In your library list, libmenu.a should be before libcurses.a; that is, +you want to say `-lmenu -lcurses', not the other way around (which would give you a link error using GNU \fBld\fR(1) and many other linkers). .SH PORTABILITY These routines emulate the System V menu library. They were not supported on diff --git a/lib/libmenu/menu.h b/lib/libmenu/menu.h index 31eb96a6c0b..b63c7406f61 100644 --- a/lib/libmenu/menu.h +++ b/lib/libmenu/menu.h @@ -1,29 +1,29 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ #ifndef ETI_MENU #define ETI_MENU #include <curses.h> -#include <term.h> #include <eti.h> #ifdef __cplusplus @@ -46,7 +46,7 @@ typedef int Item_Options; typedef struct { - char* str; + char* str; unsigned short length; } TEXT; @@ -55,7 +55,7 @@ typedef struct tagITEM TEXT name; /* name of menu item */ TEXT description; /* description of item, optional in display */ struct tagMENU *imenu; /* Pointer to parent menu */ - void *userptr; /* Pointer to user defined per item data */ + const void *userptr; /* Pointer to user defined per item data */ Item_Options opt; /* Item options */ short index; /* Item number if connected to a menu */ short y; /* y and x location of item in menu */ @@ -79,10 +79,14 @@ typedef struct tagMENU short cols; /* Nr. of items wide */ short frows; /* Nr. of formatted items high */ short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ short namelen; /* Max. name length */ short desclen; /* Max. description length */ short marklen; /* Length of mark, if any */ short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ char *pattern; /* Buffer to store match chars */ short pindex; /* Index into pattern buffer */ WINDOW *win; /* Window containing menu */ @@ -103,7 +107,7 @@ typedef struct tagMENU Menu_Hook iteminit; Menu_Hook itemterm; - void *userptr; /* Pointer to menus user data */ + const void *userptr; /* Pointer to menus user data */ char *mark; /* Pointer to marker string */ Menu_Options opt; /* Menu options */ @@ -131,19 +135,30 @@ typedef struct tagMENU #define REQ_BACK_PATTERN (KEY_MAX + 15) #define REQ_NEXT_MATCH (KEY_MAX + 16) #define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) #define MAX_MENU_COMMAND (KEY_MAX + 17) /* * Some AT&T code expects MAX_COMMAND to be out-of-band not - * just for meny commands but for forms ones as well. + * just for menu commands but for forms ones as well. */ -#define MAX_COMMAND (KEY_MAX + 128) +#if defined(MAX_COMMAND) +# if (MAX_MENU_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + /* --------- prototypes for libmenu functions ----------------------------- */ extern ITEM **menu_items(const MENU *), *current_item(const MENU *), - *new_item(char *,char *); + *new_item(const char *,const char *); extern MENU *new_menu(ITEM **); @@ -158,14 +173,16 @@ Menu_Hook item_init(const MENU *), extern WINDOW *menu_sub(const MENU *), *menu_win(const MENU *); -extern char *item_description(const ITEM *), - *item_name(const ITEM *), - *menu_mark(const MENU *), - *menu_pattern(const MENU *); +extern const char *item_description(const ITEM *), + *item_name(const ITEM *), + *menu_mark(const MENU *), + *menu_request_name(int); + +extern char *menu_pattern(const MENU *); + +extern const void *menu_userptr(const MENU *), + *item_userptr(const ITEM *); -extern char *item_userptr(const ITEM *), - *menu_userptr(const MENU *); - extern chtype menu_back(const MENU *), menu_fore(const MENU *), menu_grey(const MENU *); @@ -187,7 +204,7 @@ extern int free_item(ITEM *), set_item_init(MENU *,void(*)(MENU *)), set_item_opts(ITEM *,Item_Options), set_item_term(MENU *,void(*)(MENU *)), - set_item_userptr(ITEM *, char *), + set_item_userptr(ITEM *, const void *), set_item_value(ITEM *,bool), set_menu_back(MENU *,chtype), set_menu_fore(MENU *,chtype), @@ -195,17 +212,21 @@ extern int free_item(ITEM *), set_menu_grey(MENU *,chtype), set_menu_init(MENU *,void(*)(MENU *)), set_menu_items(MENU *,ITEM **), - set_menu_mark(MENU *, char *), + set_menu_mark(MENU *, const char *), set_menu_opts(MENU *,Menu_Options), set_menu_pad(MENU *,int), set_menu_pattern(MENU *,const char *), set_menu_sub(MENU *,WINDOW *), set_menu_term(MENU *,void(*)(MENU *)), - set_menu_userptr(MENU *,char *), + set_menu_userptr(MENU *,const void *), set_menu_win(MENU *,WINDOW *), set_top_row(MENU *,int), top_row(const MENU *), - unpost_menu(MENU *); + unpost_menu(MENU *), + menu_request_by_name(const char *), + set_menu_spacing(MENU *,int,int,int), + menu_spacing(const MENU *,int *,int *,int *); + extern bool item_value(const ITEM *), item_visible(const ITEM *); diff --git a/lib/libmenu/menu.priv.h b/lib/libmenu/menu.priv.h index 1086c1bd3a8..e478e0c0ff7 100644 --- a/lib/libmenu/menu.priv.h +++ b/lib/libmenu/menu.priv.h @@ -1,23 +1,24 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /*************************************************************************** * Module menu.priv.h * @@ -46,6 +47,7 @@ extern MENU _nc_Default_Menu; /* menu specific status flags */ #define _LINK_NEEDED (0x04) +#define _MARK_ALLOCATED (0x08) #define ALL_MENU_OPTS ( \ O_ONEVALUE | \ @@ -59,7 +61,7 @@ extern MENU _nc_Default_Menu; /* Move to the window position of an item and draw it */ #define Move_And_Post_Item(menu,item) \ - {wmove((menu)->win,(item)->y,((menu)->itemlen+1)*(item)->x);\ + {wmove((menu)->win,(menu)->spc_rows*(item)->y,((menu)->itemlen+(menu)->spc_cols)*(item)->x);\ _nc_Post_Item((menu),(item));} #define Move_To_Current_Item(menu,item) \ @@ -76,9 +78,9 @@ extern MENU _nc_Default_Menu; #define Adjust_Current_Item(menu,row,item) \ { if ((item)->y < row) \ row = (item)->y;\ - if ( (item)->y >= (row + (menu)->height) )\ + if ( (item)->y >= (row + (menu)->arows) )\ row = ( (item)->y < ((menu)->rows - row) ) ? \ - (item)->y : (menu)->rows - (menu)->height;\ + (item)->y : (menu)->rows - (menu)->arows;\ _nc_New_TopRow_and_CurrentItem(menu,row,item); } /* Reset the match pattern buffer */ diff --git a/lib/libmenu/menu_attribs.3 b/lib/libmenu/menu_attribs.3 index ebd5563d219..39850c1e2a6 100644 --- a/lib/libmenu/menu_attribs.3 +++ b/lib/libmenu/menu_attribs.3 @@ -7,19 +7,19 @@ .br int set_menu_fore(MENU *menu, chtype attr); .br -chtype menu_fore(MENU *menu); +chtype menu_fore(const MENU *menu); .br int set_menu_back(MENU *menu, chtype attr); .br -chtype menu_back(MENU *menu); +chtype menu_back(const MENU *menu); .br int set_menu_grey(MENU *menu, chtype attr); .br -chtype menu_grey(MENU *menu); +chtype menu_grey(const MENU *menu); .br int set_menu_pad(MENU *menu, int pad); .br -chtype menu_pad(MENU *menu); +int menu_pad(const MENU *menu); .br .SH DESCRIPTION The function \fBset_menu_fore\fR sets the foreground attribute of diff --git a/lib/libmenu/menu_cursor.3 b/lib/libmenu/menu_cursor.3 index 882fe52a299..d2e5e2a3e8b 100644 --- a/lib/libmenu/menu_cursor.3 +++ b/lib/libmenu/menu_cursor.3 @@ -5,7 +5,7 @@ .SH SYNOPSIS \fB#include <menu.h>\fR .br -int pos_menu_cursor(MENU *menu); +int pos_menu_cursor(const MENU *menu); .br .SH DESCRIPTION The function \fBpos_menu_cursor\fR restores the cursor to the current position diff --git a/lib/libmenu/menu_driver.3 b/lib/libmenu/menu_driver.3 index dc571056c73..d64853563a2 100644 --- a/lib/libmenu/menu_driver.3 +++ b/lib/libmenu/menu_driver.3 @@ -73,7 +73,7 @@ If the second argument is one of the above pre-defined requests, the corresponding action is performed. .PP If the second argument is neither printable ASCII nor one of the above -pre-defined menu requests, the drive asumes it is an application-specific +pre-defined menu requests, the drive assumes it is an application-specific command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these pre-defined requests. diff --git a/lib/libmenu/menu_format.3 b/lib/libmenu/menu_format.3 index 04ac9edcf1d..a901a065192 100644 --- a/lib/libmenu/menu_format.3 +++ b/lib/libmenu/menu_format.3 @@ -7,7 +7,7 @@ .br int set_menu_format(MENU *menu, int rows, int cols); .br -int menu_format(MENU *menu, int *rows, int *cols); +int menu_format(const MENU *menu, int *rows, int *cols); .br .SH DESCRIPTION The function \fBset_menu_format\fR sets the maximum display size of the given @@ -19,7 +19,7 @@ null menu pointer will change this default. A zero row or column argument to \fBset_menu_format\fR is interpreted as a request not to change the current value. -The function \fBget_menu_format\fR returns the maximum-size constraints for the +The function \fBmenu_format\fR returns the maximum-size constraints for the given menu into the storage addressed by \fBrows\fR and \fBcols\fR. .SH RETURN VALUE These routines returns one of the following: diff --git a/lib/libmenu/menu_hook.3 b/lib/libmenu/menu_hook.3 index 85d1dea6931..36adef9f7aa 100644 --- a/lib/libmenu/menu_hook.3 +++ b/lib/libmenu/menu_hook.3 @@ -7,19 +7,19 @@ .br int set_item_init(MENU *menu, void (*func)(MENU *)); .br -void (*)(MENU *) item_init(MWNU *menu); +void (*)(MENU *) item_init(const MENU *menu); .br int set_item_term(MENU *menu, void (*func)(MENU *)); .br -void (*)(MENU *) item_term(MWNU *menu); +void (*)(MENU *) item_term(const MENU *menu); .br int set_menu_init(MENU *menu, void (*func)(MENU *)); .br -void (*)(MENU *) menu_init(MWNU *menu); +void (*)(MENU *) menu_init(const MENU *menu); .br int set_menu_term(MENU *menu, void (*func)(MENU *)); .br -void (*)(MENU *) menu_term(MWNU *menu); +void (*)(MENU *) menu_term(const MENU *menu); .br .SH DESCRIPTION These functions make it possible to set hook functions to be called at various diff --git a/lib/libmenu/menu_items.3 b/lib/libmenu/menu_items.3 index 4545ccce538..888ae819311 100644 --- a/lib/libmenu/menu_items.3 +++ b/lib/libmenu/menu_items.3 @@ -7,9 +7,9 @@ .br int set_menu_items(MENU *menu, ITEM **items); .br -ITEM **menu_items(MENU *menu); +ITEM **menu_items(const MENU *menu); .br -int item_count(MENU *menu); +int item_count(const MENU *menu); .br .SH DESCRIPTION The function \fBset_menu_items\fR changes the item pointer array of the given diff --git a/lib/libmenu/menu_mark.3 b/lib/libmenu/menu_mark.3 index 61fef90afd5..62f6d39c45c 100644 --- a/lib/libmenu/menu_mark.3 +++ b/lib/libmenu/menu_mark.3 @@ -5,9 +5,9 @@ .SH SYNOPSIS \fB#include <menu.h>\fR .br -int set_menu_mark(MENU *menu, char *mark); +int set_menu_mark(MENU *menu, const char *mark); .br -char *menu_mark(MENU *menu); +const char *menu_mark(const MENU *menu); .br .SH DESCRIPTION In order to make menu selections visible on older terminals without @@ -19,14 +19,14 @@ Calling \fBset_menu_mark\fR with a null menu item will abolish the mark string. Note that changing the length of the mark string for a menu while the menu is posted is likely to produce unhelpful behavior. -The default string is "-" (a dash). Calling \fBset_menu_mark\fR wiith +The default string is "-" (a dash). Calling \fBset_menu_mark\fR with a \fBNULL\fR menu argument will change this default. The function \fBmenu_mark\fR returns the menu's mark string (or \fBNULL\fR if there is none). .SH RETURN VALUE The function \fBmenu_mark\fR returns \fBNULL\fR on error. The function -\fBset_menu_mark\fR maty return the following error codes: +\fBset_menu_mark\fR may return the following error codes: .TP 5 \fBE_OK\fR The routine succeeded. diff --git a/lib/libmenu/menu_new.3 b/lib/libmenu/menu_new.3 index b7585dc0b40..9053fdd5579 100644 --- a/lib/libmenu/menu_new.3 +++ b/lib/libmenu/menu_new.3 @@ -7,13 +7,13 @@ .br MENU *new_menu(ITEM **items); .br -char *free_menu(MENU *menu); +int free_menu(MENU *menu); .br .SH DESCRIPTION The function \fBnew_menu\fR creates a new menu connected to a specified item pointer array (which must be \fBNULL\fR-terminated). -The function \fBfree_menu\fR discomnnects \fImenu\fR from its item array +The function \fBfree_menu\fR disconnects \fImenu\fR from its item array and frees the storage allocated for the menu. .SH RETURN VALUE The function \fBnew_menu\fR returns \fBNULL\fR on error. diff --git a/lib/libmenu/menu_opts.3 b/lib/libmenu/menu_opts.3 index b307936fb74..f5b67b19d90 100644 --- a/lib/libmenu/menu_opts.3 +++ b/lib/libmenu/menu_opts.3 @@ -11,11 +11,11 @@ int menu_opts_on(MENU *menu, OPTIONS opts); .br int menu_opts_off(MENU *menu, OPTIONS opts); .br -OPTIONS menu_opts(MENU *menu); +OPTIONS menu_opts(const MENU *menu); .br .SH DESCRIPTION The function \fBset_menu_opts\fR sets all the given menu's option bits (menu -option bits may be logically-ored together). +option bits may be logically-OR'ed together). The function \fBmenu_opts_on\fR turns on the given option bits, and leaves others alone. diff --git a/lib/libmenu/menu_pattern.3 b/lib/libmenu/menu_pattern.3 index 233ba35e0a8..30bc52793d1 100644 --- a/lib/libmenu/menu_pattern.3 +++ b/lib/libmenu/menu_pattern.3 @@ -5,14 +5,14 @@ .SH SYNOPSIS \fB#include <menu.h>\fR .br -int set_menu_pattern(MENU *menu, char *pattern); +int set_menu_pattern(MENU *menu, const char *pattern); .br -char *menu_pattern(MENU *menu); +char *menu_pattern(const MENU *menu); .br .SH DESCRIPTION Every menu has an associated pattern match buffer. As input events that are printable ASCII characters come in, they are appended to this match buffer -and tested for a match, as decribed in \fBmenu_driver\fR(3x). +and tested for a match, as described in \fBmenu_driver\fR(3x). The function \fBset_menu_pattern\fR sets the pattern buffer for the given menu and tries to find the first matching item. If it succeeds, that item becomes @@ -22,7 +22,7 @@ The function \fBmenu_pattern\fR returns the pattern buffer of the given \fImenu\fR. .SH RETURN VALUE The function \fBmenu_pattern\fR returns \fBNULL\fR on error. The function -\fBset_menu_pattern\fR maty return the following error codes: +\fBset_menu_pattern\fR may return the following error codes: .TP 5 \fBE_OK\fR The routine succeeded. diff --git a/lib/libmenu/menu_post.3 b/lib/libmenu/menu_post.3 index 21e39aa5dd9..0cf8dfd30a8 100644 --- a/lib/libmenu/menu_post.3 +++ b/lib/libmenu/menu_post.3 @@ -13,7 +13,7 @@ int unpost_menu(MENU *menu); The function \fBpost_menu\fR displays a menu to its associated subwindow. To trigger physical display of the subwindow, use \fBrefresh\fR or some equivalent \fBcurses\fR routine (the implicit \fBdoupdate\fR triggered by an \fBcurses\fR -input request will do). +input request will do). \fBpost_menu\fR resets the selection status of all items. The function \fBunpost_menu\fR erases menu from its associated subwindow. .SH RETURN VALUE diff --git a/lib/libmenu/menu_requestname.3 b/lib/libmenu/menu_requestname.3 new file mode 100644 index 00000000000..9ae823e32c6 --- /dev/null +++ b/lib/libmenu/menu_requestname.3 @@ -0,0 +1,40 @@ +'\" t +.TH menu_requestname 3X "" +.SH NAME +\fBmenu_requestname\fR - handle printable menu request names +.SH SYNOPSIS +\fB#include <menu.h>\fR +.br +const char *menu_request_name(int request); +.br +int menu_request_by_name(const char *name); +.br +.SH DESCRIPTION +The function \fBmenu_request_name\fR returns the printable name of a menu +request code. +.br +The function \fBmenu_request_by_name\fR searches in the name-table for a request +with the given name and returns its request code. Otherwise E_NO_MATCH is returned. +.SH RETURN VALUE +\fBmenu_request_name\fR returns \fBNULL\fR on error and sets errno +to \fBE_BAD_ARGUMENT\fR. +.br +\fBmenu_request_by_name\fR returns \fBE_NO_MATCH\fR on error. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB<menu.h>\fR automatically includes the header file +\fB<curses.h>\fR. +.SH PORTABILITY +These routines are specific to ncurses. They were not supported on +Version 7, BSD or System V implementations. It is recommended that +any code depending on them be conditioned using NCURSES_VERSION. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/lib/libmenu/menu_spacing.3 b/lib/libmenu/menu_spacing.3 new file mode 100644 index 00000000000..ece226321c1 --- /dev/null +++ b/lib/libmenu/menu_spacing.3 @@ -0,0 +1,55 @@ +'\" t +.TH menu_spacing 3X "" +.SH NAME +\fBmenu_spacing\fR - Control spacing between menu items. +.SH SYNOPSIS +\fB#include <menu.h>\fR +.br +int set_menu_spacing(MENU *menu, + int spc_description + int spc_rows, + int spc_columns); +.br +int menu_spacing(const MENU *menu, + int* spc_description + int* spc_rows, + int* spc_columns); +.br +.SH DESCRIPTION +The function \fBset_menu_spacing\fR sets the spacing informations for the menu. +\fBspc_description\fR controls the number of spaces between an item name and an item +description. It must not be larger than \fBTABSIZE\fR. The menu system puts in the +middle of this spacing area the pad character. The remaining parts are filled with +spaces. +\fBspc_rows\fR controls the number of rows that are used for an item. It must not be +larger than 3. The menu system inserts then blank lines between item rows, these lines +will contain the pad character in the appropriate positions. +\fBspc_columns\fR controls the number of blanks between columns of items. It must not +be larger than TABSIZE. +A value of 0 for all the spacing values resets them to the default, which is 1 for all +of them. +.br +The function \fBmenu_spacing\fR passes back the spacing info for the menu. If a +pointer is NULL, this specific info is simply not returned. +.SH RETURN VALUE +Both routines return \fBE_OK\fR on success. \fBset_menu_spacing\fR may return +\fBE_POSTED\fR if the menu is posted, or \fBE_BAD_ARGUMENT\fR if one of the +spacing values is out of range. +.SH SEE ALSO +\fBcurses\fR(3X), \fBmenu\fR(3X). +.SH NOTES +The header file \fB<menu.h>\fR automatically includes the header file +\fB<curses.h>\fR. +.SH PORTABILITY +These routines are specific to ncurses. They were not supported on +Version 7, BSD or System V implementations. It is recommended that +any code depending on them be conditioned using NCURSES_VERSION. +.SH AUTHORS +Juergen Pfeifer. Manual pages and adaptation for new curses by Eric +S. Raymond. +.\"# +.\"# The following sets edit modes for GNU EMACS +.\"# Local Variables: +.\"# mode:nroff +.\"# fill-column:79 +.\"# End: diff --git a/lib/libmenu/menu_userptr.3 b/lib/libmenu/menu_userptr.3 index fab891f7869..30afd616864 100644 --- a/lib/libmenu/menu_userptr.3 +++ b/lib/libmenu/menu_userptr.3 @@ -5,9 +5,9 @@ .SH SYNOPSIS \fB#include <menu.h>\fR .br -int set_menu_userptr(MENU *menu, char *userptr); +int set_menu_userptr(MENU *menu, const void *userptr); .br -char menu_userptr(MENU *menu); +const void *menu_userptr(const MENU *menu); .br .SH DESCRIPTION Every menu and every menu item has a field that can be used to hold diff --git a/lib/libmenu/menu_win.3 b/lib/libmenu/menu_win.3 index 5f492124ca9..9ed9b4eb2ea 100644 --- a/lib/libmenu/menu_win.3 +++ b/lib/libmenu/menu_win.3 @@ -5,15 +5,15 @@ .SH SYNOPSIS \fB#include <menu.h>\fR .br -int set_menu_window(MENU *menu, WINDOW *win); +int set_menu_win(MENU *menu, WINDOW *win); .br -WINDOW *menu_window(MENU *menu); +WINDOW *menu_win(const MENU *menu); .br int set_menu_sub(MENU *menu, WINDOW *sub); .br -WINDOW *menu_sub(MENU *menu); +WINDOW *menu_sub(const MENU *menu); .br -int scale_window(MENU *menu, int *rows, int *columns); +int scale_menu(const MENU *menu, int *rows, int *columns); .br .SH DESCRIPTION Every menu has an associated pair of \fBcurses\fR windows. The menu window @@ -23,11 +23,11 @@ displays the items of the menu that are currently available for selection. The first four functions get and set those windows. It is not necessary to set either window; by default, the driver code uses \fBstdscr\fR for both. -In the \fBset_\fR functions, window argument of \fBNULL\fR is treated as tbough +In the \fBset_\fR functions, window argument of \fBNULL\fR is treated as though it were \fBstsdcr\fR. A menu argument of \fBNULL\fR is treated as a request to change the system default menu window or subwindow. -The function \fBscale_window\fR returns the minimum size required for the +The function \fBscale_menu\fR returns the minimum size required for the subwindow of \fImenu\fR. .SH RETURN VALUE Routines that return pointers return \fBNULL\fR on error. Routines that return diff --git a/lib/libmenu/mf_common.h b/lib/libmenu/mf_common.h index 518c3f49e10..1e0b3caf6bf 100644 --- a/lib/libmenu/mf_common.h +++ b/lib/libmenu/mf_common.h @@ -1,31 +1,33 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/*-----------------------------------------------------------------------------+ +| The ncurses menu library is Copyright (C) 1995-1997 | +| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | +| All Rights Reserved. | +| | +| Permission to use, copy, modify, and distribute this software and its | +| documentation for any purpose and without fee is hereby granted, provided | +| that the above copyright notice appear in all copies and that both that | +| copyright notice and this permission notice appear in supporting | +| documentation, and that the name of the above listed copyright holder(s) not | +| be used in advertising or publicity pertaining to distribution of the | +| software without specific, written prior permission. | +| | +| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | +| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | +| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | +| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | +| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | +| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | +| THE USE OR PERFORMANCE OF THIS SOFTWARE. | ++-----------------------------------------------------------------------------*/ /* Common internal header for menu and form library */ #if HAVE_CONFIG_H -# include <config.h> +# include <ncurses_cfg.h> #endif #include <stdlib.h> +#include <sys/types.h> #include <assert.h> #include <string.h> #include <ctype.h> @@ -45,6 +47,15 @@ extern int errno; # endif #endif +#include <nc_alloc.h> + +#ifdef USE_RCS_IDS +#define MODULE_ID(id) static const char Ident[] = id; +#else +#define MODULE_ID(id) /*nothing*/ +#endif + + /* Maximum regular 8-bit character code */ #define MAX_REGULAR_CHARACTER (0xff) @@ -64,4 +75,11 @@ extern int errno; (object)->status &= ~_IN_DRIVER;\ } -#define INLINE __inline +#define INLINE + +#ifndef TRACE +# if CC_HAS_INLINE_FUNCS +# undef INLINE +# define INLINE inline +# endif +#endif diff --git a/lib/libmenu/shlib_version b/lib/libmenu/shlib_version index 97c9f92d6b8..1edea46de91 100644 --- a/lib/libmenu/shlib_version +++ b/lib/libmenu/shlib_version @@ -1,2 +1,2 @@ -major=0 +major=1 minor=0 |