home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / xview / genial / func / trace.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-14  |  17.3 KB  |  633 lines

  1.  
  2. /*
  3.  * trace.c -- routines for running traces along lines or splines
  4.  */
  5.  
  6. #include "display.h"
  7. #include "ui.h"
  8. #include "log.h"
  9. #include "reg.h"
  10. #include "scale.h"
  11. #include "trace_ui.h"
  12.  
  13. GC        trgc;
  14.  
  15. struct trcontext *newtrace(), *trace_by_win();
  16. struct trcontext *trace_by_lid(), *trace_by_panelwin();
  17.  
  18. trace_tcntrl_objects *trace_tcntrl;
  19. trace_trwin_objects *trace_twin;
  20.  
  21. extern int shrink_fac;
  22.  
  23. /*************************************************************/
  24. trace_init()
  25. {
  26.     /* do not raise options window; let the options routine handle that. */
  27.     clear_info();
  28.     lab_info("Please select a region for trace", 1);
  29.     lab_info("Hit <eval> when done. ", 2);
  30.  
  31.     /* initialize trace control window if we havent already */
  32.     if (trace_tcntrl == NULL) {
  33.     trace_tcntrl = trace_tcntrl_objects_initialize(NULL,
  34.                                base_win->ctrlwin);
  35.     xv_set(trace_tcntrl->traceno,
  36.            PANEL_VALUE, curfunc->id,
  37.            NULL);
  38.     };
  39.  
  40.     /* set the region type */
  41.     reg_setdom(TRACE);
  42.  
  43.     return 0;
  44. }
  45.  
  46. /***************************************************************/
  47. int
  48. trace_eval()
  49. {
  50.     struct pval *cpbuf;        /* continuous pbuf formed from the log entry */
  51.     int       np;        /* number of points in above */
  52.     struct trcontext *curtrace;
  53.  
  54.     /*
  55.      * trace windows are interactive, so things will be much more efficient
  56.      * if we have a continous point buffer
  57.      */
  58.  
  59.     /* type BOX disabled: What is a box trace?? -BLT */
  60.     if (curfunc->reg->r_type == BOX) {
  61.     np = box_vec(curfunc->reg->r_plist, &cpbuf);
  62.     } else {
  63.     np = makepbuf(curfunc->reg->r_dlist, &cpbuf);
  64.     }
  65.     /* make a new trace context */
  66.     curtrace = newtrace(np);
  67.     curtrace->npts = np;
  68.     curtrace->pbuf = cpbuf;
  69.     if (curfunc->reg->r_type == BOX) {
  70.     curtrace->flags |= RECT;
  71.     }
  72.     /*
  73.      * if there is information in the auxiliary data, handle it.  If not, put
  74.      * it there
  75.      */
  76.     tr_auxd(curfunc, curtrace);
  77.  
  78.     if (curtrace->t_attr.scale_type == 1) {
  79.     scale_trace(curtrace);
  80.     }
  81.     /* set the control window appropriately */
  82.     trace_panel(curtrace);
  83.     xv_set(trace_tcntrl->traceno, PANEL_VALUE, curfunc->id, NULL);
  84.  
  85.     return 0;
  86. }
  87.  
  88. /***************************************************************/
  89. int
  90. trace_change(id)
  91.     int       id;
  92. {
  93.     struct pval *cpbuf;        /* continuous pbuf formed from the log entry */
  94.     int       np;        /* number of points in above */
  95.     struct trcontext *curtrace;
  96.  
  97. #ifdef DEBUG
  98.     printf("in trace change: \n");
  99. #endif
  100.  
  101.     curtrace = trace_by_lid(id);
  102.     if (curtrace == NULL) {
  103.     fprintf(stderr, "trace_change: Trace not found \n");
  104.     return -1;
  105.     }
  106.     np = makepbuf(curfunc->reg->r_dlist, &cpbuf);
  107.  
  108.     curtrace->npts = np;
  109.     curtrace->pbuf = cpbuf;
  110.  
  111. /* ADD: handle shrink mode */
  112.     xv_set(curtrace->win_info->trwin,
  113.        XV_WIDTH, MAX(np + 85, 265),
  114.        NULL);
  115.     xv_set(curtrace->win_info->trcanv,
  116.        XV_WIDTH, np + 85,
  117.        NULL);
  118.  
  119.     if (curtrace->t_attr.scale_type == 1) {
  120.     scale_trace(curtrace);
  121.     }
  122.     /* set the control window appropriately */
  123.     trace_panel(curtrace);
  124.     xv_set(trace_tcntrl->traceno, PANEL_VALUE, id, NULL);
  125.  
  126.     return 0;
  127. }
  128.  
  129. /*************************************************************/
  130. trace_clear(id)
  131.     int       id;
  132. /* clear the current trace */
  133. {
  134.     struct trcontext *ct;
  135.  
  136. #ifdef DEBUG
  137.     printf("trace_clear: log id # %d \n", id);
  138. #endif
  139.  
  140.     if ((ct = trace_by_lid(id)) == NULL) {
  141.     printf("trace_clear: trace #%d not found \n", id);
  142.     return -1;
  143.     }
  144.     integ_clear(ct);
  145.     deltrcontext(ct);
  146.     return 0;
  147. }
  148.  
  149. /*************************************************************/
  150. trace_reset()
  151. {
  152.     return;
  153. }
  154.  
  155. /*************************************************************/
  156.  
  157. struct trcontext *
  158. newtrace(np)
  159.     int       np;        /* number of points: needed to set width. */
  160. {
  161.     struct trcontext *trace;
  162.     char      title[80];
  163.     Notify_value trcanv_event_proc();
  164.     XGCValues gcval;
  165.     XFontStruct *fs;
  166.  
  167.     if (curfunc->trace != NULL)
  168.     free(curfunc->trace);
  169.  
  170.     trace = (struct trcontext *) malloc(sizeof(struct trcontext));
  171.     curfunc->trace = trace;
  172.  
  173.     trace->pbuf = NULL;
  174.     trace->npts = NULL;
  175.     trace->x = -1;
  176.     trace->y = -1;
  177.     trace->cb = (struct cbstore *) malloc(sizeof(struct cbstore));
  178.     trace->cb->cht = 0;
  179.     trace->cb->cwt = 0;
  180.     trace->flags = 0;
  181.     trace->integ.iwin = 0;
  182.     newtrattr(&trace->t_attr);
  183.     integ_init(&trace->integ);
  184.     sprintf(title, "Trace: %d", curfunc->id);
  185.  
  186.     /* create the actual window and canvas */
  187.     trace->win_info = trace_trwin_objects_initialize(NULL, base_win->ctrlwin);
  188.  
  189.     trace->trpntw = canvas_paint_window(trace->win_info->trcanv);
  190.     trace->trxid = (XID) xv_get(trace->trpntw, XV_XID, NULL);
  191.  
  192.     /* ADD: handle shrink mode!! */
  193.     xv_set(trace->win_info->trwin, XV_WIDTH, MAX(np + 85, 265),
  194.        XV_LABEL, title,
  195.        XV_SHOW, TRUE,
  196.        FRAME_CMD_PUSHPIN_IN, TRUE,
  197.        NULL);
  198.     xv_set(trace->win_info->trcanv,
  199.        XV_WIDTH, np + 85,
  200.        NULL);
  201.  
  202.     /* set up a GC for the window */
  203.     gcval.foreground = BlackPixel(display, DefaultScreen(display));
  204.     gcval.background = WhitePixel(display, DefaultScreen(display));
  205.     gcval.clip_mask = None;
  206.     trgc = XCreateGC(display, trace->trxid,
  207.              GCForeground | GCBackground | GCClipMask, &gcval);
  208.  
  209.     if (!(fs = XLoadQueryFont(display, "9x15"))) {
  210.     fprintf(stderr, "Font 9x15 not found, trying \'fixed\' \n");
  211.     if (!(fs = XLoadQueryFont(display, "fixed"))) {
  212.         fprintf(stderr, "error geting fonts, exitting...\n");
  213.         exit(-1);
  214.     }
  215.     }
  216.     XSetFont(display, trgc, fs->fid);
  217.  
  218.     return trace;
  219. }
  220.  
  221. /*******************************************************/
  222. deltrcontext(trace)
  223.     struct trcontext *trace;
  224. {
  225.     if (trace->cb->cwt != 0 && trace->cb->cht != 0)
  226.     ref_cb(img_win->d_xid, trace->cb);
  227.  
  228.     free(trace->pbuf);
  229.     free(trace->cb);
  230.     free(trace);
  231.  
  232.     xv_set(trace->win_info->trwin,
  233.        FRAME_CMD_PUSHPIN_IN, FALSE, NULL);
  234.     xv_set(trace->win_info->trwin,
  235.        XV_SHOW, FALSE, NULL);
  236. }
  237.  
  238. /*******************************************************/
  239. newtrattr(opts)
  240.     struct tropts *opts;
  241. {
  242.     opts->scale_type = 1;
  243.     opts->avgrad = (int) xv_get(trace_tcntrl->radius, PANEL_VALUE, NULL);
  244.     opts->axmin = 0;
  245.     opts->axmax = orig_img->maxv;
  246. }
  247.  
  248. /*******************************************************/
  249. scale_trace(trace)
  250.     struct trcontext *trace;
  251. {
  252.     int       min, max;
  253.     int       i;
  254.  
  255.     if (trace->t_attr.scale_type == 1) {
  256.     min = trace->pbuf[0].oval;
  257.     max = trace->pbuf[0].oval;
  258.     for (i = 0; i < trace->npts; i++) {
  259.         if (trace->pbuf[i].oval < min)
  260.         min = trace->pbuf[i].oval;
  261.         else if (trace->pbuf[i].oval > max)
  262.         max = trace->pbuf[i].oval;
  263.     }
  264.     trace->t_attr.axmin = min;
  265.     trace->t_attr.axmax = max;
  266.     }
  267.     if (trace->t_attr.scale_type == 0) {
  268.     trace->t_attr.axmin = orig_img->minv;
  269.     trace->t_attr.axmax = orig_img->maxv;
  270.     }
  271.     if (trace->t_attr.scale_type == 2) {
  272.     trace->t_attr.axmin = (int) xv_get(trace_tcntrl->min, PANEL_VALUE, NULL);
  273.     trace->t_attr.axmax = (int) xv_get(trace_tcntrl->max, PANEL_VALUE, NULL);
  274.     }
  275. }
  276.  
  277. /*****************************************************************/
  278. struct trcontext *
  279. trace_by_win(win)
  280.     Xv_window win;
  281. {
  282.     struct trcontext *trace;
  283.     struct logent *log;
  284.  
  285.     log = loghead;
  286.     while (log != NULL) {
  287.     trace = log->trace;
  288.     if (trace != NULL) {
  289.         if ((trace->trpntw == win) || (trace->win_info->trwin == win))
  290.         return trace;
  291.     }
  292.     log = log->next;
  293.     }
  294.     return NULL;
  295. }
  296.  
  297. /*****************************************************************/
  298. struct trcontext *
  299. trace_by_panelwin(win)
  300.     Xv_Window win;
  301. {
  302.     struct trcontext *trace;
  303.     struct logent *log;
  304.  
  305.     log = loghead;
  306.     while (log != NULL) {
  307.     trace = log->trace;
  308.     if (trace != NULL) {
  309.         if (trace->win_info->controls3 == win)
  310.         return trace;
  311.     }
  312.     log = log->next;
  313.     }
  314.     return NULL;
  315. }
  316.  
  317. /*****************************************************************/
  318. struct trcontext *
  319. trace_by_lid(id)
  320.     int       id;
  321. {
  322.     struct logent *log;
  323.  
  324.     log = loghead;
  325.     while (log != NULL) {
  326.     if (log->id == id)
  327.         return (log->trace);
  328.     log = log->next;
  329.     }
  330.     return NULL;
  331. }
  332.  
  333. /**************************************************************
  334.  * Repaint callback function for `h_trcanv'.
  335.  */
  336. void
  337. trcanv_repaint_proc(canvas, paint_window, display, xid, rects)
  338.     Canvas    canvas;
  339.     Xv_window paint_window;
  340.     Display  *display;
  341.     Window    xid;
  342.     Xv_xrectlist *rects;
  343. {
  344.     struct integ_context *ctx;
  345.     register int i;
  346.     XGCValues gcval;
  347.     unsigned long g;
  348.     struct trcontext *curtrace;
  349.     double    scfac;
  350.     int       trsum = 0, trave = 0;
  351.     char      message[80];
  352.     int       ylen, grheight;
  353.     int       slen, dlen, width, height;
  354.     /*
  355.      * slen and dlen are the lengths of the sample and display sections of
  356.      * the display
  357.      */
  358.  
  359.     curtrace = trace_by_win(paint_window);
  360.     if (curtrace == NULL) {
  361.     printf("no such trace associated with that window!\n");
  362.     return;
  363.     }
  364.     if (curtrace->pbuf == NULL)
  365.     return;
  366.  
  367. #ifdef DEBUG
  368.     printf("repainting tracewin\n");
  369. #endif
  370.  
  371.     XClearWindow(display, curtrace->trxid);
  372.     if ((ylen = drawaxes(curtrace)) <= 0)
  373.     return;
  374.     width = (int) xv_get(curtrace->win_info->trcanv, XV_WIDTH, NULL);
  375.     height = (int) xv_get(curtrace->win_info->trcanv, XV_HEIGHT, NULL);
  376.     slen = irint((double) height * SMPHT);
  377.     dlen = height - slen;
  378.     scfac = (double) (dlen - STARTY) /
  379.     (curtrace->yglab[ylen - 1].val - curtrace->yglab[0].val);
  380.  
  381.     for (i = 0; i < curtrace->npts; i++) {
  382.  
  383.     /* ADD: handle shrink mode!!! */
  384.     gcval.foreground = curtrace->pbuf[i].val;
  385.     XChangeGC(display, trgc, GCForeground, &gcval);
  386.     XDrawLine(display, curtrace->trxid, trgc, i, height - slen, i, height);
  387.     gcval.foreground = BlackPixel((Display *) display,
  388.                       DefaultScreen((Display *) display));
  389.     XChangeGC(display, trgc, GCForeground, &gcval);
  390.     g = trace_value(i, curtrace);
  391.     trsum += g;
  392.     if (g > curtrace->yglab[0].val) {
  393.         grheight = dlen - irint((double)
  394.                     (g - curtrace->yglab[0].val) * scfac);
  395.         XDrawLine(display, curtrace->trxid, trgc, i, dlen + 1, i,
  396.               (int) grheight);
  397.     }
  398.     }
  399.  
  400.   /* draw any overlay lines  */
  401.     XSetLineAttributes(display, trgc, 2, LineSolid, CapButt, JoinBevel);
  402.     ctx = &curtrace->integ;
  403.     XSetForeground(display, trgc, pallet[RED].pixel);
  404.     for (i = 0; i < ctx->cnum; i++) {
  405.     XDrawLine(display, curtrace->trxid, trgc, ctx->ireg[i].min,
  406.           0, ctx->ireg[i].min, dlen);
  407.     XDrawLine(display, curtrace->trxid, trgc, ctx->ireg[i].max,
  408.           0, ctx->ireg[i].max, dlen);
  409.     }
  410.     trave = trsum / curtrace->npts;
  411.     XSetLineAttributes(display, trgc, 1, LineSolid, CapButt, JoinBevel);
  412.  
  413.     /* sum and average computed in trcanv_repaint_proc */
  414.     sprintf(message, "Value:  0");
  415.     xv_set(curtrace->win_info->mes1, PANEL_LABEL_STRING, message, NULL);
  416.     sprintf(message, "Sum: %d", trsum);
  417.     xv_set(curtrace->win_info->mes3, PANEL_LABEL_STRING, message, NULL);
  418.     sprintf(message, "Average: %d", trave);
  419.     xv_set(curtrace->win_info->mes4, PANEL_LABEL_STRING, message, NULL);
  420.     panel_paint(curtrace->win_info->mes1, PANEL_CLEAR);
  421.     panel_paint(curtrace->win_info->mes3, PANEL_CLEAR);
  422.     panel_paint(curtrace->win_info->mes4, PANEL_CLEAR);
  423. }
  424.  
  425. /*************************************************************/
  426. /* trace_value() -- gets the trace value at point p along trace */
  427. unsigned
  428. trace_value(p, trace)
  429.     int       p;
  430.     struct trcontext *trace;
  431. {
  432.     int       i, start, end;
  433.     unsigned  sum;
  434.  
  435.     if (trace->t_attr.avgrad == 0) {
  436.     return trace->pbuf[p].oval;
  437.     } else {
  438.     if (p - trace->t_attr.avgrad / 2 < 0) {
  439.         start = 0;
  440.     } else {
  441.         start = p - trace->t_attr.avgrad / 2;
  442.     }
  443.  
  444.     if (p + trace->t_attr.avgrad / 2 >= trace->npts) {
  445.         end = trace->npts - 1;
  446.     } else {
  447.         end = p + trace->t_attr.avgrad / 2;
  448.     }
  449.  
  450.     sum = 0;
  451.     for (i = start; i <= end; i++) {
  452.         sum += trace->pbuf[i].oval;
  453.     }
  454.     return sum / (end + 1 - start);
  455.     }
  456. }
  457.  
  458. /*************************************************************/
  459. /* label the axes on a trace window */
  460. drawaxes(curtrace)
  461.     struct trcontext *curtrace;
  462. {
  463.     XGCValues gcval;
  464.     int       ylen;
  465.     int       slen, dlen, width, height;    /* slen and dlen are the
  466.                          * lengths of the sample and
  467.                          * display sections of the
  468.                          * display */
  469.  
  470.  
  471.     width = (int) xv_get(curtrace->win_info->trcanv, XV_WIDTH, NULL);
  472.     height = (int) xv_get(curtrace->win_info->trcanv, XV_HEIGHT, NULL);
  473.     slen = irint((double) height * SMPHT);
  474.     dlen = height - slen;
  475.     gcval.foreground = BlackPixel((Display *) display,
  476.                   DefaultScreen((Display *) display));
  477.     XChangeGC(display, trgc, GCForeground, &gcval);
  478.     ylen = build_glab(curtrace->t_attr.axmin, curtrace->t_attr.axmax, 5,
  479.               dlen - STARTY, &curtrace->yglab);
  480.     if (ylen > 0)
  481.     xlabelgraph(display, curtrace->trxid, trgc, curtrace->yglab, ylen,
  482.             curtrace->npts + 2, dlen, width, dlen, VERTICAL, -1);
  483.     return ylen;
  484. }
  485.  
  486. /*************************************************************/
  487. /*
  488.  * Event callback function for `h_trcanv'.
  489.  */
  490. Notify_value
  491. trcanv_event_proc(win, event, arg, type)
  492.     Xv_Window win;
  493.     Event    *event;
  494.     Notify_arg arg;
  495.     Notify_event_type type;
  496. {
  497.     XGCValues gcval;
  498.     XPoint    pt;
  499.     struct trcontext *curtrace;
  500.     char      message[80];
  501.     int       slen, dlen, width, height;
  502.     /*
  503.      * slen and dlen are the lengths of the sample and display sections of
  504.      * the display
  505.      */
  506.  
  507.     if (event_id(event) != MS_RIGHT && event_id(event) != MS_LEFT &&
  508.     event_id(event) != MS_MIDDLE && event_id(event) != LOC_DRAG)
  509.     return notify_next_event_func(win, event, arg, type);
  510.  
  511.     curtrace = trace_by_win(win);
  512.     if (curtrace == NULL) {
  513.     printf("no such trace associated with that window!\n");
  514.     return notify_next_event_func(win, event, arg, type);
  515.     }
  516.     width = (int) xv_get(curtrace->win_info->trcanv, XV_WIDTH, NULL);
  517.     height = (int) xv_get(curtrace->win_info->trcanv, XV_HEIGHT, NULL);
  518.     if (event_x(event) <= 0 || event_x(event) >= curtrace->npts ||
  519.     event_y(event) <= 0 || event_y(event) >= height)
  520.     return notify_next_event_func(win, event, arg, type);
  521.  
  522.     if (curtrace->pbuf == NULL)
  523.     return notify_next_event_func(win, event, arg, type);
  524.  
  525.     /* do integrate select if checked */
  526.     if ((int) xv_get(curtrace->win_info->integrate, PANEL_VALUE, NULL) > 0) {
  527.     integrate_event_proc(event, curtrace);
  528.     return notify_next_event_func(win, event, arg, type);
  529.     }
  530.     /* un-draw previous lines and crosses */
  531.     draw_log();            /* redraw endpoints and log # */
  532.     slen = irint((double) height * SMPHT);
  533.     dlen = height - slen;
  534.  
  535.     XSetLineAttributes(display, trgc, 2, LineSolid, CapButt, JoinBevel);
  536.  
  537.     if (curtrace->cb->cht != 0 || curtrace->cb->cwt != 0)
  538.     /* refresh image under cross bar */
  539.     ref_cb(img_win->d_xid, curtrace->cb);
  540.  
  541.     draw_cpl();            /* redraw crosses in point list */
  542.     draw_pvec(img_win->d_xid, curtrace->pbuf, curtrace->npts);
  543.     XSetFunction(display, trgc, GXxor);
  544.     XSetForeground(display, trgc,
  545.            (BlackPixel(display, DefaultScreen(display)) ^ standout));
  546.     XDrawLine(display, curtrace->trxid, trgc, curtrace->x, 0,
  547.           curtrace->x, dlen);
  548.     XSetFunction(display, trgc, GXcopy);
  549.  
  550.     curtrace->x = event_x(event);
  551.     curtrace->y = event_y(event);
  552.  
  553.     /* use xor to restore line to black */
  554.     gcval.foreground = pallet[RED].pixel;
  555.     XChangeGC(display, trgc, GCForeground, &gcval);
  556.     XSetFunction(display, trgc, GXxor);
  557.     XSetForeground(display, trgc,
  558.            (BlackPixel(display, DefaultScreen(display)) ^ standout));
  559.     XDrawLine(display, curtrace->trxid, trgc, curtrace->x, 0,
  560.           curtrace->x, dlen);
  561.     XSetFunction(display, trgc, GXcopy);
  562.  
  563.     /* draw marker on image */
  564.     pt.x = (short) curtrace->pbuf[curtrace->x].pt.x;
  565.     pt.y = (short) curtrace->pbuf[curtrace->x].pt.y;
  566.     cbget(orig_ximg, curtrace->cb, pt);
  567.     gcval.foreground = pallet[RED].pixel;
  568.     XChangeGC(display, gc, GCForeground, &gcval);
  569.     draw_cb(img_win->d_xid, curtrace->cb);
  570.  
  571.  
  572.     sprintf(message, "Value:  %d", trace_value(curtrace->x, curtrace));
  573.     xv_set(curtrace->win_info->mes1, PANEL_LABEL_STRING, message, NULL);
  574.     panel_paint(curtrace->win_info->mes1, PANEL_CLEAR);
  575.  
  576.     XSetLineAttributes(display, trgc, 1, LineSolid, CapButt, JoinBevel);
  577.  
  578.     return notify_next_event_func(win, event, arg, type);
  579. }
  580.  
  581. /***********************************************************/
  582. /* handle_auxd will set certain attributes if there is auxiliary data in the
  583. log, and if not, will place the current attributes in the auxdata area
  584. for logging purposes */
  585. tr_auxd(func, ctx)
  586.     struct logent *func;
  587.     struct trcontext *ctx;
  588. {
  589.     u_char   *data;
  590.  
  591.     if (func->auxdsize != 0) {
  592.     data = func->auxdata;
  593.     ctx->t_attr.avgrad = *((int *) data);
  594.     data += sizeof(int);
  595.     ctx->t_attr.axmin = *((int *) data);
  596.     data += sizeof(int);
  597.     ctx->t_attr.axmax = *((int *) data);
  598.     data += sizeof(int);
  599.     } else {
  600.     func->auxdsize = (unsigned) 3 *sizeof(int);
  601.     data = func->auxdata = (u_char *) malloc(func->auxdsize);
  602.     *((int *) data) = ctx->t_attr.avgrad;
  603.     data += sizeof(int);
  604.     *((int *) data) = ctx->t_attr.axmin;
  605.     data += sizeof(int);
  606.     *((int *) data) = ctx->t_attr.axmax;
  607.     data += sizeof(int);
  608.     }
  609. }
  610.  
  611. /*****************************************************************/
  612. void
  613. trace_refresh_proc(item, event)
  614.     Panel_item item;
  615.     Event    *event;
  616. {
  617.     struct trcontext *context, *trace_by_win();
  618.     trace_trwin_objects *ip = (trace_trwin_objects *) xv_get(item,
  619.                              XV_KEY_DATA, INSTANCE);
  620.  
  621. #ifdef DEBUG
  622.     fputs("trace: trace_refresh_proc\n", stderr);
  623. #endif
  624.  
  625.     context = trace_by_win(ip->trwin);
  626.     if (context == NULL) {
  627.     return;
  628.     }
  629.     /* repaint the window */
  630.     trcanv_repaint_proc(context->win_info->trcanv, context->trpntw, display,
  631.             context->trxid, (Xv_xrectlist *) NULL);
  632. }
  633.