                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                orizontal line move when the mouse button is released
 */

void 
finish_H_move(Widget w)
{
    int i;			/* temp indices */
    XRectangle rect;		/* expose rectangle */

    XtRemoveEventHandler(w, Button2MotionMask, FALSE, (XtEventHandler)H_mover, 
	NULL);
    for (i = 0; (*r)[i] != NULL; ++i) {
        XDrawRectangle(dw.display, dw.win, hilite_gc, x_left_margin,
            (*r)[i]->y + y_off, (unsigned)((*r)[i]->width), 
	    (unsigned)((*r)[i]->height));
    }
    if (x_off || y_off) {               /* did move */
        exposeRectList(1, Hobjary[co].rlist);
        (*(Hobjary[co].opsptr->mov))(co, (*r)[0]->x+x_off, (*r)[0]->y + y_off,
	    OBJECT);
	issue_date();
	rect.x = 0;
   	rect.y = 0;
	rect.width = page_width;
	rect.height = page_height;
	AddExposeEvent(0, &rect);
    }
}

/***********************************************************************
 *
 * FUNCTION:
 *	mover()
 *
 * INPUTS:
 *	w		(Widget)
 *	client_data	(XtPointer)
 *	event		(XEvent)
 *
 * OUTPUTS:
 *
 * RETURNS:
 *
 * EXTERNALLY READ:
 *
 * EXTERNALLY MODIFIED:
 *
 * DESCRIPTION:
 *	moves the object while the middle mouse button is depressed
 */

static void 
mover(Widget w, XtPointer client_data, XEvent *event)
{
    int i;				/* temp index */

    for (i = 0; (*r)[i] != NULL; ++i) {
	XDrawRectangle(dw.display, dw.win, hilite_gc, (*r)[i]->x + x_off,
	    (*r)[i]->y + y_off, (unsigned)((*r)[i]->width), 
	    (unsigned)((*r)[i]->height));
    }

    x_off = event->xmotion.x - x_start;
    y_off = event->xmotion.y - y_start;

    /*
     * limit range of motion
     */
    if (x_off < x_min) {
 	x_off = x_min;
    } else if (x_off > x_max) {
 	x_off = x_max;
    }
    if (y_off < y_min) {
	y_off = y_min;
    } else if (y_off > y_max) {
	y_off = y_max;
    }

    for (i = 0; (*r)[i] != NULL; ++i) {
	XDrawRectangle(dw.display, dw.win, hilite_gc, (*r)[i]->x + x_off,
	    (*r)[i]->y + y_off, (unsigned)((*r)[i]->width), 
	    (unsigned)((*r)[i]->height));
    }
}

/***********************************************************************
 *
 * FUNCTION:
 *	H_mover()
 *
 * INPUTS:
 *	w		(Widget)
 *      client_data	(XtPointer)
 *	event		(XEvent)
 *
 * OUTPUTS:
 *
 * RETURNS:
 *
 * EXTERNALLY READ:
 *
 * EXTERNALLY MODIFIED:
 *
 * DESCRIPTION:
 *	tracks the horizontal line move while the mouse button is pressed
 */

static void 
H_mover(Widget w, XtPointer client_data, XEvent *event)
{
    int i;					/* temp index */

    for (i = 0; (*r)[i] != NULL; ++i) {
        XDrawRectangle(dw.display, dw.win, hilite_gc, x_left_margin,
	    (*r)[i]->y + y_off, (unsigned)((*r)[i]->width), 
	    (unsigned)((*r)[i]->height));
    }

    x_off = event->xmotion.x - x_start;
    y_off = event->xmotion.y - y_start;

    /*
     * limit range of motion
     */
    if (x_off < x_min) {
	x_off = x_min;
    } else if (x_off > x_max) {
	x_off = x_max;
    }
    if (y_off < y_min) {
	y_off = y_min;
    } else if (y_off > y_max) {
	y_off = y_max;
    }

    for (i = 0; (*r)[i] != NULL; ++i) {
        XDrawRectangle(dw.display, dw.win, hilite_gc, x_left_margin,
            (*r)[i]->y + y_off, (unsigned)((*r)[i]->width), 
	    (unsigned)((*r)[i]->height));
    }
}

static void 
expose_object(int co)
{
    switch (objary[co].type) {
    case OBJ_ACT:
    case OBJ_EVT:
    case OBJ_SACT:
    case OBJ_SEQ:
    case OBJ_SLP:
	exposeRectList(0, objary[0].rlist);
	break;
    default:
	exposeRectList(0, objary[co].rlist);
	break;
    }
}
