home *** CD-ROM | disk | FTP | other *** search
/ Kyūkyoku!! X68000 Emulator / X68000Book.dat / mac / OLS / X68000 / Ko-Window / kow142s.lzh / parts / error.c < prev    next >
C/C++ Source or Header  |  1994-11-29  |  2KB  |  120 lines

  1. #include    <stdio.h>
  2. #include    <iocslib.h>
  3.  
  4. #include    "wlib.h"
  5. #include    "parts.h"
  6.  
  7. #define    SELECTOR_Y    38
  8.  
  9. static    int        errorexec( WindowID, EventInfo* );
  10.  
  11. static    int            bufs;
  12. static    ClipClass    clip[5];
  13. static    DrawBuf        buf[10];
  14. static    char        *SelectChar[]={" èmöF ", " ÆåÄ~ ", "ì─Ä└ìs",NULL," û│Äï "};
  15.  
  16. int        ErrorMessage( msg, sel )
  17. char    *msg ;
  18. int        sel ;
  19. {
  20.     DrawBuf        *bufp ;
  21.     EventInfo    Info ;
  22.     WindowID    wp ;
  23.     int            i, x = 384 ;
  24.     int            hx, hy ;
  25.  
  26.     bufp = buf ;
  27.     DrawSetClear( bufp++, 1 );
  28.     DrawSetSymbol( bufp++, 10, 10, msg, AttrDefault, 16 );
  29.  
  30.     if ( sel == 0 )
  31.     {
  32.         x -= 8 * 6 + 10 ;
  33.         DrawSetSymbol( bufp++, x, SELECTOR_Y, SelectChar[0], AttrDefault, 16 );
  34.         DrawSetLine( bufp++, x-2, SELECTOR_Y-4, x+8*6+1, SELECTOR_Y+16+3,
  35.                         ShadowUp, OptionShadow );
  36.         ClipSet( clip, x-2, SELECTOR_Y-4, 8*6+2, 20 );
  37.     }
  38.     else
  39.     {
  40.         ClipSet( clip, 0, 0, 0, 0 );
  41.         for( i = 4 ; i >= 1 ; --i )
  42.         {
  43.             if ( i == 3 )
  44.                 continue ;
  45.             if ( sel & i )
  46.             {
  47.                 x -= 8 * 6 + 10 ;
  48.                 DrawSetSymbol( bufp++, x, SELECTOR_Y, SelectChar[i], AttrDefault, 16 );
  49.                 DrawSetLine( bufp++, x-2, SELECTOR_Y-4, x+8*6+1, SELECTOR_Y+16+3,
  50.                                 ShadowUp, OptionShadow );
  51.                 ClipSet( clip+i, x-2, SELECTOR_Y-4, 8*6+2, 20 );
  52.             }
  53.             else
  54.                 ClipSet( clip+i, 0, 0, 0, 0 );
  55.         }
  56.     }
  57.  
  58.     bufs = bufp - buf ;
  59.     WindowGetRootScroll( &hx, &hy );
  60.     wp = WindowSimpleOpen( hx+190, hy+223, 384, 64, NULL, errorexec );
  61.     WindowRedraw( wp );
  62.     MS_CURON();
  63.     Info.LeftStat = FALSE ;
  64.     for(;;)
  65.     {
  66.         WindowGetEventInfo( &Info );
  67.             switch( toupper( Info.KeyCode ) )
  68.             {
  69.                 case 13 :
  70.                     if ( sel == 0 )
  71.                     {
  72.                         WindowClose( wp );
  73.                         return( 0 );
  74.                     }
  75.                     break ;
  76.                 case 'A' :
  77.                     if ( sel == 0 || ( sel & 1 ) )
  78.                     {
  79.                         WindowClose( wp );
  80.                         return( sel & 1 );
  81.                     }
  82.                     break ;
  83.                 case 'R' :
  84.                     if ( sel & 2 )
  85.                     {
  86.                         WindowClose( wp );
  87.                         return( 2 );
  88.                     }
  89.                     break ;
  90.                 case 'I' :
  91.                     if ( sel & 4 )
  92.                     {
  93.                         WindowClose( wp );
  94.                         return( 4 );
  95.                     }
  96.                     break ;
  97.             }
  98.         if ( Info.LeftOFF && WindowGetChild( WindowRootID, &Info ) == wp )
  99.         {
  100.             for( i = 0 ; i <= 4 ; ++i )
  101.             {
  102.                 if ( ClipInner( clip+i, Info.x, Info.y ) )
  103.                 {
  104.                     WindowClose( wp );
  105.                     return( i );
  106.                 }
  107.             }
  108.         }
  109.     }
  110. }
  111.  
  112. static    int        errorexec( wp, info )
  113. WindowID    wp ;
  114. EventInfo    *info ;
  115. {
  116.     if( info->option == EventRedraw )
  117.             WindowDraw( wp, buf, bufs );
  118.     return( TRUE );
  119. }
  120.