Back to index

im-sdk  12.3.91
Functions | Variables
OnKeySym.c File Reference
#include "PYIM.h"

Go to the source code of this file.

Functions

JINT IsWantedKeysym (JINT *pks)
JINT IsQuitKeysym (JINT *pks)
JINT IsQpSpSwitchKeysym (JINT *pks)
JINT IsEditKeysym (JINT *pks)
JINT IsPageKeysym (JINT *pks)
JINT IsSelectKeysym (JINT *pks)
VOID GetAsciiFromJword (JWORD *pwJwordArray, CHAR *szAsciiArray, JINT nLen)
JINT JwordValidLen (JWORD *pwJwordArray, JINT nMaxLen)
JINT JwordStrStrReplace (JWORD *pwDst, JWORD *pwSrc1, JWORD *pwSrc2, JINT nLenSrc2)
JWORDStrToJword (CHAR *szStr)
VOID JwordInfo (JWORD *pwJwordArray, JINT nMaxLen)
VOID Jword2Uchar (JWORD *pwJword, UCHAR *szUch, JINT nMaxLen)
UCHARRecovDyz2244 (UCHAR *szDyz2244)
JWORDRecovDyzNWord2244 (JWORD *pwDyz2244, JINT nMaxLen)
VOID DecompPeIntArray (JINT *pnOutPreedit, CHAR *szDspPreedit)
VOID ParseRawInputStr (char *szPreedit, int *pnOutPreedit)
VOID InitSge (SesGuiElement *pSgeStruct)
JINT IMPinyinTrans (JINT *pKsThis, SesGuiElement *pSge)
JINT OnEditKeysym (JINT *pNextKeysym, SesGuiElement *pSge)
JINT OnPageKeysym (JINT *pNextKeysym, SesGuiElement *pSge)
JINT OnSelectKeysym (JINT *pNextKeysym, SesGuiElement *pSge)
JINT PixWidBetween (JWORD *pwPrsStr, JINT nFrom, JINT nTo)
JINT PixWidBetween_SP (JWORD *pwPrsStr, JINT nFrom, JINT nTo)
VOID GetDspPEandCaretPos (SesGuiElement *pSge)
VOID GetDspPEandCaretPos_PS (SesGuiElement *pSge)
JINT RestoreHzToPy (SesGuiElement *pSge, JINT nResFlag)
JINT YjCodeToYjStr (JINT nYjCode, CHAR *szYjStr)
JINT IsIntArrayEqual (JINT *pnIntArray1, JINT *pnIntArray2, JINT nLen)
VOID PraseMixRawPe (SesGuiElement *pSge)
JINT QpCaretToPrsCaret (JWORD *pwPrsStr, JINT nQpCaret)
VOID GetFirst9Yj (JINT *pnPrsYj, JINT *pnF9Yj, JINT *pnLen, JINT *pnMatchMode)
JINT LookupCiku (JINT *pnOrgYj, JINT nLenYj, JINT nMatchMode, SysCandi *psc, UdcCandi *puc)
JINT GetXrdCandi (SysCandi *psc, UdcCandi *puc, JINT nXrd, JWORD *pwOneCandi, JINT nGBKSupport)
VOID ScrollViewCandiPage (SysCandi *psc, UdcCandi *puc, SesGuiElement *pSge)
VOID ListCandiInfo (SysCandi *psc, UdcCandi *puc)
JWORD RecovDyzWord2244 (JWORD wDyz2244)
JINT TypeOfSpMixWord (JWORD *pwSpMix, JINT nPos, JINT nKeyLayMode)
JINT OnSelectKeysym_SP (JINT *pNextKeysym, SesGuiElement *pSge)
JINT RestoreHzToPy_SP (SesGuiElement *pSge, JINT nResFlag)
VOID SpMix2QpMix (JWORD *pwSpMix, JWORD *pwMix, JINT nSpCaret, JINT *pnCaret, JINT nKeyLayMode)
JINT OnEditKeysym_SP (JINT *pNextKeysym, SesGuiElement *pSge, JINT nKeyLayMode)
JINT TypeOfSpChar (CHAR *pszOrgSp, JINT nPos, JINT nKeyLayMode)
JINT IsValidSpSuite (CHAR chSM, CHAR chYM, JINT nKeyLayMode)
VOID GetIehFromSge (ImToXSun *pIeh, SesGuiElement *pSge)
VOID ProcSymbIMKey (SesGuiElement *pSge, JINT nSymbType, JINT *pNextKeysym, ImToXSun *pIeh)
JINT PrepareSymbolSge (SesGuiElement *pSge, JINT nSymbType)
VOID ProcAllKeysym (JINT *pKsThis, SesGuiElement *pSge)
VOID GetDspPEandCaretPos_SP (SesGuiElement *pSge)

Variables

JWORDpwNewpySym []

Function Documentation

VOID DecompPeIntArray ( JINT pnOutPreedit,
CHAR szDspPreedit 
)

Definition at line 63 of file ParsePreedit.c.

{
       JINT    i, j, tmp;
       JINT    nHalfMatchLen, nIUVetc, nYJCode;
       CHAR    szHalfMatch[7];
       
       i   = 0;
       tmp = 1;

       for (i = 0; i < 256; i++)
              szDspPreedit[i] = '\0';
              
       for (i = 0; pnOutPreedit[i] != 0; )
       {
              tmp = pnOutPreedit[i];
              nYJCode = tmp & 0x01FF;
              nIUVetc = (tmp >> 9) & 0x07;
              nHalfMatchLen = (tmp >> 12) & 0x0F;
              
              if (nIUVetc != 0)
              {
                     if (nIUVetc == 6)                        /* [$] */
                     {
                            strcat (szDspPreedit, "$");
                            i++;
                     }
                     else if (nIUVetc == 5)                   /* [#] */
                     {
                            strcat (szDspPreedit, "#");
                            i++;
                     }
                     else if (nIUVetc == 4)                   /* ['] */
                     {
                            strcat (szDspPreedit, "\'");
                            i++;
                     }
                     else                                      /* [i u v] */
                     {
                            /*
                            **  Add a space before [iuv] except that this is 
                            **  the first CHAR in Preedit string or a ['ivu]
                            **  ahead it.
                            **  MakeOPE(0, 1, 0) is 0000 001 000000000 = 0x0200 [i]
                            **  MakeOPE(0, 2, 0) is 0000 010 000000000 = 0x0400 [u]
                            **  MakeOPE(0, 3, 0) is 0000 011 000000000 = 0x0600 [v]
                            **  MakeOPE(0, 4, 0) is 0000 100 000000000 = 0x0800 [']
                            **
                            **  [#] and [$] don't affect [SPACE]
                            **
                            **  MakeOPE(0, 5, 0) is 0000 101 000000000 = 0x0A00 [#]
                            **  MakeOPE(0, 6, 0) is 0000 110 000000000 = 0x0C00 [$]
                            */
                            if ( (i > 0) && (pnOutPreedit[i-1] != 0x0200)    \
                                         && (pnOutPreedit[i-1] != 0x0400)    \
                                         && (pnOutPreedit[i-1] != 0x0600)    \
                                         && (pnOutPreedit[i-1] != 0x0800) )
                                   strcat (szDspPreedit, " ");
                            
                            if (nIUVetc == 1)
                                   strcat (szDspPreedit, "i");
                            else  if (nIUVetc == 2)
                                   strcat (szDspPreedit, "u");
                            else  if (nIUVetc == 3)
                                   strcat (szDspPreedit, "v");
                            i++;
                     }
              }
              
              else if ((nIUVetc == 0) && (nHalfMatchLen == 6))
              {
                     /*
                     ** A valid Yinjie code. Add a SPACE before
                     ** Yinjie string expect that there is a ['] ahead or it is the first.
                     ** MakeOPE(0, 4, 0) is 0000 100 000000000 = 0x0800
                     */
                     if ((i > 0) && (pnOutPreedit[i-1] != 0x0800))
                            strcat (szDspPreedit, " ");
                     
                     if (nYJCode >= 450)
                            strcat (szDspPreedit, SHENGMUSTR[nYJCode - 450]);
                     else if (nYJCode < 450)
                            strcat (szDspPreedit, YINJIESTR_CSZ[nYJCode]);
                            
                     i++;
              }
              
              else if ((nHalfMatchLen > 0) && (nHalfMatchLen < 6) && (nIUVetc == 0))
              {
                     for (j = 0; j < nHalfMatchLen; j++)
                            szHalfMatch[j] = (char)pnOutPreedit[i + j + 1];
                     szHalfMatch[j] = '\0';
                     if ((i > 0) && (pnOutPreedit[i-1] != 0x0800))
                            strcat (szDspPreedit, " ");
                     strcat (szDspPreedit, szHalfMatch);
                     i += (j + 1);
              }
              else
              {
                     i++;
                     fprintf (stderr, "Error in DecompPeIntArray()\n");
              }
       }
       
}

Here is the caller graph for this function:

VOID GetAsciiFromJword ( JWORD pwJwordArray,
CHAR szAsciiArray,
JINT  nLen 
)

Definition at line 249 of file Jword.c.

{
       JINT   i, j;
       
       i = j = 0;
       for (i = 0; i < nLen; i++)
       {
              if ( *(pwJwordArray + i) < 0x0080)
              {
                     *(szAsciiArray + j) = (CHAR)(*(pwJwordArray + i));
                     j++;
              }
       }
       
       for ( ; j < nLen; j++)
              *(szAsciiArray + j) = '\0';
}

Definition at line 912 of file OnKeySym.c.

