home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / xfig / part02 / w_setup.c < prev   
Encoding:
C/C++ Source or Header  |  1993-05-27  |  2.5 KB  |  78 lines

  1. /*
  2.  * FIG : Facility for Interactive Generation of figures
  3.  * Copyright (c) 1985 by Supoj Sutanthavibul
  4.  *
  5.  * "Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both the copyright
  8.  * notice and this permission notice appear in supporting documentation. 
  9.  * No representations are made about the suitability of this software for 
  10.  * any purpose.  It is provided "as is" without express or implied warranty."
  11.  */
  12.  
  13. #include "fig.h"
  14. #include "resources.h"
  15. #include "w_setup.h"
  16. #include "w_util.h"
  17.  
  18. int        TOOL_WD, TOOL_HT;
  19. int        CMDPANEL_WD, CMDPANEL_HT = 22;
  20. int        MODEPANEL_WD, MODEPANEL_HT;
  21. int        MODEPANEL_SPACE;
  22. int        MSGFORM_WD, MSGFORM_HT = 18;
  23. int        MSGPANEL_WD = 600;
  24. int        MOUSEFUN_WD, MOUSEFUN_HT;
  25. int        INDPANEL_WD;
  26. int        CANVAS_WD, CANVAS_HT;
  27. int        INTERNAL_BW;
  28. int        TOPRULER_WD, TOPRULER_HT;
  29. int        SIDERULER_WD, SIDERULER_HT;
  30. int        SW_PER_ROW, SW_PER_COL;
  31.  
  32. setup_sizes(new_canv_wd, new_canv_ht)
  33.     int            new_canv_wd, new_canv_ht;
  34. {
  35.     int            NUM_CMD_SW;
  36.  
  37.     /*
  38.      * make the width of the mousefun panel about 1/3 of the size of the
  39.      * canvas width and the cmdpanel the remaining width. Be sure to set it
  40.      * up so that cmdpanel buttons can be allocated a size which divides
  41.      * evenly into the remaining space.
  42.      */
  43.     CANVAS_WD = new_canv_wd;
  44.     if (CANVAS_WD < 10)
  45.     CANVAS_WD = 10;
  46.     CANVAS_HT = new_canv_ht;
  47.     if (CANVAS_HT < 10)
  48.     CANVAS_HT = 10;
  49.  
  50.     SIDERULER_WD = RULER_WD + 8;    /* allow for 100's numbers */
  51.     TOPRULER_HT = RULER_WD;
  52.     TOPRULER_WD = CANVAS_WD;
  53.     SIDERULER_HT = CANVAS_HT;
  54.     if (TOPRULER_WD > MAX_TOPRULER_WD)
  55.     TOPRULER_WD = MAX_TOPRULER_WD;
  56.     if (SIDERULER_HT > MAX_SIDERULER_HT)
  57.     SIDERULER_HT = MAX_SIDERULER_HT;
  58.  
  59.     MODEPANEL_WD = (MODE_SW_WD + INTERNAL_BW) * SW_PER_ROW + INTERNAL_BW;
  60.     NUM_CMD_SW = num_cmd_sw();    /* kludge - NUM_CMD_SW local to w_cmdpanel.c */
  61.     CMDPANEL_WD = (((2 * CANVAS_WD) / 3 + MODEPANEL_WD +
  62.             SIDERULER_WD) / NUM_CMD_SW) * NUM_CMD_SW;
  63.     MOUSEFUN_WD = (MODEPANEL_WD + CANVAS_WD + SIDERULER_WD - CMDPANEL_WD);
  64.     while (MOUSEFUN_WD < MIN_MOUSEFUN_WD) {
  65.     MOUSEFUN_WD += NUM_CMD_SW;
  66.     CMDPANEL_WD -= NUM_CMD_SW;
  67.     }
  68.     if (CMDPANEL_WD < 5 * NUM_CMD_SW)
  69.     CMDPANEL_WD = 5 * NUM_CMD_SW;
  70.     MSGFORM_WD = CMDPANEL_WD;
  71.  
  72.     MODEPANEL_SPACE = CANVAS_HT + RULER_WD -
  73.     SW_PER_COL * (MODE_SW_HT + INTERNAL_BW);
  74.     if (MODEPANEL_SPACE < 2)
  75.     MODEPANEL_SPACE = 2;
  76.     INDPANEL_WD = MODEPANEL_WD + CANVAS_WD + SIDERULER_WD + INTERNAL_BW*2;
  77. }
  78.