home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / SETEXCEP.C < prev    next >
Text File  |  1995-08-21  |  33KB  |  599 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   setexcep.c                                                              */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*   Allow users to modify exception notifications reporting and optionally  */
  8. /*   save the new settings to user profile, SD386.PRO.                       */
  9. /*                                                                           */
  10. /* History:                                                                  */
  11. /*                                                                           */
  12. /*   10/29/91    308  Srinivas  Created to allow handling of exception       */
  13. /*                              notifications.                               */
  14. /*                                                                           */
  15. /*...Release 1.00 (Pre-release 107 11/13/91)                                 */
  16. /*...                                                                        */
  17. /*... 11/13/91  400   Srinivas  Vertical Register Display.                   */
  18. /*...                                                                        */
  19. /*...Release 1.00 (Pre-release 108 12/05/91)                                 */
  20. /*...                                                                        */
  21. /*... 02/21/92  521   Srinivas  Port to C-Set/2.                             */
  22. /*...                                                                        */
  23. /*...Release 1.01 (04/03/92)                                                 */
  24. /*...                                                                        */
  25. /*... 05/08/92  701   Srinivas  Cua Interface.                               */
  26. /*...                                                                        */
  27. /*...Release 1.05 (05/27/93)                                                 */
  28. /*...                                                                        */
  29. /*... 05/27/93  825   Joe       Reading SD386.PRO after a save causes trap.  */
  30. /*...                                                                        */
  31. /**Includes*******************************************************************/
  32. #define INCL_16                         /* for 16-bit API                    */
  33. #define INCL_SUB                        /* kbd, vio, mouse routines          */
  34. #include "all.h"                        /* SD386 include files               */
  35. #define __MIG_LIB__                                                     /*521*/
  36. #include "io.h"                         /* for routines open, chsize, close  */
  37. #include "fcntl.h"                      /* for O_WRONLY, O_TEXT              */
  38. #include "diaexcep.h"                   /* exceptions dialog data         701*/
  39.  
  40. /**Variables defined**********************************************************/
  41.  
  42. #define MAXFNAMELEN   129               /* 1 byte len+128 char for SD86.PRO  */
  43. #define VATTLENGTH   30                 /* exception name length             */
  44. #define NOTIFICATION 9                  /* notification field length         */
  45. #define MAXWINDOWSIZE HEADERSIZE+MAXEXCEPTIONS*(VATTLENGTH+NOTIFICATION+1)
  46.                                         /* window text buffer size           */
  47. #define NOTIFYMSGWIDTH 10               /* notiyfield len in cua_interface701*/
  48. #define FILENOTFOUND   2                /* file-not-found return code        */
  49.  
  50. /**Externs********************************************************************/
  51. extern char   *ExcepTypes[MAXEXCEPTIONS];/* exception names                  */
  52. extern uint    VideoRows;               /* logical screen rows               */
  53. extern uchar   ExceptionMap[MAXEXCEPTIONS]; /* exception notify/nonotify.    */
  54. extern uchar   VideoAtr;                /* logical screen attribute          */
  55. extern uchar   ScrollShade1[];          /* scroll bar attributes             */
  56. extern uchar   ScrollShade2[];          /* scroll bar attributes             */
  57. extern uchar   hilite[];                /* high light field attributes       */
  58. extern uchar   normal[];                /* normal field attributes           */
  59. extern uchar   ClearField[];            /* clear field attributes            */
  60. extern uchar   InScrollMode;            /* flag to tell we are in scrollmode */
  61. extern VIOCURSORINFO  NormalCursor;     /* make underscore flashing cursor   */
  62. extern CmdParms cmd;
  63. extern char    *ExcepSel[];             /* notification names             825*/
  64.  
  65. uchar LocalExcepMap[MAXEXCEPTIONS];     /* local copy of exceptions map   521*/
  66.                                         /* removed static                 521*/
  67. static uchar DefExcepMap[MAXEXCEPTIONS];/* constant copy of exception map  */
  68. static enum { ExpField,                 /* user currently at exception name  */
  69.               NotifyField               /* user currently at notify  field   */
  70.             } fld;                      /* user current field position       */
  71.  
  72. /*****************************************************************************/
  73. /* SaveExceptions()                                                          */
  74. /*                                                                           */
  75. /* Description:                                                              */
  76. /*                                                                           */
  77. /*   Save the exception names and their exception notifications to           */
  78. /*   profile SD386.PRO.                                                      */
  79. /*                                                                           */
  80. /* Parameters:                                                               */
  81. /*                                                                           */
  82. /*   fn        input - filename to save color values                         */
  83. /*                                                                           */
  84. /* Return:                                                                   */
  85. /*                                                                           */
  86. /*   0         Save sucessful                                                */
  87. /*   1         Save unsucessful                                              */
  88. /*                                                                           */
  89. /*****************************************************************************/
  90.                                         /*                                   */
  91.  uint                                   /*                                   */
  92. SaveExceptions( uchar *fn )             /*                                   */
  93. {                                       /*                                   */
  94.  FILE   *fp;                            /* file ptr to SD386.PRO             */
  95.  char    _word[90];                     /* buffer to scan for Start_Of_Excep */
  96.  uchar   line[VATTLENGTH+NOTIFICATION]; /* to contain excep & excep notifi   */
  97.  uchar  *pText;                         /* pointer to a text string          */
  98.  fpos_t  pos;                           /* file position                     */
  99.  int     fh;                            /* file handle for SD386.PRO         */
  100.  uchar  *pAttByte = LocalExcepMap;      /* video attribute byte index        */
  101.  uint    i;                             /* attribute item index              */
  102.                                         /*                                   */
  103.  if( (fp = fopen(fn, "r+")) == NULL )   /* if can not open SD386.PRO,        */
  104.   return( FILENOTFOUND );               /* return bad code                   */
  105.                                         /*                                   */
  106.  while(fscanf(fp, "%s", _word) != EOF && /* scan while not end of file and   */
  107.        stricmp(_word, "Start_Of_Exceptions")){;}                        /*521*/
  108.                                         /* not found "Start_Of_Exceptions"   */
  109.  if( feof( fp ) )                       /* if "Start_Of_Exceptions" not exist*/
  110.   fprintf( fp, "\n\nStart_Of_Exceptions");/* put it into profile          825*/
  111.  else                                   /* else found "Start_Of_Exceptions"  */
  112.  {                                      /*                                   */
  113.   if( fgetpos( fp, &pos) ||             /* initialize file header position   */
  114.       fsetpos( fp, &pos)                /* for future writes to file         */
  115.     )                                   /*                                   */
  116.    return( 1 );                         /* if bad file access, return error  */
  117.  }                                      /*                                   */
  118.                                         /*                                   */
  119.  fprintf(fp,"\n/*\n         EXCEPTION TYPE           NOTIFICATION");
  120.  fprintf(fp,    "\n      --------------------       --------------\n*/");
  121.                                     /* write text after "Start_Of_Exceptions"*/
  122.  /****************************************************************************/
  123.  /* From the first exception name until last, write the exception name and   */
  124.  /* its notification value out to file SD386.PRO.                            */
  125.  /****************************************************************************/
  126.  line[VATTLENGTH+NOTIFICATION-1] = 00;  /* line terminator                   */
  127.  for( i = 0;                            /* start with first exception name   */
  128.       i <  MAXEXCEPTIONS;               /* until the last exception name     */
  129.       i++, pAttByte++                   /* increment indices                 */
  130.     )                                   /* loop for all exception names      */
  131.  {                                      /*                                   */
  132.   memset(line, ' ', VATTLENGTH+NOTIFICATION-1);/* pad buffer with all blanks     */
  133.                                         /*                                   */
  134.   pText = ExcepTypes[i];                /* get exception name                */
  135.   strncpy(line, pText, strlen(pText));  /* copy excpetion name to buffer     */
  136.                                         /*                                   */
  137.   pText = ExcepSel[*pAttByte];          /* get exception notification        */
  138.   strcpy(line + VATTLENGTH, pText );    /* copy exception notification       */
  139.                                         /* to buffer                         */
  140.                                         /*                                   */
  141.   /***************************************************************************/
  142.   /* - Removed the space at the end of the line.                          825*/
  143.   /***************************************************************************/
  144.   fprintf(fp, "\n      %s",line);       /* write buffer out to file.         */
  145.  }                                      /*                                   */
  146.  /****************************************************************************/
  147.  /* After we are finished writing to the file, we now want to be certain to  */
  148.  /* erase all junk text after our writing to the file.                       */
  149.  /****************************************************************************/
  150.  if( fgetpos( fp, &pos)  ||             /* get last position after our write */
  151.      fclose( fp ) == EOF ||             /* close SD386.PRO                   */
  152.     (fh = open(fn, O_WRONLY | O_TEXT))  /* open SD386.PRO to adjust file size*/
  153.         == EOF           ||             /*                                   */
  154.      chsize(fh, pos.__fpos_elem[0])  || /* truncate junk after last write 521*/
  155.      close( fh )                        /* close SD386.PRO                   */
  156.    )                                    /*                                   */
  157.   return( 1 );                          /* if bad file access, return error  */
  158.  
  159.  
  160.  /****************************************************************************/
  161.  /* Add the last cr-lf-eof sequence to the end of the file.               825*/
  162.  /****************************************************************************/
  163.  fp = fopen(fn, "ab");                                                  /*825*/
  164.  if( (fp == NULL ) ||                                                   /*825*/
  165.      fseek(fp,0L,SEEK_END) )                                            /*825*/
  166.   return(1);                                                            /*825*/
  167.                                                                         /*825*/
  168.  fprintf(fp,"\xD\xA\x1A");                                              /*825*/
  169.  fclose(fp);                                                            /*825*/
  170.  
  171.  return( 0 );                           /* else, return okay                 */
  172. }                                       /* end SaveExceptions                */
  173.  
  174.  
  175. /*****************************************************************************/
  176. /* SetExceptions()                                                        701*/
  177. /*                                                                           */
  178. /* Description:                                                              */
  179. /*                                                                           */
  180. /*     Calls functions to display, process key & mouse events & remove the   */
  181. /*  exception notification map dialog.                                       */
  182. /*                                                                           */
  183. /* Parameters:                                                               */
  184. /*                                                                           */
  185. /* Return:                                                                   */
  186. /*   none                                                                    */
  187. /*****************************************************************************/
  188. void SetExceptions()
  189. {
  190.   /***************************************************************************/
  191.   /*  - Get the Screen write access.                                         */
  192.   /*  - Display the Exceptions Dialog.                                       */
  193.   /*  - Process the Events in the Exceptions Dialog.                         */
  194.   /*  - Remove the Exceptions Dialog.                                        */
  195.   /*  - Restore the Screen write access.                                     */
  196.   /***************************************************************************/
  197.   GetScrAccess();
  198.   DisplayDialog( &Dia_Excep, TRUE );
  199.   ProcessDialog( &Dia_Excep, &Dia_Excep_Choices, TRUE, NULL );
  200.   RemoveDialog( &Dia_Excep );
  201.   SetScrAccess();
  202.   xSetExceptions(ExceptionMap,sizeof(ExceptionMap) );
  203. }
  204.  
  205. /*****************************************************************************/
  206. /* DisplayExcepChoice()                                                   701*/
  207. /*                                                                           */
  208. /* Description:                                                              */
  209. /*                                                                           */
  210. /*   Displays the exception names and the notification type in the dialog    */
  211. /* window.                                                                   */
  212. /*                                                                           */
  213. /* Parameters:                                                               */
  214. /*                                                                           */
  215. /*   shell   ->  pointer to a dialog shell structure.                        */
  216. /*   ptr     ->  pointer to a dialog choice structure.                       */
  217. /*                                                                           */
  218. /* Return:                                                                   */
  219. /*   none                                                                    */
  220. /*****************************************************************************/
  221. void  DisplayExcepChoice (DIALOGSHELL *shell,DIALOGCHOICE *ptr)
  222. {
  223.   uint   i;
  224.   uint   StartIndex;                    /*                                   */
  225.   uchar  *pExcepMap;                    /*                                   */
  226.  
  227.   /***************************************************************************/
  228.   /* Clear the dialog.                                                       */
  229.   /***************************************************************************/
  230.   for( i=0; i<ptr->MaxRows; i++)
  231.   {
  232.    ClearField[1] = VATTLENGTH + NOTIFICATION;
  233.    putrc(shell->row+i+shell->SkipLines,shell->col+1, ClearField);
  234.   }
  235.  
  236.   /***************************************************************************/
  237.   /* init the variables required.                                            */
  238.   /***************************************************************************/
  239.   pExcepMap = LocalExcepMap;
  240.   StartIndex = 0;
  241.  
  242.   /***************************************************************************/
  243.   /* Advance the startindex and notification ptrs depending on the skip rows.*/
  244.   /***************************************************************************/
  245.   for( i = 0; i < ptr->SkipRows; i++ )
  246.   {
  247.     StartIndex++;
  248.     pExcepMap++;
  249.   }
  250.  
  251.   for(i=0;i<ptr->MaxRows;i++)
  252.   {
  253.    putrc(shell->row+i+shell->SkipLines, shell->col+2,ExcepTypes[StartIndex]);
  254.    putrc(shell->row+i+shell->SkipLines, shell->col+2+VATTLENGTH, ExcepSel[*pExcepMap]);
  255.  
  256.    StartIndex++;
  257.    pExcepMap++;
  258.   }
  259. }
  260.  
  261. /*****************************************************************************/
  262. /* SetDefaultExcepMap()                                                   701*/
  263. /*                                                                           */
  264. /* Description:                                                              */
  265. /*                                                                           */
  266. /*   Copy exception notify map to a default map used after wards.            */
  267. /*                                                                           */
  268. /* Parameters:                                                               */
  269. /*   none                                                                    */
  270. /*                                                                           */
  271. /* Return:                                                                   */
  272. /*   none                                                                    */
  273. /*****************************************************************************/
  274. void SetDefaultExcepMap()
  275. {
  276.   memcpy( DefExcepMap, ExceptionMap, MAXEXCEPTIONS );
  277. }
  278.  
  279. /*****************************************************************************/
  280. /*                                                                           */
  281. /* ExcepDialogFunction()                                                     */
  282. /*                                                                           */
  283. /* Description:                                                              */
  284. /*                                                                           */
  285. /* This is the function called by ProcessDialog (in pulldown.c) whenever an  */
  286. /* event occurs in the dialog. This fuction handles the events in a way      */
  287. /* specific to this dialog.                                                  */
  288. /*                                                                           */
  289. /* Parameters:                                                               */
  290. /*                                                                           */
  291. /*   shell         input  - Pointer to DIALOGSHELL structure.                */
  292. /*   ptr           input  - Pointer to DIALOGCHOICE structure.               */
  293. /*   nEvent        input  - Pointer to EVENT structure.                      */
  294. /*                                                                           */
  295. /* Return:                                                                   */
  296. /*        = 0     - The caller has to continue processing the dialog.        */
  297. /*       != 0     - The caller can terminate processing the dialog.          */
  298. /*****************************************************************************/
  299. uint  ExcepDialogFunction( DIALOGSHELL *shell, DIALOGCHOICE *ptr,
  300.                            EVENT *nEvent, void *ParamBlock )
  301. {
  302.   uint   fldcol;
  303.   uchar  *pExcepMap;                    /* Pointer to exception map.         */
  304.   int    SelectIndex;                   /* Index into exception map array.   */
  305.  
  306.   SelectIndex = shell->CurrentField + ptr->SkipRows - 1;
  307.   pExcepMap = LocalExcepMap + SelectIndex;
  308.   for( ;; )
  309.   {
  310.     switch( nEvent->Value )
  311.     {
  312.       case INIT_DIALOG:
  313.       {
  314.         /*********************************************************************/
  315.         /* This message is sent before displaying elements in display area.  */
  316.         /* It is to initialise the locals in the dialog function.            */
  317.         /*  - Make a copy of the global exception map.                       */
  318.         /*  - Set the field cursor and variables to the first field.         */
  319.         /*  - Set the length of the field highlite bar in normal and hilite  */
  320.         /*    arrays (used in the call to putrc).                            */
  321.         /*  - Return zero to denote continue dialog processing.              */
  322.         /*********************************************************************/
  323.         memcpy( LocalExcepMap, ExceptionMap, MAXEXCEPTIONS );
  324.         fldcol = shell->col + 2;
  325.         VioSetCurPos( (short)(shell->row + shell->SkipLines +
  326.                        shell->CurrentField - 1), (short)fldcol, 0 );
  327.         fld = ExpField;
  328.  
  329.         hilite[1] = normal[1] = (UCHAR)VATTLENGTH - 4;
  330.         return( 0 );
  331.       }
  332.  
  333.       case ENTER:
  334.       {
  335.         /*********************************************************************/
  336.         /* This message is sent if the user clicks on the ENTER button or    */
  337.         /* presses the ENTER key.                                            */
  338.         /*  - Copy the local excetion map to the global exception map.       */
  339.         /*  - Return non zero value to denote the end of dialog processing.  */
  340.         /*********************************************************************/
  341.         ptr->SkipRows = 0;
  342.         memcpy( ExceptionMap, LocalExcepMap, MAXEXCEPTIONS );
  343.         return( ENTER );
  344.       }
  345.  
  346.       case F1:
  347.       {
  348.         uchar  *HelpMsg;
  349.  
  350.         HelpMsg = GetHelpMsg( HELP_DLG_EXCEPTIONS, NULL,0 );
  351.         CuaShowHelpBox( HelpMsg );
  352.         return( 0 );
  353.       }
  354.  
  355.       case ESC:
  356.       case F10:
  357.       {
  358.         /*********************************************************************/
  359.         /* This message is sent if the user clicks on the CANCEL button or   */
  360.         /* presses the ESC/F10 keys.                                         */
  361.         /*  - Return non zero value to denote the end of dialog processing.  */
  362.         /*********************************************************************/
  363.         ptr->SkipRows = 0;
  364.         return( nEvent->Value );
  365.       }
  366.  
  367.       case MOUSEPICK:
  368.       {
  369.         /*********************************************************************/
  370.         /* This message is sent if the clicks in the dialog display area.    */
  371.         /*  - Determine on which field the user clicked.                     */
  372.         /*  - Set the cursor on that field.                                  */
  373.         /*  - If the field turns out to be notify field,                     */
  374.         /*     - Set the event value as SPACEBAR (simulate) and stay in the  */
  375.         /*       outer for loop to process SPACEBAR.                         */
  376.         /*    Else                                                           */
  377.         /*     - Return zero to denote continue dialog processing.           */
  378.         /*********************************************************************/
  379.         if( ((uint)nEvent->Col >= (shell->col + 2 + VATTLENGTH)) &&
  380.             ((uint)nEvent->Col < (shell->col+ 2 + VATTLENGTH + NOTIFYMSGWIDTH)))
  381.         {
  382.            fldcol = shell->col+ 2 + VATTLENGTH;
  383.            fld = NotifyField;
  384.         }
  385.         else
  386.         {
  387.            fldcol = shell->col+2;
  388.            fld = ExpField;
  389.         }
  390.  
  391.         VioSetCurPos( (short)(shell->row + shell->SkipLines +
  392.                        shell->CurrentField - 1), (short)fldcol, 0 );
  393.  
  394.         if( fld == NotifyField )
  395.         {
  396.           nEvent->Value = SPACEBAR;
  397.           continue;
  398.         }
  399.  
  400.         return( 0 );
  401.       }
  402.  
  403.       case key_R:
  404.       case key_r:
  405.       {
  406.         /*********************************************************************/
  407.         /* This message is sent if the user clicks in the RESET button or    */
  408.         /* presses 'R' / 'r' keys.                                           */
  409.         /*  - Reset the current exception notification to default.           */
  410.         /*  - Display the new notification value in the field.               */
  411.         /*  - Return zero to denote continue dialog processing.              */
  412.         /*********************************************************************/
  413.         *pExcepMap = DefExcepMap[ SelectIndex ];
  414.         putrc( shell->row + shell->SkipLines + shell->CurrentField - 1,
  415.                shell->col + 2 + VATTLENGTH, ExcepSel[*pExcepMap] );
  416.         return( 0 );
  417.       }
  418.  
  419.       case key_D:
  420.       case key_d:
  421.       {
  422.         /*********************************************************************/
  423.         /* This message is sent if the user clicks in the DEFAULT button or  */
  424.         /* presses 'D' / 'd' keys.                                           */
  425.         /*  - Copy the default exception map to the local exception map.     */
  426.         /*  - Redisplay the display area of the dialog.                      */
  427.         /*  - Return zero to denote continue dialog processing.              */
  428.         /*********************************************************************/
  429.         memcpy( LocalExcepMap, DefExcepMap, MAXEXCEPTIONS );
  430.         DisplayExcepChoice( shell, ptr );
  431.         return( 0 );
  432.       }
  433.  
  434.       case key_S:
  435.       case key_s:
  436.       {
  437.         /*********************************************************************/
  438.         /* This message is sent if the user clicks on the SAVE button or     */
  439.         /* presses the 'S' / 's' keys.                                       */
  440.         /*  - Find the fully qualified file name for the .pro                */
  441.         /*  - Call function to save the exceptions.                          */
  442.         /*  - If not successfull in saving exceptions, display the error box */
  443.         /*    with appropriate error message.                                */
  444.         /*  - If successfull display a timmed message and copy the local     */
  445.         /*    exception map to the default exception map.                    */
  446.         /*  - Return zero to denote continue dialog processing.              */
  447.         /*********************************************************************/
  448.         uchar  StatusMsg[100];
  449.         uchar  fn[MAXFNAMELEN];
  450.         int    rc;
  451.  
  452.         findpro( "SD386.PRO", fn, MAXFNAMELEN );
  453.         rc = SaveExceptions( fn );
  454.         if( rc )
  455.         {
  456.           if( rc == FILENOTFOUND )
  457.             sprintf( StatusMsg, "Unable to find \"SD386.PRO\" in DPATH" );
  458.           else
  459.             sprintf( StatusMsg, "Unable to save to profile \"%s\"", fn );
  460.         }
  461.         else
  462.         {
  463.           sprintf( StatusMsg, "Saving Exceptions to profile \"%s\"", fn );
  464.           memcpy( ExceptionMap, LocalExcepMap, MAXEXCEPTIONS );
  465.         }
  466.         SayMsgBox2( StatusMsg, 1200UL );
  467.         VioSetCurType( &NormalCursor, 0 );
  468.         return( 0 );
  469.       }
  470.  
  471.       case RIGHT:
  472.       case TAB:
  473.       {
  474.         /*********************************************************************/
  475.         /* This message is sent if the user presses TAB or right arrow  key.*/
  476.         /*  - Depending on the current field determine to which field we have*/
  477.         /*    to move to the right or loop around.                           */
  478.         /*  - Set the field variables.                                       */
  479.         /*  - Set the cursor position.                                       */
  480.         /*  - Return zero to denote continue dialog processing.              */
  481.         /*********************************************************************/
  482.         switch( fld )
  483.         {
  484.           case ExpField:
  485.           {
  486.             fldcol = shell->col + 2 + VATTLENGTH;
  487.             fld    = NotifyField;
  488.             break;
  489.           }
  490.  
  491.           case NotifyField:
  492.           {
  493.             fldcol = shell->col + 2;
  494.             fld    = ExpField;
  495.             break;
  496.           }
  497.         }
  498.         VioSetCurPos( (short)(shell->row + shell->SkipLines +
  499.                        shell->CurrentField - 1), (short)fldcol, 0 );
  500.         return( 0 );
  501.       }
  502.  
  503.       case LEFT:
  504.       case S_TAB:
  505.       {
  506.         /*********************************************************************/
  507.         /* This message is sent if the user presses SHIFT TAB or left arrow  */
  508.         /*  key.                                                            */
  509.         /*  - Depending on the current field determine to which field we have*/
  510.         /*    to move to the left or loop around.                            */
  511.         /*  - Set the field variables.                                       */
  512.         /*  - Set the cursor position.                                       */
  513.         /*  - Return zero to denote continue dialog processing.              */
  514.         /*********************************************************************/
  515.         switch( fld )
  516.         {
  517.           case ExpField:
  518.           {
  519.             fldcol = shell->col + 2 + VATTLENGTH;
  520.             fld    = NotifyField;
  521.             break;
  522.           }
  523.  
  524.           case NotifyField:
  525.           {
  526.             fldcol = shell->col + 2;
  527.             fld    = ExpField;
  528.             break;
  529.           }
  530.         }
  531.         VioSetCurPos( (short)(shell->row + shell->SkipLines +
  532.                        shell->CurrentField - 1), (short)fldcol, 0 );
  533.         return( 0 );
  534.       }
  535.  
  536.       case SPACEBAR:
  537.       {
  538.         /*********************************************************************/
  539.         /* This message is sent if the user presses the SPACEBAR.            */
  540.         /*  - Toggle the notification value of the current field.            */
  541.         /*  - Display the new notification value in the field.               */
  542.         /*  - Return zero to denote continue dialog processing.              */
  543.         /*********************************************************************/
  544.         pExcepMap = LocalExcepMap + SelectIndex;
  545.         *pExcepMap = (uchar)(*pExcepMap + 1);
  546.         if( *pExcepMap > 1 )
  547.           *pExcepMap  = 0;
  548.  
  549.         ClearField[1] = NOTIFICATION;
  550.         putrc( shell->row + shell->SkipLines + shell->CurrentField - 1,
  551.                shell->col + 2 + VATTLENGTH, ClearField );
  552.         putrc( shell->row + shell->SkipLines + shell->CurrentField - 1,
  553.                shell->col + 2 + VATTLENGTH, ExcepSel[*pExcepMap] );
  554.         return( 0 );
  555.       }
  556.  
  557.       case UP:
  558.       case DOWN:
  559.       case SCROLLUP:
  560.       case SCROLLDOWN:
  561.       case SCROLLBAR:
  562.       {
  563.         /*********************************************************************/
  564.         /* These messages are sent if the user presses up  or down  arrow  */
  565.         /* keys or the user clicks on the  or  in the scrollbar.           */
  566.         /*  - Set the field variables.                                       */
  567.         /*  - Set the cursor position.                                       */
  568.         /*  - Return zero to denote continue dialog processing.              */
  569.         /*********************************************************************/
  570.         switch( fld )
  571.         {
  572.           case ExpField:
  573.           {
  574.             fldcol = shell->col + 2;
  575.             break;
  576.           }
  577.  
  578.           case NotifyField:
  579.           {
  580.             fldcol = shell->col + 2 + VATTLENGTH;
  581.             break;
  582.           }
  583.         }
  584.  
  585.         VioSetCurPos( (short)(shell->row + shell->SkipLines +
  586.                        shell->CurrentField - 1), (short)fldcol, 0 );
  587.         return( 0 );
  588.       }
  589.  
  590.       default:
  591.         /*********************************************************************/
  592.         /* Any other message.                                                */
  593.         /* - Return zero to denote continue dialog processing.               */
  594.         /*********************************************************************/
  595.         return( 0 );
  596.     }
  597.   }
  598. }
  599.