* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
instead of a derived window because it contains invisible parts.
This is true for non-public fields and for scrollable fields. */
#define Has_Invisible_Parts(field) \
instead of a derived window because it contains invisible parts.
This is true for non-public fields and for scrollable fields. */
#define Has_Invisible_Parts(field) \
(((field)->just != NO_JUSTIFICATION) && \
(Single_Line_Field(field)) && \
(((field)->dcols == (field)->cols) && \
(((field)->just != NO_JUSTIFICATION) && \
(Single_Line_Field(field)) && \
(((field)->dcols == (field)->cols) && \
/* Logic to determine whether or not a dynamic field may still grow */
#define Growable(field) ((field)->status & _MAY_GROW)
/* Logic to determine whether or not a dynamic field may still grow */
#define Growable(field) ((field)->status & _MAY_GROW)
/* Macro to set the attributes for a fields window */
#define Set_Field_Window_Attributes(field,win) \
( wbkgdset((win),(chtype)((field)->pad | (field)->back)), \
/* Macro to set the attributes for a fields window */
#define Set_Field_Window_Attributes(field,win) \
( wbkgdset((win),(chtype)((field)->pad | (field)->back)), \
/* Logic to decide whether or not a field really appears on the form */
#define Field_Really_Appears(field) \
((field->form) &&\
(field->form->status & _POSTED) &&\
/* Logic to decide whether or not a field really appears on the form */
#define Field_Really_Appears(field) \
((field->form) &&\
(field->form->status & _POSTED) &&\
(field->page == field->form->curpage))
/* Logic to determine whether or not we are on the first position in the
(field->page == field->form->curpage))
/* Logic to determine whether or not we are on the first position in the
- form->status &= ~_WINDOW_MODIFIED;
- form->status |= _FCHECK_REQUIRED;
+ ClrStatus(form, _WINDOW_MODIFIED);
+ SetStatus(form, _FCHECK_REQUIRED);
Window_To_Buffer(form, form->current);
wmove(form->w, form->currow, form->curcol);
}
Window_To_Buffer(form, form->current);
wmove(form->w, form->currow, form->curcol);
}
growth = Minimum(field->maxgrow - field->dcols, growth);
field->dcols += growth;
if (field->dcols == field->maxgrow)
growth = Minimum(field->maxgrow - field->dcols, growth);
field->dcols += growth;
if (field->dcols == field->maxgrow)
growth = Minimum(field->maxgrow - field->drows, growth);
field->drows += growth;
if (field->drows == field->maxgrow)
growth = Minimum(field->maxgrow - field->drows, growth);
field->drows += growth;
if (field->drows == field->maxgrow)
}
/* drows, dcols changed, so we get really the new buffer length */
new_buflen = Buffer_Length(field);
}
/* drows, dcols changed, so we get really the new buffer length */
new_buflen = Buffer_Length(field);
field->drows = old_drows;
if ((single_line_field && (field->dcols != field->maxgrow)) ||
(!single_line_field && (field->drows != field->maxgrow)))
field->drows = old_drows;
if ((single_line_field && (field->dcols != field->maxgrow)) ||
(!single_line_field && (field->drows != field->maxgrow)))
}
if (field->status & _NEWTOP)
{
/* means we have to copy whole range */
first_modified_row = form->toprow;
first_unmodified_row = first_modified_row + field->rows;
}
if (field->status & _NEWTOP)
{
/* means we have to copy whole range */
first_modified_row = form->toprow;
first_unmodified_row = first_modified_row + field->rows;
{
if (Justification_Allowed(field))
Perform_Justification(field, win);
else
Buffer_To_Window(field, win);
}
{
if (Justification_Allowed(field))
Perform_Justification(field, win);
else
Buffer_To_Window(field, win);
}
Undo_Justification(field, form->w);
else
Buffer_To_Window(field, form->w);
Undo_Justification(field, form->w);
else
Buffer_To_Window(field, form->w);
{
if (Justification_Allowed(field))
Undo_Justification(field, form->w);
{
if (Justification_Allowed(field))
Undo_Justification(field, form->w);
field->rows - 1, field->cols - 1, 0);
wsyncup(formwin);
Buffer_To_Window(field, form->w);
field->rows - 1, field->cols - 1, 0);
wsyncup(formwin);
Buffer_To_Window(field, form->w);
(single_line_field && (field->dcols < field->maxgrow)) ||
(!single_line_field && (field->drows < field->maxgrow)))
{
(single_line_field && (field->dcols < field->maxgrow)) ||
(!single_line_field && (field->drows < field->maxgrow)))
{
/* a field with justification now changes its behavior,
so we must redisplay it */
if (single_line_field &&
/* a field with justification now changes its behavior,
so we must redisplay it */
if (single_line_field &&
Set_Field_Window_Attributes(field, form->w);
if (Has_Invisible_Parts(field))
Set_Field_Window_Attributes(field, form->w);
if (Has_Invisible_Parts(field))
(!Single_Line_Field(field)) && /* must be multi-line */
(There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */
(!Last_Row || Growable(field))) /* there are more lines */
(!Single_Line_Field(field)) && /* must be multi-line */
(There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */
(!Last_Row || Growable(field))) /* there are more lines */
First_Position_In_Current_Field(form))
{
res = Inter_Field_Navigation(FN_Previous_Field, form);
First_Position_In_Current_Field(form))
{
res = Inter_Field_Navigation(FN_Previous_Field, form);
First_Position_In_Current_Field(form))
{
res = Inter_Field_Navigation(FN_Next_Field, form);
First_Position_In_Current_Field(form))
{
res = Inter_Field_Navigation(FN_Next_Field, form);
returnCode(E_REQUEST_DENIED);
wmove(form->w, form->currow, form->curcol);
wclrtoeol(form->w);
returnCode(E_REQUEST_DENIED);
wmove(form->w, form->currow, form->curcol);
wclrtoeol(form->w);
handled in the generic routine. The reason is,
that FN_Next_Field may fail, but the form is
definitively changed */
handled in the generic routine. The reason is,
that FN_Next_Field may fail, but the form is
definitively changed */
returnCode(E_REQUEST_DENIED);
returnCode(Inter_Field_Navigation(FN_Next_Field, form));
}
returnCode(E_REQUEST_DENIED);
returnCode(Inter_Field_Navigation(FN_Next_Field, form));
}
wmove(form->w, form->currow, form->curcol);
winsertln(form->w);
myADDNSTR(form->w, bp, (int)(t - bp));
wmove(form->w, form->currow, form->curcol);
winsertln(form->w);
myADDNSTR(form->w, bp, (int)(t - bp));
EM_Overlay_Mode(FORM *form)
{
T((T_CALLED("EM_Overlay_Mode(%p)"), (void *)form));
EM_Overlay_Mode(FORM *form)
{
T((T_CALLED("EM_Overlay_Mode(%p)"), (void *)form));
EM_Insert_Mode(FORM *form)
{
T((T_CALLED("EM_Insert_Mode(%p)"), (void *)form));
EM_Insert_Mode(FORM *form)
{
T((T_CALLED("EM_Insert_Mode(%p)"), (void *)form));
{
if (!Check_Field(form, field->type, field, (TypeArgument *)(field->arg)))
return FALSE;
{
if (!Check_Field(form, field->type, field, (TypeArgument *)(field->arg)))
return FALSE;
- form->status &= ~_FCHECK_REQUIRED;
- field->status |= _CHANGED;
+ ClrStatus(form, _FCHECK_REQUIRED);
+ SetStatus(field, _CHANGED);
{
/* This means, there is also no visible field on the page.
So we propose the first one and hope the very best...
{
/* This means, there is also no visible field on the page.
So we propose the first one and hope the very best...
FIELD *last_field, *field_on_page;
werase(Get_Form_Window(form));
FIELD *last_field, *field_on_page;
werase(Get_Form_Window(form));
int result = E_REQUEST_DENIED;
T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c)));
int result = E_REQUEST_DENIED;
T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c)));
First_Position_In_Current_Field(form) &&
!(form->status & _FCHECK_REQUIRED) &&
!(form->status & _WINDOW_MODIFIED))
First_Position_In_Current_Field(form) &&
!(form->status & _FCHECK_REQUIRED) &&
!(form->status & _WINDOW_MODIFIED))
- form->status |= _WINDOW_MODIFIED;
- if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP))
+ SetStatus(form, _WINDOW_MODIFIED);
+ if (End_Of_Field && !Growable(field) && ((unsigned)field->opts & O_AUTOSKIP))
if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
NULL /* Choice Request is generic */
};
size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0]));
NULL /* Choice Request is generic */
};
size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0]));
if (Growable(field))
{
/* for a growable field we must assume zero terminated strings, because
somehow we have to detect the length of what should be copied.
*/
if (Growable(field))
{
/* for a growable field we must assume zero terminated strings, because
somehow we have to detect the length of what should be copied.
*/
wclear(field->working);
(void)mvwaddstr(field->working, 0, 0, value);
wclear(field->working);
(void)mvwaddstr(field->working, 0, 0, value);
- (void)mvwin_wchnstr(field->working, 0, i * field->dcols,
- widevalue + (i * field->dcols),
+ (void)mvwin_wchnstr(field->working, 0, (int)i * field->dcols,
+ widevalue + ((int)i * field->dcols),