mikew@wyse.wyse.com (Mike Wexler) (08/17/88)
Submitted-by: ken@cs.rochester.edu (Ken Yap) Posting-number: Volume 1, Issue 10 Archive-name: xfig/part09 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 9 (of 11)." # Contents: f2ps.c movept.c xfig.1 # Wrapped by mikew@wyse on Tue Aug 16 13:14:43 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f f2ps.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"f2ps.c\" else echo shar: Extracting \"f2ps.c\" \(15057 characters\) sed "s/^X//" >f2ps.c <<'END_OF_f2ps.c' X/* X * F2ps : Fig-to-PostScript translator X * X * Copyright (c) 1986 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * June 1986. X * 1st revision : March 1988 - read fig 1.4 X * X * %W% %G% X*/ X#include "fig.h" X#include "object.h" X X#define PAGE_WIDTH 612 /* points; 8.5" */ X#define PAGE_HEIGHT 792 /* points; 11" */ X#define TRUE 1 X#define FALSE 0 X#define POINT_PER_INCH 72 X#define DEFAULT_FONT_SIZE 11 X#define DEFAULT_FONT "Times-Roman" X#define ULIMIT_FONT_SIZE 300 X Xchar Usage[] = "Usage: %s [-f font][-s size][-e scale][-N][-c] [input [output]]\n"; Xchar *prog; Xchar *font = DEFAULT_FONT; Xint font_size = DEFAULT_FONT_SIZE; Xint cur_thickness; Xint show_page = 1; Xint center = 0; Xdouble scale = 1.0; Xdouble reduction; Xextern int num_object; Xchar *from = NULL, *to = NULL; XFILE *ffp = NULL, *tfp = NULL; Xchar Err_incomp[] = "Incomplete %s object at line %d."; Xchar Err_mem[] = "Running out of memory."; X Xput_msg(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) Xchar *format, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8; X{ X fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); X fprintf(stderr, "\n"); X } X Xget_args(argc, argv) Xint argc; Xchar *argv[]; X{ X char *a; X int first = 1; X X prog = *argv; X while (--argc) { X a = *++argv; X if (*a == '-') { X if (*++a == 'f') { /* Font name followed */ X if (--argc) X font = *++argv; X else X goto error_exit; X } X else if (*a == 'c') { /* Centering */ X center = 1; X } X else if (*a == 's') { /* Font size followed */ X if (--argc) { X font_size = atoi(*++argv); X if (font_size <= 0 || font_size > ULIMIT_FONT_SIZE) X goto error_exit; X } X else X goto error_exit; X } X else if (*a == 'e') { /* Enlarging factor followed */ X if (--argc) X scale = atof(*++argv); X else X goto error_exit; X } X else if (*a == 'N') { /* No "showpage" */ X show_page = 0; X } X else X goto error_exit; X } X else if (first) { X from = a; /* from file */ X first = 0; X } X else if (first == 0) { X to = a; /* to file */ X first = -1; X } X else X goto error_exit; X } X return; X X error_exit: X fprintf(stderr, Usage, prog); X exit(0); X } X Xmain(argc, argv) Xint argc; Xchar *argv[]; X{ X F_compound objects; X int status; X char c; X X get_args(argc, argv); X X if (to == NULL) X tfp = stdout; X else if ((tfp = fopen(to, "w")) == NULL) { X fprintf(stderr, "Couldn't open %s", to); X fprintf(stderr, Usage, prog); X exit(0); X } X X if (from) X status = read_fig(from, &objects); X else /* read from stdin */ X status = readfp_fig(stdin, &objects); X X if (status != 0) { X if (from) read_fail_message(from, status); X exit(0); X } X genps_objects(&objects); X if (tfp != stdout) (void)fclose(tfp); X } X X#define BEGIN_PROLOG "\ X/$F2psDict 32 dict def \ X$F2psDict begin\ X $F2psDict /mtrx matrix put\ X" X#define ELLIPSE_PS " \ X/DrawEllipse {\ X /endangle exch def\ X /startangle exch def\ X /yrad exch def\ X /xrad exch def\ X /y exch def\ X /x exch def\ X /savematrix mtrx currentmatrix def\ X x y translate xrad yrad scale 0 0 1 startangle endangle arc\ X savematrix setmatrix\ X } def\ X" X#define SPLINE_PS " \ X/DrawSplineSection {\ X /y3 exch def\ X /x3 exch def\ X /y2 exch def\ X /x2 exch def\ X /y1 exch def\ X /x1 exch def\ X /xa x1 x2 add 2 div def\ X /ya y1 y2 add 2 div def\ X /xb x2 x3 add 2 div def\ X /yb y2 y3 add 2 div def\ X /x2 xa xb add 2 div def\ X /y2 ya yb add 2 div def x1 x2 sub abs 2 lt y1 y2 sub abs 2 lt and\ X { x2 y2 lineto }\ X { x2 y2 xb yb x3 y3 x1 y1 xa ya x2 y2 DrawSplineSection\ X /y3 exch def\ X /x3 exch def\ X /yb exch def\ X /xb exch def\ X /y2 exch def\ X /x2 exch def}\ X ifelse\ X x2 x3 sub abs 2 lt y2 y3 sub abs 2 lt and { x3 y3 lineto }\ X { x2 y2 xb yb x3 y3 DrawSplineSection } ifelse\ X } def\ X" X#define END_PROLOG "\ X end\ X /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def\ X /$F2psEnd {$F2psEnteredState restore end} def\ X\n%%EndProlog\ X" X X#define MAX 32000 X#define MIN -32000 Xstatic int coord_system; Xstatic int llx = MAX, lly = MAX, urx = MIN, ury = MIN; X Xprolog(objects) XF_compound *objects; X{ X char host[256]; X struct passwd *who; X long when; X extern char *ctime(), *strcpy(); X extern long time(); X X fprintf(tfp, "%%!\n"); /* PostScript magic strings */ X who = getpwuid(getuid()); X if (-1 == gethostname(host, sizeof(host))) X (void)strcpy(host, "unknown-host!?!?"); X (void) time(&when); X fprintf(tfp, "%%%%Title: %s\n", ((from) ? from : "stdin")); X fprintf(tfp, "%%%%Creator: %s\n", prog); X fprintf(tfp, "%%%%CreationDate: %s", ctime(&when)); X fprintf(tfp, "%%%%For: %s@%s (%s)\n", X who->pw_name, host, who->pw_gecos); X fprintf(tfp, "%%%%Pages: %d\n", show_page); X fprintf(tfp, "%%%%BoundingBox: %d %d %d %d\n", llx, lly, urx, ury); X fprintf(tfp, "%%%%EndComments\n"); X fprintf(tfp, "%s\n", BEGIN_PROLOG); X if (ellipse_exist(objects)) fprintf(tfp, "%s\n", ELLIPSE_PS); X if (normal_spline_exist(objects)) fprintf(tfp, "%s\n", SPLINE_PS); X fprintf(tfp, "%s\n", END_PROLOG); X fprintf(tfp, "$F2psBegin\n"); X } X Xepilog() X{ X if (show_page) fprintf(tfp, "showpage\n"); X fprintf(tfp, "$F2psEnd\n"); X } X Xgenps_objects(objects) XF_compound *objects; X{ X double tx, scalex, scaley; X double dx, dy, origx, origy; X F_arc *a; X F_compound *c; X F_ellipse *e; X F_line *l; X F_spline *s; X F_text *t; X X /* Compute bounding box of objects */ X compound_bound(objects, &llx, &lly, &urx, &ury); X if (llx > urx) { X fprintf(stderr, "No object"); X return; X } X coord_system = objects->nwcorner.y; X reduction = POINT_PER_INCH / (float)objects->nwcorner.x; X scalex = scaley = scale * reduction; X /* convert to point unit */ X llx = (int)ceil(llx * scalex); lly = (int)ceil(lly * scaley); X urx = (int)ceil(urx * scalex); ury = (int)ceil(ury * scaley); X if (center) { X dx = urx - llx; X dy = ury - lly; X tx = (PAGE_WIDTH - dx) / 2.0; X origx = tx - llx; X urx = (llx=tx) + dx; X ury = (PAGE_HEIGHT + dy) / 2.0; X if (coord_system == 2) X origy = ury + lly; X else X origy = ury - dy - lly; X lly = ury - dy; X } X else { X origx = 0.0; X origy = PAGE_HEIGHT; X } X if (coord_system == 2) scaley = -scaley; X X prolog(objects); X X fprintf(tfp, "%f %f translate %.3f %.3f scale\n", X origx, origy, scalex, scaley); X X /* **** Land scape mode **** X *if (WIDTH > HEIGHT) { X * fprintf(tfp, "%d 0 translate 90 rotate\n", PAGE_WIDTH); X * if ((t = PAGE_HEIGHT / SCALE / WIDTH) < 1.0) X * fprintf(tfp, "%f %f scale\n", t, t); X * } X *else if ((t = PAGE_HEIGHT / SCALE / HEIGHT) < 1.0) X * fprintf(tfp, "%f %f scale\n", t, t); X */ X X for (a = objects->arcs; a != NULL; a = a->next) genps_arc(a); X for (c = objects->compounds; c != NULL; c = c->next) genps_compound(c); X for (e = objects->ellipses; e != NULL; e = e->next) genps_ellipse(e); X for (l = objects->lines; l != NULL; l = l->next) genps_line(l); X for (s = objects->splines; s != NULL; s = s->next) genps_spline(s); X for (t = objects->texts; t != NULL; t = t->next) genps_text(t); X epilog(); X } X Xset_style(s, v) Xint s; Xfloat v; X{ X if (s == DASH_LINE) { X if (v > 0.0) fprintf(tfp, "\t[%f] 0 setdash\n", v); X } X else if (s == DOTTED_LINE) { X if (v > 0.0) fprintf(tfp, "\t[1 %f] 0 setdash\n", v); X } X } X Xreset_style(s, v) Xint s; Xfloat v; X{ X if (s == DASH_LINE) { X if (v > 0.0) fprintf(tfp, "\t[] 0 setdash\n"); X } X else if (s == DOTTED_LINE) { X if (v > 0.0) fprintf(tfp, "\t[] 0 setdash\n"); X } X } X Xset_linewidth(w) Xint w; X{ X extern int cur_thickness; X X if (w != cur_thickness) { X cur_thickness = w; X fprintf(tfp, "%.3f setlinewidth\n", 0.7 * cur_thickness); X } X } X Xgenps_compound(com) XF_compound *com; X{ X F_arc *a; X F_compound *c; X F_ellipse *e; X F_line *l; X F_spline *s; X F_text *t; X X for (a = com->arcs; a != NULL; a = a->next) genps_arc(a); X for (c = com->compounds; c != NULL; c = c->next) genps_compound(c); X for (e = com->ellipses; e != NULL; e = e->next) genps_ellipse(e); X for (l = com->lines; l != NULL; l = l->next) genps_line(l); X for (s = com->splines; s != NULL; s = s->next) genps_spline(s); X for (t = com->texts; t != NULL; t = t->next) genps_text(t); X } X Xgenps_line(l) XF_line *l; X{ X F_point *p, *q; X X set_linewidth(l->thickness); X p = l->points; X q = p->next; X if (q == NULL) { /* A single point line */ X fprintf(tfp, "newpath %d %d moveto %d %d lineto stroke\n", X p->x, p->y, p->x, p->y); X return; X } X if (l->back_arrow) X draw_arrow_head((float)q->x, (float)q->y, (float)p->x, X (float)p->y, l->back_arrow->ht, l->back_arrow->wid); X set_style(l->style, l->style_val); X fprintf(tfp, "%% Polyline\n"); X fprintf(tfp, "newpath %d %d moveto", p->x, p->y); X while (q->next != NULL) { X p = q; X q = q->next; X fprintf(tfp, " %d %d lineto", p->x, p->y); X } X if (l->type == T_POLYLINE) X fprintf(tfp, " %d %d lineto stroke\n", q->x, q->y); X else X fprintf(tfp, " closepath stroke\n"); X reset_style(l->style, l->style_val); X if (l->for_arrow) X draw_arrow_head((float)p->x, (float)p->y, (float)q->x, X (float)q->y, l->for_arrow->ht, l->for_arrow->wid); X } X Xgenps_spline(s) XF_spline *s; X{ X if (int_spline(s)) X genps_itp_spline(s); X else X genps_ctl_spline(s); X } X Xgenps_itp_spline(s) XF_spline *s; X{ X F_point *p, *q; X F_control *a, *b; X X set_linewidth(s->thickness); X a = s->controls; X p = s->points; X if (s->for_arrow) X draw_arrow_head(a->rx, a->ry, (float)p->x, X (float)p->y, s->for_arrow->ht, s->for_arrow->wid); X X set_style(s->style, s->style_val); X fprintf(tfp, "%% Interpolated spline\n"); X fprintf(tfp, "newpath %d %d moveto\n", p->x, p->y); X for (q = p->next; q != NULL; p = q, q = q->next) { X b = a->next; X fprintf(tfp, "\t%.3f %.3f %.3f %.3f %d %d curveto\n", X a->rx, a->ry, b->lx, b->ly, q->x, q->y); X a = b; X b = b->next; X } X if (closed_spline(s)) fprintf(tfp, " closepath"); X fprintf(tfp, " stroke\n"); X reset_style(s->style, s->style_val); X X if (s->for_arrow) X draw_arrow_head(a->lx, a->ly, (float)p->x, X (float)p->y, s->for_arrow->ht, s->for_arrow->wid); X } X Xgenps_ctl_spline(s) XF_spline *s; X{ X float a, b, c, d, x1, y1, x2, y2, x3, y3; X F_point *p, *q; X X /* X if (first) { X first = FALSE; X fprintf(tfp, "%s\n", SPLINE_PS); X } X */ X X p = s->points; X x1 = p->x; y1 = p->y; X p = p->next; X c = p->x; d = p->y; X set_linewidth(s->thickness); X x3 = a = (x1 + c) / 2; X y3 = b = (y1 + d) / 2; X if (s->back_arrow) { X draw_arrow_head(c, d, x1, y1, s->back_arrow->ht, s->back_arrow->wid); X } X set_style(s->style, s->style_val); X if (! closed_spline(s)) { X fprintf(tfp, "%% Open spline\n"); X fprintf(tfp, "newpath %.3f %.3f moveto %.3f %.3f lineto\n", X x1, y1, x3, y3); X } X else { X fprintf(tfp, "%% Closed spline\n"); X fprintf(tfp, "newpath %.3f %.3f moveto\n", a, b); X } X for (q = p->next; q != NULL; p = q, q = q->next) { X x1 = x3; y1 = y3; X x2 = c; y2 = d; X c = q->x; d = q->y; X x3 = (x2 + c) / 2; X y3 = (y2 + d) / 2; X fprintf(tfp, "\t%.3f %.3f %.3f %.3f %.3f %.3f DrawSplineSection\n", X x1, y1, x2, y2, x3, y3); X } X /* X * At this point, (x2,y2) and (c,d) are the position of the X * next-to-last and last point respectively, in the point list X */ X if (closed_spline(s)) { X fprintf(tfp, "\t%.3f %.3f %.3f %.3f %.3f %.3f DrawSplineSection closepath stroke\n", X x3, y3, c, d, a, b); X } X else { X fprintf(tfp, "\t%.3f %.3f lineto stroke\n", c, d); X } X reset_style(s->style, s->style_val); X if (s->for_arrow) { X draw_arrow_head(x2, y2, c, d, s->for_arrow->ht, X s->for_arrow->wid); X } X } X Xgenps_ellipse(e) XF_ellipse *e; X{ X set_linewidth(e->thickness); X set_style(e->style, e->style_val); X fprintf(tfp, "%% Ellipse\n"); X fprintf(tfp, "newpath %d %d %d %d 0 360 DrawEllipse stroke\n", X e->center.x, e->center.y, e->radiuses.x, e->radiuses.y); X reset_style(e->style, e->style_val); X } X X#define TEXT_PS "\ X/%s findfont %f scalefont setfont\n\ X" Xgenps_text(t) XF_text *t; X{ X static int first = TRUE; X char *c; X X if (first) { X first = FALSE; X fprintf(tfp, TEXT_PS, font, font_size/reduction); X } X if (coord_system == 2) { X fprintf(tfp, "%d %d moveto 1 -1 scale (", t->base_x, t->base_y); X for (c = t->cstring; *c; c++) { X if (*c == '\\' || *c == '(' || *c == ')') putc('\\', tfp); X putc(*c, tfp); X } X fprintf(tfp, ") show 1 -1 scale\n"); X } X else if (coord_system == 1) { X fprintf(tfp, "%d %d moveto (", t->base_x, t->base_y); X for (c = t->cstring; c; ) { X if (*c == '\\' || *c == '(' || *c == ')') putc('\\', tfp); X putc(*c, tfp); X } X fprintf(tfp, ") show\n"); X } X } X Xgenps_arc(a) XF_arc *a; X{ X double angle1, angle2, dx, dy, radius, x, y; X double cx, cy, sx, sy, ex, ey; X int direction; X X cx = a->center.x; cy = a->center.y; X sx = a->point[0].x; sy = a->point[0].y; X ex = a->point[2].x; ey = a->point[2].y; X X if (coord_system == 2) X direction = !a->direction; X else X direction = a->direction; X set_linewidth(a->thickness); X if (a->for_arrow) { X arc_tangent(cx, cy, ex, ey, direction, &x, &y); X draw_arrow_head(x, y, ex, ey, a->for_arrow->ht, a->for_arrow->wid); X } X if (a->back_arrow) { X arc_tangent(cx, cy, sx, sy, !direction, &x, &y); X draw_arrow_head(x, y, sx, sy, a->back_arrow->ht, a->back_arrow->wid); X } X dx = cx - sx; X dy = cy - sy; X radius = sqrt(dx*dx + dy*dy); X angle1 = atan2(sy-cy, sx-cx) * 180 / M_PI; X angle2 = atan2(ey-cy, ex-cx) * 180 / M_PI; X /* direction = 1 -> Counterclockwise */ X set_style(a->style, a->style_val); X fprintf(tfp, "newpath %.3f %.3f %.3f %.3f %.3f %s stroke\n", X cx, cy, radius, angle1, angle2, X ((direction == 1) ? "arc" : "arcn")); X reset_style(a->style, a->style_val); X } X Xarc_tangent(x1, y1, x2, y2, direction, x, y) Xdouble x1, y1, x2, y2, *x, *y; Xint direction; X{ X if (direction) { /* counter clockwise */ X *x = x2 + (y2 - y1); X *y = y2 - (x2 - x1); X } X else { X *x = x2 - (y2 - y1); X *y = y2 + (x2 - x1); X } X } X X/* draw arrow heading from (x1, y1) to (x2, y2) */ X Xdraw_arrow_head(x1, y1, x2, y2, arrowht, arrowwid) Xfloat x1, y1, x2, y2, arrowht, arrowwid; X{ X float x, y, xb, yb, dx, dy, l, sina, cosa; X float xc, yc, xd, yd; X X dx = x2 - x1; dy = y1 - y2; X l = sqrt((double)(dx*dx + dy*dy)); X sina = dy / l; cosa = dx / l; X xb = x2*cosa - y2*sina; X yb = x2*sina + y2*cosa; X x = xb - arrowht; X y = yb - arrowwid / 2; X xc = x*cosa + y*sina; X yc = -x*sina + y*cosa; X y = yb + arrowwid / 2; X xd = x*cosa + y*sina; X yd = -x*sina + y*cosa; X fprintf(tfp, "newpath %.3f %.3f moveto %.3f %.3f lineto %.3f %.3f lineto stroke\n", X xc, yc, x2, y2, xd, yd); X } X Xellipse_exist(ob) XF_compound *ob; X{ X F_compound *c; X X if (NULL != ob->ellipses) return(1); X X for (c = ob->compounds; c != NULL; c = c->next) { X if (ellipse_exist(c)) return(1); X } X X return(0); X } X Xnormal_spline_exist(ob) XF_compound *ob; X{ X F_spline *s; X F_compound *c; X X for (s = ob->splines; s != NULL; s = s->next) { X if (normal_spline(s)) return(1); X } X X for (c = ob->compounds; c != NULL; c = c->next) { X if (normal_spline_exist(c)) return(1); X } X X return(0); X } END_OF_f2ps.c if test 15057 -ne `wc -c <f2ps.c`; then echo shar: \"f2ps.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f movept.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"movept.c\" else echo shar: Extracting \"movept.c\" \(16571 characters\) sed "s/^X//" >movept.c <<'END_OF_movept.c' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : Aug 1985. X * X * %W% %G% X*/ X#include "fig.h" X#include "resources.h" X#include "func.h" X#include "object.h" X#include "paintop.h" X X#define TOLERANCE 3 Xextern int latexline_mode, latexarrow_mode; Xextern int magnet_mode; X Xextern (*canvas_kbd_proc)(); Xextern (*canvas_locmove_proc)(); Xextern (*canvas_leftbut_proc)(); Xextern (*canvas_middlebut_proc)(); Xextern (*canvas_rightbut_proc)(); Xextern null_proc(); Xextern set_popupmenu(); XF_line *line_point_search(); XF_spline *spline_point_search(); XF_ellipse *ellipse_point_search(); XF_arc *arc_point_search(); X Xextern F_compound objects; X Xextern F_point *moved_point, *left_point; Xextern F_pos last_position, new_position; Xextern int movedpoint_num; Xextern int last_object; Xextern int fix_x, fix_y, cur_x, cur_y; Xextern int pointmarker_shown; Xextern int foreground_color, background_color; X Xextern elastic_box(), move_ebrbox(), move_ebdbox(); Xextern move_cbrbox(), move_cbdbox(); X X init_move_point(); X move_linepoint(), fix_movedlinepoint(); X move_latexlinepoint(), fix_movedlatexlinepoint(); X fix_box(); X fix_movedsplinepoint(); X move_arcpoint(), fix_movedarcpoint(); X fix_movedellipsepoint(); X Xstatic F_line *line; Xstatic F_spline *spline; Xstatic F_ellipse *ellipse; Xstatic F_arc *arc; X Xstatic int latex_fix_x, latex_fix_y; XCURSOR cur_latexcursor; X Xmove_point_selected() X{ X canvas_kbd_proc = null_proc; X canvas_locmove_proc = null_proc; X canvas_leftbut_proc = init_move_point; X canvas_middlebut_proc = null_proc; X canvas_rightbut_proc = set_popupmenu; X set_cursor(&pick9_cursor); X reset_action_on(); X } X Xinit_move_point(x, y) Xint x, y; X{ X if ((line = line_point_search(x, y, TOLERANCE, X &left_point, &moved_point)) != NULL) { X init_linepointmoving(line); X } X else if ((spline = spline_point_search(x, y, X TOLERANCE, &left_point, &moved_point)) != NULL){ X init_splinepointmoving(spline); X } X else if ((ellipse = ellipse_point_search(x, y, TOLERANCE, X &movedpoint_num)) != NULL) { X init_ellipsepointmoving(ellipse); X } X else if ((arc = arc_point_search(x, y, TOLERANCE, X &movedpoint_num)) != NULL) { X init_arcpointmoving(arc); X } X else { X return; X } X canvas_leftbut_proc = canvas_rightbut_proc = null_proc; X erase_pointmarker(); X } X Xwrapup_movepoint() X{ X show_pointmarker(); X move_point_selected(); X } X X/************************* ellipse *******************************/ X XF_ellipse * Xellipse_point_search(x, y, tol, point_num) Xint x, y, tol, *point_num; X{ X F_ellipse *e; X X for (e = objects.ellipses; e != NULL; e = e->next) { X if (abs(e->start.x - x) <= tol && abs(e->start.y - y) <= tol) { X *point_num = 0; X return(e); X } X if (abs(e->end.x - x) <= tol && abs(e->end.y - y) <= tol) { X *point_num = 1; X return(e); X } X } X return(NULL); X } X Xstatic F_ellipse *cur_e; X Xinit_ellipsepointmoving(ellipse) XF_ellipse *ellipse; X{ X if (movedpoint_num == 0) { /* starting point is selected */ X if (ellipse->type == T_ELLIPSE_BY_RAD || X ellipse->type == T_CIRCLE_BY_RAD) { X return; X } X last_position.x = cur_x = ellipse->start.x; X last_position.y = cur_y = ellipse->start.y; X fix_x = ellipse->end.x; fix_y = ellipse->end.y; X switch (ellipse->type) { X case T_ELLIPSE_BY_DIA : X canvas_locmove_proc = move_ebdbox; X ellipsebydia_box(INV_PAINT); X break; X case T_CIRCLE_BY_DIA : X canvas_locmove_proc = move_cbdbox; X circlebydia_box(INV_PAINT); X break; X } X } X else { X last_position.x = cur_x = ellipse->end.x; X last_position.y = cur_y = ellipse->end.y; X fix_x = ellipse->start.x; fix_y = ellipse->start.y; X switch (ellipse->type) { X case T_ELLIPSE_BY_RAD : X canvas_locmove_proc = move_ebrbox; X ellipsebyrad_box(INV_PAINT); X break; X case T_CIRCLE_BY_RAD : X canvas_locmove_proc = move_cbrbox; X circlebyrad_box(INV_PAINT); X break; X case T_ELLIPSE_BY_DIA : X canvas_locmove_proc = move_ebdbox; X ellipsebydia_box(INV_PAINT); X break; X case T_CIRCLE_BY_DIA : X canvas_locmove_proc = move_cbdbox; X circlebydia_box(INV_PAINT); X break; X } X } X cur_e = ellipse; X set_temp_cursor(&crosshair_cursor); X win_setmouseposition(canvas_swfd, cur_x, cur_y); X canvas_middlebut_proc = fix_movedellipsepoint; X canvas_leftbut_proc = null_proc; X } X Xfix_movedellipsepoint(x, y) Xint x, y; X{ X switch (cur_e->type) { X case T_ELLIPSE_BY_RAD : X ellipsebyrad_box(INV_PAINT); X break; X case T_CIRCLE_BY_RAD : X circlebyrad_box(INV_PAINT); X break; X case T_ELLIPSE_BY_DIA : X ellipsebydia_box(INV_PAINT); X break; X case T_CIRCLE_BY_DIA : X circlebydia_box(INV_PAINT); X break; X } X new_position.x = x; X new_position.y = y; X clean_up(); X set_action_object(F_MOVE_POINT, O_ELLIPSE); X set_latestellipse(cur_e); X relocate_ellipsepoint(cur_e, x, y, movedpoint_num); X wrapup_movepoint(); X } X Xrelocate_ellipsepoint(ellipse, x, y, point_num) XF_ellipse *ellipse; Xint x, y, point_num; X{ X int dx, dy; X X set_temp_cursor(&wait_cursor); X pw_batch_on(canvas_pixwin); X if (pointmarker_shown) toggle_ellipsepointmarker(ellipse); X draw_ellipse(ellipse, background_color); X if (point_num == 0) { /* starting point is selected */ X fix_x = ellipse->end.x; fix_y = ellipse->end.y; X ellipse->start.x = x; ellipse->start.y = y; X } X else { X fix_x = ellipse->start.x; fix_y = ellipse->start.y; X ellipse->end.x = x; ellipse->end.y = y; X } X switch (ellipse->type) { X case T_ELLIPSE_BY_RAD : X ellipse->radiuses.x = abs(x - fix_x) + 1; X ellipse->radiuses.y = abs(y - fix_y) + 1; X break; X case T_CIRCLE_BY_RAD : X dx = fix_x - x; dy = fix_y - y; X ellipse->radiuses.x = sqrt((double)(dx*dx + dy*dy)) + .5; X ellipse->radiuses.y = ellipse->radiuses.x; X break; X case T_ELLIPSE_BY_DIA : X ellipse->center.x = (fix_x + x) / 2; X ellipse->center.y = (fix_y + y) / 2; X ellipse->radiuses.x = abs(ellipse->center.x - fix_x); X ellipse->radiuses.y = abs(ellipse->center.y - fix_y); X break; X case T_CIRCLE_BY_DIA : X dx = ellipse->center.x = (fix_x + x) / 2 +.5; X dy = ellipse->center.y = (fix_y + y) / 2 +.5; X dx -= x; dy -= y; X ellipse->radiuses.x = sqrt((double)(dx*dx + dy*dy)) + .5; X ellipse->radiuses.y = ellipse->radiuses.x; X break; X } X draw_ellipse(ellipse, foreground_color); X if (pointmarker_shown) toggle_ellipsepointmarker(ellipse); X pw_batch_off(canvas_pixwin); X reset_cursor(); X set_modifiedflag(); X } X X/*************************** arc *********************************/ X Xstatic F_arc *cur_a; X XF_arc * Xarc_point_search(x, y, tol, point_num) Xint x, y, tol, *point_num; X{ X F_arc *a; X int i; X X for(a = objects.arcs; a != NULL; a = a->next) { X for (i = 0; i < 3; i++) { X if (abs(a->point[i].x - x) <= tol && X abs(a->point[i].y - y) <= tol) { X *point_num = i; X return(a); X } X } X } X return(NULL); X } X Xinit_arcpointmoving(arc) XF_arc *arc; X{ X cur_a = arc; X last_position.x = cur_x = arc->point[movedpoint_num].x; X last_position.y = cur_y = arc->point[movedpoint_num].y; X set_temp_cursor(&crosshair_cursor); X win_setmouseposition(canvas_swfd, cur_x, cur_y); X draw_arclink(INV_PAINT); X canvas_locmove_proc = move_arcpoint; X canvas_middlebut_proc = fix_movedarcpoint; X canvas_leftbut_proc = null_proc; X } X Xmove_arcpoint(x, y) Xint x, y; X{ X draw_arclink(INV_PAINT); X cur_x = x; cur_y = y; X draw_arclink(INV_PAINT); X } X Xdraw_arclink(op) Xint op; X{ X switch (movedpoint_num) { X case 0 : X pw_vector(canvas_pixwin, cur_x, cur_y, X arc->point[1].x, arc->point[1].y, op, 1); X break; X case 1 : X pw_vector(canvas_pixwin, arc->point[0].x, arc->point[0].y, X cur_x, cur_y, op, 1); X pw_vector(canvas_pixwin, arc->point[2].x, arc->point[2].y, X cur_x, cur_y, op, 1); X break; X default : X pw_vector(canvas_pixwin, arc->point[2].x, arc->point[2].y, X cur_x, cur_y, op, 1); X } X } X Xfix_movedarcpoint(x, y) Xint x, y; X{ X draw_arclink(INV_PAINT); X new_position.x = x; X new_position.y = y; X clean_up(); X set_action_object(F_MOVE_POINT, O_ARC); X set_latestarc(cur_a); X relocate_arcpoint(cur_a, x, y, movedpoint_num); X wrapup_movepoint(); X } X Xrelocate_arcpoint(arc, x, y, movedpoint_num) XF_arc *arc; Xint x, y, movedpoint_num; X{ X float xx, yy; X F_pos p[3]; X X p[0] = arc->point[0]; X p[1] = arc->point[1]; X p[2] = arc->point[2]; X p[movedpoint_num].x = x; X p[movedpoint_num].y = y; X if (compute_arccenter(p[0], p[1], p[2], &xx, &yy)) { X set_temp_cursor(&wait_cursor); X pw_batch_on(canvas_pixwin); X if (pointmarker_shown) toggle_arcpointmarker(arc); X draw_arc(arc, background_color); /* erase old arc */ X arc->point[movedpoint_num].x = x; X arc->point[movedpoint_num].y = y; X arc->center.x = xx; X arc->center.y = yy; X arc->direction = compute_direction(p[0], p[1], p[2]); X draw_arc(arc, foreground_color); /* draw new arc */ X if (pointmarker_shown) toggle_arcpointmarker(arc); X pw_batch_off(canvas_pixwin); X reset_cursor(); X set_modifiedflag(); X } X } X X/************************** spline *******************************/ X Xstatic F_spline *cur_s; X Xinit_splinepointmoving(s) XF_spline *s; X{ X F_point *p; X X cur_s = s; X last_position.x = cur_x = moved_point->x; X last_position.y = cur_y = moved_point->y; X set_temp_cursor(&crosshair_cursor); X win_setmouseposition(canvas_swfd, cur_x, cur_y); X if (closed_spline(s) && left_point == NULL) { X for (left_point = moved_point->next, X p = left_point->next; X p->next != NULL; X left_point = p, p = p->next); X } X draw_pointlink(INV_PAINT); X canvas_locmove_proc = move_linepoint; X canvas_middlebut_proc = fix_movedsplinepoint; X canvas_leftbut_proc = null_proc; X } X XF_spline * Xspline_point_search(x, y, tol, p, q) Xint x, y, tol; XF_point **p, **q; X{ X F_spline *s; X X for (s = objects.splines; s != NULL; s= s->next) { X *p = NULL; X for (*q = s->points; *q != NULL; *p = *q, *q = (*q)->next) { X if (abs((*q)->x - x) <= tol && abs((*q)->y - y) <= tol) X return(s); X } X } X return(NULL); X } X Xfix_movedsplinepoint(x, y) Xint x, y; X{ X draw_pointlink(INV_PAINT); X new_position.x = x; X new_position.y = y; X clean_up(); X set_action_object(F_MOVE_POINT, O_SPLINE); X set_latestspline(cur_s); X relocate_splinepoint(cur_s, x, y, moved_point); X wrapup_movepoint(); X } X Xrelocate_splinepoint(s, x, y, moved_point) XF_spline *s; Xint x, y; XF_point *moved_point; X{ X set_temp_cursor(&wait_cursor); X pw_batch_on(canvas_pixwin); X if (pointmarker_shown) toggle_splinepointmarker(s); X draw_spline(s, ERASE); /* erase old spline */ X moved_point->x = x; X moved_point->y = y; X if (closed_spline(s)) { X left_point->next->x = x; X left_point->next->y = y; X } X if (int_spline(s)) remake_control_points(s); X draw_spline(s, PAINT); /* draw spline with moved point */ X if (pointmarker_shown) toggle_splinepointmarker(s); X pw_batch_off(canvas_pixwin); X reset_cursor(); X set_modifiedflag(); X } X X/*************************** line ********************************/ X Xstatic F_line *cur_l; X Xinit_linepointmoving(line) XF_line *line; X{ X int box_case; X int latex_case; X F_point *p; X X cur_l = line; X box_case = 0; X latex_case = 0; X last_position.x = cur_x = moved_point->x; X last_position.y = cur_y = moved_point->y; X set_temp_cursor(&crosshair_cursor); X win_setmouseposition(canvas_swfd, cur_x, cur_y); X switch (line->type) { X case T_POLYGON : X if (left_point == NULL) X for (left_point = moved_point->next, X p = left_point->next; X p->next != NULL; X left_point = p, p = p->next); X break; X case T_BOX : X if (moved_point->next->next == NULL) { /* point 4 */ X fix_x = line->points->next->x; X fix_y = line->points->next->y; X } X else { X fix_x = moved_point->next->next->x; X fix_y = moved_point->next->next->y; X } X draw_line(line, ERASE); X box_case = 1; X break; X case T_POLYLINE : X if (left_point != NULL) { X if (left_point == line->points) { X if (line->back_arrow) /* backward arrow */ X draw_arrow(cur_x, cur_y, X left_point->x, left_point->y, X line->back_arrow, ERASE); X } X } X else if (line->back_arrow) /* backward arrow */ X draw_arrow(moved_point->next->x, moved_point->next->y, X cur_x, cur_y, line->back_arrow, ERASE); X p = moved_point->next; X if (p != NULL) { X if (line->for_arrow && p->next == NULL) X draw_arrow(cur_x, cur_y, p->x, p->y, X line->for_arrow, ERASE); X } X else if (line->for_arrow)/* f arrow */ X draw_arrow(left_point->x, left_point->y, X cur_x, cur_y, line->for_arrow, ERASE); X if (latexline_mode || latexarrow_mode) { X if (left_point != NULL) { X latex_fix_x = left_point->x; X latex_fix_y = left_point->y; X latex_case = 1; X } X else if (p != NULL) { X latex_fix_x = p->x; X latex_fix_y = p->y; X latex_case = 1; X } X } X } X if (box_case) { X draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT); X canvas_locmove_proc = elastic_box; X canvas_middlebut_proc = fix_box; X } X else if (latex_case) { X draw_pointlink(INV_PAINT); X canvas_locmove_proc = move_latexlinepoint; X canvas_middlebut_proc = fix_movedlatexlinepoint; X cur_latexcursor = &crosshair_cursor; X } X else { X draw_pointlink(INV_PAINT); X canvas_locmove_proc = move_linepoint; X canvas_middlebut_proc = fix_movedlinepoint; X } X canvas_leftbut_proc = null_proc; X } X Xmove_linepoint(x, y) Xint x, y; X{ X draw_pointlink(INV_PAINT); X cur_x = x; X cur_y = y; X draw_pointlink(INV_PAINT); X } X Xmove_latexlinepoint(x, y) Xint x, y; X{ X CURSOR c; X X draw_pointlink(INV_PAINT); X latex_endpoint(latex_fix_x, latex_fix_y, x, y, &cur_x, &cur_y, X latexarrow_mode, (magnet_mode)? 5: 1); X draw_pointlink(INV_PAINT); X c = (x == cur_x && y == cur_y)? &null_cursor: &crosshair_cursor; X if (c != cur_latexcursor) { X set_temp_cursor(c); X cur_latexcursor = c; X } X } X Xfix_box(x, y) Xint x, y; X{ X draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT); X new_position.x = x; X new_position.y = y; X clean_up(); X set_action_object(F_MOVE_POINT, O_POLYLINE); X set_latestline(line); X relocate_linepoint(line, x, y, fix_x, fix_y, moved_point, X left_point); X wrapup_movepoint(); X } X Xassign_newboxpoint(b, x1, y1, x2, y2) XF_line *b; Xint x1, y1, x2, y2; X{ X F_point *p; X X p = b->points; X p->x = x1; p->y = y1; p = p->next; X p->x = x1; p->y = y2; p = p->next; X p->x = x2; p->y = y2; p = p->next; X p->x = x2; p->y = y1; p = p->next; X p->x = x1; p->y = y1; p = p->next; X } X Xfix_movedlinepoint(x, y) Xint x, y; X{ X draw_pointlink(INV_PAINT); X new_position.x = x; X new_position.y = y; X clean_up(); X set_action_object(F_MOVE_POINT, O_POLYLINE); X set_latestline(cur_l); X relocate_linepoint(cur_l, x, y, fix_x, fix_y, moved_point, left_point); X wrapup_movepoint(); X } X Xfix_movedlatexlinepoint(x, y) Xint x, y; X{ X draw_pointlink(INV_PAINT); X latex_endpoint(latex_fix_x, latex_fix_y, x, y, &x, &y, X latexarrow_mode, (magnet_mode)? 5: 1); X if (cur_latexcursor != &crosshair_cursor) X set_temp_cursor(&crosshair_cursor); X win_setmouseposition(canvas_swfd, x, y); X new_position.x = x; X new_position.y = y; X clean_up(); X set_action_object(F_MOVE_POINT, O_POLYLINE); X set_latestline(cur_l); X relocate_linepoint(cur_l, x, y, fix_x, fix_y, moved_point, left_point); X wrapup_movepoint(); X } X Xrelocate_linepoint(line, x, y, fix_x, fix_y, moved_point, left_point) XF_line *line; Xint x, y; XF_point *moved_point, *left_point; X{ X if (pointmarker_shown) toggle_linepointmarker(line); X draw_line(line, ERASE); X switch (line->type) { X case T_BOX : X assign_newboxpoint(line, fix_x, fix_y, x, y); X break; X case T_POLYGON : X if (line->points == moved_point) { X left_point->next->x = x; X left_point->next->y = y; X } X default : X moved_point->x = x; X moved_point->y = y; X } X draw_line(line, PAINT); X if (pointmarker_shown) toggle_linepointmarker(line); X set_modifiedflag(); X } X Xdraw_pointlink(op) Xint op; X{ X F_point *p; X X if (left_point != NULL) { X pw_vector(canvas_pixwin, left_point->x, left_point->y, X cur_x, cur_y, op, 1); X } X if ((p = moved_point->next) != NULL) { X pw_vector(canvas_pixwin, p->x, p->y, cur_x, cur_y, op, 1); X } X } X XF_line * Xline_point_search(x, y, tol, p, q) Xint x, y, tol; XF_point **p, **q; X{ X F_line *l; X F_point *a, *b; X X for (l = objects.lines; l != NULL; l= l->next) { X for (a = NULL, b = l->points; b != NULL; a = b, b = b->next) { X if (abs(b->x - x) <= tol && abs(b->y - y) <= tol) { X *p = a; X *q = b; X return(l); X } X } X } X return(NULL); X } END_OF_movept.c if test 16571 -ne `wc -c <movept.c`; then echo shar: \"movept.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f xfig.1 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"xfig.1\" else echo shar: Extracting \"xfig.1\" \(15270 characters\) sed "s/^X//" >xfig.1 <<'END_OF_xfig.1' X.TH XFIG 1 "8 August 1988" X.SH NAME Xxfig \- Facility for Interactive Generation of figures under X11 X.SH SYNOPSIS X.B xfig X\fB[ -ri[ght] ]\fP X\fB[ -l[andscape] ]\fP X\fB[ -p[ortrait] ]\fP X\fB[ -w[idth] inches ]\fP X\fB[ -h[eight] inches ]\fP X\fB[\fP \fIfile\fP \fB]\fP X.SH DESCRIPTION X.I Xfig Xis a menu-driven tool that allows the user to draw and manipulate objects Xinteractively in an X window. It runs under X version 11 release 2 and Xrequires a three-button mouse. X.I File Xspecifies the name of a file to be edited. The description of objects in Xthe file will be read at the start of \fIxfig\fP. X.PP XThe output from \fIxfig\fP can be printed in several ways X.PP X.B troff - Xf2p (\fIxfig\fP to \fIpic\fP(1) translator, also known by its previous Xname \fIftop\fP(1L)) is used to translate \fIxfig\fP files into X.IR pic (1) Xlanguage. XThe resulting file may then be processed in the same maner as any other X.I pic Xfile. X.PP X.B postscript - Xf2ps (\fIxfig\fP to \fIpostscript\fP translator) is used to produce Xa X.I postscript Xfile from an X.I xfig Xfile. XThe X.I postscript Xfile can be sent directly to a postscript printer. X.PP X.B LaTeX - Xfig2latex (\fIxfig\fP to \fILaTeX\fP translator) produces a X.I LaTeX Xfile from an X.I xfig Xfile. XThis file contains X.I LaTeX Xpicture environment commands and can be Xprocessed along with other X.I LaTeX Xcommands. X.PP X.B PiCTeX - Xfig2tex (\fIxfig\fP to \fIPiCTeX\fP translator) produces a X.I PiCTeX Xfile from an X.I xfig Xfile. This file contains macros that can be Xused with the X.I PiCTeX Xenvironment under X.I TeX Xor X.I LaTeX. X.SH OPTIONS X.TP X.B \-ri XChange the position of the panel window to the right of the canvas window X(default: left). X.TP X.B \-l XMake \fIxfig\fP come up in landscape mode (10" x 7"). X.TP X.B \-p XMake \fIxfig\fP come up in portrait mode (7" x 10"). This is the Xdefault. X.TP X\fB-w\fP \fIinches\fP XMake \fIxfig\fP come up \fIinches\fP wide. X.TP X\fB-h\fP \fIinches\fP XMake \fIxfig\fP come up \fIinches\fP high. X.SH "GRAPHICAL OBJECTS" XThe objects in \fIxfig\fP are divided into \fBprimitive objects\fP and X\fBcompound object\fP. The primitive objects are: \fIARC\fP, \fICIRCLE\fP, X\fICLOSED SPLINE\fP, \fIELLIPSE\fP, \fIPOLYLINE\fP, \fIPOLYGON\fP, X\fISPLINE\fP, and \fITEXT\fP. A primitive can be moved, rotated, Xflipped, copied or erased. XA compound object is composed of primitive objects. The primitive objects Xthat constitute a compound can not be individually modified, but they can Xbe manipulated as an entity; a compound can be moved, rotated, flipped, Xcopied or erased. An extra function that can be applied to a compound Xobject is \fBscaling\fP, which is not available for primitive objects. X.SH "DISPLAY WINDOWS" XFive windows comprise the display area of \fIxfig\fP: the Xtop ruler, the side ruler, the panel window, the message window, Xand the canvas window. XThe message window always appears below the others; Xit is the area in which messages are sent and received. XThe panel window can be placed to the left or right of the Xthe canvas window (default: left). X.SH "POP-UP MENU" XThe pop-up menu appears when the right mouse button is pressed with the Xcursor positioned within the canvas window. XPositioning the cursor over the desired menu entry and releasing the Xbutton selects a menu entry. X.PP XThere are a number of file accessing functions in the pop-up menu. XMost of the time when one of these functions is selected, the user Xwill be asked for a file name. If the specified file can be located Xand the access permission are granted, \fIxfig\fP will carry out Xthe function. However in case things go wrong, \fIxfig\fP will Xabort the function and printed the causes on the message window. X.TP X.I Undo XUndo the last object creation or modification. X.TP X.I Redisplay XRedraw the canvas. X.TP X.I Remove all XRemove all objects on the canvas window (can be undone). X.TP X.I Edit file ... XThe current contents of the canvas are cleared and objects Xare read from the specified file. XThe user will be asked for a file name. XThis file will become the current file. X.TP X.I Save XSave the current contents of the canvas in the current file. XIf no file is being edited, the user will be asked for a file Xname as in the "Save in ..." function. X.TP X.I Read file ... XRead objects from the specified file and merge them with objects already Xshown on the canvas. X(The user will be asked for a file name.) X.TP X.I Save as ... XSave objects on the screen into a file specified by the user. X(The user will be asked for a file name.) X.TP X.I Status XShow the name of the current file and directory. X.TP X.I Change Directory XChange the working directory. Any file name without a full path name Xwill employ the current working directory. X.TP X.I Save & Exit XSave the objects in the current file and exit from \fIxfig\fP. XIf there is no current file, the user will be asked for a file name. XNo confirmation will be asked. X.TP X.I Quit XExit from \fIxfig\fP, discarding all objects. The user will be asked to Xconfirm the action, by clicking the left button. X.TP X.I Save as BITMAP ... XCreate a bitmap picture of the drawings for use with other tools (for example, Xfor use as an icon). The smallest rectangular area of pixels Xthat encompasses the figure is written to the named file X(the user will be asked for a file name) from Xtop row to bottom and left to right (in Sun raster format). XOnly \fITEXT\fP objects that are parts of compound objects will be Xtreated as parts of the picture; other texts are saved as objects in X\fIxfig\fP format following the bitmap data. XThe coordinates of these text objects can be used Xto identify locations on the bitmap. X.SH "PANEL WINDOW MANIPULATION FUNCTIONS" XIcons in the panel window represent object manipulation functions, Xmodes and other drawing or modification aids. XManipulation functions are selected by positioning the cursor over it and Xclicking the left mouse button. The selected icon is highlighted, and Xa message describing its function appears in the message window. X.PP XThe left and middle buttons are used to creat and modify objects in the canvas Xwindow. Most actions start with clicking of the left button Xand end with clicking of the right button. XThere is no need to hold down a button while positioning Xthe cursor. X.SH "PANEL WINDOW COMMAND DESCRIPTIONS" XEntries in the panel window can be classified into two categories: Xobject creation/modification/removal commands (only one of which may be active Xat any one time), and drawing aids (which act as toggle switches). XThere are two ways for drawing circles, two for ellipses, two for splines Xand two for closed splines. XThere are two basic splines. One is the interpolated spline Xin which the spline pass thorough the entered points (knots). XThe other is the normal spline in which on control points are Xpassed by the spline (except for the two end points in the open spline). X.SH "OBJECT CREATION/MODIFICATION/REMOVAL" XMultiple commands are grouped thematically in the following Xdescriptions (which is listed alphabetically). X.TP X.I ADD/DELETE ARROWS XAdd or delete arrow heads for \fIPOLYLINE\fP, \fIPOLYGON\fP, \fISPLINE\fP Xor \fICLOSED SPLINE\fP objects (points of a \fIBOX\fP can not be added or Xdeleted). X.TP X.I ADD/DELETE POINTS XAdd or delete points for \fIPOLYLINE\fP, \fIPOLYGON\fP, \fISPLINE\fP Xor \fICLOSED SPLINE\fP objects (points of a \fIBOX\fP can not be added Xor deleted). X.TP X.I ARC XCreate an arc. Specify three points using the left button. X.TP X.I BOX XCreate rectangular boxes. Start with the left button and terminate with Xthe right button. X.TP X.I BREAK COMPOUND XBreak a compound object to allow manipulation of its component parts. XClick the left button on the bounding box of Xthe compound object. X.TP X.I CIRCLE XCreate circles by specifying their radii or diameters. XClick the left button on the canvas window, move the cursor until the Xdesired radius or diameter is reached, then click the middle button to Xterminate. The circle will be drawn after the pressing of the middle button. X.TP X.I CLOSED INTERPOLATED SPLINE XCreate closed or periodic splines. The function is similar Xto \fIPOLYGON\fP except that a closed interpolated spline is drawn. XThe spline will pass through the points (knots). X.TP X.I CLOSED SPLINE XCreate closed or periodic spline objects. XThe function is similar to \fIPOLYGON\fP Xexcept that a closed spline will be drawn instead of polygon. XThe entered points are just control points; i.e., the spline will Xnot pass any of these points. X.TP X.I COPY XCopy object. Click the left button over part of the object to be Xcopied (for \fICIRCLE\fP and \fIELLIPSE\fP Xobjects, position on their circumferences). Drag the object to the desired Xposition and click the middle button. XThis function as well as the following three functions X(\fIMOVE\fP, \fIMOVE POINT\fP, \fIREMOVE\fP) Xwill cause point markers (manipulation aids) to be shown on the canvas window. XThere are no markers for \fICIRCLE\fP or \fIELLIPSE\fP objects. X.TP X.I ELLIPSE XCreate ellipses using the same procedure as for the drawing of circles. X.TP X.I GLUE XGlue the primitive objects within a bounding box into a compound object X(the bounding box itself is not part of the figure; Xit is a visual aid for manipulating the compound). X.TP X.I INTERPOLATED SPLINE XCreate (cubic spline) spline objects. XEnter control vectors in the same way as for creation of a X\fIPOLYLINE\fP object. XAt least three points (two control vectors) must be entered. XThe spline will pass through the entered points. X.TP X.I MOVE XMove objects in the same way as in \fICOPY\fP. X.TP X.I MOVE POINT XModify the position of points of \fIPOLYLINE, \fIBOX\fP, \fIPOLYGON\fP, X\fIELLIPSE\fP, \fIARC\fP and \fISPLINE\fP Xobjects. Click the left button over the desired point, reposition the point, Xand click the middle button. Note that \fIBOX\fP and \fIPOLYGON\fP Xobjects are internally stored as \fIPOLYLINE\fP Xobjects, and therefore moving certain points may open these objects. X.TP X.I POLYGON XSame as \fIPOLYLINE\fP Xexcept that a line segment is drawn connecting the first and last Xpoints entered. X.TP X.I POLYLINE XCreate polylines (line segments connecting a sequence of points). XEnter points by clicking the left button at the desired positions on the Xcanvas window. Click the middle button to terminate. X.TP X.I REMOVE XRemove (or delete) objects. X.TP X.I SCALE COMPOUND XOnly compound objects can be scaled. Click the left button Xon a corner of the bounding box, stretch the Xbounding box to the desired size, and click the middle button. X.TP X.I SPLINE XCreate (quadratic spline) spline objects. XEnter control vectors in the same way as for creation of a X\fIPOLYLINE\fP object. XAt least three points (two control vectors) must be entered. XThe spline will pass only the two end points. X.TP X.I TEXT XCreate text strings. Click the left button at the desired position on Xthe canvas window, then enter text from the keyboard. XTerminate by clicking the middle button or typing the return key. X.TP X.I TURN XTurn \fIPOLYGON\fP into a \fICLOSED INTERPOLATED SPLINE\fP object, or Xturn \fIPOLYLINE\fP into a \fIINTERPOLATED SPLINE\fP object. X.SH "DRAWING AIDS" XDrawing aids act as toggle switches. More than one can be selected at a time X(except for \fIGRID\fP and the line drawing modes). X.TP X.I AUTO FORWARD/BACKWARD ARROW XAutomatically add forward/backward arrow heads to \fIPOLYLINE\fP, \fISPLINE\fP Xor \fIARC\fP objects. X.TP X.I FLIP XInvert the object (middle button) or produce a mirror-image copy of an Xobject (left button). Point to part of the object ("the handle"), click Xthe appropriate button. X.TP X.I GRID XDisplay either the quarter- or half-inch grids (left button). X.TP X.I MAGNET XRound points to the nearest 1/16 of an inch. XThis affects every function, and is provided as an alignment aid. X.TP X.I UNRESTRICTED XAllow lines to be drawn with any slope. X.TP X.I MANHATTAN XEnforce drawing of lines in the horizontal and vertical direction only. XBoth \fIMANHATTAN\fP and \fIMOUNTAIN\fP can be turned on simultaneously. The Xcreations of \fIPOLYGON\fP, \fIPOLYLINE\fP and \fISPLINE\fP objects are Xaffected by these two modes. X.TP X.I MOUNTAIN XEnforce drawing of only diagonal lines. Both \fIMANHATTAN\fP Xand \fIMOUNTAIN\fP can be turned on simultaneously. The creations Xof \fIPOLYGON\fP, \fIPOLYLINE\fP and \fISPLINE\fP objects are affected Xby these two modes. X.TP X.I MANHATTAN MOUNTAIN XAllow lines to be drawn at any slope allowed when in XMOUNTIAIN or MANHATTAN modes. X.TP X.I LATEX LINE XAllow lines to be drawn only at slopes which can be handled by LaTeX picture Xenvironment lines: slope = x/y, where x,y are integers in the range [-6,6]. X.TP X.I LATEX VECTOR XAllow lines to be drawn only at slopes which can be handled by LaTeX picture Xenvironment vectors: slope = x/y, where x,y are integers in the range [-4,4]. X.TP X.I ROTATE XRotate the object (middle button) or copy (left button) +90 degrees. X.TP X.I SOLID/DASHED LINE STYLE XToggle between solid and dashed line styles. The dash length Xis fixed at 0.05 inch. X.SH X DEFAULTS XThe overall widget name(Class) is xfig.fig(Fig.TopLevelShell). Below Xis a listing of the interesting widgets. X.TP 1.5i Xoverall window Xform(Form) X.TP Xside panel Xform.panel(Form.Box) X.TP Xicons Xform.panel.button(Form.Box.Command) X.TP Xtop ruler Xform.truler(Form.Label) X.TP Xside ruler Xform.sruler(Form.Label) X.TP Xcanvas Xform.canvas(Form.Label) X.TP Xmessage window Xform.message(Form.Command) X.TP Xmenu Xform.popup_menu.menu(Form.OverrideShell.Box) X.TP Xmenu title Xform.popup_menu.menu.title(Form.OverrideShell.Box.Label) X.TP Xmenu items Xform.popup_menu.menu.pane(Form.OverrideShell.Box.Command) X.PP XFor example, to set the background of the panel to blue the resource Xwould be: X.br X\f(CWxfig*form.panel.background: blue\fP X.PP X\fBNOTE\fP: The font used in the canvas cannot be changed at this Xtime. X.SH BUGS XText strings will appear differently on hard copy, because the display Xfonts are fixed-width fonts while the fonts used by the typesetter Xsystems are variable-width fonts. X.PP XA double quote in a text string should be preceded by a back slash if the Xit is to be printed through X.IR pic (1). X.PP XObjects that extend beyond the canvas window may cause image shrinkage in Xhard copy printed by X.IR pic (1), Xsince it will try to fit every object onto a single 8.5" x 11" page. X.PP XEllipses which are too narrow may cause \fIxfig\fP to loop forever. X.PP XObjects which are created while one of the X.I grids Xis on may appear ragged. This can be corrected by selecting \fIRedisplay\fP Xfrom the pop-up menu. X.PP XThe X11 cursors are not the original ones but chosen from X11's cursor font. X.SH "SEE ALSO" XBrian W. Kernighan X.I "PIC - A Graphics Language for Typesetting User Manual" X.br Xditroff(1), f2p(1), f2ps(1), fig2latex(1), fig2tex(1), pic(1), Xtroff(1), tex(1), latex(1) X.SH ACKNOWLEDGEMENT XMany thanks goes to Professor Donald E. Fussell who inspired the Xcreation of this tool. X.SH AUTHOR XSupoj Sutanthavibul X.br XUniversity of Texas at Austin X.br X(supoj@sally.UTEXAS.EDU) X.sp XManual page modified by R. P. C. Rodgers, UCSF School of Pharmacy, XSan Francisco, CA 94118 X.sp XFrank Schmuck of Cornell contributed the LaTeX line drawing modes. X.sp XX11 port by Ken Yap (ken@cs.rochester.edu). X.sp XVariable window sizes, cleanup of X11 port, right hand side panel Xunder X11, X11 manual page provided by Dana Chee (dana@bellcore.com). END_OF_xfig.1 if test 15270 -ne `wc -c <xfig.1`; then echo shar: \"xfig.1\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 9 \(of 11\). cp /dev/null ark9isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 11 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330