diff options
Diffstat (limited to 'menu')
-rw-r--r-- | menu/m_format.c | 4 | ||||
-rw-r--r-- | menu/m_global.c | 36 | ||||
-rw-r--r-- | menu/m_item_new.c | 4 | ||||
-rw-r--r-- | menu/m_post.c | 6 | ||||
-rw-r--r-- | menu/mf_common.h | 9 |
5 files changed, 31 insertions, 28 deletions
diff --git a/menu/m_format.c b/menu/m_format.c index e13ddc5..2d681a6 100644 --- a/menu/m_format.c +++ b/menu/m_format.c @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_format.c,v 1.17 2012/03/10 23:43:41 tom Exp $") +MODULE_ID("$Id: m_format.c,v 1.18 2012/06/09 23:54:02 tom Exp $") #define minimum(a,b) ((a)<(b) ? (a): (b)) @@ -96,7 +96,7 @@ set_menu_format(MENU * menu, int rows, int cols) menu->toprow = 0; menu->curitem = *(menu->items); assert(menu->curitem); - menu->status |= _LINK_NEEDED; + SetStatus(menu, _LINK_NEEDED); _nc_Calculate_Item_Length_and_Width(menu); } else diff --git a/menu/m_global.c b/menu/m_global.c index dbd5865..d85f207 100644 --- a/menu/m_global.c +++ b/menu/m_global.c @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.26 2012/03/10 23:43:41 tom Exp $") +MODULE_ID("$Id: m_global.c,v 1.27 2012/06/10 00:09:15 tom Exp $") static char mark[] = "-"; /* *INDENT-OFF* */ @@ -117,17 +117,17 @@ ComputeMaximum_NameDesc_Lengths(MENU * menu) assert(menu && menu->items); for (items = menu->items; *items; items++) { - check = (unsigned) _nc_Calculate_Text_Width(&((*items)->name)); + check = (unsigned)_nc_Calculate_Text_Width(&((*items)->name)); if (check > MaximumNameLength) MaximumNameLength = check; - check = (unsigned) _nc_Calculate_Text_Width(&((*items)->description)); + check = (unsigned)_nc_Calculate_Text_Width(&((*items)->description)); if (check > MaximumDescriptionLength) MaximumDescriptionLength = check; } - menu->namelen = (short) MaximumNameLength; - menu->desclen = (short) MaximumDescriptionLength; + menu->namelen = (short)MaximumNameLength; + menu->desclen = (short)MaximumDescriptionLength; T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen)); } @@ -195,7 +195,7 @@ _nc_Connect_Items(MENU * menu, ITEM ** items) { (*item)->value = FALSE; } - (*item)->index = (short) ItemCount++; + (*item)->index = (short)ItemCount++; (*item)->imenu = menu; } } @@ -206,7 +206,7 @@ _nc_Connect_Items(MENU * menu, ITEM ** items) if (ItemCount != 0) { menu->items = items; - menu->nitems = (short) ItemCount; + menu->nitems = (short)ItemCount; ComputeMaximum_NameDesc_Lengths(menu); if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen)))) { @@ -256,7 +256,7 @@ _nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ ) T((T_CALLED("_nc_menu_text_width(%p)"), (const void *)item)); if (result != 0 && item->str != 0) { - int count = (int) mbstowcs(0, item->str, 0); + int count = (int)mbstowcs(0, item->str, 0); wchar_t *temp = 0; if (count > 0 @@ -343,7 +343,7 @@ _nc_Calculate_Item_Length_and_Width(MENU * menu) assert(menu); - menu->height = (short) (1 + menu->spc_rows * (menu->arows - 1)); + menu->height = (short)(1 + menu->spc_rows * (menu->arows - 1)); l = calculate_actual_width(menu, TRUE); l += menu->marklen; @@ -354,10 +354,10 @@ _nc_Calculate_Item_Length_and_Width(MENU * menu) l += menu->spc_desc; } - menu->itemlen = (short) l; + menu->itemlen = (short)l; l *= menu->cols; l += (menu->cols - 1) * menu->spc_cols; /* for the padding between the columns */ - menu->width = (short) l; + menu->width = (short)l; T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d", menu->cols, @@ -388,7 +388,7 @@ _nc_Link_Items(MENU * menu) int Last_in_Column; bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE; - menu->status &= (unsigned short) (~_LINK_NEEDED); + ClrStatus(menu, _LINK_NEEDED); if (menu->opt & O_ROWMAJOR) { @@ -431,8 +431,8 @@ _nc_Link_Items(MENU * menu) (cycle ? menu->items[(row + 1) < menu->rows ? Number_Of_Items - 1 : col] : (ITEM *) 0); - item->x = (short) col; - item->y = (short) row; + item->x = (short)col; + item->y = (short)row; if (++col == Number_Of_Columns) { row++; @@ -482,8 +482,8 @@ _nc_Link_Items(MENU * menu) (ITEM *) 0 ); - item->x = (short) col; - item->y = (short) row; + item->x = (short)col; + item->y = (short)row; if ((++row) == Number_Of_Rows) { col++; @@ -568,7 +568,7 @@ _nc_New_TopRow_and_CurrentItem( cur_item = menu->curitem; assert(cur_item); - menu->toprow = (short) new_toprow; + menu->toprow = (short)new_toprow; menu->curitem = new_current_item; if (mterm_called) @@ -590,7 +590,7 @@ _nc_New_TopRow_and_CurrentItem( } else { /* if we are not posted, this is quite simple */ - menu->toprow = (short) new_toprow; + menu->toprow = (short)new_toprow; menu->curitem = new_current_item; } } diff --git a/menu/m_item_new.c b/menu/m_item_new.c index 7f5daa9..710ef09 100644 --- a/menu/m_item_new.c +++ b/menu/m_item_new.c @@ -44,7 +44,7 @@ #endif #endif -MODULE_ID("$Id: m_item_new.c,v 1.32 2012/03/10 23:41:36 tom Exp $") +MODULE_ID("$Id: m_item_new.c,v 1.33 2012/06/09 23:55:15 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -223,7 +223,7 @@ set_menu_mark(MENU * menu, const char *mark) if (menu->mark) { if (menu != &_nc_Default_Menu) - menu->status |= _MARK_ALLOCATED; + SetStatus(menu, _MARK_ALLOCATED); } else { diff --git a/menu/m_post.c b/menu/m_post.c index bfe6ebb..a26ba49 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.30 2012/03/10 23:43:41 tom Exp $") +MODULE_ID("$Id: m_post.c,v 1.31 2012/06/09 23:54:35 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -305,7 +305,7 @@ post_menu(MENU * menu) else RETURN(E_NOT_CONNECTED); - menu->status |= _POSTED; + SetStatus(menu, _POSTED); if (!(menu->opt & O_ONEVALUE)) { @@ -369,7 +369,7 @@ unpost_menu(MENU * menu) delwin(menu->win); menu->win = (WINDOW *)0; - menu->status &= (unsigned short)(~_POSTED); + ClrStatus(menu, _POSTED); RETURN(E_OK); } diff --git a/menu/mf_common.h b/menu/mf_common.h index 115d6a8..cff6563 100644 --- a/menu/mf_common.h +++ b/menu/mf_common.h @@ -30,7 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: mf_common.h,v 0.23 2012/03/10 23:43:41 tom Exp $ */ +/* $Id: mf_common.h,v 0.24 2012/06/10 00:06:54 tom Exp $ */ /* Common internal header for menu and form library */ @@ -82,13 +82,16 @@ extern int errno; #define _POSTED (0x01U) /* menu or form is posted */ #define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */ +#define SetStatus(target,mask) (target)->status |= (unsigned short) (mask) +#define ClrStatus(target,mask) (target)->status = (unsigned short) (target->status & (~mask)) + /* Call object hook */ #define Call_Hook( object, handler ) \ if ( (object) != 0 && ((object)->handler) != (void *) 0 )\ {\ - (object)->status |= (unsigned short) (_IN_DRIVER);\ + SetStatus(object, _IN_DRIVER);\ (object)->handler(object);\ - (object)->status &= (unsigned short) (~_IN_DRIVER);\ + ClrStatus(object, _IN_DRIVER);\ } #endif /* MF_COMMON_H_incl */ |