home *** CD-ROM | disk | FTP | other *** search
- /*
- sdgtofld.c
-
- % sed_GotoField
-
- C-scape 3.2
- Copyright (c) 1986, 1987, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 11/08/86 jmd added calls to do_funcs
- 11/10/86 jmd added protected mode and added returns
- 4/01/87 jmd added active mode check
- 11/18/87 jmd changed names of some low-level funcs
- 4/08/88 jmd changed sed->fieldcount to sed_GetFieldCount()
-
- 1/27/89 jdc fixed another field deletion related bug, sed->fieldno == -1
- 3/24/89 jmd added sed_ macros
- 5/27/89 jmd removed unnecessary call to goto_field
-
- 3/17/90 jmd added Cache/Flush
- 3/28/90 jmd ansi-fied
- */
-
- #include "sed.h"
-
- int sed_GotoField(sed_type sed, int fieldno)
- /*
- requires: a field number that's within range.
- modifies: the sed.
- effects: moves to the field number given. if the field is off the
- screen, scroll the screen until it's just on.
- If the sed is active, call the fenter and fexit functions.
- */
- {
- cs_Assert(sed_Ok(sed), CS_SD_GTF_SED, 0);
- cs_Assert(fieldno >= 0 && fieldno < sed_GetFieldCount(sed), CS_SD_GTF_BFN, 0);
-
- /* check if new field is protected */
- if (menu_IsProtected(sed_GetMenu(sed), fieldno)) {
- return(SED_STUCK);
- }
-
- if (sed_GetFieldNo(sed) != -1 && !sd_exitfield(sed)) {
- return(SED_INVALID);
- }
-
- disp_Cache();
- sd_scroll_adjust(sed, fieldno);
- sd_goto_field(sed, fieldno);
-
- if (sed_IsActive(sed)) {
- sed_DoFieldFenter(sed, sed_GetFieldNo(sed));
- }
- disp_Flush();
-
- return(SED_MOVED);
- }
-
-