home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / CUACLSTK.C < prev    next >
Text File  |  1995-04-27  |  9KB  |  204 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   cuaclstk.c                                                              */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*   Cua call stack dialog functions.                                        */
  8. /*                                                                           */
  9. /*...Release 1.01 (04/03/92)                                                 */
  10. /*...                                                                        */
  11. /*... 05/08/92  701   Samuel    Cua Interface.                               */
  12. /*****************************************************************************/
  13. #include "all.h"
  14.  
  15. extern uint    NActFrames;
  16. extern uint    ActFaddrs[];
  17.  
  18. extern uchar   VideoAtr;                /* logical screen attribute          */
  19. extern uchar   ScrollShade1[];          /* scroll bar attributes          701*/
  20. extern uchar   ScrollShade2[];          /* scroll bar attributes          701*/
  21. extern uchar   hilite[];                /* high light field attributes    701*/
  22. extern uchar   normal[];                /* normal field attributes        701*/
  23. extern uchar   ClearField[];            /* clear field attributes         701*/
  24.  
  25. extern CmdParms      cmd;
  26. extern PtraceBuffer  AppPTB;
  27. /*****************************************************************************/
  28. /*                                                                           */
  29. /* ClstkDialogFunction()                                                     */
  30. /*                                                                           */
  31. /* Description:                                                              */
  32. /*                                                                           */
  33. /* This is the function called by ProcessDialog (in pulldown.c) whenever an  */
  34. /* event occurs in the dialog. This fuction handles the events in a way      */
  35. /* specific to this dialog.                                                  */
  36. /*                                                                           */
  37. /* Parameters:                                                               */
  38. /*                                                                           */
  39. /*   shell         input  - Pointer to DIALOGSHELL structure.                */
  40. /*   ptr           input  - Pointer to DIALOGCHOICE structure.               */
  41. /*   nEvent        input  - Pointer to EVENT structure.                      */
  42. /*                                                                           */
  43. /* Return:                                                                   */
  44. /*        = 0     - The caller has to continue processing the dialog.        */
  45. /*       != 0     - The caller can terminate processing the dialog.          */
  46. /*****************************************************************************/
  47. uint  ClstkDialogFunction( DIALOGSHELL *shell, DIALOGCHOICE *ptr,
  48.                            EVENT *nEvent, void *ParamBlock )
  49. {
  50.   int     SelectIndex;
  51.   AFILE   *fp;
  52.   uint    addr;
  53.  
  54.   SelectIndex = shell->CurrentField + ptr->SkipRows;
  55.   switch( nEvent->Value )
  56.   {
  57.     case INIT_DIALOG:
  58.     {
  59.       /*********************************************************************/
  60.       /* This message is sent before displaying elements in display area.  */
  61.       /* It is to initialise the locals in the dialog function.            */
  62.       /*  - Set the length of the field highlite bar in normal and hilite  */
  63.       /*    arrays (used in the call to putrc).                            */
  64.       /*  - Return zero to denote continue dialog processing.              */
  65.       /*********************************************************************/
  66.       hilite[1] = normal[1] = (UCHAR)shell->width - SCROLLBARCOLOFFSET - 2;
  67.  
  68.       shell->CurrentField = ptr->entries;
  69.       return( 0 );
  70.     }
  71.  
  72.     case ENTER:
  73.     {
  74.       AFILE   **fpp;
  75.  
  76.       fpp = ((CALLSTACKPARAM *)ParamBlock)->fpp;
  77.  
  78.       addr = ( (SelectIndex <= NActFrames) ?
  79.                ActFaddrs[ NActFrames - SelectIndex ] : GetExecAddr() );
  80.  
  81.       if( (fp = findfp( addr )) != NULL )
  82.       {
  83.         fp->flags |= AF_ZOOM;
  84.         *fpp = fp;
  85.       }
  86.       return( ENTER );
  87.     }
  88.  
  89.     case key_a:
  90.     case key_n:
  91.     case key_A:
  92.     case key_N:
  93.     {
  94.       int  *ip = ((CALLSTACKPARAM *)ParamBlock)->rc;
  95.  
  96.       *ip = RECIRCULATE;
  97.       return( nEvent->Value );
  98.     }
  99.  
  100.     case A_ENTER:
  101.     case C_ENTER:
  102.     {
  103.       addr = ( (SelectIndex <= NActFrames) ?
  104.                ActFaddrs[ NActFrames - SelectIndex ] : GetExecAddr() );
  105.  
  106.       if( (SelectIndex <= NActFrames)  &&
  107.           (fp = findfp(addr) )
  108.         )
  109.       {
  110.        SetAddrBRK( fp, addr, BRK_ONCE);
  111.        return( A_ENTER );
  112.       }
  113.  
  114.       beep();
  115.       return( 0 );
  116.     }
  117.  
  118.     case F1:
  119.     {
  120.       uchar  *HelpMsg;
  121.  
  122.       HelpMsg = GetHelpMsg( HELP_DLG_CALLSTACK, NULL,0);
  123.       CuaShowHelpBox( HelpMsg );
  124.       return( 0 );
  125.     }
  126.  
  127.     case ESC:
  128.     case F10:
  129.     {
  130.       /*********************************************************************/
  131.       /* This message is sent if the user clicks on the ENTER button or    */
  132.       /* presses the ENTER key.                                            */
  133.       /*  - Return non zero value to denote the end of dialog processing.  */
  134.       /*********************************************************************/
  135.       ptr->SkipRows = 0;
  136.       return( ESC );
  137.     }
  138.  
  139.     default:
  140.       return( 0 );
  141.   }
  142. }
  143.  
  144. /*****************************************************************************/
  145. /* DisplayClstkChoice()                                                   701*/
  146. /*                                                                           */
  147. /* Description:                                                              */
  148. /*                                                                           */
  149. /*   Displays the function names in the dialog window.                       */
  150. /*                                                                           */
  151. /* Parameters:                                                               */
  152. /*                                                                           */
  153. /*   shell   ->  pointer to a dialog shell structure.                        */
  154. /*   ptr     ->  pointer to a dialog choice structure.                       */
  155. /*                                                                           */
  156. /* Return:                                                                   */
  157. /*   none                                                                    */
  158. /*****************************************************************************/
  159. void  DisplayClstkChoice( DIALOGSHELL *shell, DIALOGCHOICE *ptr )
  160. {
  161.   uint   i;
  162.   uint   StartIndex = 1;
  163.   uint   StrLength;
  164.   uchar  *str;
  165.   uint   BorderCols;
  166.  
  167.   BorderCols = 6;
  168.  
  169.   str = ptr->labels;
  170.  
  171.   /***************************************************************************/
  172.   /* Advance the startindex and -> to func names depending on the skip rows  */
  173.   /***************************************************************************/
  174.   for( i = 0; i < ptr->SkipRows; i++ )
  175.   {
  176.     str += (strlen( str ) + 1);
  177.     StartIndex++;
  178.   }
  179.  
  180.   /***************************************************************************/
  181.   /* Display the rows that can fit in the window.                            */
  182.   /***************************************************************************/
  183.   for( i = 0; i < ptr->MaxRows; i++ )
  184.   {
  185.     if( StartIndex <= ptr->entries )
  186.     {
  187.       ClearField[1] = 1;
  188.       putrc( shell->row + i + shell->SkipLines, shell->col + 1, ClearField );
  189.       putrc( shell->row + i + shell->SkipLines, shell->col + 2, str );
  190.       StrLength = strlen( str );
  191.       str += (StrLength + 1);
  192.       StartIndex++;
  193.       ClearField[1] = shell->width - BorderCols - StrLength;
  194.       putrc( shell->row + i + shell->SkipLines, shell->col + 2 + StrLength,
  195.              ClearField );
  196.     }
  197.     else
  198.     {
  199.       ClearField[1] = shell->width-2-SCROLLBARCOLOFFSET;
  200.       putrc( shell->row + i + shell->SkipLines, shell->col + 1, ClearField );
  201.     }
  202.   }
  203. }
  204.