X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=menu%2Fm_global.c;h=2e5211468a86e80f420f0c8c26f23fc296a3452d;hp=7b4517f3660905a51d07b754ee95f6b260037241;hb=61790aa3ac9e0dff2b443ac567b174fc4d235b86;hpb=c55d387cebf1cee4757ca2c2ef4fbeae59ee4175 diff --git a/menu/m_global.c b/menu/m_global.c index 7b4517f3..2e521146 100644 --- a/menu/m_global.c +++ b/menu/m_global.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2014,2020 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,11 +38,11 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.29 2020/01/18 17:05:17 tom Exp $") +MODULE_ID("$Id: m_global.c,v 1.32 2020/12/12 00:38:02 tom Exp $") static char mark[] = "-"; /* *INDENT-OFF* */ -NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = { +MENU_EXPORT_VAR(MENU) _nc_Default_Menu = { 16, /* Nr. of chars high */ 1, /* Nr. of chars wide */ 16, /* Nr. of items high */ @@ -80,7 +81,7 @@ NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = { 0 /* status */ }; -NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = { +MENU_EXPORT_VAR(ITEM) _nc_Default_Item = { { (char *)0, 0 }, /* name */ { (char *)0, 0 }, /* description */ (MENU *)0, /* Pointer to parent menu */ @@ -107,7 +108,7 @@ NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = { | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_INLINE static void -ComputeMaximum_NameDesc_Lengths(MENU * menu) +ComputeMaximum_NameDesc_Lengths(MENU *menu) { unsigned MaximumNameLength = 0; unsigned MaximumDescriptionLength = 0; @@ -141,7 +142,7 @@ ComputeMaximum_NameDesc_Lengths(MENU * menu) | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_INLINE static void -ResetConnectionInfo(MENU * menu, ITEM ** items) +ResetConnectionInfo(MENU *menu, ITEM **items) { ITEM **item; @@ -149,13 +150,13 @@ ResetConnectionInfo(MENU * menu, ITEM ** items) for (item = items; *item; item++) { (*item)->index = 0; - (*item)->imenu = (MENU *) 0; + (*item)->imenu = (MENU *)0; } if (menu->pattern) free(menu->pattern); menu->pattern = (char *)0; menu->pindex = 0; - menu->items = (ITEM **) 0; + menu->items = (ITEM **)0; menu->nitems = 0; } @@ -170,8 +171,8 @@ ResetConnectionInfo(MENU * menu, ITEM ** items) | Return Values : TRUE - successful connection | FALSE - connection failed +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(bool) -_nc_Connect_Items(MENU * menu, ITEM ** items) +MENU_EXPORT(bool) +_nc_Connect_Items(MENU *menu, ITEM **items) { ITEM **item; unsigned int ItemCount = 0; @@ -232,8 +233,8 @@ _nc_Connect_Items(MENU * menu, ITEM ** items) | | Return Values : - +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(void) -_nc_Disconnect_Items(MENU * menu) +MENU_EXPORT(void) +_nc_Disconnect_Items(MENU *menu) { if (menu && menu->items) ResetConnectionInfo(menu, menu->items); @@ -247,8 +248,8 @@ _nc_Disconnect_Items(MENU * menu) | | Return Values : the width +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(int) -_nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ ) +MENU_EXPORT(int) +_nc_Calculate_Text_Width(const TEXT *item /*FIXME: limit length */ ) { #if USE_WIDEC_SUPPORT int result = item->length; @@ -288,7 +289,7 @@ _nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ ) */ #if USE_WIDEC_SUPPORT static int -calculate_actual_width(MENU * menu, bool name) +calculate_actual_width(MENU *menu, bool name) { int width = 0; int check = 0; @@ -336,8 +337,8 @@ calculate_actual_width(MENU * menu, bool name) | | Return Values : - +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(void) -_nc_Calculate_Item_Length_and_Width(MENU * menu) +MENU_EXPORT(void) +_nc_Calculate_Item_Length_and_Width(MENU *menu) { int l; @@ -375,8 +376,8 @@ _nc_Calculate_Item_Length_and_Width(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(void) -_nc_Link_Items(MENU * menu) +MENU_EXPORT(void) +_nc_Link_Items(MENU *menu) { if (menu && menu->items && *(menu->items)) { @@ -407,14 +408,14 @@ _nc_Link_Items(MENU * menu) (cycle ? menu->items[(Last_in_Row >= Number_Of_Items) ? Number_Of_Items - 1 : Last_in_Row] : - (ITEM *) 0); + (ITEM *)0); item->right = ((col < (Number_Of_Columns - 1)) && ((i + 1) < Number_Of_Items) )? menu->items[i + 1] : (cycle ? menu->items[row * Number_Of_Columns] : - (ITEM *) 0 + (ITEM *)0 ); Last_in_Column = (menu->rows - 1) * Number_Of_Columns + col; @@ -423,14 +424,14 @@ _nc_Link_Items(MENU * menu) (cycle ? menu->items[(Last_in_Column >= Number_Of_Items) ? Number_Of_Items - 1 : Last_in_Column] : - (ITEM *) 0); + (ITEM *)0); item->down = ((i + Number_Of_Columns) < Number_Of_Items) ? menu->items[i + Number_Of_Columns] : (cycle ? menu->items[(row + 1) < menu->rows ? Number_Of_Items - 1 : col] : - (ITEM *) 0); + (ITEM *)0); item->x = (short)col; item->y = (short)row; if (++col == Number_Of_Columns) @@ -455,12 +456,12 @@ _nc_Link_Items(MENU * menu) (cycle ? (Last_in_Column >= Number_Of_Items) ? menu->items[Last_in_Column - Number_Of_Rows] : menu->items[Last_in_Column] : - (ITEM *) 0); + (ITEM *)0); item->right = ((i + Number_Of_Rows) < Number_Of_Items) ? menu->items[i + Number_Of_Rows] : - (cycle ? menu->items[row] : (ITEM *) 0); + (cycle ? menu->items[row] : (ITEM *)0); Last_in_Row = col * Number_Of_Rows + (Number_Of_Rows - 1); @@ -470,7 +471,7 @@ _nc_Link_Items(MENU * menu) menu->items[(Last_in_Row >= Number_Of_Items) ? Number_Of_Items - 1 : Last_in_Row] : - (ITEM *) 0); + (ITEM *)0); item->down = (row < (Number_Of_Rows - 1)) ? @@ -479,7 +480,7 @@ _nc_Link_Items(MENU * menu) (col - 1) * Number_Of_Rows + row + 1]) : (cycle ? menu->items[col * Number_Of_Rows] : - (ITEM *) 0 + (ITEM *)0 ); item->x = (short)col; @@ -502,8 +503,8 @@ _nc_Link_Items(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(void) -_nc_Show_Menu(const MENU * menu) +MENU_EXPORT(void) +_nc_Show_Menu(const MENU *menu) { WINDOW *win; int maxy, maxx; @@ -542,11 +543,11 @@ _nc_Show_Menu(const MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(void) +MENU_EXPORT(void) _nc_New_TopRow_and_CurrentItem( - MENU * menu, + MENU *menu, int new_toprow, - ITEM * new_current_item) + ITEM *new_current_item) { ITEM *cur_item; bool mterm_called = FALSE;