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

📄 mso_edit.c

📁 ZORAN 962/966 SOURCE CODE,DVD chip
💻 C
字号:
/* **************************************************************************************
*  Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: $Workfile: o_edit.c $
*
* Description:
* ============
* Project definition of the MSO_EDIT functions
*
****************************************************************************************/
#include "Config.h"		// Global Configuration - do not remove!

#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //DEBUG_UI_TRACE

#include "Include\SysDefs.h"

/////////////////////////////////////////////////////////////////////////////
// Include files
#include <stdio.h>
#include <string.h>

#include "Playcore\ScPad\SCMGR.h"

#include "GUI\Menu_system\ms_object.h"
#include "gui\menu_system\osd_rendering.h"
#include "gui\menu_system\ms_display.h"
#include "GUI\Menu_system\ms_screen.h"

#include "GUI\Object_class\Edit\mso_edit.h"
#include "Menu\menu_operation_def.h"
#include "GUI\Resource\Bitmap\bitmap.h"

#include "Library\String_generate.h"
#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef	dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif



MS_OP EditOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	MSO_EDIT __NEAR *pEditObject = (MSO_EDIT __NEAR*)pThis;
    FORMATED_UNICODE_STRING sFormattedString;

	switch (MsOp)
	{
    	case MS_OP_INIT:
        	// We have to allocate enough memory to hold the text.
            // Allocate scratchpad memory to hold a unicode formatted string.
			pEditObject->moParam.ScPtr = OSDR_MallocScFormUniStr();
			// Make sure the string is empty:
            sFormattedString.mcStrLength = 0;
            		sFormattedString.mtFontIndex = FONT_0;
			OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR *)&sFormattedString,
									pEditObject->moParam.ScPtr);
            break;

        case MS_OP_EMPTY:
			// Release the scratchpad memory:
			OSDR_FreeScFormUniStr(pEditObject->moParam.ScPtr);
			break;

        case MS_OP_FOCUS_CHANGE:
        	// We have gained or lost focus.
            // Ask for a redisplay:
            MS_DisplayAddObject(pThis);
            break;

        case MS_OP_0:	// Fall thru
        case MS_OP_1:
        case MS_OP_2:
        case MS_OP_3:
        case MS_OP_4:
        case MS_OP_5:
        case MS_OP_6:
        case MS_OP_7:
        case MS_OP_8:
        case MS_OP_9:
			// Get the string for this edit out of external memory:
            OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&sFormattedString, (UINT32)pEditObject->moParam.ScPtr);

        	// Work out which number was pressed:
			lParam = (MsOp - MS_OP_0);

            // Convert the value to an ASCII character and add it to the string:
            STR_GenerateNumericValue((INT32)lParam, (WORD*)sFormattedString.mszUniStr, sFormattedString.mcStrLength, UNISTR_LENGTH_MAX+1);

            // Reformat the string:
            OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR *)&sFormattedString);

            // Write the string to external memory:
            OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&sFormattedString, pEditObject->moParam.ScPtr);

            // Redisplay:
            MS_DisplayAddObject(pThis);

            MsOp = MS_OP_NONE;
        	break;

        case MS_OP_CLEAR:
        	// Clear the edit:
        	EditClear(pEditObject);

            // Redisplay:
            MS_DisplayAddObject(pThis);

            MsOp = MS_OP_NONE;
        	break;
	}
	return MsOp;
}

BOOL EditFillOSDSeg(MSO_OBJECT __NEAR* pEditObject, MS_AREA __NEAR* pAbsArea)
{
	FORMATED_UNICODE_STRING oFormUniStr;
    UINT16 wColor = (MS_IsFocusable(pEditObject)) ? CIDX_6 : CIDX_4;

	OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
    								(UINT32)((MSO_EDIT __NEAR*)(pEditObject))->moParam.ScPtr);


    OSDR_FillOsdSegRectangle(	0,
								0,
								pEditObject->moArea.mwW,
								pEditObject->moArea.mwH,
								pAbsArea,
								wColor);

	if(MS_IsEditMasked(pEditObject))
	{
		UINT8 i;
		for(i = 0; i < oFormUniStr.mcStrLength; i++)
              {
              	oFormUniStr.mszUniStr[i] = L'*';
              }
	}

	OSDR_FillOsdSegUniString(	(FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
                                pAbsArea,
                                10, // sX,
                                0, // sY,
                                ALIGN_H_LEFT,
                                ALIGN_V_TOP,
                                CIDX_2);

	/*if(	MS_IsFocusable(pEditObject) &&
    	MS_IsFocused(pEditObject))
    {
		OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, pAbsArea);
	}*/

	return FALSE;
}

extern void EditClear(MSO_EDIT __NEAR* pThisEdit)
{
	FORMATED_UNICODE_STRING sFormattedString;

	// Get the string for this edit out of external memory:
    OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&sFormattedString, (UINT32)pThisEdit->moParam.ScPtr);

    // Clear the string by setting the first character to null:
    sFormattedString.mszUniStr[0] = '\0';

    // Reformat the string:
    OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR *)&sFormattedString);

    // Write the string to external memory:
    OSDR_SetScFormUniStr((FORMATED_UNICODE_STRING __NEAR*)&sFormattedString, pThisEdit->moParam.ScPtr);

    return;
}

⌨️ 快捷键说明

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