{
       JINT    nTotLen, i, j, t1, t2, t3;
       
       JINT    nFrom, nTo, nRawCaret;
       
       nFrom     = pSge->nViewPeStart;
       nTo       = pSge->nViewPeEnd;
       nRawCaret = pSge->nRawCaretPos;
       
       /***** Above is a PATCH  MXL For ShuangPin 98-02-23 ******/
       
       assert((nRawCaret <= nTo) && (nRawCaret >= nFrom));
       
       nTotLen   = JwordValidLen(pSge->pwPrsMixStr, UTWO);
       
       t1 = t2 = t3 = j = 0;
       for (i = 0; i <= nTotLen; i++)
       {
              if (pSge->pwPrsMixStr[i] != (JWORD)' ')
              {
                     if (j == nFrom)
                            t1 = i;
                     if (j == nTo)
                            t2 = i;
                     if (j == nRawCaret)
                            t3 = i;
                     j++;
              }
       }
       
       pSge->nViewCaretPos = t3 - t1;

       for (i = t1; i < t2; i++)
              pSge->pwViewPe[i - t1] = pSge->pwPrsMixStr[i];
       pSge->pwViewPe[t2 - t1] = 0;

       if (t1 == 0)
              pSge->nIconFlag &= (~F_LEFTARROW);
       else
              pSge->nIconFlag |= F_LEFTARROW;
              
       if ( t2 >= (nTotLen - 1))
              pSge->nIconFlag &= (~F_RIGHTARROW);
       else
              pSge->nIconFlag |= F_RIGHTARROW;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 858 of file OnKeySym.c.

{
       JINT    nTotLen, i, j, t1, t2, t3;
       
       JINT    nFrom, nTo, nRawCaret, nPrsCaretPos;
       
       nFrom     = pSge->nViewPeStart;
       nTo       = pSge->nViewPeEnd;
       nRawCaret = pSge->nRawCaretPos;
       
/*
       ==>[szOrgSp]>>vs#hw#rf#mn#gs#he#go#mz#tm#bu [29]
       ==>[  szQp ]>>zhong#hua#ren#min#gong#he#guo#mei#tian#bu [41]
       pwPrsMixStr >>zhong# hua# ren# min# gong# he# guo# mei# tian# bu [50]
       nLenSp is 29 nSpRawCaretPos[29], nLenQp is 41 nRawCaretPos[41]
       [nViewPeStart][ 0]  [nViewPeEnd][50]  [nRawCaretPos][41]
*/

       nTotLen      = JwordValidLen(pSge->pwPrsMixStr, UTWO);
       nPrsCaretPos = QpCaretToPrsCaret(pSge->pwPrsMixStr, pSge->nRawCaretPos);
       
       t1 = t2 = t3 = j = 0;
       for (i = 0; i <= nTotLen; i++)
       {
              if (i == nFrom)
                     t1 = i;
              if (i == nTo)
                     t2 = i;
              if (i == nPrsCaretPos)
                     t3 = i;
       }
       
       assert((t3 <= t2) && (t3 >= t1));

       pSge->nViewCaretPos = t3 - t1;

       for (i = t1; i < t2; i++)
              pSge->pwViewPe[i - t1] = pSge->pwPrsMixStr[i];
       pSge->pwViewPe[t2 - t1] = 0;
       
       if (t1 == 0)
              pSge->nIconFlag &= (~F_LEFTARROW);
       else
              pSge->nIconFlag |= F_LEFTARROW;
              
       if ( t2 >= (nTotLen - 1))
              pSge->nIconFlag &= (~F_RIGHTARROW);
       else
              pSge->nIconFlag |= F_RIGHTARROW;

}

Here is the call graph for this function:

Here is the caller graph for this function:

VOID GetFirst9Yj ( JINT pnPrsYj,
JINT pnF9Yj,
JINT pnLen,
JINT pnMatchMode 
)

Definition at line 545 of file ParsePreedit.c.

{
       JINT    i, nTmp1, nTmp2;
       JINT    nHalfMatchLen, nIUVetc, nYjcode;
       
       for(i = 0; i < 9; i++)
              pnF9Yj[i] = 0;

       *pnMatchMode = LU_MATCH_WIDELY;
       *pnLen       = 0;
       
       for (i = 0; (pnPrsYj[i] != 0) && ((*pnLen) < 9); )
       {
              nTmp1   = pnPrsYj[i];
              nTmp2   = pnPrsYj[i + 1];

              nYjcode       = nTmp1 & 0x01FF;
              nIUVetc       = (nTmp1 >> 9) & 0x07;
              nHalfMatchLen = (nTmp1 >> 12) & 0x0F;
              
              if ((nIUVetc == 0) && (nHalfMatchLen == 6))
              {
                     pnF9Yj[*pnLen] = nYjcode;
                     (*pnLen)++;
                     i++;
              }
              else if ((nIUVetc == 4) || (nIUVetc == 5) || (nIUVetc == 6))           /* ['][#][$] */
              {
                     i++;
                     nYjcode       = nTmp2 & 0x01FF;
                     nIUVetc       = (nTmp2 >> 9) & 0x07;
                     nHalfMatchLen = (nTmp2 >> 12) & 0x0F;
                     
                     if ((nIUVetc == 0) && (nHalfMatchLen == 6))
                     {
                            pnF9Yj[*pnLen]  = nYjcode + ((nIUVetc - 3) << 16);
                            (*pnLen)++;
                            i ++;
                     }
                     else
                     {
                            *pnMatchMode = LU_MATCH_STRICT;
                            break;
                     }
              }
              else
              {
                     *pnMatchMode = LU_MATCH_STRICT;
                     break;
              }
       }

       if (*pnMatchMode == LU_MATCH_WIDELY)
       {
              nTmp1   = pnPrsYj[i];

              nYjcode       = nTmp1 & 0x01FF;
              nIUVetc       = (nTmp1 >> 9) & 0x07;
              nHalfMatchLen = (nTmp1 >> 12) & 0x0F;
       
              if (nTmp1 == 0)
                     *pnMatchMode = LU_MATCH_WIDELY;
              else if ((nTmp1 != 0) && ((nIUVetc != 0) || (nHalfMatchLen != 6)))
                     *pnMatchMode = LU_MATCH_STRICT;
       }
}

Here is the caller graph for this function:

VOID GetIehFromSge ( ImToXSun pIeh,
SesGuiElement pSge 
)

Definition at line 676 of file NewPYLE.c.

{
       JINT   i, j;
       
       for (i = 0; i < 128; i++)
              pIeh->pwPreedit[i] = pSge->pwViewPe[i];
              
       pIeh->nCaretPos  = pSge->nViewCaretPos;
       
       pIeh->nChoiceNum = pSge->nViewCandiEnd - pSge->nViewCandiStart;
       for (i = 0; i < 8; i++)
              for (j = 0; j < 24; j++)
                     pIeh->pwLookupChoice[i][j] = 0x0000;
       
       GetLookupChoiceFromCandi(pIeh, pSge->pwViewCandi);
       
       for (i = 0; i < 16; i++)
              pIeh->pwStatus[i] = pSge->pwStatus[i];
       
       /* Because nErrorCode was cleared before each new KeySym Process */
       if (pSge->nErrorCode != 0)
       {
              pIeh->nType = IMXSUN_TYPE_ERROR;
              pIeh->nErrorCode = pSge->nErrorCode;
       }
}
JINT GetXrdCandi ( SysCandi psc,
UdcCandi puc,
JINT  nXrd,
JWORD pwOneCandi,
JINT  nGBKSupport 
)

Definition at line 1303 of file OnKeySym.c.

{
       JINT    i, k, m, nTmp;
       JINT    nRet;
       JINT    nNumSpec, nNumUdc28, nNumMh, nNumDh, nNumSh, nNumGbk;
       
       nRet  = 0;
       nNumSpec  = puc->nNumSpecCandi;
       nNumUdc28 = puc->nNumUdc28Candi;
       nNumMh    = psc->nNumMhCandi;
       nNumDh    = psc->nNumDhCandi;
       nNumSh    = psc->nNumShCandi;
       nNumGbk   = psc->nNumGbkCandi;

       nTmp  = nNumSpec + nNumUdc28 + nNumMh + nNumDh + nNumSh;       
       if(nGBKSupport == GBK_SUPPORTED) nTmp += nNumGbk;
       
       if ((nXrd < 0) || (nXrd > (nTmp - 1)))
              return nRet;
       
       /* SpecHz */
       if (nXrd < nNumSpec)                       /* [0 ~ (nNumSpecCandi - 1)] */
       {
              pwOneCandi[0] = puc->pwSpecCandi[nXrd];
              nRet = 1;
              return nRet;
       }
       /* Udc28 */
       else if ((nXrd >= nNumSpec) && (nXrd < (nNumSpec + nNumUdc28)))
       {
              m = nNumSpec;
              for (k = 0; k < puc->nSizUdc28Candi; k++)
              {
                     if (m == nXrd)
                     {
                            k++;
                            for(i = 0; puc->pwUdc28Candi[k] != 0x0000;  )
                                   pwOneCandi[i++] = puc->pwUdc28Candi[k++];
                            nRet = i;
                            break;           /* 退出k++的BREAK, NOT i++ */
                     }
                     else if (puc->pwUdc28Candi[k] == 0x0000)
                            m++;
              }
       }
       /* Mh */
       else if ( (nXrd >= (nNumSpec + nNumUdc28)) && 
               (nXrd < (nNumSpec + nNumUdc28 + nNumMh)) )
       {
              m = nNumSpec + nNumUdc28;
              for (k = 0; k < psc->nSizMhCandi; k++)
              {
                     if (m == nXrd)
                     {
                            k++;
                            for(i = 0; psc->pwMhCandi[k] != 0x0000;  )
                                   pwOneCandi[i++] = psc->pwMhCandi[k++];
                            nRet = i;

                            break;           /* 退出k++的BREAK, NOT i++ */
                     }
                     else if (psc->pwMhCandi[k] == 0x0000)
                            m++;
              }
       }
       /* Dh */
       else if ( (nXrd >= (nNumSpec + nNumUdc28 + nNumMh)) && 
               (nXrd < (nNumSpec + nNumUdc28 + nNumMh + nNumDh)) )
       {
              m = nNumSpec + nNumUdc28 + nNumMh;
              for (k = 0; k < psc->nSizDhCandi; k++)
              {
                     if (m == nXrd)
                     {
                            k++;
                            for (i = 0; psc->pwDhCandi[k] != 0x0000;  )
                                   pwOneCandi[i++] = psc->pwDhCandi[k++];
                            nRet = i;
                            break;           /* 退出k++的BREAK, NOT i++ */
                     }
                     else if (psc->pwDhCandi[k] == 0x0000)
                            m++;
              }
              nRet  = 2;
       }
       /*
       **  Sh
       **  Special Consideration for Single Hanzi Area: Because there is 'Xian' Question
       **  Here!!!! nRet may be 2.
       */
       else if ((nXrd >= (nNumSpec + nNumUdc28 + nNumMh + nNumDh)) && 
               (nXrd < (nNumSpec + nNumUdc28 + nNumMh + nNumDh + nNumSh)) )
       {
              m = nNumSpec + nNumUdc28 + nNumMh + nNumDh;
              for (k = 0; k < psc->nSizShCandi; k++)
              {
                     if (m == nXrd)
                     {
                            for (i = 0; psc->pwShCandi[k] != 0x0000;  )
                                   pwOneCandi[i++] = psc->pwShCandi[k++];
                            nRet = i;
                            break;           /* 退出k++的BREAK, NOT i++ */
                     }
                     else if (psc->pwShCandi[k] == 0x0000)
                            m++;
              }
       }
       /*Gbk */
       else if ((nXrd >= (nNumSpec + nNumUdc28 + nNumMh + nNumDh + nNumSh)) && 
               (nXrd < (nNumSpec + nNumUdc28 + nNumMh + nNumDh + nNumSh + nNumGbk)) )
       {
              m = nNumSpec + nNumUdc28 + nNumMh + nNumDh + nNumSh;
              for (k = 0; k < psc->nSizGbkCandi; k++)
              {
                     if (m == nXrd)
                     {
                            for (i = 0; psc->pwGbkCandi[k] != 0x0000;  )
                                   pwOneCandi[i++] = psc->pwGbkCandi[k++];
                            nRet = i;
                            break;           /* 退出k++的BREAK, NOT i++ */
                     }
                     else if (psc->pwGbkCandi[k] == 0x0000)
                            m++;
              }
       }
       else
       {
              fprintf(stderr, "nXrd is too Large!! in function GetXrdCandi().\n");
              nRet = 0;
       }
       
       return nRet;
}

Here is the caller graph for this function:

JINT IMPinyinTrans ( JINT pKsThis,
SesGuiElement pSge 
)

Definition at line 194 of file OnKeySym.c.

{
       JINT    i, nTmpRes, nTmp;
       JINT    nF9Yj[9], nYjLen, nMatchMode;
       /*  The following 3 lines were commented to Fix BugID 4165549
       static JINT  nPrevMatchMode = -1;
       static JINT  pnCurChoiceYjNew[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
       static JINT  pnCurChoiceYjOld[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
       */

       nTmpRes = FALSE;
       if (IsEditKeysym(pNextKeysym) == TRUE)
       {
              if (pSge->nPinyinType == KEYLAYMODE_NEWPY)
                     nTmpRes     = OnEditKeysym(pNextKeysym, pSge);
              else if ((pSge->nPinyinType >= 0) && (pSge->nPinyinType <= 2))
                     nTmpRes     = OnEditKeysym_SP(pNextKeysym, pSge, pSge->nPinyinType);
              else
              {
                     fprintf(stderr, "Error nPinyinType Invalid.\n");
                     return FALSE;
              }
              
              /*
              **  Get first nine Yinjie AND 
              **  Process ['a' 'e' 'm' 'n' 'o'] in (nF9Yj[0] ~ nF9Yj[8])
              */
              GetFirst9Yj(pSge->nPrsPyYjCode, nF9Yj, &nYjLen, &nMatchMode);

              for(i = 0; i < nYjLen; i++)
              {
                     if ((nF9Yj[i] & 0x000001FF) == 0)
                            nF9Yj[i] += (450 - 0);
                     else if ((nF9Yj[i] & 0x000001FF) == 80)
                            nF9Yj[i] += (455 - 80);
                     else if ((nF9Yj[i] & 0x000001FF) == 191)
                            nF9Yj[i] += (462 - 191);
                     else if ((nF9Yj[i] & 0x000001FF) == 211)
                            nF9Yj[i] += (463 - 211);
                     else if ((nF9Yj[i] & 0x000001FF) == 237)
                            nF9Yj[i] += (464 - 237);

              }
              for(i = nYjLen; i < 9; i++)
                     nF9Yj[i] = 0;

              /*
              **  NOTICE: pnCurChoiceYjOld[] & pnCurChoiceNew[] start from 0x0800 to avoid confliction
              **          with YinJie Code 0 (a).
              */
              for(i = 0; i < 9; i++)
                     pSge->pnCurChoiceYjNew[i] = 0x0800 + nF9Yj[i];

              /* Must compare nMatchMode also. ...!!! */
              if ((IsIntArrayEqual(pSge->pnCurChoiceYjNew, pSge->pnCurChoiceYjOld, 9) != TRUE) || 
                     (pSge->nPrevMatchMode != nMatchMode))
              {
                     for (i = 0; i < 9; i++)
                            pSge->pnCurChoiceYjOld[i] = pSge->pnCurChoiceYjNew[i];
                     pSge->nPrevMatchMode  = nMatchMode;
                     
                     LookupCiku(nF9Yj, nYjLen, nMatchMode, &(pSge->scSysCandi), &(pSge->ucUdcCandi));
                     
                     pSge->nViewCandiStart   = 0;
                     pSge->nViewCandiEnd     = 0;
                     pSge->nViewPage         = 0;
                     ScrollViewCandiPage(&(pSge->scSysCandi), &(pSge->ucUdcCandi), pSge);

                     if (pSge->nViewCandiStart == 0)
                            pSge->nIconFlag &= (~F_PREVPAGE);
                     else
                            pSge->nIconFlag |= F_PREVPAGE;

                     nTmp  = pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi  +
                             pSge->scSysCandi.nNumShCandi   + 
                            pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi;
                     if(pSge->nGBKMode == GBK_SUPPORTED) nTmp += pSge->scSysCandi.nNumGbkCandi;
                     if (pSge->nViewCandiEnd < nTmp)
                            pSge->nIconFlag |= F_NEXTPAGE;
                     else
                            pSge->nIconFlag &= (~F_NEXTPAGE);
              }
       }
       
       else if (IsPageKeysym(pNextKeysym) == TRUE)
              nTmpRes = OnPageKeysym(pNextKeysym, pSge);
              
       else if (IsSelectKeysym(pNextKeysym) == TRUE)
       {
              if (pSge->nPinyinType == KEYLAYMODE_NEWPY)
                     nTmpRes     = OnSelectKeysym(pNextKeysym, pSge);
              else if ((pSge->nPinyinType >= 0) && (pSge->nPinyinType <= 2))
                     nTmpRes     = OnSelectKeysym_SP(pNextKeysym, pSge);
              else
              {
                     fprintf(stderr, "Error pSge->nPinyinType Invalid.\n");
                     return FALSE;
              }
       }

       return nTmpRes;
}

Here is the call graph for this function:

Here is the caller graph for this function:

VOID InitSge ( SesGuiElement pSgeStruct)

Definition at line 599 of file NewPYLE.c.

{
       JINT    i;
       
       pSgeStruct->nSpRawCaretPos    = 0;

       for (i = 0; i < 40; i++)
              pSgeStruct->pwSpRawPyStr[i]  = 0x0000;
       for (i = 0; i < UONE; i++)
              pSgeStruct->pwSpMixPeStr[i]  = 0x0000;
       for (i = 0; i < UTWO; i++)
              pSgeStruct->pwSpSlctRawPy[i] = 0x0000;
       
       for (i = 0; i < UONE; i++)
       {
              pSgeStruct->pwRawPyStr[i]    = 0x0000;
              pSgeStruct->pwMixPeStr[i]    = 0x0000;
              pSgeStruct->nPrsPyYjCode[i]  = 0;
              pSgeStruct->pwCommit[i]      = 0x0000;
       }
       
       for (i = 0; i < UTWO; i++)
       {
              pSgeStruct->pwPrsPyStr[i]    = 0x0000;
              pSgeStruct->pwPrsMixStr[i]   = 0x0000;
              pSgeStruct->pwSlctHz[i]      = 0x0000;
              pSgeStruct->pwSlctRawPy[i]   = 0x0000;
       }
       
       for (i = 0; i < UHLF; i++)
       {
              pSgeStruct->pwViewPe[i]      = 0x0000;
              pSgeStruct->pwViewCandi[i]   = 0x0000;
       }
       
/*
       pSgeStruct->nPinyinType       = -1;
*/
       pSgeStruct->nPrevKeyLayMode   = pSgeStruct->nKeyLayMode;
/*
       pSgeStruct->nPunctMode        = 0;   
*/
       
       pSgeStruct->nRawCaretPos      = 0;
       pSgeStruct->nViewCaretPos     = 0;
       pSgeStruct->nViewPage         = 0;
       pSgeStruct->nViewPeStart      = 0;
       pSgeStruct->nViewPeEnd        = 0;
       pSgeStruct->nViewCandiStart   = 0;
       pSgeStruct->nViewCandiEnd     = 0;
       pSgeStruct->nSlctSteps        = 0;

       for (i = 0; i < 16; i++)
              pSgeStruct->pwStatus[i]   = 0x0000;
       pSgeStruct->nErrorCode        = 0;

       pSgeStruct->nIconFlag = F_HALFWIDTH | F_SETUP;
       
       InitStructSc(&(pSgeStruct->scSysCandi));
       InitStructUc(&(pSgeStruct->ucUdcCandi));

       /* The following 3 items were added to Fix Bug 4165549: Scott Ma, 12/8, 1998 */
       pSgeStruct->nPrevMatchMode       = -1;
       for (i = 0; i < 9; i++)
       {
              pSgeStruct->pnCurChoiceYjNew[i] = 1;
              pSgeStruct->pnCurChoiceYjOld[i] = 0;
       }
}
JINT IsEditKeysym ( JINT pks)

Definition at line 115 of file KeysymType.c.

{
       JINT   i, nLen;
       
       nLen = 0;
       for (i = 0; (i < SUN_NUM_KEYSYM) && (pks[i] != 0x0L); i++)
              nLen ++;
              
       if (nLen == 0)
              return FALSE;
       
       /*
       **  The following range is fetched from file "IMWantedKey.h"
       **  There maybe some ingoration about "IMXK_KP_xxx". Check it later.
       **
       **  Notice: A Self defined Keysym IMXK_REDRAW_INTERNAL was added! 0xEEEE
       */
       if( (pks[0] == IMXK_Escape)      ||
           (pks[0] == IMXK_quoteright)  ||
           (pks[0] == IMXK_Delete)      ||
           (pks[0] == IMXK_BackSpace)   ||
           (pks[0] == IMXK_Left)        ||
           (pks[0] == IMXK_Right)       ||
           (pks[0] == IMXK_Home)        ||
           (pks[0] == IMXK_End)         ||
           (pks[0] == IMXK_REDRAW_INTERNAL)      ||
           ((pks[0] >= IMXK_a) && (pks[0] <= IMXK_z)) 
         )
              return TRUE;
       return FALSE;
}
JINT IsIntArrayEqual ( JINT pnIntArray1,
JINT pnIntArray2,
JINT  nLen 
)

Definition at line 1103 of file OnKeySym.c.

{
       JINT   i, nFlag;
       
       nFlag = TRUE;
       for(i = 0; i < nLen; i++)
       {
              if(pnInt1[i] != pnInt2[i])
              {
                     nFlag = FALSE;
                     break;
              }
       }
       
       return nFlag;
}

Here is the caller graph for this function:

JINT IsPageKeysym ( JINT pks)

Definition at line 175 of file KeysymType.c.

{
       JINT   i, nLen;
       
       nLen = 0;
       for (i = 0; (i < SUN_NUM_KEYSYM) && (pks[i] != 0x0L); i++)
              nLen ++;
              
       if (nLen == 0)
              return FALSE;
       
       if( (pks[0] == IMXK_minus)      ||
           (pks[0] == IMXK_equal)          ||
           (pks[0] == IMXK_bracketleft)    ||
           (pks[0] == IMXK_bracketright)   ||
           (pks[0] == IMXK_comma)          ||
           (pks[0] == IMXK_MOUSEPREV)      ||
           (pks[0] == IMXK_MOUSENEXT)      ||
           (pks[0] == IMXK_period)         ||
           (pks[0] == IMXK_Return) )
              return TRUE;
       return FALSE;
}

Definition at line 66 of file KeysymType.c.

{
       if (pks[0] == IMXK_ALT_QP_SP)
              return TRUE;
       return FALSE; 
}
JINT IsQuitKeysym ( JINT pks)

Definition at line 58 of file KeysymType.c.

{
       if (pks[0] == IMXK_QUIT_PYIM)
              return TRUE;
       return FALSE; 
}
JINT IsSelectKeysym ( JINT pks)

Definition at line 200 of file KeysymType.c.

{
       JINT   i, nLen;
       
       nLen = 0;
       for (i = 0; (i < SUN_NUM_KEYSYM) && (pks[i] != 0x0L); i++)
              nLen ++;
              
       if (nLen == 0)
              return FALSE;
       
       if( (pks[0] == IMXK_space)  ||
           ((pks[0] >= IMXK_0) && (pks[0] <= IMXK_9)) )
              return TRUE;
       return FALSE;
}
JINT IsValidSpSuite ( CHAR  chSM,
CHAR  chYM,
JINT  nKeyLayMode 
)

Definition at line 2595 of file PyBasic.c.

{
       CHAR    szYjTmp1[10], szYjTmp2[10];
       JINT    nKeyLayYM1, nKeyLayYM2, nKeyLaySM;
       JINT    i, m, nRes;
       JINT    nNullYj[8] = {27, 50, 64, 82, 90, 152, 235, 285};

       assert(((chSM >= 'a') && (chSM <= 'z')) || ((chSM >= 'A') && (chSM <= 'Z')));
       assert(((chYM >= 'a') && (chYM <= 'z')) || ((chYM >= 'A') && (chYM <= 'Z')));

       if ((Lower(chSM) == 'i') || (Lower(chSM) == 'u') || (Lower(chSM) == 'v'))
       {
              nKeyLaySM   = KEYLAYMODE[nKeyLayMode][Lower(chSM) - 'a'] >> 16;
              szYjTmp1[0] = szYjTmp2[0] = YUNMUSTR[nKeyLaySM][0];
              szYjTmp1[1] = szYjTmp2[1] = YUNMUSTR[nKeyLaySM][1];
              szYjTmp1[2] = szYjTmp2[2] = '\0';
              m = 2;    /* length of ShengMu */
       }
       else
       {
              szYjTmp1[0] = szYjTmp2[0] = Lower(chSM);
              szYjTmp1[1] = szYjTmp2[1] = '\0';
              m = 1;    /* length of ShengMu */
       }

       nKeyLayYM1  =  KEYLAYMODE[nKeyLayMode][Lower(chYM) - 'a'] & 0x0000FF;
       nKeyLayYM2  = (KEYLAYMODE[nKeyLayMode][Lower(chYM) - 'a'] & 0x00FF00) >> 8;

       /* ShengMu just before it is [aeo] */
       if ((chSM == 'a') || (chSM == 'e') || (chSM == 'o'))
              szYjTmp1[0]  = szYjTmp2[0] = '\0';

       strcat(szYjTmp1, YUNMUSTR[nKeyLayYM1]);
       nRes = FastMatchYinJieStr(szYjTmp1);

       /* Process for Null Yinjie in "zh" locale. Scott Ma 98-05-13 */
#ifndef _DRAW_IM_WIN_H
       if (strcmp(szLocale, "zh") == 0)
       {
              for (i = 0; i < 8; i++)
              {
                     if (nRes == nNullYj[i])
                     {
                            nRes = -1;
                            break;
                     }
              }
       }
#endif

       if ((nRes >= 0) && (nRes < NUM_YINJIE))
              return TRUE;

       if ((nRes == -1) && (nKeyLayYM2 != 0))
       {
              strcat(szYjTmp2, YUNMUSTR[nKeyLayYM2]);
              nRes = FastMatchYinJieStr(szYjTmp2);

              /* Process for Null Yinjie in "zh" locale. Scott Ma 98-05-13 */
#ifndef _DRAW_IM_WIN_H
              if (strcmp(szLocale, "zh") == 0)
              {
                     for (i = 0; i < 8; i++)
                     {
                            if (nRes == nNullYj[i])
                            {
                                   nRes = -1;
                                   break;
                            }
                     }
              }
#endif

              if ((nRes >= 0) && (nRes < NUM_YINJIE))
                     return TRUE;
       }
       
       return FALSE;
}

Here is the caller graph for this function:

JINT IsWantedKeysym ( JINT pks)

Definition at line 74 of file KeysymType.c.

{
       JINT   i, nLen;
       
       nLen = 0;
       for (i = 0; (i < SUN_NUM_KEYSYM) && (pks[i] != 0x0L); i++)
              nLen ++;
              
       if (nLen == 0)
              return FALSE;
       
       /*
       **  The following range is fetched from file "IMKeyMap.h"
       **  There maybe some ingoration about "IMXK_KP_xxx". Check it later.
       **
       **  Notice: Internal pesudo_keysym REDRAW_INTERNAL was added !!!! 0xEEEE
       */
       if( ( pks[0] == IMXK_BackSpace)     ||
           ( pks[0] == IMXK_Linefeed)   ||
           ( pks[0] == IMXK_Return)     ||
           ( pks[0] == IMXK_Escape)     ||
           ( pks[0] == IMXK_Multi_key)  ||
           ( pks[0] == IMXK_MOUSEPREV)  ||
           ( pks[0] == IMXK_MOUSENEXT)  ||
           ( pks[0] == IMXK_Clear)        ||
           ((pks[0] >= IMXK_Home) && (pks[0] <= IMXK_Begin))           ||
           ((pks[0] >= IMSunXK_AltGraph) && (pks[0] <= IMXK_KP_Space)) ||
           ((pks[0] >= IMXK_KP_Home) && (pks[0] <= IMXK_KP_Begin))     ||
           ( pks[0] == IMXK_KP_Delete)  ||
           ((pks[0] >= IMXK_KP_Multiply) && (pks[0] <= IMXK_KP_9))     ||
           ((pks[0] >= IMXK_Shift_L) && (pks[0] <= IMXK_Alt_R))        ||
           ((pks[0] >= IMXK_space) && (pks[0] <= IMXK_asciitilde))     ||
           ( pks[0] == IMXK_Delete)        ||
           ( pks[0] == IMXK_REDRAW_INTERNAL)     
         )
              return TRUE;
              
       return FALSE;
}
VOID Jword2Uchar ( JWORD pwJword,
UCHAR szUch,
JINT  nMaxLen 
)

Definition at line 275 of file Jword.c.

{
       JINT     i, j;
       
       j = 0;
       for(i = 0; i < nMaxLen; i++)
       {
              if(pwJword[i] >= 0x0100)           /* OR 0x8140: First char defined in GBK */
              {
                     szUch[j++] = (UCHAR)((pwJword[i] & 0xFF00) >> 8);
                     szUch[j++] = (UCHAR)(pwJword[i] & 0x00FF);
              }
              else
                     szUch[j++] = (UCHAR)(pwJword[i] & 0x00FF);
       }
}
VOID JwordInfo ( JWORD pwJwordArray,
JINT  nMaxLen 
)

Definition at line 89 of file Jword.c.

{
       JINT    i, j, nLen;
       JWORD   wTmp;
       UCHAR   szStr[1024];
       
       nLen = JwordValidLen(pwJwordArray, nMaxLen);

       memset(szStr, '\0', 1024);

       i = j = 0;
       for (i = 0; i < nLen; i++)
       {
              wTmp = *(pwJwordArray + i);
              if ( (wTmp & 0xFF00) > 0)
              {
                     *(szStr + j) = (UCHAR)(( wTmp & 0xFF00) >> 8);
                     j++;
                     
                     *(szStr + j) = (UCHAR)(wTmp & 0x00FF);
                     j++;
              }
              else if ((wTmp < 0x0080) && (wTmp != 0x0009))
              {
                     *(szStr + j)  = (UCHAR)(wTmp & 0x00FF);
                     j++;
              }
       }
       
       fprintf (stderr, "%d  %s\n", j, szStr);
/*     fprintf (stderr, "%d  %s\n", j, RecovDyz2244(szStr));   */
}
JINT JwordStrStrReplace ( JWORD pwDst,
JWORD pwSrc1,
JWORD pwSrc2,
JINT  nLenSrc2 
)

Definition at line 135 of file Jword.c.

{
       JINT   i, j, k, nLenDst, nLenSrc1, nFoundFlag, nFirstAddr;
       
       nFoundFlag = 0;
       nLenDst    = JwordValidLen(pwDst, 256);
       nLenSrc1   = JwordValidLen(pwSrc1, 80);
       
       /*
       **  Find the startup offset in PwDst.
       **  THE FOLLOWING CODE TO BE TESTED TO REPLACE ABOVE CODE!! MXL 97-12-06
       */
       i = j = k = 0;
       for(i = 0; (i < nLenDst) && (j < nLenSrc1); i++)
       {
              if (pwDst[i] == pwSrc1[j])
                     j++;
              else
                     j = 0;
       }

       if (j == nLenSrc1)
       {
#ifdef _DEBUG
              /* If there is a SPACE char in the end of found pwSrc1 in pwDst. */
              if ( pwDst[i] == (JWORD)' ')
              {
                     fprintf (stderr, "JwordStrStrReplace():  THERE IS A SPACE!\n");
                     nLenSrc1 += 1;
              }
#endif

              /* 
              **  NOTES: Don't change the sequence of the following exchange and 
              **  the FOR sentence sequence 
              */
              nFirstAddr = i - j;
              if (nLenSrc1 >= nLenSrc2)
              {
                     for (i = nFirstAddr; i < (nFirstAddr + nLenSrc2); i++)
                            pwDst[i]  = pwSrc2[i - nFirstAddr];
                     for (i = (nFirstAddr + nLenSrc2); i < (nLenDst - (nLenSrc1 - nLenSrc2)); i++)
                            pwDst[i]  = pwDst[i + (nLenSrc1 - nLenSrc2)];
                     for (i = (nLenDst - (nLenSrc1 - nLenSrc2)); i < 256; i++)
                            pwDst[i]  = 0x0000;
              }
              else if (nLenSrc1 < nLenSrc2)
              {
                     for (i = (nLenDst + (nLenSrc2 - nLenSrc1)); i < 256; i++)
                            pwDst[i]  = 0x0000;
                     for (i = (nFirstAddr + nLenSrc2); i < (nLenDst + nLenSrc2 - nLenSrc1); i++)
                            pwDst[i]  = pwDst[i - (nLenSrc2 - nLenSrc1)];
                     for (i = nFirstAddr; i < (nFirstAddr + nLenSrc2); i++)
                            pwDst[i]  = pwSrc2[i - nFirstAddr];
              }
              return TRUE;
       }
       else
       {
#ifdef _DEBUG
              fprintf(stderr, "Cannot find string to be replaced in pwdst. JwordStrStrReplace().\n");
#endif
              return FALSE;
       }
}
JINT JwordValidLen ( JWORD pwJwordArray,
JINT  nMaxLen 
)

Definition at line 206 of file Jword.c.

{
       JINT   i, nValidLen;
       
       i = 0;
       nValidLen = 0;
       while ((i < nMaxLen) && (*(pwJwordArray + i) != 0))
       {
              i++;
              nValidLen++;
       }
              
       return nValidLen;
}
VOID ListCandiInfo ( SysCandi psc,
UdcCandi puc 
)

Definition at line 1442 of file OnKeySym.c.

{
       JINT    i, k, m;
       JWORD   wCandi[10];
       UCHAR   szCandi[20];
       
       for(i = 0; i < psc->nLenYj; i++)
       {
              if ((psc->nOrgYj[i] >= 450) && (psc->nOrgYj[i] <= 475) )
                     printf("%s ", SHENGMUSTR[psc->nOrgYj[i] - 450]);
              else if ((psc->nOrgYj[i] >= 0) && (psc->nOrgYj[i] < 415) )
                     printf("%s ", YINJIESTR_CSZ[psc->nOrgYj[i]]);
       }
       printf("\n\n");

       memset (wCandi,  '\0', 10 * sizeof(JWORD));
       memset (szCandi, '\0', 20);
       
       /* SpecCandi */
       printf("[SpecCandi]\n");
       i = m = 0;
       for (k = 0; k < puc->nNumSpecCandi; k++)
       {
              m = 1;
              Jword2Uchar(RecovDyzNWord2244(&(puc->pwSpecCandi[k]), m), szCandi, m);
              printf("%s\n", szCandi);

              memset (szCandi, '\0', 20);
       }
       printf("\n");

       /* Udc28Candi */
       printf("[Udc28Candi]\n");
       i = m = 0;
       for (k = 1; k < puc->nNumUdc28Candi; k++)
       {
              if (puc->pwUdc28Candi[k] == 0x0000)
              {
                     Jword2Uchar(RecovDyzNWord2244(wCandi, m), szCandi, m);
                     printf("%s\n", szCandi);

                     i++;
                     k++;
                     m = 0;
                     memset (wCandi, '\0', 10 * sizeof(JWORD));
                     memset (szCandi, '\0', 20);
              }
              else
                     wCandi[m++] = puc->pwUdc28Candi[k];
       }
       printf("\n");
       
       /* MhCandi */
       printf("[MhCandi]\n");
       i = m = 0;
       for(k = 1; i < psc->nNumMhCandi; k++)
       {
              if (psc->pwMhCandi[k] == 0x0000)
              {
                     Jword2Uchar(RecovDyzNWord2244(wCandi, m), szCandi, m);
                     printf("%s\n", szCandi);

                     i++;
                     k++;
                     m = 0;
                     memset (wCandi, '\0', 10 * sizeof(JWORD));
                     memset (szCandi, '\0', 20);
              }
              else
                     wCandi[m++] = psc->pwMhCandi[k];
       }
       printf("\n");
       
       /* DhCandi */
       printf("[DhCandi]\n");
       i = m = 0;
       for(k = 1; i < psc->nNumDhCandi; k++)
       {
              if (psc->pwDhCandi[k] == 0x0000)
              {
                     Jword2Uchar(RecovDyzNWord2244(wCandi, m), szCandi, m);
                     printf("%s\n", szCandi);

                     i++;
                     k++;
                     m = 0;
                     memset (wCandi, '\0', 10 * sizeof(JWORD));
                     memset (szCandi, '\0', 20);
              }
              else
                     wCandi[m++] = psc->pwDhCandi[k];
       }
       printf("\n");
       
       /* ShCandi */
       printf("[ShCandi]\n");
       i = m = 0;
       for(k = 0; i < psc->nNumShCandi; k++)
       {
              if (psc->pwShCandi[k] == 0x0000)
              {
                     Jword2Uchar(RecovDyzNWord2244(wCandi, m), szCandi, m);
                     printf("%s\n", szCandi);

                     i++;
                     m = 0;
                     memset (wCandi, '\0', 10 * sizeof(JWORD));
                     memset (szCandi, '\0', 20);
              }
              else
                     wCandi[m++] = psc->pwShCandi[k];
       }
       printf("\n");

       /* GbkCandi */
       printf("[GbkCandi]\n");
       i = m = 0;
       for(k = 0; i < psc->nNumGbkCandi; k++)
       {
              if (psc->pwGbkCandi[k] == 0x0000)
              {
                     Jword2Uchar(RecovDyzNWord2244(wCandi, m), szCandi, m);
                     printf("%s\n", szCandi);

                     i++;
                     m = 0;
                     memset (wCandi, '\0', 10 * sizeof(JWORD));
                     memset (szCandi, '\0', 20);
              }
              else
                     wCandi[m++] = psc->pwGbkCandi[k];
       }
       printf("\n\n");
}

Here is the call graph for this function:

JINT LookupCiku ( JINT pnOrgYj,
JINT  nLenYj,
JINT  nMatchMode,
SysCandi psc,
UdcCandi puc 
)

Definition at line 930 of file CikuOper.c.

{
       JINT    nSize, i;

       nSize = 0;

       InitStructSc(psc);
       InitStructUc(puc);
       
       /* 
       ** Set the content of psc->nOrgYj and pscYj->nLenYj    AND 
       ** Filter those Yjcode which start with a [']. 
       */
       for(i = 0; i < nLenYj; i++)
       {
              psc->nOrgYj[i]  = pnOrgYj[i];
              pnOrgYj[i]     &= 0x0000FFFF;
       }
       psc->nLenYj  = nLenYj;
       
       EnumCandi(pnOrgYj, nLenYj, psc, puc, &nSize, nMatchMode, LU_CANDI_CALC);
       
       psc->pwMhCandi    = (JWORD*)malloc((psc->nSizMhCandi  + MALIGN) * sizeof(JWORD));
       psc->pwDhCandi    = (JWORD*)malloc((psc->nSizDhCandi  + MALIGN) * sizeof(JWORD));
       psc->pwShCandi    = (JWORD*)malloc((psc->nSizShCandi  + MALIGN) * sizeof(JWORD));
       psc->pwGbkCandi   = (JWORD*)malloc((psc->nSizGbkCandi + MALIGN) * sizeof(JWORD));
       puc->pwUdc28Candi = (JWORD*)malloc((puc->nSizUdc28Candi + MALIGN) * sizeof(JWORD));

       if ((psc->pwMhCandi == NULL)  || (psc->pwDhCandi == NULL) || (psc->pwShCandi == NULL) || 
              (psc->pwGbkCandi == NULL) || (puc->pwUdc28Candi == NULL) )
       {
              fprintf(stderr, "Error!! Failed to Malloc() in Function LookupCiku().\n");
              return FALSE;
       }

       memset(psc->pwMhCandi,  '\0', (psc->nSizMhCandi  + MALIGN) * sizeof(JWORD));
       memset(psc->pwDhCandi,  '\0', (psc->nSizDhCandi  + MALIGN) * sizeof(JWORD));
       memset(psc->pwShCandi,  '\0', (psc->nSizShCandi  + MALIGN) * sizeof(JWORD));
       memset(psc->pwGbkCandi, '\0', (psc->nSizGbkCandi + MALIGN) * sizeof(JWORD));
       memset(puc->pwUdc28Candi, '\0', (puc->nSizUdc28Candi + MALIGN) * sizeof(JWORD));
       
       EnumCandi(pnOrgYj, nLenYj, psc, puc, &nSize, nMatchMode, LU_CANDI_WRITE);
       
       /* Additional Process for Spec Hanzi Candi, MXL 98.01.12 */
       if (0 == (psc->nNumMhCandi + psc->nNumDhCandi + puc->nNumUdc28Candi))
              puc->nNumSpecCandi = 0;
       
       /* Sort Candidates in structure SysCandi and UdcCandi by Frequence */
       SortCandi(psc, puc);
       
       return TRUE;
}
JINT OnEditKeysym ( JINT pNextKeysym,
SesGuiElement pSge 
)

Definition at line 298 of file OnKeySym.c.

{
       JINT    nLen, nLenRaw, i, j, k, nTmp;

       JINT    nViewPixWid, nTmpWid;
       nViewPixWid = WIN_W - 61;   /* Here 59? 61? Is Accurate, with 9 indent in left!!! */
       
       nLen    = JwordValidLen (pSge->pwMixPeStr, 256);
       nLenRaw = JwordValidLen (pSge->pwRawPyStr, 256);

       nTmpWid = 0;

       if (pNextKeysym[0] == IMXK_Escape)
       {
              InitSge(pSge);
              goto LABEL0002;
       }

       else if( (pNextKeysym[0] == IMXK_quoteright) && 
              ( (pSge->pwMixPeStr[pSge->nRawCaretPos] == IMVXK_QUOTER) || 
              ( (pSge->nRawCaretPos > 0) && (pSge->pwMixPeStr[pSge->nRawCaretPos - 1] == IMVXK_QUOTER) )))
       {
#ifdef _DRAW_IM_WIN_H
              XBell (pDspIme, 100);
#endif
              goto LABEL0002;
       }

       else if (((pNextKeysym[0] >= IMXK_a) && (pNextKeysym[0] <= IMXK_z)) || (pNextKeysym[0] == IMXK_quoteright))
       {
              if ( (nLen >= 222) || (nLenRaw >= 222)  ||
                   ((nLen == 0) && 
                    ((pNextKeysym[0] == IMXK_i) || (pNextKeysym[0] == IMXK_u) || (pNextKeysym[0] == IMXK_v))) )
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002;
              }
              
              for (i = (nLen - 1); i >= pSge->nRawCaretPos; i--)
                     pSge->pwMixPeStr[i + 1] = pSge->pwMixPeStr[i];
                     
              pSge->pwMixPeStr[pSge->nRawCaretPos] = (JWORD)pNextKeysym[0];
              pSge->pwMixPeStr[nLen + 1] = 0x0000;
              (pSge->nRawCaretPos)++;
              nLen += 1;
              
              goto LABEL0001;
       }

       else if (pNextKeysym[0] == IMXK_Delete)
       {
              if (pSge->nRawCaretPos == nLen)
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002;
              }
              else
              {
                     for (i = pSge->nRawCaretPos; i < nLen; i++)
                            pSge->pwMixPeStr[i] = pSge->pwMixPeStr[i + 1];
                     pSge->pwMixPeStr[nLen] = 0;
                     for (k = nLen; k < UONE; k++)
                            pSge->pwMixPeStr[k] = 0x0000;
                     nLen -= 1;
                     
                     /* TWO [']['] connected! */
                     j = pSge->nRawCaretPos;
                     if ((j > 0) && (pSge->pwMixPeStr[j - 1] == pSge->pwMixPeStr[j]) && (pSge->pwMixPeStr[j] == '\''))
                     {
                            for (i = (pSge->nRawCaretPos) - 1; i < nLen; i++)
                                   pSge->pwMixPeStr[i] = pSge->pwMixPeStr[i + 1];
                            pSge->pwMixPeStr[nLen] = 0;
                            for (k = nLen; k < 256; k++)
                                   pSge->pwMixPeStr[k] = 0;
                            nLen -= 1;
                     }
                     
                     /* pSge->nRawCaretPos remain previous value */
                     goto LABEL0001;
              }
       }

       else if (pNextKeysym[0] == IMXK_BackSpace)
       {
              if ((pSge->nRawCaretPos == 0) || (nLen == 0))
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002;
              }
              else if (pSge->pwMixPeStr[(pSge->nRawCaretPos) - 1] >= 0x8140)   /* Chracter before Caret is Hanzi */
              {
                     RestoreHzToPy(pSge, PYIM_RESTORE_LAST);
                     nLen = JwordValidLen(pSge->pwMixPeStr, 256);
                     
                     j = 0;
                     for (i = 0; i < nLen; i++)
                            if (pSge->pwMixPeStr[i] >= 0x8140)
                                   j ++;
                     pSge->nRawCaretPos = j;
                     
                     if (pSge->nRawCaretPos <= pSge->nViewPeStart)
                            pSge->nViewPeStart = pSge->nRawCaretPos - _MIN(3, pSge->nRawCaretPos);

                     goto LABEL0001;
              }
              else
              {
                     for (i = (pSge->nRawCaretPos) - 1; i < (nLen - 1); i++)
                            pSge->pwMixPeStr[i] = pSge->pwMixPeStr[i + 1];
                     pSge->pwMixPeStr[nLen - 1] = 0;
                     nLen -= 1;
                     for (k = nLen; k < 256; k++)
                            pSge->pwMixPeStr[k] = 0;
                     (pSge->nRawCaretPos)--;

                     /* TWO [']['] connected! */
                     j = pSge->nRawCaretPos;
                     if ((j > 0) && (pSge->pwMixPeStr[j - 1] == pSge->pwMixPeStr[j]) 
                         && (pSge->pwMixPeStr[j] == '\''))
                     {
                            for (i = (pSge->nRawCaretPos) - 1; i < nLen; i++)
                                   pSge->pwMixPeStr[i] = pSge->pwMixPeStr[i + 1];
                            pSge->pwMixPeStr[nLen] = 0;
                            for (k = nLen; k < 256; k++)
                                   pSge->pwMixPeStr[k] = 0;
                            nLen -= 1;
                     }

                     if (pSge->nRawCaretPos <= pSge->nViewPeStart)
                            pSge->nViewPeStart = pSge->nRawCaretPos - _MIN(3, pSge->nRawCaretPos);

                     goto LABEL0001;
              }
       }

       else if (pNextKeysym[0] == IMXK_Left)
       {
              if ((pSge->nRawCaretPos == 0) || (nLen == 0))
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002;
              }
              else if (pSge->pwMixPeStr[(pSge->nRawCaretPos) - 1] >= 0x8140)
              {
                     RestoreHzToPy(pSge, PYIM_RESTORE_LAST);
                     nLen = JwordValidLen(pSge->pwMixPeStr, 256);
                            
                     j = 0;
                     for (i = 0; i < nLen; i++)
                            if (pSge->pwMixPeStr[i] >= 0x8140)
                                   j ++;
                     pSge->nRawCaretPos = j;
                     
                     if (pSge->nRawCaretPos <= pSge->nViewPeStart)
                            pSge->nViewPeStart = pSge->nRawCaretPos - _MIN(3, pSge->nRawCaretPos);
                                   
                     goto LABEL0001;
              }
              else 
              {
                     (pSge->nRawCaretPos)--;
                     if (pSge->nRawCaretPos <= pSge->nViewPeStart)
                            pSge->nViewPeStart = pSge->nRawCaretPos - _MIN(3, pSge->nRawCaretPos);
                                   
                     goto LABEL0001;
              }
       }

       else if (pNextKeysym[0] == IMXK_Right)
       {
              if (pSge->nRawCaretPos == nLen)
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002;
              }
              else
              {
                     (pSge->nRawCaretPos)++;
                     goto LABEL0001;                    
              }
       }

       else if (pNextKeysym[0] == IMXK_Home)
       {
              RestoreHzToPy(pSge, PYIM_RESTORE_ALL);
              nLen = JwordValidLen(pSge->pwMixPeStr, 256);

              pSge->nRawCaretPos  = 0;
              pSge->nViewCaretPos = 0;
              pSge->nViewPeStart  = 0;
              
              goto LABEL0001;
       }

       else if (pNextKeysym[0] == IMXK_End)
       {
              pSge->nRawCaretPos = nLen;
              goto LABEL0001;
       }
       
       /*
       ** This judgement is added to process Selection Action or 
       ** Backspace/Home/LeftArrow to existing Hanzi 
       */
       else if (pNextKeysym[0] == IMXK_REDRAW_INTERNAL)
       {
              nTmp = JwordValidLen(pSge->pwSlctHz, 512);
              k = 0;
              for (i = 0; i < nTmp; i++)
                     if (pSge->pwSlctHz[i] >= 0x8140)
                            k++;
              
              pSge->nViewPeStart = _MAX(0, k - 8);

              goto LABEL0001;
       }
       
       else
              goto LABEL0002;

