argv%turnpike@Sun.COM (Dan Heller) (03/06/90)
Submitted-by: Brian Smith <bvsmith@lbl.gov> Posting-number: Volume 6, Issue 15 Archive-name: xfig2/part07 #! /bin/sh # This is a shell archive. Remove anything before this line, then feed it # into a shell via "sh file" or similar. To overwrite existing files, # type "sh file -c". # The tool that generated this appeared in the comp.sources.unix newsgroup; # send mail to comp-sources-unix@uunet.uu.net if you want that tool. # If this archive is complete, you will see the following message at the end: # "End of archive 7 (of 15)." # Contents: xfig/bitmap.c xfig/movept.c xfig/undo.c xfig/xfig.l # Wrapped by argv@turnpike on Wed Feb 28 10:53:20 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'xfig/bitmap.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xfig/bitmap.c'\" else echo shar: Extracting \"'xfig/bitmap.c'\" \(2013 characters\) sed "s/^X//" >'xfig/bitmap.c' <<'END_OF_FILE' 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 "object.h" X#include "paintop.h" X Xextern F_compound objects; X Xextern int errno; Xextern int DEBUG; Xextern int pointmarker_shown; Xextern int compoundbox_shown; X Xextern char *sys_errlist[]; Xextern int sys_nerr, errno; X Xwrite_bitmap(file_name) Xchar *file_name; X{ X FILE *fp; X struct stat file_status; X char string[180]; X X if (*file_name == 0) { X put_msg("No file"); X return; X } X if (stat(file_name, &file_status) == 0) { /* file exists */ X if (file_status.st_mode & S_IFDIR) { X put_msg("\"%s\" is a directory", file_name); X return; X } X if (file_status.st_mode & S_IWRITE) { /* writing is permitted */ X if (file_status.st_uid != geteuid()) { X put_msg("\"%s\" permission is denied", file_name); X return; X } X else { X sprintf(string, "\"%s\" File exists. Please click the LEFT button to COMFIRM overwrite. To cancel, click the MIDDLE or RIGHT button.", file_name); X if (wmgr_confirm(canvas_swfd, string) != -1) { X put_msg("No write."); X return; X } X } X } X else { X put_msg("\"%s\" File is read only", file_name); X return; X } X } X else if (errno != ENOENT) return; /* file does exist but stat fails */ X X if ((fp = fopen(file_name, "w")) == NULL) { X blink_msg(); X put_msg("Couldn't open file %s, %s", file_name, sys_errlist[errno]); X return; X } X else { X create_n_write_bitmap(fp); X } X } X Xcreate_n_write_bitmap(fp) XFILE *fp; X{ X int box, marker, xmin, ymin, xmax, ymax; X PIXRECT bitmap, pw_pixrect, pw_prretained; X F_text *t; X X /* Assume that there is at least one object */ X compound_bound(&objects, &xmin, &ymin, &xmax, &ymax); X X if (DEBUG) { X draw_rectbox(xmin, ymin, xmax, ymax, INV_PAINT, 1); X } X put_msg("Sorry, write_bitmap not implemented for X11 yet"); X } X END_OF_FILE if test 2013 -ne `wc -c <'xfig/bitmap.c'`; then echo shar: \"'xfig/bitmap.c'\" unpacked with wrong size! fi # end of 'xfig/bitmap.c' fi if test -f 'xfig/movept.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xfig/movept.c'\" else echo shar: Extracting \"'xfig/movept.c'\" \(16859 characters\) sed "s/^X//" >'xfig/movept.c' <<'END_OF_FILE' 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 case T_ARC_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 if (line->type == T_ARC_BOX) X draw_arc_box(line, ERASE); X else 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, 1); 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, 1); 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 register int tmp; X X p = b->points; X if (x1 > x2) /* sort them so that lower left is first */ X { X tmp = x1; x1 = x2; x2 = tmp; X } X if (y1 > y2) X { X tmp = y1; y1 = y2; y2 = tmp; X } 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 case T_ARC_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_FILE if test 16859 -ne `wc -c <'xfig/movept.c'`; then echo shar: \"'xfig/movept.c'\" unpacked with wrong size! fi # end of 'xfig/movept.c' fi if test -f 'xfig/undo.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xfig/undo.c'\" else echo shar: Extracting \"'xfig/undo.c'\" \(13275 characters\) sed "s/^X//" >'xfig/undo.c' <<'END_OF_FILE' X/* X * FIG : Facility for Interactive Generation of figures X * X * Copyright (c) 1985, 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU) X * January 1985. X * 1st revision : August 1985. X * 2nd revision : March 1988. 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 Xextern int pointmarker_shown, compoundbox_shown; X Xextern int foreground_color, background_color; Xextern int last_action, last_object; Xextern int last_axis, last_rotateangle; Xextern int movedpoint_num; Xextern int fix_x, fix_y; Xextern F_pos last_position, new_position; X Xextern F_compound objects; Xextern F_compound saved_objects; Xextern F_compound object_tails; X Xextern F_point *left_point; Xextern F_point *moved_point; Xextern F_point *deleted_point; Xextern F_point *added_point; X Xundo() X{ X switch(last_action) { X case F_CREATE : X undo_create(); X break; X case F_REMOVE : X undo_remove(); X break; X case F_MOVE : X undo_move(); X break; X case F_MOVE_POINT : X undo_movepoint(); X break; X case F_FLIP : X undo_flip(); X break; X case F_ROTATE : X undo_rotate(); X break; X case F_GLUE : X undo_glue(); X break; X case F_BREAK : X undo_break(); X break; X case F_SCALE : X undo_scale(); X break; X case F_ADD_POINT : X undo_addpoint(); X break; X case F_DELETE_POINT : X undo_deletepoint(); X break; X default : X return; X } X } X Xundo_addpoint() X{ X if (last_object == O_POLYLINE) X linepoint_deleting(saved_objects.lines); X else X splinepoint_deleting(saved_objects.splines); X last_action = F_DELETE_POINT; X deleted_point = added_point; X } X Xundo_deletepoint() X{ X if (last_object == O_POLYLINE) X linepoint_adding(saved_objects.lines, deleted_point); X else X splinepoint_adding(saved_objects.splines, deleted_point); X last_action = F_ADD_POINT; X added_point = deleted_point; X } X Xundo_break() X{ X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X cut_objects(&objects, &object_tails); X insert_compound(&objects.compounds, saved_objects.compounds); X last_action = F_GLUE; X } X Xundo_glue() X{ X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X delete_compound(&objects.compounds, saved_objects.compounds); X append_objects(&objects, saved_objects.compounds, &object_tails); X last_action = F_BREAK; X } X X/* XWhen a single object is created, it is inserted as the first object in Xthe appropriate list in objects. It is also placed in the appropriate Xlist in saved_objects. X XHowever when a number of objects are created (usually by reading them Xin from a file or undoing a remove-all action), they are appended to Xthe lists in objects and also saved in saved_objects. The pointers Xin object_tails will be set to point to the last members of the lists Xin objects prior to the appending. X XNote: The read operation will set the pointers in object_tails Xwhile the remove-all operation will zero pointers in objects. X*/ X Xundo_create() X{ X switch(last_object) { X case O_POLYLINE : X objects.lines = saved_objects.lines->next; X saved_objects.lines->next = NULL; X erase_lines(saved_objects.lines); X break; X case O_ELLIPSE : X objects.ellipses = saved_objects.ellipses->next; X saved_objects.ellipses->next = NULL; X erase_ellipses(saved_objects.ellipses); X break; X case O_TEXT : X objects.texts = saved_objects.texts->next; X saved_objects.texts->next = NULL; X erase_texts(saved_objects.texts); X break; X case O_SPLINE : X objects.splines = saved_objects.splines->next; X saved_objects.splines->next = NULL; X erase_splines(saved_objects.splines); X break; X case O_ARC : X objects.arcs = saved_objects.arcs->next; X saved_objects.arcs->next = NULL; X erase_arcs(saved_objects.arcs); X break; X case O_COMPOUND : X objects.compounds = saved_objects.compounds->next; X saved_objects.compounds->next = NULL; X erase_compounds(saved_objects.compounds); X break; X case O_ALL_OBJECT : X cut_objects(&objects, &object_tails); X redisplay_canvas(); X break; X } X last_action = F_REMOVE; X } X Xundo_remove() X{ X switch (last_object) { X case O_POLYLINE : X draw_lines(saved_objects.lines); X insert_line(&objects.lines, saved_objects.lines); X break; X case O_ELLIPSE : X draw_ellipses(saved_objects.ellipses); X insert_ellipse(&objects.ellipses, saved_objects.ellipses); X break; X case O_TEXT : X draw_texts(saved_objects.texts); X insert_text(&objects.texts, saved_objects.texts); X break; X case O_SPLINE : X draw_splines(saved_objects.splines); X insert_spline(&objects.splines, saved_objects.splines); X break; X case O_ARC : X draw_arcs(saved_objects.arcs); X insert_arc(&objects.arcs, saved_objects.arcs); X break; X case O_COMPOUND : X draw_compounds(saved_objects.compounds); X insert_compound(&objects.compounds, saved_objects.compounds); X break; X case O_ALL_OBJECT : X append_objects(&objects, &saved_objects, &object_tails); X redisplay_canvas(); X break; X } X last_action = F_CREATE; X } X Xundo_flip() X{ X switch (last_object) { X case O_POLYLINE : X if (pointmarker_shown) X toggle_linepointmarker(saved_objects.lines); X draw_line(saved_objects.lines, ERASE); X flip_line(saved_objects.lines, X last_position.x, last_position.y, X last_axis); X draw_line(saved_objects.lines, PAINT); X if (pointmarker_shown) X toggle_linepointmarker(saved_objects.lines); X break; X case O_ELLIPSE : X if (pointmarker_shown) X toggle_ellipsepointmarker(saved_objects.ellipses); X pw_batch_on(canvas_pixwin); X draw_ellipse(saved_objects.ellipses, background_color); X flip_ellipse(saved_objects.ellipses, X last_position.x, last_position.y, X last_axis); X draw_ellipse(saved_objects.ellipses, foreground_color); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_ellipsepointmarker(saved_objects.ellipses); X break; X case O_SPLINE : X if (pointmarker_shown) X toggle_splinepointmarker(saved_objects.splines); X pw_batch_on(canvas_pixwin); X draw_spline(saved_objects.splines, ERASE); X flip_spline(saved_objects.splines, X last_position.x, last_position.y, X last_axis); X draw_spline(saved_objects.splines, PAINT); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_splinepointmarker(saved_objects.splines); X break; X case O_ARC : X if (pointmarker_shown) X toggle_arcpointmarker(saved_objects.arcs); X pw_batch_on(canvas_pixwin); X draw_arc(saved_objects.arcs, background_color); X flip_arc(saved_objects.arcs, X last_position.x, last_position.y, X last_axis); X draw_arc(saved_objects.arcs, foreground_color); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_arcpointmarker(saved_objects.arcs); X break; X case O_COMPOUND : X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X erase_compound(saved_objects.compounds); X flip_compound(saved_objects.compounds, X last_position.x, last_position.y, X last_axis); X draw_compound(saved_objects.compounds); X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X break; X } X } X Xundo_move() X{ X int dx, dy; X X dx = last_position.x - new_position.x; X dy = last_position.y - new_position.y; X switch (last_object) { X case O_POLYLINE : X if (pointmarker_shown) X toggle_linepointmarker(saved_objects.lines); X draw_line(saved_objects.lines, ERASE); X translate_line(saved_objects.lines, dx, dy); X draw_line(saved_objects.lines, PAINT); X if (pointmarker_shown) X toggle_linepointmarker(saved_objects.lines); X break; X case O_ELLIPSE : X if (pointmarker_shown) X toggle_ellipsepointmarker(saved_objects.ellipses); X pw_batch_on(canvas_pixwin); X draw_ellipse(saved_objects.ellipses, background_color); X translate_ellipse(saved_objects.ellipses, dx, dy); X draw_ellipse(saved_objects.ellipses, foreground_color); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_ellipsepointmarker(saved_objects.ellipses); X break; X case O_TEXT : X draw_text(saved_objects.texts, INV_PAINT); X translate_text(saved_objects.texts, dx, dy); X draw_text(saved_objects.texts, PAINT); X break; X case O_SPLINE : X if (pointmarker_shown) X toggle_splinepointmarker(saved_objects.splines); X pw_batch_on(canvas_pixwin); X draw_spline(saved_objects.splines, ERASE); X translate_spline(saved_objects.splines, dx, dy); X draw_spline(saved_objects.splines, PAINT); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_splinepointmarker(saved_objects.splines); X break; X case O_ARC : X if (pointmarker_shown) X toggle_arcpointmarker(saved_objects.arcs); X pw_batch_on(canvas_pixwin); X draw_arc(saved_objects.arcs, background_color); X translate_arc(saved_objects.arcs, dx, dy); X draw_arc(saved_objects.arcs, foreground_color); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_arcpointmarker(saved_objects.arcs); X break; X case O_COMPOUND : X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X erase_compound(saved_objects.compounds); X translate_compound(saved_objects.compounds, dx, dy); X draw_compound(saved_objects.compounds); X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X break; X } X swap_newp_lastp(); X } X Xundo_movepoint() X{ X switch (last_object) { X case O_POLYLINE : X relocate_linepoint(saved_objects.lines, X last_position.x, last_position.y, X saved_objects.lines->points->x, X saved_objects.lines->points->y, X moved_point, left_point); X break; X case O_SPLINE : X relocate_splinepoint(saved_objects.splines, last_position.x, X last_position.y, moved_point); X break; X case O_ARC : X relocate_arcpoint(saved_objects.arcs, last_position.x, X last_position.y, movedpoint_num); X break; X case O_ELLIPSE : X relocate_ellipsepoint(saved_objects.ellipses, last_position.x, X last_position.y, movedpoint_num); X break; X } X swap_newp_lastp(); X } X Xundo_rotate() X{ X switch (last_object) { X case O_POLYLINE : X if (pointmarker_shown) X toggle_linepointmarker(saved_objects.lines); X draw_line(saved_objects.lines, ERASE); X if (last_rotateangle == 90) last_rotateangle = 270; X else last_rotateangle = 90; X rotate_line(saved_objects.lines, X last_position.x, last_position.y, X last_rotateangle); X draw_line(saved_objects.lines, PAINT); X if (pointmarker_shown) X toggle_linepointmarker(saved_objects.lines); X break; X case O_ELLIPSE : X if (pointmarker_shown) X toggle_ellipsepointmarker(saved_objects.ellipses); X pw_batch_on(canvas_pixwin); X draw_ellipse(saved_objects.ellipses, background_color); X if (last_rotateangle == 90) last_rotateangle = 270; X else last_rotateangle = 90; X rotate_ellipse(saved_objects.ellipses, X last_position.x, last_position.y, X last_rotateangle); X draw_ellipse(saved_objects.ellipses, foreground_color); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_ellipsepointmarker(saved_objects.ellipses); X break; X case O_SPLINE : X if (pointmarker_shown) X toggle_splinepointmarker(saved_objects.splines); X pw_batch_on(canvas_pixwin); X draw_spline(saved_objects.splines, ERASE); X if (last_rotateangle == 90) last_rotateangle = 270; X else last_rotateangle = 90; X rotate_spline(saved_objects.splines, X last_position.x, last_position.y, X last_rotateangle); X draw_spline(saved_objects.splines, PAINT); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_splinepointmarker(saved_objects.splines); X break; X case O_ARC : X if (pointmarker_shown) X toggle_arcpointmarker(saved_objects.arcs); X pw_batch_on(canvas_pixwin); X draw_arc(saved_objects.arcs, background_color); X if (last_rotateangle == 90) last_rotateangle = 270; X else last_rotateangle = 90; X rotate_arc(saved_objects.arcs, X last_position.x, last_position.y, X last_rotateangle); X draw_arc(saved_objects.arcs, foreground_color); X pw_batch_off(canvas_pixwin); X if (pointmarker_shown) X toggle_arcpointmarker(saved_objects.arcs); X break; X case O_COMPOUND : X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X erase_compound(saved_objects.compounds); X if (last_rotateangle == 90) last_rotateangle = 270; X else last_rotateangle = 90; X rotate_compound(saved_objects.compounds, X last_position.x, last_position.y, X last_rotateangle); X draw_compound(saved_objects.compounds); X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X break; X } X } X Xundo_scale() X{ X float scalex, scaley; X X if (compoundbox_shown) X draw_compoundbox(saved_objects.compounds, INV_PAINT); X erase_compound(saved_objects.compounds); X scalex = ((float)(last_position.x-fix_x)) / (new_position.x-fix_x); X scaley = ((float)(last_position.y-fix_y)) / (new_position.y-fix_y); X scale_compound(saved_objects.compounds, scalex, scaley, fix_x, fix_y); X draw_compound(saved_objects.compounds); X if (compoundbox_shown) draw_compoundbox(saved_objects.compounds, INV_PAINT); X swap_newp_lastp(); X } X Xswap_newp_lastp() X{ X int t; /* swap new_position and last_position */ X X t = new_position.x; X new_position.x = last_position.x; X last_position.x = t; X t = new_position.y; X new_position.y = last_position.y; X last_position.y = t; X } END_OF_FILE if test 13275 -ne `wc -c <'xfig/undo.c'`; then echo shar: \"'xfig/undo.c'\" unpacked with wrong size! fi # end of 'xfig/undo.c' fi if test -f 'xfig/xfig.l' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xfig/xfig.l'\" else echo shar: Extracting \"'xfig/xfig.l'\" \(19095 characters\) sed "s/^X//" >'xfig/xfig.l' <<'END_OF_FILE' 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-le[ft]\fP ] X[ \fB-L[andscape]\fP ] X[ \fB-P[ortrait]\fP ] X[ \fB-w[idth]\fP \fIunits\fP ] X[ \fB-h[eight]\fP \fIunits\fP ] X[ \fB-not[rack]\fP ] X[ \fB-tr[ack]\fP ] X[ \fB-inc[hes]\fP ] X[ \fB-me[tric]\fP ] X[ \fB-inv[erse]\fP ] X[ \fB-de[bug]\fP ] X[ \fIfile\fP ] X[ \fB-normal[Font]\fP \fIfont\fP ] X[ \fB-bold[Font]\fP \fIfont\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 3 or 4 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 on a postcript printer: X.PP Xf2ps (\fIxfig\fP to \fIpostscript\fP translator) is used to produce a X.I postscript Xfile from an \fIxfig\fP file. XThe X.I postscript Xfile can be sent directly to a postscript printer. X.SH OPTIONS X.TP X.B \-ri XChange the position of the side panel window to the right of the canvas window X(default: left). X.TP X.B \-le XChange the position of the side panel window to the left of the canvas window. X.TP X.B \-L XMake \fIxfig\fP come up in landscape mode (10" x 7.5"). This is the default. X.TP X.B \-P XMake \fIxfig\fP come up in portrait mode (7.5" x 10"). X.TP X\fB-w\fP \fIunits\fP XMake \fIxfig\fP come up \fIunits\fP wide (where units are either cm or in). X.TP X\fB-h\fP \fIunits\fP XMake \fIxfig\fP come up \fIunits\fP high (where units are either cm or in). X.TP X\fB-tr\fP XTurn on cursor (mouse) tracking arrows. X.TP X\fB-no\fP XTurn off cursor (mouse) tracking arrows. X.TP X\fB-inc\fP XMake inches the unit of choice (default). X.TP X\fB-me\fP XMake centimeters the unit of choice. X.TP X\fB-inv\fP XUse inverse video (white on black). X.TP X\fB-de\fP XTurn on debugging mode. X.TP X\fB-normal\fP \fIfont\fP XCause the font used for questions to be \fIfont\fP. XThis font is also used on the canvas when the selected font is not available Xin an X11 font. X.TP X\fB-bold\fP \fIfont\fP XCause the font used for displaying messages to be \fIfont\fP. 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" XNine windows comprise the display area of \fIxfig\fP: the Xtop ruler, the side ruler, two panel windows, the message window, Xthree indicator windows showing current line thickness, area-fill gray Xcolor and rounded box corner radius, and the canvas window. XThe main panel window can be placed to the left or right of the Xthe canvas window (default: left), and the second panel window Xis always below the message window. It contains buttons for quick Xaccess to some of the pop-up menu commands. 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. XMost of the functions in the pop-up menu can be directly access with Xthe lower button panel. 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 & Quit 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.SH "BOTTOM PANEL COMMAND FUNCTIONS" XMost of the buttons in the bottom panel are counterparts to the pop-up menu functions. XHowever, there are additional buttons for selecting font, font size, print orientation X(landscape or portrait) and the printer device itself. X.SH "BOTTOM PANEL WINDOW COMMAND DESCRIPTIONS" X.TP X.I CHANGE TEXT XChange existing text to current font, size and justification settings. X.TP X.I FONT SELECT XThis button pops up a menu of 35 fonts available for most Apple XPostscript printers. XThe name of the font appears in the font itself so that one may see Xwhat that font looks like. XIf a corresponding X11 font exists, new text is created Xon the canvas using that font. X\fIxfig\fP uses the size of X11 font closest to that selected Xby the font size button. XIf the X11 font doesn't exist, \fIxfig\fP uses the font Xselected by the "-normal" option. XTo abort selection of a font, click on the title of the menu. X.TP X.I FONT SIZE XThe left button decreases the point size of font used on the canvas and printer. XThe right button increases the point size. X.TP X.I LANDSCAPE/PORTRAIT XSelect landscape or portrait mode of printing. XThe default setting is that of the \fIxfig\fP canvas. X.TP X.I PRINTER SELECT XToggle through a list of printers available for printing the figure. XAt present this list must be compiled into \fIxfig\fP. X.TP X.I TEXT JUSTIFICATION XClicking this button cycles through selection of left, center and right justification Xof text. X.SH "SIDE PANEL WINDOW MANIPULATION FUNCTIONS" XIcons in the side 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 middle button. XThere is no need to hold down a button while positioning Xthe cursor. X.SH "SIDE PANEL WINDOW COMMAND DESCRIPTIONS" XEntries in the side 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 or settings). 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 AREA-FILL ON/OFF XTurn on or off area-fill mode. This will affect any arcs, boxes, Xpolygons, circles, closed splines or ellipses created subsequently. 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 middle button. X.TP X.I ROUNDED-CORNER BOX XCreate rectangular boxes with rounded corners. Start with the Xleft button and terminate with the middle button. XThe radius of the corners is selected by the INCREASE/DECREASE RADIUS 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 CHANGE LINE STYLE OF EXISTING OBJECT XClick left button on an object and the line style will change to the currently Xselected style. X.TP X.I CHANGE LINE THICKNESS OF EXISTING OBJECT XClick left button on an object and the line thickness will change Xto the currently selected thickness. 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 DARKEN/LIGHTEN AREA-FILL COLOR XThe left button lightens the area-fill color X(black to white through 20 gray levels). The right button darkens it. XThe (approximate) current area fill color is shown in the right-most Xindicator window. X.TP X.I ELLIPSE XCreate ellipses using the same procedure as for the drawing of circles. X.TP X.I GLUE XGlue the 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 INCREASE/DECREASE LINE THICKNESS XThe left button decreases the line thickness by one pixel, the right Xbutton increases it by one pixel. The current line thickness Xis shown in the left-most indicator window. X.TP X.I INCREASE/DECREASE RADIUS OF ROUNDED BOX CORNERS XThe left button decreases the radius used in the corners of rounded boxes, Xthe right button increases it. The current radius is shown in the middle Xindicator window. 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, X\fIROUNDED-CORNER BOX\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. XOr click the left button on a side of the bounding box, stretch that Xside 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. XText is drawn using the current font, font size and justification settings. XA DEL or ^H (backspace) will delete a character, while a ^U will kill Xthe entire line. XTerminate by clicking the middle button or typing the return key. To Xedit text, click on an existing text string with the left button. XInsertion of characters will take place at that point. 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 XMOUNTAIN or MANHATTAN modes. X.TP X.I ROTATE XRotate the object (middle button) or copy (left button) +90 degrees. X.TP X.I SOLID/DASHED/DOTTED LINE STYLE XToggle between solid, dashed and dotted 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). This Xset of resources correspond to the command line arguments: X.TP 1.25i Xjustify X(boolean:false) -right and -left arguments X.TP Xlandscape X(boolean:false) -Landscape and -Portrait arguments X.TP Xwidth X(integer:7.5 or 10 inches) -width argument X.TP Xheight X(integer:10 or 7.5 inches) -height argument X.TP XtrackCursor X(boolean:on) -track and -notrack arguments X.TP Xinches X(boolean:true) -inches and -metric arguments X.TP XreverseVideo X(boolean:off) -inverse argument X.TP Xdebug X(boolean:off) -debug argument X.TP XnormalFont X(string:fixed) -normal argument X.TP XboldFont X(string:8x13bold) -bold argument X.PP XThese arguments correspond to the widgets which make up \fIxfig\fP. X.TP 1.5i Xoverall window Xform(Form) X.TP Xside panel Xform.panel(Form.Box) X.TP Xbottom panel Xform.panel2(Form.Box) X.TP Xicons Xform.panel.button(Form.Box.Command) Xform.panel2.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 side panel to blue the resource Xwould be: X.br X\f(CWxfig*form.panel.background: blue\fP X.SH BUGS X.PP XSometimes, \fIxfig\fP doesn't see that a figure has been modified, Xand will allow the user to quit or edit a new figure without confirmation. X.PP XDrawing text sometimes freezes up xfig. Working on it. Any help in this Xarea is welcome. X.PP XCreating a text object is not "Undoable". X.PP XArea fill doesn't show on the canvas for closed splines, but are filled Xwhen printed. This has to do with the way the splines are generated on the Xscreen. X.PP XUndoing the creation of a compound object deletes the objects Xinside the compound object. Undoing the undo doesn't bring them back. 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 Xf2ps(1) X.SH ACKNOWLEDGEMENT XMany thanks goes to Professor Donald E. Fussell who inspired the Xcreation of this tool. X.SH AUTHORS XOriginal author: X.br XSupoj Sutanthavibul X.br XUniversity of Texas at Austin X.br X(supoj@sally.utexas.edu) X.sp XManual page modified by: X.br XR. P. C. Rodgers X.br XUCSF School of Pharmacy X.br XSan Francisco, CA 94118 X.sp XX11 port by: X.br XKen Yap X.br XRochester X.br X(ken@cs.rochester.edu) X.sp XVariable window sizes, cleanup of X11 port, right hand side panel Xunder X11, X11 manual page provided by: X.br XDana Chee X.br XBellcore X.br X(dana@bellcore.com) X.sp XCleanup of color port to X11 by: X.br XJohn T. Kohl X.br XMIT X.br X(jtkohl@athena.mit.edu) X.sp XArea fill, multiple line thicknesses, multiple fonts and font sizes, Xbottom panel, line style/thickness modification of objects by: X.sp XBrian V. Smith X.br XLawrence Berkeley Laboratory X.br X(standard disclaimer applies) X.br X(bvsmith@lbl.gov) END_OF_FILE if test 19095 -ne `wc -c <'xfig/xfig.l'`; then echo shar: \"'xfig/xfig.l'\" unpacked with wrong size! fi # end of 'xfig/xfig.l' fi echo shar: End of archive 7 \(of 15\). cp /dev/null ark7isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 15 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 dan ----------------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com 632 Petaluma Ave, Sebastopol, CA 95472 800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104 Opinions expressed reflect those of the author only.