home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / src / graphics / _panel.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  17.0 KB  |  704 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  2.1.1                                                 11-15-1991
  4. +
  5. +
  6. +  _panel.c
  7. +
  8. +
  9. +  Copyright (c) 1991  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #include <math.h>
  16. #include <string.h>
  17. #include <stdio.h>
  18. #include <values.h>
  19.  
  20. #ifdef XVIEW
  21.  
  22. #include <X11/X.h>
  23. #include <X11/Xlib.h>
  24.  
  25. #include <xview/xview.h>
  26. #include <xview/xv_xrect.h>
  27. #include <xview/panel.h>
  28. #include <xview/font.h>
  29. #include <xview/openmenu.h>
  30. #include <xview/icon.h>
  31.  
  32.  
  33. #else
  34.  
  35. #include <suntool/sunview.h>
  36. #include <suntool/canvas.h>
  37. #include <suntool/panel.h>
  38.  
  39. #endif
  40.  
  41. #define MAX_BUT  64
  42. #define MAX_ITEM 16
  43.  
  44. static short icon_image[] = {
  45.  
  46. #include "leda.icon"
  47.  
  48. };
  49.  
  50. mpr_static(panel_icon_pixrect,64,64,1,icon_image);
  51.  
  52.  
  53. typedef struct {
  54.  
  55. Frame   panel_frame;
  56. Panel   panel;
  57.  
  58. Panel_item choice_item[MAX_ITEM];
  59. int*       choice_ref[MAX_ITEM];
  60. int        choice_step[MAX_ITEM];
  61. int        choice_offset[MAX_ITEM];
  62. int        choice_count;
  63.  
  64. Panel_item slider_item[MAX_ITEM];
  65. int*       slider_ref[MAX_ITEM];
  66. int        slider_count;
  67.  
  68. Panel_item string_item[MAX_ITEM];
  69. Menu       string_menu[MAX_ITEM];
  70. char*      string_ref[MAX_ITEM];
  71. int        string_count;
  72.  
  73. Panel_item int_item[MAX_ITEM];
  74. int*       int_ref[MAX_ITEM];
  75. int        int_count;
  76.  
  77. Panel_item float_item[MAX_ITEM];
  78. double*    float_ref[MAX_ITEM];
  79. int        float_count;
  80.  
  81. Panel_item but_item[MAX_BUT]; 
  82. int        but_centered[MAX_BUT];
  83. int        but_count;
  84. int        but_line_count;
  85. int        button_width;
  86.  
  87. int panel_row;
  88.  
  89. } LEDA_PANEL;
  90.  
  91. typedef LEDA_PANEL *leda_panel;
  92.  
  93. static leda_panel current_panel;
  94. static int        panel_button_answer;
  95.  
  96.  
  97. void  x_draw_panel_init(p)
  98. leda_panel p;
  99. {
  100.   p->choice_count = 0;
  101.   p->slider_count = 0;
  102.   p->string_count = 0;
  103.   p->int_count    = 0;
  104.   p->float_count  = 0;
  105.   p->but_count    = 0;
  106.   p->but_line_count = 0;
  107.   p->button_width = 0;
  108.   p->panel_row    = 0;
  109.  
  110. }
  111.  
  112.  
  113. leda_panel x_draw_panel_create()
  114.  
  115. #ifdef XVIEW
  116.   Xv_Font panel_font;
  117. #endif
  118.  
  119.   Icon icon = icon_create(ICON_IMAGE, &panel_icon_pixrect, 0);
  120.  
  121.   leda_panel p = (leda_panel) malloc(sizeof(LEDA_PANEL));
  122.  
  123.  
  124.   p->panel_frame = window_create(0, FRAME,
  125.                               FRAME_ICON, icon,
  126.                               FRAME_NO_CONFIRM, TRUE, 
  127.                               WIN_WIDTH, 1000,
  128.                               WIN_X,      100, 
  129.                               WIN_Y,      100, 
  130.                               0);
  131.  
  132. #ifdef XVIEW
  133.  
  134.   panel_font = (Xv_Font)xv_find(p->panel_frame, FONT,
  135.                          FONT_FAMILY, FONT_FAMILY_DEFAULT_FIXEDWIDTH,
  136.                          FONT_STYLE,  FONT_STYLE_NORMAL,
  137.                          FONT_SIZE,   14,
  138.                          0);
  139.  
  140.   p->panel = window_create(p->panel_frame, PANEL, WIN_FONT, panel_font, 0);
  141.  
  142. #else
  143.  
  144.   p->panel = window_create(p->panel_frame, PANEL,0);
  145.  
  146. #endif
  147.  
  148.  
  149.  x_draw_panel_init(p);
  150.  
  151.  return p;
  152.  
  153. }
  154.  
  155. void x_draw_panel_destroy(p) 
  156. leda_panel p;
  157. { window_destroy(p->panel_frame);
  158.   free(p); 
  159.  }
  160.  
  161.  
  162. static void panel_button_notify(item, event)
  163. Panel_item    item;
  164. Event        *event;
  165. {
  166.   int i,n;
  167.   char buf[256];
  168.   float f;
  169.  
  170.   panel_button_answer = (int)panel_get(item,PANEL_CLIENT_DATA);
  171.  
  172.   for (i=0; i<current_panel->slider_count; i++)
  173.     *(current_panel->slider_ref[i]) = 
  174.                         (int)panel_get_value(current_panel->slider_item[i]);
  175.  
  176.   for (i=0; i<current_panel->choice_count; i++)
  177.    { n = (int)panel_get_value(current_panel->choice_item[i]);
  178.     *(current_panel->choice_ref[i]) = 
  179.         current_panel->choice_offset[i] + n * current_panel->choice_step[i];
  180.     }
  181.  
  182.   for (i=0; i<current_panel->string_count; i++)
  183.    strcpy(current_panel->string_ref[i],
  184.           (char*)panel_get_value(current_panel->string_item[i]));
  185.  
  186.   for (i=0; i<current_panel->int_count; i++)
  187.   { strcpy(buf,(char*)panel_get_value(current_panel->int_item[i]));
  188.     sscanf(buf,"%d",current_panel->int_ref[i]);
  189.    }
  190.  
  191.   for (i=0; i<current_panel->float_count; i++)
  192.   { strcpy(buf,(char*)panel_get_value(current_panel->float_item[i]));
  193.     sscanf(buf,"%f",&f);
  194.     *(current_panel->float_ref[i]) = (double)f;
  195.    }
  196.  
  197.   notify_stop();
  198.  
  199.  }
  200.  
  201.  
  202. #ifdef XVIEW
  203.  
  204. static void menu_proc(menu, menu_item)  /* selecting menu */
  205. Menu menu;
  206. Menu_item menu_item;
  207. {
  208.    Panel_item text_item = window_get(menu,MENU_CLIENT_DATA);
  209.    window_set(text_item,PANEL_VALUE,window_get(menu_item, MENU_STRING),0);
  210.  }
  211.  
  212. #else
  213.  
  214. static char** menu_strings;
  215.  
  216. static void panel_menu_proc(item, event)
  217. Panel_item item;
  218. Event *event;
  219. { int i;
  220.   Menu_item menu_item;
  221.   int j = (int)panel_get(item,PANEL_CLIENT_DATA);
  222.  
  223.   if (event_id(event) == MS_RIGHT && event_is_down(event))
  224.   { menu_item = menu_show(current_panel->string_menu[j], current_panel->panel, event,0);
  225.     panel_set(current_panel->string_item[j],PANEL_VALUE, menu_get(menu_item, MENU_STRING),0);
  226.    }
  227.   else panel_default_handle_event(item,event);
  228. }
  229.  
  230. #endif
  231.  
  232.  
  233. void x_draw_panel_choice_item(p,text,address,argc,argv,step,offset)
  234. leda_panel p;
  235. char* text;
  236. int* address;
  237. int argc;
  238. char** argv;
  239. int step;
  240. int offset;
  241. {
  242.   int i;
  243.   char* choices[16];
  244.  
  245.   if (p->choice_count == MAX_ITEM) return;
  246.  
  247.   for(i=0;i<16;i++) 
  248.      choices[i] = (i<argc) ? argv[i] : 0;
  249.  
  250.   p->panel_row+=40;
  251.  
  252.   p->choice_ref[p->choice_count] = address;
  253.  
  254.   p->choice_step[p->choice_count] = step;
  255.   p->choice_offset[p->choice_count] = offset;
  256.  
  257.   p->choice_item[p->choice_count] = panel_create_item(p->panel, PANEL_CHOICE, 
  258.                           PANEL_LABEL_STRING, text,       
  259.                           PANEL_LABEL_X, 20,
  260.                           PANEL_VALUE_X, 180,
  261.                           PANEL_ITEM_Y, p->panel_row,
  262.                           PANEL_DISPLAY_LEVEL,    PANEL_ALL,
  263.                           PANEL_VALUE, (*address-offset)/step,
  264.                           PANEL_CHOICE_STRINGS, 
  265.                              choices[0],  choices[1],  choices[2],  choices[3], 
  266.                              choices[4],  choices[5],  choices[6],  choices[7], 
  267.                              choices[8],  choices[9],  choices[10], choices[11],
  268.                              choices[12], choices[13], choices[14], choices[15],
  269.                              0,0);
  270.  p->choice_count++;
  271.  
  272. }
  273.  
  274.  
  275. void x_draw_panel_slider_item(p,text,address,Min,Max)
  276. leda_panel p;
  277. char* text;
  278. int* address;
  279. int Min;
  280. int Max;
  281. {
  282.   int i;
  283.   char label[18];
  284.  
  285.   if (p->slider_count == MAX_ITEM) return;
  286.  
  287.   for (i=0; i<17; i++)  
  288.     label[i] = (i<strlen(text)) ? text[i] : ' ';
  289.  
  290.   label[17] = 0;
  291.  
  292.   p->panel_row+=40;
  293.  
  294.   p->slider_ref[p->slider_count] = address;
  295.  
  296.   p->slider_item[p->slider_count] = panel_create_item(p->panel, PANEL_SLIDER, 
  297.                           PANEL_LABEL_STRING, label,       
  298.                           PANEL_LABEL_X,      20,
  299.                           PANEL_VALUE_X,      180,
  300.                           PANEL_ITEM_Y,       p->panel_row,
  301.                           PANEL_VALUE,        *address,
  302.                           PANEL_MIN_VALUE,    Min,
  303.                           PANEL_MAX_VALUE,    Max,
  304.                           PANEL_SLIDER_WIDTH, 180,
  305.                           PANEL_SHOW_RANGE,   FALSE,
  306.                       /*  PANEL_VALUE_DISPLAY_LENGTH, 20, */
  307.                           0);
  308.  p->slider_count++;
  309.  
  310. }
  311.  
  312.  
  313.  
  314. void x_draw_panel_text_item(p,text)
  315. leda_panel p;
  316. char* text;
  317. {
  318.   p->panel_row+=20;
  319.  
  320.   panel_create_item(p->panel, PANEL_MESSAGE, 
  321.                            PANEL_LABEL_BOLD, TRUE,
  322.                            PANEL_LABEL_STRING, text,
  323.                            PANEL_ITEM_X, 20,
  324.                            PANEL_ITEM_Y, p->panel_row,
  325.                        0);
  326.  
  327. }
  328.  
  329.  
  330. void x_draw_panel_string_menu_item(p,text,s,menu_label,n,items)
  331. leda_panel p;
  332. char* text;
  333. char* s;
  334. char    *menu_label;
  335. int      n;
  336. char  **items;
  337. {
  338.     Menu menu;
  339.     char menu_l[32];
  340.     int i;
  341.     int cols = 1 +n/15;
  342.  
  343.     if (p->string_count == MAX_ITEM) return;
  344.  
  345.     p->panel_row+=40;
  346.  
  347.     p->string_ref[p->string_count] = s;
  348.  
  349.     p->string_item[p->string_count] = panel_create_item(p->panel, PANEL_TEXT, 
  350.                                 PANEL_ITEM_X, 20,
  351.                                 PANEL_ITEM_Y, p->panel_row,
  352.                                 PANEL_LABEL_STRING, text,
  353.                                 PANEL_VALUE,s,
  354.                                 PANEL_VALUE_X,180,
  355.                                 PANEL_LABEL_X,20,
  356.                                 PANEL_VALUE_DISPLAY_LENGTH, 20,
  357.                                 PANEL_VALUE_STORED_LENGTH, 256, 
  358.                                 0);
  359.     
  360. #ifdef XVIEW
  361.  
  362.     if (n>0)
  363.     {
  364.       menu = (Menu)window_create(NULL, MENU,
  365.                              MENU_NCOLS, cols,
  366.                              MENU_CLIENT_DATA, p->string_item[p->string_count],
  367.                              MENU_NOTIFY_PROC, menu_proc,
  368.                              0);
  369.  
  370.       for(i=0;i<n;i++) menu_set(menu,MENU_STRING_ITEM,items[i],i,0);
  371.  
  372.       (void) window_create(p->panel, PANEL_BUTTON,
  373.                               PANEL_LABEL_STRING, menu_label,
  374.                               PANEL_ITEM_MENU,    menu, 
  375.                               0);
  376.      }
  377.  
  378. #else
  379.  
  380.  
  381.     if (n > 0)
  382.     { 
  383.      sprintf(menu_l,"%s -> ",menu_label);
  384.      menu_label = menu_l;
  385.  
  386.       menu = menu_create(MENU_NCOLS, cols,
  387.                          MENU_NOTIFY_PROC, menu_return_item,
  388.                         0);
  389.  
  390.       for(i=0;i<n;i++) menu_set(menu,MENU_STRING_ITEM,items[i],i,0);
  391.  
  392.       panel_create_item(p->panel, PANEL_BUTTON,
  393.               PANEL_LABEL_IMAGE,panel_button_image(p->panel,menu_label,0,0), 
  394.               PANEL_EVENT_PROC, panel_menu_proc,
  395.               PANEL_CLIENT_DATA,p->string_count,
  396.                         0);
  397.      }
  398.  
  399.     p->string_menu[p->string_count] = menu;
  400.  
  401. #endif
  402.  
  403.     p->string_count++;
  404.  
  405.  }
  406.  
  407. void x_draw_panel_string_item(p,text,s)
  408. leda_panel p;
  409. char* text;
  410. char* s;
  411. { x_draw_panel_string_menu_item(p,text,s,"",0,0); }
  412.  
  413.  
  414. void x_draw_panel_int_item(p,text,i)
  415. leda_panel p;
  416. char* text;
  417. int* i;
  418. {
  419.     char s[32];
  420.  
  421.     if (p->int_count == MAX_ITEM) return;
  422.  
  423.     sprintf(s,"%d",*i);
  424.  
  425.     p->panel_row+=40;
  426.  
  427.    
  428.     p->int_ref[p->int_count] = i;
  429.  
  430.     p->int_item[p->int_count] = panel_create_item(p->panel, PANEL_TEXT, 
  431.                                 PANEL_ITEM_X, 20,
  432.                                 PANEL_ITEM_Y, p->panel_row,
  433.                                 PANEL_LABEL_STRING, text,
  434.                                 PANEL_VALUE,s,
  435.                                 PANEL_VALUE_X,180,
  436.                                 PANEL_LABEL_X,20,
  437.                                 PANEL_VALUE_DISPLAY_LENGTH, 10,
  438.                                 PANEL_VALUE_STORED_LENGTH, 32, 
  439.                                 0);
  440.     
  441.  
  442. /*
  443.    p->int_item[p->int_count] = panel_create_item(p->panel, PANEL_NUMERIC_TEXT,
  444.                                             PANEL_ITEM_X, 20,
  445.                                             PANEL_ITEM_Y, p->panel_row,
  446.                                             PANEL_LABEL_STRING,    text,
  447.                                             PANEL_VALUE, *i,
  448.                                             PANEL_MIN_VALUE, -MAXINT,
  449.                                             PANEL_MAX_VALUE, MAXINT,
  450.                                             PANEL_VALUE_X,180,
  451.                                             PANEL_LABEL_X,20,
  452.                                             PANEL_VALUE_DISPLAY_LENGTH, 10,
  453.                                             NULL);
  454. */
  455.  
  456.     p->int_count++;
  457.     
  458.  }
  459.  
  460. void x_draw_panel_float_item(p,text,f)
  461. leda_panel p;
  462. char* text;
  463. double* f;
  464. {
  465.     char s[256];
  466.     sprintf(s,"%f",*f); 
  467.  
  468.     if (p->float_count == MAX_ITEM) return;
  469.  
  470.     p->panel_row+=40;
  471.     p->float_item[p->float_count] = panel_create_item(p->panel, PANEL_TEXT, 
  472.                                 PANEL_ITEM_X, 20,
  473.                                 PANEL_ITEM_Y, p->panel_row,
  474.                                 PANEL_LABEL_STRING, text,
  475.                                 PANEL_VALUE, s,
  476.                                 PANEL_VALUE_X,180,
  477.                                 PANEL_LABEL_X,20,
  478.                                 PANEL_VALUE_DISPLAY_LENGTH, 10,
  479.                                 PANEL_VALUE_STORED_LENGTH, 256, 
  480.                                 0);
  481.     p->float_ref[p->float_count] = f;
  482.  
  483.     p->float_count++;
  484.     
  485.  }
  486.  
  487.  
  488. int x_draw_panel_button(p,button)
  489. leda_panel p;
  490. char* button;
  491.   Rect    *r;
  492.  
  493.   int i;
  494.  
  495.   if (p->but_count == MAX_BUT) return;
  496.  
  497.   p->but_centered[p->but_count] = 0;
  498.  
  499.   if (p->but_line_count==0)
  500.   {  
  501.     if (p->panel_row==0) 
  502.        p->panel_row = 20;
  503.     else 
  504.        if (p->but_count==0) 
  505.           p->panel_row+=50;
  506.        else
  507.           p->panel_row+=35;
  508.  
  509.  p->but_item[p->but_count] =  panel_create_item(p->panel, PANEL_BUTTON, 
  510.  
  511. #ifdef XVIEW
  512.              PANEL_LABEL_STRING, button,       
  513. #else
  514.              PANEL_LABEL_IMAGE,panel_button_image(p->panel,button,0,0),
  515. #endif
  516.                            PANEL_NOTIFY_PROC, panel_button_notify,
  517.                            PANEL_CLIENT_DATA,p->but_count,
  518.                            PANEL_ITEM_Y, p->panel_row,
  519.                            PANEL_ITEM_X,20,
  520.                            0);
  521.    }
  522.     else
  523.    {
  524.      p->but_item[p->but_count] =  panel_create_item(p->panel, PANEL_BUTTON, 
  525.  
  526. #ifdef XVIEW
  527.              PANEL_LABEL_STRING, button,       
  528. #else
  529.              PANEL_LABEL_IMAGE,panel_button_image(p->panel,button,0,0),
  530. #endif
  531.                            PANEL_NOTIFY_PROC, panel_button_notify,
  532.                            PANEL_CLIENT_DATA,p->but_count,
  533.                            PANEL_ITEM_Y, p->panel_row,
  534.                            0);
  535.  
  536.    if ( panel_get(p->but_item[p->but_count],PANEL_ITEM_X)
  537.                            < panel_get(p->but_item[p->but_count-1],PANEL_ITEM_X) )
  538.    { /* new line */
  539.      p->panel_row += 35;
  540.      p->but_line_count = 0;
  541.      panel_set(p->but_item[p->but_count],PANEL_ITEM_Y,p->panel_row,0);
  542.      p->button_width = (int) window_get(p->panel,WIN_WIDTH) - 10;
  543.     }
  544.  
  545.   }
  546.  
  547.     p->but_line_count++;
  548.     p->but_count++;
  549.  
  550.  
  551. }
  552.  
  553.  
  554.  
  555. int x_draw_panel_button_line(p,n,buttons)
  556. leda_panel p;
  557. int n;
  558. char** buttons;
  559. { int i;
  560.   int w;
  561.   Panel_item dummy;
  562.  
  563.  
  564.  
  565.   for(i=0; i<n; i++)  x_draw_panel_button(p,buttons[i]);
  566.  
  567.   dummy =  panel_create_item(p->panel, PANEL_BUTTON, PANEL_ITEM_Y, p->panel_row, 0);
  568.  
  569.   w = (int)panel_get(dummy,PANEL_ITEM_X);
  570.  
  571.   panel_destroy_item(dummy);
  572.  
  573.   if (w < (int)panel_get(p->but_item[p->but_count-1],PANEL_ITEM_X)) 
  574.      p->button_width = (int)window_get(p->panel,WIN_WIDTH) - 10;
  575.   else
  576.      if (w > p->button_width) p->button_width = w;
  577.  
  578.   p->but_line_count = 0;
  579. }
  580.  
  581.  
  582. void x_draw_panel_label(p,label)
  583. leda_panel p;
  584. char* label;
  585. { window_set(p->panel_frame,FRAME_LABEL, label,0); }
  586.  
  587.  
  588. int x_draw_panel_open(p)
  589. leda_panel p;
  590. { Panel_item cont_but, quit_but;
  591.   Rect    *r;
  592.  
  593.   int width,height,left,top,delta;
  594.   int i;
  595.  
  596.   current_panel = p;
  597.  
  598.   if (p->but_count == 0)   /* default buttons: continue /quit */
  599.   {
  600.    p->panel_row+=50;
  601.    
  602.    cont_but = panel_create_item(p->panel, PANEL_BUTTON, 
  603.  
  604. #ifdef XVIEW
  605.              PANEL_LABEL_STRING, "continue",       
  606. #else
  607.              PANEL_LABEL_IMAGE,panel_button_image(p->panel,"continue",0,0),
  608. #endif
  609.                            PANEL_NOTIFY_PROC, panel_button_notify,
  610.                            PANEL_CLIENT_DATA,-1,
  611.                            PANEL_ITEM_Y, p->panel_row,
  612.                            PANEL_ITEM_X, 180,
  613.                   0);
  614.  
  615.    quit_but = panel_create_item(p->panel, PANEL_BUTTON, 
  616.  
  617. #ifdef XVIEW
  618.              PANEL_LABEL_STRING, "quit",       
  619. #else
  620.              PANEL_LABEL_IMAGE,panel_button_image(p->panel,"quit",0,0),
  621. #endif
  622.                            PANEL_NOTIFY_PROC, panel_button_notify,
  623.                            PANEL_CLIENT_DATA,-2,
  624.                            PANEL_ITEM_Y, p->panel_row,
  625.                     0);
  626.  
  627.    }
  628.  
  629.    else 
  630.      if (p->but_line_count > 0) x_draw_panel_button_line(p,0,0);
  631.  
  632.  
  633.  
  634. #ifndef XVIEW
  635.   panel_create_item(p->panel, PANEL_MESSAGE, 
  636.                            PANEL_LABEL_BOLD, TRUE,
  637.                            PANEL_LABEL_STRING, " ",
  638.                            PANEL_ITEM_X, 20,
  639.                            PANEL_ITEM_Y, p->panel_row+25,
  640.                        0);
  641. #endif
  642.  
  643. /*
  644.   if (grid_mode) x_draw_cursor(mouse_xreal,mouse_yreal);
  645. */
  646.  
  647.   window_fit(p->panel);
  648.   window_fit(p->panel_frame);
  649.  
  650.  
  651. /* center buttons */
  652.  
  653.    delta = ((int) window_get(p->panel,WIN_WIDTH) - p->button_width - 10)/2;
  654.  
  655.    for (i=0;i<p->but_count;i++)
  656.      if (p->but_centered[i] == 0)
  657.      { panel_set(p->but_item[i],PANEL_ITEM_X, 
  658.                  panel_get(p->but_item[i],PANEL_ITEM_X) + delta, 0);
  659.        p->but_centered[i] = 1;
  660.       }
  661.  
  662.  
  663.  
  664.   /* center the panel_frame frame on the screen */
  665.  
  666.   r = (Rect *) window_get(p->panel_frame, WIN_SCREEN_RECT);
  667.  
  668.   width = (int) window_get(p->panel_frame, WIN_WIDTH);
  669.   height = (int) window_get(p->panel_frame, WIN_HEIGHT);
  670.  
  671.   left = (r->r_width - width) / 2;
  672.   top = (r->r_height - height) / 2;
  673.  
  674.   if (left < 0) left = 0;
  675.   if (top < 0) top = 0;
  676.  
  677.   window_set(p->panel_frame, WIN_X, left, WIN_Y, top, 0);
  678.  
  679.  
  680.   window_main_loop(p->panel_frame);
  681.  
  682.   window_set(p->panel_frame,WIN_SHOW,FALSE,0);
  683.  
  684.  
  685.   if (p->but_count == 0)
  686.   { panel_destroy_item(cont_but);
  687.     panel_destroy_item(quit_but);
  688.     p->panel_row -= 50;
  689.    }
  690.  
  691. /*
  692.   if (grid_mode) x_draw_cursor(mouse_xreal,mouse_yreal);
  693. */
  694.  
  695.   if (panel_button_answer == -2) exit(0);
  696.  
  697.   return panel_button_answer;
  698.  
  699. }
  700.  
  701.