home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 1 / FFMCD01.bin / bbs / libdisks / d700t799 / disk762.lha / PlotMap / source.lha / handleUser.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-09  |  21.0 KB  |  644 lines

  1. /* handle user`s input (PlotMap) */
  2.  
  3. #include "PlotMap.h"
  4.  
  5.  
  6. #define MENU_PROJECT 0
  7. #define MENU_PREFERENCES 1
  8. #define MENU_COLORS 2
  9. #define MENU_MAPS 3
  10. #define MENU_EDIT 4
  11.  
  12. #define ITEM_HELP 0
  13. #define ITEM_SAVE_MAP 2
  14. #define ITEM_SAVE_CONFIG 3
  15. #define ITEM_PRINT_MAP 5
  16. #define ITEM_ABOUT 7
  17. #define ITEM_QUIT 9
  18.  
  19. #define ITEM_VFACTOR 0
  20. #define SUB_SET 0
  21. #define SUB_USE_DEFAULT 1
  22. #define ITEM_CLS_BEFORE_DRAW 2
  23. #define ITEM_COORD_WINDOW 4
  24. #define ITEM_COORD_MOUSEXY 5
  25. #define ITEM_COORD_DEGREE 6
  26. #define ITEM_PLOTMAP_MIN 8
  27. #define ITEM_PLOTMAP_MAX 13
  28. #define ITEM_DETAIL_LEVEL 15
  29.  
  30. #define ITEM_PLANE 0
  31. #define SUB_FLAT 0
  32. #define SUB_MERCATOR 1
  33. #define ITEM_BOX 1
  34. #define SUB_BOX1 0
  35. #define SUB_BOX2 1
  36. #define SUB_BOX_ZOOM_IN 3
  37. #define SUB_BOX_ZOOM_OUT 4
  38. #define ITEM_SPHERE 2
  39. #define SUB_GLOBE 0
  40. #define SUB_ORBITAL 1
  41. #define SUB_SPHERE_ZOOM_IN 3
  42. #define SUB_SPHERE_ZOOM_OUT 4
  43. #define ITEM_REDRAW 4
  44.  
  45. #define ITEM_PALETTE 0
  46. #define ITEM_BG_COLOR 2
  47. #define ITEM_OCEAN_COLOR 3
  48. #define ITEM_MAP_COLOR_MIN 5
  49. #define ITEM_MAP_COLOR_MAX 10
  50. #define ITEM_GRID_COLOR 12
  51. #define ITEM_GRIDHIGH_COLOR 13
  52. #define ITEM_SHADOW_COLOR 14
  53. #define ITEM_LINE_COLOR 16
  54. #define ITEM_BOX_COLOR 17
  55. #define ITEM_TEXT_COLOR 18
  56. #define ITEM_FLOOD_COLOR 19
  57.  
  58. #define ITEM_CLEAR_SCREEN 0
  59. #define ITEM_FILL_OCEANS 1
  60. #define ITEM_GRID 2
  61. #define ITEM_SHADOW 3
  62. #define ITEM_TOGGLE_TITLE 4
  63. #define ITEM_DRAW_LINE 6
  64. #define ITEM_DRAW_BOX 7
  65. #define ITEM_DRAW_FILLEDBOX 8
  66. #define ITEM_TEXT 9
  67. #define ITEM_FLOOD_FILL 10
  68.  
  69.  
  70. #define SET_VFAC_STRING 1
  71. #define SET_VFAC_DEFAULT 2
  72. #define SET_VFAC_OK 3
  73. #define SET_VFAC_CANCEL 4
  74.  
  75. /********** externals **********/
  76.  
  77. extern struct config config;
  78. extern struct Menu *menu;
  79. extern struct Screen *screen;
  80. extern struct TextAttr myfont;
  81. extern struct RastPort *rp;
  82. extern APTR vinfo;
  83. extern BOOL ende;
  84. extern double act_vfactor, m_vfactor;
  85. extern UWORD old_maptype;
  86.  
  87. extern void save_config(void);
  88. extern void draw_fullmap(UWORD), draw_boxmap(UWORD), draw_globemap(UWORD);
  89. extern void refresh_coord(WORD, WORD), set_coord_window_size(void);
  90. extern void open_coord_window(void), close_coord_window(void);
  91. extern void fill_oceans(void), draw_grid(void), draw_shadow(void);
  92. extern void draw_line(void), text(void), flood_fill(void);
  93. extern BOOL draw_box(BOOL, int);
  94.  
  95. /********** Variablen, Daten **********/
  96.  
  97. /* Data for about requester */
  98. static struct EasyStruct AboutES =
  99.    {sizeof(struct EasyStruct), 0, "About...",
  100. "PlotMap V"VERSION" ("DATE")\n\
  101. (c) 1992 Thies Wellpott\n\
  102. This program is freely distributable\n\n\
  103. This program has been developed with\n\
  104. help of the source code of DrawMap 4.0\n\
  105. by Bryan Brown", "Ok"};
  106.  
  107. struct Gadget *gad_list;
  108. struct Window *wd = NULL;
  109.  
  110. /********** Routinen **********/
  111.  
  112. BOOL open_window(int width, int height, UBYTE *title)
  113. /* => TRUE: all ok, => FALSE: error */
  114. {
  115.    if (!(wd = OpenWindowTags(NULL,
  116.             WA_Left,main_wd->MouseX - width/2,
  117.             WA_Top,main_wd->MouseY,
  118.             WA_CustomScreen,screen,  WA_Title,title,
  119.             WA_IDCMP, IDCMP_REFRESHWINDOW | IDCMP_VANILLAKEY |
  120.                IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE |
  121.                IDCMP_ACTIVEWINDOW,
  122.             WA_Flags, WFLG_SIMPLE_REFRESH | WFLG_RMBTRAP | WFLG_ACTIVATE |
  123.                WFLG_DRAGBAR,
  124.             WA_InnerWidth,width, WA_InnerHeight,height,
  125.             WA_AutoAdjust,TRUE,  WA_Gadgets, gad_list,  TAG_DONE)))
  126.    {
  127.       FreeGadgets(gad_list);
  128.       TITLE_ERROR("Can`t open window!");
  129.       return(FALSE);
  130.    }
  131.  
  132.    GT_RefreshWindow(wd, NULL);
  133.    ClearMenuStrip(main_wd);   /* clear menu strip, so user can`t select */
  134.    IDCMP(0);
  135.    return(TRUE);
  136. }
  137.  
  138.  
  139. void close_window(void)
  140. {
  141.    if (wd)
  142.    {
  143.       CloseWindow(wd);
  144.       wd = NULL;
  145.       FreeGadgets(gad_list);
  146.       IDCMP(NORMAL_IDCMP);
  147.       SetMenuStrip(main_wd, menu);     /* reattach menu */
  148.    }
  149. }
  150.  
  151.  
  152. static void help(void)
  153. /* open window with help items */
  154. {
  155. }
  156.  
  157.  
  158. static void save_map(void)
  159. /* open file requester and save map as IFF-picture */
  160. {
  161. }
  162.  
  163.  
  164. static void print_map(void)
  165. /* print map via DUMP_RPORT */
  166. {
  167. }
  168.  
  169.  
  170. void set_vfac_menu(void)
  171. {
  172.    ClearMenuStrip(main_wd);
  173.  
  174.    sprintf( ((struct IntuiText *)ItemAddress(menu,
  175.          FULLMENUNUM(1,0,NOSUB))->ItemFill)->IText,
  176.          "Vert. factor  %3.2f", act_vfactor);
  177.    sprintf( ((struct IntuiText *)ItemAddress(menu,
  178.          FULLMENUNUM(1,0,1))->ItemFill)->IText,
  179.          "Use default  %3.2f", config.vfac);
  180.  
  181.    LayoutMenuItems(ItemAddress(menu, FULLMENUNUM(1,0,NOSUB)), vinfo,
  182.             GTMN_Menu, menu, TAG_DONE);
  183.    SetMenuStrip(main_wd, menu);
  184.    m_vfactor = (double)(screen->Height) / 5.90 / act_vfactor;
  185. }
  186.  
  187.  
  188. static void set_vfac(void)
  189. /* open window; Use as default, Ok, Cancel */
  190. {
  191.    struct NewGadget new_gad;
  192.    struct Gadget *gad, *str_gad;
  193.    int font_h, char_w;
  194.    BOOL wd_ende = FALSE;
  195.    char istr[5];
  196.  
  197.    font_h = myfont.ta_YSize;
  198.    char_w = TextLength(rp, "M", 1);
  199.    sprintf(istr, "%3.2f", act_vfactor);
  200.  
  201.    gad_list = NULL;
  202.    gad = CreateContext(&gad_list);
  203.  
  204.    new_gad.ng_LeftEdge = screen->WBorLeft + 4 + 14*char_w;
  205.    new_gad.ng_TopEdge = screen->WBorTop + myfont.ta_YSize + 3;
  206.    new_gad.ng_Width = 5*char_w + 12;
  207.    new_gad.ng_Height = font_h + 6;
  208.    new_gad.ng_GadgetText = "_Vert. factor:";
  209.    new_gad.ng_GadgetID = SET_VFAC_STRING;
  210.    new_gad.ng_TextAttr = &myfont;
  211.    new_gad.ng_Flags = PLACETEXT_LEFT;
  212.    new_gad.ng_VisualInfo = vinfo;
  213.    new_gad.ng_UserData = NULL;
  214.    str_gad = gad = CreateGadget(STRING_KIND, gad, &new_gad,
  215.             GT_Underscore,'_',  GTST_String,istr,  GTST_MaxChars,4,
  216.             TAG_DONE);
  217.  
  218.    new_gad.ng_LeftEdge -= 14*char_w;
  219.    new_gad.ng_TopEdge += font_h + 6 + INTERHEIGHT;
  220.    new_gad.ng_Width = 14*char_w + 8;
  221.    new_gad.ng_Height = font_h + 4;
  222.    new_gad.ng_GadgetText = "Use as _default";
  223.    new_gad.ng_GadgetID = SET_VFAC_DEFAULT;
  224.    new_gad.ng_Flags = PLACETEXT_IN;
  225.    gad = CreateGadget(BUTTON_KIND, gad, &new_gad,
  226.             GT_Underscore,'_',  TAG_DONE);
  227.  
  228.    new_gad.ng_LeftEdge += 14*char_w + 8 + INTERWIDTH;
  229.    new_gad.ng_Width = 6*char_w + 8;
  230.    new_gad.ng_GadgetText = "_Ok";
  231.    new_gad.ng_GadgetID = SET_VFAC_OK;
  232.    gad = CreateGadget(BUTTON_KIND, gad, &new_gad,
  233.             GT_Underscore,'_',  TAG_DONE);
  234.  
  235.    new_gad.ng_LeftEdge += 6*char_w + 8 + INTERWIDTH;
  236.    new_gad.ng_GadgetText = "_Cancel";
  237.    new_gad.ng_GadgetID = SET_VFAC_CANCEL;
  238.    gad = CreateGadget(BUTTON_KIND, gad, &new_gad,
  239.             GT_Underscore,'_',  TAG_DONE);
  240.  
  241.    if (!gad)
  242.    {
  243.       FreeGadgets(gad_list);
  244.       TITLE_ERROR("Can`t create gadgets!");
  245.       return;
  246.    }
  247.  
  248.    if (!open_window(26*char_w + 24 + 2 * INTERWIDTH + 8,
  249.                      2*font_h + 10 + INTERHEIGHT + 4, "Set vert. factor"))
  250.       return;
  251.  
  252.    while (!wd_ende)
  253.    {
  254.       struct IntuiMessage *msg;
  255.       ULONG class;
  256.       UWORD code;
  257.       BOOL def_flag = FALSE, error = FALSE;
  258.       int i;
  259.       char *str = ((struct StringInfo *)str_gad->SpecialInfo)->Buffer;
  260.  
  261.       WaitPort(wd->UserPort);
  262.       while (!wd_ende && (msg = GT_GetIMsg(wd->UserPort)))
  263.       {
  264.          class = msg->Class;
  265.          code = msg->Code;
  266.          gad = (struct Gadget *)msg->IAddress;
  267.          GT_ReplyIMsg(msg);
  268.  
  269.          switch (class)
  270.          {
  271.             case IDCMP_ACTIVEWINDOW:
  272.                ActivateGadget(str_gad, wd, NULL);
  273.                break;
  274.             case IDCMP_GADGETUP:
  275.                switch (gad->GadgetID)
  276.                {
  277.                   case SET_VFAC_STRING:
  278.                      error = FALSE;
  279.                      for (i = 0; i < strlen(str); i++)
  280.                      {
  281.                         if (i == 1)
  282.                         {
  283.                            if (str[i] != '.')
  284.                               error = TRUE;
  285.                         }
  286.                         else
  287.                         {
  288.                            if (str[i] < '0' || str[i] > '9')
  289.                               error = TRUE;
  290.                         }
  291.                      } /* for (i) */
  292.                      if (error)
  293.                      {
  294.                         DisplayBeep(NULL);
  295.                         SetWindowTitles(wd, "Wrong input!", (UBYTE *)-1);
  296.                         ActivateGadget(str_gad, wd, NULL);
  297.                      }
  298.                      else
  299.                         SetWindowTitles(wd, "Set vert. factor", (UBYTE *)-1);
  300.                      break;
  301.                   case SET_VFAC_DEFAULT:
  302.                      def_flag = TRUE;
  303.                   case SET_VFAC_OK:
  304.                      if (!error)
  305.                         act_vfactor = afp(str);       /* FFP only! */
  306.                      if (def_flag)
  307.                         config.vfac = act_vfactor;
  308.                      wd_ende = TRUE;
  309.                      break;
  310.                   case SET_VFAC_CANCEL:
  311.                      wd_ende = TRUE;
  312.                      break;
  313.                } /* switch (GadgetID) */
  314.                break;
  315.             case IDCMP_VANILLAKEY:
  316.                switch (code)
  317.                {
  318.                   case 'v':
  319.                   case 'V':
  320.                      ActivateGadget(str_gad, wd, NULL);
  321.                      break;
  322.                   case 'd':
  323.                   case 'D':
  324.                      def_flag = TRUE;
  325.                   case 'o':
  326.                   case 'O':
  327.                      if (!error)
  328.                         act_vfactor = afp(str);
  329.                      if (def_flag)
  330.                         config.vfac = act_vfactor;
  331.                      wd_ende = TRUE;
  332.                      break;
  333.                   case 'c':
  334.                   case 'C':
  335.                      wd_ende = TRUE;
  336.                      break;
  337.                } /* switch (code) */
  338.                break;
  339.             case IDCMP_REFRESHWINDOW:
  340.                GT_BeginRefresh(wd);
  341.                GT_EndRefresh(wd, TRUE);
  342.                break;
  343.          } /* switch (class) */
  344.       } /* while (GT_GetIMsg) */
  345.    } /* while (!wd_ende) */
  346.  
  347.    close_window();                  /* also frees gadgets */
  348.    set_vfac_menu();
  349. }
  350.  
  351.  
  352. static void palette(void)
  353. {
  354. }
  355.  
  356.  
  357. static void redraw(void)
  358. /* redraw current map */
  359. {
  360.    if (old_maptype != ~0)
  361.    {
  362.       if (old_maptype & MAP_PLANE)
  363.          draw_fullmap(old_maptype & MAP_MASK);
  364.       if (old_maptype & MAP_BOX)
  365.          draw_boxmap(old_maptype & MAP_MASK);
  366.       if (old_maptype & MAP_SPHERE)
  367.          draw_globemap(old_maptype & MAP_MASK);
  368.    }
  369.    else
  370.       TITLE_ERROR("Can`t redraw: no previous map drawn!");
  371. }
  372.  
  373.  
  374. void handleIDCMP(void)
  375. {
  376.    struct IntuiMessage *msg;
  377.    ULONG class;
  378.    UWORD code, menunum, itemnum, subnum;
  379.    WORD mx,my, oldx=-1,oldy=-1;
  380.    struct MenuItem *item;
  381.  
  382.    /* IMPORTANT!!! FIRST check for end, THEN get message, otherwise you get
  383.     * a message but WILL NOT reply it (because while loop will be broken if
  384.     * flag ende is set) !! */
  385.    while (!ende && (msg = (struct IntuiMessage *)GetMsg(main_wd->UserPort)))
  386.    {
  387.       class = msg->Class;
  388.       code = msg->Code;
  389.       mx = msg->MouseX;
  390.       my = msg->MouseY;
  391.       ReplyMsg((struct Message *)msg);
  392.  
  393.       switch (class)
  394.       {
  395.          case IDCMP_INTUITICKS:
  396.             if ((oldx != mx) || (oldy != my))      /* avoid flicker */
  397.             {
  398.                refresh_coord(mx,my);
  399.                oldx = mx;
  400.                oldy = my;
  401.             }
  402.             break;
  403.          case IDCMP_MENUPICK:
  404.             TITLE_NORMAL;
  405.             while (code != MENUNULL)
  406.             {
  407.                menunum = MENUNUM(code);
  408.                itemnum = ITEMNUM(code);
  409.                subnum = SUBNUM(code);
  410.                item = ItemAddress(menu, code);     /* get item address */
  411.  
  412.                switch (menunum)
  413.                {
  414.                   case MENU_PROJECT:
  415.                      switch (itemnum)
  416.                      {
  417.                         case ITEM_HELP:
  418.                            help();
  419.                            break;
  420.                         case ITEM_SAVE_MAP:
  421.                            save_map();
  422.                            break;
  423.                         case ITEM_SAVE_CONFIG:
  424.                            save_config();
  425.                            break;
  426.                         case ITEM_PRINT_MAP:
  427.                            print_map();
  428.                            break;
  429.                         case ITEM_ABOUT:
  430.                            EasyRequest(main_wd, &AboutES, NULL, NULL);
  431.                            break;
  432.                         case ITEM_QUIT:
  433.                            ende = TRUE;
  434.                            break;
  435.                      } /* switch (itemnum) */
  436.                      break;
  437.                   case MENU_PREFERENCES:
  438.                      switch (itemnum)
  439.                      {
  440.                         case ITEM_VFACTOR:
  441.                            switch (subnum)
  442.                            {
  443.                               case SUB_SET:
  444.                                  set_vfac();
  445.                                  break;
  446.                               case SUB_USE_DEFAULT:
  447.                                  act_vfactor = config.vfac;
  448.                                  set_vfac_menu();
  449.                                  break;
  450.                            } /* switch (subnum) */
  451.                            break;
  452.                         case ITEM_CLS_BEFORE_DRAW:
  453.                            config.cls_before_draw ^= TRUE;
  454.                            break;
  455.                         case ITEM_COORD_WINDOW:
  456.                            if (item->Flags & CHECKED)
  457.                            {
  458.                               open_coord_window();
  459.                               config.coord_window = TRUE;
  460.                            }
  461.                            else
  462.                            {
  463.                               close_coord_window();
  464.                               config.coord_window = FALSE;
  465.                            }
  466.                            break;
  467.                         case ITEM_COORD_MOUSEXY:
  468.                            config.coord_mousexy ^= TRUE;
  469.                            set_coord_window_size();
  470.                            break;
  471.                         case ITEM_COORD_DEGREE:
  472.                            config.coord_degree ^= TRUE;
  473.                            set_coord_window_size();
  474.                            break;
  475.                         case ITEM_PLOTMAP_MIN+0:
  476.                         case ITEM_PLOTMAP_MIN+1:
  477.                         case ITEM_PLOTMAP_MIN+2:
  478.                         case ITEM_PLOTMAP_MIN+3:
  479.                         case ITEM_PLOTMAP_MIN+4:
  480.                         case ITEM_PLOTMAP_MIN+5:
  481.                            config.plotmap[itemnum - ITEM_PLOTMAP_MIN] ^= TRUE;
  482.                            break;
  483.                         case ITEM_DETAIL_LEVEL:
  484.                            config.detail_level = subnum + 1;
  485.                            break;
  486.                      } /* switch (itemnum) */
  487.                      break;
  488.                   case MENU_COLORS:
  489.                      switch (itemnum)
  490.                      {
  491.                         case ITEM_PALETTE:
  492.                            palette();
  493.                            break;
  494.                         case ITEM_BG_COLOR:
  495.                            config.bg_color = subnum;
  496.                            break;
  497.                         case ITEM_OCEAN_COLOR:
  498.                            config.ocean_color = subnum;
  499.                            break;
  500.                         case ITEM_MAP_COLOR_MIN+0:
  501.                         case ITEM_MAP_COLOR_MIN+1:
  502.                         case ITEM_MAP_COLOR_MIN+2:
  503.                         case ITEM_MAP_COLOR_MIN+3:
  504.                         case ITEM_MAP_COLOR_MIN+4:
  505.                         case ITEM_MAP_COLOR_MIN+5:
  506.                            config.mapcolor[itemnum-ITEM_MAP_COLOR_MIN] = subnum;
  507.                            break;
  508.                         case ITEM_GRID_COLOR:
  509.                            config.grid_color = subnum;
  510.                            break;
  511.                         case ITEM_GRIDHIGH_COLOR:
  512.                            config.gridhigh_color = subnum;
  513.                            break;
  514.                         case ITEM_SHADOW_COLOR:
  515.                            config.shadow_color = subnum;
  516.                            break;
  517.                         case ITEM_LINE_COLOR:
  518.                            config.line_color = subnum;
  519.                            break;
  520.                         case ITEM_BOX_COLOR:
  521.                            config.box_color = subnum;
  522.                            break;
  523.                         case ITEM_TEXT_COLOR:
  524.                            config.text_color = subnum;
  525.                            break;
  526.                         case ITEM_FLOOD_COLOR:
  527.                            config.flood_color = subnum;
  528.                            break;
  529.                      } /* switch (itemnum) */
  530.                      break;
  531.                   case MENU_MAPS:
  532.                      switch (itemnum)
  533.                      {
  534.                         case ITEM_PLANE:
  535.                            switch (subnum)
  536.                            {
  537.                               case SUB_FLAT:
  538.                                  draw_fullmap(MAP_FLAT);
  539.                                  break;
  540.                               case SUB_MERCATOR:
  541.                                  draw_fullmap(MAP_MERCATOR);
  542.                                  break;
  543.                            } /* switch (subnum) */
  544.                            break;
  545.                         case ITEM_BOX:
  546.                            if (old_maptype & (MAP_PLANE | MAP_BOX))
  547.                            {
  548.                               switch (subnum)
  549.                               {
  550.                                  case SUB_BOX1:
  551.                                     if (draw_box(FALSE, 1))
  552.                                        draw_boxmap(old_maptype & MAP_MASK);
  553.                                     break;
  554.                                  case SUB_BOX2:
  555.                                     if (draw_box(FALSE, 2))
  556.                                        draw_boxmap(old_maptype & MAP_MASK);
  557.                                     break;
  558.                                  case SUB_BOX_ZOOM_IN:
  559.                                     if (old_maptype & MAP_BOX)
  560.                                     {
  561.                                     }
  562.                                     break;
  563.                                  case SUB_BOX_ZOOM_OUT:
  564.                                     if (old_maptype & MAP_BOX)
  565.                                     {
  566.                                     }
  567.                                     break;
  568.                               } /* switch (subnum) */
  569.                            } /* if (MAP_PLANE | MAP_BOX) */
  570.                            break;
  571.                         case ITEM_SPHERE:
  572.                            switch (subnum)
  573.                            {
  574.                               case SUB_GLOBE:
  575.                                  draw_globemap(MAP_GLOBE);
  576.                                  break;
  577.                               case SUB_ORBITAL:
  578.                                  draw_globemap(MAP_ORBITAL);
  579.                                  break;
  580.                               case SUB_SPHERE_ZOOM_IN:
  581.                                  if (old_maptype & MAP_SPHERE)
  582.                                  {
  583.                                  }
  584.                                  break;
  585.                               case SUB_SPHERE_ZOOM_OUT:
  586.                                  if (old_maptype & MAP_SPHERE)
  587.                                  {
  588.                                  }
  589.                                  break;
  590.                            } /* switch (subnum) */
  591.                            break;
  592.                         case ITEM_REDRAW:
  593.                            redraw();
  594.                            break;
  595.                      } /* switch (itemnum) */
  596.                      break;
  597.                   case MENU_EDIT:
  598.                      switch (itemnum)
  599.                      {
  600.                         case ITEM_CLEAR_SCREEN:
  601.                            SetRast(rp, config.bg_color);
  602.                            break;
  603.                         case ITEM_FILL_OCEANS:
  604.                            fill_oceans();
  605.                            break;
  606.                         case ITEM_GRID:
  607.                            draw_grid();
  608.                            break;
  609.                         case ITEM_SHADOW:
  610.                            draw_shadow();
  611.                            break;
  612.                         case ITEM_TOGGLE_TITLE:
  613.                            ShowTitle(screen, !(screen->Flags & SHOWTITLE));
  614.                            break;
  615.                         case ITEM_DRAW_LINE:
  616.                            draw_line();
  617.                            break;
  618.                         case ITEM_DRAW_BOX:
  619.                            draw_box(FALSE, 0);
  620.                            break;
  621.                         case ITEM_DRAW_FILLEDBOX:
  622.                            draw_box(TRUE, 0);
  623.                            break;
  624.                         case ITEM_TEXT:
  625.                            text();
  626.                            break;
  627.                         case ITEM_FLOOD_FILL:
  628.                            flood_fill();
  629.                            break;
  630.                      } /* switch (itemnum) */
  631.                      break;
  632.                } /* switch (menunum) */
  633.  
  634.                if ((item->NextSelect != code) && (MENUNUM(item->NextSelect) < 5))
  635.                   code = item->NextSelect;      /* get next selected item */
  636.                else                             /* only if different! */
  637.                   code = MENUNULL;
  638.             } /* while (code != MENUNULL) */
  639.             break;
  640.       } /* switch (class) */
  641.    } /* while (GetMsg()) */
  642. }
  643.  
  644.