home *** CD-ROM | disk | FTP | other *** search
- /*
- sdlstfld.c 11/10/86
-
- % sed_GotoLastField
-
- C-scape 3.2
- Copyright (c) 1986, 1987, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 11/18/87 jmd changed names of some low-level funcs
- 4/08/88 jmd changed sed->fieldcount to sed_GetFieldCount()
-
- 3/24/89 jmd added sed_ macros
- 9/01/89 jmd removed menu variable to avoid Microsoft compiler bug
-
- 3/17/90 jmd added Cache/Flush
- 3/28/90 jmd ansi-fied
- */
-
- #include "sed.h"
-
- int sed_GotoLastField(sed_type sed)
- /*
- modifies: sed object.
- effects: tries to go to the last unprotected editing field
- (contingent upon passing the fexit test).
- If the sed is active, call the fenter and fexit functions.
- */
- {
- register int last_fld;
-
- cs_Assert(sed_Ok(sed), CS_SD_GLF_SED, 0);
-
- /* find next unprotected field */
- for (last_fld = menu_GetFieldCount(sed_GetMenu(sed)) - 1; last_fld >= 0; last_fld--) {
- if (!menu_IsProtected(sed_GetMenu(sed), last_fld)) {
- break;
- }
- }
-
- if (last_fld < 0) { /* no unprotected fields found */
- return(SED_STUCK);
- }
-
- if (!sd_exitfield(sed)) {
- return(SED_INVALID);
- }
-
- disp_Cache();
- sd_scroll_adjust(sed, last_fld);
- sd_goto_field(sed, last_fld);
-
- if (sed_IsActive(sed)) {
- sed_DoFieldFenter(sed, sed_GetFieldNo(sed));
- }
- disp_Flush();
-
- return(SED_MOVED);
- }
-