home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
FUNCS
/
SPCEMBED.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-07
|
2KB
|
107 lines
/*
spcembed.c 8/22/88
% spc_Embed
C-scape 3.2
Copyright (c) 1988, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
11/28/88 jmd renamed
12/01/88 jmd replaced LEFT/RIGHT with TAB/SHFT_TAB
12/06/88 jmd added nested bob support
5/16/89 jmd removed ENTER support
3/28/90 jmd ansi-fied
8/07/90 pmcm added BOB_INC
*/
#include <stdio.h>
#include <ctype.h>
#include "cscape.h"
#include "scancode.h"
/* special function for embedded seds */
boolean spc_Embed(sed_type sed, int scancode)
/*
effects: Handles movement between fields.
ESC sets baton to 0, exits
UP goes up a field,
DOWN goes down a field,
RIGHT goes right a field,
LEFT goes left a field,
returns: TRUE if intercepted a key, FALSE otherwise.
Note: This routine also tests for BOB_ values because
it might be called from bob_funcs.
*/
{
switch (scancode) {
case BOB_QUIT:
case ESC:
sed_SetBaton(sed, BOB_QUIT);
sed_ToggleExit(sed);
return(TRUE);
#ifdef COMMENTED_OUT
case ENTER:
/* try to go to the next field else exit */
if (sed_IncField(sed) == SED_STUCK) {
sed_SetBaton(sed, BOB_DOWN);
sed_ToggleExit(sed);
}
return(TRUE);
#endif
case BOB_UP:
case UP:
if (sed_UpField(sed) == SED_STUCK) {
sed_SetBaton(sed, BOB_UP);
sed_ToggleExit(sed);
}
return(TRUE);
case BOB_DOWN:
case DOWN:
if (sed_DownField(sed) == SED_STUCK) {
sed_SetBaton(sed, BOB_DOWN);
sed_ToggleExit(sed);
}
return(TRUE);
case BOB_INC:
if (sed_IncField(sed) == SED_STUCK) {
sed_SetBaton(sed, BOB_INC);
sed_ToggleExit(sed);
}
return(TRUE);
case BOB_RIGHT:
case TAB:
if (sed_RightField(sed) == SED_STUCK) {
sed_SetBaton(sed, BOB_RIGHT);
sed_ToggleExit(sed);
}
return(TRUE);
case BOB_LEFT:
case SHFT_TAB:
if (sed_LeftField(sed) == SED_STUCK) {
sed_SetBaton(sed, BOB_LEFT);
sed_ToggleExit(sed);
}
return(TRUE);
default:
break;
}
return(FALSE);
}