home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume24
/
chemtab
/
part02
/
graphlib.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-12
|
2KB
|
131 lines
#ifdef ReGIS
#include <stdio.h>
#include <curses.h>
#include <strings.h>
#include "variables.h"
#include "element.h"
#include "graph.h"
#include "undefs.h"
#include "tune.h"
/*
* ReGIS graphics interface package (NOTE: Not curses oriented)
*/
chcolor(col)
int col;
{
if (!strncmp(getenv("TERM"), "vt2", 3)) {
switch(col) {
case '7':
case '2':
case '4':
col = RED_2;
break;
case '1':
case '5':
col = BLU_2;
break;
case '0': col = BLK_2; break;
default:
col = GRN_2;
break;
}
}
printf("W(I%d)", col);
}
initregis()
{
printf("\033Pp");
#ifdef LASERPRT
if (laser)
fprintf(lsr, "\033Pp");
#endif LASERPRT
chcolor(6);
}
endregis()
{
#ifdef LASERPRT
if (laser)
fprintf(lsr, "\033\\");
#endif LASERPRT
printf("\033\\");
}
regisgoto(x, y)
int x, y;
{
#ifdef LASERPRT
if (laser)
fprintf(lsr, "P[%d,%d]", x, y);
#endif LASERPRT
printf("P[%d,%d]", x, y);
}
line(x1, y1, x2, y2)
int x1, y1, x2, y2; /* From x1,y1 to x2,y2 */
{
regisgoto(x1, y1);
printf("V[%d,%d]", x2, y2);
#ifdef LASERPRT
if (laser)
fprintf(lsr, "V[%d,%d]", x2, y2);
#endif LASERPRT
}
mybox(width, x1, y1, x2, y2)
int width, x1, y1, x2, y2;
{
int i;
for (i = 0; i <= width; i++) {
line(x1+i, y1+i, x2-i, y1+i);
line(x2-i, y1+i, x2-i, y2-i);
line(x2-i, y2-i, x1+i, y2-i);
line(x1+i, y2-i, x1+i, y1+i);
}
}
hash(x1, y1, which)
int x1, y1, which; /* Make small hashmark with cross at x1,y1 */
{
if (which) {
regisgoto(x1, y1); /* decided to make it a circle... */
printf("W(S1)C[+2]W(S0)");
fflush(stdout);
#ifdef LASERPRT
if (laser)
fprintf(lsr, "W(S1)C[+2]W(S0)");
#endif LASERPRT
} else {
line(x1, y1-2, x1, y1+2);
line(x1-2, y1, x1+2, y1);
}
}
text(size, dir, angle, string)
int size, /* 0 through 16 * multiplier of # pixels in char */
dir, /* Angle of text in 45 degree increments */
angle; /* italics angle -45 to 45 degrees */
char *string; /* text to output */
{
printf("T(D%d)(S%d)(D%d)(I%d)'%s'", dir, size, dir, angle, string);
#ifdef LASERPRT
if (laser)
fprintf(lsr, "T(D%d)(S%d)(D%d)(I%d)'%s'", dir, size, dir, angle, string);
#endif LASERPRT
}
regispc()
{
noecho(); crmode();
regisgoto(10, 455);
text(1, 0, -5, "Press SPACE to continue...");
fflush(stdout);
getchar();
echo(); nocrmode();
}
#endif ReGIS