?? frm_driver.c
字號:
| lines of the field.|| Return Values : E_OK - success| E_REQUEST_DENIED - already in last column+--------------------------------------------------------------------------*/static int IFN_Down_Character(FORM * form){ FIELD *field = form->current; if ( (++(form->currow)) == field->drows ) {#if GROW_IF_NAVIGATE if (!Single_Line_Field(field) && Field_Grown(field,1)) return(E_OK);#endif --(form->currow); return(E_REQUEST_DENIED); } return(E_OK);}/*---------------------------------------------------------------------------- END of Intra-Field Navigation routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------- Vertical scrolling helper routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------| Facility : libnform | Function : static int VSC_Generic(FORM *form, int lines)|| Description : Scroll multi-line field forward (lines>0) or| backward (lines<0) this many lines.|| Return Values : E_OK - success | E_REQUEST_DENIED - can't scroll+--------------------------------------------------------------------------*/static int VSC_Generic(FORM *form, int lines){ FIELD *field = form->current; int res = E_REQUEST_DENIED; int rows_to_go = (lines > 0 ? lines : -lines); if (lines > 0) { if ( (rows_to_go + form->toprow) > (field->drows - field->rows) ) rows_to_go = (field->drows - field->rows - form->toprow); if (rows_to_go > 0) { form->currow += rows_to_go; form->toprow += rows_to_go; res = E_OK; } } else { if (rows_to_go > form->toprow) rows_to_go = form->toprow; if (rows_to_go > 0) { form->currow -= rows_to_go; form->toprow -= rows_to_go; res = E_OK; } } return(res);}/*---------------------------------------------------------------------------- End of Vertical scrolling helper routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------- Vertical scrolling routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------| Facility : libnform | Function : static int Vertical_Scrolling(| int (* const fct) (FORM *),| FORM * form)| | Description : Performs the generic vertical scrolling routines. | This has to check for a multi-line field and to set| the _NEWTOP flag if scrolling really occurred.|| Return Values : Propagated error code from low-level driver calls+--------------------------------------------------------------------------*/static int Vertical_Scrolling(int (* const fct) (FORM *), FORM * form){ int res = E_REQUEST_DENIED; if (!Single_Line_Field(form->current)) { res = fct(form); if (res == E_OK) form->current->status |= _NEWTOP; } return(res);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int VSC_Scroll_Line_Forward(FORM * form)| | Description : Scroll multi-line field forward a line|| Return Values : E_OK - success| E_REQUEST_DENIED - no data ahead+--------------------------------------------------------------------------*/static int VSC_Scroll_Line_Forward(FORM * form){ return VSC_Generic(form,1);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int VSC_Scroll_Line_Backward(FORM * form)| | Description : Scroll multi-line field backward a line|| Return Values : E_OK - success| E_REQUEST_DENIED - no data behind+--------------------------------------------------------------------------*/static int VSC_Scroll_Line_Backward(FORM * form){ return VSC_Generic(form,-1);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int VSC_Scroll_Page_Forward(FORM * form)| | Description : Scroll a multi-line field forward a page|| Return Values : E_OK - success| E_REQUEST_DENIED - no data ahead+--------------------------------------------------------------------------*/static int VSC_Scroll_Page_Forward(FORM * form){ return VSC_Generic(form,form->current->rows);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int VSC_Scroll_Half_Page_Forward(FORM * form)| | Description : Scroll a multi-line field forward half a page|| Return Values : E_OK - success| E_REQUEST_DENIED - no data ahead+--------------------------------------------------------------------------*/static int VSC_Scroll_Half_Page_Forward(FORM * form){ return VSC_Generic(form,(form->current->rows + 1)/2);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int VSC_Scroll_Page_Backward(FORM * form)| | Description : Scroll a multi-line field backward a page|| Return Values : E_OK - success| E_REQUEST_DENIED - no data behind+--------------------------------------------------------------------------*/static int VSC_Scroll_Page_Backward(FORM * form){ return VSC_Generic(form, -(form->current->rows));}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int VSC_Scroll_Half_Page_Backward(FORM * form)| | Description : Scroll a multi-line field backward half a page|| Return Values : E_OK - success| E_REQUEST_DENIED - no data behind+--------------------------------------------------------------------------*/static int VSC_Scroll_Half_Page_Backward(FORM * form){ return VSC_Generic(form, -((form->current->rows + 1)/2));}/*---------------------------------------------------------------------------- End of Vertical scrolling routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------- Horizontal scrolling helper routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------| Facility : libnform | Function : static int HSC_Generic(FORM *form, int columns)|| Description : Scroll single-line field forward (columns>0) or| backward (columns<0) this many columns.|| Return Values : E_OK - success | E_REQUEST_DENIED - can't scroll+--------------------------------------------------------------------------*/static int HSC_Generic(FORM *form, int columns){ FIELD *field = form->current; int res = E_REQUEST_DENIED; int cols_to_go = (columns > 0 ? columns : -columns); if (columns > 0) { if ((cols_to_go + form->begincol) > (field->dcols - field->cols)) cols_to_go = field->dcols - field->cols - form->begincol; if (cols_to_go > 0) { form->curcol += cols_to_go; form->begincol += cols_to_go; res = E_OK; } } else { if ( cols_to_go > form->begincol ) cols_to_go = form->begincol; if (cols_to_go > 0) { form->curcol -= cols_to_go; form->begincol -= cols_to_go; res = E_OK; } } return(res);}/*---------------------------------------------------------------------------- End of Horizontal scrolling helper routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------- Horizontal scrolling routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------| Facility : libnform | Function : static int Horizontal_Scrolling(| int (* const fct) (FORM *),| FORM * form)| | Description : Performs the generic horizontal scrolling routines. | This has to check for a single-line field.|| Return Values : Propagated error code from low-level driver calls+--------------------------------------------------------------------------*/static int Horizontal_Scrolling(int (* const fct) (FORM *), FORM * form){ if (Single_Line_Field(form->current)) return fct(form); else return(E_REQUEST_DENIED);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int HSC_Scroll_Char_Forward(FORM * form)| | Description : Scroll single-line field forward a character|| Return Values : E_OK - success| E_REQUEST_DENIED - no data ahead+--------------------------------------------------------------------------*/static int HSC_Scroll_Char_Forward(FORM *form){ return HSC_Generic(form,1);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int HSC_Scroll_Char_Backward(FORM * form)| | Description : Scroll single-line field backward a character|| Return Values : E_OK - success| E_REQUEST_DENIED - no data behind+--------------------------------------------------------------------------*/static int HSC_Scroll_Char_Backward(FORM *form){ return HSC_Generic(form,-1);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int HSC_Horizontal_Line_Forward(FORM* form)| | Description : Scroll single-line field forward a line|| Return Values : E_OK - success| E_REQUEST_DENIED - no data ahead+--------------------------------------------------------------------------*/static int HSC_Horizontal_Line_Forward(FORM * form){ return HSC_Generic(form,form->current->cols);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int HSC_Horizontal_Half_Line_Forward(FORM* form)| | Description : Scroll single-line field forward half a line|| Return Values : E_OK - success| E_REQUEST_DENIED - no data ahead+--------------------------------------------------------------------------*/static int HSC_Horizontal_Half_Line_Forward(FORM * form){ return HSC_Generic(form,(form->current->cols + 1)/2);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int HSC_Horizontal_Line_Backward(FORM* form)| | Description : Scroll single-line field backward a line|| Return Values : E_OK - success| E_REQUEST_DENIED - no data behind+--------------------------------------------------------------------------*/static int HSC_Horizontal_Line_Backward(FORM * form){ return HSC_Generic(form,-(form->current->cols));}/*---------------------------------------------------------------------------| Facility : libnform | Function : static int HSC_Horizontal_Half_Line_Backward(FORM* form)| | Description : Scroll single-line field backward half a line|| Return Values : E_OK - success| E_REQUEST_DENIED - no data behind+--------------------------------------------------------------------------*/static int HSC_Horizontal_Half_Line_Backward(FORM * form){ return HSC_Generic(form,-((form->current->cols + 1)/2));}/*---------------------------------------------------------------------------- End of Horizontal scrolling routines --------------------------------------------------------------------------*//*---------------------------------------------------------------------------- Helper routines for Field Editing --------------------------------------------------------------------------*//*---------------------------------------------------------------------------| Facility : libnform | Function : static bool Is_There_Room_For_A_Line(FORM * form)| | Description : Check whether or not there is enough room in the| buffer to enter a whole line.|| Return Values : TRUE - there is enough space| FALSE - there is not enough space+--------------------------------------------------------------------------*/INLINE static bool Is_There_Room_For_A_Line(FORM * form){ FIELD *field = form->current; char *begin_of_last_line, *s; Synchronize_Buffer(form); begin_of_last_line = Address_Of_Row_In_Buffer(field,(field->drows-1)); s = After_End_Of_Data(begin_of_last_line,field->dcols); return ((s==begin_of_last_line) ? TRUE : FALSE);}/*---------------------------------------------------------------------------| Facility : libnform | Function : static bool Is_There_Room_For_A_Char_In_Line(FORM * form)| | Description : Checks whether or not there is room for a new character| in the current line.|| Return Values : TRUE - there is room| FALSE - there is not enough room (line full)+--------------------------------------------------------------------------*/INLINE static bool Is_There_Room_For_A_Char_In_Line(FORM * form){ int last_char_in_
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -