FX_DWORD CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, FX_DWORD dwThemeID, FX_BOOL bChildren) { if (m_pThemeData) { SetThemeData(FWL_GetThemeColor(dwThemeID)); } InitCaption(TRUE); InitCaption(FALSE); return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); }
BOOL CARIB8CharDecode::Caption( const BYTE* pbSrc, DWORD dwSrcSize, vector<CAPTION_DATA>* pCaptionList ) { if( pbSrc == NULL || dwSrcSize == 0 || pCaptionList == NULL){ return FALSE; } InitCaption(); m_pCaptionList = pCaptionList; BOOL bRet = TRUE; DWORD dwReadCount = 0; while(dwReadCount<dwSrcSize){ DWORD dwReadSize = 0; BOOL bRet = Analyze(pbSrc+dwReadCount, dwSrcSize-dwReadCount, &dwReadSize ); if( bRet == TRUE ){ if( m_strDecode.size() > 0 ){ CheckModify(); } }else{ pCaptionList->clear(); break; } m_strDecode = ""; dwReadCount+=dwReadSize; } return bRet; }
//戻り値がFALSEのときpCaptionListは中途半端に更新されているので、可能ならすべてを破棄する BOOL CARIB8CharDecode::Caption( const BYTE* pbSrc, DWORD dwSrcSize, vector<CAPTION_DATA>* pCaptionList, CDRCMap* pDRCMap, WORD wInitSWFMode ) { if( pbSrc == NULL || dwSrcSize == 0 || pCaptionList == NULL || pDRCMap == NULL ){ return FALSE; } m_bSpacing = FALSE; m_pCaptionList = pCaptionList; m_pDRCMap = pDRCMap; m_wSWFMode = m_wInitSWFMode = wInitSWFMode; InitCaption(); DWORD dwReadSize = 0; BOOL bRet = Analyze( pbSrc, dwSrcSize, &dwReadSize ); if( bRet == TRUE ){ CheckModify(); } return bRet; }
FWL_ERR CFWL_FormTP::Initialize() { InitTTO(); InitCaption(TRUE); InitCaption(FALSE); return CFWL_WidgetTP::Initialize(); }
BOOL CARIB8CharDecode::C0( const BYTE* pbSrc, DWORD dwSrcSize, DWORD* pdwReadSize ) { if( dwSrcSize == 0 ){ return FALSE; } DWORD dwReadSize = 0; DWORD dwReadBuff = 0; m_bSpacing = FALSE; switch(pbSrc[0]){ case 0x20: //SP 背景色空白 m_strDecode += L' '; ActivePositionForward(1); m_bSpacing = TRUE; dwReadSize = 1; break; case 0x0D: //APR 改行 CheckModify(); m_bPosInit = TRUE; m_wPosX = m_wClientX; m_wPosY += GetLineDirSize(); if( m_wPosY >= m_wClientY + m_wClientH ){ m_wPosY = m_wClientY + GetLineDirSize() - 1; } m_wPosStartX = m_wPosX; dwReadSize = 1; break; case 0x0E: //LS1 GLにG1セット m_GL = &m_G1; dwReadSize = 1; break; case 0x0F: //LS0 GLにG0セット m_GL = &m_G0; dwReadSize = 1; break; case 0x19: //SS2 シングルシフト //G2で呼ぶ(マクロ展開を考慮してGLは入れ替えない) if( GL_GR( pbSrc+1, dwSrcSize-1, &dwReadBuff, &m_G2 ) == FALSE ){ return FALSE; } dwReadSize = 1+dwReadBuff; break; case 0x1D: //SS3 シングルシフト //G3で呼ぶ(マクロ展開を考慮してGLは入れ替えない) if( GL_GR( pbSrc+1, dwSrcSize-1, &dwReadBuff, &m_G3 ) == FALSE ){ return FALSE; } dwReadSize = 1+dwReadBuff; break; case 0x1B: //ESC エスケープシーケンス if( ESC( pbSrc+1, dwSrcSize-1, &dwReadBuff ) == FALSE ){ return FALSE; } dwReadSize = 1+dwReadBuff; break; case 0x08: //APB 動作位置後退 { CheckModify(); m_bPosInit = TRUE; WORD wDirX = GetCharDirSize(); if( m_wPosX < m_wClientX + wDirX ){ WORD wDirY = GetLineDirSize(); m_wPosX = m_wClientX + m_wClientW / wDirX * wDirX; if( m_wPosY < m_wClientY + wDirY*2-1 ){ m_wPosY = m_wClientY + (m_wClientH/wDirY+1) * wDirY - 1; } m_wPosY -= wDirY; } m_wPosX -= wDirX; m_wPosStartX = m_wPosX; dwReadSize = 1; } break; case 0x09: //APF 動作位置前進 CheckModify(); ActivePositionForward(1); //文字出力がないのでm_wPosStartXを更新しないと進行に矛盾がおこる m_wPosStartX = m_wPosX; dwReadSize = 1; break; case 0x0A: //APD 動作行前進 CheckModify(); m_bPosInit = TRUE; m_wPosY += GetLineDirSize(); if( m_wPosY >= m_wClientY + m_wClientH ){ m_wPosY = m_wClientY + GetLineDirSize() - 1; } m_wPosStartX = m_wPosX; dwReadSize = 1; break; case 0x0B: //APU 動作行後退 { CheckModify(); m_bPosInit = TRUE; WORD wDirY = GetLineDirSize(); if( m_wPosY < m_wClientY + wDirY*2-1 ){ m_wPosY = m_wClientY + (m_wClientH/wDirY+1) * wDirY - 1; } m_wPosY -= wDirY; m_wPosStartX = m_wPosX; dwReadSize = 1; } break; case 0x16: //PAPF 指定動作位置前進 if( dwSrcSize < 2 ){ return FALSE; } CheckModify(); ActivePositionForward(pbSrc[1] - 0x40); m_wPosStartX = m_wPosX; dwReadSize = 2; break; case 0x1C: //APS 動作位置指定 if( dwSrcSize < 3 ){ return FALSE; } CheckModify(); m_bPosInit = TRUE; //動作位置基準点は左下なので1行前進しておく(参考:mark10als) m_wPosY = m_wClientY + GetLineDirSize() * (pbSrc[1] - 0x40 + 1) - 1; m_wPosX = m_wClientX + GetCharDirSize() * (pbSrc[2] - 0x40); m_wPosStartX = m_wPosX; dwReadSize = 3; break; case 0x0C: //CS { dwReadSize = 1; CheckModify(); CAPTION_DATA Item; Item.bClear = TRUE; Item.dwWaitTime = m_dwWaitTime; m_pCaptionList->push_back(Item); m_wSWFMode = m_wInitSWFMode; InitCaption(); } break; default: dwReadSize = 1; break; } *pdwReadSize = dwReadSize; //DEBUG_OUT(pbSrc[0]==0x0E ? TEXT(__FUNCTION__) TEXT("(): GL<-G1\n") : // pbSrc[0]==0x0F ? TEXT(__FUNCTION__) TEXT("(): GL<-G0\n") : NULL); return TRUE; }
BOOL CARIB8CharDecode::CSI( const BYTE* pbSrc, DWORD dwSrcSize, DWORD* pdwReadSize ) { DWORD dwReadSize = 0; //中間文字0x20まで移動 WORD wP1 = 0; WORD wP2 = 0; int nParam = 0; for( ; dwReadSize+1<dwSrcSize; dwReadSize++ ){ if( pbSrc[dwReadSize] == 0x20 ){ if( nParam==0 ){ wP1 = wP2; } nParam++; break; }else if( pbSrc[dwReadSize] == 0x3B ){ if( nParam==0 ){ wP1 = wP2; wP2 = 0; } nParam++; }else if( 0x30<=pbSrc[dwReadSize] && pbSrc[dwReadSize]<=0x39 ){ if( nParam<=1 ){ wP2 = wP2*10+(pbSrc[dwReadSize]&0x0F); } } } //終端文字に移動 if( ++dwReadSize >= dwSrcSize ){ return FALSE; } switch(pbSrc[dwReadSize]){ case 0x53: //SWF if( nParam==1 ){ m_wSWFMode = wP1; }else{ //未サポート } if( InitCaption() == FALSE ){ return FALSE; } break; case 0x6E: //RCS m_bRasterColorIndex = (BYTE)(wP1&0x7F); break; case 0x61: //ACPS m_wPosStartX = m_wPosX = wP1; if( nParam>=2 ){ m_wPosY = wP2; } break; case 0x56: //SDF m_wClientW = wP1; if( nParam>=2 ){ m_wClientH = wP2; } break; case 0x5F: //SDP m_wClientX = wP1; if( nParam>=2 ){ m_wClientY = wP2; } if( m_bPosInit == FALSE ){ m_wPosStartX = m_wPosX = m_wClientX; m_wPosY = m_wClientY + GetLineDirSize() - 1; } break; case 0x57: //SSM m_wCharW = wP1; if( nParam>=2 ){ m_wCharH = wP2; } if( m_bPosInit == FALSE ){ m_wPosY = m_wClientY + GetLineDirSize() - 1; } break; case 0x58: //SHS m_wCharHInterval = wP1; break; case 0x59: //SVS m_wCharVInterval = wP1; break; case 0x42: //GSM //未サポート break; case 0x5D: //GAA //未サポート break; case 0x5E: //SRC //未サポート break; case 0x62: //TCC //未サポート break; case 0x65: //CFS //未サポート break; case 0x63: //ORN if( wP1 == 0x02 ){ m_bShadow = TRUE; } break; case 0x64: //MDF if( wP1 == 0 ){ m_bBold = FALSE; m_bItalic = FALSE; }else if( wP1 == 1 ){ m_bBold = TRUE; }else if( wP1 == 2 ){ m_bItalic = TRUE; }else if( wP1 == 3 ){ m_bBold = TRUE; m_bItalic = TRUE; } break; case 0x66: //XCS //未サポート break; case 0x68: //PRA m_bPRA = (BYTE)(wP1 + 1); CheckModify(TRUE); m_bPRA = 0; break; case 0x54: //CCC //未サポート break; case 0x67: //SCR //未サポート break; default: break; } dwReadSize++; *pdwReadSize = dwReadSize; return TRUE; }