UC5IMD.H
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:3k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1996, 1998-1999 DXGuide. All Rights Reserved.
- // File: UC5IMD.h
- #ifndef _UC5IMD__H
- #define _UC5IMD__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- const WORD constMaxInputCodeLen = 12;
- const WORD constMaxInputCharSetLen = 64;
- const WORD constMaxInputMethodNameLen = 8;
- const UINT constIMDHzFileOffset = 0x80; // In ucdos 5.0
- const WORD constIMD_ID_Len = 0x20; // In ucdos 5.0
- const WORD constMaxDispBufLen = 52;
- const WORD constMaxPageInfoBufSize = 400;
- const WORD constMaxFileCacheSize = 512;
- #ifndef _GUI_
- class CPackFile;
- class CPackFileManager;
- class CDIKeyState;
- #endif // _GUI_
- class CUC5IMD
- {
- friend class CIMDManager;
- friend class CDXIMDBar;
- public:
- CUC5IMD(void);
- ~CUC5IMD();
- protected:
- short m_errorCode;
- // Get from IMD File
- char m_pInputMethodName[constMaxInputMethodNameLen + 1];
- char m_pInputCharSet[constMaxInputCharSetLen + 1];
- int m_nInputCharSetLen;
- char m_charQuery;
- BYTE m_nSelectKeyOrder;
- int m_nMaxCodeLen;
- bool m_bAutoSelect;
- bool m_bFuzzyLookup;
- WORD m_wIMDHzIndexOffset;
- WORD m_wIMDHzIndexLen;
- WORD m_wOneHzCodeLen;
- BYTE* m_pIMDHzIndexBuf;
- bool m_bMustMaxLenDispDupCode;
- int m_nInputCharCount;
- bool m_bIMDProcKey;
- bool m_bDupBufShow;
- int m_nCurPageNo;
- int m_nCurPageDupNum;
- BYTE m_nMaxPageDupNum; // should be const number !!!
- BYTE* m_pIMDCodeIndexBuf;
- char m_pCodeBuf[constMaxInputCodeLen];
- char m_pDispBuf[constMaxDispBufLen + 1];
- BYTE m_pCurCodeBuf[constMaxInputCodeLen];
- BYTE* m_pIndexCurCodeBuf;
- BYTE m_pPageInfoBuf[constMaxPageInfoBufSize];
- short m_nIMDIndexBufBegOffset;
- short m_nIMDIndexBufEndOffset;
- long m_lIMDFileOffset;
- WORD m_wIMDSameCodeBegOffset;
- WORD m_wIMDSameCodeEndOffset;
- bool m_bFuzzyGet;
- public:
- #ifndef _GUI_
- bool Load(LPCTSTR lpszFileName,
- CPackFileManager* pPackFileManager = NULL,
- BYTE byteFuncKey = 0xFF);
- #endif // _GUI_
- bool Load(WORD wResID, LPCTSTR lpType = NULL, BYTE byteFuncKey = 0xFF);
- protected:
- bool Load(BYTE byteFuncKey = 0xFF);
- public:
- void Error(short errCode);
- bool GetHzCode(LPCTSTR lpHz, CString& strCode);
- bool GetHzFirstCode(LPCTSTR lpHz, CString& strCode);
- void GetFirstDupBuf(void);
- void GetNextDupBuf(void);
- bool SelectHZ(BYTE byteIndex, char* pOutBuf);
- bool PageNext(void);
- bool PagePrev(void);
- #ifndef _GUI_
- virtual bool OnKeyDown(CDIKeyState* pKeyState,
- char* pOutBuf, bool& bDispDupBuf, bool& bSelected);
- #endif // _GUI_
- void SaveCurPageInfo(int nPageNo);
- void GetCurPageInfo(int nPageNo);
- void CalcSameCodeEndOffset(int nIndexBufBegOffset);
- void SetDispBufLen(WORD wDispBufLen)
- {
- if (wDispBufLen < constMaxDispBufLen)
- m_wDispBufLen = wDispBufLen;
- }
- protected:
- void Beep(void);
- public:
- enum
- {
- ERR_NOERR,
- ERR_OPEN_IMD,
- ERR_READ_IMD,
- ERR_INVALID_IMD,
- ERR_USER
- };
- protected:
- static const CString m_strDefaultIMDTypeName;
- static const CString m_strIMDID;
- static const CString m_pStrIMDError[ERR_USER];
- WORD m_wDispBufLen;
- private:
- WORD GetAltFuncKeyCode(BYTE ch);
- WORD GetCharSetIndex(BYTE ch);
- BYTE GetIMDByte(void);
- private:
- long m_lCacheBegOffset;
- BYTE m_aFileCache[constMaxFileCacheSize];
- protected:
- union
- {
- #ifndef _GUI_
- CPackFile* m_pPackFile;
- #endif // _GUI
- CFile* m_pFile;
- };
- #ifndef _GUI_
- bool m_bUsePackFile;
- #endif // _GUI
- };
- #endif // _UC5IMD__H