home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume8 / xfig2.8 / part02 / redisplay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-02  |  2.8 KB  |  139 lines

  1. /* 
  2.  *    FIG : Facility for Interactive Generation of figures
  3.  *
  4.  *    Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
  5.  *    Febuary 1988.
  6.  *
  7.  *    %W%    %G%
  8. */
  9. #include "fig.h"
  10. #include "resources.h"
  11. #include "object.h"
  12. #include "paintop.h"
  13.  
  14. extern int        pointmarker_shown;
  15. extern int        compoundbox_shown;
  16. extern int        foreground_color, background_color;
  17.  
  18. redisplay_objects(objects)
  19. F_compound    *objects;
  20. {
  21.     int fill;
  22.  
  23.     if (objects == NULL) 
  24.         return;
  25.     for (fill=1; fill >= 0; fill--)
  26.         {
  27.         redisplay_arcobject(objects->arcs,fill);
  28.         redisplay_compoundobject(objects->compounds,fill);
  29.         redisplay_ellipseobject(objects->ellipses,fill);
  30.         redisplay_lineobject(objects->lines,fill);
  31.         redisplay_splineobject(objects->splines,fill);
  32.         }
  33.     if (pointmarker_shown)    /* show the point markers if they are on */
  34.         toggle_pointmarker();
  35.     if (compoundbox_shown) {
  36.         F_compound    *c;
  37.         for (c = objects->compounds; c != NULL; c = c->next)
  38.         draw_compoundbox(c, INV_PAINT);    /* show the compound boxes */
  39.         }
  40.     /* text doesn't have fill mode */
  41.     redisplay_textobject(objects->texts);
  42.     }
  43.  
  44. redisplay_arcobject(arcs,fill)
  45. F_arc    *arcs;
  46. int fill;
  47. {
  48.     F_arc    *arc;
  49.  
  50.     for (arc = arcs; arc != NULL; arc = arc->next)
  51.         {
  52.         if ((fill && arc->area_fill) ||
  53.             (fill==0 && arc->area_fill == 0))
  54.             draw_arc(arc, foreground_color);
  55.         }
  56.     }
  57.  
  58. redisplay_ellipseobject(ellipses,fill)
  59. F_ellipse    *ellipses;
  60. int fill;
  61. {
  62.     F_ellipse    *e;
  63.  
  64.     for (e = ellipses; e != NULL; e = e->next)
  65.         {
  66.         if ((fill && e->area_fill) ||
  67.             (fill==0 && e->area_fill == 0))
  68.             draw_ellipse(e, foreground_color);
  69.         }
  70.     }
  71.  
  72. redisplay_lineobject(lines,fill)
  73. F_line    *lines;
  74. int fill;
  75. {
  76.     F_line    *line;
  77.  
  78.     for (line = lines; line != NULL; line = line->next) 
  79.         {
  80.         if ((fill && line->area_fill) ||
  81.             (fill==0 && line->area_fill == 0))
  82.             draw_line(line, PAINT);
  83.         }
  84.     }
  85.  
  86. redisplay_splineobject(splines,fill)
  87. F_spline    *splines;
  88. int fill;
  89. {
  90.     F_spline    *s;
  91.  
  92.     for (s = splines; s != NULL; s = s->next)
  93.         {
  94.         if ((fill && s->area_fill) ||
  95.             (fill==0 && s->area_fill == 0))
  96.             draw_spline(s, PAINT);
  97.         }
  98.     }
  99.  
  100. redisplay_textobject(texts)
  101. F_text    *texts;
  102. {
  103.     F_text    *t;
  104.  
  105.     for (t = texts; t != NULL; t = t->next)
  106.         draw_text(t, PAINT);
  107.     }
  108.  
  109. redisplay_compoundobject(compounds,fill)
  110. F_compound    *compounds;
  111. int fill;
  112. {
  113.     F_compound    *c;
  114.  
  115.     for(c = compounds; c != NULL; c = c->next) {
  116.         redisplay_arcobject(c->arcs,fill);
  117.         redisplay_compoundobject(c->compounds,fill);
  118.         redisplay_ellipseobject(c->ellipses,fill);
  119.         redisplay_lineobject(c->lines,fill);
  120.         redisplay_splineobject(c->splines,fill);
  121.  
  122.         /* no filled text mode, just do text on non-filled pass */
  123.         if(fill==0) {
  124.             redisplay_textobject(c->texts);
  125.             }
  126.         }
  127.     }
  128.  
  129. redisplay_canvas()
  130. {
  131.     extern F_compound    objects;
  132.  
  133.     clear_canvas();
  134.     set_temp_cursor(&wait_cursor);
  135.     redisplay_objects(&objects);
  136.     redisplay_grid();
  137.     reset_cursor();
  138.     }
  139.