📄 atv.c
字号:
{
ATV *info;
info=start;
while( info != NULL )
{
if( info->areaId==areaId ) return info;
else info=info->next;
}
return NULL;
}
/*****************************************************************
* Function Name: searchATV
* Param in: PMSG *ROSmsg,ATVCB *p
* Result code: ATV *
* Description: searching atv by its coordinates and flag
*****************************************************************/
ATV *searchATV( MSG *ROSmsg,ATVCB *p )
{
static ATV *info,*start;
static x,y;
start=p->stack[ p->top ];
info=start;
x = (( POINTS * )&ROSmsg->lparam)->x;
y = (( POINTS * )&ROSmsg->lparam)->y;
while( info != NULL )
{
if( info->flag == AREA_REENABLE )
{
if( x > info->xsrc && \
y > info->ysrc && \
x < info->xdest && \
y < info->ydest )
return info;
else
info=info->next;
}else
info=info->next;
}
return NULL;
}
/*****************************************************************
* Function Name: SysTransMsg
* Param in: PMSG *ROSmsg,ATVCB *p,PMSG *PPSMmsg
* Result code: void
* Description: translating ROSmsg into PPSMmsg
*****************************************************************/
void SysTransMsg( MSG *ROSmsg,ATVCB *p,MSG *PPSMmsg )
{
ATV *info;
SHORT off;
DWORD pGC;
static MSG chinese_msg,key_msg;
WORD x,y,i,j;
static WORD i1 = 12,j1;
pGC=GetCurGC( );
if( ROSmsg == NULL && p == NULL && PPSMmsg == NULL )
return ;
if( ( p->currentAtv == NULL ) && ( p->lastmsgtype == NONE ) )
{
if( ROSmsg->message == SM_PENDOWN )
{
info=searchATV( ROSmsg,p );
if( info != NULL )
{
p->currentAtv=info;
p->lastmsgtype=TOUCH;
if( info->type == ICON_AREA )
{
PPSMmsg->message=IRPT_ICON;
PPSMmsg->wparam=PPSM_ICON_TOUCH;
}
else if( info->type == INPUT_AREA )
{
PPSMmsg->message=IRPT_INPUT_STATUS;
PPSMmsg->wparam=PPSM_INPUT_TOUCH;
}
else if( info->type == PAD_AREA )
{
off=info->extptr1->off;
if( ( info->extptr1->timeroutflag == 0 ) && ( off > 0 ) )
/*judge if it is still a chinese char,and off-2,off-1 is the last dot of the last line*/
{
if( off > 497 )//this condition is executed is very little,modified by DSA 2002/03/21
{
info->extptr1->point[off-2]=0xff;
info->extptr1->point[off-1]=0xff;
SysActiveAreaSuspend(p->currentAtv->extptr1->areaId,AREA_SUSPEND);
ClearPenTrack( p->currentAtv->extptr1 );
/*识字*/
WTRecognize( p->currentAtv->extptr1->point,off,p->currentAtv->extptr1->CandidateResult);
chinese_msg.message=ASIX_CHINESE;//chinese_msg.message=SM_CHINESE;
chinese_msg.wparam=HandWriteRecognizeNum;
chinese_msg.data=p->currentAtv->extptr1->CandidateResult;
//chinese_msg.lparam=CurWindow;
chinese_msg.lparam=p->currentAtv->extptr1->WndId;//modified by dsa 2002.03.19
SysSendMessage( gLcdOwnerTskId,(&chinese_msg) );
p->currentAtv->extptr1->off=0;
}
info->extptr1->point[off-2]=0xff;
info->extptr1->point[off-1]=0x00;
SysStopTimer( info->extptr1->timerId );
}
info->extptr1->point[off]=(BYTE)( ( POINTS * )&ROSmsg->lparam )->x;
info->extptr1->point[off+1]=(BYTE)( ( POINTS * )&ROSmsg->lparam )->y;
//SysDrawDot( pGC,GPC_BLACK,info->extptr1->point[off],info->extptr1->point[off+1],GPC_XOR_STYLE);
SysDrawDot( pGC,GPC_BLUE,info->extptr1->point[off],info->extptr1->point[off+1],GPC_XOR_STYLE);
info->extptr1->off=off+2;
}
else if( info->type == KEY_AREA )
{
x = (( POINTS * )&ROSmsg->lparam)->x;
y = (( POINTS * )&ROSmsg->lparam)->y;
i=i1=(x-info->extptr2->xPos)/info->extptr2->keyWidth;
j=j1=(y-info->extptr2->yPos)/info->extptr2->keyHeight;
InvRec(pGC,info->extptr2->xPos+i*info->extptr2->keyWidth,
info->extptr2->yPos+j*info->extptr2->keyHeight,
info->extptr2->keyWidth,info->extptr2->keyHeight);
}
}
else/*there is not suitable Atv*/
{
PPSMmsg->message=IRPT_NONE;
PPSMmsg->wparam=PPSM_NONE;
p->currentAtv=NULL;
p->lastmsgtype=NONE;
}
}
else if( ROSmsg->message == SM_PENMOVE )
{
info=searchATV( ROSmsg,p );
if( info != NULL )
{
p->currentAtv=info;
p->lastmsgtype=DRAG;
if( info->type == ICON_AREA )
{
PPSMmsg->message=IRPT_ICON;
PPSMmsg->wparam=PPSM_ICON_DRAG;
}
else if( info->type == INPUT_AREA )
{
PPSMmsg->message=IRPT_INPUT_STATUS;
PPSMmsg->wparam=PPSM_INPUT_DRAG;
}
/*here,we don't consider PAD_AREA,we don't think customer draw a line from outside to PAD_AREA*/
}
else/*there is not suitable Atv*/
{
PPSMmsg->message=IRPT_NONE;
PPSMmsg->wparam=PPSM_NONE;
p->currentAtv=NULL;
p->lastmsgtype=NONE;
}
}
else if( ROSmsg->message == SM_PENUP )
{
PPSMmsg->message=IRPT_NONE;
PPSMmsg->wparam=PPSM_NONE;
p->currentAtv=NULL;
p->lastmsgtype=NONE;
}
PPSMmsg->lparam = (DWORD)p->currentAtv;
}
else if( ( p->currentAtv != NULL ) && ( (p->lastmsgtype == TOUCH) || (p->lastmsgtype == DRAG) || (p->lastmsgtype == PEN) ) )
{
if( ROSmsg->message == SM_PENUP )
{
if( p->currentAtv->type == ICON_AREA )
{
PPSMmsg->message=IRPT_ICON;
PPSMmsg->wparam=PPSM_ICON_PEN_UP;
}
else if( p->currentAtv->type == INPUT_AREA )
{
PPSMmsg->message=IRPT_INPUT_STATUS;
PPSMmsg->wparam=PPSM_INPUT_PEN_UP;
}
else if( p->currentAtv->type == PAD_AREA )
{
off=p->currentAtv->extptr1->off;
p->currentAtv->extptr1->timeroutflag=0;
if( off > 497 )/*we consider the most dot in a chinese char is 500*/
{
p->currentAtv->extptr1->point[off]=0xff;
p->currentAtv->extptr1->point[off+1]=0xff;
off=off+2;
SysActiveAreaSuspend(p->currentAtv->extptr1->areaId,AREA_SUSPEND);
ClearPenTrack( p->currentAtv->extptr1 );
/*识字*/
WTRecognize( p->currentAtv->extptr1->point,off,p->currentAtv->extptr1->CandidateResult);
chinese_msg.message=ASIX_CHINESE;//chinese_msg.message=SM_CHINESE;
chinese_msg.wparam=HandWriteRecognizeNum;
chinese_msg.data=p->currentAtv->extptr1->CandidateResult;
//chinese_msg.lparam=CurWindow;
chinese_msg.lparam=p->currentAtv->extptr1->WndId;//modified by dsa 2002.03.19
SysSendMessage( gLcdOwnerTskId,(&chinese_msg) );
p->currentAtv->extptr1->off=0;
}
else
{
SysStartTimer( p->currentAtv->extptr1->timerId );
p->currentAtv->extptr1->off=off+2;
}
}
else if( p->currentAtv->type == KEY_AREA )
{
x = (( POINTS * )&ROSmsg->lparam)->x;
y = (( POINTS * )&ROSmsg->lparam)->y;
i=(x-p->currentAtv->extptr2->xPos)/p->currentAtv->extptr2->keyWidth;
j=(y-p->currentAtv->extptr2->yPos)/p->currentAtv->extptr2->keyHeight;
InvRec(pGC,p->currentAtv->extptr2->xPos+i*p->currentAtv->extptr2->keyWidth,
p->currentAtv->extptr2->yPos+j*p->currentAtv->extptr2->keyHeight,
p->currentAtv->extptr2->keyWidth,p->currentAtv->extptr2->keyHeight);
key_msg.message=ASIX_SOFTKEY;
key_msg.wparam=1;
key_msg.data=(void *)(p->currentAtv->extptr2->keymap[j*p->currentAtv->extptr2->numCol+i]);
key_msg.lparam=p->currentAtv->extptr2->WndId;
SysSendMessage( gLcdOwnerTskId,(&key_msg));
}
PPSMmsg->lparam = (DWORD)p->currentAtv;
p->currentAtv=NULL;
p->lastmsgtype=NONE;
}
else if( ROSmsg->message == SM_PENMOVE )
{
info=searchATV( ROSmsg,p );
{
if( info == NULL )
{
if( p->currentAtv->type == ICON_AREA )
{
PPSMmsg->message=IRPT_ICON;
PPSMmsg->wparam=PPSM_ICON_DRAG_UP;
}
else if( p->currentAtv->type == INPUT_AREA )
{
PPSMmsg->message=IRPT_INPUT_STATUS;
PPSMmsg->wparam=PPSM_INPUT_DRAG_UP;
}
else if( p->currentAtv->type == PAD_AREA )
/*we consider a chinese char is over when we find a line outside the PAD_AREA*/
{
off=p->currentAtv->extptr1->off;
p->currentAtv->extptr1->point[off]=0xff;
p->currentAtv->extptr1->point[off+1]=0xff;
off=off+2;
SysActiveAreaSuspend(p->currentAtv->extptr1->areaId,AREA_SUSPEND);
ClearPenTrack( p->currentAtv->extptr1 );
/*识字*/
WTRecognize( p->currentAtv->extptr1->point,off,p->currentAtv->extptr1->CandidateResult);
chinese_msg.message=ASIX_CHINESE;//chinese_msg.message=SM_CHINESE;
chinese_msg.wparam=HandWriteRecognizeNum;
chinese_msg.data=p->currentAtv->extptr1->CandidateResult;
//chinese_msg.lparam=CurWindow;
chinese_msg.lparam=p->currentAtv->extptr1->WndId;//modified by dsa 2002.03.19
SysSendMessage( gLcdOwnerTskId,(&chinese_msg) );
p->currentAtv->extptr1->off=0;
}
PPSMmsg->lparam = (DWORD)p->currentAtv;
p->currentAtv=NULL;
p->lastmsgtype=NONE;
}
else
{
if( p->currentAtv == info )
{
if( p->currentAtv->type == ICON_AREA )
{
PPSMmsg->message=IRPT_NONE;
PPSMmsg->wparam=PPSM_NONE;
/*这里原本暂时不考虑,但现在不得不考虑,因为在ICON中可能多于3个点*/
}
else if( p->currentAtv->type == INPUT_AREA )
{
p->lastmsgtype=PEN;
PPSMmsg->message=IRPT_PEN;
}
else if( p->currentAtv->type == PAD_AREA )
{
off=p->currentAtv->extptr1->off;
if( off > 497 )
{
p->currentAtv->extptr1->point[off]=0xff;
p->currentAtv->extptr1->point[off+1]=0xff;
off=off+2;
SysActiveAreaSuspend(p->currentAtv->extptr1->areaId,AREA_SUSPEND);
ClearPenTrack( p->currentAtv->extptr1 );
/*识字*/
WTRecognize( p->currentAtv->extptr1->point,off,p->currentAtv->extptr1->CandidateResult);
chinese_msg.message=ASIX_CHINESE;//chinese_msg.message=SM_CHINESE;
chinese_msg.wparam=HandWriteRecognizeNum;
chinese_msg.data=p->currentAtv->extptr1->CandidateResult;
//chinese_msg.lparam=CurWindow;
chinese_msg.lparam=p->currentAtv->extptr1->WndId;//modified by dsa 2002.03.19
SysSendMessage( gLcdOwnerTskId,(&chinese_msg) );
p->currentAtv->extptr1->off=0;
}
else
{
p->currentAtv->extptr1->point[off]=(BYTE)( ( POINTS * )&ROSmsg->lparam )->x;
p->currentAtv->extptr1->point[off+1]=(BYTE)( ( POINTS * )&ROSmsg->lparam )->y;
SysDrawLine( pGC,GPC_BLACK,p->currentAtv->extptr1->point[off-2],p->currentAtv->extptr1->point[off-1],
p->currentAtv->extptr1->point[off],p->currentAtv->extptr1->point[off+1],GPC_SOLID_LINE,GPC_XOR_STYLE);
p->currentAtv->extptr1->off=off+2;
}
}
else if( p->currentAtv->type == KEY_AREA )
{
x = (( POINTS * )&ROSmsg->lparam)->x;
y = (( POINTS * )&ROSmsg->lparam)->y;
i=(x-p->currentAtv->extptr2->xPos)/p->currentAtv->extptr2->keyWidth;
j=(y-p->currentAtv->extptr2->yPos)/p->currentAtv->extptr2->keyHeight;
if( (i != i1)||(j != j1) )
{
if(i1 != 12)
{
InvRec(pGC,p->currentAtv->extptr2->xPos+i1*p->currentAtv->extptr2->keyWidth,
p->currentAtv->extptr2->yPos+j1*p->currentAtv->extptr2->keyHeight,
p->currentAtv->extptr2->keyWidth,p->currentAtv->extptr2->keyHeight);
}
InvRec(pGC,p->currentAtv->extptr2->xPos+i*p->currentAtv->extptr2->keyWidth,
p->currentAtv->extptr2->yPos+j*p->currentAtv->extptr2->keyHeight,
p->currentAtv->extptr2->keyWidth,p->currentAtv->extptr2->keyHeight);
}
i1=i;
j1=j;
}
PPSMmsg->lparam = (DWORD)p->currentAtv;
/* Notice: In IRPT_PEN message, its lparam is used to save coordinate of pen,*/
/* while not its data. So we should change function IrptGetData(). */
/* Notice: 01-11-9 In PPSM message, pen's coordinates are put into data, */
/* not lparam, nor anything else. */
(DWORD)PPSMmsg->data=ROSmsg->lparam;
}
else
{
if( p->currentAtv->type == ICON_AREA )
{
PPSMmsg->message=IRPT_ICON;
PPSMmsg->wparam=PPSM_ICON_DRAG_UP;
}
else if( p->currentAtv->type == INPUT_AREA )
{
PPSMmsg->message=IRPT_INPUT_STATUS;
PPSMmsg->wparam=PPSM_INPUT_DRAG_UP;
}
else if( p->currentAtv->type == PAD_AREA )
/*we consider a chinese char is over when we find a line outside the PAD_AREA*/
{
off=p->currentAtv->extptr1->off;
p->currentAtv->extptr1->point[off]=0xff;
p->currentAtv->extptr1->point[off+1]=0xff;
off=off+2;
SysActiveAreaSuspend(p->currentAtv->extptr1->areaId,AREA_SUSPEND);
ClearPenTrack( p->currentAtv->extptr1 );
/*识字*/
WTRecognize( p->currentAtv->extptr1->point,off,p->currentAtv->extptr1->CandidateResult);
chinese_msg.message=ASIX_CHINESE;//chinese_msg.message=SM_CHINESE;
chinese_msg.wparam=HandWriteRecognizeNum;
chinese_msg.data=p->currentAtv->extptr1->CandidateResult;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -