📄 display.c
字号:
if (in_Text==NULL)
return(0);
scrGetRealLength(in_Text, &nChar, &nPixel);
return (nChar);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_GetMaxTextLen |
+--------------------------------------------------------------------+
PURPOSE : This function is used to calculate the sub-string
(number of characters) of a 0-terminated string (in_Text)
that can be displayed in the region given by the parameter
in_HSize. The value of in_HSize is measured in logical
units (e.g. pixels or multiple of characters). Call
the function dspl_SelectFont() to select a font.
*/
GLOBAL USHORT dspl_GetMaxTextLen (char * in_Text,
USHORT in_HSize)
{
if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER)
return strlen (in_Text);
else
return scrFntGetFit ( in_Text, ( int ) in_HSize );
}
GLOBAL void dspl_set_char_type(UBYTE char_type){
dspl_char_type = char_type;
}
GLOBAL UBYTE dspl_get_char_type(void){
return dspl_char_type;
}
int dspl_getDisplayType( void )
{
#ifndef COLOURDISPLAY
return (DSPL_BW);
#endif
#ifdef R2D_ENABLED
if (R2D_LCD_DISPLAY == R2D_COLOR)
return (DSPL_COLOUR);
else
#endif
return (DSPL_BW);
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_TextOut_Cmode |
+--------------------------------------------------------------------+
PURPOSE : This function is used to display a text at the given
location in_X/in_Y uding the defined attributes (in_Attrib)
and the currently selected color (foreground and background).
The cursor position is left unchanged. The driver will not
take the displays bounding rectangle into consideration and
therefore text may be cut off.
Linefeeds and carriage returns are not supported and there-
fore must be handled by upper layers.
GW 14/02/03 - SPR#1736 Modified code to call 'dspl_ScrText' to allow a border to be drawn
round chinese characters.
*/
GLOBAL UBYTE dspl_TextOut_Cmode (USHORT in_X,
USHORT in_Y,
UBYTE in_Attrib,
char * in_Text)
{
int in_X_signed;
int in_Y_signed;
int txtStyle=0;
// SH - If we want signed coordinates (i.e. if x and y can have negative numbers)
// we need to convert the unsigned values into two's complement.
if (in_Attrib & DSPL_TXTATTR_SIGNED_COORDS)
{
in_X_signed = (SHORT)in_X;
in_Y_signed = (SHORT)in_Y;
}
else
{
in_X_signed = in_X;
in_Y_signed = in_Y;
}
#if defined (WIN32)
if (scrEnabled)
{
if (in_Attrib & DSPL_TXTATTR_INVERS)
{
scrText_Invert(in_X, in_Y, in_Text);
}
else
{
scrText(in_X, in_Y, in_Text);
}
}
else
LCD_WriteString (in_Y, in_X, (UBYTE *) in_Text);
#else
if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER)
{
if (in_Attrib & DSPL_TXTATTR_INVERS)
{
if (dspl_char_type == DSPL_TYPE_ASCII)
scrText_Invert(6 * in_X + 2, 8 * in_Y, in_Text);
else
scrText_Invert_Unicode(12 * in_X + 2, 12 * in_Y,(USHORT*) in_Text);
}
else
{
if (dspl_char_type == DSPL_TYPE_ASCII)
scrText(6 * in_X_signed + 2, 8 * in_Y_signed, in_Text);
else
scrText_Unicode(12 * in_X_signed + 2, 12 * in_Y_signed, (USHORT*)in_Text);
}
}
else
{
txtStyle = 0;
if (in_Attrib & DSPL_TXTATTR_INVERS)
txtStyle = TXT_STYLE_INVERT;
else
txtStyle = TXT_STYLE_NORMAL;
if (dspl_char_type != DSPL_TYPE_ASCII)
txtStyle = txtStyle | TXT_STYLE_UNICODE;
dspl_ScrText( in_X_signed,in_Y_signed,in_Text, txtStyle);
// scrText_Unicode(in_X_signed,in_Y_signed, (USHORT*)in_Text);
}
#endif
/*
* if an external display simulation is used and switched on with the
* EXT_DISPLAY config primitive - send a MMI_DISPLAY_REQ primitive.
*/
if (extDisplay)
dspl_SendDisplayReq (in_X, in_Y, in_Text);
return DRV_OK;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_TextOut |
+--------------------------------------------------------------------+
PURPOSE : This function is used to display a text at the given
location in_X/in_Y using the defined attributes (in_Attrib)
It calls dspl_ScrText to actually display the text
GW 14/02/03 - SPR#1736 Modified code to call 'dspl_ScrText' to allow a border to be drawn
round chinese characters.
*/
GLOBAL UBYTE dspl_TextOut(USHORT in_X,
USHORT in_Y,
UBYTE in_Attrib,
char * in_Text)
{
UBYTE temp;
int in_X_signed;
int in_Y_signed;
int txtStyle=0;
char* op_str;
/*MC SPR 1319*/
if (in_Text == NULL)
return DRV_OK;
/*MC end*/
op_str = in_Text;
#if defined (WIN32)
if (!scrEnabled)
{
LCD_WriteString (in_Y, in_X, (UBYTE *) in_Text);
}
else
#endif
{
if (in_Attrib & DSPL_TXTATTR_SIGNED_COORDS)
{
in_X_signed = (SHORT)in_X;
in_Y_signed = (SHORT)in_Y;
}
else
{
in_X_signed = in_X;
in_Y_signed = in_Y;
}
/*Mc SPR 1526, we no longer check for current mode*/
if (in_Attrib & DSPL_TXTATTR_INVERS)
txtStyle = TXT_STYLE_INVERT;
else
txtStyle = TXT_STYLE_NORMAL;
if ((in_Attrib&DSPL_TXTATTR_UNICODE) || (in_Text[0] ==0x80))
{
txtStyle = txtStyle | TXT_STYLE_UNICODE;
if (op_str[0] ==0x80)//if unicode tag at beginning of string
op_str = &op_str[2];
}
if (displayData.DisplayType EQ DSPL_TYPE_CHARACTER)
{
/* the following is only accurate for a fixed-width font*/
if (txtStyle & TXT_STYLE_UNICODE)
{
in_X_signed = in_X_signed*12+2;
in_Y_signed = in_Y_signed*12;
}
else
{
in_X_signed = in_X_signed*6+2;
in_Y_signed = in_Y_signed*8;
}
}
dspl_ScrText( in_X_signed,in_Y_signed,op_str, txtStyle);
}
/*
* if an external display simulation is used and switched on with the
* EXT_DISPLAY config primitive - send a MMI_DISPLAY_REQ primitive.
*/
if (extDisplay)
dspl_SendDisplayReq (in_X, in_Y, in_Text);
return DRV_OK;
}
/**/
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_SetWorkShadow |
+--------------------------------------------------------------------+
PURPOSE : This function is used to define the address of the
shadow RAM for drawing operations.
*/
GLOBAL UBYTE dspl_SetWorkShadow (UBYTE * in_ShadowPtr)
{
return DSPL_FCT_NOTSUPPORTED;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6103) MODULE : DRV_DSPL |
| STATE : code ROUTINE : dspl_SetDisplayShadow |
+--------------------------------------------------------------------+
PURPOSE : This function is used to define the address of the
shadow RAM for displaying operations.
*/
GLOBAL UBYTE dspl_SetDisplayShadow (UBYTE * in_ShadowPtr)
{
return DSPL_FCT_NOTSUPPORTED;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147) MODULE : SMI_WM |
| STATE : code ROUTINE : dspl_SendDisplayReq |
+--------------------------------------------------------------------+
PURPOSE : sends an MMI_DISPLAY_REQ primitive to write
the text at position X,Y to PL. If the parameter
text is NULL only the cursor position
should change. If in this case the X and Y value
is 0xffff the cursor will be hide.
*/
LOCAL void dspl_SendDisplayReq (USHORT x, USHORT y, char *text)
{
#ifdef NEW_FRAME
T_QMSG Msg;
T_VOID_STRUCT *prim;
#endif
USHORT sdu_len = (text NEQ NULL) ? strlen (text) : 0;
PALLOC_SDU (mmi_display_req, MMI_DISPLAY_REQ, (USHORT)(sdu_len<<3));
mmi_display_req->c_x = x;
mmi_display_req->c_y = y;
if (text NEQ NULL)
{
/*
* text output
*/
mmi_display_req->attrib.content = CON_TEXT;
mmi_display_req->attrib.control = CTL_NORMAL;
mmi_display_req->sdu.o_buf = 0;
mmi_display_req->sdu.l_buf = (sdu_len<<3);
memcpy (mmi_display_req->sdu.buf, text, sdu_len);
}
else
{
/*
* change the cursor position
*/
mmi_display_req->attrib.content = CON_CURSOR;
mmi_display_req->attrib.control = ((x EQ 0xffff) ? CTL_HIDDEN : CTL_NORMAL);
mmi_display_req->sdu.o_buf = 0;
mmi_display_req->sdu.l_buf = 0;
}
#if defined NEW_FRAME
if ( hCommMMI == VSI_ERROR )
{
mmi_handle = vsi_e_handle ( 0, "MMI" );
hCommMMI = vsi_c_open ( 0, "MMI" );
prim = vsi_c_pnew ( 100, 0x8000 FILE_LINE_MACRO );
strcpy ((char*)prim, "REDIRECT MMI 0000111000001010 PAN");
vsi_c_primitive ( mmi_handle, D2P(prim) );
}
PSEND(hCommMMI,mmi_display_req);
#else
ext_primitive (D2P(mmi_display_req), "CST", "PAN",
sizeof (T_PRIM_HEADER) +
sizeof (T_MMI_DISPLAY_REQ) +
sdu_len);
PFREE (mmi_display_req);
#endif
}
GLOBAL UBYTE dspl_DrawWin (USHORT px, USHORT py, USHORT sx, USHORT sy, int format, t_font_bitmap *bgdBmp)
{
USHORT x1,y1,x2,y2;
int xOfs,yOfs;
if (bgdBmp == NULL)
{
scrDrawFilledRect( px+3,py+3, sx, sy, 0x00010101 ); //shadow
scrDrawFilledRect( px,py, sx, sy, dspl_GetBgdColour() );
scrRect( px-1,py-1, sx+1, sy+1);
}
else
{
xOfs = (sx-bgdBmp->width)/2;
yOfs = (sy-bgdBmp->height)/2;
dspl_GetWindow(&x1,&y1,&x2,&y2 );
switch (format)
{
case DSPL_WIN_NORMAL:
dspl_show_bitmap(px, py, bgdBmp, SHOWBITMAP_NORMAL );
break;
case DSPL_WIN_CENTRE:
dspl_show_bitmap(px+xOfs, py+yOfs, bgdBmp, SHOWBITMAP_NORMAL );
break;
case DSPL_WIN_CLIP:
dspl_SetWindow(px,py,px+sx,px+sy );
dspl_show_bitmap(px, py, bgdBmp, SHOWBITMAP_NORMAL );
break;
case DSPL_WIN_CENTRE_CLIP:
dspl_SetWindow(px,py,px+sx,px+sy );
dspl_show_bitmap(px+xOfs, py+yOfs, bgdBmp, SHOWBITMAP_NORMAL );
break;
case DSPL_WIN_TILE:
dspl_SetWindow(px,py,px+sx,px+sy );
yOfs=0;
while(yOfs < sy)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -