[comp.sources.x] v01i011: xfig: a MacDraw style line editor

mikew@wyse.wyse.com (Mike Wexler) (08/17/88)

Submitted-by: ken@cs.rochester.edu (Ken Yap)
Posting-number: Volume 1, Issue 11
Archive-name: xfig/part10

#! /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 10 (of 11)."
# Contents:  panel.c
# Wrapped by mikew@wyse on Tue Aug 16 13:14:43 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f panel.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"panel.c\"
else
echo shar: Extracting \"panel.c\" \(20030 characters\)
sed "s/^X//" >panel.c <<'END_OF_panel.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 "const.h"
X#include "func.h"
X#include "object.h"
X#include "paintop.h"
X
Xextern			null_proc();
X
X/**************     local variables and routines   **************/
X
X#ifdef	X11
Xtypedef struct
X{
X	TOOL	widget;
X	Pixmap	normal, reverse;
X} button_info;
X#endif	X11
X
X#include "panel.h"
X
Xstatic			panel_selected();
Xstatic			panel_sighandler();
Xstatic			init_switch();
Xstatic F_switch		*switch_selected();
Xstatic			panel_selected();
Xstatic			switch_handler();
Xstatic			switch_action();
Xstatic			mode_on();
Xstatic			mode_off();
Xstatic			set_command();
Xstatic			set_geometry();
Xstatic			set_grid();
Xstatic			set_style();
X
X#define			on_action(z)	(z->on_func)(z)
X#define			off_action(z)	(z->off_func)(z)
X
Xstatic F_switch		switches[] = { 
X	{ 0, 0, 0, 0, &cirrad_ic, F_CIRCLE_BY_RAD, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 0, &cirdia_ic, F_CIRCLE_BY_DIA, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 1, &ellrad_ic, F_ELLIPSE_BY_RAD, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 1, &elldia_ic, F_ELLIPSE_BY_DIA, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 2, &c_spl_ic, F_CLOSED_SPLINE, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 2, &spl_ic, F_SPLINE, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 3, &c_intspl_ic, F_CLOSED_INTSPLINE, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 3, &intspl_ic, F_INTSPLINE, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 4, &box_ic, F_BOX, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 4, &polygon_ic, F_POLYGON, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 5, &line_ic, F_POLYLINE, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 5, &text_ic, F_TEXT, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 6, &arc_ic, F_CIRCULAR_ARC, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 6, &turn_ic, F_TURN, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 8, &glue_ic, F_GLUE, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 8, &break_ic, F_BREAK, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 9, &scale_ic, F_SCALE, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 9, &autoarrow_ic, F_AUTOARROW, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 10, &addpt_ic, F_ADD_POINT, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 10, &deletept_ic, F_DELETE_POINT, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 11, &move_ic, F_MOVE, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 11, &movept_ic, F_MOVE_POINT, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 12, &copy_ic, F_COPY, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 12, &remove_ic, F_REMOVE, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 13, &flip_x_ic, F_FLIP_XAXIS, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 13, &flip_y_ic, F_FLIP_YAXIS, set_command, null_proc, S_ON, },
X	{ 0, 0, 0, 14, &rot90_ic, F_ROTATE90, set_command, null_proc, S_ON, },
X	{ 0, 0, 1, 14, &rot270_ic, F_ROTATE270, set_command, null_proc, S_ON, },
X	{ 0, 1, 0, 16, &grid1_ic, F_GRID1, set_grid, set_grid, S_TOG, },
X	{ 0, 1, 1, 16, &grid2_ic, F_GRID2, set_grid, set_grid, S_TOG, },
X	{ 1, 2, 0, 17, &unconstraint_ic, F_UNCONSTRAINT, set_geometry, null_proc, S_ON, },
X	{ 0, 2, 1, 17, &mounthattan_ic, F_MOUNTHATTAN, set_geometry, null_proc, S_ON, },
X	{ 0, 2, 0, 18, &manhattan_ic, F_MANHATTAN, set_geometry, null_proc, S_ON, },
X	{ 0, 2, 1, 18, &mountain_ic, F_MOUNTAIN, set_geometry, null_proc, S_ON, },
X	{ 0, 2, 0, 19, &latexline_ic, F_LATEX_LINE, set_geometry, null_proc, S_ON, },
X	{ 0, 2, 1, 19, &latexarrow_ic, F_LATEX_ARROW, set_geometry, null_proc, S_ON, },
X	{ 0, -1, 0, 20, &backarrow_ic, F_AUTOB_ARROW, mode_on, mode_off, S_TOG, },
X	{ 0, -1, 1, 20, &forarrow_ic, F_AUTOF_ARROW, mode_on, mode_off, S_TOG, },
X	{ 1, 3, 0, 21, &solidline_ic, F_SET_SOLID_LINE, set_style, null_proc, S_ON, },
X	{ 0, 3, 1, 21, &dashline_ic, F_SET_DASH_LINE, set_style, null_proc, S_ON, },
X	{ 0, 3, 1, 22, &dottedline_ic, F_SET_DOTTED_LINE, set_style, null_proc, S_ON, },
X	{ 1, -1, 1, 23, &magnet_ic, F_MAGNET, mode_on, mode_off, S_TOG, },
X	};
X
X#define			NUM_GROUP	4
X#define			NUM_SWITCH	(sizeof(switches) / sizeof(F_switch))
Xstatic F_switch		*group[NUM_GROUP];
X
X/*
X *	Panel subwindow section
X */
X
X#ifndef	X11
Xinit_panel(tool)
XTOOL		tool;
X{
X	INPUTMASK		mask;
X
X	panel_sw = tool_createsubwindow(tool, "", -1, -1);
X	if (panel_sw == (TOOLSW) 0) return(0);
X	panel_swfd = panel_sw->ts_windowfd;
X	panel_pixwin = pw_open(panel_swfd);
X
X	panel_sw->ts_io.tio_selected = panel_selected;
X	panel_sw->ts_io.tio_handlesigwinch = panel_sighandler;
X	panel_sw->ts_destroy = null_proc;
X
X	input_imnull(&mask);
X	win_setinputcodebit(&mask, MS_LEFT);
X	win_setinputcodebit(&mask, MS_MIDDLE);
X	win_setinputcodebit(&mask, MS_RIGHT);
X	win_setinputmask(panel_swfd, &mask, NULL, WIN_NULLLINK);
X	win_setcursor(panel_swfd, &arrow_cursor);
X	(void)fcntl(panel_swfd, F_SETFL, fcntl(panel_swfd, F_GETFL, 0) | O_NDELAY);
X	init_switch();
X	return(1);
X	}
X#else
Xstatic Arg	panel_args[] =
X{
X	{ XtNx, (XtArgVal)0 },
X	{ XtNy, (XtArgVal)0 },
X	{ XtNwidth, (XtArgVal)0 },
X	{ XtNheight, (XtArgVal)0 },
X	{ XtNhSpace, (XtArgVal)SWITCH_ICON_SPACING },
X	{ XtNvSpace, (XtArgVal)SWITCH_ICON_SPACING },
X	{ XtNleft, (XtArgVal)XtChainLeft },
X};
X
Xextern void button_select();
X
Xstatic XtCallbackRec    button_callbacks[] =
X{
X	{ button_select, NULL },
X	{ NULL, NULL },
X};
X
Xstatic Arg	button_args[] =
X{
X	{ XtNx, (XtArgVal)0 },
X	{ XtNy, (XtArgVal)0 },
X	{ XtNlabel, (XtArgVal)"        " },
X	{ XtNwidth, (XtArgVal)0 },
X	{ XtNheight, (XtArgVal)0 },
X	{ XtNbackgroundPixmap, (XtArgVal)NULL },
X	{ XtNcallback, (XtArgVal)button_callbacks },
X};
X
Xextern int	PANEL_LEFT, PANEL_TOP, PANEL_HEIGHT, PANEL_WID;
Xextern int	CANVAS_HEIGHT, ICON_COLUMN;
X
X#define	N_SWITCHES	(sizeof(switches)/sizeof(switches[0]))
X
Xint init_panel(tool)
X	TOOL		tool;
X{
X	register int		i;
X	register F_switch	*sw;
X
X	panel_args[2].value = PANEL_WID =
X		(SWITCH_ICON_WIDTH + 2 + SWITCH_ICON_SPACING) * ICON_COLUMN
X/* 2 for borders on switches */
X		+ SWITCH_ICON_SPACING;
X	panel_args[3].value = PANEL_HEIGHT = CANVAS_HEIGHT + RULER_WIDTH + MSG_HEIGHT;
X	panel_sw = XtCreateWidget("panel", boxWidgetClass, tool, panel_args,
X		XtNumber(panel_args));
X	for (i = 0; i < N_SWITCHES; ++i)
X	{
X		sw = &switches[i];
X		button_args[0].value = sw->x * sw->icon->width;
X		button_args[1].value = sw->y * sw->icon->height;
X		button_args[3].value = sw->icon->width;
X		button_args[4].value = sw->icon->height;
X		button_callbacks[0].closure = (caddr_t)sw;
X		sw->but.widget = XtCreateManagedWidget(
X			"button", commandWidgetClass,
X			panel_sw, button_args, XtNumber(button_args));
X	}
X	return (1);
X}
X
Xsetup_panel()
X{
X	register int		i;
X	register F_switch	*sw;
X	register Display	*d = tool_d;
X	register Screen		*s = tool_s;
X	register Pixmap		p;
X	register GC		cgc;
X	XGCValues		gcv;
X
X	cgc = XCreateGC(d, XtWindow(panel_sw), 0, &gcv);
X	XCopyGC(d, gc, ~0, cgc);
X	for (i = 0; i < N_SWITCHES; ++i)
X	{
X		sw = &switches[i];
X/*
X**	You'd think XCreateBitmapFromBitmapData would work but
X**	unfortunately it wants LSB first data.
X*/
X		p = XCreatePixmap(d, XtWindow(sw->but.widget),
X			sw->icon->width, sw->icon->height, sw->icon->depth);
X		XPutImage(d, p, gc, sw->icon, 0, 0, 0, 0, sw->icon->width,
X			sw->icon->height);
X		sw->but.normal = button_args[5].value = (XtArgVal)p;
X		XtSetValues(sw->but.widget, &button_args[5], 1);
X	}
X/*
X**	Create reversed bitmaps for displaying activated state
X*/
X	XSetForeground(d, cgc, WhitePixelOfScreen(s));
X	XSetBackground(d, cgc, BlackPixelOfScreen(s));
X	for (i = 0; i < N_SWITCHES; ++i)
X	{
X		sw = &switches[i];
X		p = XCreatePixmap(d, XtWindow(sw->but.widget),
X			sw->icon->width, sw->icon->height, sw->icon->depth);
X		XPutImage(d, p, cgc, sw->icon, 0, 0, 0, 0, sw->icon->width,
X			sw->icon->height);
X		sw->but.reverse = (XtArgVal)p;
X	}
X	XFreeGC(d, cgc);
X	init_switch();
X	panel_pixwin = panel_swfd = XtWindow(panel_sw);
X	XDefineCursor(d, panel_swfd, (Cursor)arrow_cursor.bitmap);
X}
X
Xstatic void button_select(widget, s)
X	TOOL		widget;
X	F_switch	*s;
X{
X	switch_action(s);
X}
X#endif	X11
X
X#ifndef	X11
Xstatic
Xpanel_selected(nullsw, ibits, obits, ebits, timer)
Xcaddr_t		*nullsw;
Xint		*ibits, *obits, *ebits;
Xstruct timeval	*timer;
X{
X	extern int		action_on;
X	extern int		receiving_msg;
X	INPUTEVENT		ie;
X	int			x, y;
X
X	x = -1;
X	while (input_readevent(panel_swfd, &ie) != -1) {
X	    if (ie.ie_code == MS_LEFT) {
X		x = ie.ie_locx;
X		y = ie.ie_locy;
X		}
X	    }
X	*ibits = *obits = *ebits = 0;
X	if (action_on) return;
X	if (receiving_msg) return;  /* ignore mouse input when msg is being
X					accepted	*/
X	if (x != -1) switch_handler(x, y);
X	}
X
Xstatic
Xpanel_sighandler()
X{
X	pw_damaged(panel_pixwin);
X	pw_writebackground(panel_pixwin, 0, 0, 2048, 2048, PAINT);
X	redisplay_panel();
X	pw_donedamaged(panel_pixwin);
X	}
X
Xredisplay_panel()
X{
X	F_switch	*s, *t;
X
X	t = &switches[NUM_SWITCH-1];
X	for (s = switches; s <= t; s++) {
X	    if (s->on == 1)
X		turn_on(s);
X	    else 
X		turn_off(s);
X	    }
X	}
X
Xstatic F_switch *
Xswitch_selected(x, y)
Xint	x, y;
X{
X	F_switch	*sw;
X	int		i;
X
X	for (sw = switches, i = 0; i < NUM_SWITCH; sw++, i++) {
X	    if (sw->x > x || sw->x + SWITCH_ICON_WIDTH < x) continue;
X	    if (sw->y <= y && y <= sw->y + SWITCH_ICON_HEIGHT) return(sw);
X	    }
X	return(NULL); /* no item is selected */
X	}
X#endif	X11
X
Xstatic
Xinit_switch()
X{
X	extern int	manhattan_mode;
X	extern int	mountain_mode;
X	extern int	autoforwardarrow_mode;
X	extern int	autobackwardarrow_mode;
X	extern int	latexline_mode;
X	extern int	latexarrow_mode;
X	extern int	magnet_mode;
X	extern int	cur_line_style;
X	extern float	cur_styleval;
X	extern float	cur_dashlength;
X	extern float	cur_dotgap;
X	int		i;
X	F_switch	*sw;
X
X	for (sw = switches, i = 0; i < NUM_SWITCH; sw++, i++) {
X	    sw->x *= SWITCH_ICON_WIDTH;
X	    sw->y *= SWITCH_ICON_HEIGHT;
X	    }
X	for (i = 0; i < NUM_GROUP; ) group[i++] = NULL;
X
X	for (sw = switches, i = 0; i < NUM_SWITCH; sw++, i++) {
X	    if (sw->on) {
X		/* Only the following switch can be preset */
X		switch (sw->value) {
X		    case F_UNCONSTRAINT :
X			manhattan_mode = 0;
X			mountain_mode = 0;
X			latexline_mode = 0;
X			latexarrow_mode = 0;
X			group[sw->group] = sw;
X			break;
X		    case F_MOUNTHATTAN :
X			manhattan_mode = 1;
X			mountain_mode = 1;
X			group[sw->group] = sw;
X			break;
X		    case F_MANHATTAN :
X			manhattan_mode = 1;
X			group[sw->group] = sw;
X			break;
X		    case F_MOUNTAIN :
X			mountain_mode = 1;
X			group[sw->group] = sw;
X			break;
X		    case F_LATEX_LINE :
X			latexline_mode = 1;
X			group[sw->group] = sw;
X			break;
X		    case F_LATEX_ARROW :
X			latexarrow_mode = 1;
X			group[sw->group] = sw;
X			break;
X		    case F_AUTOF_ARROW :
X			autoforwardarrow_mode = 1;
X			break;
X		    case F_AUTOB_ARROW :
X			autobackwardarrow_mode = 1;
X			break;
X		    case F_SET_SOLID_LINE :
X			cur_line_style = SOLID_LINE;
X			cur_styleval = 0.0;
X			break;
X		    case F_SET_DASH_LINE :
X			cur_line_style = DASH_LINE;
X			cur_styleval = cur_dashlength;
X			break;
X		    case F_SET_DOTTED_LINE :
X			cur_line_style = DOTTED_LINE;
X			cur_styleval = cur_dotgap;
X			break;
X		    case F_MAGNET :
X			magnet_mode = 1;
X			break;
X		    default :
X			continue;
X		    }
X		turn_on(sw);
X		if (sw->group != -1) group[sw->group] = sw;
X		}
X	    }
X	}
X
X#ifndef	X11
Xstatic
Xswitch_handler(x, y)
Xint	x, y;
X{
X	F_switch *s;
X
X	if (NULL == (s = switch_selected(x, y))) return;
X	switch_action(s);
X	}
X#endif	X11
X
Xstatic
Xset_command(sw)
XF_switch	*sw;
X{
X	extern int	cur_command;
X	extern int	rotate_angle;
X	extern int	flip_axis;
X
X	switch (sw->value) {
X	    case F_CIRCLE_BY_RAD :
X		circlebyradius_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("CIRCLE drawing: specify RADIUS");
X		break;
X	    case F_CIRCLE_BY_DIA :
X		circlebydiameter_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("CIRCLE drawing: specify DIAMETER");
X		break;
X	    case F_ELLIPSE_BY_RAD :
X		ellipsebyradius_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("ELLIPSE drawing: specify RADIUSES");
X		break;
X	    case F_ELLIPSE_BY_DIA :
X		ellipsebydiameter_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("ELLIPSE drawing: specify DIAMETERS");
X		break;
X	    case F_BOX :
X		box_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("Rectangular BOX drawing");
X		break;
X	    case F_POLYGON :
X		line_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("POLYGON drawing");
X		break;
X	    case F_POLYLINE :
X		line_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("POLYLINE drawing");
X		break;
X	    case F_TEXT :
X		text_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("TEXT input (from keyboard)");
X		break;
X	    case F_CIRCULAR_ARC :
X		arc_drawing_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("ARC drawing: specify three points on the arc");
X		break;
X	    case F_SPLINE :
X		draw_spline_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("SPLINE drawing: specify control points");
X		break;
X	    case F_CLOSED_SPLINE :
X		draw_spline_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("CLOSED SPLINE drawing: specify control points");
X		break;
X	    case F_INTSPLINE :
X		draw_intspline_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("INTERPOLATED SPLINE drawing");
X		break;
X	    case F_CLOSED_INTSPLINE :
X		draw_intspline_selected();
X		erase_pointmarker();
X		erase_compoundbox();
X		put_msg("CLOSED INTERPOLATED SPLINE drawing");
X		break;
X	    case F_GLUE :
X		compound_selected();
X		erase_pointmarker();
X		show_compoundbox();
X		put_msg("GLUE objects into COMPOUND object with bounding box");
X		break;
X	    case F_BREAK :
X		break_selected();
X		erase_pointmarker();
X		show_compoundbox();
X		put_msg("BREAK COMPOUND object");
X		break;
X	    case F_SCALE :
X		scale_compound_selected();
X		erase_pointmarker();
X		show_compoundbox();
X		put_msg("SCALE COMPOUND object");
X		break;
X	    case F_ADD_POINT :
X		point_adding_selected();
X		show_pointmarker();
X		erase_compoundbox();
X		put_msg("ADD POINTs (to POLYLINE, POLYGON, CLOSED-SPLINE and SPLINE)");
X		break;
X	    case F_DELETE_POINT :
X		delete_point_selected();
X		show_pointmarker();
X		erase_compoundbox();
X		put_msg("DELETE POINTs (from POLYLINE, POLYGON, CLOSED-SPLINE and SPLINE)");
X		break;
X	    case F_MOVE :
X		move_selected();
X		show_pointmarker();
X		show_compoundbox();
X		put_msg("MOVE objects");
X		break;
X	    case F_MOVE_POINT :
X		move_point_selected();
X		show_pointmarker();
X		erase_compoundbox();
X		put_msg("MOVE POINTs (of POLYLINE, POLYGON, CLOSED-SPLINE, SPLINE and BOX)");
X		break;
X	    case F_REMOVE :
X		remove_selected();
X		show_pointmarker();
X		show_compoundbox();
X		put_msg("REMOVE objects");
X		break;
X	    case F_COPY :
X		copy_selected();
X		show_pointmarker();
X		show_compoundbox();
X		put_msg("COPY objects");
X		break;
X	    case F_ROTATE270 :
X		rotate_selected();
X		show_pointmarker();
X		show_compoundbox();
X		rotate_angle = 270;
X		put_msg("ROTATE objects (middle button) or COPY & ROTATE (left button) -90 degree");
X		break;
X	    case F_ROTATE90 :
X		rotate_selected();
X		show_pointmarker();
X		show_compoundbox();
X		rotate_angle = 90;
X		put_msg("ROTATE objects (middle button) or COPY & ROTATE (left button) 90 degree");
X		break;
X	    case F_FLIP_XAXIS :
X		flip_selected();
X		show_pointmarker();
X		show_compoundbox();
X		flip_axis = 1;
X		put_msg("FLIP objects (middle button) or COPY & FLIP (left button) up or down");
X		break;
X	    case F_FLIP_YAXIS :
X		flip_selected();
X		show_pointmarker();
X		show_compoundbox();
X		flip_axis = 2;
X		put_msg("FLIP objects (middle button) or COPY & FLIP (left button) left or right");
X		break;
X	    case F_TURN :
X		turn_selected();
X		show_pointmarker();
X		erase_compoundbox();
X		put_msg("Turn POLYGON (POLYLINE) into CLOSED-SPLINE (SPLINE) or vice versa");
X		break;
X	    case F_AUTOARROW :
X		arrow_head_selected();
X		show_pointmarker();
X		erase_compoundbox();
X		put_msg("ADD arrow head (left button); DELETE arrow head (middle button)");
X		break;
X	    }
X	cur_command = sw->value;
X	}
X
Xstatic
Xset_geometry(sw)
XF_switch	*sw;
X{
X	extern int	manhattan_mode;
X	extern int	mountain_mode;
X	extern int	latexline_mode;
X	extern int	latexarrow_mode;
X
X	switch (sw->value) {
X	    case F_UNCONSTRAINT :
X		manhattan_mode = 0;
X		mountain_mode = 0;
X		latexline_mode = 0;
X		latexarrow_mode = 0;
X		put_msg("UNCONSTRAINT geometry (for POLYLINE and SPLINE)");
X		break;
X	    case F_MOUNTHATTAN :
X		mountain_mode = 1;
X		manhattan_mode = 1;
X		latexline_mode = 0;
X		latexarrow_mode = 0;
X		put_msg("MOUNT-HATTAN geometry (for POLYLINE and SPLINE)");
X		break;
X	    case F_MANHATTAN :
X		manhattan_mode = 1;
X		mountain_mode = 0;
X		latexline_mode = 0;
X		latexarrow_mode = 0;
X		put_msg("MANHATTAN geometry (for POLYLINE and SPLINE)");
X		break;
X	    case F_MOUNTAIN :
X		mountain_mode = 1;
X		manhattan_mode = 0;
X		latexline_mode = 0;
X		latexarrow_mode = 0;
X		put_msg("MOUNTAIN geometry (for POLYLINE and SPLINE)");
X		break;
X	    case F_LATEX_LINE :
X		latexline_mode = 1;
X		manhattan_mode = 0;
X		mountain_mode = 0;
X		latexarrow_mode = 0;
X		put_msg("LATEX LINE geometry: allow only LaTeX line slopes");
X		break;
X	    case F_LATEX_ARROW :
X		latexarrow_mode = 1;
X		manhattan_mode = 0;
X		mountain_mode = 0;
X		latexline_mode = 0;
X		put_msg("LATEX ARROW geometry: allow only LaTeX arrow slopes");
X		break;
X	    }
X	}
X
Xstatic
Xset_grid(sw)
XF_switch	*sw;
X{
X	setup_grid(sw->value);
X	}
X
Xstatic
Xmode_on(sw)
XF_switch	*sw;
X{
X	extern int	autoforwardarrow_mode;
X	extern int	autobackwardarrow_mode;
X	extern int	magnet_mode;
X
X	switch (sw->value) {
X	    case F_AUTOF_ARROW :
X		autoforwardarrow_mode = 1;
X		put_msg("AUTO FORWARD ARROW (for ARC, POLYLINE and SPLINE)");
X		break;
X	    case F_AUTOB_ARROW :
X		autobackwardarrow_mode = 1;
X		put_msg("AUTO BACKWARD ARROW (for ARC, POLYLINE and SPLINE)");
X		break;
X	    case F_MAGNET :
X		magnet_mode = 1;
X		put_msg("MAGNET: round entered points to the nearest 1/16\" increment");
X		break;
X	    }
X	}
X
Xstatic
Xmode_off(sw)
XF_switch	*sw;
X{
X	extern int	autoforwardarrow_mode;
X	extern int	autobackwardarrow_mode;
X	extern int	magnet_mode;
X
X	switch (sw->value) {
X	    case F_AUTOF_ARROW :
X		autoforwardarrow_mode = 0;
X		break;
X	    case F_AUTOB_ARROW :
X		autobackwardarrow_mode = 0;
X		break;
X	    case F_MAGNET :
X		magnet_mode = 0;
X		break;
X	    }
X	}
X
Xstatic
Xset_style(sw)
XF_switch	*sw;
X{
X	extern int	cur_line_style;
X	extern float	cur_styleval;
X	extern float	cur_dashlength;
X	extern float	cur_dotgap;
X
X	switch (sw->value) {
X	    case F_SET_SOLID_LINE :
X		cur_line_style = SOLID_LINE;
X		cur_styleval = 0.0;
X		put_msg("SOLID LINE STYLE (for BOX, POLYGON and POLYLINE)");
X		break;
X	    case F_SET_DASH_LINE :
X		cur_line_style = DASH_LINE;
X		cur_styleval = cur_dashlength;
X		put_msg("DASH LINE STYLE (for BOX, POLYGON and POLYLINE)");
X		break;
X	    case F_SET_DOTTED_LINE :
X		cur_line_style = DOTTED_LINE;
X		cur_styleval = cur_dotgap;
X		put_msg("DOTTED LINE STYLE (for BOX, POLYGON and POLYLINE)");
X		break;
X	    }
X	}
X
X#ifndef	X11
Xstatic
Xturn_on(s)
XF_switch	*s;
X{
X	s->on = 1;
X	pw_write(panel_pixwin, s->x, s->y,
X		SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT, ERASE, s->icon, 0, 0);
X	}
X
Xstatic
Xturn_off(s)
XF_switch	*s;
X{
X	s->on = 0;
X	pw_write(panel_pixwin, s->x, s->y,
X		SWITCH_ICON_WIDTH, SWITCH_ICON_HEIGHT, PAINT,
X		s->icon, 0, 0);
X	}
X#else
Xstatic turn_on(s)
X	F_switch	*s;
X{
X	s->on = 1;
X	button_args[5].value = (XtArgVal)s->but.reverse;
X	XtSetValues(s->but.widget, &button_args[5], 1);
X}
X
Xstatic turn_off(s)
X	F_switch	*s;
X{
X	s->on = 0;
X	button_args[5].value = (XtArgVal)s->but.normal;
X	XtSetValues(s->but.widget, &button_args[5], 1);
X}
X#endif	X11
X
Xstatic
Xswitch_action(sw)
XF_switch	*sw;
X{
X	F_switch	*old;
X
X	if (sw == NULL) return;
X
X	if (sw->group == -1) {
X	    if (sw->on) {
X		turn_off(sw);
X		off_action(sw);
X		}
X	    else {
X		turn_on(sw);
X		on_action(sw);
X		}
X	    return;
X	    }
X
X	old = group[sw->group];
X	if (old == sw) {
X	    if (old->type != S_ON) {
X		turn_off(old);
X		off_action(old);
X		group[old->group] = NULL;
X		}
X	    return;
X	    }
X	else if (old) {
X	    turn_off(old);
X	    off_action(old);
X	    }
X
X	turn_on(sw);
X	on_action(sw);
X	group[sw->group] = sw;
X	}
END_OF_panel.c
if test 20030 -ne `wc -c <panel.c`; then
    echo shar: \"panel.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 10 \(of 11\).
cp /dev/null ark10isdone
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