/*********************************************************************** * * TITLE: * sequence.c * * AUTHOR: * Cassie Mulnix * * DESCRIPTION: * This module is part of the OPPS editor, xopps. It contains * object routines to handle sequence objects. * * CHANGE HISTORY * * $Log: sequence.c,v $ * Revision 1.36 1994/12/31 04:32:43 kevin * fixed memory allocation problem after DialogTextGet * * Revision 1.35 1994/08/10 22:05:48 cassie * removed call to DialogFlagSet in verify_fun since * it is already set in ok_button * * Revision 1.34 1994/07/20 19:06:35 clm * updated TRUE, ERROR etc in cancel & ok_button functions * to DIALOG_ constants * * Revision 1.33 1994/06/16 21:57:27 clm * updated to new dialog routines - extra parameter to DialogTextCreate * * Revision 1.32 1994/06/16 16:56:35 clm * updated to new gr_ routines using GR_ for font names * * Revision 1.31 1994/06/08 18:48:45 clm * removed Xm library includes since they are in dialog * * Revision 1.30 1994/06/07 00:52:11 clm * fixed ok_button date values * * Revision 1.29 1994/06/01 22:27:07 clm * rewrote init functions to use dialog oellib functions * also don't initialize popups until object called * * Revision 1.28 1994/05/20 23:31:43 clm * updated with HP, SGI changes * * Revision 1.27 1994/05/04 23:34:36 clm * ported to ANSI C * * Revision 1.26 1993/11/11 18:12:10 clm * adjusted vertical position of text * * Revision 1.25 1993/05/21 16:01:58 clm * fixed buffer size for sav function * * Revision 1.24 1993/05/18 22:39:41 clm * added meaningful error messages for check_num and check_day * * Revision 1.23 1993/05/18 20:58:30 clm * added new message.c function * fixed rtc display to RTC_WIDTH instead of text width * * Revision 1.22 1993/02/20 00:04:14 clm * added Slip Precedence Objects to edit popup * * Revision 1.21 1993/02/08 16:24:40 clm * fixed endate to be end of day * * Revision 1.20 1993/02/08 16:23:30 clm * fixed loc_function for y2 * fixed so lines don't display if runs off page * * Revision 1.19 1992/12/14 18:55:08 clm * really fixed dsp and loc bug * * Revision 1.18 1992/12/11 22:11:12 clm * fixed loc and dsp for completely offpage objects * * Revision 1.17 1992/12/10 21:45:40 clm * fixed new_index so chart is always object 0 * * Revision 1.16 1992/12/01 16:49:11 clm * added vertical positioning * fixed locate and display * * Revision 1.15 1992/11/30 22:56:30 clm * fixed locate function * * Revision 1.14 1992/11/24 16:28:27 clm * fixed rem functions - setting of ip array * * Revision 1.13 1992/11/09 21:51:33 clm * removed unused variables * * Revision 1.12 1992/11/09 16:33:11 clm * added precedence lines * * Revision 1.11 1992/10/20 16:54:04 clm * fixed placement of idtext * * Revision 1.10 1992/10/16 14:46:56 clm * changed free, realloc, and malloc to Xt functions * * Revision 1.9 1992/10/12 18:12:12 clm * fixed move to only change y coordinate * * Revision 1.8 1992/10/09 21:17:43 clm * fixed move routine * * Revision 1.7 1992/10/02 20:41:54 clm * housekeeping * * Revision 1.6 1992/09/30 22:45:32 clm * fixed location of r.x and r.width for two text items * * Revision 1.5 1992/09/29 23:26:34 clm * added id text and toggle * * Revision 1.4 1992/09/25 20:37:27 clm * error checking for end date < start date * * Revision 1.3 1992/09/16 14:56:02 clm * fixed load function so doesn't add object if error in load * * Revision 1.2 1992/09/14 14:18:52 clm * fixed error checking of font in load_sequence * * Revision 1.1 1992/09/09 17:54:29 clm * Initial revision * * *********************************************************************** * * WARNINGS: * * EXTERNAL CALLABLE COMPONENTS (PUBLIC): * * GLOBALS: * * WAIVERS: * * NOTES: * * MANPAGE: * ***********************************************************************/ #ifndef lint static char rcsid[] = "$Id: sequence.c,v 1.36 1994/12/31 04:32:43 kevin OEL $"; #endif /* sequence.c - an xopps module containing routines for sequence objects global functions: add_sequence(s_month, s_day, s_year, e_month, e_day, e_year, disp, solid, hpos, vpos, line, font, layer text, rtc) - add sequence object to data base local functions: rem_sequence(i) - remove sequence object dsp_sequence(i) - display sequence object edt_sequence(i) - edit sequence object with subwindow mov_sequence(i) - move sequence object msg_sequence(i) - display message seq_done_handle() - done handle for edit panel */ #include "xopps.h" #define RTC_WIDTH 5 static int font_values[] = { GR_COURIER, GR_COURIER_BOLD, GR_HELVETICA, GR_HELVETICA_BOLD, GR_TIMES, GR_TIMES_BOLD }; static int font_sizes[] = { 8, 10, 12, 14, 18, 24 }; /* local functions */ static void create_dialog(void); static int load_sequence(char *); /* load a sequence object */ static void seq_ok_button(void); /* Callback for ok button */ static void cancel_button(void); /* Callback for cancel button */ static void change_color(Widget, XtPointer, XtPointer); static void change_point(Widget, XtPointer, XtPointer); static void change_font(Widget, XtPointer, XtPointer); static void change_disp(Widget, XtPointer, XtPointer); static void change_solid(Widget, XtPointer, XtPointer); static void change_hpos(Widget, XtPointer, XtPointer); static void change_vpos(Widget, XtPointer, XtPointer); static void change_drawlyr(Widget, XtPointer, XtPointer); static void change_rtc(Widget, XtPointer, XtPointer); static void change_idhpos(Widget, XtPointer, XtPointer); static void change_idvpos(Widget, XtPointer, XtPointer); static void change_idtog(Widget, XtPointer, XtPointer); static void change_pline(Widget, XtPointer, XtPointer); static void set_pline(utc_val, utc_val); /* Executes pline slips */ static void dsp_sequence(int); static void edt_sequence(int, int); static void rem_sequence(int, int); static void lim_sequence(int, int *, int *, int *, int *, int); static void loc_sequence(int, int); static void mov_sequence(int, int, int, int); static void cpy_sequence(struct obj *, struct obj *); static void msg_sequence(int, int); static void sav_sequence(int, FILE *, int); static void verify_fun(Widget, XtPointer, XtPointer); /* function pointer */ static struct ops seq_ops = { dsp_sequence, edt_sequence, rem_sequence, lim_sequence, loc_sequence, mov_sequence, cpy_sequence, msg_sequence, sav_sequence }; static DialogDate *sdate, *edate; static DialogOption *disp, *hpos, *vpos; static DialogOption *idhpos, *idvpos, *idtog; static DialogOption *drawlyr, *font, *point; static DialogOption *rtc, *colorw, *plinew, *line; static DialogText *lpos, *text, *idtext; static Widget seq_dialog; /* dialog shell for popup */ static Widget parent_shell; static int new_point; /* new point id */ static int new_font; /* new font id */ static int new_drawlyr; /* new draw layer id */ static int new_color; /* new color id */ static int new_disp; /* new disp id */ static int new_solid; /* new solid id */ static int new_hpos; /* new horiz position id */ static int new_vpos; /* new vert position id */ static int new_rtc; /* new rtc id */ static int new_idhpos; /* new id hpos */ static int new_idvpos; /* new id vpos */ static int new_idtog; /* new id toggle */ static int pline_flag = FALSE; /* pline slip flag */ /*********************************************************************** * * FUNCTION: * init_sequence_object() * * INPUTS: * parent (Widget) * * OUTPUTS: * none * * RETURNS: * none * * EXTERNALLY READ: * none * * EXTERNALLY MODIFIED: * none * * DESCRIPTION: * registers the object and sets the parent */ void init_sequence_object(Widget parent) { register_io_obj('U', load_sequence); /* register object */ parent_shell = parent; } /*********************************************************************** * * FUNCTION: * create_dialog() * * INPUTS: * none * * OUTPUTS: * none * * RETURNS: * none * * EXTERNALLY READ: * none * * EXTERNALLY MODIFIED: * none * * DESCRIPTION: * initializes the widgets for the sequence object */ static void create_dialog(void) { static char *hpos_list[] = { "Left", "Center", "Right" }; static char *vpos_list[] = { "Above", "Below", "Center" }; static char *disps[] = { "None", "Display" }; static char *fonts[] = { "Courier", "Courier Bold", "Helvetica", "Helvetica Bold", "Times", "Times Bold" }; static char *points[] = { "8", "10", "12", "14", "18", "24" }; static char *dates[] = { "None", "DOY", "Month/Day" }; static char *opts[] = { "No", "Yes" }; static char *lines[] = { "Solid", "Box" }; static char *drawlyrs[] = { "0", "1", "2", "3" }; seq_dialog = DialogInit(parent_shell, "Sequence Object", "sequence", verify_fun, (XtPointer)DIALOG_CANCEL); DialogAddRow(2); sdate = DialogDateCreate("Start Date "); edate = DialogDateCreate("End Date "); lpos = DialogTextCreate("Line Position ", 2, 2); text = DialogTextCreate("Text ", 50, 100); DialogAddRow(2); hpos = DialogOptionCreate("Horiz. Text Position ", 3, 0, change_hpos, DIALOG_OPT_STR_ARY, hpos_list, NULL); vpos= DialogOptionCreate("Vert. Text Position ", 3, 0, change_vpos, DIALOG_OPT_STR_ARY, vpos_list, NULL); DialogAddRow(2); idtext = DialogTextCreate("Id ", 20, 100); idtog = DialogOptionCreate("Display Id ", 2, 0, change_idtog, DIALOG_OPT_STR_ARY, disps, NULL); DialogAddRow(2); idhpos = DialogOptionCreate("Horizontal Id Position ", 3, 0, change_idhpos, DIALOG_OPT_STR_ARY, hpos_list, NULL); idvpos = DialogOptionCreate("Vertical Id Position ", 3, 0, change_idvpos, DIALOG_OPT_STR_ARY, vpos_list, NULL); DialogAddRow(2); font = DialogOptionCreate("Font ", 6, 5, change_font, DIALOG_OPT_STR_ARY, fonts, font_values); point = DialogOptionCreate("Point ", 6, 10, change_point, DIALOG_OPT_STR_ARY, points, font_sizes); DialogAddRow(3); disp = DialogOptionCreate("Display Date", 3, 1, change_disp, DIALOG_OPT_STR_ARY, dates, NULL); rtc = DialogOptionCreate("Real Time Change ", 2, 0, change_rtc, DIALOG_OPT_STR_ARY, opts, NULL); line = DialogOptionCreate("Line Type ", 2, 0, change_solid, DIALOG_OPT_STR_ARY, lines, NULL); DialogAddRow(2); colorw = DialogOptionCreate("Color ", ncolor, 0, change_color, DIALOG_OPT_STR_ARY, color_name, color_index); drawlyr = DialogOptionCreate("Draw Layer ", 4, 0, change_drawlyr, DIALOG_OPT_STR_ARY, drawlyrs, NULL); plinew = DialogOptionCreate("Slip Precedence Objects ", 2, 0, change_pline, DIALOG_OPT_STR_ARY, opts, NULL); DialogStdButtons(verify_fun, (XtPointer)DIALOG_UPDATE, verify_fun, (XtPointer)DIALOG_CANCEL, (XtCallbackProc)ShowHelp, "sequence"); } /*********************************************************************** * * FUNCTION: * add_sequence() * * INPUTS: * strtdate, endate (utc_val) * disp, solid, hpos, vpos, line (int) * font, point, layer, rtc (int) * text (char *) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * adds new sequence object */ int add_sequence(utc_val strtdate, utc_val endate, int disp, int solid, int hpos, int vpos, int line, int font, int point, int layer, int color, char *text, int rtc, char *idtext, int idtog, int idhpos, int idvpos) { int i; /* index */ i = new_index(FALSE); objary[i].z.seqptr = (struct seq *)XtMalloc(sizeof(struct seq)); objary[i].z.seqptr->strtdate = strtdate; objary[i].z.seqptr->endate = endate; objary[i].z.seqptr->disp = (enum tds)disp; objary[i].z.seqptr->solid = solid; objary[i].z.seqptr->line = line; objary[i].z.seqptr->font = font; objary[i].z.seqptr->point = point; objary[i].z.seqptr->color = color; objary[i].z.seqptr->hpos = hpos; objary[i].z.seqptr->vpos = vpos; objary[i].z.seqptr->idtog = idtog; objary[i].z.seqptr->idhpos = idhpos; objary[i].z.seqptr->idvpos = idvpos; objary[i].z.seqptr->text = XtNewString(text); objary[i].z.seqptr->idtext = XtNewString(idtext); objary[i].z.seqptr->rtc = rtc; objary[i].type = OBJ_SEQ; objary[i].layer = layer; objary[i].opsptr = &seq_ops; return i; } /*********************************************************************** * * FUNCTION: * rem_sequence() * * INPUTS: * i (int) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * This module removes sequence object i from the data base */ static void rem_sequence(int i, int dir) { struct obj *objptr; /* temp object pointer */ int (*ip)[]; /* array of pline indices */ int nip; /* number of indices */ int j; /* temp loop index */ int prec = 0; switch (i) { case BACK: objptr = &objbck; break; case TEMP: objptr = &objtmp; prec = 1; break; default: objptr = &(objary[i]); break; } /* * only remove precedence lines if object is not temporary */ if (!prec) { if (objptr->precptr != NULL) { if (objptr->precptr->nelems > 0) { nip = objptr->precptr->nelems; ip = (int(*)[])XtMalloc((Cardinal)(sizeof(int) * nip)); for (j = 0; j < nip; j++) { (*ip)[j] = elemof_dynarray(objptr->precptr, j); } for (j = 0; j < nip; j++) { rem_pline((*ip)[j], OBJECT); } XtFree((char *)ip); delete_dynarray(objptr->precptr); } } } freeRectList(objptr->rlist); XtFree(objptr->z.seqptr->text); XtFree((char *)objptr->z.seqptr); rem_object(objptr); } /*********************************************************************** * * FUNCTION: * mov_sequence() * * INPUTS: * i, x, y (int) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * This module moves the sequence object when the middle mouse * button is pressed */ static void mov_sequence(int i, int x, int y, int dir) { XRectangle *(*r)[]; /* rectangle */ r = getMoveRect(objary[i].rlist); objary[i].z.seqptr->line = (((*r)[0]->y+y+1-y_act_bottom)/y_gap)+page_begin; } /*********************************************************************** * * FUNCTION: * lim_sequence() * * INPUTS: * i (int) * x1, y1, x2, y2 (int *) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * This module limits the range of motion of the sequence object i */ static void lim_sequence(int i, int *x1, int *y1, int *x2, int *y2, int dir) { XRectangle *(*r)[]; /* rectangle */ r = getMoveRect(objary[i].rlist); *x1 = (*r)[0]->x; *y1 = y_act_bottom; *x2 = (*r)[0]->x; *y2 = y_lines_end - y_gap; } /*********************************************************************** * * FUNCTION: * loc_sequence() * * INPUTS: * i (int) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * locates posittion of sequence object i */ static void loc_sequence(int i, int dir) { struct seq *seqptr; /* local pointer */ XRectangle r; /* rectangle */ XRectangle *(*line_rect)[]; /* line rectangle */ XRectangle rtc; /* rectangle if real time change */ int xs, xe; /* x coordinates of dates */ int lnpos; /* line position */ int dxltime, dxrtime; /* length of time string */ char lbuf[6], rbuf[6]; /* right and left text buffers */ int mo, da, yr; /* month, day and year of date */ int doy; /* utc day of year */ int txwidth, txheight; /* height and width of text buffer */ int width; /* width of string */ seqptr = objary[i].z.seqptr; if (((seqptr->line < page_begin) || (seqptr->line > page_end)) || ((seqptr->strtdate < objary[0].z.chtptr->start_date) && (seqptr->endate < objary[0].z.chtptr->start_date)) || ((seqptr->strtdate > objary[0].z.chtptr->end_date) && (seqptr->endate > objary[0].z.chtptr->end_date))) { setRectList(objary[i].rlist, 0); return; } xs = utc_to_x(seqptr->strtdate); xe = utc_to_x(seqptr->endate + UTC_ONE_DAY); if ((xe == XVAL_EARLY) || (xs == XVAL_LATE)) { setRectList(objary[i].rlist, 0); return; } if (xs == XVAL_EARLY) { xs = x_time_offset; } if (xe == XVAL_LATE) { xe = x_right_margin; } lnpos = hln_objary[seqptr->line]; line_rect = getMoveRect(Hobjary[lnpos].rlist); txwidth = gr_txwidth(seqptr->font|seqptr->point); if (seqptr->disp == TDS_DOY) { doy = get_doy(seqptr->strtdate); (void)sprintf(lbuf, "%03d", doy); doy = get_doy(seqptr->endate); (void)sprintf(rbuf, "%03d", doy); dxltime = (strlen(lbuf) + 1) * txwidth; dxrtime = (strlen(rbuf) + 1) * txwidth; } else if (seqptr->disp == TDS_DATE) { get_mdy(&mo, &da, &yr, seqptr->strtdate); (void)sprintf(lbuf, "%d/%d", mo, da); get_mdy(&mo, &da, &yr, seqptr->endate); (void)sprintf(rbuf, "%d/%d", mo, da); dxltime = (strlen(lbuf) + 1) * txwidth; dxrtime = (strlen(rbuf) + 1) * txwidth; } else { dxltime = 0; dxrtime = 0; } width = gr_strwidth(seqptr->text, seqptr->font|seqptr->point); if (gr_strwidth(seqptr->idtext, seqptr->font|seqptr->point) > width) { width = gr_strwidth(seqptr->idtext, seqptr->font|seqptr->point); } r.x = xs - dxltime - txwidth - 2; r.width = xe - xs + dxltime + dxrtime + 7 + txwidth; if (((seqptr->hpos == GR_LEFT) && (strcmp(seqptr->text, "") != 0)) || ((seqptr->idhpos == GR_LEFT) && (strcmp(seqptr->idtext, "") != 0))) { r.x = r.x - width - 2; r.width = r.width + width + 2; } if (((seqptr->hpos == GR_RIGHT) && (strcmp(seqptr->text,"") != 0)) || ((seqptr->idhpos == GR_RIGHT) && (strcmp(seqptr->idtext, "") != 0))) { r.width = r.width + width + 2; } if (((seqptr->hpos == GR_CENTER) && (strcmp(seqptr->text,"") != 0)) || ((seqptr->idhpos == GR_CENTER) && (strcmp(seqptr->idtext, "") != 0))) { r.x = r.x - width/4 - 2; r.width = r.width + width/2 + 2; } r.y = (*line_rect)[0]->y; r.height = y_gap; txheight = gr_txheight(seqptr->font|seqptr->point); if ((seqptr->vpos == TX_ABOVE) && (strcmp(seqptr->text, "") != 0)) { r.y = r.y - 1 - txheight; r.height = r.height + txheight + 1; } else if ((seqptr->vpos == TX_BELOW) && (strcmp(seqptr->text, "") != 0)) { r.height = r.height + txheight + 1; } if (seqptr->idtog == TOG_ON) { if (seqptr->idvpos == TX_ABOVE) { r.y = r.y - txheight - 1; r.height = r.height + txheight + 1; } else if (seqptr->idvpos == TX_BELOW) { r.height = r.height + txheight + 1; } } if (objary[i].z.seqptr->rtc == TRUE) { rtc.x = x_right_margin + 1; rtc.y = r.y; rtc.width = gr_txheight(seqptr->font|seqptr->point); rtc.height = r.height; setRectList(objary[i].rlist, 2, &r, RL_PRIMARY, &rtc, RL_EXPOSE); } else { setRectList(objary[i].rlist, 1, &r, RL_PRIMARY); } } /*********************************************************************** * * FUNCTION: * dsp_sequence() * * INPUTS: * i (int) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * pops up a edit box for the sequence i */ static void dsp_sequence(int i) { struct seq *seqptr; /* to make code more readable */ int xs, xe; /* x-pos of start/end times */ int dx; /* length of text string */ int dxltime; /* length of start hour string */ int dxrtime; /* length of end hour string */ char lbuf[6]; /* print start hour buffer */ char rbuf[6]; /* print end hour buffer */ XRectangle *(*r)[]; /* rectangle */ int width; /* width of character */ enum tog mask; /* mask for text */ int doy, yr, da, mo; /* day of year, month, day, year of date */ int j; /* temp loop index */ int temp_font; /* font is bold if rtc is TRUE */ int text_x, text_y; /* placement of text */ int idtext_x, idtext_y; /* placement of id text */ int txheight; /* height of text character */ seqptr = objary[i].z.seqptr; if (((seqptr->line < page_begin) || (seqptr->line > page_end)) || ((seqptr->strtdate < objary[0].z.chtptr->start_date) && (seqptr->endate < objary[0].z.chtptr->start_date)) || ((seqptr->strtdate > objary[0].z.chtptr->end_date) && (seqptr->endate > objary[0].z.chtptr->end_date))) { /* seqivity is on line outside of current display region */ setRectList(objary[i].rlist, 0); return; } else { xs = utc_to_x(seqptr->strtdate); xe = utc_to_x(seqptr->endate + UTC_ONE_DAY); if ((xe == XVAL_EARLY) || (xs == XVAL_LATE)) { /* date is outside of current display region */ setRectList(objary[i].rlist, 0); return; } if (xs == XVAL_EARLY) { xs = x_time_offset; } if (xe == XVAL_LATE) { xe = x_right_margin; } r = getMoveRect(Hobjary[hln_objary[seqptr->line]].rlist); width = gr_txwidth(seqptr->font|seqptr->point); txheight = gr_txheight(seqptr->font|seqptr->point); if (seqptr->solid == 1) { /* Box line type */ gr_rect_clear(xs+1, (*r)[0]->y + 1,xe-xs-2,(*r)[0]->height - 3); gr_set_color(color_name[seqptr->color], color_gscale[seqptr->color]); gr_rectangle(xs, (*r)[0]->y + 2, xe-xs, (*r)[0]->height - 4); } else { /* solid line type */ gr_set_color(color_name[seqptr->color],color_gscale[seqptr->color]); gr_line(xs, (*r)[0]->y+(*r)[0]->height/2, xe, (*r)[0]->y + (*r)[0]->height/2); if (xs != x_time_offset) { gr_line(xs, (*r)[0]->y + 3, xs, (*r)[0]->y+(*r)[0]->height - 4); } if (xe != x_right_margin) { gr_line(xe, (*r)[0]->y + 3, xe, (*r)[0]->y+(*r)[0]->height - 4); } } get_mdy(&mo, &da, &yr, seqptr->strtdate); if (seqptr->disp == TDS_DOY) { doy = get_doy(seqptr->strtdate); (void)sprintf(lbuf, "%03d", doy); doy = get_doy(seqptr->endate); (void)sprintf(rbuf, "%03d", doy); dxltime = (strlen(lbuf) + 1) * width; dxrtime = (strlen(rbuf) + 1) * width; } else if (seqptr->disp == TDS_DATE) { get_mdy(&mo, &da, &yr, seqptr->strtdate); (void)sprintf(lbuf, "%d/%d", mo, da); get_mdy(&mo, &da, &yr, seqptr->endate); (void)sprintf(rbuf, "%d/%d", mo, da); dxltime = (strlen(lbuf) + 1) * width; dxrtime = (strlen(rbuf) + 1) * width; } else { (void)sprintf(lbuf, "%s", ""); (void)sprintf(rbuf, "%s", ""); dxltime = 0; dxrtime = 0; } dx = strlen(seqptr->text) * width + 4; if (objary[i].layer == 0) { mask = TOG_OFF; } else { mask = TOG_ON; } if (seqptr->rtc) { /* font is not bold, so make it bold */ if (seqptr->font == GR_COURIER) { temp_font = GR_COURIER_BOLD; } else if (seqptr->font == GR_HELVETICA) { temp_font = GR_HELVETICA_BOLD; } else if (seqptr->font == GR_TIMES) { temp_font = GR_TIMES_BOLD; } } else { temp_font = seqptr->font; } gr_text(xs - width,(*r)[0]->y + (*r)[0]->height*3/4, lbuf, GR_RIGHT, temp_font|seqptr->point, (int)mask); gr_text(xe + width, (*r)[0]->y + (*r)[0]->height*3/4, rbuf, GR_LEFT, temp_font|seqptr->point, (int)mask); width = gr_strwidth(seqptr->text, seqptr->font|seqptr->point); switch (seqptr->hpos) { case GR_LEFT: text_x = xs - dxltime - width - 4; break; case GR_RIGHT: text_x = xe + dxrtime + 4; break; case GR_CENTER: text_x = xs - width/2 + (xe - xs)/2; break; } /* switch */ switch (seqptr->vpos) { case TX_ABOVE: text_y = (*r)[0]->y - 1; break; case TX_BELOW: text_y = (*r)[0]->y + y_gap + txheight + 2; break; default: text_y = (*r)[0]->y + y_gap/2 + txheight/2 + 1; break; } gr_text(text_x, text_y, seqptr->text, GR_LEFT, (seqptr->font|seqptr->point), 0); if (seqptr->rtc) { /* real-time change */ for (j = 1; j <= RTC_WIDTH; j++) gr_line(x_right_margin + j, (*r)[0]->y + (*r)[0]->height/4, x_right_margin + j, (*r)[0]->y + (*r)[0]->height*3/4); } /* if */ if (seqptr->idtog == TOG_ON) { width = gr_strwidth(seqptr->idtext, seqptr->font|seqptr->point); switch (seqptr->idhpos) { case GR_LEFT: idtext_x = xs - dxltime - width - 4; break; case GR_RIGHT: idtext_x = xe + dxrtime + 4; break; default: idtext_x = xs - width/2 + (xe - xs)/2; break; } switch (seqptr->idvpos) { case TX_ABOVE: idtext_y = (*r)[0]->y - 1; break; case TX_BELOW: idtext_y = (*r)[0]->y + y_gap + txheight + 2; break; default: idtext_y = (*r)[0]->y + y_gap/2 + txheight/2 + 1; break; } gr_text(idtext_x, idtext_y, seqptr->idtext, GR_LEFT, seqptr->font|seqptr->point, 0); } } /* else display on page */ } /*********************************************************************** * * FUNCTION: * msg_sequence() * * INPUTS: * i (int) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * displays the sequence message for object i */ static void msg_sequence(int i, int dir) { char buf[64]; strcpy(buf, "Sequence: "); strncat(buf, objary[i].z.seqptr->text, 40); Message(buf); } /*********************************************************************** * * FUNCTION: * cpy_sequence() * * INPUTS: * to, from (struct obj *) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * This module copies sequence from to sequence to */ static void cpy_sequence(struct obj *to, struct obj *from) { if (from->type == OBJ_NUL) { return; } to->z.seqptr = (struct seq *)XtMalloc(sizeof(struct seq)); to->z.seqptr->strtdate = from->z.seqptr->strtdate; to->z.seqptr->endate = from->z.seqptr->endate; to->z.seqptr->line = from->z.seqptr->line; to->z.seqptr->disp = from->z.seqptr->disp; to->z.seqptr->solid = from->z.seqptr->solid; to->z.seqptr->hpos = from->z.seqptr->hpos; to->z.seqptr->vpos = from->z.seqptr->vpos; to->z.seqptr->font = from->z.seqptr->font; to->z.seqptr->point = from->z.seqptr->point; to->z.seqptr->color = from->z.seqptr->color; to->z.seqptr->rtc = from->z.seqptr->rtc; to->z.seqptr->idtog = from->z.seqptr->idtog; to->z.seqptr->idhpos = from->z.seqptr->idhpos; to->z.seqptr->idvpos = from->z.seqptr->idvpos; to->z.seqptr->text = XtNewString(from->z.seqptr->text); to->z.seqptr->idtext = XtNewString(from->z.seqptr->idtext); to->type = OBJ_SEQ; to->opsptr = &seq_ops; to->layer = from->layer; to->precptr = from->precptr; to->rlist = copyRectList(from->rlist); } /*********************************************************************** * * FUNCTION: * edt_sequence() * * INPUTS: * i, new (int) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * pops up a edit box for the sequence i */ static void edt_sequence(int i, int new) { char buf[4]; if (seq_dialog == NULL) { create_dialog(); } (*(objary[i].opsptr->cpy))(&objtmp, &objary[i]); new_point = objtmp.z.seqptr->point; new_font = objtmp.z.seqptr->font; new_disp = objtmp.z.seqptr->disp; new_hpos = objtmp.z.seqptr->hpos; new_vpos = objtmp.z.seqptr->vpos; new_solid = objtmp.z.seqptr->solid; new_drawlyr = objtmp.layer; new_color = objtmp.z.seqptr->color; new_rtc = objtmp.z.seqptr->rtc; new_idtog = objtmp.z.seqptr->idtog; new_idhpos = objtmp.z.seqptr->idhpos; new_idvpos = objtmp.z.seqptr->idvpos; pline_flag = FALSE; if (new) { /* * only need rem when undo option is added */ (*(objary[i].opsptr->rem))(i, OBJECT); i = -1; } DialogDateSet(sdate, objtmp.z.seqptr->strtdate); DialogDateSet(edate, objtmp.z.seqptr->endate); sprintf(buf, "%d", objtmp.z.seqptr->line); DialogTextSet(lpos, buf); DialogOptionSet(font, (int)new_font); DialogOptionSet(point, (int)new_point); DialogOptionSet(hpos, (int)new_hpos); DialogOptionSet(vpos, (int)new_vpos); DialogOptionSet(disp, (int)new_disp); DialogOptionSet(line, (int)new_solid); DialogOptionSet(drawlyr, (int)new_drawlyr); DialogOptionSet(colorw, (int)new_color); DialogOptionSet(idhpos, (int)new_idhpos); DialogOptionSet(idvpos, (int)new_idvpos); DialogOptionSet(idtog, (int)new_idtog); DialogOptionSet(rtc, (int)new_rtc); if ((objtmp.precptr == NULL) || (new)) { XtSetSensitive(plinew->parent, FALSE); } else { XtSetSensitive(plinew->parent, TRUE); } DialogOptionSet(plinew, pline_flag); DialogTextSet(text, objtmp.z.seqptr->text); DialogTextSet(idtext, objtmp.z.seqptr->idtext); EditObject(i, seq_dialog); } /*********************************************************************** * * FUNCTION: * seq_ok_button() * * INPUTS: * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * this module checks input after the ok button is pressed */ static void seq_ok_button(void) { int change = DIALOG_NO_CHANGE; /* object changed */ utc_val sdate_diff, edate_diff; /* slip in dates */ utc_val temp_date; char *buf; int val; /* temporary integer */ temp_date = DialogDateGet(sdate); if (temp_date != UTC_INVALID) { if (temp_date != objtmp.z.seqptr->strtdate) { change |= DIALOG_UPDATE; } } else { Warning("Improper Start Date"); change |= DIALOG_ERROR; } sdate_diff = temp_date - objtmp.z.seqptr->strtdate; temp_date = DialogDateGet(edate); if (temp_date != UTC_INVALID) { if (temp_date != objtmp.z.seqptr->endate) { change |= DIALOG_UPDATE; } } else { Warning("Improper End Date"); change |= DIALOG_ERROR; } edate_diff = temp_date - objtmp.z.seqptr->endate; /* * slip objects associated by precedence lines */ set_pline(sdate_diff, edate_diff); objtmp.z.seqptr->strtdate = objtmp.z.seqptr->strtdate + sdate_diff; objtmp.z.seqptr->endate = objtmp.z.seqptr->endate + edate_diff; if (objtmp.z.seqptr->endate < objtmp.z.seqptr->strtdate) { Warning("Sequence Start Date must precede End date"); change |= DIALOG_ERROR; } if (new_disp != objtmp.z.seqptr->disp) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->disp = DialogOptionGet(disp); if (new_solid != objtmp.z.seqptr->solid) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->solid = DialogOptionGet(line); if (new_hpos != objtmp.z.seqptr->hpos) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->hpos = DialogOptionGet(hpos); if (new_vpos != objtmp.z.seqptr->vpos) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->vpos = DialogOptionGet(vpos); val = DialogTextGetInt(lpos); if ((val < 1) || (val > MAX_LINE)) { Warning("Improper Line Position"); change |= DIALOG_ERROR; } else if (val != objtmp.z.seqptr->line) { change |= DIALOG_UPDATE; objtmp.z.seqptr->line = val; } if (new_drawlyr != objtmp.layer) { change |= DIALOG_UPDATE; } objtmp.layer = DialogOptionGet(drawlyr); if (new_font != objtmp.z.seqptr->font) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->font = DialogOptionGet(font); if (new_point != objtmp.z.seqptr->point) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->point = DialogOptionGet(point); if (new_rtc != objtmp.z.seqptr->rtc) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->rtc = DialogOptionGet(rtc); if (new_color != objtmp.z.seqptr->color) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->color = DialogOptionGet(colorw); if (new_idtog != objtmp.z.seqptr->idtog) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->idtog = DialogOptionGet(idtog); if (new_idhpos != objtmp.z.seqptr->idhpos) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->idhpos = DialogOptionGet(idhpos); if (new_idvpos != objtmp.z.seqptr->idvpos) { change |= DIALOG_UPDATE; } objtmp.z.seqptr->idvpos = DialogOptionGet(idvpos); buf = DialogTextGet(text); if (strcmp(buf, objtmp.z.seqptr->text)) { change |= DIALOG_UPDATE; XtFree(objtmp.z.seqptr->text); objtmp.z.seqptr->text = buf; } else { XtFree(buf); } buf = DialogTextGet(idtext); if (strcmp(buf, objtmp.z.seqptr->idtext)) { change |= DIALOG_UPDATE; XtFree(objtmp.z.seqptr->idtext); objtmp.z.seqptr->idtext = buf; } else { XtFree(buf); } object_change = change; DialogFlagSet(change); } /*********************************************************************** * * FUNCTION: * load_sequence() * * INPUTS: * buf (char *) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * loads sequence object record */ static int load_sequence(char *buf) { utc_val st_date, e_date; /* start and end date */ int line; /* index to hline object */ int layer; /* drawing layer */ enum tds disp; /* display flag */ int solid; /* line_type */ int hpos, vpos; /* text position */ int font; /* text font */ int point; /* point for text font */ char text[64]; /* comment text */ int color; /* color of sequence */ int rtc; /* rtc toggle */ int idtog; /* idtog toggle */ int idhpos; /* idhpos value */ int idvpos; /* idvpos value */ char idtext[64]; /* id text */ int i; /* temp index */ if (record_scan(buf + 1, "ttdddddddddqdqddd", &st_date, &e_date, &disp, &solid, &hpos, &vpos, &line, &font, &point, &layer, &color, text, &rtc, idtext, &idtog, &idhpos, &idvpos) == 17) { if ((line < 0) || (line > num_pages * pg_lines)) { Warning("Illegal Sequence line %d", line); } else if ((layer < 0) || (layer > 3)) { Warning("Illegal Sequence layer %d", layer); } else if (((int)disp < TDS_NONE) || ((int)disp > TDS_DATE)) { Warning("Illegal Sequence display %d", disp); } else if ((hpos < 0) || (hpos > 2)) { Warning("Illegal Sequence horizontal position %d", hpos); } else if ((vpos < 0) || (vpos > 2)) { Warning("Illegal Sequence vertical position %d", vpos); } else if ((solid < 0) || (solid > 2)) { Warning("Illegal Sequence line type %d", solid); } else if ((font != GR_COURIER) && (font != GR_COURIER_BOLD) && (font != GR_HELVETICA) && (font != GR_HELVETICA_BOLD) && (font != GR_TIMES) && (font != GR_TIMES_BOLD)) { Warning("Illegal Sequence font %d", font); } else if ((point != 8) && (point != 10) && (point != 12) && (point != 14) && (point != 18) && (point != 24)) { Warning("Illegal Sequence point %d", point); } else if ((color < 0) || (color > ncolor)) { Warning("Illegal Sequence color %d", color); } else if ((rtc < 0) || (rtc > 1)) { Warning("Illegal Sequence rtc %d", rtc); } else if ((idhpos < 0) || (idhpos > 2)) { Warning("Illegal Sequence id hpos %d", idhpos); } else if ((idvpos < 0) || (idvpos > 2)) { Warning("Illegal Sequence id vpos %d", idvpos); } else if ((idtog < 0) || (idtog > 1)) { Warning("Illegal Sequence id display toggle %d", idtog); } else { i = add_sequence(st_date, e_date, (int)disp, solid, hpos, vpos, line, font, point, layer, color, text, rtc, idtext, idtog, idhpos, idvpos); return 0; } return -1; } else { return -1; } } /*********************************************************************** * * FUNCTION: * sav_sequence() * * INPUTS: * i (int) * fp (FILE *) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * saves the sequence object i to fp */ static void sav_sequence(int i, FILE *fp, int dir) { struct seq *seqptr; /*temp object pointer */ char buf[1024]; /* temp buffer */ seqptr = objary[i].z.seqptr; buf[0] = 'U'; buf[1] = ' '; (void)record_print(buf+2, "ttdddddddddqdqddd", seqptr->strtdate, seqptr->endate, seqptr->disp, seqptr->solid, seqptr->hpos, seqptr->vpos, seqptr->line, seqptr->font, seqptr->point, objary[i].layer, seqptr->color, seqptr->text, seqptr->rtc, seqptr->idtext, seqptr->idtog, seqptr->idhpos, seqptr->idvpos); (void)fputs(buf, fp); } /*********************************************************************** * * FUNCTION: * cancel_button() * * INPUTS: * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * discards any edits and closes edit window */ /* ARGSUSED */ static void cancel_button(void) { object_change = DIALOG_CANCEL; DialogFlagSet(DIALOG_CANCEL); } /*********************************************************************** * * FUNCTION: * change_color() * * INPUTS: * button (Widget) * option, any_data (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * sets new color for sequence object */ static void change_color(Widget button, XtPointer option, XtPointer any_data) { new_color = (int)option; } /*********************************************************************** * * FUNCTION: * change_disp() * * INPUTS: * button (Widget) * option (XtPointer) * anydata (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes display date to the input value */ static void change_disp(Widget button, XtPointer option, XtPointer any_data) { new_disp = (int)option; } /*********************************************************************** * * FUNCTION: * change_hpos() * * INPUTS: * button (Widget) * option, any_data (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes the horizontal position of the sequence object */ static void change_hpos(Widget button, XtPointer option, XtPointer any_data) { new_hpos = (int)option; } /*********************************************************************** * * FUNCTION: * change_vpos() * * INPUTS: * button (Widget) * option, any_data (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes the vertical position of the sequence object */ static void change_vpos(Widget button, XtPointer option, XtPointer any_data) { new_vpos = (int)option; } /*********************************************************************** * * FUNCTION: * change_drawlyr() * * INPUTS: * button (Widget) * option, any_data (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes the draw layer of the sequence object */ static void change_drawlyr(Widget button, XtPointer option, XtPointer any_data) { new_drawlyr = (int)option; } /*********************************************************************** * * FUNCTION: * change_font() * * INPUTS: * button - (Widget) * option - (XtPointer) * any_data - (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes the font of the sequence object * */ static void change_font(Widget button, XtPointer option, XtPointer any_data) { new_font = (int)option; } /*********************************************************************** * * FUNCTION: * change_point() * * INPUTS: * button - (Widget) * option - (XtPointer) * any_data - (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes the font point size of the sequence object * */ static void change_point(Widget button, XtPointer option, XtPointer any_data) { new_point = (int)option; } /*********************************************************************** * * FUNCTION: * change_solid() * * INPUTS: * button (Widget) * option (XtPointer) * anydata (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes solid line type to the input value */ static void change_solid(Widget button, XtPointer option, XtPointer any_data) { new_solid = (int)option; } /*********************************************************************** * * FUNCTION: * change_rtc() * * INPUTS: * button (Widget) * option (XtPointer) * anydata (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes rtc to the input value */ static void change_rtc(Widget button, XtPointer option, XtPointer any_data) { new_rtc = (int)option; } /*********************************************************************** * * FUNCTION: * change_idhpos() * * INPUTS: * button (Widget) * option (XtPointer) * anydata (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes idhpos to the input value */ static void change_idhpos(Widget button, XtPointer option, XtPointer any_data) { new_idhpos = (int)option; } /*********************************************************************** * * FUNCTION: * change_idvpos() * * INPUTS: * button (Widget) * option (XtPointer) * anydata (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes idvpos to the input value */ static void change_idvpos(Widget button, XtPointer option, XtPointer any_data) { new_idvpos = (int)option; } /*********************************************************************** * * FUNCTION: * change_idtog() * * INPUTS: * button (Widget) * option (XtPointer) * anydata (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * changes idtog to the input value */ static void change_idtog(Widget button, XtPointer option, XtPointer any_data) { new_idtog = (int)option; } /*********************************************************************** * * FUNCTION: * change_pline() * * INPUTS: * button - (Widget) * option - (XtPointer) * any_data - (XtPointer) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * This module sets the pline object slip value for activities * */ static void change_pline(Widget button, XtPointer option, XtPointer any_data) { pline_flag = (int)option; } /*********************************************************************** * * FUNCTION: * set_pline() * * INPUTS: * sdate_diff, edate_diff (int) * * OUTPUTS: * * RETURNS: * * EXTERNALLY READ: * * EXTERNALLY MODIFIED: * * DESCRIPTION: * This module adjusts the dates of the objects associated by * precedence lines by the slip amount of the activity dates */ static void set_pline(utc_val sdate_diff, utc_val edate_diff) { int i, co; /* temp indices */ if ((pline_flag) && (objtmp.precptr != NULL)) { for (i = 0; i < sizeof_dynarray(objtmp.precptr); i++) { co = elemof_dynarray(objtmp.precptr, i); if ((objary[plnary[co].obj1].z.seqptr->strtdate != objtmp.z.seqptr->strtdate) || (objary[plnary[co].obj1].z.seqptr->endate != objtmp.z.seqptr->endate)) { switch (objary[plnary[co].obj1].type) { case OBJ_EVT: objary[plnary[co].obj1].z.evtptr->edate += sdate_diff; (*(objary[plnary[co].obj1].opsptr->loc))(plnary[co].obj1, OBJECT); break; case OBJ_ACT: objary[plnary[co].obj1].z.actptr->strtdate += sdate_diff; objary[plnary[co].obj1].z.actptr->endate += edate_diff; (*(objary[plnary[co].obj1].opsptr->loc))(plnary[co].obj1, OBJECT); break; case OBJ_SACT: objary[plnary[co].obj1].z.sactptr->strtdate += sdate_diff; objary[plnary[co].obj1].z.sactptr->endate += edate_diff; (*(objary[plnary[co].obj1].opsptr->loc))(plnary[co].obj1, OBJECT); break; case OBJ_SLP: objary[plnary[co].obj1].z.slpptr->strtdate += sdate_diff; objary[plnary[co].obj1].z.slpptr->endate += edate_diff; (*(objary[plnary[co].obj1].opsptr->loc))(plnary[co].obj1, OBJECT); break; case OBJ_SEQ: objary[plnary[co].obj1].z.seqptr->strtdate += sdate_diff; objary[plnary[co].obj1].z.seqptr->endate += edate_diff; (*(objary[plnary[co].obj1].opsptr->loc))(plnary[co].obj1, OBJECT); break; default: break; } } if ((objary[plnary[co].obj2].z.seqptr->strtdate != objtmp.z.seqptr->strtdate) || (objary[plnary[co].obj2].z.seqptr->endate != objtmp.z.seqptr->endate)) { switch (objary[plnary[co].obj2].type) { case OBJ_EVT: objary[plnary[co].obj2].z.evtptr->edate += sdate_diff; (*(objary[plnary[co].obj2].opsptr->loc))(plnary[co].obj2, OBJECT); break; case OBJ_ACT: objary[plnary[co].obj2].z.actptr->strtdate += sdate_diff; objary[plnary[co].obj2].z.actptr->endate += edate_diff; (*(objary[plnary[co].obj2].opsptr->loc))(plnary[co].obj2, OBJECT); break; case OBJ_SACT: objary[plnary[co].obj2].z.sactptr->strtdate += sdate_diff; objary[plnary[co].obj2].z.sactptr->endate += edate_diff; (*(objary[plnary[co].obj2].opsptr->loc))(plnary[co].obj2, OBJECT); break; case OBJ_SLP: objary[plnary[co].obj2].z.slpptr->strtdate += sdate_diff; objary[plnary[co].obj2].z.slpptr->endate += edate_diff; (*(objary[plnary[co].obj2].opsptr->loc))(plnary[co].obj2, OBJECT); break; case OBJ_SEQ: objary[plnary[co].obj2].z.seqptr->strtdate += sdate_diff; objary[plnary[co].obj2].z.seqptr->endate += edate_diff; (*(objary[plnary[co].obj2].opsptr->loc))(plnary[co].obj2, OBJECT); break; default: break; } } } } } /*********************************************************************** * * FUNCTION: * verify_fun() * * INPUTS: * w (Widget) * x, y (XtPointer) * * OUTPUTS: * none * * RETURNS: * none * * EXTERNALLY READ: * none * * EXTERNALLY MODIFIED: * none * * DESCRIPTION: * validates that the popup dialog can be closed */ static void verify_fun(Widget w, XtPointer x, XtPointer y) { if ((int)x == DIALOG_CANCEL) { if (!ShellValidateClose(w)) return; cancel_button(); } else if ((int)x == DIALOG_UPDATE) { seq_ok_button(); } }