LABEL0001:
       {
              /* Prase pwMixPeStr and fill other related pSge field */
              PraseMixRawPe(pSge);
              
              nTmpWid = PixWidBetween (pSge->pwPrsMixStr, pSge->nViewPeStart, pSge->nRawCaretPos);
              if (nTmpWid > nViewPixWid)
              {
                     for (i = pSge->nViewPeStart; nTmpWid > nViewPixWid; i++)
                            nTmpWid = PixWidBetween (pSge->pwPrsMixStr, i, pSge->nRawCaretPos);
                     
                     pSge->nViewPeStart = i - 1;
                     pSge->nViewPeEnd   = pSge->nRawCaretPos;
              }
              
              nTmpWid = 0;
              for (i = pSge->nViewPeStart; (i <= nLen) && (nTmpWid <= nViewPixWid); i++)
                     nTmpWid = PixWidBetween (pSge->pwPrsMixStr, pSge->nViewPeStart, i);
              
              pSge->nViewPeEnd = i - 1;
              GetDspPEandCaretPos (pSge);
       }

LABEL0002:    
       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT OnEditKeysym_SP ( JINT pNextKeysym,
SesGuiElement pSge,
JINT  nKeyLayMode 
)

Definition at line 1584 of file OnKeySym.c.

{
       JINT    nLen, nLenRaw, nLenPrs, i, j, k, nTmp;
       JINT    nLenSp, nLenSpRaw;
       JINT    nTypeSpYj1, nTypeSpYj2, nTypeSpYj01, nTypeSpYj02, nTypeSpYj002, nTypeSpYj0002;

       JINT    nViewPixWid, nTmpWid;
       JINT    nPrsCaretPos;
       nViewPixWid = WIN_W - 61;   /* Here 59? 61? Is Accurate, with 9 indent in left!!! */
       
       nLenSp    = JwordValidLen (pSge->pwSpMixPeStr, 256);
       nLenSpRaw = JwordValidLen (pSge->pwSpRawPyStr, 40);

       nLen      = JwordValidLen (pSge->pwMixPeStr, 256);
       nLenRaw   = JwordValidLen (pSge->pwRawPyStr, 256);

       nTmpWid = 0;

       nTypeSpYj1 = nTypeSpYj2 = nTypeSpYj01 = nTypeSpYj02 = nTypeSpYj002 = nTypeSpYj0002 = -1;
       
       nTypeSpYj01   = TypeOfSpMixWord(pSge->pwSpMixPeStr, (pSge->nSpRawCaretPos - 2), nKeyLayMode);
       nTypeSpYj1    = TypeOfSpMixWord(pSge->pwSpMixPeStr, (pSge->nSpRawCaretPos - 1), nKeyLayMode);
       nTypeSpYj2    = TypeOfSpMixWord(pSge->pwSpMixPeStr, pSge->nSpRawCaretPos, nKeyLayMode);
       nTypeSpYj02   = TypeOfSpMixWord(pSge->pwSpMixPeStr, (pSge->nSpRawCaretPos + 1), nKeyLayMode);
       nTypeSpYj002  = TypeOfSpMixWord(pSge->pwSpMixPeStr, (pSge->nSpRawCaretPos + 2), nKeyLayMode);
       nTypeSpYj0002 = TypeOfSpMixWord(pSge->pwSpMixPeStr, (pSge->nSpRawCaretPos + 3), nKeyLayMode);
       
       if (pNextKeysym[0] == IMXK_Escape)
       {
              InitSge(pSge);
              goto LABEL0002SP;
       }

       /* QuoteRight is omitted in ShuangPin Model. MXL */
       else if (pNextKeysym[0] == IMXK_quoteright)
       {
#ifdef _DRAW_IM_WIN_H
              XBell (pDspIme, 100);
#endif
              goto LABEL0002SP;
       }

       else if ( ((pNextKeysym[0] >= IMXK_a) && (pNextKeysym[0] <= IMXK_z)) ||
                 ((pNextKeysym[0] >= IMXK_A) && (pNextKeysym[0] <= IMXK_Z)) )
       {
              if ((nLen >= 222) || (nLenRaw >= 222) || (nLenSp >= 30) || (nLenSpRaw >= 30))
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002SP;
              }
              
              if (nTypeSpYj1 == SPYJ_YUNMU)
              {
                     /* append [v] to [hw#rf#mn] to form [hw#rf#mn#v] ===> INVALID */
                     /* Insert [v] to [hw#rf#mn] to form [hw#rf#v#mn] ===> NUMSIGN */
                     /* Insert [v] to [hw#rf$mn] to form [hw#rf#v$mn] ===> DOLLAR  */
                     /* Insert [v] to [hw#rf'mn] to form [hw#rf#v'mn] ===> QUOTE   */
                     if ((nTypeSpYj2 == SPYJ_INVALID) || (nTypeSpYj2 == SPYJ_NUMSIGN) ||
                            (nTypeSpYj2 == SPYJ_DOLLAR) || (nTypeSpYj2 == SPYJ_QUOTE))
                     {
                            /* Insert [#v] to Here!! */
                            for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                   pSge->pwSpMixPeStr[i + 2]    = pSge->pwSpMixPeStr[i];

                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)'#';
                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 1] = (JWORD)pNextKeysym[0];
                            pSge->pwSpMixPeStr[nLenSp + 2]               = 0x0000;
                            (pSge->nSpRawCaretPos) += 2;
                     }
                     else
                     {
                            assert((nTypeSpYj2 != SPYJ_SHENGMU) && (nTypeSpYj2 != SPYJ_YUNMU));
                     }
              }
              else if (nTypeSpYj1 == SPYJ_SHENGMU)
              {
                     /* append [s] to [hw#rf#mn#v] to form [hw#rf#mn#vs] or [hw#rf#mn#v#s] ==> INVALID */
                     /* Insert [s] to [hw#rf#v#mn] to form [hw#rf#vs#mn] or [hw#rf#v#s#mn] ==> NUMSIGN */
                     /* Insert [s] to [hw#rf#v'mn] to form [hw#rf#vs'mn] or [hw#rf#v#s'#mn]==> QUOTE   */
                     if ((nTypeSpYj2 == SPYJ_INVALID) || (nTypeSpYj2 == SPYJ_NUMSIGN) 
                            || (nTypeSpYj2 == SPYJ_QUOTE))
                     {
                            assert(pSge->nSpRawCaretPos >= 1);
                            if (IsValidSpSuite((CHAR)pSge->pwSpMixPeStr[pSge->nSpRawCaretPos - 1], 
                                   (CHAR)pNextKeysym[0], nKeyLayMode) == TRUE)
                            {
                                   /* Insert [s] */
                                   for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                          pSge->pwSpMixPeStr[i + 1]    = pSge->pwSpMixPeStr[i];
                                   
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                                   pSge->pwSpMixPeStr[nLenSp + 1]               = 0x0000;
                                   (pSge->nSpRawCaretPos) += 1;
                            }
                            else
                            {
                                   /* Insert [#v] Here */
                                   for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                          pSge->pwSpMixPeStr[i + 2]    = pSge->pwSpMixPeStr[i];

                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)'#';
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 1] = (JWORD)pNextKeysym[0];
                                   pSge->pwSpMixPeStr[nLenSp + 2]               = 0x0000;
                                   (pSge->nSpRawCaretPos) += 2;
                            }
                     }
                     /* Insert [s] to [hw#rf#v$mn] to form [hw#rf#vs#mn] or [hw#rf#v$s#mn] */
                     else if (nTypeSpYj2 == SPYJ_DOLLAR)
                     {
                            assert(pSge->nSpRawCaretPos >= 1);
                            if (IsValidSpSuite((CHAR)pSge->pwSpMixPeStr[pSge->nSpRawCaretPos - 1], 
                                   (CHAR)pNextKeysym[0], nKeyLayMode) == TRUE)
                            {
                                   /* replace [$] with [s#] and increase CaretPos by 1 */
                                   for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                          pSge->pwSpMixPeStr[i + 1]    = pSge->pwSpMixPeStr[i];
                                   
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 1] = (JWORD)'#';
                                   pSge->pwSpMixPeStr[nLenSp + 1]               = 0x0000;
                                   (pSge->nSpRawCaretPos) += 1;
                            }
                            else
                            {
                                   /* Insert [s#] after [$], NOT AFTER [v] */
                                   for (i = (nLenSp - 1); i >= (pSge->nSpRawCaretPos + 1); i--)
                                          pSge->pwSpMixPeStr[i + 2]    = pSge->pwSpMixPeStr[i];

                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 1] = (JWORD)pNextKeysym[0];
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 2] = (JWORD)'#';
                                   pSge->pwSpMixPeStr[nLenSp + 2]               = 0x0000;
                                   (pSge->nSpRawCaretPos) += 2;
                            }
                     }
                     /* Insert [s] to [hw#rf#vw#mn] to form [hw#rf#vs#mn] or [hw#rf#v#s#mn] */
                     else if (nTypeSpYj2 == SPYJ_YUNMU)
                     {
                            assert(pSge->nSpRawCaretPos >= 1);
                            if (IsValidSpSuite((CHAR)pSge->pwSpMixPeStr[pSge->nSpRawCaretPos - 1], 
                                   (CHAR)pNextKeysym[0], nKeyLayMode) == TRUE)
                            {
                                   /* Replace [w] with [s], move Caret to the next position */
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                                   (pSge->nSpRawCaretPos) += 1;
                            }
                            else
                            {
                                   /* Replace [w] with [#s], add Caret by 2 */
                                   for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                          pSge->pwSpMixPeStr[i + 1]    = pSge->pwSpMixPeStr[i];
                                   
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)'#';
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 1] = (JWORD)pNextKeysym[0];
                                   pSge->pwSpMixPeStr[nLenSp + 1]               = 0x0000;
                                   (pSge->nSpRawCaretPos) += 2;
                            }
                     }
                     else   /* nTypeSpYj2 == SPYJ_SHENGMU */
                     {
                            assert(nTypeSpYj2 != SPYJ_SHENGMU);
                     }
              }
              /* From the header of SpStr part of this pwSpMixPeStr */
              else if (nTypeSpYj1 == SPYJ_INVALID)
              {
                     if (nTypeSpYj2 == SPYJ_SHENGMU)    /* Insert [v] before [hw#rf#mn] to form [v#hw#rf#mn] */
                     {
                            /* Insert [v#], add CaretPos by 1 */
                            for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                   pSge->pwSpMixPeStr[i + 2]    = pSge->pwSpMixPeStr[i];
                            
                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 1] = (JWORD)'#';
                            pSge->pwSpMixPeStr[nLenSp + 2]               = 0x0000;
                            (pSge->nSpRawCaretPos) += 1;
                     }
                     else if (nTypeSpYj2 == SPYJ_QUOTE) /* Insert [v] before ['hw#rf#mn] to form [v'hw#rf#mn] */
                     {
                            /* Insert [v], add CaretPos by 1 */
                            for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                   pSge->pwSpMixPeStr[i + 1]    = pSge->pwSpMixPeStr[i];
                                   
                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                            pSge->pwSpMixPeStr[nLenSp + 1]               = 0x0000;
                            (pSge->nSpRawCaretPos) += 1;
                     }
                     else if (nTypeSpYj2 == SPYJ_INVALID)  /* Insert a single [v] to form [v] */
                     {
                            /* Only a single [v] in pwSpMixPeStr */
                            assert((nLenSp == 0) && (pSge->nSpRawCaretPos == 0));

                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                            pSge->pwSpMixPeStr[nLenSp + 1]               = 0x0000;
                            (pSge->nSpRawCaretPos) += 1;
                     }
                     else
                     {
                            assert((nTypeSpYj2 != SPYJ_YUNMU) && (nTypeSpYj2 != SPYJ_NUMSIGN) && (nTypeSpYj2 != SPYJ_DOLLAR));
                     }
              }
              else if (nTypeSpYj1 == SPYJ_QUOTE)
              {
                     if (nTypeSpYj2 == SPYJ_INVALID)   /* Append [v] to [hw#rf'] to form [hw#rf'v] */
                     {
                            /* Because it means that Caret is at the end of pwSpMixPeStr */
                            assert(nLenSp == pSge->nSpRawCaretPos);

                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                            pSge->pwSpMixPeStr[nLenSp + 1]               = 0x0000;
                            (pSge->nSpRawCaretPos) += 1;
                     }
                     else if (nTypeSpYj2 == SPYJ_SHENGMU)   /* Insert [s] to [hw#rf'v#mn] to form [hw#rf's#v#mn] */
                     {
                            /* Insert [s#], add CaretPos by 1 */
                            for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                                   pSge->pwSpMixPeStr[i + 2]    = pSge->pwSpMixPeStr[i];
                            
                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos]     = (JWORD)pNextKeysym[0];
                            pSge->pwSpMixPeStr[pSge->nSpRawCaretPos + 1] = (JWORD)'#';
                            pSge->pwSpMixPeStr[nLenSp + 2]               = 0x0000;
                            (pSge->nSpRawCaretPos) += 1;
                     }
                     else
                     {
                            /* nTypeSpYj2 should not be SPYJ_NUMSIGN   SPYJ_DOLLAR   SPYJ_YUNMU */
                            assert(0);
                     }
              }
              else if ((nTypeSpYj1 == SPYJ_NUMSIGN) || (nTypeSpYj1 == SPYJ_DOLLAR))
              {
                     /* Error condition for this UI design. For _DEBUG Only */
                     printf ("Error: Caret been Moved to the end of SPYJ_NUMSIGN or SPYJ_DOLLAR.\n");
              }
              
              /*********
              for (i = (nLenSp - 1); i >= pSge->nSpRawCaretPos; i--)
                     pSge->pwSpMixPeStr[i + 1]    = pSge->pwSpMixPeStr[i];
              
              pSge->pwSpMixPeStr[pSge->nSpRawCaretPos] = (JWORD)pNextKeysym[0];
              pSge->pwSpMixPeStr[nLen + 1]             = 0x0000;
              (pSge->nSpRawCaretPos)++;
              ********/

              /* Convert SpMix to QuanPinMix, include nSpRawCaretPos and nRawCaretPos */
              SpMix2QpMix(pSge->pwSpMixPeStr, pSge->pwMixPeStr, pSge->nSpRawCaretPos, &(pSge->nRawCaretPos), nKeyLayMode);
              nLenSp    = JwordValidLen (pSge->pwSpMixPeStr, 256);
              nLen      = JwordValidLen (pSge->pwMixPeStr, 256);
              
              goto LABEL0001SP;
       }

       else if (pNextKeysym[0] == IMXK_Delete)
       {
              if ((pSge->nRawCaretPos == nLen) || (pSge->nSpRawCaretPos == nLenSp))
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002SP;
              }
              else
              {
                     /*
                     **  If to be deleted is a ShengMu, try to Delete a more YunMu also, and delete
                     **  SPYJ_NUMSIGN or SPYJ_DOLLAR also.
                     */
                     /*
                     **  SPYJ_SHENGMU & SPYJ_YUNMU & SPYJ_QUOTE & SPYJ_NUMSIGN & SPYJ_DOLLAR & SPYJ_INVALID
                     */
                     if (nTypeSpYj2 == SPYJ_INVALID)
                     {
#ifdef _DRAW_IM_WIN_H
                            XBell (pDspIme, 100);
#endif
                            goto LABEL0002SP;
                     }
                     else if (nTypeSpYj2 == SPYJ_YUNMU)
                     {
                            /* Delete this YUNMU, No matter what content of nTypeSpYj02 */
                            for (i = pSge->nSpRawCaretPos; i < (nLenSp - 1); i++)
                                   pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 1];
                                   
                            pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                     }
                     else if (nTypeSpYj2 == SPYJ_SHENGMU)
                     {
                            if ((nTypeSpYj02 == SPYJ_QUOTE) || (nTypeSpYj02 == SPYJ_NUMSIGN)
                                   || (nTypeSpYj02 == SPYJ_DOLLAR))
                            {
                                   /* Delete this SHENGMU and QUOTE/NUMSIGN/DOLLAR */
                                   /* [vs#hw#^r#mn#gs]  ==> [vs#hw#^mn#gs]           */
                                   for (i = pSge->nSpRawCaretPos; i < (nLenSp - 2); i++)
                                          pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 2];
                                   
                                   pSge->pwSpMixPeStr[nLenSp - 2] = 0x0000;
                                   pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                            }
                            else if (nTypeSpYj02 == SPYJ_YUNMU)
                            {
                                   if ((nTypeSpYj002 == SPYJ_QUOTE) || (nTypeSpYj002 == SPYJ_NUMSIGN) 
                                          || (nTypeSpYj002 == SPYJ_DOLLAR))
                                   {
                                          /* Delete this SHENGMU and YUNMU and QUOTE/NUMSIGN/DOLLAR */
                                          /* [vs#hw#^rf#mn#gs]  ==> [vs#hw#^mn#gs] */
                                          /* [^vs#hw#rf#mn#gs]  ==> [^hw#rf#mn#gs] */
                                          for (i = pSge->nSpRawCaretPos; i < (nLenSp - 3); i++)
                                                 pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 3];
                                   
                                          pSge->pwSpMixPeStr[nLenSp - 3] = 0x0000;
                                          pSge->pwSpMixPeStr[nLenSp - 2] = 0x0000;
                                          pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                                   }
                                   else if (nTypeSpYj002 == SPYJ_INVALID)
                                   {
                                          /* Delete this SHENGMU and YUNMU */
                                          /* [vs#hw#rf#mn#^gs]  ==> [vs#hw#rf#mn#^] */
                                          for (i = pSge->nSpRawCaretPos; i < (nLenSp - 2); i++)
                                                 pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 2];
                                   
                                          pSge->pwSpMixPeStr[nLenSp - 2] = 0x0000;
                                          pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                                   }
                                   else
                                   {
                                          assert((nTypeSpYj002 != SPYJ_SHENGMU) && (nTypeSpYj002 != SPYJ_YUNMU));
                                   }
                            }
                            else if (nTypeSpYj02 == SPYJ_INVALID)
                            {
                                   /* Delete Only this SHENGMU */
                                   /* [vs#hw#^f]        ==> [vs#hw#^]        INVALID  */
                                   /* [^f]              ==> [^]              INVALID  */
                                   for (i = pSge->nSpRawCaretPos; i < (nLenSp - 1); i++)
                                          pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 1];
                                   
                                   pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                            }
                            else
                            {
                                   assert(nTypeSpYj02 != SPYJ_SHENGMU);
                            }
                     }
                     else if (nTypeSpYj2 == SPYJ_QUOTE)
                     {
                            /*
                            **  if nTypeSpYj02 == INVALID, Just delete it
                            **  if nTypeSpYj02 == SHENGMU, replace it by [#]
                            **  Else, assert failure.
                            */
                            if (nTypeSpYj02 == SPYJ_INVALID)
                            {
                                   for (i = pSge->nSpRawCaretPos; i < (nLenSp - 1); i++)
                                          pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 1];
                                   
                                   pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                            }
                            else if (nTypeSpYj02 == SPYJ_SHENGMU)
                            {
                                   pSge->pwSpMixPeStr[pSge->nSpRawCaretPos] = (JWORD)'#';
                            }
                            else
                            {
                                   assert(0);
                            }
                     }
                     else if ((nTypeSpYj2 == SPYJ_NUMSIGN) || (nTypeSpYj2 == SPYJ_DOLLAR))
                     {
                            assert(nTypeSpYj02 == SPYJ_SHENGMU);
                            
                            /* Same as nTypeSpYj2 == SPYJ_SHENGMU, but delete this NUMSIGN/DOLLAR also */
                            if ((nTypeSpYj002 == SPYJ_QUOTE) || (nTypeSpYj002 == SPYJ_NUMSIGN)
                                   || (nTypeSpYj002 == SPYJ_DOLLAR) || (nTypeSpYj002 == SPYJ_INVALID))
                            {
                                   /* Delete this SHENGMU and QUOTE/NUMSIGN/DOLLAR */
                                   /* [vs#hw^#r#mn#gs]  ==> [vs#hw^#mn#gs]           */
                                   /* [vs#hw^#f]        ==> [vs#hw^]        INVALID  */
                                   for (i = pSge->nSpRawCaretPos; i < (nLenSp - 2); i++)
                                          pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 2];
                                   
                                   pSge->pwSpMixPeStr[nLenSp - 2] = 0x0000;
                                   pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                            }
                            else if (nTypeSpYj002 == SPYJ_YUNMU)
                            {
                                   /* [vs#hw^#rf#mn#gs]  ==> [vs#hw^#mn#gs] */
                                   /* [vs#hw#rf#mn^#gs]  ==> [vs#hw#rf#mn^] */
                                   if ((nTypeSpYj0002 == SPYJ_QUOTE) || (nTypeSpYj0002 == SPYJ_NUMSIGN) 
                                          || (nTypeSpYj0002 == SPYJ_DOLLAR) || (nTypeSpYj0002 == SPYJ_INVALID))
                                   {
                                          /* Delete this SHENGMU and YUNMU and QUOTE/NUMSIGN/DOLLAR */
                                          for (i = pSge->nSpRawCaretPos; i < (nLenSp - 3); i++)
                                                 pSge->pwSpMixPeStr[i]      = pSge->pwSpMixPeStr[i + 3];
                                          
                                          pSge->pwSpMixPeStr[nLenSp - 3] = 0x0000;
                                          pSge->pwSpMixPeStr[nLenSp - 2] = 0x0000;
                                          pSge->pwSpMixPeStr[nLenSp - 1] = 0x0000;
                                   }
                                   else
                                   {
                                          assert((nTypeSpYj0002 != SPYJ_SHENGMU) && (nTypeSpYj0002 != SPYJ_YUNMU));
                                   }
                            }
                            else
                            {
                                   assert(nTypeSpYj002 != SPYJ_SHENGMU);
                            }
                     }

                     /* pSge->nSpRawCaretPos remain previous value */
                     
                     /* Convert SpMix to QuanPinMix, include nSpRawCaretPos and nRawCaretPos */
                     SpMix2QpMix(pSge->pwSpMixPeStr, pSge->pwMixPeStr, pSge->nSpRawCaretPos, &(pSge->nRawCaretPos), nKeyLayMode);
                     nLenSp    = JwordValidLen (pSge->pwSpMixPeStr, UONE);
                     nLen      = JwordValidLen (pSge->pwMixPeStr, UONE);

                     goto LABEL0001SP;
              }
       }

       else if (pNextKeysym[0] == IMXK_BackSpace)
       {
              if ((pSge->nRawCaretPos == 0) || (nLen == 0) || (nLenSp == 0) || (pSge->nSpRawCaretPos == 0))
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002SP;
              }
              else if (pSge->pwSpMixPeStr[(pSge->nSpRawCaretPos) - 1] >= 0x8140)   /* Character before Caret is Hanzi */
              {
                     /* Simple be explained as [LEFT Arrow]  */
                     pNextKeysym[0] = IMXK_Left;
                     OnEditKeysym_SP(pNextKeysym, pSge, nKeyLayMode);
              }
              else
              {
                     /* Simple be explained as [LEFT Arrow] and [Delete] */
                     pNextKeysym[0] = IMXK_Left;
                     OnEditKeysym_SP(pNextKeysym, pSge, nKeyLayMode);
                     pNextKeysym[0] = IMXK_Delete;
                     OnEditKeysym_SP(pNextKeysym, pSge, nKeyLayMode);
              }
       }

       else if (pNextKeysym[0] == IMXK_Left)
       {
              if ((pSge->nRawCaretPos == 0) || (nLen == 0) || (nLenSp == 0) || (pSge->nSpRawCaretPos == 0))
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002SP;
              }
              else if (pSge->pwSpMixPeStr[(pSge->nSpRawCaretPos) - 1] >= 0x8140)   /* Chracter before Caret is Hanzi */
              {
                     /* For ShuangPin Model, This function call SpMix2QpMix() also. */
                     RestoreHzToPy_SP(pSge, PYIM_RESTORE_LAST);
                     nLenSp = JwordValidLen(pSge->pwSpMixPeStr, UONE);

                     j = 0;
                     for (i = 0; i < nLen; i++)
                            if (pSge->pwSpMixPeStr[i] >= 0x8140)
                                   j ++;
                     pSge->nSpRawCaretPos = j;

                     /*
                     **  Convert SpMix to QuanPinMix, include nSpRawCaretPos and nRawCaretPos 
                     */
                     SpMix2QpMix(pSge->pwSpMixPeStr, pSge->pwMixPeStr, pSge->nSpRawCaretPos, &(pSge->nRawCaretPos), nKeyLayMode);
                     nLen      = JwordValidLen (pSge->pwMixPeStr, UONE);

                     goto LABEL0001SP;
              }
              else
              {
                     if (nTypeSpYj1 != SPYJ_INVALID)
                     {
                            if ((nTypeSpYj01 == SPYJ_NUMSIGN) || (nTypeSpYj02 == SPYJ_DOLLAR))
                                   pSge->nSpRawCaretPos -= 2;
                            else
                                   pSge->nSpRawCaretPos -= 1;
                     }
                     else
                     {
                            assert(0);
                     }
                     
                     SpMix2QpMix(pSge->pwSpMixPeStr, pSge->pwMixPeStr, pSge->nSpRawCaretPos, &(pSge->nRawCaretPos), nKeyLayMode);
                     nLen      = JwordValidLen (pSge->pwMixPeStr, UONE);

                     goto LABEL0001SP;
              }
       }

       else if (pNextKeysym[0] == IMXK_Right)
       {
              if ((pSge->nRawCaretPos == nLen) || (pSge->nSpRawCaretPos == nLenSp))
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0002SP;
              }
              else
              {
                     if (nTypeSpYj2 != SPYJ_INVALID)
                     {
                            if ((nTypeSpYj2 == SPYJ_NUMSIGN) || (nTypeSpYj2 == SPYJ_DOLLAR))
                                   pSge->nSpRawCaretPos += 2;
                            else
                                   pSge->nSpRawCaretPos += 1;
                     }
                     else
                     {
                            assert(0);
                     }
                     
                     SpMix2QpMix(pSge->pwSpMixPeStr, pSge->pwMixPeStr, pSge->nSpRawCaretPos, &(pSge->nRawCaretPos), nKeyLayMode);
                     nLen      = JwordValidLen (pSge->pwMixPeStr, UONE);

                     goto LABEL0001SP;
              }
       }

       else if (pNextKeysym[0] == IMXK_Home)
       {
              RestoreHzToPy_SP(pSge, PYIM_RESTORE_ALL);
              nLenSp   = JwordValidLen(pSge->pwSpMixPeStr, UONE);
              pSge->nSpRawCaretPos = 0;
              
              /*
              **  Convert SpMix to QuanPinMix, include nSpRawCaretPos and nRawCaretPos 
              */
              SpMix2QpMix(pSge->pwSpMixPeStr, pSge->pwMixPeStr, pSge->nSpRawCaretPos, &(pSge->nRawCaretPos), nKeyLayMode);
              nLen      = JwordValidLen (pSge->pwMixPeStr, UONE);
              
              pSge->nRawCaretPos  = 0;
              pSge->nViewCaretPos = 0;
              pSge->nViewPeStart  = 0;
              
              goto LABEL0001SP;
       }

       else if (pNextKeysym[0] == IMXK_End)
       {
              pSge->nSpRawCaretPos = nLenSp;
              pSge->nRawCaretPos   = nLen;
              goto LABEL0001SP;
       }
       
       /*
       ** This judgement is added to process Selection Action or 
       ** Backspace/Home/LeftArrow to existing Hanzi 
       */
       else if (pNextKeysym[0] == IMXK_REDRAW_INTERNAL)
       {
              /*
              **  Convert SpMix to QuanPinMix, include nSpRawCaretPos and nRawCaretPos 
              */
              SpMix2QpMix(pSge->pwSpMixPeStr, pSge->pwMixPeStr, pSge->nSpRawCaretPos, &(pSge->nRawCaretPos), nKeyLayMode);
              nLenSp    = JwordValidLen (pSge->pwSpMixPeStr, 256);
              nLen      = JwordValidLen (pSge->pwMixPeStr, 256);
              
              nTmp = JwordValidLen(pSge->pwSlctHz, 512);
              k = 0;
              for (i = 0; i < nTmp; i++)
                     if (pSge->pwSlctHz[i] >= 0x8140)
                            k++;
              
              pSge->nViewPeStart = _MAX(0, k - 8);

              goto LABEL0001SP;
       }
       
       else
              goto LABEL0002SP;

