home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
SDGOTO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
2KB
|
85 lines
/*
sdgoto.c
% sd_goto_field (field movement handler)
C-scape 3.2
Copyright (c) 1986, 1987, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
11/16/86 sng Now handles variable-length fields.
11/18/87 jmd changed name of function
2/25/88 jmd split up GetR2M macro for UNIX compilers
4/12/88 jmd added reset of field's xoffset and adjust_rowcol().
10/02/88 jmd moved cursor sd_adjust_cur
12/16/88 jmd added currfield
1/18/89 jdc added oldfield == -1 check for field deletion
3/24/89 jmd added test for extra painting, added sed_ macros
12/04/89 jmd added cursor color
3/28/90 jmd ansi-fied
*/
#include "sed.h"
void sd_goto_field(sed_type sed, int fieldno)
/*
modifies: sed.
effects: moves to the field number given; if moving into
a new field, unhighlights old field and highlights the new.
*/
{
int oldfieldno;
byte reg, sel = 0x07;
cs_Assert(menu_GetFieldCount(sed_GetMenu(sed)) != 0, CS_SD_GTO_NF, 0);
cs_Assert(sed_Ok(sed), CS_SD_GTO_SED, 0);
cs_Assert(fieldno >= 0, CS_SD_GTO_NFO, 0);
/* note: we don't check to see whether or not we're going to the
same field. this is because someone might be calling goto just
to change the colors of the field.
*/
/* save the old field number */
oldfieldno = sed_GetFieldNo(sed);
/* Set the new field number */
sed_SetFieldNo(sed, fieldno);
/* unhighlight the old field (if it would change colors) */
if (oldfieldno >= 0) {
sed_GetFieldColors(sed, oldfieldno, ®, &sel);
if (reg != sel) {
sd_refresh_field(sed, oldfieldno);
}
}
/* skip this if we haven't changed fields */
if (oldfieldno != fieldno) {
/* reset the current field pointer */
sed_SetCurrField(sed, menu_GetField(sed_GetMenu(sed), fieldno));
/* update the field position data */
sed_SetRecordPos(sed, field_FirstChar(sed_GetCurrField(sed)));
field_SetXoffset(sed_GetCurrField(sed), 0);
/* highlight the new field (if it would change colors) */
sed_GetFieldColors(sed, fieldno, ®, &sel);
if (reg != sel) {
sd_refresh_field(sed, fieldno);
}
}
/* adjust cursor color */
win_SetCursorColor(sed, disp_GetAttrFgColor(sel));
/* adjust the cursor position */
sd_adjust_cur(sed);
}