home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / software / unix / saoimage / sao1_07.tar / wndwadj.c < prev    next >
C/C++ Source or Header  |  1991-06-21  |  4KB  |  143 lines

  1. #ifndef lint
  2. static char SccsId[] = "%W%  %G%";
  3. #endif
  4.  
  5. /* Module:    wndwadj.c (Window Adjust)
  6.  * Subroutine:    adjust_desktop()    returns: void
  7.  * Subroutine:    adjust_graphbox()    returns: void
  8.  * Xlib calls:    XResizeWindow()
  9.  * Copyright:    1989 Smithsonian Astrophysical Observatory
  10.  *        You may do anything you like with this file except remove
  11.  *        this copyright.  The Smithsonian Astrophysical Observatory
  12.  *        makes no representations about the suitability of this
  13.  *        software for any purpose.  It is provided "as is" without
  14.  *        express or implied warranty.
  15.  * Modified:    {0} Michael VanHilst    initial version        6 July 1989
  16.  *        {1} MVH added adjust_graphbox()            21 Oct 1989
  17.  *        {2} RPS added code to set the init_button flag when window is
  18.  *        resized.   13 May 1991
  19.  *        {n} <who> -- <does what> -- <when>
  20.  */
  21.  
  22. #include <stdio.h>            /* stderr, NULL, etc. */
  23. #include <X11/Xlib.h>            /* X window stuff */
  24. #include <X11/Xutil.h>            /* X window manager stuff */
  25. #include "hfiles/struct.h"        /* all struct record types */
  26. #include "hfiles/extern.h"        /* major declared structs */
  27. #include "hfiles/cgraph.h"
  28.  
  29. extern struct cgraphRec cgraph;
  30. extern struct windowRec desktop;
  31. #ifdef ALLIANT
  32. extern int init_button;
  33. #endif
  34.  
  35.  
  36. /*
  37.  * Subroutine:    adjust_desktop
  38.  * Purpose:    Adjust displays when the main desktop window is adjusted.
  39.  */
  40. void adjust_desktop ( configure )
  41.      XConfigureEvent *configure;
  42. {
  43.   int diff;
  44.   int do_dispbox = 0;
  45.   int do_graphbox = 0;
  46.   void map_graphbox(), adjust_main_colorbar(), free_blink();
  47.   void init_dispbuf(), new_pancursor(), new_display(), adjust_buttonmenu();
  48.  
  49.   if( configure->window != desktop.ID )
  50.     return;
  51.   if( configure->height != desktop.height ) {
  52.     diff = configure->height - desktop.height;
  53.     desktop.height = configure->height;
  54.     desktop.yheight += diff;
  55.     dispbox.height += diff;
  56.     dispbox.yheight += diff;
  57.     do_dispbox = 1;
  58.     colorbox.y += diff;
  59.   }
  60.   if( configure->width != desktop.width ) {
  61.     diff = configure->width - desktop.width;
  62.     desktop.width = configure->width;
  63.     desktop.xwidth += diff;
  64.     colorbox.width += diff;
  65.     colorbox.xwidth += diff;
  66.     XResizeWindow(colorbox.display, colorbox.ID,
  67.           colorbox.width, colorbox.height);
  68.     adjust_main_colorbar();
  69.     btnbox.width += diff;
  70.     btnbox.xwidth += diff;
  71.     XResizeWindow(btnbox.display, btnbox.ID, btnbox.width, btnbox.height);
  72.     adjust_buttonmenu (&btnbox);
  73. #ifdef ALLIANT
  74.     init_button=1;
  75. #endif
  76.     dispbox.width += diff;
  77.     dispbox.xwidth += diff;
  78.     do_dispbox = 1;
  79.     panbox.x += diff;
  80.     magnibox.x += diff;
  81.   }
  82.   if( do_dispbox ) {
  83.     /* dump the blink buffers and pixmaps, they are no linger usable */
  84.     free_blink();
  85.     XResizeWindow(dispbox.display, dispbox.ID, dispbox.width, dispbox.height);
  86.     init_dispbuf();
  87.     new_pancursor(0);
  88.     new_display(0, 0, 0, 0);
  89.   }
  90.   if( do_graphbox )
  91.     /* remap the graphbox (it checks for its location) */
  92.     map_graphbox();
  93. }
  94.  
  95. /*
  96.  * Subroutine:    adjust_graphbox()
  97.  * Purpose:    respond to a resizing of the color graph window
  98.  */
  99. void adjust_graphbox ( configure )
  100.      XConfigureEvent *configure;
  101. {
  102.   void adjust_color_graph(), adjust_graph_colorbar(), draw_cgraph();
  103.  
  104.   graphbox.x = configure->x;
  105.   graphbox.y = configure->y;
  106.   graphbox.width = configure->width;
  107.   graphbox.height = configure->height;
  108.   graphbox.xwidth = graphbox.width - (graphbox.xzero + graphbox.xzero);
  109.   graphbox.yheight = graphbox.height - (graphbox.yzero + graphbox.yzero);
  110.   adjust_color_graph();
  111.   adjust_graph_colorbar();
  112.   if( graphbox.active )
  113.     draw_cgraph(1, 0);
  114. }
  115.  
  116. #ifdef FOO
  117. /*
  118.  * Subroutine:    set_dispborder
  119.  */
  120. void set_dispborder ( dispbdr )
  121.      int dispbdr;
  122. {
  123.   desktop.bdrwidth = dispbdr;
  124.   desktop.bdrtotal = dispbdr + dispbdr;
  125.   graphbox.bdrwidth = dispbdr;
  126.   graphbox.bdrtotal = dispbdr + dispbdr;
  127. }
  128.  
  129. /*
  130.  * Subroutine:    set_auxborder
  131.  */
  132. void set_auxborder ( auxbdr )
  133.      int auxbdr;
  134. {
  135.   panbox.bdrwidth = auxbdr;
  136.   panbox.bdrtotal = auxbdr + auxbdr;
  137.   magnibox.bdrwidth = auxbdr;
  138.   magnibox.bdrtotal = auxbdr + auxbdr;
  139.   dispbox.bdrwidth = auxbdr;
  140.   dispbox.bdrtotal = auxbdr + auxbdr;
  141. }
  142. #endif
  143.