home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kyūkyoku!! X68000 Emulator
/
X68000Book.dat
/
mac
/
OLS
/
X68000
/
Ko-Window
/
kow142s.lzh
/
wsrv
/
kanji.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-25
|
3KB
|
149 lines
#include <stdio.h>
#include <microstr.h>
#include <sys_doslib.h>
#include <iocslib.h>
#include "clip.h"
#include "window.h"
#include "simple.h"
#include "manager.h"
#include "screen.h"
#include "wopen.h"
/* 1994 11/26 WindowSetHenDsp Æ╟ë┴é╔éµéΘæσò¥Åæé½è╖éª H.Ogasawara (COR.) */
int HenDsp( int, int, char* );
int HenDspEntry();
void HenEchoLock();
void HenEchoUnlock();
static int HposX= 4,
HposY= -26;
#define NKOUHOWIN 1
#define FONT 16
#define FONTX 8
#define IWINCHAR 80
#define IWINSIZE (IWINCHAR*FONTX)
#define MWINCHAR 10
static SimpleClass ModeWP, InputWP;
static int (*DefaultHenDsp)(),
(*WindowHenDspEnt)()= HenDspEntry;
extern int ScreenH,
ScreenV;
void *
WindowSetHenDsp( ent )
void *ent;
{
return (void*)INTVCS( 0xff18, WindowHenDspEnt= ent );
}
void
KanjiInit()
{
if( !DefaultHenDsp ){
HenEchoLock();
DefaultHenDsp= (void*)INTVCS( 0xff18, (void*)WindowHenDspEnt );
}
}
void
KanjiQuit()
{
if( DefaultHenDsp ){
INTVCS( 0xff18, (void*)DefaultHenDsp );
HenEchoUnlock();
DefaultHenDsp= NULL;
}
}
static int
HenkanExec( wp, info )
SimpleClass *wp;
EventInfo *info;
{
static DrawBuf buf[1];
switch( info->option ){
case EventRedraw:
DrawSetClear( buf, 1 );
WindowDraw( wp, buf, 1 );
break;
case EventClose:
WindowClose( wp );
break;
case EventMouseSwitch:
if( info->LeftON || info->RightON ){
MoveOperation( wp, info );
if( wp == &InputWP ){
WindowGetPosition( wp, &HposX, &HposY );
HposX -= HomeX;
HposY -= HomeY+ScreenV;
}
}
}
return TRUE;
}
int
HenDsp( mode, pos, str )
int mode, pos;
char *str;
{
SimpleClass *wp= &InputWP;
DrawBuf buf[1];
int HenkanX= HposX+ HomeX;
int HenkanY= HposY+ ScreenV +HomeY ;
int x= pos*8 +4;
switch( mode ){
case 0: /* mode open */
(*systemfunc[SimpleType].setfunc)(
&ModeWP, HenkanX+IWINSIZE+26, HenkanY,
MWINCHAR*FONTX+8, FONT+4, &RootWindow, -1,HenkanExec);
WindowRedraw( &ModeWP );
return MWINCHAR+2;
case 1: /* mode draw */
case 2: /* mode R draw */
if( pos < 3 )
goto length_ret;
wp= &ModeWP;
x-= 24; /* pos-= 3 */
case 5: /* input draw */
case 6: /* input R draw */
case 9: /* kouho draw */
case 10:/* kouho R draw */
if( *str ){
DrawSetSymbol( buf, x, 2, str,
(mode&1) ? AttrDefault : 1, FONT );
WindowDraw( wp, buf, 1 );
}
length_ret:
return pos+n_strlen( str );
case 3: /* mode close */
WindowClose( &ModeWP );
WindowClose( &InputWP );
break;
case 4: /* input open */
(*systemfunc[SimpleType].setfunc)( &InputWP, HenkanX, HenkanY,
IWINSIZE+8, FONT+4, &RootWindow,-1, HenkanExec );
WindowRedraw( &InputWP );
return IWINCHAR;
case 7: /* input erase */
DrawSetLine( buf, x, 2, IWINSIZE+8, 17, 1, OptionFill );
WindowDraw( &InputWP, buf, 1 );
break;
case 8: /* kouho open */
case 11: /* kouho close */
DrawSetClear( buf, 1 );
WindowDraw( &InputWP, buf, 1 );
return IWINCHAR;
}
return 0;
}
/* :vi:se ts=4 sw=4: */