📄 select.c
字号:
Lfree( itemareaid );
Lfree( scaption ); //modified by xuanhui 2002/4/4
return ASIX_ERROR;
}
if( !(style&SLS_ENABLE) ) //modified by xuanhui 2002/4/4
{
enable = FALSE; //modified by xuanhui 2002/3/20
ActiveAreaSuspend( itemareaid[i],AREA_SUSPEND );
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_DARKGREY,exdata_ptr[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_disablecolor,exdata_ptr[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_disablecolor,scaption,startx+SL_DISTANCE,text_starty );
}else{
enable = TRUE;
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_BLACK,exdata_ptr[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_text,exdata_ptr[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_text,scaption,startx+SL_DISTANCE,text_starty );
}
draw3dcheckbox(startx,starty,SL_DIAMETER,SL_DIAMETER,enable,exdata_ptr[i].state );
} else if( style&SLS_RADIOBOX ) { //draw radiobox with its style
//modified by xuanhui 2002/4/4
//if( ActiveAreaEnable( &itemareaid[i],ICON_AREA,STROKE_MODE,startx,starty,startx+SL_DISTANCE+ENGLISH_CHAR_WIDTH*strlen(exdata_ptr->caption),starty+SL_DISPLAY_TEXT_HEIGHT, ctrl_ptr->wndid ) == PPSM_ERROR )
if( ActiveAreaEnable( &itemareaid[i],ICON_AREA,STROKE_MODE,startx,y_frame,startx+SL_DISTANCE+ENGLISH_CHAR_WIDTH*strlen(scaption),(y_frame+interval-1), ctrl_ptr->wndid ) == PPSM_ERROR )
{
for( j=0;j<i;j++ )
{
ActiveAreaDisable( itemareaid[j] );
}
//restor the screen
if (ctrl_ptr->sl_bk_saved != NULL ){
//modified by xuanhui 2002/3/20
//PutRec( pGC, ctrl_ptr->sl_bk_saved, x, y, width, hight,GPC_REPLACE_STYLE,0);
if ( PutRec( pGC, ctrl_ptr->sl_bk_saved, (U16)(x+2), y, (U16)(width-4), hight,GPC_REPLACE_STYLE,0) != PPSM_OK )
return ASIX_ERROR;
Lfree(ctrl_ptr->sl_bk_saved);
}
/* else
//modified by xuanhui 2002/3/20
//ClearRec( pGC, GPC_WHITE, x, y, width, hight, GPC_REPLACE_STYLE);
ClearRec( pGC, ColorTheme.form_backcolor, x, y, width, hight, GPC_REPLACE_STYLE);
*/
//ClearRec( pGC, pGC, GPC_WHITE,x,y-8,width,hight+8,GPC_REPLACE_STYLE );
//need put back the background
//Lfree(ctrl_ptr->sl_bk_saved);
Lfree( curradio_ptr );
Lfree( nextradio_ptr );
Lfree( ctrl_ptr );
Lfree( itemareaid );
Lfree( scaption ); //modified by xuanhui 2002/4/4
return ASIX_ERROR;
}
if( !(style&SLS_ENABLE) ) //modified by xuanhui 2002/4/4
{
enable = FALSE; //modified by xuanhui 2002/3/20
ActiveAreaSuspend( itemareaid[i],AREA_SUSPEND );
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_DARKGREY,exdata_ptr[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_disablecolor,exdata_ptr[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_disablecolor,scaption,startx+SL_DISTANCE,text_starty );
}else{
enable = TRUE;
//modified by xuanhui 2002/3/20
//Disp16StringGrey( GPC_BLACK,exdata_ptr[i].caption,startx+32,starty );
//modified by xuanhui 2002/4/4
//Disp16StringGrey( ColorTheme.form_text,exdata_ptr[i].caption,startx+SL_DISTANCE,starty );
Disp16StringGrey( ColorTheme.form_text,scaption,startx+SL_DISTANCE,text_starty );
}
draw3dradiobox(startx,starty,SL_DIAMETER,SL_DIAMETER,enable,exdata_ptr[i].state);
//SetDotWidth(1,0);
//Disp16StringGrey( GPC_BLACK,exdata_ptr[i].caption,startx+32,starty );
}
// to conclude the current radiobox or checkbox
//modified by xuanhui 2002/3/20
//if( exdata_ptr[i].state == 1 )
if( exdata_ptr[i].state == SL_CHECKED )
{
curradio_ptr->index = i;
}
//change the y coordinate which will draw a radiobox or checkbox next time
starty = starty + interval;
text_starty = text_starty + interval; //modified by xuanhui 2002/4/4
y_frame = y_frame + interval; //modified by xuanhui 2002/4/4
Lfree( scaption ); //modified by xh 02/11/5
}
return ASIX_OK;
}
//the function sl_destroy() helps to destroy a selectbox
STATUS sl_destroy( void *ctrl_str )
{
int i;
U32 *itemareaid;
U16 x;
U16 y;
U16 width;
U16 hight;
struct sl_ctrl_str *ctrl_ptr;
U32 pGC;
pGC = GetGC( );
ctrl_ptr = (struct sl_ctrl_str *)ctrl_str;
//modified by xuanhui 2002/3/20
if( ctrl_ptr == NULL )
return ASIX_ERROR;
itemareaid = ctrl_ptr->id_index;
x = ctrl_ptr->sl_x;
y = ctrl_ptr->sl_y;
width = ctrl_ptr->sl_width;
hight = ctrl_ptr->sl_hight;
//if( ctrl_ptr == NULL ) //modified by xuanhui 2002/3/20
//return ASIX_ERROR;
//release the active area
for ( i=0;i<ctrl_ptr->sl_rownum;i++ )
{
if( itemareaid[i] != 0 )
ActiveAreaDisable( itemareaid[i] );
}
if (ctrl_ptr->sl_bk_saved != NULL ){
//modified by xuanhui 2002/3/20
//PutRec( pGC, ctrl_ptr->sl_bk_saved, x, y, width, hight,GPC_REPLACE_STYLE,0);
if ( PutRec( pGC, (P_U16)ctrl_ptr->sl_bk_saved, x, y, width, hight,GPC_REPLACE_STYLE,0) != PPSM_OK )
return ASIX_ERROR;
Lfree(ctrl_ptr->sl_bk_saved);
} else
//modified by xuanhui 2002/3/20
//ClearRec( pGC, GPC_WHITE, x, y, width, hight, GPC_REPLACE_STYLE);
ClearRec( pGC, ColorTheme.form_backcolor, x, y, width, hight, GPC_REPLACE_STYLE);
//ClearRec( pGC, pGC, GPC_WHITE,x,y-8,width,hight+8,GPC_REPLACE_STYLE );//??? why?
//put back the backgroud here
//release the memory which was applied
Lfree( itemareaid );
Lfree( ctrl_ptr->id_index ); //modified by xuanhui 2002/3/20
Lfree( ctrl_ptr->sl_curradio );
Lfree( ctrl_ptr->sl_nextradio );
Lfree( ctrl_ptr->sl_exdata );
Lfree( ctrl_ptr );
return ASIX_OK;
}
//the function sl_msg_trans() helps to translate the message
STATUS sl_msg_trans(void *ctrl_str, U16 msg_type, U32 areaid, P_U16 data, U32 size, PMSG trans_msg)
{
int i;
U8 ismymsg = 0;
struct sl_ctrl_str *ctrl_ptr;
U32 pGC;
pGC = GetGC( );
ctrl_ptr = (struct sl_ctrl_str *)ctrl_str;
if ( ctrl_ptr == NULL )
return ASIX_ERROR;
//set the next radio which was droped this time and will be displayed the next time
for( i = 0;i<ctrl_ptr->sl_rownum;i++ )
{
if( ctrl_ptr->id_index[i] == areaid )
{
ctrl_ptr->sl_nextradio->state = ctrl_ptr->sl_exdata[i].state;
ctrl_ptr->sl_nextradio->caption = ctrl_ptr->sl_exdata[i].caption;
ctrl_ptr->sl_nextradio->index = i;
ismymsg = 1;
}
}
if ( ismymsg == 0 ) return ASIX_NO_MSG;
//allocate memory for MSG struct
memset( (void *)trans_msg, 0x0, sizeof (MSG) );
//trans_msg = (PMSG)memmsg;
//the following will fill the message struct
switch( msg_type )
{
case ASIX_ICON:
{
// switch( *data )
switch( size )
{
case PPSM_ICON_DRAG_UP:
{
trans_msg->message = WM_PENDRAGUP;
break;
}
case PPSM_ICON_PEN_UP:
{
trans_msg->message = WM_PENUP;
break;
}
case PPSM_ICON_TOUCH:
{
trans_msg->message = WM_PENDOWN;
break;
}
case PPSM_ICON_DRAG:
{
trans_msg->message = WM_PENDRAG;
break;
}
default: return ASIX_ERROR;
}
trans_msg->messageType = ASIX_MESSAGE;
trans_msg->lparam = ctrl_ptr->wndid;
trans_msg->wparam = sizeof( ctrl_ptr );
trans_msg->data = (void *)ctrl_ptr;
break;
}
default:
return ASIX_NO_MSG;
}
return ASIX_OK;
}
//the function sl_msg_proc() helps to do default process for selectbox
STATUS sl_msg_proc( U32 win_id, U16 sl_msg_type, U32 lparam, void *data, U16 wparam, void *reserved )
{
U32 style;
S16 x;
S16 y;
S16 xdest;
S16 ydest;
U16 starty_interval; //modified by xuanhui 2002/4/9
MSG msg;
ASIX_WINDOW *wndptr;
struct sl_item *exdata_ptr;
struct sl_ctrl_str *ctrl_ptr;
wndptr = (ASIX_WINDOW *)win_id;
if( wndptr == NULL )
return ASIX_ERROR;
if( wndptr->wndclass == NULL || wndptr->wndclass->wndclass_id != WNDCLASS_SELECT)
return ASIX_ERROR;
ctrl_ptr = (struct sl_ctrl_str *)wndptr->ctrl_str;
if( ctrl_ptr == NULL )
return ASIX_ERROR;
style = ctrl_ptr->sl_style;
exdata_ptr = ctrl_ptr->sl_exdata;
//modified by xuanhui 2002/4/4
if (style & SLS_FRAME)
{
if ( ctrl_ptr->sl_caption != NULL )
starty_interval =(U16)((ctrl_ptr->sl_hight-SL_FRAME_TEXT_HEIGHT-3)/(ctrl_ptr->sl_rownum)/2-SL_DIAMETER/2);
else
starty_interval =(U16)((ctrl_ptr->sl_hight-3*2)/(ctrl_ptr->sl_rownum)/2-SL_DIAMETER/2);
}else
starty_interval =(U16)((ctrl_ptr->sl_hight)/(ctrl_ptr->sl_rownum)/2-SL_DIAMETER/2);
if( sl_msg_type!=WM_PENDOWN && sl_msg_type!=WM_PENDRAG && sl_msg_type!=WM_PENDRAGUP && sl_msg_type!=WM_PENUP )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -