home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
SLDDROWS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-27
|
2KB
|
91 lines
/*
slddrows.c
% sled_DeleteRows
C-scape 3.2
Copyright (c) 1988, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
10/14/88 jdc created
11/09/88 jdc rewrote for sarrays
3/29/89 jmd converted seds to 'pure' objects, cleaned up macros
4/13/89 jmd added Fenter, Fexit support
8/04/89 gam changed #include <sledwin.h> to sled.h
8/05/89 gam added support for protected/marked rows and columns
9/01/89 pmc fixed so properly restores active status
2/22/90 jdc fixed
2/24/90 jdc removed sled_GetHeight
3/28/90 jmd ansi-fied
8/27/90 jdc fixed backscroll with text at top problem
*/
#include "sed.h"
#include "sadecl.h"
#include "sled.h"
void sled_DeleteRows(sed_type sed, int row, int count)
{
int col, back = 0, hgt;
sarray_type sa;
boolean actflag;
/* Save current field vars */
sed_DoSexits(sed);
/* = in loop because of extra row marking/protection sarray */
for (col = 0; col <= sled_GetWidth(sed); col++) {
sa = (sarray_type) xa_Get(sled_GetXa(sed), col);
if (row <= 0 && count >= sled_GetColSize(sed)) {
/* don't delete the last row, just blank it */
sa_Blank(sa, (long)row, 1, FALSE);
}
else {
sa_Del(sa, (long)row, (long)count);
}
}
/* if the field should appear to be newly entered */
if (row <= sled_GetRow(sed) && row + count > sled_GetRow(sed)) {
sed_GoHome(sed);
sed_DoFieldFenter(sed, sed_GetFieldNo(sed));
}
/* adjust size */
if (sled_SetColSize(sed, sled_GetColSize(sed) - count) <= 0) {
sled_SetColSize(sed, 1);
}
sed_SetMenuVHeight(sed, sled_GetColSize(sed));
hgt = sed_GetMenuHeight(sed) - menu_GetFieldRow(sed_GetMenu(sed), 0);
/* adjust offset */
if (sled_GetColSize(sed) < hgt) {
sled_SetOffset(sed, 0);
}
else {
back = ((back = sled_GetOffset(sed) - (sled_GetColSize(sed) - hgt)) < 0)
? 0 : back;
sled_SetOffset(sed, sled_GetOffset(sed) - back);
}
/* get the fields pointing at the right vars, and update the records */
sled_remapper(sed, 0);
sed_DoSenters(sed);
/* place the field highlight */
row = sed_GetGridRow(sed, sed_GetFieldNo(sed)) + back;
if (row + sled_GetOffset(sed) >= sled_GetColSize(sed)) {
row = sled_GetColSize(sed) - 1 - sled_GetOffset(sed);
}
if ((actflag = sed_GetActive(sed)) != FALSE) {
sed_SetActive(sed, FALSE);
}
sed_GotoGridField(sed, row, sed_GetGridCol(sed, sed_GetFieldNo(sed)));
sed_SetActive(sed, actflag);
}