📄 asix_wn.c
字号:
}
STATUS wn_destroy(void *ctrl_str)
{
struct wn_ctrl *ctrl_ptr;
ASIX_WINDOW *wndptr;
U32 pGC;
pGC = GetGC( );
ctrl_ptr = (struct wn_ctrl *)ctrl_str;
if ( ctrl_ptr == NULL ) return ASIX_ERROR;//check the ping.By zl 2002.3.18
PenIrptDisable();
if (ctrl_ptr->clientid != 0) ActiveAreaDisable(ctrl_ptr->clientid);
if (ctrl_ptr->titleid != 0 ) ActiveAreaDisable(ctrl_ptr->titleid);
PenIrptEnable();
if (ctrl_ptr->saved_screen != NULL ) {
wndptr = (ASIX_WINDOW *)ctrl_ptr->wndid;
PutRec( pGC, ctrl_ptr->saved_screen, wndptr->x, wndptr->y,
wndptr->width, wndptr->hight, GPC_REPLACE_STYLE, 0);
// longn_qi 2002/01/25 for monitor memory leak
asix_wn_memdbgprintf( "asix_wn free mem of screen buffer" );
Lfree(ctrl_ptr->saved_screen);
}
// longn_qi 2002/01/25 for monitor memory leak
asix_wn_memdbgprintf( "asix_wn free mem of itself" );
Lfree(ctrl_str);
return ASIX_OK;
}
STATUS wn_msgproc( U32 win_id, U16 asix_msg, U32 lparam, void *data, U16 wparam, void *reserved)
{
register struct wn_ctrl *ctrlstr;
register ASIX_WINDOW *wndptr;
static MSG wn_msg;
ID id;
//STATUS rv;
wndptr = (ASIX_WINDOW *)win_id;
if( wndptr == NULL )
return ASIX_ERROR;
if( wndptr->wndclass == NULL || wndptr->wndclass->wndclass_id != WNDCLASS_WIN )
return ASIX_ERROR;
ctrlstr = (struct wn_ctrl *)wndptr->ctrl_str;
memset( (void *)&wn_msg, 0x0, sizeof(MSG) );
wn_msg.messageType = ASIX_MESSAGE;
switch( asix_msg )
{
case WM_COMMAND:
if ( lparam == ctrlstr->close_wndid && wparam == MS_ICON_PEN_UP ){
wn_msg.message = WM_QUIT;
wn_msg.data = NULL;
wn_msg.wparam = 0;
AdvSendMessage(GetCurTask()->id, (P_MESSAGE)&wn_msg, NO_SWAP_TASK);
} else if ( lparam == ctrlstr->sys_wndid ){
id = (SYSTCB *)(SysMenu_Taskptr[wparam]->id) - (SYSTCB *)&gSysTcbTbl[0];
id++;
wn_msg.message = SM_SWITCH;
wn_msg.wparam = SWAP_TO_FOREGROUND;
wn_msg.lparam = id;
AdvSendMessage((U32)&gSysTcbTbl[SYSTASK_ID-1], (P_MESSAGE)&wn_msg, SWAP_TASK_LATER);
} else if (lparam == ctrlstr->user_wndid ){
;
}
break;
case WM_TIMER:
break;
case WM_KEYDOWN:
case WM_KEYUP:
switch( wparam )
{
case ASIX_KEY_CANCEL: // press the button
if( lparam == ctrlstr->wndid && ( wndptr->style & WS_CLOSEBOX ) )
{
wn_msg.messageType = ASIX_MESSAGE;
wn_msg.lparam = ctrlstr->close_wndid;
wn_msg.wparam = MS_ICON_PEN_UP;
wn_msg.data = (void *)ctrlstr;
wn_msg.message = WM_COMMAND;
AdvSendMessage(GetCurTask()->id, (P_MESSAGE)&wn_msg, NO_SWAP_TASK );
}
break;
}
break;
case WM_CLIENT:
SetFocus( ctrlstr->wndid );
break;
default:
return ASIX_ERROR;
}
return ASIX_OK;
}
STATUS wn_msgtrans(void *ctrl_str, U16 msg_type, U32 areaId, P_U16 data, U32 size, PMSG trans_msg)
{
register struct wn_ctrl *ctrlstr;
if ( msg_type != ASIX_ICON && msg_type != ASIX_KEY )
return ASIX_NO_MSG;
ctrlstr = (struct wn_ctrl *)ctrl_str;
if (ctrlstr==NULL || trans_msg==NULL)
return ASIX_ERROR;
switch( msg_type )
{
case ASIX_ICON:
if (areaId != ctrlstr->clientid && areaId != ctrlstr->titleid) return ASIX_NO_MSG;
//When the User touches the client area of the window , it will send WM_CLIENT msg
//and when the user touched the tille area, it will send WM_TITLE msg
// LM 01/05/28
// LM 01/12/20 move
memset( (void *)trans_msg, 0x0, sizeof (MSG) );
trans_msg->messageType = ASIX_MESSAGE; //the type of all the ASIX win messages are ASIX_MESSAGE
trans_msg->lparam = ctrlstr->wndid;
trans_msg->data = (void *)ctrlstr;
trans_msg->wparam = (U16)WNDCLASS_WIN;
// if ( *data == PPSM_ICON_PEN_UP && areaId == ctrlstr->clientid )
// trans_msg->message = WM_CLIENT;
// else if ( *data == PPSM_ICON_PEN_UP && areaId == ctrlstr->titleid)
// trans_msg->message = WM_TITLE;
if ( size == PPSM_ICON_PEN_UP && areaId == ctrlstr->clientid )
trans_msg->message = WM_CLIENT;
else if ( size == PPSM_ICON_PEN_UP && areaId == ctrlstr->titleid)
trans_msg->message = WM_TITLE;
else
return ASIX_NO_MSG;
break;
// case ASIX_KEY:
// if( ctrlstr->wndid != areaId )
// return ASIX_NO_MSG;
// trans_msg->messageType = ASIX_MESSAGE;
// trans_msg->message = WM_KEYUP;
// trans_msg->lparam = ctrlstr->wndid;
// trans_msg->wparam = size + ASIX_CONTROL_KEY_CODE_BEGIN;
// trans_msg->data = (void *)ctrlstr;
// break;
default:
return ASIX_NO_MSG;
break;
}
return ASIX_OK;
}
STATUS wn_caption(void *ctrl_str, char *caption, void *exdata)
{
register struct wn_ctrl *ctrlstr;
ASIX_WINDOW *wndptr;
U8 caption_len;
U32 pGC;
if ( *(P_U32)ctrl_str != WNDCLASS_WIN ) return ASIX_ERROR;
pGC = GetGC( );
ctrlstr = (struct wn_ctrl *)ctrl_str;
wndptr = (ASIX_WINDOW *)ctrlstr->wndid;
if ( !(wndptr->style & WS_CAPTION) ) return ASIX_ERROR;
caption_len = wndptr->width - 2;
if (ctrlstr->close_wndid != 0) caption_len -= ((ASIX_WINDOW *)ctrlstr->close_wndid)->width;
if (ctrlstr->sys_wndid != 0) caption_len -= ((ASIX_WINDOW *)ctrlstr->sys_wndid)->width;
if (ctrlstr->user_wndid != 0) caption_len -= ((ASIX_WINDOW *)ctrlstr->user_wndid)->width;
ClearRec( pGC, ColorTheme.form_title, wndptr->x+1, wndptr->y+1, caption_len, CHINESE_CHAR_HEIGHT+3,GPC_REPLACE_STYLE);
//DisplayMsg(caption, wndptr->x+1, wndptr->y+2, wndptr->x+caption_len*ENGLISH_CHAR_WIDTH-1, wndptr->y+1+CHINESE_CHAR_HEIGHT, GPC_REPLACE_STYLE);
// DrawText(pGC, caption, wndptr->x+1, wndptr->y+2, wndptr->x+caption_len*ENGLISH_CHAR_WIDTH-1, wndptr->y+1+CHINESE_CHAR_HEIGHT, HZK_16X16_FONT, ColorTheme.form_caption, GPC_REPLACE_STYLE);
DrawText(pGC, caption, wndptr->x+CAPTION_LEFT, wndptr->y+CAPTION_UP, wndptr->x+caption_len-1,
wndptr->y+1+CHINESE_CHAR_HEIGHT, HZK_16X16_FONT, ColorTheme.form_caption, GPC_REPLACE_STYLE);
//InvRec( pGC, wndptr->x+1, wndptr->y+1, caption_len*ENGLISH_CHAR_WIDTH, CHINESE_CHAR_HEIGHT+3);
return ASIX_OK;
}
STATUS wn_repaint(void *ctrl_str, U32 lparam)
{
ASIX_WINDOW *wndptr;
struct wn_ctrl *ctrlptr;
U8 caption_len = ASIX_LCD_W/ENGLISH_CHAR_WIDTH-2;
U32 pGC;
if (ctrl_str == NULL || *((U32 *)ctrl_str) != WNDCLASS_WIN ) return ASIX_ERROR;
pGC = GetGC( );
ctrlptr = (struct wn_ctrl *)ctrl_str;
wndptr = (ASIX_WINDOW *)(ctrlptr->wndid);
if (wndptr->style & WS_BORDER) {
//DrawRec( pGC, GPC_BLACK, wndptr->x, wndptr->y, wndptr->x+wndptr->width-1, wndptr->y+wndptr->hight-1, GPC_SOLID_LINE, GPC_REPLACE_STYLE);
/* 2001-11-24 16:20 */
DrawRec( pGC, ColorTheme.form_board, wndptr->x, wndptr->y, wndptr->x+wndptr->width-1, wndptr->y+wndptr->hight-1, GPC_SOLID_LINE, GPC_REPLACE_STYLE);
}
if (wndptr->style & WS_POPUP) {
//ClearRec( pGC, GPC_LIGHTGREY, wndptr->x+1, wndptr->y+1, wndptr->width-2, wndptr->hight-2,GPC_REPLACE_STYLE);
/* 2001-11-24 16:20 */
ClearRec( pGC, ColorTheme.form_popclient, wndptr->x+1, wndptr->y+1, wndptr->width-2, wndptr->hight-2,GPC_REPLACE_STYLE);
} else {
//ClearRec( pGC, GPC_WHITE, wndptr->x+1, wndptr->y+1, wndptr->width-2, wndptr->hight-2,GPC_REPLACE_STYLE);
/* 2001-11-24 16:21 */
ClearRec( pGC, ColorTheme.form_client, wndptr->x+1, wndptr->y+1, wndptr->width-2, wndptr->hight-2,GPC_REPLACE_STYLE);
}
if (wndptr->style & WS_USERBOX) caption_len -=2;
if (wndptr->style & WS_SYSMENU) caption_len -=2;
if (wndptr->style & WS_CLOSEBOX) caption_len -= 2;
if ( (wndptr->style & WS_BORDER) && (wndptr->style & WS_DLGFRAME) ) {
DrawRec( pGC, GPC_BLACK, wndptr->x, wndptr->y, wndptr->x+wndptr->width-1, wndptr->y+CHINESE_CHAR_HEIGHT+4, 0, GPC_REPLACE_STYLE);
//if (wndptr->style & WS_POPUP)
// ClearRec( pGC, GPC_WHITE, wndptr->x+1, wndptr->y+1, wndptr->width-2, CHINESE_CHAR_HEIGHT+4,GPC_REPLACE_STYLE);
ClearRec( pGC, ColorTheme.form_title, wndptr->x+1, wndptr->y+1, wndptr->width-2, CHINESE_CHAR_HEIGHT+4,GPC_REPLACE_STYLE);
//DisplayMsg(wndptr->caption, wndptr->x+1, wndptr->y+2, wndptr->x+caption_len*ENGLISH_CHAR_WIDTH-1, wndptr->y+1+CHINESE_CHAR_HEIGHT, GPC_REPLACE_STYLE);
DrawText(pGC, wndptr->caption, wndptr->x+CAPTION_LEFT, wndptr->y+2, wndptr->x+caption_len*ENGLISH_CHAR_WIDTH-1, wndptr->y+1+CHINESE_CHAR_HEIGHT, \
HZK_16X16_FONT, ColorTheme.form_caption, GPC_REPLACE_STYLE);
//InvRec( pGC, wndptr->x+1, wndptr->y+1, wndptr->width-2, CHINESE_CHAR_HEIGHT+3);
}
return ASIX_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -