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

📄 aphearsaybrowser.c

📁 本电子词典是名人928的学习机代码,主要是电子学习机AP,其他还没有传
💻 C
字号:
/****************************************************************************/
/*                                                                          */
/*              Copyright (C) 2005 SHENZHEN MEIJIN CO.LTD                   */
/*                                                                          */
/* FILE NAME:   ApHearSayBrowser.c                                          */
/* MODULE NAME: AP应用程序                                                  */
/* DESCRIPTION: Hearsya Browser                                             */
/*                                                                          */
/* FUNCTIONS:                                                               */
/*                                                                          */
/****************************************************************************/
/*    NAME         DATE               REMARKS                               */
/* ==========  ============   ==============================================*/
/*   DennyHan    2006-03-11         V1.00B                                  */
/****************************************************************************/
// 包含必要的头文件
#include	"Ap.h"
#include	"ApHearSay.h"

//==================================================================
extern RrParam		g_RrParam;

#define APHS_NOT_TEXT          ((const char *)"没有文本信息!")

static VOID HearSayInvertMstArea(APGUI_STRUCT *pGui);
//==================================================================
// Event Proc
//--------
INT  HearSayBrowserProc ( APGUI_STRUCT *pGui, UINT uEvent, UINT uParam )
{
INT nRet;

    if (   (uEvent != EVENT_INITIALIZE)
         &&(uEvent != EVENT_DESTROY   )   )
    {
        if (   ( g_RrParam.wRptMode & RR_MODE_NOTEXT )
            && ( pGui == g_RrParam.pBwrGui )              )
        {
            if (uEvent == EVENT_DRAW)
            {
            UINT16 x,y;
            UINT16 wId;
                pGui->uCurrentIme &= (~BROWSER_OPTION_RELOAD);
                GraphDisableRefresh();
                wId = FontGetLib();
            	GraphClearRect(pGui->nX,pGui->nY,
            	                pGui->nX+pGui->uWidth-1,
        	                    pGui->nY + pGui->uHeight - 1);

                x = FontGetStringWidth (wId,(UINT8*)APHS_NOT_TEXT);
                if (x >= pGui->uWidth)
                {
                    x =  pGui->nX;
                }
                else
                {
                    x = pGui->nX + (pGui->uWidth - x) /2;
                }

                y = FontGetHeight(wId);
                if (y >= pGui->uHeight)
                {
                    y =  pGui->nY;
                }
                else
                {
                    y = pGui->nY + (pGui->uHeight - y) /2;
                }
            	GraphDrawText( x,y,0,0, (UINT8*)APHS_NOT_TEXT);

                GraphEnableRefresh();
            }
            nRet = 0;
            return nRet;
        }
    }

    nRet=BrowserHandleEvent( (MBrowser *)pGui,uEvent,uParam);
#ifdef APHS_AUTO_INVERT_EN
    if (EVENT_DRAW == uEvent)
    {   //
        if (  pGui == g_RrParam.pBwrGui )
        {
            HearSayInvertMstArea(pGui);
        }
    }
#endif
    return nRet;
}

//===============================================================
// Expand command
INT	HearSayEvent_BrowserEx(APGUI_STRUCT *pGui, UINT uEvent, UINT uParam)
{
CMDEXP* pcmdexp;
INT     nRet;
    pcmdexp = (CMDEXP*)uParam;  //uParam为消息参数
    nRet = 0;
    if(pcmdexp->wCmdType == EVENT_CMDEXP_BWR)
    {
    BrwCmdEx* pbrwcmd;
        pbrwcmd = (BrwCmdEx*)pcmdexp->pCmdExp;
        if(pbrwcmd->pBrwHdl == (APGUI_STRUCT_MODEL*)(pGui+1))     //handle为浏览器句柄
        {
            nRet = 0;
            switch(pbrwcmd->uType)
            {
            case CMEX_BROWSER_REQUEST_TOP:
				nRet = ApHsReReadFileText(CMEX_BROWSER_REQUEST_TOP, (VOID*)pbrwcmd);
                break;
            case CMEX_BROWSER_REQUEST_BOT:
				nRet = ApHsReReadFileText(CMEX_BROWSER_REQUEST_BOT, (VOID*)pbrwcmd);
                break;
            }
        }
    }

    return nRet;
}

//===============================================================
static VOID HearSayInvertMstArea(APGUI_STRUCT *pGui)
{
UINT16  x1,y1,x2,y2;
UINT16  MaxY;
    if  (   (!(g_RrParam.wRptMode&RR_MODE_NOMST)) )
//    	  &&(g_RrParam.wRptMode & RR_MODE_AUTOMATIC )
//         && (!g_RrParam.bMarkFlag)                      )
    {   // if it is MST File,
        // and it is not in mark mode
        GraphDisableRefresh();
        BrowserLineColToXY((MBrowser *)pGui, g_RrParam.dwStLine,
                            0, &x1, &y1);
        x1 =  pGui->nX;
		y1 += pGui->nY;
		MaxY = (pGui->nY+pGui->uHeight-1);
        if ( y1 > MaxY)
        {
            y1=MaxY;
        }

        BrowserLineColToXY((MBrowser *)pGui, g_RrParam.dwEndLine,
                            100, &x2, &y2);
        x2 =  pGui->nX + pGui->uWidth-1;
		y2 += pGui->nY-1;
        if ( y2 > MaxY )
        {
            y2 = MaxY;
        }

        GraphInvertRect(x1,y1,x2,y2);
        GraphEnableRefresh();
    }
}

⌨️ 快捷键说明

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