home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff227.lzh
/
PickPacket
/
src
/
stbuf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-25
|
5KB
|
162 lines
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* |_o_o|\\ Copyright (c) 1989 The Software Distillery. *
* |. o.| || All Rights Reserved *
* | . | || Written by John Toebes and Doug Walker *
* | o | || The Software Distillery *
* | . |// 235 Trillingham Lane *
* ====== Cary, NC 27513 *
* BBS:(919)-471-6436 *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "pickpack.h"
#include "struct.h"
#include "bufgen.h"
static struct IntuiText IText =
{
1,0,JAM2, /* front and back text pens, drawmode and fill byte */
0,0, /* XY origin relative to container TopLeft */
&TOPAZ80, /* font pointer or NULL for default */
NULL, /* pointer to text */
NULL /* next IntuiText structure */
};
static struct IntuiText NameText = {
3,0,JAM2, /* front and back text pens, drawmode and fill byte */
98,13, /* XY origin relative to container TopLeft */
&TOPAZ80, /* font pointer or NULL for default */
NULL, /* pointer to text */
NULL /* next IntuiText structure */
};
void stbufnew(nw, it, stnode)
struct NewWindow **nw;
struct IntuiText **it;
struct STNODE *stnode;
{
*nw = &NewWindowStructure1;
stnode->d.bdata->Gadget1 = Gadget1;
stnode->d.bdata->Gadget3 = Gadget2;
stnode->d.bdata->Gadget3 = Gadget3;
stnode->d.bdata->Gadget1SInfo = Gadget1SInfo;
stnode->d.bdata->Gadget2.NextGadget = &stnode->d.bdata->Gadget1;
stnode->d.bdata->Gadget3.NextGadget = &stnode->d.bdata->Gadget2;
stnode->d.bdata->Gadget1.SpecialInfo = (APTR)&stnode->d.bdata->Gadget1SInfo;
stnode->d.bdata->pos = 0;
NewWindowStructure1.FirstGadget = &stnode->d.bdata->Gadget1;
*it = &IText1;
return;
}
#define HEXASC 44
/* Display the struct FileHandle */
int stbufdisp(n)
struct STNODE *n;
{
return(stbufmove(n, 0));
}
/* Display the struct FileHandle */
int stbufmove(n, adj)
struct STNODE *n;
int adj;
{
char data[100];
char *dpos, *p;
int cyc, c;
int bytes;
int i, off;
int dlines, wlines;
int hpot, hbody;
INITTEXT(13)
BUG(1, ("stbufdisp: Entry, stnode 0x%08x window 0x%08x\n", n, n->w))
wlines = (n->w->Height - 13)/9;
dlines = (n->d.bdata->size+15) >> 4;
if (wlines >= dlines)
{
off = 0;
hpot = 0;
hbody = -1;
bytes = n->d.bdata->size;
dpos = n->d.bdata->buf;
}
else
{
if (n->d.bdata->Gadget1SInfo.VertPot == 0xffff)
off = dlines-wlines+adj;
else
off = ((n->d.bdata->Gadget1SInfo.VertPot*(dlines-wlines)+32000) >> 16)+adj;
if (off >= dlines-wlines)
{
hpot = -1;
off = dlines-wlines;
}
else if (off <= 0)
{
off = 0;
hpot = 0;
}
else
hpot = (off<<16)/(dlines-wlines);
hbody = (wlines<<16)/dlines;
bytes = n->d.bdata->size-(off*16);
if (bytes > wlines*16)
bytes = wlines*16;
dpos = &n->d.bdata->buf[off*16];
}
BUG(3,("bytes=%d hpot=%d hbody=%d dlines=%d wlines=%d\n",bytes,hpot,hbody,dlines,wlines))
ModifyProp(&n->d.bdata->Gadget1, n->w, NULL,
AUTOKNOB+FREEVERT, -1, hpot, -1, hbody);
/* Now go through and display the data */
off <<= 4;
i = 0;
while(bytes--)
{
c = *dpos++ & 0xff;
cyc = off&15;
if (!cyc)
{
/* Time to init the output buffer */
sprintf(data,
/* 0000: 00000000 00000000 00000000 00000000 *................* */
"%04x: * *", off);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
/* Now fill in the current character slot */
/* - - - - - - - - - - - - - - - - - - - - - - - - */
p = data+6+(cyc<<1)+(cyc>>2);
*p++ = "0123456789ABCDEF"[c>>4];
*p++ = "0123456789ABCDEF"[c&15];
/* - - - - - - - - - - - - - - - - - - - - - - - - */
/* Translate all non printing characters to a '.' */
/* This includes the range 0-1F, 7F, 80-9F, FF */
/* - - - - - - - - - - - - - - - - - - - - - - - - */
if (((c+1)&0x7f) <= ' ') c = '.';
data[HEXASC+cyc] = c;
off++;
if (bytes == 0 || cyc == 15)
{
/* Display it on the screen */
SHOWTEXT
}
}
strcpy(data, " ");
while(i++ < wlines)
SHOWTEXT
BUG(1, ("stbufdisp: Exit\n"))
return(RC_OK);
}