LABEL0001SP:
       {
              /* Prase pwMixPeStr and fill other related pSge field */
              PraseMixRawPe(pSge);
              
              nPrsCaretPos = QpCaretToPrsCaret(pSge->pwPrsMixStr, pSge->nRawCaretPos);
              if (nPrsCaretPos <= pSge->nViewPeStart)
                     pSge->nViewPeStart = nPrsCaretPos - _MIN(3, nPrsCaretPos);

              nTmpWid = PixWidBetween_SP (pSge->pwPrsMixStr, pSge->nViewPeStart, nPrsCaretPos);
              
              if (nTmpWid > nViewPixWid)
              {
                     for (i = pSge->nViewPeStart; nTmpWid > nViewPixWid; i++)
                            nTmpWid = PixWidBetween_SP (pSge->pwPrsMixStr, i, nPrsCaretPos);
                     
                     pSge->nViewPeStart = i - 1;
                     pSge->nViewPeEnd   = nPrsCaretPos;
              }
              
              nTmpWid = 0;
              nLenPrs = JwordValidLen(pSge->pwPrsMixStr, UTWO);
              for (i = pSge->nViewPeStart; (i <= nLenPrs) && (nTmpWid <= nViewPixWid); i++)
                     nTmpWid = PixWidBetween_SP (pSge->pwPrsMixStr, pSge->nViewPeStart, i);
              
              pSge->nViewPeEnd = i - 1;
              
              GetDspPEandCaretPos_SP (pSge);
       }

