home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / reve / items.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  17.2 KB  |  607 lines

  1. /*LINTLIBRARY*/
  2.  
  3. /*  @(#)items.c 1.20 91/11/13
  4.  *
  5.  *  Procedures for manipulating the reve game panel items.
  6.  *
  7.  *  Copyright (C) 1990, 1991 - Rich Burridge & Yves Gallot.
  8.  *  All rights reserved.
  9.  *
  10.  *  Permission is granted to copy this source, for redistribution
  11.  *  in source form only, provided the news headers in "substantially
  12.  *  unaltered format" are retained, the introductory messages are not
  13.  *  removed, and no monies are exchanged.
  14.  *
  15.  *  Permission is also granted to copy this source, without the
  16.  *  news headers, for the purposes of making an executable copy by
  17.  *  means of compilation, provided that such copy will not be used
  18.  *  for the purposes of competition in any othello tournaments, without
  19.  *  prior permission from the authors.
  20.  *
  21.  *  No responsibility is taken for any errors on inaccuracies inherent
  22.  *  either to the comments or the code of this program, but if reported
  23.  *  (see README file), then an attempt will be made to fix them.
  24.  */
  25.  
  26. #include "reve.h"
  27. #include "color.h"
  28. #include "extern.h"
  29.  
  30.  
  31. void
  32. draw_button(wtype, item, color, image)      /* Draw a panel button. */
  33. enum win_type wtype ;
  34. enum panel_type item ;
  35. int color ;
  36. enum image_type image ;
  37. {
  38.   char *label ;
  39.   int x, y ;
  40.  
  41.   if (gtype == GXVIEW) return ;
  42.   x = items[(int) item].x ;
  43.   y = items[(int) item].y ;
  44.   if (x == -1 && y == -1) return ;
  45.   if (iscolor)
  46.     {
  47.       draw_stencil(wtype, x, y, BWIDTH, BHEIGHT, RSRC, color,
  48.                    BUT_STENCIL, BUT_STENCIL) ;
  49.       draw_image(wtype, x, y, BWIDTH, BHEIGHT, image) ;
  50.     }
  51.   else draw_stencil(wtype, x, y, BWIDTH, BHEIGHT, RSRC, C_WHITE,
  52.                     BUT_STENCIL, image) ;
  53.   label = items[(int) item].text ;
  54.   if (image == BUT_INVERT) color = C_WHITE ;
  55.   else                     color = C_TEXT ;
  56.   x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ;
  57.   y += (font_heights[(int) NFONT] +
  58.        (BHEIGHT - font_heights[(int) NFONT]) / 2) - 5 ;
  59.   draw_text(wtype, x, y, NFONT, color, label) ;
  60. }
  61.  
  62.  
  63. void
  64. draw_choice(wtype, item, color)
  65. enum win_type wtype ;
  66. enum panel_type item ;
  67. int color ;
  68. {
  69.   char *str ;
  70.   int height, i, maxw, tcol, val, width, x, xoff, y ;
  71.  
  72.   if (gtype == GXVIEW) return ;
  73.   tcol = B_COLOR(C_TEXT) ;
  74.   if (strlen(items[(int) item].label))
  75.     draw_text(items[(int) item].wtype,
  76.               items[(int) item].lx,
  77.               items[(int) item].ly + font_heights[(int) BFONT],
  78.               BFONT, tcol, items[(int) item].label) ;
  79.  
  80.   maxw = 0 ;
  81.   for (i = 0; i < items[(int) item].nopts; i++)
  82.     {
  83.       str = items[(int) item].options[i] ;
  84.       if ((val = get_strwidth(NFONT, str)) > maxw) maxw = val ;
  85.     }
  86.  
  87.   maxw += CHOICEGAP ;
  88.   x = items[(int) item].x ;
  89.   y = items[(int) item].y ;
  90.   height = font_heights[(int) NFONT] * 2 ;
  91.   width = items[(int) item].nopts * maxw ;
  92.   color_area(wtype, x, y, width, height, color) ;
  93.   draw_rect(wtype, x, y, x + width, y + height, RSRC, C_BLACK) ;
  94.  
  95.   items[(int) item].width = width ;
  96.   items[(int) item].height = height ;
  97.  
  98.   for (i = 1; i < items[(int) item].nopts; i++)
  99.     draw_line(W_PROPS, x + (i * maxw), y,
  100.                        x + (i * maxw), y + height, RSRC, C_BLACK) ;
  101.  
  102.   for (i = 0; i < items[(int) item].nopts; i++)
  103.     {
  104.       str = items[(int) item].options[i] ;
  105.       val = get_strwidth(NFONT, str) ;
  106.       xoff = (maxw - val) / 2 ;
  107.       draw_text(items[(int) item].wtype,
  108.                 x + (i * maxw) + xoff,
  109.                 y + font_heights[(int) NFONT] +
  110.                    (font_heights[(int) NFONT] / 2), NFONT, tcol, str) ;
  111.     }
  112.  
  113.   val = items[(int) item].value ;
  114.   if (val < 0 || val >= items[(int) item].nopts) return ;
  115.   draw_rect(wtype,
  116.             x + (val * maxw) + 1, y + 1,
  117.             x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ;
  118. }
  119.  
  120.  
  121. void
  122. draw_clock(wtype, item, state)
  123. enum win_type wtype ;
  124. enum panel_type item ;
  125. int state ;
  126. {
  127.   char *label ;
  128.   int color, h, w, x, y ;
  129.  
  130. #ifdef XVIEW
  131.   xv_clock(item) ;
  132.   return ;
  133. #else
  134.   if (state) color = B_COLOR(C_TEXT) ;
  135.   else       color = W_COLOR(C_PANEL) ;
  136.   if (strlen(items[(int) item].label))
  137.     draw_text(items[(int) item].wtype,
  138.               items[(int) item].lx,
  139.               items[(int) item].ly + font_heights[(int) NFONT],
  140.               NFONT, color, items[(int) item].label) ;
  141.  
  142.   x = items[(int) item].x ;
  143.   y = items[(int) item].y - 10 ;
  144.   w = CLWIDTH ;
  145.   h = CLHEIGHT ;
  146.   color_area(W_PANEL, x + 1, y + 1, w - 2, h - 2, W_COLOR(C_PANEL)) ;
  147.   if (state) color = C_BLACK ;
  148.   else       color = W_COLOR(C_PANEL) ;
  149.   draw_rect(W_PANEL, x, y, x + w, y + h, RSRC, color) ;
  150.  
  151.   label = items[(int) item].text ;
  152.   color = C_TEXT ;
  153.   x += ((CLWIDTH - get_strwidth(NFONT, label)) / 2) ;
  154.   y += (font_heights[(int) NFONT] +
  155.        (CLHEIGHT - font_heights[(int) NFONT]) / 2) ;
  156.   if (state) draw_text(wtype, x, y, NFONT, color, label) ;
  157. #endif /*XVIEW*/
  158. }
  159.  
  160.  
  161. void
  162. draw_cycle(wtype, item, color, image)
  163. enum win_type wtype ;
  164. enum panel_type item ;
  165. int color ;
  166. enum image_type image ;
  167. {
  168.   int x, y ;
  169.  
  170.   if (gtype == GXVIEW) return ;
  171.   x = items[(int) item].x + 40 ;
  172.   y = items[(int) item].y ;
  173.   if (iscolor)
  174.     {
  175.       draw_stencil(wtype, x, y, CWIDTH, CHEIGHT, RSRC, color,
  176.                    CY_STENCIL, CY_STENCIL) ;
  177.       draw_image(wtype, x, y, CWIDTH, CHEIGHT, image) ;
  178.     }
  179.   else draw_stencil(wtype, x, y, CWIDTH, CHEIGHT, RSRC, C_WHITE,
  180.                     CY_STENCIL, image) ;
  181. }
  182.  
  183.  
  184. void
  185. draw_cycle_item(wtype, item, color, image)
  186. enum win_type wtype ;
  187. enum panel_type item ;
  188. int color ;
  189. enum image_type image ;
  190. {
  191.   char val[4] ;
  192.   int tcol ;
  193.  
  194.   tcol = B_COLOR(C_TEXT) ;
  195.   if (strlen(items[(int) item].label))
  196.     draw_text(items[(int) item].wtype,
  197.               items[(int) item].lx,
  198.               items[(int) item].ly + font_heights[(int) BFONT],
  199.               BFONT, tcol, items[(int) item].label) ;
  200.  
  201.   if (item == MAX_DEPTH && !items[(int) item].value) STRCPY(val, "off") ;
  202.   else SPRINTF(val, "%d", items[(int) item].value) ;
  203.   set_cycle(wtype, item, val) ;
  204.   draw_cycle(wtype, item, color, image) ;
  205. }
  206.  
  207.  
  208. void
  209. draw_filename(str)      /* Output filename in text field. */
  210. char *str ;
  211. {
  212.   int y ;
  213.  
  214.   color_area(W_PANEL, tx + 1, ty + 1, tw - 2, th - 2, W_COLOR(C_PANEL)) ;
  215.   y = ty + (font_heights[(int) NFONT] +
  216.            (th - font_heights[(int) NFONT]) / 2) - 5 ;
  217.   draw_text(W_PANEL, tx + 5, y, NFONT, B_COLOR(C_TEXT), str) ;
  218.   draw_line(W_PANEL, tx + 5 + get_strwidth(NFONT, str), y + 5,
  219.                      tx + 5 + get_strwidth(NFONT, str),
  220.                      y + 5 - font_heights[(int) NFONT], RSRC, C_BLACK) ;
  221. }
  222.  
  223.  
  224. void
  225. draw_textfield()
  226. {
  227.   int x1, y1 ;
  228.  
  229.   if (gtype == GXVIEW) return ;
  230.   lsval = (cury < (BBORDER + (1*(BHEIGHT+BGAP)))) ? 'l' : 's' ;
  231.   x1 = BBORDER + BWIDTH + (BGAP / 2) ;
  232.   y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
  233.   color_area(W_PANEL, x1, y1,
  234.              4 * (BWIDTH + BGAP), BHEIGHT + BGAP, W_COLOR(C_PANEL)) ;
  235.   draw_rect(W_PANEL, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
  236.                     y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
  237.   draw_text(W_PANEL, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
  238.             (font_heights[(int) NFONT] +
  239.             (BHEIGHT - font_heights[(int) NFONT]) / 2) - 5,
  240.             BFONT, B_COLOR(C_TEXT), "File:") ;
  241.   tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ;
  242.   ty = BBORDER + BHEIGHT + BGAP ;
  243.   tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ;
  244.   th = BHEIGHT ;
  245.   draw_rect(W_PANEL, tx, ty, tx + tw, ty + th, RSRC, C_BLACK) ;
  246.   draw_filename(gamefile) ;
  247.  
  248.   tinput = 1 ;
  249.   items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ;
  250.   items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ;
  251.   draw_button(W_PANEL, CANCEL_BUT, C_ITEMS, BUT_NORMAL) ;
  252. }
  253.  
  254.  
  255. void
  256. draw_toggle(wtype, item, color)
  257. enum win_type wtype ;
  258. enum panel_type item ;
  259. int color ;
  260. {
  261.   enum image_type image ;
  262.   int tcol, x, y ;
  263.  
  264.   if (gtype == GXVIEW) return ;
  265.   tcol = B_COLOR(C_TEXT) ;
  266.   if (strlen(items[(int) item].label))
  267.     draw_text(items[(int) item].wtype,
  268.               items[(int) item].lx,
  269.               items[(int) item].ly + font_heights[(int) BFONT],
  270.               BFONT, tcol, items[(int) item].label) ;
  271.  
  272.   if (items[(int) item].value) image = TOGGLE_ON ;
  273.   else                         image = TOGGLE_OFF ;
  274.  
  275.   x = items[(int) item].x ;
  276.   y = items[(int) item].y ;
  277.   if (iscolor)
  278.     {
  279.       draw_stencil(wtype, x, y, TICKWIDTH, TICKHEIGHT, RSRC, color,
  280.                    CY_STENCIL, CY_STENCIL) ;
  281.       draw_image(wtype, x, y, TICKWIDTH, TICKHEIGHT, image) ;
  282.     }
  283.   else draw_stencil(wtype, x, y, TICKWIDTH, TICKHEIGHT, RSRC, C_WHITE,
  284.                     CY_STENCIL, image) ;
  285.  
  286.   if (strlen(items[(int) item].text))
  287.     draw_text(items[(int) item].wtype,
  288.               items[(int) item].x + TICKWIDTH + 10,
  289.               items[(int) item].y + font_heights[(int) NFONT],
  290.               NFONT, tcol, items[(int) item].text) ;
  291. }
  292.  
  293.  
  294. void
  295. get_filename()     /* Extract next character for load/save filename. */
  296. {
  297.   char c, dummy[MAXLINE] ;
  298.   int finished, len, nochars ;
  299.  
  300.   if (gtype == GXVIEW) return ;
  301.   finished = 0 ;
  302.   c = cur_ch ;
  303.   if (c == ESCAPE)
  304.     {
  305.       remove_textfield() ;
  306.       return ;
  307.     }
  308.   len = strlen(gamefile) ;
  309.        if (c == BACKSPACE || c == DEL) gamefile[len-1] = '\0' ;
  310.   else if (c == RETURN || c == LINEFEED) finished = 1 ;
  311.   else if (c >= 32) STRNCAT(gamefile, &c, 1) ;
  312.   len = strlen(gamefile) ;
  313.   nochars = (len <= 20) ? len : 20 ;
  314.   STRNCPY(dummy, &gamefile[len - nochars], nochars) ;
  315.   dummy[nochars] = '\0' ;
  316.   draw_filename(dummy) ;
  317.  
  318.   if (finished)
  319.     {
  320.            if (lsval == 'l') load_game() ;
  321.       else if (lsval == 's') save_game() ;
  322.       remove_textfield() ;
  323.     }
  324. }
  325.  
  326.  
  327. void
  328. load_and_move()
  329. {
  330.   if (loadgame)
  331.     {
  332.       loadgame = 0 ;
  333.       load_game() ;
  334.     }
  335.  
  336.   if (first_move)
  337.     {
  338.       first_move = 0 ;
  339.       next_player = BLACK ;
  340.       opponent_move(next_player) ;
  341.     }
  342. }
  343.  
  344.  
  345. void
  346. make_message(wtype, item)         /* Display a message panel. */
  347. enum win_type wtype ;
  348. enum panel_type item ;
  349. {
  350.   char *message ;
  351.   int x, y ;
  352.  
  353.   if (gtype == GXVIEW) return ;
  354.   if (strlen(items[(int) item].label))
  355.     draw_text(items[(int) item].wtype,
  356.               items[(int) item].lx,
  357.               items[(int) item].ly + font_heights[(int) BFONT],
  358.               BFONT, B_COLOR(C_TEXT), items[(int) item].label) ;
  359.  
  360.   message = items[(int) item].text ;
  361.   x = items[(int) item].x ;
  362.   y = items[(int) item].y ;
  363.   color_area(wtype, x, y, PANEL_WIDTH, 15, W_COLOR(C_PANEL)) ;
  364.   draw_text(wtype, x, y + font_heights[(int) NFONT], NFONT,
  365.             B_COLOR(C_TEXT), message) ;
  366. }
  367.  
  368.  
  369. void
  370. message(mtype, str)
  371. enum panel_type mtype ;
  372. char *str ;
  373. {
  374.   int n ;
  375.  
  376.   if (str == NULL) return ;
  377.   if (!started && mtype == PANEL_MES)
  378.     FPRINTF(stderr, "%s: %s\n", progname, str) ;
  379.  
  380. #ifdef XVIEW
  381.   xv_message(mtype, str) ;
  382.   return ;
  383. #else
  384.   n = (int) mtype ;
  385.   color_area(W_PANEL, items[n].x, items[n].y,
  386.              get_strwidth(NFONT, items[n].text),
  387.              font_heights[(int) NFONT] + 5, W_COLOR(C_PANEL)) ;
  388.   draw_text(W_PANEL, items[n].x, items[n].y + font_heights[(int) NFONT],
  389.             NFONT, B_COLOR(C_TEXT), str) ;
  390.   STRCPY(items[n].text, str) ;
  391. #endif /*XVIEW*/
  392. }
  393.  
  394.  
  395. void
  396. paint_all()
  397. {
  398.   paint_board() ;
  399.   paint_panel() ;
  400.   if (help_showing)  set_frame(W_HELP,  help_showing) ;
  401.   if (props_showing) set_frame(W_PROPS, props_showing) ;
  402.   load_and_move() ;
  403. }
  404.  
  405.  
  406. void
  407. paint_board()
  408. {
  409.   char s1[2], sa[2] ;
  410.   int adjust, d, i, n, x, y ;
  411.  
  412.   color_area(W_BOARD, 0, 0, board_width, board_height, C_WHITE) ;
  413.   if (iscolor)
  414.     {
  415.       color_area(W_BOARD, 0, 0, board_width, board_height, C_BORDER) ;
  416.       color_area(W_BOARD, bborder, bborder, BOARD_SIZE * cell_width,
  417.                  BOARD_SIZE * cell_height, C_SQUARE) ;
  418.     }
  419.  
  420.   batch(IS_ON) ;
  421.   for (n = 0; n <= BOARD_SIZE; n++)
  422.     {
  423.       color = B_COLOR(C_GRID) ;
  424.       if (n == 0 || n == BOARD_SIZE) color = C_BLACK ;
  425.       if (color == C_GRID) adjust = 1 ;
  426.       else adjust = 0 ;
  427.       draw_line(W_BOARD, (n * cell_width) + bborder,         /* Vertical. */
  428.                 bborder + adjust, (n * cell_width) + bborder,
  429.                 bborder + (BOARD_SIZE * cell_height) - adjust, RSRC, color) ;
  430.       draw_line(W_BOARD, bborder + adjust,                  /* Horizontal. */
  431.                 bborder + (n * cell_height),
  432.                 bborder + (BOARD_SIZE * cell_width) - adjust,
  433.                 bborder + (n * cell_height), RSRC, color) ;
  434.     }  
  435.   batch(IS_OFF) ;
  436.   batch(IS_ON) ;
  437.   for (i = 0; i < BOARD_SIZE; i++)
  438.     {
  439.       color = (iscolor) ? C_WHITE : C_BLACK ;
  440.       SPRINTF(s1, "%c", 'a' + i) ;
  441.       draw_text(W_BOARD, bborder + (i * cell_width) + (cell_width / 2) - 2,
  442.                 bborder - 4, GFONT, color, s1) ;
  443.       draw_text(W_BOARD, bborder + (i * cell_width) + (cell_width / 2) - 2,
  444.                 (2 * bborder) + (BOARD_SIZE * cell_height) - 2,
  445.                 GFONT, color, s1) ;
  446.       SPRINTF(sa, "%c", '1' + i) ;
  447.       draw_text(W_BOARD, bborder / 2 - 2,
  448.                 bborder + (i * cell_height) + (cell_height / 2) + 2,
  449.                 GFONT, color, sa) ;
  450.       draw_text(W_BOARD, bborder + (BOARD_SIZE * cell_width) + (bborder/2) - 2,
  451.                 bborder + (i * cell_height) + (cell_height / 2) + 2,
  452.                 GFONT, color, sa) ;
  453.     }
  454.   batch(IS_OFF) ;
  455.   batch(IS_ON) ;
  456.   FOR_BOARD(i)
  457.     if (board.square[i])
  458.       {
  459.         get_xy(i, &x, &y) ;
  460.         draw_piece(board.square[i], x, y, RSRC) ;
  461.       }
  462.   if (DO_LAST)   show_last(last_move, IS_ON) ;
  463.   if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ;
  464.  
  465.   if (show_moves || (invalid == TRUE && SHOW_LEGAL)) show_all(IS_ON) ;
  466.   if (suggestion != -1) draw_symbol(S_SUGGEST, suggestion, IS_ON) ;
  467.   batch(IS_OFF) ;
  468. }
  469.  
  470.  
  471. void
  472. paint_help()
  473. {
  474.   if (gtype == GXVIEW) return ;
  475.   if (hfp == NULL) return ;
  476.   color_area(W_HELP, 0, 0,
  477.              help_width, (2 * CGAP) + CHEIGHT, W_COLOR(C_PANEL)) ;
  478.   draw_cycle_item(W_HELP, HELP_PAGE, C_ITEMS, CY_NORMAL) ;
  479.   draw_line(W_HELP, 0,          (2 * CGAP) + CHEIGHT,
  480.                     help_width, (2 * CGAP) + CHEIGHT, RSRC, C_BLACK) ;
  481.   paint_help_text() ;
  482. }
  483.  
  484.  
  485. void
  486. paint_help_text()
  487. {
  488.   char buf[MAXLINE] ;
  489.   int i, y ;
  490.  
  491.   if (gtype == GXVIEW) return ;
  492.   color_area(W_HELP, 0, (2 * CGAP) + CHEIGHT + 1, help_width,
  493.              ((font_heights[(int) HFONT] + 1) * HELP_ROWS) + (2 * CGAP) - 1,
  494.              W_COLOR(C_PANEL)) ;
  495.   FSEEK(hfp, help_offsets[items[(int) HELP_PAGE].value], 0) ;
  496.   for (i = 0; i < HELP_ROWS; i++)
  497.     {
  498.       if (fgets(buf, MAXLINE, hfp) == NULL) return ;
  499.       y = (3 * CGAP) + CHEIGHT + ((i + 1) * (font_heights[(int) HFONT] + 1)) ;
  500.       draw_text(W_HELP, CGAP, y, HFONT, B_COLOR(C_TEXT), buf) ;
  501.     }
  502. }
  503.  
  504.  
  505. void
  506. paint_panel()
  507. {
  508.   char mes[MAXLINE] ;
  509.  
  510.   if (iscolor)
  511.     color_area(W_PANEL, 0, 0, PANEL_WIDTH, PANEL_HEIGHT, C_PANEL) ;
  512.  
  513.   draw_button(W_PANEL, LOAD_BUT,     C_ITEMS, BUT_NORMAL) ;
  514.   draw_button(W_PANEL, MOVES_BUT,    C_ITEMS, BUT_NORMAL) ;
  515.   draw_button(W_PANEL, NEW_GAME_BUT, C_ITEMS, BUT_NORMAL) ;
  516.   draw_button(W_PANEL, HELP_BUT,     C_ITEMS, BUT_NORMAL) ;
  517.   draw_button(W_PANEL, REDO_BUT,     C_ITEMS, BUT_NORMAL) ;
  518.   draw_button(W_PANEL, PROPS_BUT,    C_ITEMS, BUT_NORMAL) ;
  519.  
  520.   draw_button(W_PANEL, SAVE_BUT,     C_ITEMS, BUT_NORMAL) ;
  521.   draw_button(W_PANEL, SUGGEST_BUT,  C_ITEMS, BUT_NORMAL) ;
  522.   draw_button(W_PANEL, PRINT_BUT,    C_ITEMS, BUT_NORMAL) ;
  523.   draw_button(W_PANEL, STOP_BUT,     C_ITEMS, BUT_NORMAL) ;
  524.   draw_button(W_PANEL, UNDO_BUT,     C_ITEMS, BUT_NORMAL) ;
  525.   draw_button(W_PANEL, QUIT_BUT,     C_ITEMS, BUT_NORMAL) ;
  526.  
  527.   make_message(W_PANEL, BLACK_PLAYS) ;
  528.   make_message(W_PANEL, WHITE_PLAYS) ;
  529.  
  530.   draw_clock(W_PANEL, BLACK_CLOCK, DO_CLOCK) ;
  531.   draw_clock(W_PANEL, WHITE_CLOCK, DO_CLOCK) ;
  532.  
  533.   make_message(W_PANEL, PANEL_MES) ;
  534.   make_message(W_PANEL, EVAL_MES) ;
  535.   make_message(W_PANEL, SCORE_MES) ;
  536.   make_message(W_PANEL, TURN_MES) ;
  537.  
  538.   if (tinput) draw_textfield() ;
  539.   set_score() ;
  540.   SPRINTF(mes, "%s to move.",
  541.           (next_player == BLACK) ? bstone_name : wstone_name) ;
  542.   message(TURN_MES, mes) ;
  543. }
  544.  
  545.  
  546. void
  547. paint_prop_sheet()
  548. {
  549.   int color ;
  550.  
  551.   if (gtype == GXVIEW) return ;
  552.   color = W_COLOR(C_PANEL) ;
  553.   color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ;
  554.  
  555.   draw_choice(W_PROPS, COMP_CHOICE, color) ;
  556.   draw_choice(W_PROPS, DIFF_CHOICE, color) ;
  557.  
  558.   draw_cycle_item(W_PROPS, MAX_DEPTH, C_ITEMS, CY_NORMAL) ;
  559.  
  560.   draw_toggle(W_PROPS, OPT_ANIM, color) ;
  561.   draw_toggle(W_PROPS, OPT_BEST, color) ;
  562.   draw_toggle(W_PROPS, OPT_LAST, color) ;
  563.   draw_toggle(W_PROPS, OPT_EVAL, color) ;
  564.   draw_toggle(W_PROPS, OPT_NUM,  color) ;
  565.   draw_toggle(W_PROPS, OPT_FLIP, color) ;
  566.   draw_toggle(W_PROPS, OPT_MOVE, color) ;
  567.   draw_toggle(W_PROPS, OPT_CLK,  color) ;
  568. }
  569.  
  570.  
  571. void
  572. remove_textfield()
  573. {
  574.   int x1, y1 ;
  575.  
  576.   if (gtype == GXVIEW) return ;
  577.   x1 = BBORDER + BWIDTH + (BGAP / 2) ;
  578.   y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
  579.   color_area(W_PANEL, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP,
  580.              W_COLOR(C_PANEL)) ;
  581.   tinput = 0 ;
  582.   items[(int) CANCEL_BUT].x = -1 ;
  583.   items[(int) CANCEL_BUT].y = -1 ;
  584.  
  585.   draw_button(W_PANEL, SUGGEST_BUT,  C_ITEMS, BUT_NORMAL) ;
  586.   draw_button(W_PANEL, PRINT_BUT,    C_ITEMS, BUT_NORMAL) ;
  587.   draw_button(W_PANEL, STOP_BUT,     C_ITEMS, BUT_NORMAL) ;
  588.   draw_button(W_PANEL, UNDO_BUT,     C_ITEMS, BUT_NORMAL) ;
  589. }
  590.  
  591.  
  592. void
  593. set_cycle(wtype, item, str)
  594. enum win_type wtype ;
  595. enum panel_type item ;
  596. char *str ;
  597. {
  598.   if (gtype == GXVIEW) return ;
  599.   color_area(wtype, items[(int) item].x, items[(int) item].y,
  600.              items[(int) item].width, CHEIGHT, W_COLOR(C_PANEL)) ;
  601.   draw_text(wtype, items[(int) item].x,
  602.             items[(int) item].y + font_heights[(int) NFONT],
  603.             NFONT, B_COLOR(C_TEXT), str) ;
  604.   STRCPY(items[(int) item].text, str) ;
  605.   items[(int) item].width = get_strwidth(NFONT, str) ;
  606. }
  607.