Lines Matching defs:field

53         The current field of the form is left and some new field is
56 The current position in the current field is changed.
59 It has to check for a multi-line field.
62 It has to check for a single-line field.
64 The content of the current field is changed
68 Perform verifications of the field.
70 Requests to enumerate possible field values
98 /* Allow dynamic field growth also when navigating past the end */
130 /* Calculate the position of a single row in a field buffer */
131 #define Position_Of_Row_In_Buffer(field,row) ((row)*(field)->dcols)
134 #define Address_Of_Nth_Buffer(field,N) \
135 ((field)->buf + (N)*(1+Buffer_Length(field)))
138 #define Address_Of_Row_In_Nth_Buffer(field,N,row) \
139 (Address_Of_Nth_Buffer(field,N) + Position_Of_Row_In_Buffer(field,row))
142 #define Address_Of_Row_In_Buffer(field,row) \
143 Address_Of_Row_In_Nth_Buffer(field,0,row)
145 /* Calculate the start address of the row in the forms current field
150 /* Calculate the start address of the row in the forms current field
155 /* Calculate the address of the cursor in the forms current field
160 /* Calculate the address of the cursor in the forms current field
165 /* Logic to decide whether or not a field is actually a field with
167 #define Is_Scroll_Field(field) \
168 (((field)->drows > (field)->rows) || \
169 ((field)->dcols > (field)->cols))
171 /* Logic to decide whether or not a field needs to have an individual window
174 #define Has_Invisible_Parts(field) \
175 (!((field)->opts & O_PUBLIC) || \
176 Is_Scroll_Field(field))
178 /* Logic to decide whether or not a field needs justification */
179 #define Justification_Allowed(field) \
180 (((field)->just != NO_JUSTIFICATION) && \
181 (Single_Line_Field(field)) && \
182 (((field)->dcols == (field)->cols) && \
183 ((field)->opts & O_STATIC)) )
185 /* Logic to determine whether or not a dynamic field may still grow */
186 #define Growable(field) ((field)->status & _MAY_GROW)
189 #define Set_Field_Window_Attributes(field,win) \
190 ( wbkgdset((win),(chtype)((field)->pad | (field)->back)), \
191 wattrset((win),(field)->fore) )
193 /* Logic to decide whether or not a field really appears on the form */
194 #define Field_Really_Appears(field) \
195 ((field->form) &&\
196 (field->form->status & _POSTED) &&\
197 (field->opts & O_VISIBLE) &&\
198 (field->page == field->form->curpage))
201 current field */
457 FIELD *field;
460 field = form->current;
461 assert(pos >= field->buf && field->dcols > 0);
462 idx = (int)(pos - field->buf);
464 *((div_t *) & (form->currow)) = div(idx, field->dcols);
466 form->currow = idx / field->dcols;
467 form->curcol = idx - field->cols * form->currow;
469 if (field->drows < form->currow)
476 | const FIELD * field,
480 | field, the buffer is split to the lines of the
486 Buffer_To_Window(const FIELD *field, WINDOW *win)
494 assert(win && field);
500 for (row = 0, pBuffer = field->buf;
517 | FIELD * field)
527 Window_To_Buffer(WINDOW *win, FIELD *field)
534 assert(win && field && field->buf);
536 pad = field->pad;
537 p = field->buf;
540 for (row = 0; (row < height) && (row < field->drows); row++)
543 len += myINNSTR(win, p + len, field->dcols);
589 | Function : static bool Field_Grown( FIELD *field, int amount)
593 | a new window for this field.
595 | field-buffer pointer, the dcols and drows values
596 | as well as a new current Window for the field.
598 | Return Values : TRUE - field successfully increased
602 Field_Grown(FIELD *field, int amount)
606 if (field && Growable(field))
608 bool single_line_field = Single_Line_Field(field);
609 int old_buflen = Buffer_Length(field);
611 int old_dcols = field->dcols;
612 int old_drows = field->drows;
613 FIELD_CELL *oldbuf = field->buf;
617 FORM *form = field->form;
620 (form->current == field));
627 growth = field->cols * amount;
628 if (field->maxgrow)
629 growth = Minimum(field->maxgrow - field->dcols, growth);
630 field->dcols += growth;
631 if (field->dcols == field->maxgrow)
632 field->status &= ~_MAY_GROW;
636 growth = (field->rows + field->nrow) * amount;
637 if (field->maxgrow)
638 growth = Minimum(field->maxgrow - field->drows, growth);
639 field->drows += growth;
640 if (field->drows == field->maxgrow)
641 field->status &= ~_MAY_GROW;
644 new_buflen = Buffer_Length(field);
645 newbuf = (FIELD_CELL *)malloc(Total_Buffer_Size(field));
649 field->dcols = old_dcols;
650 field->drows = old_drows;
651 if ((single_line_field && (field->dcols != field->maxgrow)) ||
652 (!single_line_field && (field->drows != field->maxgrow)))
653 field->status |= _MAY_GROW;
667 field->buf = newbuf;
668 for (i = 0; i <= field->nbuf; i++)
670 new_bp = Address_Of_Nth_Buffer(field, i);
680 if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR)
686 WINDOW *new_window = newpad(field->drows, field->dcols);
694 Set_Field_Window_Attributes(field, form->w);
696 Buffer_To_Window(field, form->w);
708 if (field != field->link)
712 for (linked_field = field->link;
713 linked_field != field;
716 linked_field->buf = field->buf;
717 linked_field->drows = field->drows;
718 linked_field->dcols = field->dcols;
725 field->dcols = old_dcols;
726 field->drows = old_drows;
727 field->buf = oldbuf;
729 (field->dcols != field->maxgrow)) ||
731 (field->drows != field->maxgrow)))
732 field->status |= _MAY_GROW;
743 | Function : int Field_encloses(FIELD *field, int ry, int rx)
745 | Description : Check if the given coordinates lie within the given field.
749 | E_SYSTEM_ERROR - form has no current field or
750 | field-window
753 Field_encloses(FIELD *field, int ry, int rx)
755 T((T_CALLED("Field_encloses(%p)"), field));
756 if (field != 0
757 && field->frow <= ry
758 && (field->frow + field->rows) > ry
759 && field->fcol <= rx
760 && (field->fcol + field->cols) > rx)
773 | field to be in sync. with the currow and curcol
778 | E_SYSTEM_ERROR - form has no current field or
779 | field-window
784 FIELD *field;
793 field = form->current;
797 if (Has_Invisible_Parts(field))
802 field->frow + form->currow - form->toprow,
803 field->fcol + form->curcol - form->begincol);
826 FIELD *field;
836 field = form->current;
839 if (field->opts & O_PUBLIC)
841 if (Is_Scroll_Field(field))
845 if (Single_Line_Field(field))
852 if (form->curcol >= (form->begincol + field->cols))
853 form->begincol = form->curcol - field->cols + 1;
859 field->frow,
860 field->fcol,
861 field->frow,
862 field->cols + field->fcol - 1,
867 /* A multi-line, i.e. vertical scrolling field */
870 if (field->drows > field->rows)
872 row_after_bottom = form->toprow + field->rows;
876 field->status |= _NEWTOP;
880 form->toprow = form->currow - field->rows + 1;
881 field->status |= _NEWTOP;
883 if (field->status & _NEWTOP)
887 first_unmodified_row = first_modified_row + field->rows;
888 field->status &= ~_NEWTOP;
913 first_unmodified_row = first_modified_row + field->rows;
920 field->frow + first_modified_row - form->toprow,
921 field->fcol,
922 field->frow + first_unmodified_row - form->toprow - 1,
923 field->cols + field->fcol - 1,
930 /* if the field-window is simply a derived window, i.e. contains no
943 | FIELD * field,
946 | Description : Output field with requested justification
951 Perform_Justification(FIELD *field, WINDOW *win)
957 bp = Get_Start_Of_Data(field->buf, Buffer_Length(field));
958 len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp);
962 assert(win && (field->drows == 1) && (field->dcols == field->cols));
964 switch (field->just)
969 col = (field->cols - len) / 2;
972 col = field->cols - len;
986 | FIELD * field,
989 | Description : Display field without any justification, i.e.
995 Undo_Justification(FIELD *field, WINDOW *win)
1000 bp = Get_Start_Of_Data(field->buf, Buffer_Length(field));
1001 len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp);
1048 | FIELD * field,
1051 | Description : Create a subwindow for the field and display the
1053 | or simply erase the field.
1059 Display_Or_Erase_Field(FIELD *field, bool bEraseFlag)
1064 if (!field)
1067 fwin = Get_Form_Window(field->form);
1069 field->rows, field->cols, field->frow, field->fcol);
1075 if (field->opts & O_VISIBLE)
1076 Set_Field_Window_Attributes(field, win);
1084 if (field->opts & O_PUBLIC)
1086 if (Justification_Allowed(field))
1087 Perform_Justification(field, win);
1089 Buffer_To_Window(field, win);
1091 field->status &= ~_NEWTOP;
1099 #define Display_Field(field) Display_Or_Erase_Field(field,FALSE)
1100 #define Erase_Field(field) Display_Or_Erase_Field(field,TRUE)
1104 | Function : static int Synchronize_Field(FIELD * field)
1110 | E_BAD_ARGUMENT - invalid field pointer
1114 Synchronize_Field(FIELD *field)
1119 if (!field)
1122 if (((form = field->form) != (FORM *)0)
1123 && Field_Really_Appears(field))
1125 if (field == form->current)
1130 if ((field->opts & O_PUBLIC) && Justification_Allowed(field))
1131 Undo_Justification(field, form->w);
1133 Buffer_To_Window(field, form->w);
1135 field->status |= _NEWTOP;
1139 res = Display_Field(field);
1141 field->status |= _CHANGED;
1147 | Function : static int Synchronize_Linked_Fields(FIELD * field)
1154 | E_BAD_ARGUMENT - invalid field pointer
1158 Synchronize_Linked_Fields(FIELD *field)
1164 if (!field)
1167 if (!field->link)
1170 for (linked_field = field->link;
1171 linked_field != field;
1183 | Function : int _nc_Synchronize_Attributes(FIELD * field)
1190 | E_BAD_ARGUMENT - invalid field pointer
1194 _nc_Synchronize_Attributes(FIELD *field)
1200 T((T_CALLED("_nc_Synchronize_Attributes(%p)"), field));
1202 if (!field)
1205 CHECKPOS(field->form);
1206 if (((form = field->form) != (FORM *)0)
1207 && Field_Really_Appears(field))
1209 if (form->current == field)
1212 Set_Field_Window_Attributes(field, form->w);
1216 if (field->opts & O_PUBLIC)
1218 if (Justification_Allowed(field))
1219 Undo_Justification(field, form->w);
1221 Buffer_To_Window(field, form->w);
1228 field->frow, field->fcol,
1229 field->rows - 1, field->cols - 1, 0);
1231 Buffer_To_Window(field, form->w);
1232 field->status |= _NEWTOP; /* fake refresh to paint all */
1238 res = Display_Field(field);
1247 | Function : int _nc_Synchronize_Options(FIELD * field,
1252 | to really change the behavior of the field.
1255 | E_BAD_ARGUMENT - invalid field pointer
1256 | E_CURRENT - field is the current one
1260 _nc_Synchronize_Options(FIELD *field, Field_Options newopts)
1267 T((T_CALLED("_nc_Synchronize_Options(%p,%#x)"), field, newopts));
1269 if (!field)
1272 oldopts = field->opts;
1274 field->opts = newopts;
1275 form = field->form;
1279 if (form->current == field)
1281 field->opts = oldopts;
1287 if ((form->curpage == field->page))
1292 res = Display_Field(field);
1294 res = Erase_Field(field);
1300 res = Display_Field(field);
1308 bool single_line_field = Single_Line_Field(field);
1313 /* the field becomes now static */
1314 field->status &= ~_MAY_GROW;
1318 (field->cols == field->dcols) &&
1319 (field->just != NO_JUSTIFICATION) &&
1320 Field_Really_Appears(field))
1322 res2 = Display_Field(field);
1327 /* field is no longer static */
1328 if ((field->maxgrow == 0) ||
1329 (single_line_field && (field->dcols < field->maxgrow)) ||
1330 (!single_line_field && (field->drows < field->maxgrow)))
1332 field->status |= _MAY_GROW;
1333 /* a field with justification now changes its behavior,
1336 (field->just != NO_JUSTIFICATION) &&
1337 Field_Really_Appears(field))
1339 res2 = Display_Field(field);
1355 | Description : Make the newfield the new current field.
1358 | E_BAD_ARGUMENT - invalid form or field pointer
1365 FIELD *field;
1376 if (!(form->field))
1379 field = form->current;
1381 if ((field != newfield) ||
1385 (field->opts & O_VISIBLE) &&
1386 (field->form->curpage == field->page))
1389 if (field->opts & O_PUBLIC)
1391 if (field->drows > field->rows)
1394 field->status &= ~_NEWTOP;
1396 field->status |= _NEWTOP;
1400 if (Justification_Allowed(field))
1402 Window_To_Buffer(form->w, field);
1404 Perform_Justification(field, form->w);
1413 field = newfield;
1415 if (Has_Invisible_Parts(field))
1416 new_window = newpad(field->drows, field->dcols);
1419 field->rows, field->cols, field->frow, field->fcol);
1424 form->current = field;
1431 Set_Field_Window_Attributes(field, form->w);
1433 if (Has_Invisible_Parts(field))
1436 Buffer_To_Window(field, form->w);
1440 if (Justification_Allowed(field))
1443 Undo_Justification(field, form->w);
1463 | Description : Move to the next character in the field. In a multi-line
1464 | field this wraps at the end of the line.
1472 FIELD *field = form->current;
1476 if ((form->curcol += step) == field->dcols)
1478 if ((++(form->currow)) == field->drows)
1481 if (!Single_Line_Field(field) && Field_Grown(field, 1))
1489 if (Single_Line_Field(field) && Field_Grown(field, 1))
1504 | Description : Move to the previous character in the field. In a
1505 | multi-line field this wraps and the beginning of the
1535 | Description : Move to the beginning of the next line in the field
1543 FIELD *field = form->current;
1546 if ((++(form->currow)) == field->drows)
1549 if (!Single_Line_Field(field) && Field_Grown(field, 1))
1563 | Description : Move to the beginning of the previous line in the field
1585 | Description : Move to the beginning of the next word in the field.
1593 FIELD *field = form->current;
1606 s = Get_First_Whitespace_Character(bp, Buffer_Length(field) -
1607 (int)(bp - field->buf));
1610 t = Get_Start_Of_Data(s, Buffer_Length(field) -
1611 (int)(s - field->buf));
1627 | Description : Move to the beginning of the previous word in the field.
1635 FIELD *field = form->current;
1646 s = After_End_Of_Data(field->buf, (int)(bp - field->buf));
1658 t = After_Last_Whitespace_Character(field->buf, (int)(s - field->buf));
1666 s = After_End_Of_Data(field->buf, (int)(t - field->buf));
1667 t = After_Last_Whitespace_Character(field->buf, (int)(s - field->buf));
1682 | the field.
1689 FIELD *field = form->current;
1694 Get_Start_Of_Data(field->buf, Buffer_Length(field)));
1703 | the field. If the field occupies the last position in
1712 FIELD *field = form->current;
1717 pos = After_End_Of_Data(field->buf, Buffer_Length(field));
1718 if (pos == (field->buf + Buffer_Length(field)))
1729 | the current line of the field.
1736 FIELD *field = form->current;
1742 field->dcols));
1751 | current line of the field. If the field occupies the
1760 FIELD *field = form->current;
1767 pos = After_End_Of_Data(bp, field->dcols);
1768 if (pos == (bp + field->dcols))
1819 FIELD *field = form->current;
1821 if (Single_Line_Field(field) && Field_Grown(field, 1))
1835 | of the field.
1857 | lines of the field.
1865 FIELD *field = form->current;
1868 if ((++(form->currow)) == field->drows)
1871 if (!Single_Line_Field(field) && Field_Grown(field, 1))
1891 | Description : Scroll multi-line field forward (nlines>0) or
1900 FIELD *field = form->current;
1906 if ((rows_to_go + form->toprow) > (field->drows - field->rows))
1907 rows_to_go = (field->drows - field->rows - form->toprow);
1945 | This has to check for a multi-line field and to set
1968 | Description : Scroll multi-line field forward a line
1984 | Description : Scroll multi-line field backward a line
2000 | Description : Scroll a multi-line field forward a page
2016 | Description : Scroll a multi-line field forward half a page
2032 | Description : Scroll a multi-line field backward a page
2048 | Description : Scroll a multi-line field backward half a page
2071 | Description : Scroll single-line field forward (ncolumns>0) or
2080 FIELD *field = form->current;
2086 if ((cols_to_go + form->begincol) > (field->dcols - field->cols))
2087 cols_to_go = field->dcols - field->cols - form->begincol;
2125 | This has to check for a single-line field.
2142 | Description : Scroll single-line field forward a character
2158 | Description : Scroll single-line field backward a character
2174 | Description : Scroll single-line field forward a line
2190 | Description : Scroll single-line field forward half a line
2206 | Description : Scroll single-line field backward a line
2222 | Description : Scroll single-line field backward half a line
2255 FIELD *field = form->current;
2259 begin_of_last_line = Address_Of_Row_In_Buffer(field, (field->drows - 1));
2260 s = After_End_Of_Data(begin_of_last_line, field->dcols);
2312 FIELD *field = form->current;
2313 FIELD_CELL *bp = Address_Of_Row_In_Buffer(field, row);
2314 int datalen = (int)(After_End_Of_Data(bp, field->dcols) - bp);
2315 int freelen = field->dcols - datalen;
2331 last line this may work, if the field is growable */
2332 if ((row == (field->drows - 1)) && Growable(field))
2334 if (!Field_Grown(field, 1))
2337 bp = Address_Of_Row_In_Buffer(field, row);
2340 if (row < (field->drows - 1))
2345 + field->dcols
2352 freelen = field->dcols - (datalen + freelen); /* for the next line */
2374 | Description : If a character has been entered into a field, it may
2387 FIELD *field = form->current;
2389 bool Last_Row = ((field->drows - 1) == form->currow);
2391 if ((field->opts & O_WRAP) && /* wrapping wanted */
2392 (!Single_Line_Field(field)) && /* must be multi-line */
2394 (!Last_Row || Growable(field))) /* there are more lines */
2403 /* the above logic already ensures, that in this case the field
2405 if (!Field_Grown(field, 1))
2409 Window_To_Buffer(form->w, field);
2410 split = After_Last_Whitespace_Character(bp, field->dcols);
2414 chars_to_be_wrapped = field->dcols - chars_to_remain_on_line;
2435 Window_To_Buffer(form->w, field);
2454 | Description : Generic routine for field editing requests. The driver
2470 character in a field. But navigation is also allowed on non-
2522 FIELD *field = form->current;
2524 bool Last_Row = ((field->drows - 1) == form->currow);
2530 (!(Growable(field) && !Single_Line_Field(field))))
2545 if (Last_Row && !Field_Grown(field, 1))
2548 means here that the field is growable and not
2549 a single-line field */
2564 !(Growable(field) && !Single_Line_Field(field)))
2574 if (!(May_Do_It || Growable(field)))
2576 if (!May_Do_It && !Field_Grown(field, 1))
2580 t = After_End_Of_Data(bp, field->dcols - form->curcol);
2606 FIELD *field = form->current;
2610 if (Check_Char(field->type, (int)C_BLANK, (TypeArgument *)(field->arg)))
2615 ((Single_Line_Field(field) && Growable(field))))
2617 if (!There_Is_Room && !Field_Grown(field, 1))
2641 FIELD *field = form->current;
2645 if (Check_Char(field->type, (int)C_BLANK, (TypeArgument *)(field->arg)))
2647 bool Maybe_Done = (form->currow != (field->drows - 1)) &&
2650 if (!Single_Line_Field(field) &&
2651 (Maybe_Done || Growable(field)))
2653 if (!Maybe_Done && !Field_Grown(field, 1))
2689 | N.B.: The case of overloaded BS on first field position
2698 FIELD *field = form->current;
2713 prev_line = Address_Of_Row_In_Buffer(field, (form->currow - 1));
2714 this_line = Address_Of_Row_In_Buffer(field, (form->currow));
2716 prev_end = After_End_Of_Data(prev_line, field->dcols);
2717 this_end = After_End_Of_Data(this_line, field->dcols);
2719 (field->cols - (int)(prev_end - prev_line)))
2730 * into the last column of the field, and requires the user to enter a
2735 * cursor past the end of the form field. In this case, just delete the
2736 * character at the end of the field.
2741 form->curcol = field->dcols - 1;
2786 FIELD *field = form->current;
2788 FIELD_CELL *ep = bp + field->dcols;
2836 | Description : Clear to end of field.
2853 | Description : Clear entire field.
2917 | FIELD * field,
2920 | Description : Get the next field choice. For linked types this is
2927 Next_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
2936 Next_Choice(typ->left, field, argp->left) ||
2937 Next_Choice(typ->right, field, argp->right));
2942 return typ->next(field, (void *)argp);
2950 | FIELD * field,
2953 | Description : Get the previous field choice. For linked types this
2960 Previous_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
2969 Previous_Choice(typ->left, field, argp->left) ||
2970 Previous_Choice(typ->right, field, argp->right));
2975 return typ->prev(field, (void *)argp);
2990 | Description : Get the next field choice.
2998 FIELD *field = form->current;
3002 returnCode((Next_Choice(field->type, field, (TypeArgument *)(field->arg)))
3011 | Description : Get the previous field choice.
3019 FIELD *field = form->current;
3023 returnCode((Previous_Choice(field->type, field, (TypeArgument *)(field->arg)))
3039 | FIELD * field,
3042 | Description : Check the field according to its fieldtype and its
3046 | Return Values : TRUE - field is valid
3047 | FALSE - field is invalid.
3050 Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
3054 if (field->opts & O_NULLOK)
3056 FIELD_CELL *bp = field->buf;
3071 Check_Field(typ->left, field, argp->left) ||
3072 Check_Field(typ->right, field, argp->right));
3077 return typ->fcheck(field, (void *)argp);
3087 | Description : Validate the current field of the form.
3089 | Return Values : TRUE - field is valid
3090 | FALSE - field is invalid
3095 FIELD *field;
3097 field = form->current;
3101 (!(field->opts & O_PASSOK)))
3103 if (!Check_Field(field->type, field, (TypeArgument *)(field->arg)))
3106 field->status |= _CHANGED;
3107 Synchronize_Linked_Fields(field);
3123 | Description : Validate the current field of the form.
3125 | Return Values : E_OK - field valid
3126 | E_INVALID_FIELD - field not valid
3147 | Function : static FIELD *Next_Field_On_Page(FIELD * field)
3149 | Description : Get the next field after the given field on the current
3154 | Return Values : Pointer to the next field.
3157 Next_Field_On_Page(FIELD *field)
3159 FORM *form = field->form;
3160 FIELD **field_on_page = &form->field[field->index];
3161 FIELD **first_on_page = &form->field[form->page[form->curpage].pmin];
3162 FIELD **last_on_page = &form->field[form->page[form->curpage].pmax];
3171 while (field != (*field_on_page));
3179 | Description : Get the first active field on the current page,
3181 | visible field on the page. If there are also none,
3182 | we return the first field on page and hope the best.
3184 | Return Values : Pointer to calculated field.
3189 FIELD **last_on_page = &form->field[form->page[form->curpage].pmax];
3195 active and visible field on the current page. We then select
3196 the first visible field on this readonly page
3200 FIELD **field = &form->field[proposed->index];
3201 FIELD **first = &form->field[form->page[form->curpage].pmin];
3205 field = (field == last_on_page) ? first : field + 1;
3206 if (((*field)->opts & O_VISIBLE))
3209 while (proposed != (*field));
3211 proposed = *field;
3215 /* This means, there is also no visible field on the page.
3229 | Function : static FIELD *Previous_Field_On_Page(FIELD * field)
3231 | Description : Get the previous field before the given field on the
3236 | Return Values : Pointer to the previous field.
3239 Previous_Field_On_Page(FIELD *field)
3241 FORM *form = field->form;
3242 FIELD **field_on_page = &form->field[field->index];
3243 FIELD **first_on_page = &form->field[form->page[form->curpage].pmin];
3244 FIELD **last_on_page = &form->field[form->page[form->curpage].pmax];
3253 while (field != (*field_on_page));
3260 | Function : static FIELD *Sorted_Next_Field(FIELD * field)
3262 | Description : Get the next field after the given field on the current
3266 | Return Values : Pointer to the next field.
3269 Sorted_Next_Field(FIELD *field)
3271 FIELD *field_on_page = field;
3279 while (field_on_page != field);
3286 | Function : static FIELD *Sorted_Previous_Field(FIELD * field)
3288 | Description : Get the previous field before the given field on the
3292 | Return Values : Pointer to the previous field.
3295 Sorted_Previous_Field(FIELD *field)
3297 FIELD *field_on_page = field;
3305 while (field_on_page != field);
3312 | Function : static FIELD *Left_Neighbor_Field(FIELD * field)
3314 | Description : Get the left neighbor of the field on the same line
3317 | Return Values : Pointer to left neighbor field.
3320 Left_Neighbor_Field(FIELD *field)
3322 FIELD *field_on_page = field;
3324 /* For a field that has really a left neighbor, the while clause
3326 neighbor. Otherwise we cycle backwards through the sorted field list
3333 while (field_on_page->frow != field->frow);
3340 | Function : static FIELD *Right_Neighbor_Field(FIELD * field)
3342 | Description : Get the right neighbor of the field on the same line
3345 | Return Values : Pointer to right neighbor field.
3348 Right_Neighbor_Field(FIELD *field)
3350 FIELD *field_on_page = field;
3357 while (field_on_page->frow != field->frow);
3364 | Function : static FIELD *Upper_Neighbor_Field(FIELD * field)
3368 | field really means. We define that it must be on a
3370 | field laying on the left side of the given field. If
3371 | this set is empty, we take the first field on the line.
3373 | Return Values : Pointer to the upper neighbor field.
3376 Upper_Neighbor_Field(FIELD *field)
3378 FIELD *field_on_page = field;
3379 int frow = field->frow;
3380 int fcol = field->fcol;
3395 rightmost field on this line */
3399 field. */
3403 /* If we wrapped, just go to the right which is the first field on
3414 | Function : static FIELD *Down_Neighbor_Field(FIELD * field)
3418 | field really means. We define that it must be on a
3420 | field laying on the right side of the given field. If
3421 | this set is empty, we take the last field on the line.
3423 | Return Values : Pointer to the upper neighbor field.
3426 Down_Neighbor_Field(FIELD *field)
3428 FIELD *field_on_page = field;
3429 int frow = field->frow;
3430 int fcol = field->fcol;
3445 field on this line */
3449 field. */
3453 /* If we wrapped, just go to the left which is the last field on
3472 | Description : Generic behavior for changing the current field, the
3473 | field is left and a new field is entered. So the field
3474 | must be validated and the field init/term hooks must
3478 | E_INVALID_FIELD - field is invalid
3501 | Description : Move to the next field on the current page of the form
3518 | Description : Move to the previous field on the current page of the
3536 | Description : Move to the first field on the current page of the form
3546 Next_Field_On_Page(form->field[form->page[form->curpage].pmax])));
3553 | Description : Move to the last field on the current page of the form
3564 Previous_Field_On_Page(form->field[form->page[form->curpage].pmin])));
3571 | Description : Move to the sorted next field on the current page
3589 | Description : Move to the sorted previous field on the current page
3607 | Description : Move to the sorted first field on the current page
3618 Sorted_Next_Field(form->field[form->page[form->curpage].smax])));
3625 | Description : Move to the sorted last field on the current page
3636 Sorted_Previous_Field(form->field[form->page[form->curpage].smin])));
3643 | Description : Get the field on the left of the current field on the
3661 | Description : Get the field on the right of the current field on the
3679 | Description : Get the upper neighbor of the current field. This
3699 | Description : Get the down neighbor of the current field. This
3726 | FIELD * field)
3729 | the given field the current field on the page. If
3730 | for the field NULL is given, make the first field on
3731 | the page the current field. The routine acts only
3736 | E_BAD_ARGUMENT - invalid field pointer
3740 _nc_Set_Form_Page(FORM *form, int page, FIELD *field)
3750 last_field = field_on_page = form->field[form->page[page].smin];
3760 if (field)
3761 res = _nc_Set_Current_Field(form, field);
3765 context that contains field navigation
3815 | that the field is left and a new field is entered.
3816 | So the field must be validated and the field init/term
3821 | E_INVALID_FIELD - field is invalid
3919 | current field of the form.
3928 FIELD *field = form->current;
3932 if ((field->opts & O_EDIT)
3934 && (field->opts & O_ACTIVE)
3938 if ((field->opts & O_BLANK) &&
3954 ((Single_Line_Field(field) && Growable(field)))))
3957 if (!There_Is_Room && !Field_Grown(field, 1))
3965 bool End_Of_Field = (((field->drows - 1) == form->currow) &&
3966 ((field->dcols - 1) == form->curcol));
3969 if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP))
3973 if (End_Of_Field && Growable(field) && !Field_Grown(field, 1))
3979 * We have just added a byte to the form field. It may have
3981 * addch_used field is nonzero and we should not try to move
4110 | current position in the current field. If it is not
4120 | E_INVALID_FIELD - field contents are invalid
4137 if (!(form->field))
4168 Page_Navigation, /* overloaded to call field&form hooks */
4169 Inter_Field_Navigation, /* overloaded to call field hooks */
4248 FIELD *field = form->field[i];
4250 if (Field_Is_Selectable(field)
4251 && Field_encloses(field, ry, rx) == E_OK)
4253 res = _nc_Set_Current_Field(form, field);
4302 | Function : int set_field_buffer(FIELD *field,
4305 | Description : Set the given buffer of the field to the given value.
4306 | Buffer 0 stores the displayed content of the field.
4318 set_field_buffer(FIELD *field, int buffer, const char *value)
4329 T((T_CALLED("set_field_buffer(%p,%d,%s)"), field, buffer, _nc_visbuf(value)));
4331 if (!field || !value || ((buffer < 0) || (buffer > field->nbuf)))
4334 len = Buffer_Length(field);
4336 if (Growable(field))
4338 /* for a growable field we must assume zero terminated strings, because
4345 if (!Field_Grown(field,
4346 (int)(1 + (vlen - len) / ((field->rows + field->nrow)
4347 * field->cols))))
4354 p = Address_Of_Nth_Buffer(field, buffer);
4363 if (wresize(field->working, field->drows, field->dcols) == ERR)
4366 delwin(field->working);
4367 field->working = newpad(field->drows, field->dcols);
4369 wclear(field->working);
4370 mvwaddstr(field->working, 0, 0, value);
4378 for (i = 0; i < (unsigned)field->drows; ++i)
4380 mvwin_wchnstr(field->working, i, 0,
4381 widevalue + (i * field->dcols),
4382 field->dcols);
4413 if (((syncres = Synchronize_Field(field)) != E_OK) &&
4416 if (((syncres = Synchronize_Linked_Fields(field)) != E_OK) &&
4425 | Function : char *field_buffer(const FIELD *field,int buffer)
4427 | Description : Return the address of the buffer for the field.
4432 field_buffer(const FIELD *field, int buffer)
4436 T((T_CALLED("field_buffer(%p,%d)"), field, buffer));
4438 if (field && (buffer >= 0) && (buffer <= field->nbuf))
4441 FIELD_CELL *data = Address_Of_Nth_Buffer(field, buffer);
4443 int size = Buffer_Length(field);
4462 if (field->expanded[buffer] != 0)
4463 free(field->expanded[buffer]);
4464 field->expanded[buffer] = typeMalloc(char, need + 1);
4467 if ((result = field->expanded[buffer]) != 0)
4469 wclear(field->working);
4470 mvwadd_wchnstr(field->working, 0, 0, data, size);
4471 mvwinnstr(field->working, 0, 0, result, (int)need);
4474 result = Address_Of_Nth_Buffer(field, buffer);