home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / xspringies / part03 < prev    next >
Text File  |  1993-04-28  |  45KB  |  1,161 lines

  1. Newsgroups: comp.sources.x
  2. From: dmd@gradient.cis.upenn.edu (Douglas DeCarlo)
  3. Subject: v19i055:  xspringies - it's a spring simulator...no, it's a game, Part03/16
  4. Message-ID: <1993Mar26.161204.9616@sparky.imd.sterling.com>
  5. X-Md4-Signature: 0c8c3fb7584b9de3a55398e3bd7a39fc
  6. Date: Fri, 26 Mar 1993 16:12:04 GMT
  7. Approved: chris@sparky.imd.sterling.com
  8.  
  9. Submitted-by: dmd@gradient.cis.upenn.edu (Douglas DeCarlo)
  10. Posting-number: Volume 19, Issue 55
  11. Archive-name: xspringies/part03
  12. Environment: X11
  13. Supersedes: xspringies: Volume 14, Issue 25-30
  14.  
  15. #!/bin/sh
  16. # to extract, remove the header and type "sh filename"
  17. if `test ! -s ./title.h`
  18. then
  19. echo "writting ./title.h"
  20. cat > ./title.h << '\BARFOO\'
  21. #define title_width 96
  22. #define title_height 48
  23. static char title_bits[] = {
  24.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  25.    0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f,
  26.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  27.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  28.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  29.    0x02, 0x1c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  30.    0x02, 0x38, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  31.    0x02, 0x70, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  32.    0x02, 0xe0, 0x80, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  33.    0x02, 0xc0, 0x41, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  34.    0x02, 0x80, 0x23, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  35.    0x02, 0x00, 0x17, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  36.    0x02, 0x00, 0x0a, 0x20, 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x10,
  37.    0x02, 0x00, 0x1d, 0x40, 0x40, 0xa3, 0x81, 0x86, 0x05, 0x0e, 0x07, 0x10,
  38.    0x02, 0x80, 0x38, 0x80, 0xc7, 0x64, 0x92, 0x49, 0x26, 0x91, 0x08, 0x10,
  39.    0x02, 0x40, 0x70, 0x00, 0x48, 0x24, 0x90, 0x48, 0x24, 0x91, 0x00, 0x10,
  40.    0x02, 0x20, 0xe0, 0x00, 0x48, 0x24, 0x90, 0x48, 0x24, 0x0f, 0x07, 0x10,
  41.    0x02, 0x10, 0xc0, 0x21, 0x48, 0x24, 0x90, 0x48, 0x24, 0x01, 0x08, 0x10,
  42.    0x02, 0x08, 0x80, 0x43, 0xc4, 0x24, 0x90, 0x48, 0x26, 0x91, 0x08, 0x10,
  43.    0x02, 0x04, 0x00, 0x87, 0x43, 0x23, 0x90, 0x88, 0x25, 0x0e, 0x07, 0x10,
  44.    0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10,
  45.    0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10,
  46.    0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10,
  47.    0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x10,
  48.    0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x10,
  49.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  50.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  51.    0x02, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x10,
  52.    0x02, 0xfe, 0x03, 0x00, 0xf8, 0xbe, 0xef, 0xfb, 0x00, 0x70, 0x1d, 0x10,
  53.    0x02, 0xff, 0x07, 0x00, 0x04, 0x41, 0x10, 0x04, 0x01, 0xa8, 0x2a, 0x10,
  54.    0x82, 0xff, 0x0f, 0x80, 0x83, 0xa2, 0x28, 0x0a, 0x02, 0x54, 0x55, 0x10,
  55.    0x82, 0x65, 0x0e, 0x40, 0x45, 0x92, 0x24, 0xc9, 0x03, 0xec, 0x6e, 0x10,
  56.    0xc2, 0x99, 0x1d, 0xa0, 0x28, 0x8a, 0xa2, 0x28, 0x06, 0x56, 0xd5, 0x10,
  57.    0xc2, 0xdd, 0xdd, 0x91, 0x28, 0x8a, 0xa2, 0x28, 0xea, 0xaa, 0xab, 0x10,
  58.    0xc2, 0xdd, 0xfd, 0x8f, 0x28, 0x8a, 0xa2, 0x28, 0xf2, 0x57, 0xd5, 0x10,
  59.    0xc2, 0xdd, 0x5d, 0x81, 0x28, 0x8a, 0xa2, 0x28, 0xa2, 0xba, 0xba, 0x10,
  60.    0xc2, 0xdd, 0x1d, 0x80, 0x28, 0x8a, 0xa2, 0x28, 0x02, 0x76, 0xdd, 0x10,
  61.    0x82, 0xdd, 0x0d, 0x80, 0x28, 0x8a, 0xa2, 0x28, 0x02, 0xec, 0x6f, 0x10,
  62.    0x82, 0xff, 0x0f, 0x80, 0x28, 0x8a, 0xa2, 0x28, 0x02, 0xd4, 0x57, 0x10,
  63.    0x02, 0xff, 0x07, 0x80, 0x28, 0x8a, 0xa2, 0x28, 0x02, 0xa8, 0x2a, 0x10,
  64.    0x02, 0xfe, 0x03, 0x80, 0x24, 0x49, 0x92, 0x24, 0x01, 0x70, 0x1d, 0x10,
  65.    0x02, 0xf8, 0x00, 0x00, 0xc3, 0x30, 0x0c, 0xc3, 0x00, 0xc0, 0x07, 0x10,
  66.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  67.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  68.    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
  69.    0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f,
  70.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  71.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  72.  
  73. #define icon_width 32
  74. #define icon_height 32
  75. static char icon_bits[] = {
  76.    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x04, 0x01, 0x44,
  77.    0x00, 0x00, 0x00, 0x44, 0x80, 0x00, 0x08, 0x44, 0x00, 0x00, 0x00, 0x38,
  78.    0x10, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x12,
  79.    0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20,
  80.    0x80, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x10,
  81.    0x00, 0x38, 0x00, 0x20, 0x0e, 0x7c, 0x00, 0x10, 0x12, 0x7c, 0x00, 0x21,
  82.    0x12, 0x7c, 0x00, 0x11, 0x0a, 0x38, 0x00, 0x21, 0x12, 0x83, 0x20, 0x11,
  83.    0xa2, 0x54, 0x51, 0x21, 0xa2, 0x54, 0x4a, 0x11, 0xa2, 0x54, 0x4a, 0x20,
  84.    0x1e, 0x53, 0x72, 0x11, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x48, 0x38,
  85.    0x00, 0x00, 0x30, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7c,
  86.    0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00};
  87.  
  88. #define startup_width 160
  89. #define startup_height 128
  90. static char startup_bits[] = {
  91.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  92.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  93.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  94.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  95.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  96.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
  97.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  98.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  99.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  100.    0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
  101.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  102.    0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  103.    0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  104.    0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  105.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
  106.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
  107.    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03,
  108.    0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  109.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0xc0, 0x07, 0x00, 0x00,
  110.    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
  111.    0x00, 0x00, 0xf8, 0x07, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  112.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f,
  113.    0xe0, 0x03, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
  114.    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0xf0, 0x01, 0x00, 0x00,
  115.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  116.    0x00, 0x00, 0xe0, 0x1f, 0xf0, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x02, 0x80,
  117.    0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f,
  118.    0xf8, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00,
  119.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0x78, 0xe0, 0xff, 0x01,
  120.    0x00, 0x00, 0x08, 0xc0, 0x03, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
  121.    0x00, 0x00, 0x80, 0xff, 0x3c, 0xe0, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x80,
  122.    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
  123.    0x3d, 0x70, 0x80, 0x03, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x40, 0x40,
  124.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1e, 0x70, 0x80, 0x03,
  125.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  126.    0x00, 0x00, 0x00, 0x7e, 0x0f, 0x70, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08,
  127.    0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
  128.    0x0f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  129.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0x07, 0xe0, 0x03, 0x00,
  130.    0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
  131.    0x00, 0x00, 0x00, 0xdf, 0x0f, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
  132.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf,
  133.    0x0f, 0x00, 0x7f, 0x70, 0x3f, 0xdc, 0x0f, 0xe7, 0x7e, 0xe0, 0x1f, 0x0e,
  134.    0xff, 0xe0, 0x1f, 0x00, 0x00, 0x00, 0x80, 0xef, 0x1f, 0x00, 0xfc, 0xf0,
  135.    0x7f, 0xfc, 0x1f, 0xe7, 0xff, 0xf0, 0x3f, 0x8e, 0xff, 0xf1, 0x3f, 0x00,
  136.    0x00, 0x00, 0xc0, 0xc7, 0x3f, 0x00, 0xe0, 0xf1, 0xff, 0xfc, 0x3f, 0xe7,
  137.    0xff, 0xf9, 0x7f, 0xce, 0xff, 0xfb, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xc7,
  138.    0x3f, 0x00, 0xc0, 0xf3, 0xf0, 0x3c, 0x3c, 0xe7, 0xe1, 0x79, 0x78, 0xce,
  139.    0xc3, 0x7b, 0x70, 0x00, 0x00, 0x00, 0xe0, 0x83, 0x7f, 0x00, 0x80, 0x73,
  140.    0xe0, 0x1c, 0x38, 0xe7, 0xc0, 0x39, 0x70, 0xce, 0xe1, 0xf3, 0x07, 0x00,
  141.    0x00, 0x00, 0xe0, 0x01, 0xff, 0x70, 0x80, 0x73, 0xe0, 0x1c, 0x00, 0xe7,
  142.    0xc0, 0x39, 0x70, 0xce, 0xff, 0xe1, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x01,
  143.    0xff, 0x70, 0x80, 0x73, 0xe0, 0x1c, 0x00, 0xe7, 0xc0, 0x39, 0x70, 0xce,
  144.    0x3f, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xfe, 0xe1, 0xc0, 0xf1,
  145.    0xf0, 0x1c, 0x00, 0xe7, 0xc0, 0x79, 0x78, 0xce, 0x83, 0x39, 0x78, 0x00,
  146.    0x00, 0x00, 0x78, 0x00, 0xfc, 0xe3, 0xff, 0xf1, 0xff, 0x1c, 0x00, 0xe7,
  147.    0xc0, 0xf9, 0x7f, 0xce, 0xff, 0xfb, 0x7f, 0x00, 0x00, 0x00, 0x7c, 0x00,
  148.    0xfc, 0xc3, 0xff, 0xf0, 0x7f, 0x1c, 0x00, 0xe7, 0xc0, 0xf1, 0x7f, 0x8e,
  149.    0xff, 0xf1, 0x3f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0xf8, 0x87, 0x7f, 0x70,
  150.    0x3f, 0x1c, 0x00, 0xe7, 0xc0, 0xe1, 0x7f, 0x0e, 0xff, 0xe0, 0x1f, 0x00,
  151.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
  152.    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  153.    0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
  154.    0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
  155.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x18,
  156.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
  157.    0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00,
  158.    0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
  159.    0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70,
  160.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0xe0, 0x3a,
  161.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
  162.    0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  163.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00,
  164.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  165.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
  166.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  167.    0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  168.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
  169.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  170.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
  171.    0xc0, 0x03, 0x00, 0x3c, 0x00, 0x00, 0x0c, 0x00, 0xe0, 0x01, 0x1c, 0x00,
  172.    0x18, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x06, 0x00, 0x64,
  173.    0x00, 0x00, 0x0c, 0x00, 0x20, 0x03, 0x26, 0x00, 0x18, 0x00, 0x88, 0x00,
  174.    0x00, 0x00, 0x00, 0x00, 0xc0, 0x93, 0x01, 0x64, 0x4e, 0xe6, 0xcc, 0xf1,
  175.    0x20, 0x73, 0x06, 0xa7, 0x99, 0x03, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
  176.    0x40, 0x96, 0x19, 0x64, 0x59, 0x96, 0x2d, 0x1b, 0x20, 0x9b, 0x86, 0x6c,
  177.    0x5b, 0x06, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x96, 0x01, 0x64,
  178.    0x59, 0x96, 0x2d, 0x73, 0x20, 0x7b, 0x86, 0x6c, 0x58, 0x06, 0x70, 0x00,
  179.    0x00, 0x00, 0x00, 0x00, 0x40, 0x96, 0x19, 0x64, 0x59, 0x96, 0x2d, 0xe3,
  180.    0x20, 0x1b, 0xa6, 0x6c, 0x58, 0x06, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
  181.    0xc0, 0xe3, 0x01, 0x3c, 0x8e, 0xe5, 0xcd, 0x7a, 0xe0, 0xf1, 0x1c, 0x6b,
  182.    0x98, 0x03, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
  183.    0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00,
  184.    0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00,
  185.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
  186.    0x00, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  187.    0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  188.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
  189.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  190.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
  191.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  192.    0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  193.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x70, 0x00,
  194.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  195.    0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
  196.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  197.    0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  198.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00,
  199.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  200.    0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
  201.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  202.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  203.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  204.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  205.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  206.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  207.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6c, 0x46, 0x00,
  208.    0x23, 0x00, 0x80, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  209.    0x00, 0x00, 0x00, 0x00, 0x40, 0x0c, 0x46, 0x00, 0x23, 0x00, 0x80, 0x00,
  210.    0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  211.    0x40, 0x6d, 0xcf, 0x83, 0xe7, 0x71, 0x9a, 0xcc, 0xc1, 0xe3, 0x00, 0x00,
  212.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x6d, 0x46, 0x06,
  213.    0x23, 0xcb, 0xb6, 0x67, 0x82, 0x91, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00,
  214.    0x00, 0x00, 0x00, 0x00, 0x40, 0x6d, 0x46, 0x06, 0x23, 0xcb, 0xb2, 0x8c,
  215.    0x80, 0x91, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  216.    0x40, 0x6d, 0x56, 0x06, 0x2b, 0xcb, 0xb2, 0xac, 0x83, 0x95, 0x19, 0x00,
  217.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x6e, 0x4c, 0x06,
  218.    0x26, 0xb3, 0xb2, 0xcc, 0x01, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  219.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  220.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  221.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  222.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  223.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  224.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  225.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  226.    0x00, 0x00, 0x00, 0x7c, 0xdb, 0x00, 0x63, 0xe0, 0x03, 0x00, 0x00, 0x00,
  227.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
  228.    0x1b, 0x00, 0x63, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  229.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xdb, 0x9c, 0xf7, 0xe0,
  230.    0xcb, 0x9c, 0xc6, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  231.    0x00, 0x00, 0x00, 0x0c, 0xdb, 0x32, 0x63, 0x60, 0xc8, 0xb2, 0x6d, 0x00,
  232.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
  233.    0xdb, 0x32, 0x63, 0x60, 0xc8, 0xb2, 0xcc, 0x01, 0x00, 0x00, 0x00, 0x00,
  234.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xdb, 0x32, 0x6b, 0x61,
  235.    0xd0, 0xb2, 0x8c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  236.    0x00, 0x00, 0x00, 0x7c, 0xdb, 0x1c, 0xc6, 0xe0, 0x63, 0xac, 0xec, 0x01,
  237.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  238.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  239.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  240.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  241.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  242.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64,
  243.    0x80, 0x11, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x04, 0x00, 0x00, 0x00, 0x00,
  244.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x80, 0x11, 0x00, 0x00,
  245.    0x0c, 0x00, 0x60, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  246.    0x00, 0x00, 0x00, 0x6c, 0xde, 0xf3, 0x78, 0x0d, 0x0c, 0x8e, 0x63, 0x3c,
  247.    0x4e, 0xd6, 0x34, 0x4e, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74,
  248.    0x99, 0x91, 0x65, 0x1b, 0x0c, 0x59, 0xf6, 0x64, 0x59, 0xb6, 0x6d, 0x59,
  249.    0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x99, 0x91, 0x65, 0x19,
  250.    0x0c, 0x59, 0x66, 0x64, 0x59, 0x36, 0x0c, 0x59, 0x32, 0x00, 0x00, 0x00,
  251.    0x00, 0x00, 0x00, 0x64, 0x99, 0x95, 0x65, 0x19, 0x0c, 0x59, 0x66, 0x64,
  252.    0x59, 0x36, 0x0c, 0x59, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64,
  253.    0x16, 0x93, 0x59, 0x19, 0x7c, 0x8e, 0x63, 0x3c, 0x8e, 0x35, 0x0c, 0x8e,
  254.    0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  255.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  256.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  257.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  258.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  259.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x9c,
  260.    0x05, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  261.    0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0xb2, 0x05, 0x00, 0x80, 0x00,
  262.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64,
  263.    0x8d, 0x93, 0x0c, 0xb2, 0x3d, 0xcd, 0x9c, 0x07, 0x00, 0x00, 0x00, 0x00,
  264.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0xdb, 0x94, 0x0c, 0xb2,
  265.    0x65, 0xdb, 0xa6, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  266.    0x00, 0x00, 0x00, 0x64, 0xc3, 0x93, 0x0c, 0xb2, 0x65, 0xc3, 0x86, 0x0c,
  267.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64,
  268.    0xc3, 0x90, 0x0c, 0xb2, 0x65, 0xc3, 0xa6, 0x0c, 0x00, 0x00, 0x00, 0x00,
  269.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x83, 0x67, 0x07, 0x9c,
  270.    0x3d, 0xc3, 0x9c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  271.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  272.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  273.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  274.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  275.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  276.    0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x40, 0x6c, 0x46, 0x30, 0x00, 0x00,
  277.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
  278.    0x00, 0x06, 0x40, 0x0c, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  279.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x8d, 0x97, 0x41, 0x6d,
  280.    0x4f, 0xb6, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  281.    0x00, 0x00, 0x00, 0x7c, 0x5b, 0x96, 0x41, 0x6d, 0xc6, 0xb3, 0x0d, 0x00,
  282.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64,
  283.    0x59, 0x96, 0x41, 0x6d, 0x46, 0xb6, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
  284.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x59, 0x96, 0x41, 0x6d,
  285.    0x56, 0xb6, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  286.    0x00, 0x00, 0x00, 0x64, 0x99, 0xe5, 0xc1, 0x6e, 0x4c, 0xb6, 0x0c, 0x00,
  287.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  288.    0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  289.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00,
  290.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  291.    0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  292.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  293.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  294.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  295.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  296.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  297.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  298.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  299.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  300.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  301.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  302.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  303.    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  304.    0x00, 0x00, 0x00, 0x00};
  305. \BARFOO\
  306. else
  307.   echo "will not over write ./title.h"
  308. fi
  309. if `test ! -s ./widget.c`
  310. then
  311. echo "writting ./widget.c"
  312. cat > ./widget.c << '\BARFOO\'
  313. /* widget.c -- Xlib widget support for xspringies
  314.  * Copyright (C) 1991,1992  Douglas M. DeCarlo
  315.  *
  316.  * This file is part of XSpringies, a mass and spring simulation system for X
  317.  *
  318.  * XSpringies is free software; you can redistribute it and/or modify
  319.  * it under the terms of the GNU General Public License as published by
  320.  * the Free Software Foundation; either version 1, or (at your option)
  321.  * any later version.
  322.  *
  323.  * XSpringies is distributed in the hope that it will be useful,
  324.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  325.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  326.  * GNU General Public License for more details.
  327.  * 
  328.  * You should have received a copy of the GNU General Public License
  329.  * along with XSpringies; see the file COPYING.  If not, write to
  330.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  331.  *
  332.  */
  333.  
  334. #include <X11/Xlib.h>
  335. #include <X11/Xutil.h>
  336. #include "defs.h"
  337.  
  338. #define NAME_LEN    32
  339. #define MAX_OBJS    16
  340. #define NUM_DIGS        12
  341.  
  342. /* Bitmaps used */
  343. static char check_bits[] = {
  344.    0x00, 0x00, 0xfe, 0x7f, 0x06, 0x60, 0x0a, 0x50, 0x12, 0x48, 0x22, 0x44,
  345.    0x42, 0x42, 0x82, 0x41, 0x82, 0x41, 0x42, 0x42, 0x22, 0x44, 0x12, 0x48,
  346.    0x0a, 0x50, 0x06, 0x60, 0xfe, 0x7f, 0x00, 0x00};
  347. static char checked_bits[] = {
  348.    0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0x0e, 0x70, 0x16, 0x68, 0x26, 0x64,
  349.    0x46, 0x62, 0x86, 0x61, 0x86, 0x61, 0x46, 0x62, 0x26, 0x64, 0x16, 0x68,
  350.    0x0e, 0x70, 0xfe, 0x7f, 0xfe, 0x7f, 0x00, 0x00};
  351. static char unchecked_bits[] = {
  352.    0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60,
  353.    0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60, 0x06, 0x60,
  354.    0x06, 0x60, 0xfe, 0x7f, 0xfe, 0x7f, 0x00, 0x00};
  355. static char box_bits[] = {
  356.    0x00, 0x00, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
  357.    0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
  358.    0x02, 0x40, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00};
  359. static char rarr_bits[] = {
  360.    0xfc, 0x1f, 0xfe, 0x3f, 0x07, 0x70, 0x13, 0x60, 0x73, 0x60, 0xf3, 0x61,
  361.    0xf3, 0x67, 0xf3, 0x6f, 0xf3, 0x67, 0xf3, 0x61, 0x73, 0x60, 0x13, 0x60,
  362.    0x07, 0x70, 0xfe, 0x3f, 0xfc, 0x1f, 0x00, 0x00};
  363. static char riarr_bits[] = {
  364.    0xfc, 0x1f, 0x06, 0x30, 0xfb, 0x6f, 0xed, 0x5f, 0x8d, 0x5f, 0x0d, 0x5e,
  365.    0x0d, 0x58, 0x0d, 0x50, 0x0d, 0x58, 0x0d, 0x5e, 0x8d, 0x5f, 0xed, 0x5f,
  366.    0xfb, 0x6f, 0x06, 0x30, 0xfc, 0x1f, 0x00, 0x00};
  367. static char larr_bits[] = {
  368.    0xfc, 0x1f, 0xfe, 0x3f, 0x07, 0x70, 0x03, 0x64, 0x03, 0x67, 0xc3, 0x67,
  369.    0xf3, 0x67, 0xfb, 0x67, 0xf3, 0x67, 0xc3, 0x67, 0x03, 0x67, 0x03, 0x64,
  370.    0x07, 0x70, 0xfe, 0x3f, 0xfc, 0x1f, 0x00, 0x00};
  371. static char liarr_bits[] = {
  372.    0xfc, 0x1f, 0x06, 0x30, 0xfb, 0x6f, 0xfd, 0x5b, 0xfd, 0x58, 0x3d, 0x58,
  373.    0x0d, 0x58, 0x05, 0x58, 0x0d, 0x58, 0x3d, 0x58, 0xfd, 0x58, 0xfd, 0x5b,
  374.    0xfb, 0x6f, 0x06, 0x30, 0xfc, 0x1f, 0x00, 0x00};
  375.  
  376. /* Types of objects */
  377. typedef struct {
  378.     Window win;
  379.     int ulx, uly, lrx, lry;
  380.     int idno;
  381.     char name[NAME_LEN];
  382.     boolean state;
  383. } button;
  384.  
  385. /* Types of objects */
  386. typedef struct {
  387.     Window win;
  388.     int ulx, uly, lrx, lry;
  389.     int idno;
  390.     char name[NAME_LEN];
  391.     int *activeid;
  392.     Pixmap pm;
  393.     int pmwid, pmht;
  394.     boolean state;
  395.     boolean disable;
  396. } modebutton;
  397.  
  398. typedef struct {
  399.     Window win;
  400.     int ulx, uly, lrx, lry;
  401.     int idno;
  402.     char name[NAME_LEN];
  403.     boolean nowstate;
  404.     boolean *state;
  405. } checkbox;
  406.  
  407. typedef struct {
  408.     Window win;
  409.     int ulx, uly, lrx, lry;
  410.     int idno;
  411.     char name[NAME_LEN];
  412.     char format[NAME_LEN];
  413.     int state, active;
  414.     double nowvalue;
  415.     double *value;
  416.     double vmin, vmax, vincr;
  417. } slider;
  418.  
  419. /* Object globals */
  420. static button buttons[MAX_OBJS];
  421. static modebutton mbuttons[MAX_OBJS];
  422. static checkbox cboxes[MAX_OBJS];
  423. static slider sliders[MAX_OBJS];
  424. static char keybuff[NUM_DIGS + 1];
  425. static int numb, numm, nums, numc, cur_type, cur_num, cur_but, key_active;
  426. static boolean key_dirty;
  427. static Pixmap cb_pm, cbc_pm, cbcb_pm, cbub_pm, la_pm, lap_pm, ra_pm, rap_pm;
  428.  
  429. /* Flag if the arrow buttons on sliders are in scan mode */
  430. boolean scan_flag;
  431.  
  432. /* X variables from elsewhere */
  433. extern Display *dpy;
  434. extern Window main_win;
  435. extern GC drawgc, erasegc, fggc, bggc, revgc, hlgc;
  436. extern Pixmap acts_pm;
  437. void (*notify_func)();
  438.  
  439. void init_widgets(notify)
  440. void (*notify)();
  441. {
  442.     extern Pixmap get_pixmap();
  443.  
  444.     numb = nums = numc = numm = cur_type = cur_num = 0;
  445.     key_active = cur_but = -1;
  446.     scan_flag = FALSE;
  447.  
  448.     notify_func = notify;
  449.  
  450.     cb_pm = get_pixmap(box_bits, 16, 16, FALSE);
  451.     cbc_pm = get_pixmap(check_bits, 16, 16, FALSE);
  452.     cbcb_pm = get_pixmap(checked_bits, 16, 16, FALSE);
  453.     cbub_pm = get_pixmap(unchecked_bits, 16, 16, FALSE);
  454.     la_pm = get_pixmap(larr_bits, 16, 16, FALSE);
  455.     lap_pm = get_pixmap(liarr_bits, 16, 16, FALSE);
  456.     ra_pm = get_pixmap(rarr_bits, 16, 16, FALSE);
  457.     rap_pm = get_pixmap(riarr_bits, 16, 16, FALSE);
  458. }
  459.  
  460. void add_button(d, win, ulx, uly, lrx, lry, name, idno)
  461. Drawable d;
  462. Window win;
  463. int ulx, uly, lrx, lry;
  464. char *name;
  465. int idno;
  466. {
  467.     int len;
  468.  
  469.     if (numb < MAX_OBJS - 1) {
  470.     buttons[numb].win = win;
  471.     buttons[numb].ulx = ulx;
  472.     buttons[numb].uly = uly;
  473.     buttons[numb].lrx = lrx;
  474.     buttons[numb].lry = lry;
  475.     strncpy(buttons[numb].name, name, NAME_LEN-1);
  476.     buttons[numb].name[NAME_LEN-1] = '\0';
  477.     len = strlen(buttons[numb].name);
  478.     buttons[numb].idno = idno;
  479.     buttons[numb].state = FALSE;
  480.  
  481.     XDrawRectangle(dpy, d, drawgc, ulx, uly, lrx - ulx + 1, lry - uly + 1);
  482.     XDrawRectangle(dpy, d, drawgc, ulx+1, uly+1, lrx - ulx - 1, lry - uly - 1);
  483.  
  484.     XDrawString(dpy, d, drawgc, (ulx + lrx - len * F_WID) / 2, (uly + lry + F_HT) / 2,
  485.             buttons[numb].name, len);
  486.  
  487.     numb++;
  488.     }
  489. }
  490.  
  491. void draw_modebutton(d, which)
  492. Drawable d;
  493. int which;
  494. {
  495.     int ulx, uly, lrx, lry, pmwid, pmht;
  496.     int len;
  497.     Pixmap pm;
  498.  
  499.     ulx = mbuttons[which].ulx;
  500.     uly = mbuttons[which].uly;
  501.     lrx = mbuttons[which].lrx;
  502.     lry = mbuttons[which].lry;
  503.     pmwid = mbuttons[which].pmwid;
  504.     pmht = mbuttons[which].pmht;
  505.     pm = mbuttons[which].pm;
  506.  
  507.     len = strlen(mbuttons[which].name);
  508.  
  509.     if (len) { 
  510.     XCopyArea(dpy, pm, d, drawgc, 0, 0, pmwid, pmht, ulx + (lrx - ulx - pmwid) / 2, uly + (lry - uly - 4 * F_HT / 3 - 1 - pmht) / 2);
  511.     XDrawString(dpy, d, drawgc, ulx + (lrx - ulx - len * F_WID) / 2, lry - F_HT / 3 - 1, mbuttons[which].name, len);
  512.     } else {
  513.     XCopyArea(dpy, pm, d, drawgc, 0, 0, pmwid, pmht, ulx + (lrx - ulx - pmwid) / 2, uly + (lry - uly - pmht) / 2);
  514.     }
  515. }
  516.  
  517. void add_modebutton(d, win, ulx, uly, lrx, lry, name, pm_bits, pmwid, pmht, idno, activeid, disable)
  518. Drawable d;
  519. Window win;
  520. int ulx, uly, lrx, lry;
  521. char *name;
  522. char *pm_bits;
  523. int pmwid, pmht;
  524. int idno;
  525. int *activeid;
  526. boolean disable;
  527. {
  528.     if (numm < MAX_OBJS - 1) {
  529.     mbuttons[numm].win = win;
  530.     mbuttons[numm].ulx = ulx;
  531.     mbuttons[numm].uly = uly;
  532.     mbuttons[numm].lrx = lrx;
  533.     mbuttons[numm].lry = lry;
  534.     strncpy(mbuttons[numm].name, name, NAME_LEN-1);
  535.     mbuttons[numm].name[NAME_LEN-1] = '\0';
  536.     mbuttons[numm].idno = idno;
  537.     mbuttons[numm].activeid = activeid;
  538.     mbuttons[numm].state = (mbuttons[numm].idno == *activeid);
  539.     
  540.     mbuttons[numm].disable = disable;
  541.  
  542.     XDrawRectangle(dpy, d, drawgc, ulx, uly, lrx - ulx + 1, lry - uly + 1);
  543.     XDrawRectangle(dpy, d, drawgc, ulx+1, uly+1, lrx - ulx - 1, lry - uly - 1);
  544.  
  545.     mbuttons[numm].pm = get_pixmap(pm_bits, pmwid, pmht, FALSE);
  546.     mbuttons[numm].pmwid = pmwid;
  547.     mbuttons[numm].pmht = pmht;
  548.  
  549.     draw_modebutton(d, numm);
  550.  
  551.     numm++;
  552.     }
  553. }
  554.  
  555. void add_checkbox(d, win, ulx, uly, lrx, lry, name, idno, state)
  556. Drawable d;
  557. Window win;
  558. int ulx, uly, lrx, lry;
  559. char *name;
  560. int idno;
  561. boolean *state;
  562. {
  563.     int len;
  564.  
  565.     if (numc < MAX_OBJS - 1) {
  566.     cboxes[numc].win = win;
  567.     cboxes[numc].ulx = ulx;
  568.     cboxes[numc].uly = uly;
  569.     cboxes[numc].lrx = lrx;
  570.     cboxes[numc].lry = lry;
  571.     strncpy(cboxes[numc].name, name, NAME_LEN-1);
  572.     cboxes[numc].name[NAME_LEN-1] = '\0';
  573.     len = strlen(cboxes[numc].name);
  574.     cboxes[numc].idno = idno;
  575.     cboxes[numc].state = state;
  576.     cboxes[numc].nowstate = *(cboxes[numc].state);
  577.  
  578.     XCopyArea(dpy, cb_pm, d, drawgc, 0, 0, 16, 16, ulx, (uly + lry - 16) / 2);
  579.  
  580.     XDrawString(dpy, d, drawgc, ulx + 20, (uly + lry + F_HT) / 2 - 1, cboxes[numc].name, len);
  581.  
  582.     numc++;
  583.     }
  584. }
  585.  
  586. void add_slider(d, win, ulx, uly, lrx, lry, name, format, idno, value, vmax, vmin, vincr)
  587. Drawable d;
  588. Window win;
  589. int ulx, uly, lrx, lry;
  590. char *name, *format;
  591. int idno;
  592. double *value;
  593. double vmin, vmax, vincr;
  594. {
  595.     int len;
  596.  
  597.     if (numc < MAX_OBJS - 1) {
  598.     sliders[nums].win = win;
  599.     sliders[nums].ulx = ulx;
  600.     sliders[nums].uly = uly;
  601.     sliders[nums].lrx = lrx;
  602.     sliders[nums].lry = lry;
  603.     strncpy(sliders[nums].name, name, NAME_LEN-1);
  604.     sliders[nums].name[NAME_LEN-1] = '\0';
  605.     len = strlen(sliders[nums].name);
  606.     strncpy(sliders[nums].format, format, NAME_LEN-1);
  607.     sliders[nums].format[NAME_LEN-1] = '\0';
  608.     sliders[nums].idno = idno;
  609.     sliders[nums].value = value;
  610.     sliders[nums].nowvalue = *(sliders[nums].value);
  611.     sliders[nums].vmax = vmax;
  612.     sliders[nums].vmin = vmin;
  613.     sliders[nums].vincr = vincr;
  614.     sliders[nums].state = O_NOTHING;
  615.     sliders[nums].active = FALSE;
  616.  
  617.     XCopyArea(dpy, la_pm, d, drawgc, 0, 0, 16, 16, ulx, (uly + lry - 16) / 2);
  618.     XCopyArea(dpy, ra_pm, d, drawgc, 0, 0, 16, 16, ulx + 16 + F_WID * NUM_DIGS + 12, (uly + lry - 16) / 2);
  619.  
  620.     XDrawRectangle(dpy, d, drawgc, ulx + 16 + 2, (uly + lry - 16) / 2, F_WID * NUM_DIGS + 6, F_HT + 4);
  621.     XDrawRectangle(dpy, d, drawgc, ulx + 16 + 3, (uly + lry - 16) / 2 + 1, F_WID * NUM_DIGS + 4, F_HT + 2);
  622.  
  623.     XDrawString(dpy, d, drawgc, ulx + 16 + F_WID * NUM_DIGS + 32, (uly + lry + F_HT) / 2 - 2, sliders[nums].name, len);
  624.  
  625.     nums++;
  626.     }
  627. }
  628.  
  629. void activate_mbutton(activeptr, state)
  630. int *activeptr;
  631. boolean state;
  632. {
  633.     int i;
  634.  
  635.     for (i = 0; i < numm; i++) {
  636.     if (mbuttons[i].activeid == activeptr) {
  637.         *(mbuttons[i].activeid) = state ? mbuttons[i].idno : -1;
  638.         break;
  639.     }
  640.     }
  641. }
  642.  
  643. static void update_mbutton(old_id, new_id)
  644. int old_id, new_id;
  645. {
  646.     int i, ulx, uly, lrx, lry;
  647.  
  648.     /* Invert old mode button */
  649.     for (i = 0; i < numm; i++) {
  650.     if (mbuttons[i].idno == old_id)
  651.       break;
  652.     }
  653.     if (mbuttons[i].idno == old_id) {
  654.     ulx = mbuttons[i].ulx;
  655.     uly = mbuttons[i].uly;
  656.     lrx = mbuttons[i].lrx;
  657.     lry = mbuttons[i].lry;
  658.  
  659.     XCopyPlane(dpy, acts_pm, mbuttons[i].win, fggc, ulx+3, uly+3, lrx - ulx - 4, lry - uly - 4, ulx+3, uly+3, 0x1);
  660.     }
  661.  
  662.     /* Invert new mode button */
  663.     for (i = 0; i < numm; i++) {
  664.     if (mbuttons[i].idno == new_id)
  665.       break;
  666.     }
  667.     if (mbuttons[i].idno == new_id) {
  668.     ulx = mbuttons[i].ulx;
  669.     uly = mbuttons[i].uly;
  670.     lrx = mbuttons[i].lrx;
  671.     lry = mbuttons[i].lry;
  672.  
  673.     XCopyPlane(dpy, acts_pm, mbuttons[i].win, revgc, ulx+3, uly+3, lrx - ulx - 4, lry - uly - 4, ulx+3, uly+3, 0x1);
  674.     }
  675. }
  676.  
  677. void update_slider_box(cur, ulx, uly, lrx, lry, inverted)
  678. int cur;
  679. boolean inverted;
  680. {
  681.     int len;
  682.     char valuebuf[256];
  683.  
  684.     if (cur == key_active && key_dirty) {
  685.     strcpy(valuebuf, keybuff);
  686.     len = strlen(valuebuf);
  687.     } else {
  688.     sprintf(valuebuf, sliders[cur].format, *(sliders[cur].value));
  689.     if ((len = strlen(valuebuf)) > NUM_DIGS)
  690.       len = NUM_DIGS;
  691.     }
  692.  
  693.     XFillRectangle(dpy, sliders[cur].win, bggc, ulx + 16 + 4, (uly + lry - 16) / 2 + 2, F_WID * NUM_DIGS + 3, F_HT + 1);
  694.  
  695.     if (inverted) {
  696.     XFillRectangle(dpy, sliders[cur].win, hlgc, ulx + 16 + 5, (uly + lry - 16) / 2 + 3, F_WID * NUM_DIGS + 1, F_HT - 1);
  697.     }
  698.     XDrawString(dpy, sliders[cur].win, inverted ? bggc : fggc, ulx + 16 + 4, (uly + lry + F_HT) / 2 - 2, valuebuf, len);
  699. }
  700.  
  701. void update_slider(cur)
  702. int cur;
  703. {
  704.     int ulx, uly, lrx, lry;
  705.  
  706.     ulx = sliders[cur].ulx;
  707.     uly = sliders[cur].uly;
  708.     lrx = sliders[cur].lrx;
  709.     lry = sliders[cur].lry;
  710.  
  711.     /* Set to proper range */
  712.     if (*(sliders[cur].value) < sliders[cur].vmin) {
  713.     *(sliders[cur].value) = sliders[cur].vmin;
  714.     } else if (*(sliders[cur].value) > sliders[cur].vmax) {
  715.     *(sliders[cur].value) = sliders[cur].vmax;
  716.     }
  717.  
  718.     update_slider_box(cur, ulx, uly, lrx, lry, cur == key_active);
  719. }
  720.  
  721. void change_slider_parms(cur, valp, max, min)
  722. int cur;
  723. double *valp, max, min;
  724. {
  725.     sliders[cur].value = valp;
  726.     sliders[cur].vmax = max;
  727.     sliders[cur].vmin = min;
  728. }
  729.  
  730. int slider_valno(idno)
  731. int idno;
  732. {
  733.     int i;
  734.  
  735.     /* Draw sliders */
  736.     for (i = 0; i < nums; i++) {
  737.     if (sliders[i].idno == idno)
  738.       return i;
  739.     }
  740.     return -1;
  741. }
  742.  
  743. static void update_checkbox(cur, active)
  744. int cur;
  745. boolean active;
  746. {
  747.     int ulx, uly, lry;
  748.     Pixmap which_pm;
  749.  
  750.     ulx = cboxes[cur].ulx;
  751.     uly = cboxes[cur].uly;
  752.     lry = cboxes[cur].lry;
  753.  
  754.     if (active) {
  755.     which_pm = cboxes[cur].nowstate ? cbub_pm : cbcb_pm;
  756.     } else {
  757.     which_pm = *(cboxes[cur].state) ? cbc_pm : cb_pm;
  758.     }
  759.  
  760.     XCopyPlane(dpy, which_pm, cboxes[cur].win, fggc, 0, 0, 16, 16, ulx, (uly + lry - 16) / 2, 0x1);
  761. }
  762.  
  763. void redraw_widgets(mode)
  764. boolean mode;
  765. {
  766.     int i;
  767.  
  768.     if (mode){
  769.     /* Draw mode buttons */
  770.     for (i = 0; i < numm; i++) {
  771.         if (*(mbuttons[i].activeid) == mbuttons[i].idno)
  772.           update_mbutton(-1, mbuttons[i].idno);
  773.     }
  774.     }
  775.  
  776.     /* Draw checkboxes */
  777.     for (i = 0; i < numc; i++) {
  778.     update_checkbox(i, FALSE);
  779.     }
  780.  
  781.     /* Draw sliders */
  782.     for (i = 0; i < nums; i++) {
  783.     update_slider(i);
  784.     }
  785.  
  786.  
  787.     /* Redraw active object */
  788. }
  789.  
  790. boolean key_widgets(key, win)
  791. int key;
  792. Window win;
  793. {
  794.     int len, ka = key_active;
  795.  
  796.     if (key_active < 0 || sliders[key_active].win != win)
  797.       return FALSE;
  798.  
  799.     len = strlen(keybuff);
  800.  
  801.     switch (key) {
  802.       case K_DELETE:
  803.     if (len > 0) {
  804.         keybuff[len - 1] = '\0';
  805.     }
  806.     break;
  807.       case K_RETURN:
  808.     if (keybuff[0]) {
  809.         sscanf(keybuff, "%lf", sliders[key_active].value);
  810.     }
  811.       case K_ESCAPE:
  812.     key_active = -1;
  813.     break;
  814.       default:
  815.     if (len < NUM_DIGS - 1) {
  816.         keybuff[len] = (char)key;
  817.         keybuff[len+1] = '\0';
  818.     }
  819.     break;
  820.     }
  821.  
  822.     key_dirty = TRUE;
  823.     update_slider(ka);
  824.     if (key == K_RETURN) {
  825.     notify_func(O_SLIDER, ka);
  826.     }
  827.     return TRUE;
  828. }
  829.  
  830. boolean check_widgets(win, mx, my, butn, mstat)
  831. Window win;
  832. int mx, my;
  833. int butn, mstat;
  834. {
  835.     int i;
  836.     int ulx, uly, lrx, lry;
  837.  
  838.     switch (mstat) {
  839.       case M_UP:
  840.     /* If button up, then just deactivate current widget */
  841.     if (cur_but == butn) {
  842.         switch (cur_type) {
  843.           case O_BUTTON:
  844.         ulx = buttons[cur_num].ulx;
  845.         uly = buttons[cur_num].uly;
  846.         lrx = buttons[cur_num].lrx;
  847.         lry = buttons[cur_num].lry;
  848.  
  849.         if (buttons[cur_num].state) {
  850.             XCopyPlane(dpy, acts_pm, win, fggc, ulx+3, uly+3, lrx - ulx - 4, lry - uly - 4, ulx+3, uly+3, 0x1);
  851.             buttons[cur_num].state = FALSE;
  852.             notify_func(O_BUTTON, buttons[cur_num].idno);
  853.         }
  854.         break;
  855.  
  856.           case O_MBUTTON:
  857.         if (mbuttons[cur_num].state) {
  858.             *(mbuttons[cur_num].activeid) = (*(mbuttons[cur_num].activeid) != mbuttons[cur_num].idno) ? mbuttons[cur_num].idno : -1;
  859.             mbuttons[cur_num].state = FALSE;
  860.             notify_func(O_MBUTTON, mbuttons[cur_num].idno);
  861.         }
  862.         break;
  863.  
  864.           case O_SLIDER:
  865.         ulx = sliders[cur_num].ulx;
  866.         uly = sliders[cur_num].uly;
  867.         lrx = sliders[cur_num].lrx;
  868.         lry = sliders[cur_num].lry;
  869.  
  870.         if (sliders[cur_num].state == O_LSLIDER) {
  871.             XCopyPlane(dpy, la_pm, win, fggc, 0, 0, 16, 16, ulx, (uly + lry - 16) / 2, 0x1);
  872.             sliders[cur_num].active = FALSE;
  873.             notify_func(O_SLIDER, sliders[cur_num].idno);
  874.         } else if (sliders[cur_num].state == O_RSLIDER) {
  875.             XCopyPlane(dpy, ra_pm, win, fggc, 0, 0, 16, 16, ulx + 16 + F_WID * NUM_DIGS + 12, (uly + lry - 16) / 2, 0x1);
  876.             sliders[cur_num].active = FALSE;
  877.             notify_func(O_SLIDER, sliders[cur_num].idno);
  878.         } else if (sliders[cur_num].state == O_TSLIDER) {
  879.             if (sliders[cur_num].active) {
  880.             key_active = cur_num;
  881.             key_dirty = FALSE;
  882.             keybuff[0] = '\0';
  883.             }
  884.         }
  885.  
  886.         scan_flag = FALSE;
  887.         break;
  888.  
  889.           case O_CHECKBOX:
  890.         ulx = cboxes[cur_num].ulx;
  891.         uly = cboxes[cur_num].uly;
  892.         lrx = cboxes[cur_num].lrx;
  893.         lry = cboxes[cur_num].lry;
  894.         
  895.         if (*(cboxes[cur_num].state) != cboxes[cur_num].nowstate) {
  896.             *(cboxes[cur_num].state) = cboxes[cur_num].nowstate;
  897.             update_checkbox(cur_num, FALSE);
  898.  
  899.             notify_func(O_CHECKBOX, cboxes[cur_num].idno);
  900.         }
  901.         break;
  902.         }
  903.         cur_type = cur_num = 0;
  904.         cur_but = -1;
  905.         return TRUE;
  906.     }
  907.     break;
  908.  
  909.       case M_DOWN:
  910.     if (cur_but < 0) {
  911.         /* Check buttons */
  912.         for (i = 0; i < numb; i++) {
  913.         ulx = buttons[i].ulx;
  914.  
  915.         uly = buttons[i].uly;
  916.         lrx = buttons[i].lrx;
  917.         lry = buttons[i].lry;
  918.         
  919.         if (buttons[i].win == win && ulx < mx && mx < lrx && uly < my && my < lry) {
  920.             if (!buttons[i].state) {
  921.             XCopyPlane(dpy, acts_pm, win, revgc, ulx+3, uly+3, lrx - ulx - 4, lry - uly - 4, ulx+3, uly+3, 0x1);
  922.             buttons[i].state = TRUE;
  923.             }
  924.             cur_type = O_BUTTON;
  925.             cur_num = i;
  926.             cur_but = butn;
  927.             return TRUE;
  928.         }
  929.         }
  930.  
  931.         /* Check checkboxes */
  932.         for (i = 0; i < numc; i++) {
  933.         ulx = cboxes[i].ulx;
  934.         uly = cboxes[i].uly;
  935.         lrx = cboxes[i].lrx;
  936.         lry = cboxes[i].lry;
  937.         
  938.         if (cboxes[i].win == win && ulx < mx && mx < lrx && uly < my && my < lry) {
  939.             if (*(cboxes[i].state)) {
  940.             cboxes[i].nowstate = FALSE;
  941.             } else {
  942.             cboxes[i].nowstate = TRUE;
  943.             }
  944.             update_checkbox(i, TRUE);
  945.  
  946.             cur_type = O_CHECKBOX;
  947.             cur_num = i;
  948.             cur_but = butn;
  949.             return TRUE;
  950.         }
  951.         }
  952.  
  953.         /* Check mode buttons */
  954.         for (i = 0; i < numm; i++) {
  955.         ulx = mbuttons[i].ulx;
  956.         uly = mbuttons[i].uly;
  957.         lrx = mbuttons[i].lrx;
  958.         lry = mbuttons[i].lry;
  959.         
  960.         if (mbuttons[i].win == win && ulx < mx && mx < lrx && uly < my && my < lry) {
  961.             if ((*(mbuttons[i].activeid) == mbuttons[i].idno) && !mbuttons[i].disable)
  962.               return FALSE;
  963.  
  964.             update_mbutton(*(mbuttons[i].activeid), (*(mbuttons[i].activeid) != mbuttons[i].idno) ? mbuttons[i].idno : -1);
  965.             mbuttons[i].state = TRUE;
  966.  
  967.             cur_type = O_MBUTTON;
  968.             cur_num = i;
  969.             cur_but = butn;
  970.             return TRUE;
  971.         }
  972.         }
  973.  
  974.         /* Check sliders */
  975.         for (i = 0; i < nums; i++) {
  976.         ulx = sliders[i].ulx;
  977.         uly = sliders[i].uly;
  978.         lrx = sliders[i].lrx;
  979.         lry = sliders[i].lry;
  980.         
  981.         if (sliders[i].win == win && ulx < mx && (uly + lry - 16) / 2 < my && my < (uly + lry - 16) / 2 + 16) {
  982.             if (mx < ulx + 16) {
  983.             /* Do left arrow */
  984.             if (i == key_active) {
  985.                 key_widgets(K_RETURN, sliders[key_active].win);
  986.             }
  987.             sliders[i].state = O_LSLIDER;
  988.             XCopyPlane(dpy, lap_pm, win, fggc, 0, 0, 16, 16, ulx, (uly + lry - 16) / 2, 0x1);
  989.             if (butn == 1)
  990.               *(sliders[i].value) -= sliders[i].vincr;
  991.             update_slider(i);
  992.             sliders[i].active = TRUE;
  993.             if (butn != 1)
  994.               scan_flag = TRUE;
  995.             } else if (ulx + 16 + F_WID * NUM_DIGS + 12 < mx && mx < ulx + 16 + F_WID * NUM_DIGS + 12 + 16) {
  996.             /* Do right arrow */
  997.             if (i == key_active) {
  998.                 key_widgets(K_RETURN, sliders[key_active].win);
  999.             }
  1000.             sliders[i].state = O_RSLIDER;
  1001.             XCopyPlane(dpy, rap_pm, win, fggc, 0, 0, 16, 16, ulx + 16 + F_WID * NUM_DIGS + 12, (uly + lry - 16) / 2, 0x1);
  1002.             if (butn == 1)
  1003.               *(sliders[i].value) += sliders[i].vincr;
  1004.             update_slider(i);
  1005.             sliders[i].active = TRUE;
  1006.             if (butn != 1)
  1007.               scan_flag = TRUE;
  1008.             } else if (ulx + 18 < mx && mx < ulx + 18 + F_WID * NUM_DIGS + 6) {
  1009.             /* Do text box */
  1010.             key_widgets(K_RETURN, sliders[key_active].win);
  1011.             sliders[i].state = O_TSLIDER;
  1012.             sliders[i].active = TRUE;
  1013.             update_slider_box(i, ulx, uly, lrx, lry, TRUE);
  1014.             }
  1015.             
  1016.             cur_type = O_SLIDER;
  1017.             cur_num = i;
  1018.             cur_but = butn;
  1019.             return TRUE;
  1020.         }
  1021.         }
  1022.  
  1023.     }
  1024.     break;
  1025.  
  1026.       case M_DRAG:
  1027.     if (cur_but >= 0) {
  1028.         boolean inside;
  1029.  
  1030.         switch (cur_type) {
  1031.           case O_BUTTON:
  1032.         ulx = buttons[cur_num].ulx;
  1033.         uly = buttons[cur_num].uly;
  1034.         lrx = buttons[cur_num].lrx;
  1035.         lry = buttons[cur_num].lry;
  1036.         
  1037.         inside = (buttons[cur_num].win == win) && ulx < mx && mx < lrx && uly < my && my < lry;
  1038.         
  1039.         if ((inside && !buttons[cur_num].state) || (!inside && buttons[cur_num].state)) {
  1040.             /* Flip button value */
  1041.             XCopyPlane(dpy, acts_pm, win, buttons[cur_num].state ? fggc : revgc, ulx+3, uly+3, lrx - ulx - 4, lry - uly - 4, ulx+3, uly+3, 0x1);
  1042.             buttons[cur_num].state = !buttons[cur_num].state;
  1043.         }
  1044.         break;
  1045.  
  1046.           case O_MBUTTON:
  1047.         ulx = mbuttons[cur_num].ulx;
  1048.         uly = mbuttons[cur_num].uly;
  1049.         lrx = mbuttons[cur_num].lrx;
  1050.         lry = mbuttons[cur_num].lry;
  1051.         
  1052.         inside = (mbuttons[cur_num].win == win) && ulx < mx && mx < lrx && uly < my && my < lry;
  1053.         
  1054.         if ((inside && !mbuttons[cur_num].state) || (!inside && mbuttons[cur_num].state)) {
  1055.             /* Flip button value */
  1056.             if (mbuttons[cur_num].state)
  1057.               update_mbutton((*(mbuttons[cur_num].activeid) != mbuttons[cur_num].idno) ? mbuttons[cur_num].idno : -1, *(mbuttons[cur_num].activeid));
  1058.             else
  1059.               update_mbutton(*(mbuttons[cur_num].activeid), (*(mbuttons[cur_num].activeid) != mbuttons[cur_num].idno) ? mbuttons[cur_num].idno : -1);
  1060.  
  1061.             mbuttons[cur_num].state = !mbuttons[cur_num].state;
  1062.         }
  1063.         break;
  1064.  
  1065.           case O_SLIDER:
  1066.         ulx = sliders[cur_num].ulx;
  1067.         uly = sliders[cur_num].uly;
  1068.         lrx = sliders[cur_num].lrx;
  1069.         lry = sliders[cur_num].lry;
  1070.  
  1071.         inside = ((uly + lry - 16) / 2 < my && my < (uly + lry - 16) / 2 + 16);
  1072.  
  1073.         if (sliders[cur_num].state == O_LSLIDER) {
  1074.             inside = inside && (ulx < mx) && (mx < ulx + 16);
  1075.  
  1076.             if (sliders[cur_num].active && !inside) {
  1077.             XCopyPlane(dpy, la_pm, win, fggc, 0, 0, 16, 16, ulx, (uly + lry - 16) / 2, 0x1);
  1078.             sliders[cur_num].active = FALSE;
  1079.             } else if (!sliders[cur_num].active && inside) {
  1080.             XCopyPlane(dpy, lap_pm, win, fggc, 0, 0, 16, 16, ulx, (uly + lry - 16) / 2, 0x1);
  1081.             sliders[cur_num].active = TRUE;
  1082.             }
  1083.             scan_flag = (cur_but != 1 && sliders[cur_num].active);
  1084.         } else if (sliders[cur_num].state == O_RSLIDER) {
  1085.             inside = inside && (ulx + 16 + F_WID * NUM_DIGS + 12 < mx) && (mx < ulx + 16 + F_WID * NUM_DIGS + 12 + 16);
  1086.  
  1087.             if (sliders[cur_num].active && !inside) {
  1088.             XCopyPlane(dpy, ra_pm, win, fggc, 0, 0, 16, 16, ulx + 16 + F_WID * NUM_DIGS + 12, (uly + lry - 16) / 2, 0x1);
  1089.             sliders[cur_num].active = FALSE;
  1090.             } else if (!sliders[cur_num].active && inside) {
  1091.             XCopyPlane(dpy, rap_pm, win, fggc, 0, 0, 16, 16, ulx + 16 + F_WID * NUM_DIGS + 12, (uly + lry - 16) / 2, 0x1);
  1092.             sliders[cur_num].active = TRUE;
  1093.             }
  1094.             scan_flag = (cur_but != 1 && sliders[cur_num].active);
  1095.         } else if (sliders[cur_num].state == O_TSLIDER) {
  1096.             inside = (uly + lry - 16) / 2 < my && my <= (uly + lry - 16) / 2 + F_HT + 3 && ulx + 18 < mx && mx < ulx + 18 + F_WID * NUM_DIGS + 6;
  1097.  
  1098.             if ((sliders[cur_num].active && !inside) || (!sliders[cur_num].active && inside)) {
  1099.             update_slider_box(cur_num, ulx, uly, lrx, lry, inside);
  1100.             sliders[cur_num].active = !sliders[cur_num].active;
  1101.             }
  1102.         }
  1103.         break;
  1104.  
  1105.           case O_CHECKBOX:
  1106.         ulx = cboxes[cur_num].ulx;
  1107.         uly = cboxes[cur_num].uly;
  1108.         lrx = cboxes[cur_num].lrx;
  1109.         lry = cboxes[cur_num].lry;
  1110.         
  1111.         inside = (cboxes[cur_num].win == win) && ulx < mx && mx < lrx && uly < my && my < lry;
  1112.  
  1113.         if (inside && *(cboxes[cur_num].state) == cboxes[cur_num].nowstate) {
  1114.             cboxes[cur_num].nowstate = !*(cboxes[cur_num].state);
  1115.         } else if (!inside && *(cboxes[cur_num].state) != cboxes[cur_num].nowstate) {
  1116.             cboxes[cur_num].nowstate = *(cboxes[cur_num].state);
  1117.         } else {
  1118.             break;
  1119.         }
  1120.         
  1121.         /* Change checkbox value */
  1122.         update_checkbox(cur_num, inside);
  1123.         break;
  1124.         }
  1125.     }
  1126.     break;
  1127.  
  1128.       case M_HOLD:
  1129.     if (cur_but >= 1 && cur_type == O_SLIDER) {
  1130.         double mag = 1.0;
  1131.  
  1132.         if (cur_but == 3)
  1133.           mag = 10.0;
  1134.  
  1135.         if (sliders[cur_num].state == O_LSLIDER) {
  1136.         *(sliders[cur_num].value) -= sliders[cur_num].vincr * mag;
  1137.         update_slider(cur_num);
  1138.         } else if (sliders[cur_num].state == O_RSLIDER) {
  1139.         *(sliders[cur_num].value) += sliders[cur_num].vincr * mag;
  1140.         update_slider(cur_num);
  1141.         }
  1142.     }
  1143.     break;
  1144.     }
  1145.  
  1146.     return FALSE;
  1147. }
  1148. \BARFOO\
  1149. else
  1150.   echo "will not over write ./widget.c"
  1151. fi
  1152. echo "Finished archive 3 of 16"
  1153. exit
  1154.  
  1155. exit 0 # Just in case...
  1156. -- 
  1157.   // chris@IMD.Sterling.COM            | Send comp.sources.x submissions to:
  1158. \X/  Amiga - The only way to fly!      |
  1159.  "It's intuitively obvious to the most |    sources-x@imd.sterling.com
  1160.   casual observer..."                  |
  1161.