/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2006 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 *
#include "form.priv.h"
-MODULE_ID("$Id: frm_driver.c,v 1.71 2005/10/01 19:42:40 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.76 2006/11/04 18:45:35 tom Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
|
| Return Values : Pointer to first non-blank position in buffer
+--------------------------------------------------------------------------*/
-INLINE static FIELD_CELL *
+NCURSES_INLINE static FIELD_CELL *
Get_Start_Of_Data(FIELD_CELL *buf, int blen)
{
FIELD_CELL *p = buf;
| Return Values : Pointer to position after last non-blank position in
| buffer.
+--------------------------------------------------------------------------*/
-INLINE static FIELD_CELL *
+NCURSES_INLINE static FIELD_CELL *
After_End_Of_Data(FIELD_CELL *buf, int blen)
{
FIELD_CELL *p = &buf[blen];
|
| Return Values : Pointer to first whitespace character in buffer.
+--------------------------------------------------------------------------*/
-INLINE static FIELD_CELL *
+NCURSES_INLINE static FIELD_CELL *
Get_First_Whitespace_Character(FIELD_CELL *buf, int blen)
{
FIELD_CELL *p = buf;
| Return Values : Pointer to position after last whitespace character in
| buffer.
+--------------------------------------------------------------------------*/
-INLINE static FIELD_CELL *
+NCURSES_INLINE static FIELD_CELL *
After_Last_Whitespace_Character(FIELD_CELL *buf, int blen)
{
FIELD_CELL *p = &buf[blen];
|
| Return Values : -
+--------------------------------------------------------------------------*/
-INLINE static void
+NCURSES_INLINE static void
Adjust_Cursor_Position(FORM *form, const FIELD_CELL *pos)
{
FIELD *field;
#if USE_WIDEC_SUPPORT
&& p->chars[1] == 0
#endif
- && AttrOf(*p) == ChAttrOf(pad))
+ )
*p = myBLANK;
}
}
|
| Return Values : -
+--------------------------------------------------------------------------*/
-INLINE static void
+NCURSES_INLINE static void
Synchronize_Buffer(FORM *form)
{
if (form->status & _WINDOW_MODIFIED)
if (field->opts & O_VISIBLE)
Set_Field_Window_Attributes(field, win);
else
- wattrset(win, getattrs(fwin));
+ wattrset(win, WINDOW_ATTRS(fwin));
werase(win);
}
|
| Return Values : E_OK - success
| E_BAD_ARGUMENT - invalid field pointer
+| E_CURRENT - field is the current one
| E_SYSTEM_ERROR - some severe basic error
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
|
| Description : Make the newfield the new current field.
|
-| Return Values : E_OK - success
-| E_BAD_ARGUMENT - invalid form or field pointer
-| E_SYSTEM_ERROR - some severe basic error
+| Return Values : E_OK - success
+| E_BAD_ARGUMENT - invalid form or field pointer
+| E_SYSTEM_ERROR - some severe basic error
+| E_NOT_CONNECTED - no fields are connected to the form
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
_nc_Set_Current_Field(FORM *form, FIELD *newfield)
| Return Values : TRUE - there is enough space
| FALSE - there is not enough space
+--------------------------------------------------------------------------*/
-INLINE static bool
+NCURSES_INLINE static bool
Is_There_Room_For_A_Line(FORM *form)
{
FIELD *field = form->current;
| Return Values : TRUE - there is room
| FALSE - there is not enough room (line full)
+--------------------------------------------------------------------------*/
-INLINE static bool
+NCURSES_INLINE static bool
Is_There_Room_For_A_Char_In_Line(FORM *form)
{
int last_char_in_line;
* automatically (given the proper options). But we cannot eat the
* keystroke to back over the wrapping point, since that would put the
* cursor past the end of the form field. In this case, just delete the
- * character at the end of the field.
+ * character at the end of the field.
*/
if (form->currow == this_row && this_row > 0)
{
|
| Return Values : Pointer to the next field.
+--------------------------------------------------------------------------*/
-INLINE static FIELD *
+NCURSES_INLINE static FIELD *
Next_Field_On_Page(FIELD *field)
{
FORM *form = field->form;
|
| Return Values : Pointer to the previous field.
+--------------------------------------------------------------------------*/
-INLINE static FIELD *
+NCURSES_INLINE static FIELD *
Previous_Field_On_Page(FIELD *field)
{
FORM *form = field->form;
|
| Return Values : Pointer to the next field.
+--------------------------------------------------------------------------*/
-INLINE static FIELD *
+NCURSES_INLINE static FIELD *
Sorted_Next_Field(FIELD *field)
{
FIELD *field_on_page = field;
|
| Return Values : Pointer to the previous field.
+--------------------------------------------------------------------------*/
-INLINE static FIELD *
+NCURSES_INLINE static FIELD *
Sorted_Previous_Field(FIELD *field)
{
FIELD *field_on_page = field;
|
| Return Values : Pointer to left neighbor field.
+--------------------------------------------------------------------------*/
-INLINE static FIELD *
+NCURSES_INLINE static FIELD *
Left_Neighbor_Field(FIELD *field)
{
FIELD *field_on_page = field;
|
| Return Values : Pointer to right neighbor field.
+--------------------------------------------------------------------------*/
-INLINE static FIELD *
+NCURSES_INLINE static FIELD *
Right_Neighbor_Field(FIELD *field)
{
FIELD *field_on_page = field;
|
| Return Values : E_OK - success
| != E_OK - error from subordinate call
+| E_BAD_ARGUMENT - invalid field pointer
+| E_SYSTEM_ERROR - some severe basic error
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
_nc_Set_Form_Page(FORM *form, int page, FIELD *field)
|
| Return Values : The next page number
+--------------------------------------------------------------------------*/
-INLINE static int
+NCURSES_INLINE static int
Next_Page_Number(const FORM *form)
{
return (form->curpage + 1) % form->maxpage;
|
| Return Values : The previous page number
+--------------------------------------------------------------------------*/
-INLINE static int
+NCURSES_INLINE static int
Previous_Page_Number(const FORM *form)
{
return (form->curpage != 0 ? form->curpage - 1 : form->maxpage - 1);
| Description : Enter character c into at the current position of the
| current field of the form.
|
-| Return Values : E_OK -
-| E_REQUEST_DENIED -
+| Return Values : E_OK - success
+| E_REQUEST_DENIED - driver could not process the request
| E_SYSTEM_ERROR -
+--------------------------------------------------------------------------*/
static int
FIELD *field = form->current;
int result = E_REQUEST_DENIED;
- T((T_CALLED("Data_Entry(%p,%s)"), form, _tracechtype(c)));
+ T((T_CALLED("Data_Entry(%p,%s)"), form, _tracechtype((chtype)c)));
if ((field->opts & O_EDIT)
#if FIX_FORM_INACTIVE_BUG
&& (field->opts & O_ACTIVE)
| E_INVALID_FIELD - field contents are invalid
| E_BAD_STATE - called from inside a hook routine
| E_REQUEST_DENIED - request failed
+| E_NOT_CONNECTED - no fields are connected to the form
| E_UNKNOWN_COMMAND - command not known
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)