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 >
Wrap
C/C++ Source or Header
|
1994-11-29
|
2KB
|
120 lines
#include <stdio.h>
#include <iocslib.h>
#include "wlib.h"
#include "parts.h"
#define SELECTOR_Y 38
static int errorexec( WindowID, EventInfo* );
static int bufs;
static ClipClass clip[5];
static DrawBuf buf[10];
static char *SelectChar[]={" èmöF ", " ÆåÄ~ ", "ì─Ä└ìs",NULL," û│Äï "};
int ErrorMessage( msg, sel )
char *msg ;
int sel ;
{
DrawBuf *bufp ;
EventInfo Info ;
WindowID wp ;
int i, x = 384 ;
int hx, hy ;
bufp = buf ;
DrawSetClear( bufp++, 1 );
DrawSetSymbol( bufp++, 10, 10, msg, AttrDefault, 16 );
if ( sel == 0 )
{
x -= 8 * 6 + 10 ;
DrawSetSymbol( bufp++, x, SELECTOR_Y, SelectChar[0], AttrDefault, 16 );
DrawSetLine( bufp++, x-2, SELECTOR_Y-4, x+8*6+1, SELECTOR_Y+16+3,
ShadowUp, OptionShadow );
ClipSet( clip, x-2, SELECTOR_Y-4, 8*6+2, 20 );
}
else
{
ClipSet( clip, 0, 0, 0, 0 );
for( i = 4 ; i >= 1 ; --i )
{
if ( i == 3 )
continue ;
if ( sel & i )
{
x -= 8 * 6 + 10 ;
DrawSetSymbol( bufp++, x, SELECTOR_Y, SelectChar[i], AttrDefault, 16 );
DrawSetLine( bufp++, x-2, SELECTOR_Y-4, x+8*6+1, SELECTOR_Y+16+3,
ShadowUp, OptionShadow );
ClipSet( clip+i, x-2, SELECTOR_Y-4, 8*6+2, 20 );
}
else
ClipSet( clip+i, 0, 0, 0, 0 );
}
}
bufs = bufp - buf ;
WindowGetRootScroll( &hx, &hy );
wp = WindowSimpleOpen( hx+190, hy+223, 384, 64, NULL, errorexec );
WindowRedraw( wp );
MS_CURON();
Info.LeftStat = FALSE ;
for(;;)
{
WindowGetEventInfo( &Info );
switch( toupper( Info.KeyCode ) )
{
case 13 :
if ( sel == 0 )
{
WindowClose( wp );
return( 0 );
}
break ;
case 'A' :
if ( sel == 0 || ( sel & 1 ) )
{
WindowClose( wp );
return( sel & 1 );
}
break ;
case 'R' :
if ( sel & 2 )
{
WindowClose( wp );
return( 2 );
}
break ;
case 'I' :
if ( sel & 4 )
{
WindowClose( wp );
return( 4 );
}
break ;
}
if ( Info.LeftOFF && WindowGetChild( WindowRootID, &Info ) == wp )
{
for( i = 0 ; i <= 4 ; ++i )
{
if ( ClipInner( clip+i, Info.x, Info.y ) )
{
WindowClose( wp );
return( i );
}
}
}
}
}
static int errorexec( wp, info )
WindowID wp ;
EventInfo *info ;
{
if( info->option == EventRedraw )
WindowDraw( wp, buf, bufs );
return( TRUE );
}