LABEL0002SP:  
       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT OnPageKeysym ( JINT pNextKeysym,
SesGuiElement pSge 
)

Definition at line 556 of file OnKeySym.c.

{
       JINT    nTmp;
       JINT    nPageSh, nPageGbk, nCurPage, nTargetPage;
       
       /* Prev Page */
       if ((pNextKeysym[0] == IMXK_minus) || (pNextKeysym[0] == IMXK_bracketleft) 
              || (pNextKeysym[0] == IMXK_comma) || (pNextKeysym[0] == IMXK_MOUSEPREV))
       {
              if (pSge->nViewCandiStart > 0)
              {
                     pSge->nViewPage --;
                     ScrollViewCandiPage(&(pSge->scSysCandi), &(pSge->ucUdcCandi), pSge);
                     goto LABEL0003;
              }
              else
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0004;
              }
       }
       /* Next Page */
       else if ((pNextKeysym[0] == IMXK_equal) || (pNextKeysym[0] == IMXK_bracketright) 
              || (pNextKeysym[0] == IMXK_period) || (pNextKeysym[0] == IMXK_MOUSENEXT))
       {
              nTmp  = pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi  +
                      pSge->scSysCandi.nNumShCandi +
                      pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi;
              if(pSge->nGBKMode == GBK_SUPPORTED) nTmp += pSge->scSysCandi.nNumGbkCandi;

              if (pSge->nViewCandiEnd < nTmp)
              {
                     pSge->nViewPage ++;
                     ScrollViewCandiPage(&(pSge->scSysCandi), &(pSge->ucUdcCandi), pSge);
                     goto LABEL0003;
              }
              else
              {
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
                     goto LABEL0004;
              }
       }
       else if (pNextKeysym[0] == IMXK_Return)
       {
              nTmp     = pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi  +
                         pSge->scSysCandi.nNumShCandi   + pSge->scSysCandi.nNumGbkCandi +
                         pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi;
                         
              nPageSh  = pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi +
                         pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi;
                         
              nPageGbk = nPageSh + pSge->scSysCandi.nNumShCandi;
              nCurPage = pSge->nViewCandiStart;
              
              if ((nCurPage < nPageSh) && (pSge->scSysCandi.nNumShCandi + pSge->scSysCandi.nNumGbkCandi > 0))
                     nTargetPage = nPageSh;
              else if ((nCurPage >= nPageSh) && (nCurPage < nPageGbk) && (pSge->scSysCandi.nNumGbkCandi > 0))
                     nTargetPage = nPageGbk;
              else                           /* (nCurPage >= nPageGbk) */
                     nTargetPage = 0;
              
              pSge->nViewCandiStart   = 0;
              pSge->nViewCandiEnd     = 0;
              pSge->nViewPage         = 0;
              for ( ; ;  )
              {
                     ScrollViewCandiPage(&(pSge->scSysCandi), &(pSge->ucUdcCandi), pSge);
                     if ((pSge->nViewCandiEnd < nTmp) && (pSge->nViewCandiStart < nTargetPage))
                            pSge->nViewPage ++;
                     else
                            break;
              }
              
              goto LABEL0003;
       }
       
       /* 以下LABEL0003代码可被组合到函数ScrollViewCandiPage中去. MXL 97.11.28 04:15 */
LABEL0003:
       {      
                     if (pSge->nViewCandiStart == 0)
                            pSge->nIconFlag &= (~F_PREVPAGE);
                     else
                            pSge->nIconFlag |= F_PREVPAGE;
                     
                     nTmp  = pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi  +
                             pSge->scSysCandi.nNumShCandi   + 
                             pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi;
                     if(pSge->nGBKMode == GBK_SUPPORTED)
                            nTmp += pSge->scSysCandi.nNumGbkCandi;

                     if (pSge->nViewCandiEnd < nTmp)
                            pSge->nIconFlag |= F_NEXTPAGE;
                     else
                            pSge->nIconFlag &= (~F_NEXTPAGE);
       }

LABEL0004:
       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT OnSelectKeysym ( JINT pNextKeysym,
SesGuiElement pSge 
)

Definition at line 660 of file OnKeySym.c.

