home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / CUAMENU.C < prev    next >
C/C++ Source or Header  |  1995-12-13  |  84KB  |  1,937 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   cuamenu.c                                                               */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*   Cua Action bar related functions.                                       */
  8. /*                                                                           */
  9. /*****************************************************************************/
  10.  
  11. #include "all.h"
  12. #include <ctype.h>
  13. #include "cuamenu.h"
  14.  
  15. /*****************************************************************************/
  16. /* #defines for various positions in the menu.                               */
  17. /*****************************************************************************/
  18. #define POS_ACTIONBAR    1              /* Event in the action bar.          */
  19. #define POS_PULLDOWN     2              /* Event in the current pulldown.    */
  20. #define POS_OUTSIDEMENU  3              /* Event outside the menu.           */
  21.  
  22. #define NO_PULLDOWN      -1
  23.  
  24. #define CONTINUE         1
  25. #define RETURN           2
  26.  
  27. #define MENU_PULLDOWN    1
  28. #define MENU_ACTIONBAR   2
  29. #define MENU_PULLACTION  3
  30.  
  31. /*****************************************************************************/
  32. /* Externals.                                                                */
  33. /*****************************************************************************/
  34. extern uchar    hiatt[];                /* attributes string for highlight.  */
  35. extern uchar    VideoAtr;               /* default logical video attribute.  */
  36. extern uchar    ClearField[];           /* attrib str for clearing fields.   */
  37. extern uchar    hilite[];               /* attrib str to highlight fields.   */
  38. extern uchar    badhilite[];            /* attrib str to highlight bad fields*/
  39. extern uchar    normal[];               /* attrib str to disp normal fields. */
  40. extern uchar    badnormal[];            /* attrib str to disp bad fields.    */
  41. extern uchar    Shadow[];               /* attrib str for shadowing around   */
  42. extern KEY2FUNC defk2f[];               /* keys to functions map.            */
  43. extern KEYSCODE key2code[];
  44. extern uint     VideoCols;
  45. extern uint     VideoRows;
  46. extern uchar    *VideoMap;
  47. extern UINT     MenuRow;                /* screen row for menu bar (0..N)    */
  48.  
  49. /*****************************************************************************/
  50. /* Statics.                                                                  */
  51. /*****************************************************************************/
  52. static PEVENT   Event;
  53. static int      MouseState = STATE_BUTTON_RELEASED;
  54. static int      MenuState;
  55. static UCHAR    icol[ NUM_PULLDOWNS ];
  56. static UCHAR    ilen[ NUM_PULLDOWNS ];
  57. static int      CurrentMenuChoice;
  58.  
  59. static UCHAR    uarrow[]    = { U_ARROW, 0 };
  60. static UCHAR    darrow[]    = { D_ARROW, 0 };
  61.  
  62. static UCHAR    barstr[]    = {V_BAR,0};
  63. static UCHAR    rarrow[]    = { R_ARROW, 0 };
  64. static UCHAR    topline[]   = { TL_CORNER, RepCnt(1), H_BAR, TR_CORNER, 0 };
  65. static UCHAR    botline[]   = { BL_CORNER, RepCnt(1), H_BAR, BR_CORNER, 0 };
  66.  
  67. static UCHAR    separator[] = { L_JUNCTION, RepCnt(1), H_BAR, R_JUNCTION, 0 };
  68. static UCHAR    bullet[]    = { BULLET, 0 };
  69.  
  70. typedef struct keychoice
  71. {
  72.   int Key;
  73.   int Choice;
  74. } KEY2CHOICE;
  75.  
  76. /*****************************************************************************/
  77. /* CuaMenuBar()                                                              */
  78. /*                                                                           */
  79. /* Description:                                                              */
  80. /*                                                                           */
  81. /*   We come into this function when we have received an event on the        */
  82. /*   action bar. The user is wants to select a function to execute.          */
  83. /*   The purpose of this function is to provide the interface necessary to   */
  84. /*   select the function and return a function code to the caller.           */
  85. /*                                                                           */
  86. /* Parameters:                                                               */
  87. /*                                                                           */
  88. /*   InitialOption  - Action bar selection before entry.                     */
  89. /*                                                                           */
  90. /* Return Value:                                                             */
  91. /*                                                                           */
  92. /*   FuncCode       - function code of the selected function.                */
  93. /*                                                                           */
  94. /*****************************************************************************/
  95. int  CuaMenuBar( int InitialOption , void *pParm )
  96. {
  97.   int    FuncCode, rc, InitialPullChoice = 0;
  98.  
  99.   /***************************************************************************/
  100.   /* This code will manage two cursors. The cursor highlighting the          */
  101.   /* Action Bar selection and another highlighting the pulldown selection.   */
  102.   /*                                                                         */
  103.   /* -  Initialise the flags.                                                */
  104.   /***************************************************************************/
  105.  
  106.   /***************************************************************************/
  107.   /* If the function has been called with initial option as No pulldown, ie  */
  108.   /* only the action bar cursor is to be shown.                              */
  109.   /***************************************************************************/
  110.   if( InitialOption == NO_PULLDOWN )
  111.   {
  112.     /*************************************************************************/
  113.     /* - Set current pulldown flag.                                          */
  114.     /* - Set CurrentMenuChoice which will get the selection on the action bar*/
  115.     /* - Display the action bar cursor.                                      */
  116.     /*************************************************************************/
  117.     CurrentMenuChoice = 0;
  118.     DisplayMenuCursor( CurrentMenuChoice );
  119.     MenuState = MENU_ACTIONBAR;
  120.   }
  121.   /***************************************************************************/
  122.   /* If the function has been called with a valid action bar option.         */
  123.   /***************************************************************************/
  124.   else
  125.   {
  126.     /*************************************************************************/
  127.     /* - Set CurrentMenuChoice which will get the selection on the action bar*/
  128.     /* - Display the action bar cursor.                                      */
  129.     /* - Display the pulldown for the action bar selection.                  */
  130.     /* - Display the pulldown cursor on the top pulldown selection.          */
  131.     /*************************************************************************/
  132.     if( (CurrentMenuChoice = InitialOption - 1) >= NUM_PULLDOWNS )
  133.        CurrentMenuChoice = 0;
  134.  
  135.     DisplayMenuCursor( CurrentMenuChoice );
  136.     DisplayPulldown( CurrentMenuChoice );
  137.  
  138.     Event = GetCurrentEvent();
  139.     if( Event->Type == TYPE_MOUSE_EVENT )
  140.     {
  141.       MenuState = MENU_PULLACTION;
  142.       switch( Event->Value )
  143.       {
  144.         case EVENT_BUTTON_1_DOWN:
  145.         {
  146.           MouseState = STATE_BUTTON_PRESSED;
  147.           break;
  148.         }
  149.  
  150.         case EVENT_BUTTON_1_DOWN_MOVE:
  151.         {
  152.           MouseState = STATE_BUTTON_MOVE;
  153.           break;
  154.         }
  155.  
  156.         case EVENT_NO_BUTTONS_DOWN:
  157.         case EVENT_NO_BUTTONS_DOWN_MOVE:
  158.         {
  159.           MouseState = STATE_BUTTON_RELEASED;
  160.           break;
  161.         }
  162.       }
  163.     }
  164.     else
  165.     {
  166.       MenuState  = MENU_PULLDOWN;
  167.       MouseState = NULL;
  168.     }
  169.   }
  170.  
  171.   /***************************************************************************/
  172.   /* Now, we go into a loop until we get a function code to return to the    */
  173.   /* caller.                                                                 */
  174.   /***************************************************************************/
  175.   for( ;; )
  176.   {
  177.     switch( MenuState )
  178.     {
  179.       case MENU_PULLDOWN:
  180.       {
  181.         rc = GetPulldownChoice( CurrentMenuChoice, &MouseState, &FuncCode,
  182.                                 InitialPullChoice );
  183.         switch( rc )
  184.         {
  185.           case ESC:                                                     /*818*/
  186.           case ENTER:
  187.           case PADENTER:
  188.           {
  189.             RemoveMenuCursor( CurrentMenuChoice );
  190.             Event->Type=TYPE_KBD_EVENT; /*Pretend function returned by KBD*/
  191.             return( FuncCode );
  192.           }
  193.  
  194.           case RIGHT:
  195.           {
  196.             RemoveMenuCursor( CurrentMenuChoice );
  197.             if( CurrentMenuChoice < (NUM_PULLDOWNS - 1) )
  198.               CurrentMenuChoice++;
  199.             else
  200.               CurrentMenuChoice = 0;
  201.             DisplayMenuCursor( CurrentMenuChoice );
  202.             DisplayPulldown( CurrentMenuChoice );
  203.             MenuState = MENU_PULLDOWN;
  204.             break;
  205.           }
  206.  
  207.           case LEFT:
  208.           {
  209.             RemoveMenuCursor( CurrentMenuChoice );
  210.             if( CurrentMenuChoice > 0 )
  211.               CurrentMenuChoice--;
  212.             else
  213.               CurrentMenuChoice = NUM_PULLDOWNS - 1;
  214.             DisplayMenuCursor( CurrentMenuChoice );
  215.             DisplayPulldown( CurrentMenuChoice );
  216.             MenuState = MENU_PULLDOWN;
  217.             break;
  218.           }
  219.  
  220.           case RETURN:
  221.           {
  222.             RemoveMenuCursor( CurrentMenuChoice );
  223.             return( FuncCode );
  224.           }
  225.  
  226.           case MOUSECLICK:
  227.           {
  228.             int store;
  229.  
  230.             store = CurrentMenuChoice;
  231.             if( MouseEventInActionBar( &CurrentMenuChoice ) )
  232.             {
  233.               CurrentMenuChoice--;
  234.               if( store != CurrentMenuChoice )
  235.               {
  236.                 RemoveMenuCursor( store );
  237.                 DisplayPulldown( CurrentMenuChoice );
  238.                 DisplayMenuCursor( CurrentMenuChoice );
  239.               }
  240.  
  241.               if( MouseState == STATE_BUTTON_PRESSED ||
  242.                   MouseState == STATE_BUTTON_MOVE )
  243.                 MenuState = MENU_PULLACTION;
  244.               else
  245.               {
  246.                 MenuState = MENU_PULLDOWN;
  247.                 MouseState = STATE_BUTTON_RELEASED;
  248.                 InitialPullChoice = 1;
  249.               }
  250.             }
  251.             else
  252.             {
  253.               RemoveMenuCursor( store );
  254.               return( SETCURSORPOS );
  255.             }
  256.             break;
  257.           }
  258.         }
  259.         break;
  260.       }
  261.  
  262.       case MENU_ACTIONBAR:
  263.       case MENU_PULLACTION:
  264.       {
  265.         rc = GetActionbarChoice( &CurrentMenuChoice, &MenuState, &MouseState,
  266.                                  &InitialPullChoice );
  267.         switch( rc )
  268.         {
  269.           case ENTER:
  270.           case PADENTER:
  271.           {
  272.             MenuState = MENU_PULLDOWN;
  273.             break;
  274.           }
  275.  
  276.           case ESC:
  277.             return( DONOTHING );
  278.  
  279.           case MOUSECLICK:
  280.           case SETCURSORPOS:
  281.             return( SETCURSORPOS );
  282.  
  283.           case CONTINUE:
  284.             break;
  285.         }
  286.         break;
  287.       }
  288.     }                                   /* switch( MenuState );              */
  289.   }                                     /* for( ;; ) loop                    */
  290. }
  291.  
  292. /*****************************************************************************/
  293. /* DisplayMenu()                                                             */
  294. /*                                                                           */
  295. /* Description:                                                              */
  296. /*                                                                           */
  297. /*  Displays the action bar and builds arrays containing the length and      */
  298. /*  column position of the action bar elements.                              */
  299. /*                                                                           */
  300. /* Parameters:                                                               */
  301. /*             None                                                          */
  302. /*                                                                           */
  303. /* Return:                                                                   */
  304. /*             None                                                          */
  305. /*                                                                           */
  306. /*****************************************************************************/
  307. #define SPACING 1
  308.  
  309. void  DisplayMenu()
  310. {
  311.   int   Index, col, n;
  312.   uchar *ip;
  313.  
  314.   ClrScr( MenuRow, MenuRow, vaMenuBar );
  315.  
  316.   for( Index = 0, col = SPACING, ip = MenuNames; *ip; ++Index )
  317.   {
  318.     icol[Index] = (uchar)col;
  319.     ilen[Index] = (uchar)( (n = strlen( ip ) ) + 2 );
  320.     col += n + SPACING + 1;
  321.     ip  += n + 1;
  322.   }
  323.  
  324.   for( Index = 0, ip = MenuNames; Index < NUM_PULLDOWNS; ++Index )
  325.   {
  326.     putrcx( MenuRow, icol[Index] + 1, ip);
  327.     putrcx( MenuRow, icol[Index] + MenuCols[Index], hiatt);
  328.     ip += ilen[Index] - 1;
  329.   }
  330.  
  331.   putrcx( MenuRow, SHRINKUPARROWCOL, uarrow);
  332.   putrcx( MenuRow, SHRINKUPARROWCOL, hiatt);
  333.   putrcx( MenuRow, EXPANDDNARROWCOL, darrow);
  334.   putrcx( MenuRow, EXPANDDNARROWCOL, hiatt);
  335. }
  336.  
  337. /*****************************************************************************/
  338. /*                                                                           */
  339. /* GetEventPositionInMenu()                                                  */
  340. /*                                                                           */
  341. /* Description:                                                              */
  342. /*                                                                           */
  343. /* Checks if the current event has occurred in the action bar,the            */
  344. /* current pulldown, or neither. If the current event is in an               */
  345. /* action bar or pulldown, then an index of the particular selection         */
  346. /* of where the event occurred is returned.                                  */
  347. /*                                                                           */
  348. /* Parameters:                                                               */
  349. /*                                                                           */
  350. /*   CurrPullIndex input  - the index of the pulldown currently selected.    */
  351. /*   Choice        output - if the event is in the pulldown or the action    */
  352. /*                          bar, then this is the index of the selection.    */
  353. /*                                                                           */
  354. /* Return:                                                                   */
  355. /*                                                                           */
  356. /*   POS_ACTIONBAR    Current event is in the action bar.                    */
  357. /*   POS_PULLDOWN     Current event is in a pulldown.                        */
  358. /*   POS_OUTSIDEMENU  Current event is not in pulldown or the action bar.    */
  359. /*                                                                           */
  360. /*****************************************************************************/
  361. int  GetEventPositionInMenu( int CurrPullIndex, int *Choice )
  362. {
  363.   if( MouseEventInActionBar( Choice ) )
  364.     return( POS_ACTIONBAR );
  365.  
  366.   if( MouseEventInPulldown( CurrPullIndex, Choice ) )
  367.     return( POS_PULLDOWN );
  368.  
  369.   return( POS_OUTSIDEMENU );
  370. }
  371.  
  372.  
  373. /*****************************************************************************/
  374. /* MouseEventInActionBar()                                                   */
  375. /*                                                                           */
  376. /* Description:                                                              */
  377. /*                                                                           */
  378. /*   Checks if the current event has occurred in the action bar, and if      */
  379. /*   so sets the choice for the caller.                                      */
  380. /*                                                                           */
  381. /* Parameters:                                                               */
  382. /*                                                                           */
  383. /*   Choice     output - selection if the event is in the action bar.        */
  384. /*                                                                           */
  385. /* Return:                                                                   */
  386. /*                                                                           */
  387. /*   TRUE       Event is in action bar.                                      */
  388. /*   FALSE      Event is not in action bar.                                  */
  389. /*                                                                           */
  390. /*****************************************************************************/
  391. int  MouseEventInActionBar( int *Choice )
  392. {
  393.   int    Index;
  394.   PEVENT CurrentEvent;
  395.  
  396.   /***************************************************************************/
  397.   /* As this function is called outside this module we have to get the       */
  398.   /* current event even though this is available as a static variable (Event)*/
  399.   /* in this module.                                                         */
  400.   /***************************************************************************/
  401.   CurrentEvent = GetCurrentEvent();
  402.  
  403.   if( CurrentEvent->Row == MenuRow )
  404.   {
  405.     for( Index = 0; Index < NUM_PULLDOWNS; Index++ )
  406.     {
  407.       if ( (CurrentEvent->Col >= icol[Index]) &&
  408.            (CurrentEvent->Col <= (icol[Index] + ilen[Index])) )
  409.       {
  410.         *Choice = Index + 1;
  411.         return( TRUE );
  412.       }
  413.     }
  414.   }
  415.   *Choice = 0;
  416.   return( FALSE );
  417. }
  418.  
  419. /*****************************************************************************/
  420. /* MouseEventInPulldown()                                                    */
  421. /*                                                                           */
  422. /* Description:                                                              */
  423. /*                                                                           */
  424. /*   Checks if the current event has occurred in the pulldown, and if        */
  425. /*   so sets the choice for the caller.                                      */
  426. /*                                                                           */
  427. /* Parameters:                                                               */
  428. /*                                                                           */
  429. /*   PulldownIndex input  - Index corresponding to the current pulldown.     */
  430. /*   Choice        output - Index corresponding to the choice in the         */
  431. /*                          pulldown if the event is in the pulldown.        */
  432. /*                                                                           */
  433. /* Return:                                                                   */
  434. /*                                                                           */
  435. /*   TRUE       Event is in pulldown.                                        */
  436. /*   FALSE      Event is not in pulldown.                                    */
  437. /*                                                                           */
  438. /*****************************************************************************/
  439. int MouseEventInPulldown( int PulldownIndex, int *Choice )
  440. {
  441.   PULLDOWN  *PullPtr;
  442.   PEVENT    CurrentEvent;
  443.  
  444.   CurrentEvent = GetCurrentEvent();
  445.   PullPtr = pullarray[ PulldownIndex ];
  446.  
  447.   if( (CurrentEvent->Row > PullPtr->row ) &&
  448.       (CurrentEvent->Row < (PullPtr->row + PullPtr->entries + 1)) )
  449.   {
  450.     if( (CurrentEvent->Col >= PullPtr->col) &&
  451.         (CurrentEvent->Col <= PullPtr->col + PullPtr->width) )
  452.     {
  453.       *Choice = (int)CurrentEvent->Row - PullPtr->row;
  454.       return( TRUE );
  455.     }
  456.   }
  457.   return( FALSE );
  458. }
  459.  
  460. /*****************************************************************************/
  461. /* RemoveMenuCursor()                                                        */
  462. /*                                                                           */
  463. /* Description:                                                              */
  464. /*                                                                           */
  465. /*   Removes the action bar cursor.                                          */
  466. /*                                                                           */
  467. /* Parameters:                                                               */
  468. /*                                                                           */
  469. /*   Index     - current selection in the action bar that the cursor is on.  */
  470. /*                                                                           */
  471. /* Return:                                                                   */
  472. /*                                                                           */
  473. /*   None                                                                    */
  474. /*                                                                           */
  475. /*****************************************************************************/
  476. static uchar optOFF[] = {RepCnt(0),Attrib(vaMenuBar),0};
  477. #define optOFFlen optOFF[1]
  478.  
  479. void  RemoveMenuCursor( int Index )
  480. {
  481.   /***************************************************************************/
  482.   /* - Remove the hilight from the choice.                                   */
  483.   /* - Display the hot key in hi attribute.                                  */
  484.   /***************************************************************************/
  485.   optOFFlen = ilen[Index];
  486.   putrcx( MenuRow, icol[Index], optOFF);
  487.   putrcx( MenuRow, icol[Index] + MenuCols[Index], hiatt);
  488. }
  489.  
  490. /*****************************************************************************/
  491. /* DiaplayMenuCursor()                                                       */
  492. /*                                                                           */
  493. /* Description:                                                              */
  494. /*                                                                           */
  495. /*   Adds the action bar cursor.                                             */
  496. /*                                                                           */
  497. /* Parameters:                                                               */
  498. /*                                                                           */
  499. /*   Index     - selection in the action bar to put the cursor on.           */
  500. /*                                                                           */
  501. /* Return:                                                                   */
  502. /*                                                                           */
  503. /*   None                                                                    */
  504. /*****************************************************************************/
  505. static uchar  optON[] = {RepCnt(0),Attrib(vaMenuCsr),0};
  506. #define optONlen optON[1]
  507.  
  508. void  DisplayMenuCursor( int Index )
  509. {
  510.   optONlen  = ilen[Index];
  511.   putrcx( MenuRow, icol[Index], optON);
  512. }
  513.  
  514. /*****************************************************************************/
  515. /* GetActionbarChoice()                                                      */
  516. /*                                                                           */
  517. /* Description:                                                              */
  518. /*                                                                           */
  519. /*   Gets a user choice in the action bar when the pulldown is not displayed.*/
  520. /*                                                                           */
  521. /* Parameters:                                                               */
  522. /*                                                                           */
  523. /*   ActionbarIndex - position of the action bar cursor.                     */
  524. /*                   (pulldown index into the array)                         */
  525. /*                                                                           */
  526. /* Return:                                                                   */
  527. /*                                                                           */
  528. /*                                                                           */
  529. /*****************************************************************************/
  530. int  GetActionbarChoice( int *CurrentMenuChoice, int *MenuState,
  531.                          int *MouseState, int *Choice )
  532. {
  533.   int PullDisplay = FALSE;
  534.  
  535.   if( *MenuState == MENU_PULLACTION )
  536.     PullDisplay = TRUE;
  537.  
  538.   for( ;; )
  539.   {
  540.     Event = GetEvent( SEM_INDEFINITE_WAIT );
  541.     switch( Event->Type )
  542.     {
  543.       case TYPE_MOUSE_EVENT:
  544.       {
  545.         int EventPosition;
  546.  
  547.         EventPosition = GetEventPositionInMenu( *CurrentMenuChoice,
  548.                                                  Choice );
  549.         switch( Event->Value )
  550.         {
  551.           case EVENT_NO_BUTTONS_DOWN:
  552.           case EVENT_NO_BUTTONS_DOWN_MOVE:
  553.           {
  554.             switch( EventPosition )
  555.             {
  556.               case POS_PULLDOWN:
  557.               case POS_ACTIONBAR:
  558.               {
  559.                 if( *MouseState == STATE_BUTTON_PRESSED ||
  560.                     *MouseState == STATE_BUTTON_MOVE )
  561.                 {
  562.                   if( EventPosition == POS_ACTIONBAR )
  563.                   {
  564. #if 0
  565.                     *CurrentMenuChoice = *Choice - 1;
  566. #endif
  567.                     *Choice = 1;
  568.                   }
  569.                   *MenuState = MENU_PULLDOWN;
  570.                   return( CONTINUE );
  571.                 }
  572.                 break;
  573.               }
  574.  
  575.               case POS_OUTSIDEMENU:
  576.               {
  577.                 if( PullDisplay )
  578.                   RemovePulldown( *CurrentMenuChoice );
  579.                 RemoveMenuCursor( *CurrentMenuChoice );
  580.                 return( SETCURSORPOS );
  581.               }
  582.             }
  583.             break;
  584.           }
  585.  
  586.           case EVENT_BUTTON_1_DOWN:
  587. #if 0
  588.           case EVENT_BUTTON_2_DOWN:
  589. #endif
  590.           {
  591.             *MouseState = STATE_BUTTON_PRESSED;
  592.             switch( EventPosition )
  593.             {
  594.               case POS_ACTIONBAR:
  595.               {
  596.                 if( *Choice != (*CurrentMenuChoice + 1) )
  597.                 {
  598.                   RemoveMenuCursor( *CurrentMenuChoice );
  599.                   if( PullDisplay )
  600.                     RemovePulldown( *CurrentMenuChoice );
  601.                   *CurrentMenuChoice = *Choice - 1;
  602.                   if( PullDisplay )
  603.                     DisplayPulldown( *CurrentMenuChoice );
  604.                   DisplayMenuCursor( *CurrentMenuChoice );
  605.                 }
  606.                 if( !PullDisplay )
  607.                 {
  608.                   DisplayPulldown( *CurrentMenuChoice );
  609.                   PullDisplay = TRUE;
  610.                 }
  611.                 break;
  612.               }
  613.  
  614.               default:
  615.               {
  616.                 if( PullDisplay )
  617.                   RemovePulldown( *CurrentMenuChoice );
  618.                 RemoveMenuCursor( *CurrentMenuChoice );
  619.                 return( MOUSECLICK );
  620.               }
  621.             }
  622.             break;
  623.           }
  624.  
  625.           case EVENT_BUTTON_1_DOWN_MOVE:
  626. #if 0
  627.           case EVENT_BUTTON_2_DOWN_MOVE:
  628. #endif
  629.           {
  630.             *MouseState = STATE_BUTTON_MOVE;
  631.             switch( EventPosition )
  632.             {
  633.               case POS_ACTIONBAR:
  634.               {
  635.                 if( *Choice != (*CurrentMenuChoice + 1) )
  636.                 {
  637.                   if( PullDisplay == TRUE )
  638.                     RemovePulldown( *CurrentMenuChoice );
  639.                   RemoveMenuCursor( *CurrentMenuChoice );
  640.                   *CurrentMenuChoice = *Choice - 1;
  641.                   DisplayPulldown( *CurrentMenuChoice );
  642.                   PullDisplay = TRUE;
  643.                   DisplayMenuCursor( *CurrentMenuChoice );
  644.                 }
  645.                 break;
  646.               }
  647.  
  648.               case POS_PULLDOWN:
  649.               {
  650.                 if( PullDisplay == TRUE )
  651.                 {
  652.                   *MenuState = MENU_PULLDOWN;
  653.                   return( CONTINUE );
  654.                 }
  655.                 else
  656.                 {
  657.                   RemoveMenuCursor( *CurrentMenuChoice );
  658.                   return( MOUSECLICK );
  659.                 }
  660.               }
  661.  
  662.               case POS_OUTSIDEMENU:
  663.               {
  664.                 if( PullDisplay )
  665.                   continue;
  666.                 else
  667.                 {
  668.                   RemoveMenuCursor( *CurrentMenuChoice );
  669.                   return( MOUSECLICK );
  670.                 }
  671.               }
  672.  
  673.               default:
  674.                 break;
  675.             }
  676.             break;
  677.           }
  678.         }
  679.         break;
  680.       }
  681.  
  682.       case TYPE_KBD_EVENT:
  683.       {
  684.         switch( Event->Value )
  685.         {
  686.           case F1:
  687.           {
  688.             UCHAR    *HelpMsg, NoHelpMsg[50];
  689.             ULONG    HelpId;
  690.  
  691.             HelpId = Menuhids[*CurrentMenuChoice];
  692.             if( HelpId )
  693.               HelpMsg = GetHelpMsg( HelpId, NULL,0 );
  694.             else
  695.             {
  696.               strcpy( NoHelpMsg, "\rNo help available currently. Sorry!\r" );
  697.               HelpMsg = NoHelpMsg;
  698.             }
  699.             CuaShowHelpBox( HelpMsg );
  700.             break;
  701.           }
  702.  
  703.           case RIGHT:
  704.           {
  705.             RemoveMenuCursor( *CurrentMenuChoice );
  706.             if( *CurrentMenuChoice < (NUM_PULLDOWNS - 1) )
  707.               (*CurrentMenuChoice)++;
  708.             else
  709.               *CurrentMenuChoice = 0;
  710.             DisplayMenuCursor( *CurrentMenuChoice );
  711.             break;
  712.           }
  713.  
  714.           case LEFT:
  715.           {
  716.             RemoveMenuCursor( *CurrentMenuChoice );
  717.             if( *CurrentMenuChoice > 0 )
  718.               (*CurrentMenuChoice)--;
  719.             else
  720.               *CurrentMenuChoice = NUM_PULLDOWNS - 1;
  721.             DisplayMenuCursor( *CurrentMenuChoice );
  722.             break;
  723.           }
  724.  
  725.           case ENTER:
  726.           case PADENTER:
  727.           {
  728.             DisplayPulldown( *CurrentMenuChoice );
  729.             return( Event->Value );
  730.           }
  731.  
  732.           case ESC:
  733.           {
  734.             RemoveMenuCursor( *CurrentMenuChoice );
  735.             return( Event->Value );
  736.           }
  737.  
  738.           default:
  739.           {
  740.             int ActionBarChoice;
  741.  
  742.             ActionBarChoice = bindex( Menukeys, NUM_PULLDOWNS,
  743.                                      (Event->Value & 0xFF) | 0x20 );
  744.             if( ActionBarChoice < NUM_PULLDOWNS )
  745.             {
  746.               RemoveMenuCursor( *CurrentMenuChoice );
  747.               *CurrentMenuChoice = ActionBarChoice;
  748.               DisplayMenuCursor( *CurrentMenuChoice );
  749.               DisplayPulldown( *CurrentMenuChoice );
  750.               return( ENTER );
  751.             }
  752.             else
  753.               beep();
  754.             break;
  755.           }
  756.         }                               /* switch( Event->Value )            */
  757.       }                                 /* case TYPE_KBD_EVENT               */
  758.     }                                   /* switch( Event->Type )             */
  759.   }                                     /* for( ;; ) loop                    */
  760. }
  761.  
  762. /*****************************************************************************/
  763. /* DisplayPullCursor()                                                       */
  764. /*                                                                           */
  765. /* Description:                                                              */
  766. /*                                                                           */
  767. /*   Displays the pulldown cursor.                                           */
  768. /*                                                                           */
  769. /* Parameters:                                                               */
  770. /*                                                                           */
  771. /*   PullIndex - position of the action bar choice.                          */
  772. /*               (pulldown index into the array)                             */
  773. /*   Index     - position of the pulldown cursor choice.                     */
  774. /*                                                                           */
  775. /* Return:                                                                   */
  776. /*   None                                                                    */
  777. /*                                                                           */
  778. /*****************************************************************************/
  779. void  DisplayPullCursor( int PullIndex, int Index )
  780. {
  781.   PULLDOWN *PullPtr = pullarray[ PullIndex ];
  782.  
  783.   badhilite[1] = (uchar)PullPtr->width - 2;
  784.   hilite[1]    = (uchar)PullPtr->width - 2;
  785.  
  786.   VideoMap[vaBadSel] = (VideoMap[vaMenuCsr] & 0xF0) | FG_black | FG_light;
  787.  
  788.   if( TestBit( PullPtr->BitMask, Index - 1 ) )
  789.     putrcx( PullPtr->row + Index, PullPtr->col + 1, hilite);
  790.   else
  791.     putrcx( PullPtr->row + Index, PullPtr->col + 1, badhilite);
  792. }
  793.  
  794. /*****************************************************************************/
  795. /*                                                                           */
  796. /* RemovePullCursor()                                                        */
  797. /*                                                                           */
  798. /* Description:                                                              */
  799. /*                                                                           */
  800. /*   Removes the pulldown cursor.                                            */
  801. /*                                                                           */
  802. /* Parameters:                                                               */
  803. /*                                                                           */
  804. /*   PullIndex - position of the action bar choice.                          */
  805. /*               (pulldown index into the array)                             */
  806. /*   Index     - position of the pulldown cursor choice.                     */
  807. /*                                                                           */
  808. /* Return:                                                                   */
  809. /*                                                                           */
  810. /*   None                                                                    */
  811. /*                                                                           */
  812. /*****************************************************************************/
  813. void  RemovePullCursor( int PullIndex, int Index )
  814. {
  815.   PULLDOWN *PullPtr = pullarray[ PullIndex ];
  816.  
  817.   badnormal[1] = (uchar)PullPtr->width - 2;
  818.   normal[1]    = (uchar)PullPtr->width - 2;
  819.  
  820.   if( TestBit(PullPtr->BitMask, Index - 1 ) )
  821.   {
  822.     putrcx( PullPtr->row + Index, PullPtr->col + 1, normal);
  823.     putrcx( PullPtr->row + Index, PullPtr->col + 2 +
  824.            *( PullPtr->SelPos + Index - 1 ), hiatt);
  825.   }
  826.   else
  827.     putrcx( PullPtr->row + Index, PullPtr->col + 1, badnormal);
  828.  
  829. }
  830.  
  831. /*****************************************************************************/
  832. /* DisplayPulldown()                                                         */
  833. /*                                                                           */
  834. /* Description:                                                              */
  835. /*                                                                           */
  836. /*     Displays a pulldown window along with selections.                     */
  837. /*                                                                           */
  838. /* Parameters:                                                               */
  839. /*                                                                           */
  840. /*   PullIndex - position of the action bar choice.                          */
  841. /*               (pulldown index into the array)                             */
  842. /*                                                                           */
  843. /* Return:                                                                   */
  844. /*                                                                           */
  845. /*   None                                                                    */
  846. /*                                                                           */
  847. /*****************************************************************************/
  848. void  DisplayPulldown( int PullIndex )
  849. {
  850.   int      i;
  851.   char     *str;
  852.   PULLDOWN *PullPtr;
  853.   CAS_PULLDOWN *Cascade;
  854.  
  855.   PullPtr = pullarray[ PullIndex ];
  856.  
  857.   /***************************************************************************/
  858.   /* Allocate the memory required to save the screen that will be covered by */
  859.   /* Pulldown and save the screen area which will be covered.                */
  860.   /***************************************************************************/
  861.   PullPtr->SaveArea = (uchar *)Talloc( (PullPtr->entries + 3) *
  862.                                        (PullPtr->width + 1) * 2 );
  863.   windowsv( PullPtr->col, PullPtr->row, PullPtr->entries + 3,
  864.             PullPtr->width + 1, PullPtr->SaveArea );
  865.  
  866.   /***************************************************************************/
  867.   /* - set the default video attribute.                                      */
  868.   /* - set up string for attributes of bad entries.                          */
  869.   /* - initialize color attribute for the clear cell.                        */
  870.   /***************************************************************************/
  871.   VideoAtr      = vaMenuBar;
  872.   badnormal[1]  = (uchar)PullPtr->width - 2;
  873.   VideoMap[vaBadAct] = (VideoMap[vaMenuBar] & 0xF0) | FG_black | FG_light;
  874.   ClearField[1] = (uchar)PullPtr->width;
  875.  
  876.   /***************************************************************************/
  877.   /* clear the screen area covered by the pulldown.                          */
  878.   /***************************************************************************/
  879.   for( i = 0; i < PullPtr->entries + 2; i++ )
  880.     putrcx( PullPtr->row + i, PullPtr->col, ClearField);
  881.  
  882.   /***************************************************************************/
  883.   /* Put bar characters on the action bar.                                   */
  884.   /***************************************************************************/
  885.   topline[2] = (char)PullPtr->width - 2;
  886.   putrcx( PullPtr->row, PullPtr->col, topline);
  887.  
  888.   /***************************************************************************/
  889.   /* Put the entries into the pull down box. If the item is disabled then    */
  890.   /* change the attributes of that item. Highlight the Character by which    */
  891.   /* the item can be selected.                                               */
  892.   /***************************************************************************/
  893.   Cascade = &(PullPtr->CasPulldown[0]);
  894.   for( i = 0, str = PullPtr->labels; i < PullPtr->entries ; i++ )
  895.   {
  896.     putrcx( PullPtr->row + i + 1, PullPtr->col, barstr);
  897.     if( str[0] == '-' )
  898.     {
  899.       separator[2] = (char)PullPtr->width - 2;
  900.       putrcx( PullPtr->row + i + 1, PullPtr->col, separator);
  901.     }
  902.     else
  903.     {
  904.       putrcx( PullPtr->row + i + 1, PullPtr->col + 2, str);
  905.       if( Cascade )
  906.         putrcx( PullPtr->row + i + 1, PullPtr->col + PullPtr->width - 8,
  907.                 (uchar *)(PullPtr->AccelKeys + i));
  908.       else
  909.       if( PullPtr->AccelKeys )
  910.         putrcx( PullPtr->row + i + 1, PullPtr->col + PullPtr->width - 7,
  911.                 (uchar *)(PullPtr->AccelKeys + i));
  912.  
  913.       if( TestBit( PullPtr->BitMask, i ) )
  914.         putrcx( PullPtr->row + i + 1, PullPtr->col + 2 + *(PullPtr->SelPos + i),
  915.                 hiatt);
  916.       else
  917.         putrcx( PullPtr->row + i + 1, PullPtr->col + 1, badnormal);
  918.  
  919.       if( Cascade &&  Cascade[i].PulldownIndex )
  920.         putrcx( PullPtr->row + i + 1, PullPtr->col + PullPtr->width - 2,
  921.                 rarrow);
  922.       putrcx( PullPtr->row + i + 1, PullPtr->col + PullPtr->width - 1, barstr);
  923.     }
  924.     str += strlen( str ) + 1;
  925.   }
  926.  
  927.   /***************************************************************************/
  928.   /* Put length into botline string and then display the bottom line.        */
  929.   /***************************************************************************/
  930.   botline[2] = (char)PullPtr->width - 2;
  931.   putrcx( PullPtr->row + PullPtr->entries + 1, PullPtr->col, botline);
  932.  
  933.  
  934.   /***************************************************************************/
  935.   /* Display the shadowing stuff.                                            */
  936.   /***************************************************************************/
  937.   Shadow[1] = (char)PullPtr->width;
  938.   putrcx( PullPtr->row + PullPtr->entries + 2, PullPtr->col + 1, Shadow);
  939.   Shadow[1] = (char)1;
  940.  
  941.   for( i = 1; i < PullPtr->entries + 3; i++ )
  942.     putrcx( PullPtr->row + i, PullPtr->col + PullPtr->width, Shadow);
  943. }
  944.  
  945. /*****************************************************************************/
  946. /* RemovePulldown()                                                          */
  947. /*                                                                           */
  948. /* Description:                                                              */
  949. /*                                                                           */
  950. /*     Removes a pulldown window from the screen.                            */
  951. /*                                                                           */
  952. /* Parameters:                                                               */
  953. /*                                                                           */
  954. /*   PullIndex - position of the action bar choice.                          */
  955. /*               (pulldown index into the array)                             */
  956. /*                                                                           */
  957. /* Return:                                                                   */
  958. /*                                                                           */
  959. /*   None                                                                    */
  960. /*                                                                           */
  961. /*****************************************************************************/
  962. void  RemovePulldown( int PullIndex )
  963. {
  964.   PULLDOWN *PullPtr;
  965.  
  966.   PullPtr = pullarray[ PullIndex ];
  967.   /***************************************************************************/
  968.   /* - set the default video attribute.                                      */
  969.   /* - Hide the mouse.                                                       */
  970.   /***************************************************************************/
  971.   VideoAtr = vaMenuBar;
  972.  
  973.   /***************************************************************************/
  974.   /* Restore the screen area covered by the pulldown                         */
  975.   /* Release the memory allocated for screen save area.                      */
  976.   /***************************************************************************/
  977.   windowrst( PullPtr->col, PullPtr->row, PullPtr->entries + 3,
  978.              PullPtr->width + 1, PullPtr->SaveArea );
  979.  
  980.   Tfree( PullPtr->SaveArea );
  981. }
  982.  
  983. /*****************************************************************************/
  984. /* MouseEventInArrow()                                                       */
  985. /*                                                                           */
  986. /* Description:                                                              */
  987. /*                                                                           */
  988. /*   Checks if the current event has occurred in the arrow indicating the    */
  989. /*   cascaded pulldown for the current pulldown choice.                      */
  990. /*                                                                           */
  991. /* Parameters:                                                               */
  992. /*                                                                           */
  993. /*   Choice     output - selection if the event is in the action bar.        */
  994. /*                                                                           */
  995. /* Return:                                                                   */
  996. /*                                                                           */
  997. /*   TRUE       Event is in pulldown arrow.                                  */
  998. /*   FALSE      Event is not in pulldown arrow.                              */
  999. /*                                                                           */
  1000. /*****************************************************************************/
  1001. int  MouseEventInArrow( PULLDOWN *PullPtr, int CurrentPullChoice )
  1002. {
  1003.   PEVENT CurrentEvent;
  1004.  
  1005.   CurrentEvent = GetCurrentEvent();
  1006.   if( CurrentEvent->Col == (PullPtr->col + PullPtr->width - 2) )
  1007.     return( TRUE );
  1008.   else
  1009.     return( FALSE );
  1010. }
  1011.  
  1012. /*****************************************************************************/
  1013. /* GetPulldownChoice()                                                       */
  1014. /*                                                                           */
  1015. /* Description:                                                              */
  1016. /*                                                                           */
  1017. /*   Gets a user choice after a pulldown is displayed.                       */
  1018. /*                                                                           */
  1019. /* Parameters:                                                               */
  1020. /*                                                                           */
  1021. /*   PullIndex - position of the action bar choice.                          */
  1022. /*               (pulldown index into the array)                             */
  1023. /*                                                                           */
  1024. /* Assumptions:                                                              */
  1025. /*                                                                           */
  1026. /*   This function assumes the pulldown is displayed already, and the caller */
  1027. /* need not remove the pulldown which is done inside this function itself.   */
  1028. /*                                                                           */
  1029. /* Return:                                                                   */
  1030. /*                                                                           */
  1031. /*                                                                           */
  1032. /*****************************************************************************/
  1033. int  GetPulldownChoice( int PullIndex, int *MouseState, int *FuncCode,
  1034.                         int InitialPullChoice )
  1035. {
  1036.   int       CurrentPullChoice, PrevPullChoice, key;
  1037.   PULLDOWN *PullPtr;
  1038.   PEVENT    CurrentEvent;
  1039.  
  1040.   PullPtr = pullarray[ PullIndex ];
  1041.   if( InitialPullChoice )
  1042.     CurrentPullChoice = PrevPullChoice = InitialPullChoice;
  1043.   else
  1044.     CurrentPullChoice = PrevPullChoice = 1;
  1045.  
  1046.   DisplayPullCursor( PullIndex, CurrentPullChoice );
  1047. #if 0
  1048.   *MouseState = STATE_BUTTON_RELEASED;
  1049. #endif
  1050.  
  1051.   for( ;; )
  1052.   {
  1053.     CurrentEvent = GetEvent( SEM_INDEFINITE_WAIT );
  1054.     switch( CurrentEvent->Type )
  1055.     {
  1056.       case TYPE_MOUSE_EVENT:
  1057.       {
  1058.         int EventPosition;
  1059.  
  1060.         if( CurrentPullChoice )
  1061.           PrevPullChoice = CurrentPullChoice;
  1062.         EventPosition = GetEventPositionInMenu( PullIndex, &CurrentPullChoice );
  1063.         switch( CurrentEvent->Value )
  1064.         {
  1065.           case EVENT_NO_BUTTONS_DOWN:
  1066.           case EVENT_NO_BUTTONS_DOWN_MOVE:
  1067.           {
  1068.             switch( EventPosition )
  1069.             {
  1070.               case POS_PULLDOWN:
  1071.               {
  1072.                 if( (*MouseState == STATE_BUTTON_PRESSED ||
  1073.                      *MouseState == STATE_BUTTON_MOVE) &&
  1074.                     (TestBit(PullPtr->BitMask, CurrentPullChoice - 1))
  1075.                   )
  1076.                 {
  1077.                   CAS_PULLDOWN *Cascade;
  1078.  
  1079.                   Cascade = &(PullPtr->CasPulldown[0]);
  1080.                   if( Cascade && Cascade[CurrentPullChoice - 1].PulldownIndex &&
  1081.                       MouseEventInArrow( PullPtr, CurrentPullChoice ) )
  1082.                     key = RIGHT;
  1083.                   else
  1084.                     key = ENTER;
  1085.                 }
  1086.                 else
  1087.                 {
  1088.                   if( *MouseState == STATE_BUTTON_PRESSED ||
  1089.                       *MouseState == STATE_BUTTON_MOVE )
  1090.                     beep();
  1091.                   continue;
  1092.                 }
  1093.                 break;
  1094.               }
  1095.  
  1096.               default:
  1097.               {
  1098.                 if( *MouseState == STATE_BUTTON_PRESSED ||
  1099.                     *MouseState == STATE_BUTTON_MOVE )
  1100.                 {
  1101.                   *FuncCode = SETCURSORPOS;
  1102.                   RemovePulldown( PullIndex );
  1103.                   return( MOUSECLICK );
  1104.                 }
  1105.                 else
  1106.                 {
  1107.                   if( !CurrentPullChoice )
  1108.                     CurrentPullChoice = 1;
  1109.                   continue;
  1110.                 }
  1111.               }
  1112.             }
  1113.             break;
  1114.           }
  1115.  
  1116. #if 0
  1117.           case EVENT_BUTTON_2_DOWN:
  1118.           {
  1119.             if( EventPosition == POS_OUTSIDEMENU )
  1120.             {
  1121.               SetCursorPos();
  1122.               continue;
  1123.             }
  1124.             else
  1125.             {
  1126.               *MouseState = STATE_BUTTON_RELEASED;
  1127.               continue;
  1128.             }
  1129.           }
  1130. #endif
  1131.  
  1132.           case EVENT_BUTTON_1_DOWN:
  1133.           case EVENT_BUTTON_1_DOWN_MOVE:
  1134. #if 0
  1135.           case EVENT_BUTTON_2_DOWN_MOVE:
  1136. #endif
  1137.           {
  1138.             if( CurrentEvent->Value == EVENT_BUTTON_1_DOWN )
  1139.               *MouseState = STATE_BUTTON_PRESSED;
  1140.  
  1141.             switch( EventPosition )
  1142.             {
  1143.               case POS_PULLDOWN:
  1144.               {
  1145.                 if( CurrentEvent->Value != EVENT_BUTTON_1_DOWN )
  1146.                   *MouseState = STATE_BUTTON_MOVE;
  1147.                 if( CurrentPullChoice != PrevPullChoice )
  1148.                 {
  1149.                   if( PrevPullChoice && (!(PullPtr->separators &
  1150.                       (0x0001 << (PrevPullChoice - 1)))) )
  1151.                     RemovePullCursor( PullIndex, PrevPullChoice );
  1152.                   PrevPullChoice = CurrentPullChoice;
  1153.                   if( !(PullPtr->separators &
  1154.                         (0x0001 << (PrevPullChoice - 1))) )
  1155.                     DisplayPullCursor( PullIndex, CurrentPullChoice );
  1156.                 }
  1157.                 continue;
  1158.               }
  1159.  
  1160.               case POS_OUTSIDEMENU:
  1161.               {
  1162.                 if( CurrentEvent->Value == EVENT_BUTTON_1_DOWN ||
  1163.                     ( *MouseState == STATE_BUTTON_RELEASED &&
  1164.                       CurrentEvent->Value != EVENT_BUTTON_2_DOWN_MOVE ) )
  1165.                 {
  1166.                   *FuncCode = SETCURSORPOS;
  1167.                   RemovePulldown( PullIndex );
  1168.                   return( MOUSECLICK );
  1169.                 }
  1170.                 else
  1171.                 {
  1172.                   if( PrevPullChoice )
  1173.                     RemovePullCursor( PullIndex, PrevPullChoice );
  1174.                   PrevPullChoice = CurrentPullChoice;
  1175.                   continue;
  1176.                 }
  1177.               }
  1178.  
  1179.               default:
  1180.               {
  1181.                 RemovePullCursor( PullIndex, PrevPullChoice );
  1182.                 if( CurrentPullChoice != (PullIndex + 1) )
  1183.                   RemovePulldown( PullIndex );
  1184.  
  1185.                 if( CurrentEvent->Value != EVENT_BUTTON_1_DOWN )
  1186.                   *MouseState = STATE_BUTTON_MOVE;
  1187.                 *FuncCode = SETCURSORPOS;
  1188.                 return( MOUSECLICK );
  1189.               }
  1190.             }
  1191.           }
  1192.       /*  break; */
  1193.  
  1194.           default:
  1195.           {
  1196.             *MouseState = STATE_BUTTON_RELEASED;
  1197.             continue;
  1198.           }
  1199.         }
  1200.         break;
  1201.       }
  1202.  
  1203.       case TYPE_KBD_EVENT:
  1204.       {
  1205.         key = CurrentEvent->Value;
  1206.         break;
  1207.       }
  1208.     }
  1209.  
  1210.     switch( key )
  1211.     {
  1212.       case F1:
  1213.       {
  1214.         uchar    *HelpMsg, NoHelpMsg[50];
  1215.         ULONG    HelpId;
  1216.  
  1217.         HelpId  = PullPtr->help[ CurrentPullChoice - 1 ];
  1218.         if( HelpId )
  1219.           HelpMsg = GetHelpMsg( HelpId, NULL,0 );
  1220.         else
  1221.         {
  1222.           strcpy( NoHelpMsg, "\rNo help available currently. Sorry!\r" );
  1223.           HelpMsg = NoHelpMsg;
  1224.         }
  1225.         CuaShowHelpBox( HelpMsg );
  1226.         break;
  1227.       }
  1228.  
  1229.       case UP:
  1230.       {
  1231.         RemovePullCursor( PullIndex, CurrentPullChoice );
  1232.         if( CurrentPullChoice > 1 )
  1233.           CurrentPullChoice--;
  1234.         else
  1235.           CurrentPullChoice = pullarray[ PullIndex ]->entries;
  1236.  
  1237.         if( PullPtr->separators & (0x0001 << (CurrentPullChoice - 1)) )
  1238.           CurrentPullChoice--;
  1239.         DisplayPullCursor( PullIndex, CurrentPullChoice );
  1240.         break;
  1241.       }
  1242.  
  1243.       case DOWN:
  1244.       {
  1245.         RemovePullCursor( PullIndex, CurrentPullChoice );
  1246.         if( CurrentPullChoice < pullarray[ PullIndex ]->entries )
  1247.           CurrentPullChoice++;
  1248.         else
  1249.           CurrentPullChoice = 1;
  1250.         if( PullPtr->separators & (0x0001 << (CurrentPullChoice - 1)) )
  1251.           CurrentPullChoice++;
  1252.         DisplayPullCursor( PullIndex, CurrentPullChoice );
  1253.         break;
  1254.       }
  1255.  
  1256.       case ESC:
  1257.       case LEFT:
  1258.       {
  1259.         *FuncCode = DONOTHING;
  1260.         RemovePulldown( PullIndex );
  1261.         return( CurrentEvent->Value );
  1262.       }
  1263.  
  1264.       default:
  1265.       {
  1266.         uchar    *LocPtr;
  1267.  
  1268.         LocPtr = strchr( PullPtr->hotkeys, toupper(CurrentEvent->Value & 0x00FF) );
  1269.         if( LocPtr && *LocPtr )
  1270.         {
  1271.           key = ENTER;
  1272.           PrevPullChoice = CurrentPullChoice;
  1273.           CurrentPullChoice = (int)( LocPtr - PullPtr->hotkeys + 1 );
  1274.           if( CurrentPullChoice != PrevPullChoice )
  1275.           {
  1276.             RemovePullCursor( PullIndex, PrevPullChoice );
  1277.             DisplayPullCursor( PullIndex, CurrentPullChoice );
  1278.           }
  1279.         }
  1280.         else
  1281.         {
  1282.           beep();
  1283.           break;
  1284.         }
  1285.       }                                 /* Intentional fall-through          */
  1286.  
  1287.       goto caseenter;
  1288. caseenter:
  1289.  
  1290.       case ENTER:
  1291.       case PADENTER:
  1292.       {
  1293.        if( TestBit(pullarray[ PullIndex ]->BitMask, CurrentPullChoice - 1) )
  1294.        {
  1295.         uchar *FuncCodes;
  1296.  
  1297.         RemovePulldown( PullIndex );
  1298.         FuncCodes = pullarray[ PullIndex ]->funccodes;
  1299.         if( FuncCodes )
  1300.           *FuncCode = (int)FuncCodes[ CurrentPullChoice - 1 ];
  1301.         else
  1302.           *FuncCode = CurrentPullChoice - 1;
  1303.  
  1304.         return( key );
  1305.        }
  1306.        else
  1307.         beep();
  1308.       }
  1309.       break;
  1310.  
  1311.       case RIGHT:
  1312.       {
  1313.         CAS_PULLDOWN *Cascade;
  1314.         PULLDOWN     *CasPullPtr;
  1315.         int  rc;
  1316.  
  1317.         Cascade = &(PullPtr->CasPulldown[0]);
  1318.         if( Cascade && Cascade[CurrentPullChoice - 1].PulldownIndex  &&
  1319.             TestBit( pullarray[PullIndex]->BitMask, CurrentPullChoice - 1 )
  1320.           )
  1321.  
  1322.         {
  1323.           CasPullPtr =
  1324.                       pullarray[ Cascade[CurrentPullChoice - 1].PulldownIndex ];
  1325.  
  1326.           CasPullPtr->row = PullPtr->row + CurrentPullChoice;
  1327.           if( (PullPtr->col + PullPtr->width + CasPullPtr->width) > VideoCols )
  1328.             CasPullPtr->col = PullPtr->col - (CasPullPtr->width + 1);
  1329.           else
  1330.             CasPullPtr->col = PullPtr->col + PullPtr->width + 1;
  1331.           DisplayCasPulldown( Cascade[CurrentPullChoice - 1] );
  1332.           rc = GetCasPulldownChoice( &Cascade[CurrentPullChoice - 1],
  1333.                                       FuncCode, MouseState );
  1334.           switch( rc )
  1335.           {
  1336.             case MOUSECLICK:
  1337.             {
  1338.               int Pos;
  1339.  
  1340.               PrevPullChoice = CurrentPullChoice;
  1341.               Pos = GetEventPositionInMenu(PullIndex, &CurrentPullChoice);
  1342.               if( Pos == POS_PULLDOWN )
  1343.               {
  1344.                 if( CurrentPullChoice != PrevPullChoice )
  1345.                 {
  1346.                   RemovePullCursor( PullIndex, PrevPullChoice );
  1347.                   PrevPullChoice = CurrentPullChoice;
  1348.                   DisplayPullCursor( PullIndex, CurrentPullChoice );
  1349.                 }
  1350.  
  1351.                 CurrentEvent = GetCurrentEvent();
  1352.                 if( CurrentEvent->Value == EVENT_NO_BUTTONS_DOWN ||
  1353.                     CurrentEvent->Value == EVENT_NO_BUTTONS_DOWN_MOVE )
  1354.                   *MouseState = STATE_BUTTON_RELEASED;
  1355.                 else
  1356.                 {
  1357.                   *MouseState = STATE_BUTTON_PRESSED;
  1358.                   continue;
  1359.                 }
  1360.               }
  1361.               else
  1362.               {
  1363.                 CurrentEvent = GetCurrentEvent();
  1364.                 if( CurrentEvent->Value == EVENT_NO_BUTTONS_DOWN ||
  1365.                     CurrentEvent->Value == EVENT_NO_BUTTONS_DOWN_MOVE )
  1366.                   *MouseState = STATE_BUTTON_RELEASED;
  1367.                 else
  1368.                 {
  1369.                   RemovePullCursor( PullIndex, PrevPullChoice );
  1370.                   *MouseState = STATE_BUTTON_PRESSED;
  1371.                 }
  1372.  
  1373.                 if( CurrentPullChoice != (PullIndex + 1) )
  1374.                   RemovePulldown( PullIndex );
  1375.                 return( MOUSECLICK );
  1376.               }
  1377.               break;
  1378.             }
  1379.  
  1380.             case PADENTER:
  1381.             case ENTER:
  1382.             {
  1383.               uchar *FuncCodes;
  1384.  
  1385.               RemovePulldown( PullIndex );
  1386.               FuncCodes = pullarray[ PullIndex ]->funccodes;
  1387.               if( FuncCodes )
  1388.                 *FuncCode = (int)FuncCodes[ CurrentPullChoice - 1 ];
  1389.               else
  1390.                 *FuncCode = CurrentPullChoice - 1;
  1391.  
  1392.               return( rc );
  1393.             }
  1394.  
  1395.             case RETURN:
  1396.             {
  1397.               RemovePulldown( PullIndex );
  1398.               return( RETURN );
  1399.             }
  1400.  
  1401.             case ESC:
  1402.             case LEFT:
  1403.             case CONTINUE:
  1404.               continue;
  1405.  
  1406.             default:
  1407.             {
  1408.               RemovePulldown( PullIndex );
  1409.               return( rc );
  1410.             }
  1411.           }
  1412.         }
  1413.         RemovePulldown( PullIndex );
  1414.         *FuncCode = DONOTHING;                                          /*807*/
  1415.         return( key );
  1416.       }
  1417.     }
  1418.   }                                     /* end of for( ;; ) loop.            */
  1419. }
  1420.  
  1421. /*****************************************************************************/
  1422. /* DisplayCasPulldown()                                                      */
  1423. /*                                                                           */
  1424. /* Description:                                                              */
  1425. /*                                                                           */
  1426. /*     Displays a cascaded pulldown with appropriate default selections      */
  1427. /*                                                                           */
  1428. /* Parameters:                                                               */
  1429. /*                                                                           */
  1430. /*   PullIndex - position of the action bar choice.                          */
  1431. /*               (pulldown index into the array)                             */
  1432. /*                                                                           */
  1433. /* Return:                                                                   */
  1434. /*                                                                           */
  1435. /*   None                                                                    */
  1436. /*                                                                           */
  1437. /*****************************************************************************/
  1438. void  DisplayCasPulldown( CAS_PULLDOWN Cascade )
  1439. {
  1440.   int       i;
  1441.   PULLDOWN *PullPtr;
  1442.  
  1443.   DisplayPulldown( Cascade.PulldownIndex );
  1444.   PullPtr = pullarray[ Cascade.PulldownIndex ];
  1445.   for( i = 0; i < PullPtr->entries; i++ )
  1446.   {
  1447.     if( TestBit( Cascade.Flag, i ) )
  1448.       putrcx( PullPtr->row + i + 1, PullPtr->col + 1, bullet);
  1449.   }
  1450. }
  1451.  
  1452. /*****************************************************************************/
  1453. /* GetCasPulldownChoice()                                                    */
  1454. /*                                                                           */
  1455. /* Description:                                                              */
  1456. /*                                                                           */
  1457. /*   Gets a user choice after a cascaded pulldown is displayed.              */
  1458. /*                                                                           */
  1459. /* Parameters:                                                               */
  1460. /*                                                                           */
  1461. /*   PullIndex - position of the action bar choice.                          */
  1462. /*               (pulldown index into the array)                             */
  1463. /*                                                                           */
  1464. /* Assumptions:                                                              */
  1465. /*                                                                           */
  1466. /*   This function assumes the pulldown is displayed already, and the caller */
  1467. /* need not remove the pulldown which is done inside this function itself.   */
  1468. /*                                                                           */
  1469. /* Return:                                                                   */
  1470. /*                                                                           */
  1471. /*                                                                           */
  1472. /*****************************************************************************/
  1473. int  GetCasPulldownChoice( CAS_PULLDOWN *Cascade, int *Choice, int *MouseState )
  1474. {
  1475.   int rc;
  1476.  
  1477.   *MouseState = STATE_BUTTON_RELEASED;
  1478.   rc = GetPulldownChoice( Cascade->PulldownIndex, MouseState, Choice, 1 );
  1479.   switch( rc )
  1480.   {
  1481.     case ENTER:
  1482.     {
  1483.       Cascade->Flag = 0;
  1484.       SetBit( Cascade->Flag, *Choice );
  1485.       return( rc );
  1486.     }
  1487.  
  1488.     case LEFT:
  1489.       return( CONTINUE );
  1490.  
  1491.     default:
  1492.       return( rc );
  1493.   }
  1494. }
  1495.  
  1496. /*****************************************************************************/
  1497. /*  UpdatePullDownsWithAccelKeys()                                           */
  1498. /*                                                                           */
  1499. /* Description:                                                              */
  1500. /*                                                                           */
  1501. /*   Updates the static pull down structures with the accel key names.       */
  1502. /*                                                                           */
  1503. /* Return:                                                                   */
  1504. /*                                                                           */
  1505. /*   None                                                                    */
  1506. /*                                                                           */
  1507. /*****************************************************************************/
  1508. void  UpdatePullDownsWithAccelKeys()
  1509. {
  1510.   int      i, j, k, no;
  1511.   PULLDOWN  *ptr;
  1512.   int       Funccode;
  1513.  
  1514.   /***************************************************************************/
  1515.   /* for all the pulldowns.                                                  */
  1516.   /***************************************************************************/
  1517.   for( no = 0; no < NUM_PULLDOWNS; no++ )
  1518.   {
  1519.     ptr = pullarray[no];
  1520.     /*************************************************************************/
  1521.     /* for all the choices.                                                  */
  1522.     /*************************************************************************/
  1523.     for( j = 0; j < ptr->entries; j++ )
  1524.     {
  1525.       /***********************************************************************/
  1526.       /* - get the funccode.                                                 */
  1527.       /* - Search for the function code in the defk2f map.                   */
  1528.       /* - If found search the key2code map to find the name of the accel    */
  1529.       /*   key and put the name in the pull down struture.                   */
  1530.       /***********************************************************************/
  1531.       Funccode = (int)*(ptr->funccodes+j);
  1532.       for( i = 0 ; i < KEYNUMSOC ; i++ )
  1533.       {
  1534.         if (defk2f[i].fcode == Funccode)
  1535.         {
  1536.           for( k = 0 ; k < USERKEYS ; k++ )
  1537.           {
  1538.             if (defk2f[i].scode == key2code[k].scode )
  1539.             {
  1540.               sprintf( (char *)(ptr->AccelKeys + j), "%+5s", key2code[k].key,
  1541.                        '\0' );
  1542.               break;
  1543.             }
  1544.           }
  1545.           break;
  1546.         }
  1547.       }
  1548.     }
  1549.   }
  1550. }
  1551.  
  1552. /*****************************************************************************/
  1553. /* KeyInActionBarExpressKeys()                                               */
  1554. /*                                                                           */
  1555. /* Description:                                                              */
  1556. /*                                                                           */
  1557. /*   Checks whether the current keyboard event has a key which is among the  */
  1558. /* the express keys for the action bar options.                              */
  1559. /*                                                                           */
  1560. /* Parameters:                                                               */
  1561. /*                                                                           */
  1562. /*   Choice   (output) - The function returns the action bar option's index  */
  1563. /*                       in this int *, if the key is among the express keys.*/
  1564. /*                                                                           */
  1565. /* Return:                                                                   */
  1566. /*                                                                           */
  1567. /*   TRUE              - The key is among the action bar express keys.       */
  1568. /*   FALSE             - The key is not among the action bar express keys.   */
  1569. /*                                                                           */
  1570. /*****************************************************************************/
  1571. uint KeyInActionBarExpressKeys( int *Choice )
  1572. {
  1573.   KEY2CHOICE ExpkeyChoices[NUM_PULLDOWNS] =
  1574.   {
  1575.     { A_F, 1 },
  1576.     { A_R, 2 },
  1577.     { A_B, 3 },
  1578.     { A_S, 4 },
  1579.     { A_D, 5 },
  1580.     { A_V, 6 },
  1581.     { A_E, 7 },
  1582.     { A_M, 8 },
  1583.     { A_H, 9 }
  1584.   };
  1585.   PEVENT CurrentEvent;
  1586.   int    i;
  1587.  
  1588.   CurrentEvent = GetCurrentEvent();
  1589.  
  1590.   for( i = 0; i < NUM_PULLDOWNS; i++ )
  1591.   {
  1592.     if( ExpkeyChoices[i].Key == CurrentEvent->Value )
  1593.     {
  1594.       *Choice = ExpkeyChoices[i].Choice;
  1595.       return( TRUE );
  1596.     }
  1597.   }
  1598.   return( FALSE );
  1599. }
  1600.  
  1601. /*****************************************************************************/
  1602. /* IsSwapFlag()                                                              */
  1603. /*                                                                           */
  1604. /* Description:                                                              */
  1605. /*                                                                           */
  1606. /*   Checks whether the swap flag for the Run pulldown is set for a given    */
  1607. /* pulldown choice. Swap flags are in the cascaded pulldown structures of the*/
  1608. /* pulldown options.                                                         */
  1609. /*                                                                           */
  1610. /* Parameters:                                                               */
  1611. /*                                                                           */
  1612. /*   FuncCode (input)  - Function code of the given pulldown option. Used to */
  1613. /*                       identify the current pulldown option.               */
  1614. /*                                                                           */
  1615. /* Return:                                                                   */
  1616. /*                                                                           */
  1617. /*   SWAPFLAG          - Swap flag is set for the given pulldown option.     */
  1618. /*   NOSWAPFLAG        - Swap flag is not set for the given pulldown option. */
  1619. /*                                                                           */
  1620. /* Restrictions:                                                             */
  1621. /*                                                                           */
  1622. /*   This function is purely for the Run pulldown of the action bar. It may  */
  1623. /* not work for other cascaded pulldowns.                                    */
  1624. /*                                                                           */
  1625. /*****************************************************************************/
  1626. #define  RUNPULLDOWN   1
  1627. #define  SWAPFLAG      1
  1628. #define  NOSWAPFLAG    0
  1629.  
  1630. int  IsSwapFlag( int FuncCode )
  1631. {
  1632.   PULLDOWN  *PullPtr;
  1633.  
  1634.   PullPtr = pullarray[RUNPULLDOWN];     /* only run pulldown is our concern. */
  1635.   switch( FuncCode )
  1636.   {
  1637.     case RUN:
  1638.     case SSTEP:
  1639.     case SSTEPINTOFUNC:
  1640.     case RUNTOCURSOR:
  1641.     {
  1642.       int  i;
  1643.       CAS_PULLDOWN  *Cascade = PullPtr->CasPulldown;
  1644.  
  1645.       for( i = 0; i < PullPtr->entries; i++ )
  1646.       {
  1647.         if( PullPtr->funccodes[i] == FuncCode )
  1648.           if(TestBit( Cascade[i].Flag, 0 ) )
  1649.             return( SWAPFLAG );
  1650.           else
  1651.             return( NOSWAPFLAG );
  1652.       }
  1653.       return( NOSWAPFLAG );
  1654.     }
  1655.  
  1656.     default:
  1657.       return( NOSWAPFLAG );
  1658.   }
  1659. }
  1660.  
  1661. /*****************************************************************************/
  1662. /* GetObjectPullChoice()                                                     */
  1663. /*                                                                           */
  1664. /* Description:                                                              */
  1665. /*                                                                           */
  1666. /*   Displays an object pulldown and gets the user choice from the pulldown. */
  1667. /*                                                                           */
  1668. /* Parameters:                                                               */
  1669. /*                                                                           */
  1670. /*   PullIndex - position of the action bar choice.                          */
  1671. /*               (pulldown index into the array)                             */
  1672. /*                                                                           */
  1673. /* Return:                                                                   */
  1674. /*                                                                           */
  1675. /*****************************************************************************/
  1676. int  GetObjectPullChoice( int PullIndex, int *MouseState )
  1677. {
  1678.   PEVENT    CurrentEvent;
  1679.   PULLDOWN *PullPtr;
  1680.   int       FuncCode;
  1681.  
  1682.   CurrentEvent = GetCurrentEvent();
  1683.   PullPtr = pullarray[PullIndex];
  1684.  
  1685.   if( CurrentEvent->Type == TYPE_MOUSE_EVENT )
  1686.   {
  1687.     if( (CurrentEvent->Row + PullPtr->entries + 3) < VideoRows )
  1688.       PullPtr->row = CurrentEvent->Row + 1;
  1689.     else
  1690.       PullPtr->row = VideoRows - PullPtr->entries - 3;
  1691.  
  1692.     if( (CurrentEvent->Col + PullPtr->width + 3) < VideoCols )
  1693.       PullPtr->col = CurrentEvent->Col + 1;
  1694.     else
  1695.       PullPtr->col = VideoCols - PullPtr->width - 3;
  1696.   }
  1697.  
  1698.   DisplayPulldown( PullIndex );
  1699.   *MouseState = STATE_BUTTON_RELEASED;
  1700.   GetPulldownChoice( PullIndex, MouseState, &FuncCode, 0 );
  1701.   return( FuncCode );
  1702. }
  1703.  
  1704. /*****************************************************************************/
  1705. /* ReSetSelectBit()                                                          */
  1706. /*                                                                           */
  1707. /* Description:                                                              */
  1708. /*                                                                           */
  1709. /*   Sets the select bit for a selection in a pulldown.                      */
  1710. /*                                                                           */
  1711. /* Parameters:                                                               */
  1712. /*                                                                           */
  1713. /*   PullIndex       - which pulldown.                                       */
  1714. /*   PullChoiceIndex - which pulldown entry.                                 */
  1715. /*                                                                           */
  1716. /* Return:                                                                   */
  1717. /*                                                                           */
  1718. /*   None.                                                                   */
  1719. /*                                                                           */
  1720. /*****************************************************************************/
  1721. void ReSetSelectBit( int PullIndex, int PullChoiceIndex )
  1722. {
  1723.  ResetBit(pullarray[PullIndex]->BitMask, PullChoiceIndex);
  1724. }
  1725.  
  1726. /*****************************************************************************/
  1727. /* SetSelectBit()                                                            */
  1728. /*                                                                           */
  1729. /* Description:                                                              */
  1730. /*                                                                           */
  1731. /*   Sets the select bit for a selection in a pulldown.                      */
  1732. /*                                                                           */
  1733. /* Parameters:                                                               */
  1734. /*                                                                           */
  1735. /*   PullIndex       - which pulldown.                                       */
  1736. /*   PullChoiceIndex - which pulldown entry.                                 */
  1737. /*                                                                           */
  1738. /* Return:                                                                   */
  1739. /*                                                                           */
  1740. /*   None.                                                                   */
  1741. /*                                                                           */
  1742. /*****************************************************************************/
  1743. void SetSelectBit( int PullIndex, int PullChoiceIndex )
  1744. {
  1745.  SetBit(pullarray[PullIndex]->BitMask, PullChoiceIndex);
  1746. }
  1747.  
  1748. /*****************************************************************************/
  1749. /* SetMenuMask()                                                             */
  1750. /*                                                                           */
  1751. /* Description:                                                              */
  1752. /*                                                                           */
  1753. /*   Sets the mask bits for the various views in the debugger.               */
  1754. /*                                                                           */
  1755. /* Parameters:                                                               */
  1756. /*                                                                           */
  1757. /*   View   which view the mask bits are to be set for.                      */
  1758. /*                                                                           */
  1759. /* Return:                                                                   */
  1760. /*                                                                           */
  1761. /*   None.                                                                   */
  1762. /*                                                                           */
  1763. /*****************************************************************************/
  1764. void  SetMenuMask( int View )
  1765. {
  1766.  /****************************************************************************/
  1767.  /* enable all of the pulldown choices.                                      */
  1768.  /****************************************************************************/
  1769.  pullarray[PULLDOWN_FILE       ]->BitMask = 0xFFFF;
  1770.  pullarray[PULLDOWN_RUN        ]->BitMask = 0xFFFF;
  1771.  pullarray[PULLDOWN_BREAKPOINT ]->BitMask = 0xFFFF;
  1772.  pullarray[PULLDOWN_SEARCH     ]->BitMask = 0xFFFF;
  1773.  pullarray[PULLDOWN_DATA       ]->BitMask = 0xFFFF;
  1774.  pullarray[PULLDOWN_VIEW       ]->BitMask = 0xFFFF;
  1775.  pullarray[PULLDOWN_SETTINGS   ]->BitMask = 0xFFFF;
  1776.  pullarray[PULLDOWN_MISC       ]->BitMask = 0xFFFF;
  1777.  pullarray[PULLDOWN_HELP       ]->BitMask = 0xFFFF;
  1778.  pullarray[PULLDOWN_RUN_CASCADE]->BitMask = 0xFFFF;
  1779.  pullarray[PULLDOWN_OBJ_SOURCE ]->BitMask = 0xFFFF;
  1780.  pullarray[PULLDOWN_OBJ_FORMAT ]->BitMask = 0xFFFF;
  1781.  pullarray[PULLDOWN_OBJ_DATA   ]->BitMask = 0xFFFF;
  1782.  
  1783.  switch( View )
  1784.  {
  1785.   case SOURCEVIEW:
  1786.   {
  1787.    /************************************************************************/
  1788.    /* disable Data pulldown choices                                        */
  1789.    /************************************************************************/
  1790.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_EDITEXPRESSION);
  1791.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_EDITSTORAGE   );
  1792.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_FORMATVAR     );
  1793.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_REMOVEVAR     );
  1794.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_INSERT        );
  1795.  
  1796.    /************************************************************************/
  1797.    /* disable View pulldown choices                                        */
  1798.    /************************************************************************/
  1799.    ResetBit(pullarray[PULLDOWN_VIEW]->BitMask, PULLDOWN_VIEW_SOURCE );
  1800.   }
  1801.   break;
  1802.  
  1803.   case ASSEMBLYVIEW:
  1804.   {
  1805.    ResetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_FINDFUNCTION);
  1806.    ResetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_DROPFILE);
  1807.  
  1808.    pullarray[PULLDOWN_SEARCH]->BitMask = 0x0000;
  1809.    pullarray[PULLDOWN_DATA  ]->BitMask = 0x0000;
  1810.  
  1811.    ResetBit(pullarray[PULLDOWN_VIEW]->BitMask, PULLDOWN_VIEW_ASSEMBLER);
  1812.   }
  1813.   break;
  1814.  
  1815.   case DATAVIEWSRC:
  1816.   {
  1817.    ResetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_FINDFUNCTION);
  1818.    ResetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_DROPFILE);
  1819.  
  1820.    ResetBit(pullarray[PULLDOWN_RUN]->BitMask, PULLDOWN_RUN_RUNTOCURSOR);
  1821.    ResetBit(pullarray[PULLDOWN_RUN]->BitMask, PULLDOWN_RUN_RUNTOCURSORNOSWAP);
  1822.    ResetBit(pullarray[PULLDOWN_RUN]->BitMask, PULLDOWN_RUN_SETEXECLINE);
  1823.  
  1824.    ResetBit(pullarray[PULLDOWN_BREAKPOINT]->BitMask, PULLDOWN_BREAKPOINT_SETCLRBKP);
  1825.    ResetBit(pullarray[PULLDOWN_BREAKPOINT]->BitMask, PULLDOWN_BREAKPOINT_SETCONDBKP);
  1826.  
  1827.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_SHOWVAR      );
  1828.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_SHOWVARPTSTO );
  1829.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_WATCHVAR     );
  1830.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_WATCHVARPTSTO);
  1831.  
  1832.    ResetBit(pullarray[PULLDOWN_VIEW]->BitMask, PULLDOWN_VIEW_SOURCE);
  1833.    ResetBit(pullarray[PULLDOWN_VIEW]->BitMask, PULLDOWN_VIEW_DATA);
  1834.  
  1835.    ResetBit(pullarray[PULLDOWN_SETTINGS]->BitMask, PULLDOWN_SETTINGS_ASSEMBLYSOURCE);
  1836.    ResetBit(pullarray[PULLDOWN_SETTINGS]->BitMask, PULLDOWN_SETTINGS_MNEMONICS     );
  1837.   }
  1838.   break;
  1839.  
  1840.   case DATAVIEWASM:
  1841.   {
  1842.    ResetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_FINDFUNCTION);
  1843.    ResetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_DROPFILE);
  1844.  
  1845.    ResetBit(pullarray[PULLDOWN_RUN]->BitMask, PULLDOWN_RUN_RUNTOCURSOR);
  1846.    ResetBit(pullarray[PULLDOWN_RUN]->BitMask, PULLDOWN_RUN_RUNTOCURSORNOSWAP);
  1847.    ResetBit(pullarray[PULLDOWN_RUN]->BitMask, PULLDOWN_RUN_SETEXECLINE);
  1848.  
  1849.    ResetBit(pullarray[PULLDOWN_BREAKPOINT]->BitMask, PULLDOWN_BREAKPOINT_SETCLRBKP);
  1850.    ResetBit(pullarray[PULLDOWN_BREAKPOINT]->BitMask, PULLDOWN_BREAKPOINT_SETCONDBKP);
  1851.  
  1852.    pullarray[PULLDOWN_SEARCH]->BitMask = 0x0000;
  1853.  
  1854.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_SHOWVAR      );
  1855.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_SHOWVARPTSTO );
  1856.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_WATCHVAR     );
  1857.    ResetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_WATCHVARPTSTO);
  1858.  
  1859.    ResetBit(pullarray[PULLDOWN_VIEW]->BitMask, PULLDOWN_VIEW_ASSEMBLER);
  1860.    ResetBit(pullarray[PULLDOWN_VIEW]->BitMask, PULLDOWN_VIEW_DATA);
  1861.   }
  1862.   break;
  1863.  
  1864.   case EXPANDDATA:
  1865.   {
  1866.    pullarray[PULLDOWN_FILE       ]->BitMask = 0x0000;
  1867.    pullarray[PULLDOWN_RUN        ]->BitMask = 0x0000;
  1868.    pullarray[PULLDOWN_BREAKPOINT ]->BitMask = 0x0000;
  1869.    pullarray[PULLDOWN_SEARCH     ]->BitMask = 0x0000;
  1870.    pullarray[PULLDOWN_DATA       ]->BitMask = 0x0000;
  1871.    pullarray[PULLDOWN_VIEW       ]->BitMask = 0x0000;
  1872.    pullarray[PULLDOWN_SETTINGS   ]->BitMask = 0x0000;
  1873.    pullarray[PULLDOWN_MISC       ]->BitMask = 0x0000;
  1874.    pullarray[PULLDOWN_HELP       ]->BitMask = 0x0000;
  1875.    pullarray[PULLDOWN_RUN_CASCADE]->BitMask = 0x0000;
  1876.    pullarray[PULLDOWN_OBJ_SOURCE ]->BitMask = 0x0000;
  1877.    pullarray[PULLDOWN_OBJ_FORMAT ]->BitMask = 0x0000;
  1878.    pullarray[PULLDOWN_OBJ_DATA   ]->BitMask = 0x0000;
  1879.  
  1880.    SetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_QUIT);
  1881.    SetBit(pullarray[PULLDOWN_DATA]->BitMask, PULLDOWN_DATA_EXPANDVAR);
  1882.   }
  1883.   break;
  1884.  
  1885.   case BROWSEFILE:
  1886.   {
  1887.    pullarray[PULLDOWN_FILE       ]->BitMask = 0x0000;
  1888.    pullarray[PULLDOWN_RUN        ]->BitMask = 0x0000;
  1889.    pullarray[PULLDOWN_BREAKPOINT ]->BitMask = 0x0000;
  1890.    pullarray[PULLDOWN_SEARCH     ]->BitMask = 0x0000;
  1891.    pullarray[PULLDOWN_DATA       ]->BitMask = 0x0000;
  1892.    pullarray[PULLDOWN_VIEW       ]->BitMask = 0x0000;
  1893.    pullarray[PULLDOWN_SETTINGS   ]->BitMask = 0x0000;
  1894.    pullarray[PULLDOWN_MISC       ]->BitMask = 0x0000;
  1895.    pullarray[PULLDOWN_HELP       ]->BitMask = 0x0000;
  1896.    pullarray[PULLDOWN_RUN_CASCADE]->BitMask = 0x0000;
  1897.    pullarray[PULLDOWN_OBJ_SOURCE ]->BitMask = 0x0000;
  1898.    pullarray[PULLDOWN_OBJ_FORMAT ]->BitMask = 0x0000;
  1899.    pullarray[PULLDOWN_OBJ_DATA   ]->BitMask = 0x0000;
  1900.  
  1901.    SetBit(pullarray[PULLDOWN_FILE]->BitMask, PULLDOWN_FILE_QUIT);
  1902.  
  1903.    pullarray[PULLDOWN_SEARCH]->BitMask = 0xFFFF;
  1904.   }
  1905.   break;
  1906.  
  1907. #if MSH
  1908.   case BROWSEMSHFILE:
  1909.   {
  1910.     SetSelectMask( 5, 1, ON );
  1911.  
  1912.     for( i = 8; i < 12; i++ )
  1913.       SetSelectMask( 4, i, ON );
  1914.     break;
  1915.   }
  1916. #endif
  1917.  
  1918.   default:
  1919.     break;
  1920.  }
  1921. }
  1922.  
  1923. PULLDOWN  *GetPullPointer( int Index )
  1924. {
  1925.   return( pullarray[ Index ] );
  1926. }
  1927.  
  1928. void DisableDropFile( void )
  1929. {
  1930.  ReSetSelectBit( PULLDOWN_FILE, PULLDOWN_FILE_DROPFILE );
  1931. }
  1932.  
  1933. void EnableDropFile( void )
  1934. {
  1935.  SetSelectBit( PULLDOWN_FILE, PULLDOWN_FILE_DROPFILE );
  1936. }
  1937.