home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
SDDECFLD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
2KB
|
70 lines
/*
sddecfld.c
% sed_DecField
C-scape 3.2
Copyright (c) 1986, 1987, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
11/05/86 jmd converted to boolean
11/06/86 jmd removed references to toggled_in_exit
11/07/86 jmd cleaned up the logic
11/08/86 jmd added calls to do_funcs
11/10/86 jmd added protected mode
11/18/87 jmd changed names of some low-level funcs
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_DecField(sed_type sed)
/*
modifies: sed object.
effects: tries to go to the previous editing field, without wrapping
around (contingent upon passing the fexit function.)
*/
{
register int prev_fld;
cs_Assert(sed_Ok(sed), CS_SD_DF_SED, 0);
if (sed_GetFieldNo(sed) <= 0) {
return(SED_STUCK);
}
/* find previous unprotected field */
for (prev_fld = sed_GetFieldNo(sed) - 1; prev_fld >= 0; prev_fld--) {
if (!menu_IsProtected(sed_GetMenu(sed), prev_fld))
break;
}
if (prev_fld < 0) { /* no unprotected fields found */
sd_goto_field(sed, sed_GetFieldNo(sed)); /* refresh current field */
return(SED_STUCK);
}
if (!sd_exitfield(sed)) {
return(SED_INVALID);
}
disp_Cache();
sd_scroll_adjust(sed, prev_fld);
sd_goto_field(sed, prev_fld);
if (sed_IsActive(sed)) {
sed_DoFieldFenter(sed, sed_GetFieldNo(sed));
}
disp_Flush();
return(SED_MOVED);
}