⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guistyle_item_string.c

📁 IT projecotr reference design.
💻 C
字号:
/*****************************************************************************
**             TEXAS INSTRUMENTS PROPRIETARY INFORMATION
**
**  (c) Copyright, Texas Instruments Incorporated, 2006.
**      All Rights Reserved.
**
**  Property of Texas Instruments Incorporated. Restricted Rights -
**  Use, duplication, or disclosure is subject to restrictions set
**  forth in TI's program license agreement and associated documentation.
******************************************************************************/

#include "common.h"
#include "osd.h"
#include "guiStyle.h"
#include "guiStyle_sub.h"

/* This item style requires a dynamic text field */
int08 guiStyle_item_String_SetTextString( int16 itemId, uint08 *string )
{
    int16 fieldId;
    OSDFIELDTYPE fieldType;
    uint16 stringBuf[20];
    uint08 i;
    
    for( i=0; i<20 && string[i] != 0; i++ )
    {
        stringBuf[i] = string[i];
    }
    if( i != 20 )
        stringBuf[i] = 0;
    else
        stringBuf[19] = 0;
    
    /* search thru the fields for all dynamic text strings in the item */
    fieldId = OSD_GetFirstFieldID( itemId );
    if( fieldId == OSD_ERR_ID_INVALID )
        return FAIL;
    
    while( fieldId != OSD_ERR_ID_INVALID )
    {
        if( OSD_GetFieldType( fieldId, &fieldType ) != PASS )
            return FAIL;
            
        /* for all dynamic text strings, set the string */
        if( fieldType == DYNA_TEXT )
        {
            if( OSD_GetLanguageDirection( OSD_GetLanguage()) )
            {    
                /* use default font style instead of arabic font style for RTL language */
                if( OSD_SetDynaTextStringSpecial( fieldId, stringBuf, STYL_STYLE_2, TRUE ) != PASS )
                    return FAIL;
            }
            else
            {
                if( OSD_SetDynaTextString( fieldId, stringBuf ) != PASS )
                    return FAIL;
            }        
        }    
        fieldId = OSD_GetNextFieldID( fieldId );
    }
   
    return PASS;
}


int08 guiStyle_item_String_SetSingleValue( int16 itemId, int32 value, int32 min, int32 max )
{
    int16 fieldId;
    OSDFIELDTYPE fieldType;
    uint16 string[6];
    
    /* search thru the fields for the first Dynamic Text in the item */
    fieldId = OSD_GetFirstFieldID( itemId );
    if( fieldId == OSD_ERR_ID_INVALID )
        return FAIL;
    
    while( fieldId != OSD_ERR_ID_INVALID )
    {
        if( OSD_GetFieldType( fieldId, &fieldType ) != PASS )
            return FAIL;
        
        /* if we found the Dynamic Text, display the argument value appropriately */
        if( fieldType == DYNA_TEXT )
        {
            /* convert the argument value directly into a unicode string and display */
            guiStyle_sub_IntToDynamicTextString( value, string, FALSE );
            if( OSD_GetLanguageDirection( OSD_GetLanguage()) )
            {    
                /* use default font style instead of arabic font style for RTL language */
                OSD_SetDynaTextStringSpecial( fieldId, string, STYL_STYLE_2, TRUE );
            }
            else
            {
                OSD_SetDynaTextString( fieldId, string );
            }
        }
        fieldId = OSD_GetNextFieldID( fieldId );
    }        
    
    return PASS;
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -