MS_STAT.C
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:5k
- /* **************************************************************************************
- * Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: MS_STAT.C $
- *
- * Description:
- * ============
- * menu system static menus handling
- *
- * Log:
- * ====
- * $Revision: 5 $
- * Last Modified by $Author: Leonh $ at $Modtime: 9/04/03 8:05p $
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /SourceCode/I64_Common/I64_Reference/UI/Menu_sys/MS_STAT.C $
- *
- * 5 9/04/03 9:49p Leonh
- * if the first byte is 0, make sure the the whole string for display is 0
- *
- * 4 03-02-21 11:44 Janeg
- * Fix string range validation bug.
- *
- * 3 03-01-09 4:43 Leslie
- * Unicode support
- *
- * 12 23/04/02 9:39 Nirm
- * - Added dependency in "Config.h".
- *
- * 11 11/03/02 12:58 Nirm
- * Debug message in case of memory allocation failure.
- *
- * 10 2/27/02 7:02a Tomasp
- * Changed get_blk/rel_blk to malloc,free.
- *
- * 9 18/02/02 20:41 Nirm
- * Exported essential methods.
- *
- * 8 14/02/02 18:10 Nirm
- * Fixed handling of strings that reside in the SDRAM.
- *
- * 6 16/01/02 8:57 Nirm
- * Fixed debug-messages.
- *
- * 5 9/01/02 21:21 Nirm
- * Corrected Include-paths.
- *
- * 4 9/01/02 18:23 Nirm
- * Corrected Include-Paths.
- *
- * 3 30/12/01 10:05 Atai
- * Add explicit casting
- *
- * 2 25/12/01 10:55 Atai
- * Code cleaning
- **************************************************************************************** */
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef _DEBUG
- #include "DebugDbgMain.h"
- #undef IFTRACE
- #define IFTRACE if (gTraceMenu)
- #endif //_DEBUG
- #include <stdio.h>
- #include <stdlib.h>
- #include "PlaycoreScPadscmgr.h"
- #include "Decoderosdrendr.h"
- #include "UIMenu_Sysosd_drv.h"
- #include "UIMenu_Sysms_wdgt.h"
- #include "UIMenu_Sysms_lib.h"
- //START of customer specific include files
- #include "Stringsstrings.h"
- //END of customer specific include files
- MS_UOP static_user_op(MS_WIDGET *widget,MS_UOP uop,char param)
- {
- int str[ MS_STATIC_MAX_LENGTH / sizeof(int) + 1 ];
- unsigned char bgColor;
- #ifdef D_MS_EXTENSIONS
- unsigned char fgColor;
- #endif
- void *text = ((MS_STATIC *) widget)->text;
- switch (uop)
- {
- case MS_UOP_DELETE:
- param = 7; // Remove warning
- return MS_UOP_NOP;
- case MS_UOP_DISPLAY:
- wcscpy( (wchar_t*)str, L"" );
- bgColor = BACK_COLOR(widget, param);
- #ifdef D_MS_EXTENSIONS
- fgColor = FORE_COLOR(widget, param);
- #endif
-
- if (MS_IS_USE_SC(widget))
- {
- if ( NULL_HANDLE != (WORD)text )
- sc_GetBytes((unsigned short)text, 0, MS_STATIC_MAX_LENGTH, (BYTE *)str);
- if(str[0] == 0)//LeonH_0904_2003: Sometimes when clear static display, only set the first two char to 0 on scratch pad. Make sure ignore the remainder.
- wcscpy( (wchar_t*)str, L"" );
- }
- if (MS_IS_ASCII(widget) )
- {
- if (!MS_IS_USE_SC(widget))
- #ifdef D_MS_EXTENSIONS
- OSD_PutText(widget->pos.x, widget->pos.y, widget->pos.w/*0*/, widget->pos.h, fgColor, bgColor, text, MS_JUST(widget), C_ASCII);
- #else
- OSD_PutText(widget->pos.x, widget->pos.y, widget->pos.w/*0*/, widget->pos.h, FG_COLOR(widget->color), bgColor, text, MS_JUST(widget), C_ASCII);
- #endif
- else
- #ifdef D_MS_EXTENSIONS
- OSD_PutText(widget->pos.x, widget->pos.y, widget->pos.w/*0*/, widget->pos.h, fgColor, bgColor, str, MS_JUST(widget), C_ASCII);
- #else
- OSD_PutText(widget->pos.x, widget->pos.y, widget->pos.w/*0*/, widget->pos.h, FG_COLOR(widget->color), bgColor, str, MS_JUST(widget), C_ASCII);
- #endif
- }
- else
- {
- if ( MS_IS_USE_SC(widget) )
- text = (void *) str[0];
- if ((WORD)S_LAST <= (WORD) text )
- return MS_UOP_NOP;
- #ifdef D_MS_EXTENSIONS
- OSD_PutText(widget->pos.x, widget->pos.y, widget->pos.w/*0*/, widget->pos.h, fgColor, bgColor, text, MS_JUST(widget), !C_ASCII);
- #else
- OSD_PutText(widget->pos.x, widget->pos.y, /*0*/widget->pos.w, widget->pos.h, FG_COLOR(widget->color), bgColor, text, MS_JUST(widget), !C_ASCII);
- #endif
- }
- return MS_UOP_NOP;
- }
- return MS_UOP_NOP;
- }
- void MS_init_static(MS_STATIC *mss, MS_POS *pos, MS_COLOR color,
- void (* user_op)(MS_WIDGET *, MS_UOP, char),
- void *text, unsigned char attr)
- {
- #ifdef _DEBUG
- if (NULL == mss) {
- tr_printf(("FATAL: MS_init_static() Failed: NULL control.n"));
- return;
- }
- #endif //_DEBUG
-
- ((MS_WIDGET *)mss)->pos = *pos;
- ((MS_WIDGET *)mss)->color = color;
- if (NULL != user_op)
- ((MS_WIDGET *)mss)->user_op = (MS_UOP(*)(MS_WIDGET *,MS_UOP,char ))user_op;
- else
- ((MS_WIDGET *)mss)->user_op = (MS_UOP(*)(MS_WIDGET *,MS_UOP,char ))static_user_op;
- ((MS_WIDGET *)mss)->attr = attr;
- mss->text = text;
- ((MS_WIDGET *)mss)->parent = NO_PARENT;
- ((MS_WIDGET *)mss)->attrh = ALIGN_LEFT;
- }
- MS_STATIC *MS_create_static(MS_POS *pos,
- MS_COLOR color,
- void *text,
- unsigned char attr)
- {
- MS_STATIC *mss;
-
- dbg_printf(("MS_create_staticn"));
-
- mss = (MS_STATIC *)malloc(sizeof(MS_STATIC));
- #ifdef _DEBUG
- if (NULL == mss) {
- tr_printf(("FATAL: MS_create_static() Failed: Low system resources.n"));
- return NULL;
- }
- #endif //_DEBUG
- MS_init_static(mss, pos, color, (void (*)(MS_WIDGET *, MS_UOP, char) ) static_user_op, text, attr );
- return mss;
- }