{
       JINT   i, j, nTmp, nTmpLen, nTmpRes, nRes;
       JINT   nCurCandiNum;
       JINT   nChoiceMark;    /* nChoiceMark start from 1 to nCurCandiNum */
       CHAR   szYjStr[80];    /* Yinjie String (including [']) corressponding to current Selection */
       JINT   nLenThisSel;
       JWORD  wThisSel[9];
       JINT   nXrd;
       JINT   nYj, nYjLen;
       
       nCurCandiNum = pSge->nViewCandiEnd - pSge->nViewCandiStart;
       
       if ((pNextKeysym[0] == IMXK_space) && (nCurCandiNum >= 1))
              pNextKeysym[0] = IMXK_1;
       else if ((pNextKeysym[0] == IMXK_space) && (nCurCandiNum == 0))
       {
#ifdef _DRAW_IM_WIN_H
              XBell (pDspIme, 100);
#endif
              return TRUE;
       }
       
       if ((pNextKeysym[0] > IMXK_0) && (pNextKeysym[0] <= (IMXK_0 + nCurCandiNum)))
       {
              for(i = 0; i < 9; i++)
                     wThisSel[i] = 0x0000;
              nChoiceMark     = pNextKeysym[0] - IMXK_0;
              nXrd            = pSge->nViewCandiStart + nChoiceMark - 1;
              nLenThisSel     = GetXrdCandi(&(pSge->scSysCandi), &(pSge->ucUdcCandi), nXrd, wThisSel, pSge->nGBKMode);

              for(i = 0; i < 80; i++)
                     szYjStr[i]  = '\0';

              /* 考虑 XIAN 问题, 如果nXrd指示是在SingleHanzi, 则只取第一个音节串 */
              if (nXrd >= (pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi + 
                           pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi))
                     nTmp = 1;
              else       /* 是双字或多字选择 */
                     nTmp = nLenThisSel;
              
              /*
              **  BUG FIXED: nTmp May be 7, more example, "中华人民共和国",
              **             But OrgYj String is "zh h r m g". [0, 1, 2, 3, 4]
              **             nOrgYj[5] & nOrgYj[6] have been set to 0 in GetF9Yj,
              **             So, change the judgement condition
              **             FROM (j < nTmp) TO (j < nTmp) && (j < nLenYj) !!
              **                  ^^^^^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^
              **             MXL, 97-12-06.
              */
              for(j = 0; (j < nTmp) && (j < pSge->scSysCandi.nLenYj); j++)
              {
                     if ((pSge->scSysCandi.nOrgYj[j] & 0xFFFD0000) == 0xFFFD0000)    /* There is a ['] aheader */
                            strcat(szYjStr, "'");

                     /****  Aha,  ShuangPin's Parse Algorigthm has changed it!!!  - Scott Ma 
                     if (pSge->scSysCandi.nOrgYj[j] >= 0x00010000)
                            strcat(szYjStr, "'");
                     */

                     nYj = pSge->scSysCandi.nOrgYj[j] & 0x01FF;
                     if ((nYj >= 0) && (nYj < NUM_YINJIE))
                            strcat(szYjStr, YINJIESTR_CSZ[nYj]);
                     else if ((nYj >= 450) && (nYj <= 475))
                            strcat(szYjStr, SHENGMUSTR[nYj - 450]);
              }

#ifdef _DEBUG
              printf("TO BE REPLACED: [%s], nLenYj is %d\n", szYjStr, pSge->scSysCandi.nLenYj);
#endif
              
              nRes = nTmpLen = JwordValidLen(pSge->pwSlctHz, 512);
              
              for(i = 0; i < nLenThisSel; i++)
                     pSge->pwSlctHz[nTmpLen + i]        = wThisSel[i];
              pSge->pwSlctHz[nTmpLen + nLenThisSel]  = 0x0009;        /* Horizonal Tab Key */
              (pSge->nSlctSteps)++;

              /* Calc new pSge->nRawCaretPos */
              nTmp    = 0;
              nTmpLen = JwordValidLen(pSge->pwSlctHz, 512);
              for (i = 0; i < nTmpLen; i++)
                     if (pSge->pwSlctHz[i] != 0x0009)
                            nTmp++;
              pSge->nRawCaretPos = nTmp;

              nTmpRes  = JwordStrStrReplace(pSge->pwMixPeStr, StrToJword(szYjStr), (JWORD*)RecovDyz2244((UCHAR*)wThisSel), nLenThisSel);
              if (nTmpRes == FALSE)
                     fprintf (stderr, "Failed in OnSelectKeysym(): JwordStrStrReplace\n");
              
              nTmpLen  = JwordValidLen(pSge->pwSlctRawPy, 512);
              nYjLen   = strlen(szYjStr);
              for (i = nTmpLen; i < (nTmpLen + nYjLen); i++)
                     pSge->pwSlctRawPy[i] = (JWORD)szYjStr[i - nTmpLen];
              pSge->pwSlctRawPy[nTmpLen + nYjLen] = 0x0009;    /* Horizonal Tab Key */
              
              /* Recycle call to IMPinyinTrans() !!!! */
              pNextKeysym[0] = IMXK_REDRAW_INTERNAL;
              IMPinyinTrans(pNextKeysym, pSge);
       }
       else
       {
#ifdef _DRAW_IM_WIN_H
              XBell (pDspIme, 100);
#endif
              ;
       }

       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT OnSelectKeysym_SP ( JINT pNextKeysym,
SesGuiElement pSge 
)

Definition at line 2403 of file OnKeySym.c.

{
       JINT   i, j, nTmp, nTmpLen, nTmpRes, nRes;
       JINT   nCurCandiNum;
       JINT   nChoiceMark;    /* nChoiceMark start from 1 to nCurCandiNum */
       CHAR   szYjStr[80];    /* ShuangPin Yinjie String (including [']) corressponding to current Selection */
       JINT   nLenThisSel;
       JWORD  wThisSel[9];
       JINT   nXrd;
       JINT   nYj, nYjLen;
       
       JINT   nOffset, nSpYjLen, w;        /* a nOffset was added to calculates the Position of Hanzi in pwSpMixPeStr  */
       
       nCurCandiNum = pSge->nViewCandiEnd - pSge->nViewCandiStart;
       
       if ((pNextKeysym[0] == IMXK_space) && (nCurCandiNum >= 1))
              pNextKeysym[0] = IMXK_1;
       else if ((pNextKeysym[0] == IMXK_space) && (nCurCandiNum == 0))
       {
#ifdef _DRAW_IM_WIN_H
              XBell (pDspIme, 100);
#endif
              return TRUE;
       }
       
       if ((pNextKeysym[0] > IMXK_0) && (pNextKeysym[0] <= (IMXK_0 + nCurCandiNum)))
       {
              for(i = 0; i < 9; i++)
                     wThisSel[i] = 0x0000;
              nChoiceMark     = pNextKeysym[0] - IMXK_0;
              nXrd            = pSge->nViewCandiStart + nChoiceMark - 1;
              nLenThisSel     = GetXrdCandi(&(pSge->scSysCandi), &(pSge->ucUdcCandi), nXrd, wThisSel, pSge->nGBKMode);

              for(i = 0; i < 80; i++)
                     szYjStr[i]  = '\0';

              /* 考虑 XIAN 问题, 如果nXrd指示是在SingleHanzi, 则只取第一个音节串 */
              if (nXrd >= (pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi + 
                           pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi))
                     nTmp = 1;
              else       /* 是双字或多字选择 */
                     nTmp = nLenThisSel;

              /*
              **  BUG FIXED: nTmp May be 7, more example, "中华人民共和国",
              **             But OrgYj String is "zh h r m g". [0, 1, 2, 3, 4]
              **             nOrgYj[5] & nOrgYj[6] have been set to 0 in GetF9Yj,
              **             So, change the judgement condition
              **             FROM (j < nTmp) TO (j < nTmp) && (j < nLenYj) !!
              **                  ^^^^^^^^^^    ^^^^^^^^^^^^^^^^^^^^^^^^^^
              **             MXL, 97-12-06.
              */
              /* Empty FOR_j HERE!! Find where is the end of Hanzi */
              for (j = 0; pSge->pwSpMixPeStr[j] >= 0x0080; j++)
              {
                     ;
              }
              nOffset = j;        /* Offset of First Sp English char */
              
              w = 0;
              for (j = 0; (j < nTmp) && (j < pSge->scSysCandi.nLenYj); j++)
              {
                     /* Here is a LAZY PATCH!! [Scott Ma 98-04-26]  */
                     nSpYjLen = 0;
                     if ((pSge->scSysCandi.nOrgYj[j + 1] & 0x000F0000) == 0x000E0000)    /* There is a ['] aheader */
                     {
                            nSpYjLen++;
                     }
                     else if ((pSge->scSysCandi.nOrgYj[j + 1] & 0x000F0000) == 0x000D0000)    /* There is a [#] aheader */
                     {
                            nSpYjLen++;
                     }
                     else if ((pSge->scSysCandi.nOrgYj[j + 1] & 0x000F0000) == 0x000C0000)    /* There is a [$] aheader */
                     {
                            nSpYjLen++;
                     }

                     nYj = pSge->scSysCandi.nOrgYj[j] & 0x01FF;
                     if ((nYj >= 0) && (nYj < NUM_YINJIE) && (nYj != 450) && (nYj != 455) && (nYj != 462) && (nYj != 463) && (nYj != 464))
                            nSpYjLen += 2;
                     else
                            nSpYjLen += 1;
                            
                     for (i = 0; i < nSpYjLen; i++)
                            szYjStr[w++] = (CHAR)(pSge->pwSpMixPeStr[nOffset++]);
              }

#ifdef _DEBUG
              printf("TO BE REPLACED: nTmp is [%d],  [%s], nLenYj is %d\n", nTmp, szYjStr, pSge->scSysCandi.nLenYj);
#endif

              nRes = nTmpLen = JwordValidLen(pSge->pwSlctHz, 512);
              
              for(i = 0; i < nLenThisSel; i++)
                     pSge->pwSlctHz[nTmpLen + i]        = wThisSel[i];
              pSge->pwSlctHz[nTmpLen + nLenThisSel]  = 0x0009;        /* Horizonal Tab Key */
              (pSge->nSlctSteps)++;

              /* Calc new pSge->nRawCaretPos */
              nTmp    = 0;
              nTmpLen = JwordValidLen(pSge->pwSlctHz, 512);
              for (i = 0; i < nTmpLen; i++)
                     if (pSge->pwSlctHz[i] != 0x0009)
                            nTmp++;
              pSge->nSpRawCaretPos = nTmp;

              nTmpRes  = JwordStrStrReplace(pSge->pwSpMixPeStr, StrToJword(szYjStr), (JWORD*)RecovDyz2244((UCHAR*)wThisSel), nLenThisSel);
              if (nTmpRes == FALSE)
                     fprintf (stderr, "Failed in OnSelectKeysym(): JwordStrStrReplace\n");
              
              nTmpLen  = JwordValidLen(pSge->pwSpSlctRawPy, 512);
              nYjLen   = strlen(szYjStr);
              for (i = nTmpLen; i < (nTmpLen + nYjLen); i++)
                     pSge->pwSpSlctRawPy[i] = (JWORD)szYjStr[i - nTmpLen];
              pSge->pwSpSlctRawPy[nTmpLen + nYjLen] = 0x0009;  /* Horizonal Tab Key */
              
              /* Recycle call to IMPinyinTrans() !!!! */
              pNextKeysym[0] = IMXK_REDRAW_INTERNAL;
              IMPinyinTrans(pNextKeysym, pSge);
       }
       else
       {
#ifdef _DRAW_IM_WIN_H
              XBell (pDspIme, 100);
#endif
              ;
       }

       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

VOID ParseRawInputStr ( char *  szPreedit,
int *  pnOutPreedit 
)

Definition at line 196 of file ParsePreedit.c.

{
       CHAR    szNextUnit[10];
       JINT    nPELen;
       JINT    nCurOff, nOPEOff, nRef, nPy;
       JINT    nMatchFlag,  nMatchSMLen,  nMatchYMLenFit,  nMatchYMLenMax,  nMatchYinjie;
       JINT    nMatchFlag2, nMatchSMLen2, nMatchYMLenFit2, nMatchYMLenMax2, nMatchYinjie2;
       JINT    i, j, tmp, tmp1, tmp2;
       CHAR    cEnd, cNext;
       
       JINT    nHalfMatchLen, nIUVetc, nYJCode;

       nHalfMatchLen = nIUVetc = nYJCode = 0;
       nCurOff       = 0;
       nRef = nPy = 0;
       nOPEOff    = 0;
       
       nPELen = (int)strlen(szPreedit);
       
       while (nPELen > nCurOff)
       {
              for (i = 0; i < 10; i++)
                     szNextUnit[i] = '\0';
              
              tmp  = GetNextUnit(szPreedit, nCurOff, szNextUnit);
              nRef = (tmp >> 8) & 0x00FF;
              nPy  = tmp & 0x00FF;

              if (nRef == 1)           /* a ['] */
              {
                     pnOutPreedit[nOPEOff] = MakeOPE (0, 4, 0);
                     nOPEOff ++;
                     nCurOff ++;
              }
              else if (nRef == 2)      /* a [#] */
              {
                     pnOutPreedit[nOPEOff] = MakeOPE (0, 5, 0);
                     nOPEOff ++;
                     nCurOff ++;
              }
              else if (nRef == 3)      /* a [$] */
              {
                     pnOutPreedit[nOPEOff] = MakeOPE (0, 6, 0);
                     nOPEOff ++;
                     nCurOff ++;
              }
              
              if (nPy == 0)
              {
#ifdef _DEBUG
                     fprintf (stderr, "ParseRawInputStr() was exited from [nPy == 0]\n");
#endif
                     nCurOff = nPELen;    /* break;  OR: nCurOff = nPELen; */
              }
              else                        /* nPy > 0 */
              {
                     tmp = MatchUnitByYinjie (szNextUnit);
                     nMatchYMLenFit = (tmp >> 16) & 0x07;
                     nMatchFlag = (tmp >> 13) & 0x07;
                     nMatchSMLen = (tmp >> 12) & 0x01;
                     nMatchYMLenMax = (tmp >> 9) & 0x07;
                     nMatchYinjie = tmp & 0x01FF;
                     
                     tmp1 = nCurOff + nMatchSMLen + nMatchYMLenMax + 1;
                     
                     if (nMatchFlag == 1)
                     {
                            /* The first Char is [i][u][v] */
                            if (szNextUnit[0] == 'i')
                                   tmp = 1;
                            else if (szNextUnit[0] == 'u')
                                   tmp = 2;
                            else if (szNextUnit[0] == 'v')
                                   tmp = 3;
                                   
                            pnOutPreedit[nOPEOff] = MakeOPE(0, tmp, 0);
                            nOPEOff ++;
                            nCurOff ++;
                     }
                     /*
                     **   A Bug Fixed: ORG: zhonw => zhon w // NEW: zhonw => zh o n w
                     **   97-10-5
                     */
                     else if ( (nMatchFlag == 2) && (tmp1 == nPELen) )
                     {
                            nHalfMatchLen = nMatchSMLen + 1 + nMatchYMLenMax;
                            pnOutPreedit[nOPEOff] = MakeOPE (nHalfMatchLen, 0, 0);
                            nOPEOff ++;
                            for (j = 0; j < (nMatchSMLen + nMatchYMLenMax + 1); j++ )
                            {
                                   pnOutPreedit[nOPEOff] = (int)szNextUnit[j];
                                   nOPEOff ++;
                                   nCurOff ++;
                            }
                     }
                     else if (nMatchFlag == 0)
                     {
                            cEnd = szPreedit[nCurOff + nMatchSMLen + nMatchYMLenFit];
                            cNext = szPreedit[nCurOff + nMatchSMLen + 1 + nMatchYMLenFit];
                            
                            /*
                            ** G[aeou]  //  N[aeiouv]  //  R[aeiou]
                            */
                            if( ((cEnd == 'g') && ((cNext == 'a') || (cNext == 'e') ||     \
                                                 (cNext == 'o') || (cNext == 'u') ))       \
                             || ((cEnd == 'n') && ((cNext == 'a') || (cNext == 'e') ||     \
                                                   (cNext == 'i') || (cNext == 'o') ||     \
                                                   (cNext == 'u') || (cNext == 'v') ))     \
                             || ((cEnd == 'r') && ((cNext == 'a') || (cNext == 'e') ||     \
                                                   (cNext == 'i') || (cNext == 'o') ||     \
                                                   (cNext == 'u') )) )
                            {
                                   for (i = 0; i < (nMatchSMLen + nMatchYMLenFit); i++)
                                          szNextUnit[i] = szPreedit[nCurOff + i];
                                   for (i = (nMatchSMLen + nMatchYMLenFit); i < 7; i++)
                                          szNextUnit[i] = '\0';
                                   
                                   tmp2 = MatchUnitByYinjie (szNextUnit);
                                   nMatchYMLenFit2 = (tmp2 >> 16) & 0x07;
                                   nMatchFlag2 = (tmp2 >> 13) & 0x07;
                                   nMatchSMLen2 = (tmp2 >> 12) & 0x01;
                                   nMatchYMLenMax2 = (tmp2 >> 9) & 0x07;
                                   nMatchYinjie2 = tmp2 & 0x01FF;
                                   
                                   /*
                                   ** The following condition may be adjusted to get more
                                   ** precision and general. Thus, following syntax is equal.
                                   ** eran <==> er'an  ana <==> an'a  IS IT BEST????
                                   */
                                   if (nMatchFlag2 == 0)
                                   {
                                          nMatchYinjie = nMatchYinjie2;
                                          nMatchSMLen = nMatchSMLen2;
                                          nMatchYMLenFit = nMatchYMLenFit2;
                                   }
                            }
                            
                            pnOutPreedit[nOPEOff] = MakeOPE (6, 0, nMatchYinjie);
                            nOPEOff ++;
                            nCurOff += (nMatchSMLen + 1 + nMatchYMLenFit);
                     }
                     else
                     {
                            /* nMatchFlag = 3, or 2 in middle */
                            /* Setting nHalfMatchLen to 6 to avoid MakeOPE(0, 0, 0) */
                            
                            pnOutPreedit[nOPEOff] = MakeOPE (6, 0, nMatchYinjie);
                            nOPEOff ++;
                            nCurOff += (nMatchSMLen + 1 + nMatchYMLenFit);
                     }
              }
                     
       } /* End of While() */
       pnOutPreedit[nOPEOff] = 0;
}

Here is the caller graph for this function:

JINT PixWidBetween ( JWORD pwPrsStr,
JINT  nFrom,
JINT  nTo 
)

Definition at line 799 of file OnKeySym.c.

{
       JINT    nTotLen, i, j, t1, t2, nt1;
       
       assert(nTo >= nFrom);
       nTotLen = JwordValidLen(pwPrsStr, UTWO);

       t1 = t2 = j = 0;
       for (i = 0; i <= nTotLen; i++)
       {
              if (pwPrsStr[i] != (JWORD)' ')
              {
                     if (j == nFrom)
                            t1 = i;
                     if (j == nTo)
                            t2 = i;
                     j++;
              }
       }

       nt1 = 0;
       for (i = t1; i < t2; i++)
       {
              /* REVIEW:  pwPrsStr[nTotLen] is 0 !!! */
              if ((pwPrsStr[i] != 0) && (pwPrsStr[i] >= 0x8140))
                     nt1 += HZPIXWID;
              else if ((pwPrsStr[i] != 0) && (pwPrsStr[i] < 0x0080))
                     nt1 += wAlphaIconWid[pwPrsStr[i] - 0x20];
       }
       return nt1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT PixWidBetween_SP ( JWORD pwPrsStr,
JINT  nFrom,
JINT  nTo 
)

Definition at line 836 of file OnKeySym.c.

{
       JINT    nTotLen, i, j, nt1;
       
       assert(nTo >= nFrom);
       nTotLen = JwordValidLen(pwPrsStr, UTWO);

       nt1 = 0;
       for (i = nFrom; i < nTo; i++)
       {
              /* REVIEW:  pwPrsStr[nTotLen] is 0 !!! */
              if ((pwPrsStr[i] != 0) && (pwPrsStr[i] >= 0x8140))
                     nt1 += HZPIXWID;
              else if ((pwPrsStr[i] != 0) && (pwPrsStr[i] < 0x0080))
                     nt1 += wAlphaIconWid[pwPrsStr[i] - 0x20];
       }
       return nt1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1121 of file OnKeySym.c.

{
       JINT    nMixRawLen, nHzPartLen, nEngLen, i;
       CHAR    szEngRawPeStr[256];
       CHAR    szTmpParsedPE[512];
       JINT    nSpaceFlag;
       
       nHzPartLen = 0;
       nMixRawLen = JwordValidLen(pSge->pwMixPeStr, UONE);
       
       for (i = 0; (i < nMixRawLen) && (pSge->pwMixPeStr[i] >= 0x8140); i++)
              nHzPartLen++;
       
       for (i = 0; i < 256; i++)
              szEngRawPeStr[i] = '\0';
       for (i = 0; i < 512; i++)
              szTmpParsedPE[i] = '\0';
              
       for (i = nHzPartLen; (i < nMixRawLen) && (pSge->pwMixPeStr[i] < 0x0080); i++)
              szEngRawPeStr[i - nHzPartLen] = (CHAR)pSge->pwMixPeStr[i];

       ParseRawInputStr (szEngRawPeStr, pSge->nPrsPyYjCode);
       DecompPeIntArray (pSge->nPrsPyYjCode, szTmpParsedPE);
       nEngLen = strlen(szTmpParsedPE);
       
       for (i = 0; i < nHzPartLen; i++)
              pSge->pwPrsMixStr[i] = pSge->pwMixPeStr[i];
              
       /*
       **  By Wendy's Suggestion, 
       **  为美化显示, 特意在汉字和英文之间加一空格
       */
       nSpaceFlag = 0;
       if (nHzPartLen > 0)
       {
              pSge->pwPrsMixStr[nHzPartLen] = (JWORD)' ';
              pSge->pwPrsPyStr[0] = (JWORD)' ';
              i++;
              nSpaceFlag = 1;
       }
       
       for (i = 0; i < nEngLen; i++)
       {
              pSge->pwPrsMixStr[i + nHzPartLen + nSpaceFlag] = (JWORD)szTmpParsedPE[i];
              pSge->pwPrsPyStr[i + nSpaceFlag] = (JWORD)szTmpParsedPE[i];
       }

       for (i = nEngLen + nHzPartLen + nSpaceFlag; i < 512; i++)
              pSge->pwPrsMixStr[i] = 0x0000;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT PrepareSymbolSge ( SesGuiElement pSge,
JINT  nSymbType 
)

Definition at line 2539 of file OnKeySym.c.

{
       JINT    i, nLen, nTmp;
       
       free (pSge->scSysCandi.pwMhCandi);
       free (pSge->scSysCandi.pwDhCandi);
       free (pSge->scSysCandi.pwShCandi);
       free (pSge->scSysCandi.pwGbkCandi);
       free (pSge->ucUdcCandi.pwUdc28Candi);
       
       pSge->scSysCandi.pwMhCandi    = NULL;
       pSge->scSysCandi.pwDhCandi    = NULL;
       pSge->scSysCandi.pwShCandi    = NULL;
       pSge->scSysCandi.pwGbkCandi   = NULL;
       pSge->ucUdcCandi.pwUdc28Candi = NULL;
       
       InitSge(pSge);
       
       nLen = JwordValidLen(pwNewpySym[nSymbType], 256);
       
       pSge->scSysCandi.nNumShCandi = nLen;
       pSge->scSysCandi.nSizShCandi = nLen * 2;     /* In Jword */
       pSge->scSysCandi.pwShCandi   = (JWORD*)malloc((nLen * 2  + MALIGN) * sizeof(JWORD));
       if (pSge->scSysCandi.pwShCandi == NULL)
       {
              fprintf(stderr, "Error!! Failed to Malloc() in Function PrepareSymbolSge().\n");
              return FALSE;
       }
       memset(pSge->scSysCandi.pwShCandi,  0x00, (nLen * 2  + MALIGN) * sizeof(JWORD));
       
       for (i = 0; i < nLen; i++)
              pSge->scSysCandi.pwShCandi[2 * i] = pwNewpySym[nSymbType][i];

       pSge->nViewCandiStart   = 0;
       pSge->nViewCandiEnd     = 0;
       pSge->nViewPage         = 0;
       ScrollViewCandiPage(&(pSge->scSysCandi), &(pSge->ucUdcCandi), pSge);

       if (pSge->nViewCandiStart == 0)
              pSge->nIconFlag &= (~F_PREVPAGE);
       else
              pSge->nIconFlag |= F_PREVPAGE;

       nTmp  = pSge->scSysCandi.nNumMhCandi   + pSge->scSysCandi.nNumDhCandi  +
               pSge->scSysCandi.nNumShCandi   + 
               pSge->ucUdcCandi.nNumSpecCandi + pSge->ucUdcCandi.nNumUdc28Candi;
       if(pSge->nGBKMode == GBK_SUPPORTED) nTmp += pSge->scSysCandi.nNumGbkCandi;
       if (pSge->nViewCandiEnd < nTmp)
              pSge->nIconFlag |= F_NEXTPAGE;
       else
              pSge->nIconFlag &= (~F_NEXTPAGE);
       
       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

VOID ProcAllKeysym ( JINT pKsThis,
SesGuiElement pSge 
)

Definition at line 107 of file OnKeySym.c.

{
       JINT    i;
       JINT    nKsLen;
       
       nKsLen = 0;
       /* for (i = 0; (i < SUN_NUM_KEYSYM) && (pKsThis[i] != 0x0L); i++) */
       for (i = 0; (i < 1) && (pKsThis[i] != 0x0L); i++)
              nKsLen ++;
       if (nKsLen >= 1) 
       {
              if ((pKsThis[0] == IMXK_Shift_L) || (pKsThis[0] == IMXK_Shift_R))
                     bShiftIsPressed = (JSHORT)(1 - bShiftIsPressed);
              else if (pKsThis[0] == IMXK_Caps_Lock)
                     bCapsIsPressed  = (JSHORT)(1 - bCapsIsPressed);
                     
              else if ((pKsThis[0] == IMXK_Alt_L) ||
                      (pKsThis[0] == IMXK_Alt_L) )
                     bAltIsPressed = (JSHORT)(1 - bAltIsPressed);
                     
              /* The Following Key is used as Switcher of Ime Window */
              else if ((pKsThis[0] == IMXK_Control_L) || 
                      (pKsThis[0] == IMXK_Control_R) )
                     bCtrlIsPressed = (JSHORT)(1 - bCtrlIsPressed);
                     
              else if ((pKsThis[0] == IMXK_Meta_L) ||
                      (pKsThis[0] == IMXK_Meta_R) )
                     bMetaIsPressed = (JSHORT)(1 - bMetaIsPressed);
                     
              else if ((pKsThis[0] == IMSunXK_AltGraph) ||
                      (pKsThis[0] == IMXK_Mode_switch) )
                     bAltGrIsPressed = (JSHORT)(1 - bAltGrIsPressed);
                     
              else if ((pKsThis[0] == IMSunXK_Compose) ||
                      (pKsThis[0] == IMXK_Multi_key) )
                     bCompIsPressed = (JSHORT)(1 - bCompIsPressed);
                     
              /* 
              ** If some other key is combined with the above switcher(s),
              ** These switcher is turn Off and be send as a fully key
              ** to application. (Committed)
              */
              else if ((bCtrlIsPressed == 1 ) || (bMetaIsPressed == 1) ||
                      (bAltGrIsPressed == 1) || (bCompIsPressed == 1))
              {
              }
              
              /*
              ** Alt is used to Switch IM (QuanPin, ShuangPin, WuBi...)
              ** Other combination besides IM switcher is committed out.
              ** To avoid conflict with Application, Alt + 1, 2, 3, 4 is preferred.
              */
              else if (bAltIsPressed == 1)
              {
              }
                     
              /*
              **  Normal single Key is transferred to IM_trans.
              */
              else if ((bShiftIsPressed == 0) && (bCapsIsPressed == 0))
              {
                     if ((pKsThis[0] >= IMXK_A) && (pKsThis[0] <= IMXK_Z))
                            pKsThis[0] += (IMXK_a - IMXK_A);

                     IMPinyinTrans(pKsThis, pSge);  
              }
              
              else if ((bShiftIsPressed == 1) && (bCapsIsPressed == 1))
              {
                     /* Bounce Keyevent directly back application */
                     if ((pKsThis[0] >= IMXK_A) && (pKsThis[0] <= IMXK_Z))
                            pKsThis[0] += (IMXK_a - IMXK_A);
              }
              else if ((bShiftIsPressed == 0) && (bCapsIsPressed == 1))
              {
                     if (nKsLen > 1)
                            pKsThis[0] = pKsThis[1];
              }
              else if ((bShiftIsPressed == 1) && (bCapsIsPressed == 0))
              {
                     if (nKsLen > 1)
                            pKsThis[0] = pKsThis[1];
              }
       }
}
VOID ProcSymbIMKey ( SesGuiElement pSge,
JINT  nSymbType,
JINT pNextKeysym,
ImToXSun pIeh 
)

Definition at line 2595 of file OnKeySym.c.

{
       JWORD  wThisSel[9];
       JINT   i, nCurCandiNum, nChoiceMark, nXrd, nLenThisSel;
       
       GetIehFromSge(pIeh, pSge);
       pIeh->nType = IMXSUN_TYPE_NORMAL;
       memset(pIeh->pwCommit, 0x00, UONE * sizeof(JWORD));
       
       if ((nSymbType != pSge->nKeyLayMode) || (pSge->nKeyLayMode != pSge->nPrevKeyLayMode))
       {
              PrepareSymbolSge(pSge, nSymbType);
              GetIehFromSge(pIeh, pSge);
              
              pIeh->nType = IMXSUN_TYPE_NORMAL;
              pSge->nKeyLayMode     = nSymbType;
              pSge->nPrevKeyLayMode = pSge->nKeyLayMode;
       }
       
       if (IsPageKeysym(pNextKeysym) == TRUE)
       {
              OnPageKeysym(pNextKeysym, pSge);
              GetIehFromSge(pIeh, pSge);
              pIeh->nType = IMXSUN_TYPE_NORMAL;
       }
       else if (IsSelectKeysym(pNextKeysym) == TRUE)
       {
              nCurCandiNum = pSge->nViewCandiEnd - pSge->nViewCandiStart;
              if (pNextKeysym[0] == IMXK_space)
                     pNextKeysym[0] = IMXK_1;
                     
              if ((pNextKeysym[0] > IMXK_0) && (pNextKeysym[0] <= (IMXK_0 + nCurCandiNum)))
              {
                     memset(wThisSel, 0x00, 9 * 2);
                     nChoiceMark     = pNextKeysym[0] - IMXK_0;
                     nXrd            = pSge->nViewCandiStart + nChoiceMark - 1;
                     nLenThisSel     = GetXrdCandi(&(pSge->scSysCandi), &(pSge->ucUdcCandi), nXrd, wThisSel, pSge->nGBKMode);
                     memset(pIeh->pwCommit, 0x00, 256 * 2);
                     assert(nLenThisSel == 1);
                     GetIehFromSge(pIeh, pSge);
                     for (i = 0; i < nLenThisSel; i++)
                            pIeh->pwCommit[i] = wThisSel[i];
                     pIeh->nType = IMXSUN_TYPE_COMMITSYMBOL;
              }
              else
              {
                     NULL;
#ifdef _DRAW_IM_WIN_H
                     XBell (pDspIme, 100);
#endif
              }
       }
       else if ( (IsPageKeysym(pNextKeysym) != TRUE) || (IsSelectKeysym(pNextKeysym) != TRUE) )
       {
              NULL;
#ifdef _DRAW_IM_WIN_H
              XBell (pDspIme, 100);
#endif
       }
       return;
}
JINT QpCaretToPrsCaret ( JWORD pwPrsStr,
JINT  nQpCaret 
)

Definition at line 772 of file OnKeySym.c.

{
       JINT    nPrsCaret;
       JINT    nTotLen, i, j;
       
       nTotLen = JwordValidLen(pwPrsStr, UTWO);
       assert((nQpCaret <= nTotLen) && (nQpCaret >= 0));
       
       nPrsCaret = 0;
       j = 0;
       for (i = 0; i <= nTotLen; i++)
       {
              if (pwPrsStr[i] != (JWORD)' ')
              {
                     if (j == nQpCaret)
                            nPrsCaret = i;
                     j++;
              }
       }
       return nPrsCaret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

UCHAR* RecovDyz2244 ( UCHAR szDyz2244)

Definition at line 1972 of file PyBasic.c.

{
       JINT    i, j, nLen, nHlfLen;
       JINT    nDyzCode, nNormCode;
       static  UCHAR*  szNorm = NULL; 
   
       nLen = strlen((CHAR*)szDyz2244);
       nHlfLen = nLen / 2;

       if(szNorm != NULL)
              free(szNorm);

       szNorm = (UCHAR*)malloc(nLen + MALIGN);
       if (szNorm == NULL)
       {
              fprintf(stderr, "Failed to alloc Memory in function RecovDyz2244()\n");
              return (szNorm);
       }
       memset(szNorm, '\0', (nLen + MALIGN));
       
       j = 0;
       for (i = 0; i < nHlfLen; i++)
       {
              nDyzCode = szDyz2244[(2 * i) + 1] + ((JINT)szDyz2244[2 * i] << 8);
              if ((nDyzCode >= 0x2001) && (nDyzCode <= 0x2244))
              {
                     nNormCode         = DYZLIST[nDyzCode - 0x2001];
                     szNorm[2 * i]     = (UCHAR)((nNormCode & 0xFF00) >> 8);
                     szNorm[2 * i + 1] = (UCHAR)(nNormCode & 0x00FF);
              }
              else
              {
                     szNorm[2 * i]      = szDyz2244[2 * i];
                     szNorm[2 * i + 1]  = szDyz2244[2 * i + 1];
              }
       }
       
       return (szNorm);
}
JWORD * RecovDyzNWord2244 ( JWORD pwDyz2244,
JINT  nMaxLen 
)

Definition at line 2032 of file PyBasic.c.

{
       static JWORD*  pwRet = NULL;
       JINT    i;

       free (pwRet);
       pwRet = (JWORD*)malloc((nMaxLen + MALIGN) * sizeof(JWORD));
       if (pwRet == NULL)
       {
              fprintf(stderr, "Failed in malloc() of RecovDyzNWord2244().\n");
              return pwRet;
       }
       memset(pwRet, '\0', sizeof(JWORD) * (nMaxLen + MALIGN));

       for (i = 0; (i < nMaxLen) && (pwDyz2244[i] != 0x0000); i++)
       {
              if ((pwDyz2244[i] >= 0x2001) && (pwDyz2244[i] <= 0x2244))
                     pwRet[i]  = (JWORD)DYZLIST[pwDyz2244[i] - 0x2001];
              else
                     pwRet[i]  = pwDyz2244[i];
       }

       return pwRet;
}

Here is the caller graph for this function:

JWORD RecovDyzWord2244 ( JWORD  wDyz2244)

Definition at line 2016 of file PyBasic.c.

{
       JWORD    wRet;
       
       wRet = wDyz2244;
       
       if ((wDyz2244 >= 0x2001) && (wDyz2244 <= 0x2244))
              wRet  = (JWORD)DYZLIST[wDyz2244 - 0x2001];
       
       return wRet;
}

Here is the caller graph for this function:

JINT RestoreHzToPy ( SesGuiElement pSge,
JINT  nResFlag 
)

Definition at line 966 of file OnKeySym.c.

{
       JINT   nSelectHzLen, nSelectRawEngLen, nTotRawLen;
       JWORD  waHz[256], waEng[256];
       JINT   i, j, k, nTmp;
       JINT   nLenHz, nLenEng, nFirstAddr;
       
       nSelectHzLen     = JwordValidLen(pSge->pwSlctHz, 512);
       nSelectRawEngLen = JwordValidLen(pSge->pwSlctRawPy, 512);
       nTotRawLen       = JwordValidLen(pSge->pwMixPeStr, 256);
       
       for (i = 0; i < 256; i++)
       {
              waHz[i]  = 0x0000;
              waEng[i] = 0x0000;
       }

       if (nResFlag == PYIM_RESTORE_ALL)
       {
              i = j = 0;
              for (i = 0; i < nSelectHzLen; i++)
                     if (pSge->pwSlctHz[i] >= 0x8140)
                            waHz[j++] = pSge->pwSlctHz[i];
              nLenHz = j;

              i = j = 0;
              for (i = 0; i < nSelectRawEngLen; i++)
                     if (pSge->pwSlctRawPy[i] >= 0x0020)
                            waEng[j++] = pSge->pwSlctRawPy[i];
              nLenEng = j;

              for (i = 0; i < 512; i++)
              {
                     pSge->pwSlctRawPy[i] = 0x0000;
                     pSge->pwSlctHz[i]    = 0x0000;
              }
              pSge->nSlctSteps = 0;
       }

       else if (nResFlag == PYIM_RESTORE_LAST)
       {
              i = j = k = 0;
              for (i = 0; i < nSelectRawEngLen; i++)
              {
                     if (pSge->pwSlctRawPy[i] == 0x0009)
                            j++;
                     
                     if ((j == (pSge->nSlctSteps - 1)) && (pSge->pwSlctRawPy[i] != 0x0009))
                     {
                            waEng[k++] = pSge->pwSlctRawPy[i];
                            pSge->pwSlctRawPy[i] = 0x0000;
                     }
                     if (j == pSge->nSlctSteps)
                            pSge->pwSlctRawPy[i] = 0x0000;
              }
              nLenEng = k;
                            
              i = j = k = 0;
              for (i = 0; i < nSelectHzLen; i++)
              {
                     if (pSge->pwSlctHz[i] == 0x0009)
                            j++;
                     
                     if ((j == (pSge->nSlctSteps - 1)) && (pSge->pwSlctHz[i] != 0x0009))
                     {
                            waHz[k++] = pSge->pwSlctHz[i];
                            pSge->pwSlctHz[i] = 0x0000;
                     }
                     if (j == pSge->nSlctSteps)
                            pSge->pwSlctHz[i] = 0x0000;
              }
              nLenHz = k;
              
              (pSge->nSlctSteps)--;

       }
       else
              return FALSE;

       if (nResFlag == PYIM_RESTORE_ALL)
              nFirstAddr = 0;
       else    /* nResFlag == PYIM_RESTORE_LAST */
       {
              nTmp = 0;
              for (i = 0; i < nTotRawLen; i++)
                     if (pSge->pwMixPeStr[i] >= 0x8140)
                            nTmp++;
              
              nFirstAddr = nTmp - nLenHz;
       }
       
       if (nLenHz >= nLenEng)
       {
              for (i = nFirstAddr; i < (nFirstAddr + nLenEng); i++)
                     *(pSge->pwMixPeStr + i) = waEng[i - nFirstAddr];
                     
              for (i = (nFirstAddr + nLenEng); i < (nTotRawLen - (nLenHz - nLenEng)); i++)
                     *(pSge->pwMixPeStr + i) = *(pSge->pwMixPeStr + i + (nLenHz - nLenEng));
                     
              for (i = (nTotRawLen - (nLenHz - nLenEng)); i < 256; i++)
                     *(pSge->pwMixPeStr + i) = 0x0000;
       }
       else if (nLenHz < nLenEng)
       {
              for (i == (nTotRawLen + (nLenEng - nLenHz)); i < 256; i++)
                     *(pSge->pwMixPeStr + i) = 0x0000;
                     
              /* To be rewriten TO: i++ MXL: 1997-12-27 */
              for (i = nTotRawLen + (nLenEng - nLenHz) - 1; i >= (nFirstAddr + nLenEng); i--)
                     *(pSge->pwMixPeStr + i) = *(pSge->pwMixPeStr + i - nLenEng + nLenHz);
                     
              for (i = nFirstAddr; i < (nFirstAddr + nLenEng); i++)
                     *(pSge->pwMixPeStr + i) = waEng[i - nFirstAddr];
       }
       
       /*******
       PraseMixRawPe(pSge);
       *******/
       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT RestoreHzToPy_SP ( SesGuiElement pSge,
JINT  nResFlag 
)

Definition at line 2283 of file OnKeySym.c.

{
       JINT    nSelectHzLen, nSpSelectRawEngLen, nSpTotRawLen;
       JINT    nLenHz, nLenSpEng, nFirstAddr;
       JWORD   waHz[256], waSpEng[256];
       
       JINT   i, j, k, nTmp;

       nSelectHzLen        = JwordValidLen(pSge->pwSlctHz, 512);
       nSpSelectRawEngLen  = JwordValidLen(pSge->pwSpSlctRawPy, 512);
       nSpTotRawLen        = JwordValidLen(pSge->pwSpMixPeStr, 256);
       
       for (i = 0; i < 256; i++)
       {
              waHz[i]     = 0x0000;
              waSpEng[i]  = 0x0000;
       }

       if (nResFlag == PYIM_RESTORE_ALL)
       {
              i = j = 0;
              for (i = 0; i < nSelectHzLen; i++)
                     if (pSge->pwSlctHz[i] >= 0x8140)
                            waHz[j++] = pSge->pwSlctHz[i];
              nLenHz = j;

              i = j = 0;
              for (i = 0; i < nSpSelectRawEngLen; i++)
                     if (pSge->pwSpSlctRawPy[i] >= 0x0020)
                            waSpEng[j++] = pSge->pwSpSlctRawPy[i];
              nLenSpEng = j;
              
              for (i = 0; i < 512; i++)
              {
                     pSge->pwSlctHz[i]      = 0x0000;
                     pSge->pwSpSlctRawPy[i] = 0x0000;
              }
              pSge->nSlctSteps = 0;
       }

       else if (nResFlag == PYIM_RESTORE_LAST)
       {
              i = j = k = 0;
              for (i = 0; i < nSpSelectRawEngLen; i++)
              {
                     if (pSge->pwSpSlctRawPy[i] == 0x0009)
                            j++;
                     
                     if ((j == (pSge->nSlctSteps - 1)) && (pSge->pwSpSlctRawPy[i] != 0x0009))
                     {
                            waSpEng[k++]           = pSge->pwSpSlctRawPy[i];
                            pSge->pwSpSlctRawPy[i] = 0x0000;
                     }
                     if (j == pSge->nSlctSteps)
                            pSge->pwSpSlctRawPy[i] = 0x0000;
              }
              nLenSpEng = k;
                            
              i = j = k = 0;
              for (i = 0; i < nSelectHzLen; i++)
              {
                     if (pSge->pwSlctHz[i] == 0x0009)
                            j++;
                     
                     if ((j == (pSge->nSlctSteps - 1)) && (pSge->pwSlctHz[i] != 0x0009))
                     {
                            waHz[k++] = pSge->pwSlctHz[i];
                            pSge->pwSlctHz[i] = 0x0000;
                     }
                     if (j == pSge->nSlctSteps)
                            pSge->pwSlctHz[i] = 0x0000;
              }
              nLenHz = k;
              
              (pSge->nSlctSteps)--;

       }
       else
              return FALSE;

       if (nResFlag == PYIM_RESTORE_ALL)
              nFirstAddr = 0;
       else    /* nResFlag == PYIM_RESTORE_LAST */
       {
              nTmp = 0;
              for (i = 0; i < nSpTotRawLen; i++)
                     if (pSge->pwSpMixPeStr[i] >= 0x8140)
                            nTmp++;
              
              nFirstAddr = nTmp - nLenHz;
       }
       
       if (nLenHz >= nLenSpEng)
       {
              for (i = nFirstAddr; i < (nFirstAddr + nLenSpEng); i++)
                     *(pSge->pwSpMixPeStr + i) = waSpEng[i - nFirstAddr];
                     
              for (i = (nFirstAddr + nLenSpEng); i < (nSpTotRawLen - (nLenHz - nLenSpEng)); i++)
                     *(pSge->pwSpMixPeStr + i) = *(pSge->pwSpMixPeStr + i + (nLenHz - nLenSpEng));
                     
              for (i = (nSpTotRawLen - (nLenHz - nLenSpEng)); i < 256; i++)
                     *(pSge->pwSpMixPeStr + i) = 0x0000;
       }
       else if (nLenHz < nLenSpEng)
       {
              for (i == (nSpTotRawLen + (nLenSpEng - nLenHz)); i < 256; i++)
                     *(pSge->pwSpMixPeStr + i) = 0x0000;
                     
              /* To be rewriten TO: i++ MXL: 1997-12-27 */
              for (i = nSpTotRawLen + (nLenSpEng - nLenHz) - 1; i >= (nFirstAddr + nLenSpEng); i--)
                     *(pSge->pwSpMixPeStr + i) = *(pSge->pwSpMixPeStr + i - nLenSpEng + nLenHz);
                     
              for (i = nFirstAddr; i < (nFirstAddr + nLenSpEng); i++)
                     *(pSge->pwSpMixPeStr + i) = waSpEng[i - nFirstAddr];
       }
       
       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

VOID ScrollViewCandiPage ( SysCandi psc,
UdcCandi puc,
SesGuiElement pSge 
)

Definition at line 1188 of file OnKeySym.c.

{
       JINT    i, j, k, m;

       JINT    nNumMark;              /* Digital Alpha. 1. 2. 3. 4.*** to mark Candi Number */ 
       JINT    nTotCandi;
       JINT    nMAXPIX, nTmpPix;
       JINT    nWantPage, nCurPage;
       JWORD   wNextCandi[9];
       JINT    nPixOfNext;            /* Width of wNextCandi[9] */
       JINT    nLenOfNext;            /* Hanzi Number in wNextCandi[9] after GetXrdCandi() */
       JINT    nPageSh, nPageGbk;

       nTotCandi = psc->nNumMhCandi  + psc->nNumDhCandi   + psc->nNumShCandi + 
                   psc->nNumGbkCandi + puc->nNumSpecCandi + puc->nNumUdc28Candi;  /* Candi Number */
       /* To Assure Max Candi Num is 7, so minus 20 !! */
       nMAXPIX   = WIN_W - 61 - 20;   /* Same as nViewPixWid in Preedit Area */
       nWantPage = pSge->nViewPage;   /* Page Number want to be displayed */

       /*
       **  在这里暂且不管词的频率, 按先后顺序显示. 单字最多7个. 
       **  象素点的数量与Preedit中的相同: 
       **  1.象素  2.XXXX  3.**
       **  必须保证: 任何一个Candidates的长度加上nNumMark的长度不会超过 nMAXPIX
       **
       **  [** TO IMPROVE: In SortSysCandi(), Rearrange XIAN candies to proper position **] 97.11.28.
       */
       for (m = 0; m < UHLF; m++)
              pSge->pwViewCandi[m] = 0x0000;

       nCurPage  = 0;
       nTmpPix   = 0;
       nNumMark  = 1;
       j = k = m = 0;
       
       nPageSh   = puc->nNumSpecCandi + puc->nNumUdc28Candi + psc->nNumMhCandi + psc->nNumDhCandi;
       nPageGbk  = nPageSh + psc->nNumShCandi;
       
       pSge->nViewCandiStart = 0;
       /* No i++ in this FOR sentence */
       for (i = 0; i < nTotCandi;  )
       {
              if (nCurPage == nWantPage)
              {
                     nLenOfNext   = GetXrdCandi(psc, puc, i, wNextCandi, pSge->nGBKMode);
                     /* Width of Hanzies PLUS [1.SS], S indicates SPACE ' '(0x20) */
                     nPixOfNext   = (nLenOfNext * HZPIXWID) + wAlphaIconWid[nNumMark + '0' - 0x20]  + 
                                     wAlphaIconWid['.' - 0x20] + (2 * wAlphaIconWid[' ' - 0x20]);

                     /*
                     **  If not beyond nMAXPIX, Write wNextCandi[] to pSge->nViewCandi 
                     **  and set pSge->nViewCandiEnd to i+1
                     */
                     if ( ((nTmpPix + nPixOfNext) >= nMAXPIX) || ((i == nPageSh || i == nPageGbk) && (nNumMark > 1) ))
                            break;        /* BREAK of FOR_i sentence */
                     else 
                     {
                            nTmpPix  += nPixOfNext;
                            pSge->nViewCandiEnd = i + 1;

                            pSge->pwViewCandi[m++]     = (JWORD)(nNumMark + '0');
                            pSge->pwViewCandi[m++]     = (JWORD)'.';
                            for (k = 0; k < nLenOfNext; )
                            {
                                   pSge->pwViewCandi[m]   = RecovDyzWord2244(wNextCandi[k]);
                                   m++;
                                   k++;
                            }
                            pSge->pwViewCandi[m++]     = 0x20;    /* SPACE: Add two SPACE after each candi */
                            pSge->pwViewCandi[m++]     = 0x20;    /* SPACE */

                            nNumMark += 1;
                            i++;
                     }
              }

              else   /* (nCurPage < nWantPage) */
              {
                     nLenOfNext   = GetXrdCandi(psc, puc, i, wNextCandi, pSge->nGBKMode);
                     /* Width of Hanzies PLUS [1.  ] */
                     nPixOfNext   = (nLenOfNext * HZPIXWID) + wAlphaIconWid[nNumMark + '0' - 0x20]    + 
                                     wAlphaIconWid['.' - 0x20] + (2 * wAlphaIconWid[' ' - 0x20]);

                     /*
                     **  Reset nTmpPix & nNumMark to 0 & 1, Increase nCurPage by 1.
                     **  Don't increase i to let it recalulate again.
                     */
                     if ( ((nTmpPix + nPixOfNext) >= nMAXPIX) || ((i == nPageSh || i == nPageGbk) && (nNumMark > 1) ))
                     {
                            nTmpPix   = 0;
                            nNumMark  = 1;
                            nCurPage += 1;

                            pSge->nViewCandiStart = i;
                     }
                     /* If not beyond nMAXPIX */
                     else
                     {
                            nTmpPix  += nPixOfNext;
                            nNumMark += 1;
                            i++;
                     }
              }
       } /* End of FOR_i */

}

Here is the call graph for this function:

Here is the caller graph for this function:

VOID SpMix2QpMix ( JWORD pwSpMix,
JWORD pwMix,
JINT  nSpCaret,
JINT pnCaret,
JINT  nKeyLayMode 
)

Definition at line 2208 of file OnKeySym.c.

{
       CHAR    szOrgSp[40], szQp[256];
       JINT    i, nLen, nLenHz;
       JINT    nTmpCaret;
       
       nLen   = JwordValidLen (pwSpMix, 256);
       nLenHz = 0;
       
       for (i = 0; i < nLen; i++)
       {
              if (pwSpMix[i] <= 0x0080)
                     break;               /* BREAK out FOR_i */
       }
       nLenHz = i;
       
       assert((nLen - nLenHz) < 40);
       assert(nSpCaret >= nLenHz);
       
       memset (szOrgSp, '\0', 40);
       memset (szQp,    '\0', 256);
       
       for (i = nLenHz; i < nLen; i++)
              szOrgSp[i - nLenHz] = (CHAR)(pwSpMix[i] & 0x00FF);
       
       Sp2QpStr_Better(szOrgSp, szQp, nKeyLayMode, nSpCaret - nLenHz, &nTmpCaret);
       
       for (i = 0; i < nLenHz; i++)
              pwMix[i] = pwSpMix[i];

       assert((nLenHz + strlen(szQp)) < 240);

       for (i = nLenHz; i < nLenHz + strlen(szQp); i++)
              pwMix[i] = (JWORD)szQp[i - nLenHz];
              
       pwMix[i] = 0x0000;
       *pnCaret = nTmpCaret + nLenHz;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JWORD* StrToJword ( CHAR szStr)

Definition at line 63 of file Jword.c.

{
       JINT    i, nLen;
static  JWORD*  pwRet = NULL;      
       
       nLen = strlen(szStr);
       
       free(pwRet);
       pwRet = (JWORD*)malloc((nLen + MALIGN) * sizeof(JWORD));
       if(pwRet == NULL)
       {
              fprintf (stderr, "Failed to alloc Memory in StrToJword().\n");
              return NULL;
       }
       memset(pwRet, '\0', (nLen + MALIGN) * sizeof(JWORD));

       for (i = 0; i < nLen; i++)
              pwRet[i]  = (JWORD)szStr[i];
       
       return pwRet;
}
JINT TypeOfSpChar ( CHAR pszOrgSp,
JINT  nPos,
JINT  nKeyLayMode 
)

Definition at line 2435 of file PyBasic.c.

{
       JINT    nLen, i, j, k, m, nRes;
       CHAR    szYjTmp1[10], szYjTmp2[10];
       JINT    nfStartSM, nfStartYM;
       JINT    nKeyLayYM1, nKeyLayYM2, nKeyLaySM;
       
       memset (szYjTmp1, '\0', 10);
       memset (szYjTmp2, '\0', 10);
       nfStartSM = TRUE;
       nfStartYM = FALSE;
       i = j = 0;
       
       nLen = strlen(pszOrgSp);

       if ((nPos < 0) || (nPos >= nLen))
              return SPYJ_INVALID;
              
       /* Valid nPos is  [0 ~ (nLen - 1)] */
       for (i = 0; i <= nPos; )
       {
              if (pszOrgSp[i] == '\'')
              {
                     nfStartSM  = TRUE;
                     nfStartYM  = FALSE;

                     if (nPos == i)
                            return SPYJ_QUOTE;
                     else
                            i++;
                     
                     continue;
              }
              
              if (pszOrgSp[i] == '#')
              {
                     nfStartSM  = TRUE;
                     nfStartYM  = FALSE;

                     if (nPos == i)
                            return SPYJ_NUMSIGN;
                     else
                            i++;
                     
                     continue;
              }
              
              if (pszOrgSp[i] == '$')
              {
                     nfStartSM  = TRUE;
                     nfStartYM  = FALSE;

                     if (nPos == i)
                            return SPYJ_DOLLAR;
                     else
                            i++;
                     
                     continue;
              }

              /* For a UpperCase [A], it was treated as ShengMu and was replaced with ['a'] */
              if (nfStartSM == TRUE)
              {
                     /* To "ch" "sh" "zh" */
                     if ((Lower(pszOrgSp[i]) == 'i') || (Lower(pszOrgSp[i]) == 'u') || (Lower(pszOrgSp[i]) == 'v'))
                     {
                            nKeyLaySM   = KEYLAYMODE[nKeyLayMode][Lower(pszOrgSp[i]) - 'a'] >> 16;
                            szYjTmp1[0] = szYjTmp2[0] = YUNMUSTR[nKeyLaySM][0];
                            szYjTmp1[1] = szYjTmp2[1] = YUNMUSTR[nKeyLaySM][1];
                            szYjTmp1[2] = szYjTmp2[2] = '\0';
                            m = 2;    /* length of ShengMu */
                     }
                     else
                     {
                            szYjTmp1[0] = szYjTmp2[0] = Lower(pszOrgSp[i]);
                            szYjTmp1[1] = szYjTmp2[1] = '\0';
                            m = 1;    /* length of ShengMu */
                     }
                     
                     if (IsUpper(pszOrgSp[i]))
                     {
                            nfStartSM  = TRUE;
                            nfStartYM  = FALSE;
                     }
                     else
                     {
                            nfStartSM  = FALSE;
                            nfStartYM  = TRUE;
                     }

                     if (nPos == i)
                            return SPYJ_SHENGMU;
                     
                     i++;

              }
              else if (nfStartYM == TRUE)
              {
                     /* If it is in Upper Case, treat it as ShengMu */
                     if (IsUpper(pszOrgSp[i]))
                     {
                            nfStartSM  = TRUE;
                            nfStartYM  = FALSE;
                            continue;
                     }
                     
                     nKeyLayYM1 = KEYLAYMODE[nKeyLayMode][pszOrgSp[i] - 'a'] & 0x0000FF;
                     nKeyLayYM2 = (KEYLAYMODE[nKeyLayMode][pszOrgSp[i] - 'a'] & 0x00FF00) >> 8;

                     /* ShengMu just before it is [aeo] */
                     if ((pszOrgSp[i - 1] == 'a') || (pszOrgSp[i - 1] == 'e') || (pszOrgSp[i - 1] == 'o'))
                            szYjTmp1[0]  = szYjTmp2[0] = '\0';

                     strcat(szYjTmp1, YUNMUSTR[nKeyLayYM1]);
                     nRes = FastMatchYinJieStr(szYjTmp1);
                     if ((nRes >= 0) && (nRes < NUM_YINJIE))
                     {
                            if (nPos == i)
                                   return SPYJ_YUNMU;
                            i++;
                     }

                     if ((nRes == -1) && (nKeyLayYM2 != 0))
                     {
                            strcat(szYjTmp2, YUNMUSTR[nKeyLayYM2]);
                            nRes = FastMatchYinJieStr(szYjTmp2);
                            if ((nRes >= 0) && (nRes < NUM_YINJIE))
                            {
                                   if (nPos == i)
                                          return SPYJ_YUNMU;
                                   i++;
                            }
                     }

                     nfStartSM  = TRUE;
                     nfStartYM  = FALSE;
                     memset (szYjTmp1, '\0', 10);
                     memset (szYjTmp2, '\0', 10);
              }
       }
       
       return SPYJ_INVALID;
}

Here is the caller graph for this function:

JINT TypeOfSpMixWord ( JWORD pwSpMix,
JINT  nPos,
JINT  nKeyLayMode 
)

Definition at line 2248 of file OnKeySym.c.

{
       CHAR    szOrgSp[40];
       JINT    i, nLenHz, nLen;
       JINT    nRes;

       nLen   = JwordValidLen (pwSpMix, 256);
       nLenHz = 0;
       
       for (i = 0; i < nLen; i++)
       {
              if (pwSpMix[i] <= 0x0080)
                     break;               /* BREAK out FOR_i */
       }
       nLenHz = i;

       memset (szOrgSp, '\0', 40);
       
#ifdef _DEBUG
       if ((nLen - nLenHz) > 39)
              fprintf (stderr, "Error in TypeOfSpMixWord(): > 39!\n");
#endif

       for (i = nLenHz; i < nLen; i++)
              szOrgSp[i - nLenHz] = (CHAR)(pwSpMix[i] & 0x00FF);
              
       nRes = TypeOfSpChar(szOrgSp, (nPos - nLenHz), nKeyLayMode);
       return nRes;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT YjCodeToYjStr ( JINT  nYjCode,
CHAR szYjStr 
)

Definition at line 1090 of file OnKeySym.c.

{
       if ((nYjCode >= 0) && (nYjCode < NUM_YINJIE))
              strcpy(szYjStr, YINJIESTR_CSZ[nYjCode]);
       else if ((nYjCode >= 450) && (nYjCode <= 475))
              strcpy(szYjStr, SHENGMUSTR[nYjCode - 450]);
       else
              return FALSE;
       
       return TRUE;
}

Variable Documentation

Definition at line 425 of file KeysymType.c.