DragonNest/Common/EtInterface/EtUIIMEEditBox.cpp

1505 lines
42 KiB
C++
Raw Permalink Normal View History

#include "StdAfx.h"
#include "EtUIIMEEditBox.h"
#include "EtUIDialog.h"
#ifdef _DEBUG
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
#endif
CEtUIIMEEditBox::CEtUIIMEEditBox( CEtUIDialog *pParent )
: CEtUIEditBox( pParent ), m_bFirstVisibleOver( false )
{
m_Property.UIType = UI_CONTROL_IMEEDITBOX;
m_Property.IMEEditBoxProperty.fIndicatorSize = 0.0f;
m_dwCompTargetColor = D3DCOLOR_ARGB( 255, 255, 255, 255 );
m_dwCompTargetBkColor = D3DCOLOR_ARGB( 255, 150, 150, 150 );
m_dwCompTargetNonColor = D3DCOLOR_ARGB( 255, 255, 255, 0 );
m_dwCompTargetNonBkColor = D3DCOLOR_ARGB( 255, 150, 150, 150 );
m_bForceBottomPosition = false;
m_nTempCompSize = 0;
}
CEtUIIMEEditBox::~CEtUIIMEEditBox(void)
{
}
void CEtUIIMEEditBox::Initialize( SUIControlProperty *pProperty )
{
CEtUIEditBox::Initialize( pProperty );
UpdateRects();
}
void CEtUIIMEEditBox::SetTemplate( int nTemplateIndex )
{
CEtUIEditBox::SetTemplate( nTemplateIndex );
if( m_Property.IMEEditBoxProperty.dwMaxChars == 0 )
m_Property.IMEEditBoxProperty.dwMaxChars = 256;
SetMaxEditLength( m_Property.IMEEditBoxProperty.dwMaxChars );
}
bool CEtUIIMEEditBox::MsgProc( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if( !IsEnable() || !IsShow() || !IsKeyLock() )
{
return false;
}
#if defined(DEBUG) || defined(_DEBUG)
assert( m_bIMEStaticMsgProcCalled && L"To fix, call CEtUIDialogResourceManager::MsgProc() first" );
#endif
static LPARAM lAlt = 0x80000000, lCtrl = 0x80000000, lShift = 0x80000000;
bool bpbTrappedData, *pbTrapped;
HIMC hImc;
pbTrapped = &bpbTrappedData;
*pbTrapped = false;
if( !s_bEnableImeSystem )
{
return CEtUIEditBox::MsgProc( uMsg, wParam, lParam );
}
// <20><><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>.
// IME <20><><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD> <20><><EFBFBD><EFBFBD> WM_KEYDOWN <20><> wParam<61><6D> <20><><EFBFBD><EFBFBD> <20>׻<EFBFBD> VK_PROCESSKEY<45><59>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> vk<76><6B><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF>ϴٸ<CFB4>, ImmGetVirtualKey<65>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǵµ<C7B4>,
// TranslateMessage<67><65> ȣ<><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>¿<EFBFBD><C2BF>߸<EFBFBD> <20>Ѵ<EFBFBD>.
// <20>׷<EFBFBD><D7B7><EFBFBD> <20>Ʒ<EFBFBD><C6B7><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ڵ<EFBFBD><DAB5><EFBFBD> <20><EFBFBD><E9BDBA><EFBFBD>̽<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD> <20>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD> IMEó<45><C3B3><EFBFBD><EFBFBD> <20>ȵǰ<C8B5> <20>Ϸ<EFBFBD><CFB7><EFBFBD> <20>ڵ<EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD>̰<EFBFBD><CCB0><EFBFBD><EFBFBD><EFBFBD>,
// <20>̷<EFBFBD><CCB7><EFBFBD> <20>غ<EFBFBD><D8BA><EFBFBD> IME<4D><45> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD>.(<28><>, <20><><EFBFBD>յǰ<D5B5> <20>ִ<EFBFBD>.)
// <20>̷<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
//if( m_bFirstVisibleOver )
//{
// if( uMsg == WM_KEYDOWN && wParam == VK_PROCESSKEY )
// {
// UINT nKey = ImmGetVirtualKey( m_pParent->GetHWnd() );
// if( nKey == VK_BACK )
// m_bFirstVisibleOver = false;
// else
// return true;
// }
//}
switch( uMsg )
{
case WM_IME_COMPOSITION:
{
// Note : m_Buffer<65><72> static <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴ϶<C6B4><CFB6><EFBFBD> <20><> <20>κп<CEBA><D0BF><EFBFBD> üũ<C3BC><C5A9> <20>Ѵ<EFBFBD>.
// <09>ִ<EFBFBD> <20><><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20><> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
//
if( m_Buffer.IsMaxEditBoxLength() )
{
PostMessage( GetFocus(), WM_IME_ENDCOMPOSITION, 0, 0 );
break;
}
// Note: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20>ʹ<EFBFBD> <20><><EFBFBD><20>ϼ<EFBFBD><CFBC><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20>о<D0BE><EEB3BB> <20>ϳ<EFBFBD><CFB3><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʰ<EFBFBD> <20>Ǵ<EFBFBD> <20><><EFBFBD><20><><EFBFBD>´<EFBFBD>.
// <20>ȱ׷<C8B1><D7B7><EFBFBD> m_nFirstVisible <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD≯<EFBFBD> <20>Ѿ<D1BE><EEB0A1> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD>.
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><CCBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڰ<EFBFBD> <20>߰<EFBFBD><DFB0>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><ECBFA1> üũ<C3BC>Ѵ<EFBFBD>. <20>ȱ׷<C8B1><D7B7><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʾƼ<CABE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
if( m_bFirstVisibleOver )
{
HIMC hImc;
hImc = _ImmGetContext( m_pParent->GetHWnd() );
_ImmNotifyIME( hImc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 );
_ImmReleaseContext( m_pParent->GetHWnd(), hImc );
m_bFirstVisibleOver = false;
break;
// #14215 <20>̽<EFBFBD>(m_bFirstVisibleOver <20><><EFBFBD>°<EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD> <20>ϱ<EFBFBD>)<29><> <20>ذ<EFBFBD><D8B0>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>õ<EFBFBD><C3B5><EFBFBD> <20>߾<EFBFBD><DFBE><EFBFBD>.
// 1. <20><20>̷<EFBFBD><CCB7><EFBFBD> <20><><EFBFBD>µǴ<C2B5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_bFirstVisibleOver <20><><EFBFBD>·<EFBFBD> <20>ٲٴ<D9B2> <20><> <20><>ü<EFBFBD><C3BC> <20><><EFBFBD>ζ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>,
// m_bFirstVisibleOver<65><72> true<75><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PlaceCaret <20>˻<EFBFBD><CBBB>κп<CEBA><D0BF><EFBFBD> ImmSetCompositionString<6E><67> ȣ<><C8A3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD≯<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20>ƹ<EFBFBD><C6B9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD> FALSE<53><45> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
// <20><><EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD> ã<>ƺ<EFBFBD><C6BA><EFBFBD> <20>ȵȴٰ<C8B4> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><EEB6BB> <20><><EFBFBD>ľߵȴٰ<C8B4> <20><><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD> <20><>ã<EFBFBD>Ҵ<EFBFBD>.
// 2. ImmProcessKey<65><79> ImmLockIMC<4D><43> <20>̿<EFBFBD><CCBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>η<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD> <20>ȵ<EFBFBD>.
// 3. <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>۵<EFBFBD><DBB5><EFBFBD><EFBFBD><EFBFBD> <20>ʾƼ<CABE> <20>޼<EFBFBD><DEBC><EFBFBD> <20><>ü<EFBFBD><C3BC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ߴ<EFBFBD>.
// <20>׷<EFBFBD><D7B7><EFBFBD> WM_IME_COMPOSITION <20><> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD> <20>Ⱥ<EFBFBD><C8BA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
// <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD> IME<4D><45> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ޱ⶧<DEB1><E2B6A7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Result<6C><74> <20><><EFBFBD><EFBFBD><EEBAB8> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>յǰ<D5B5> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD>޵Ǿ<DEB5><C7BE><EFBFBD>.
// <20><>, <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> <20>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
// (<28><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD> IME<4D>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> <20>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD>ǰ<EFBFBD> <20>ִٴ<D6B4> <20><> Ȯ<><C8AE><EFBFBD>ϰ<EFBFBD> <20>ʹٸ<CDB4>,
// m_bFirstVisibleOver <20>϶<EFBFBD> return true <20>س<EFBFBD><D8B3><EFBFBD>, <20><> <20>Է<EFBFBD><D4B7>غ<EFBFBD><D8BA><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD>̻<EFBFBD> <20><><EFBFBD>ڰ<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
// <20><>Ʈ<EFBFBD><C6AE> <20>ѹ<EFBFBD> <20>ߴٿ<DFB4><D9BF><EFBFBD>, wm_paint<6E><74> <20><><EFBFBD>ŵǸ鼭 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>յ<EFBFBD><D5B5>ִ°<D6B4><C2B0><EFBFBD> Ȯ<><C8AE><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>.)
// 4. <20>׷<EFBFBD><D7B7><EFBFBD> <20><><EFBFBD><EFBFBD> ã<>ƺ<EFBFBD><C6BA><EFBFBD> Ű<><C5B0><EFBFBD><EFBFBD> <20><>ŷ<EFBFBD><C5B7> <20><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>, IME<4D><45> <20><><EFBFBD><EFBFBD> <20>޼<EFBFBD><DEBC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>־<EFBFBD><D6BE>ٰ<EFBFBD> <20>Ѵ<EFBFBD>.
// 5. <20><><EFBFBD>κ<EFBFBD><CEBA><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʰ<EFBFBD>, <20><><EFBFBD><EFBFBD> Result<6C><74> <20>ö<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǵٰ<C7B4> <20>Ѵ<EFBFBD>.
//
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ؼ<EFBFBD>, Ű<><C5B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD> <20><><EFBFBD>°<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD> <20><><EFBFBD>Ƽ<EFBFBD>
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20>ϰڴ<CFB0>.
// <20>ƴϸ<C6B4> <20>׳<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>յ<EFBFBD> <20><><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Result<6C><74> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..
}
LONG lRet;
WCHAR wszCompStr[ MAX_COMPSTRING_SIZE ]={0};
*pbTrapped = true;
hImc = _ImmGetContext( m_pParent->GetHWnd() );
if( hImc == NULL )
{
break;
}
if( lParam & GCS_CURSORPOS )
{
s_nCompCaret = _ImmGetCompositionStringW( hImc, GCS_CURSORPOS, NULL, 0 );
if( s_nCompCaret < 0 )
{
s_nCompCaret = 0;
}
}
if( lParam & GCS_RESULTSTR )
{
lRet = _ImmGetCompositionStringW( hImc, GCS_RESULTSTR, wszCompStr, sizeof( wszCompStr ) );
if( lRet > 0 )
{
lRet /= sizeof( WCHAR );
wszCompStr[ lRet ] = 0;
TruncateCompString( false, ( int )wcslen( wszCompStr ) );
s_CompString.SetText( wszCompStr );
if( CEtUIIME::s_bRESULTSTR_NotSendComp == false )
{
SendCompString();
}
else
{
GetEtDevice()->SetDialogBoxMode(false);
CEtUIIME::s_bRESULTSTR_NotSendComp = true;
}
ResetCompositionString();
}
}
if( lParam & GCS_COMPSTR )
{
lRet = _ImmGetCompositionStringW( hImc, GCS_COMPSTR, wszCompStr, sizeof( wszCompStr ) );
if( lRet > 0 )
{
int i;
lRet /= sizeof( WCHAR );
wszCompStr[ lRet ] = 0;
TruncateCompString( false, ( int )wcslen( wszCompStr ) );
s_CompString.SetText( wszCompStr );
m_pParent->ProcessCommand(EVENT_EDITBOX_IME_CHANGE, true, this, WM_IME_COMPOSITION);
if( ( GetLanguage() == LANG_CHT ) && ( !GetImeId() ) )
{
if( lstrlenW( s_CompString.GetBuffer() ) )
{
s_CandList.dwCount = 4;
s_CandList.dwSelection = ( DWORD ) - 1;
for( i = 3; i >= 0; i-- )
{
if( i > lstrlenW( s_CompString.GetBuffer() ) - 1 )
{
s_CandList.awszCandidate[ i ][ 0 ] = 0;
}
else
{
s_CandList.awszCandidate[ i ][ 0 ] = s_CompString[ i ];
s_CandList.awszCandidate[ i ][ 1 ] = 0;
}
}
s_CandList.dwPageSize = MAX_CANDLIST;
memset( ( void * )s_CompString.GetBuffer(), 0, sizeof( WCHAR ) * 4 );
s_bShowReadingWindow = true;
GetReadingWindowOrientation( 0 );
if( s_bHorizontalReading )
{
s_CandList.nReadingError = -1;
s_wszReadingString[ 0 ] = 0;
for( i = 0; i < ( int )s_CandList.dwCount; i++ )
{
if( s_CandList.dwSelection == i )
{
s_CandList.nReadingError = lstrlenW( s_wszReadingString );
}
wcscat_s( s_wszReadingString, 32, s_CandList.awszCandidate[ i ] );
}
}
}
else
{
s_CandList.dwCount = 0;
s_bShowReadingWindow = false;
}
}
if( s_bInsertOnType )
{
int nCount;
SendCompString();
nCount = lstrlenW( s_CompString.GetBuffer() + s_nCompCaret );
for( i = 0; i < nCount; i++ )
{
SendMessage( m_pParent->GetHWnd(), WM_KEYDOWN, VK_LEFT, 0 );
}
SendMessage( m_pParent->GetHWnd(), WM_KEYUP, VK_LEFT, 0 );
}
}
ResetCaretBlink();
// Note : <20>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> ũ<><20><><EFBFBD><EFBFBD><EEB3AA> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ѱ۸<D1B1> <20>׽<EFBFBD>Ʈ <20>߰<EFBFBD> <20><> <20>Ŀ<EFBFBD> <20>߱<EFBFBD>, <20>Ϻ<EFBFBD><CFBA><EFBFBD> <20><><EFBFBD>쵵 üũ<C3BC>ؾ<EFBFBD> <20>Ѵ<EFBFBD>.
//
// <09><>ġ<EFBFBD><C4A1> <20><><EFBFBD><20>Ǿ<EFBFBD><C7BE>Ѵ<EFBFBD>.
PlaceCaret( (int)lRet );
}
if( lParam & GCS_COMPATTR )
{
lRet = _ImmGetCompositionStringW( hImc, GCS_COMPATTR, s_abyCompStringAttr, sizeof( s_abyCompStringAttr ) );
if( lRet > 0 )
{
s_abyCompStringAttr[lRet] = 0;
}
}
if( CEtUIIME::s_bProcess_GCS_COMPCLAUSE )
{
if( lParam & GCS_COMPCLAUSE )
{
lRet = _ImmGetCompositionStringW( hImc, GCS_COMPCLAUSE, s_adwCompStringClause, sizeof( s_adwCompStringClause ) );
s_adwCompStringClause[ lRet / sizeof( DWORD ) ] = 0;
}
}
if( CEtUIIME::s_bRESULTSTR_NotSendComp == true )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ <20><><EFBFBD><EFBFBD>.
float fX1 = CEtUIIMEEditBox::s_CurrentCaretPos.fX * m_pParent->GetScreenWidth();
float fX2 = CEtUIIMEEditBox::s_CurrentCaretPos.fY * m_pParent->GetScreenHeight();
RECT rcWindow;
GetWindowRect( m_pParent->GetHWnd(), &rcWindow );
POINT pt;
pt.x = (long)fX1 - rcWindow.left;
pt.y = (long)fX2 - rcWindow.top;
// Ǯ<><C7AE>ũ<EFBFBD><C5A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ĸ<><C4B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʰ<EFBFBD> <20><> <20>ڸ<EFBFBD><DAB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Է<EFBFBD>â<EFBFBD><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
// <20>׷<EFBFBD><D7B7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 20<32>ȼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϰڴ<CFB0>.
if( !(GetWindowLong( m_pParent->GetHWnd(), GWL_STYLE ) & WS_CAPTION) )
pt.y += 20;
ClientToScreen(m_pParent->GetHWnd(), &pt);
COMPOSITIONFORM cf;
cf.dwStyle = CFS_POINT;
cf.ptCurrentPos.x = pt.x;
cf.ptCurrentPos.y = pt.y;
ImmSetCompositionWindow(hImc, &cf);
}
_ImmReleaseContext( m_pParent->GetHWnd(), hImc );
if( CEtUIIME::s_bRESULTSTR_NotSendComp == true )
{
return CEtUIEditBox::MsgProc( uMsg, wParam, lParam );
}
}
break;
case WM_IME_ENDCOMPOSITION:
TruncateCompString();
ResetCompositionString();
s_bHideCaret = false;
s_bShowReadingWindow = false;
m_pParent->ProcessCommand(EVENT_EDITBOX_IME_CHANGE, true, this, WM_IME_ENDCOMPOSITION);
break;
case WM_IME_NOTIFY:
switch( wParam )
{
case IMN_SETCONVERSIONMODE:
case IMN_SETOPENSTATUS:
CheckToggleState();
break;
case IMN_OPENCANDIDATE:
case IMN_CHANGECANDIDATE:
{
int i, j;
LPCANDIDATELIST lpCandList;
DWORD dwLenRequired;
s_CandList.bShowWindow = true;
*pbTrapped = true;
hImc = _ImmGetContext( m_pParent->GetHWnd() );
if( hImc == NULL )
{
break;
}
lpCandList = NULL;
s_bShowReadingWindow = false;
dwLenRequired = _ImmGetCandidateListW( hImc, 0, NULL, 0 );
if( dwLenRequired )
{
lpCandList = ( LPCANDIDATELIST )HeapAlloc( GetProcessHeap(), 0, dwLenRequired );
dwLenRequired = _ImmGetCandidateListW( hImc, 0, lpCandList, dwLenRequired );
}
if( lpCandList )
{
int nPageTopIndex;
s_CandList.dwSelection = lpCandList->dwSelection;
s_CandList.dwCount = lpCandList->dwCount;
nPageTopIndex = 0;
s_CandList.dwPageSize = min( lpCandList->dwPageSize, MAX_CANDLIST );
if( GetPrimaryLanguage() == LANG_JAPANESE )
{
nPageTopIndex = ( s_CandList.dwSelection / s_CandList.dwPageSize ) * s_CandList.dwPageSize;
}
else
{
nPageTopIndex = lpCandList->dwPageStart;
}
if( GetLanguage() == LANG_CHS && !GetImeId() )
{
s_CandList.dwSelection = ( DWORD ) - 1;
}
else
{
s_CandList.dwSelection = s_CandList.dwSelection - nPageTopIndex;
}
memset( s_CandList.awszCandidate, 0, sizeof(s_CandList.awszCandidate) );
for( i = nPageTopIndex, j = 0; i < ( int )lpCandList->dwCount && j < ( int )s_CandList.dwPageSize; i++, j++ )
{
LPWSTR pwsz;
WCHAR *pwszNewCand;
pwsz = s_CandList.awszCandidate[ j ];
*pwsz = ( WCHAR )( L'0' + ( ( j + 1 ) % 10 ) );
pwsz++;
if( s_bVerticalCand )
{
*pwsz = L' ';
pwsz++;
}
pwszNewCand = ( LPWSTR )( ( BYTE * )lpCandList + lpCandList->dwOffset[ i ] );
while( *pwszNewCand )
{
*pwsz = *pwszNewCand;
pwsz++;
pwszNewCand++;
}
if( !s_bVerticalCand )
{
*pwsz = L' ';
pwsz++;
}
*pwsz = 0;
}
s_CandList.dwCount = lpCandList->dwCount - lpCandList->dwPageStart;
if( s_CandList.dwCount > lpCandList->dwPageSize )
{
s_CandList.dwCount = lpCandList->dwPageSize;
}
HeapFree( GetProcessHeap(), 0, lpCandList );
_ImmReleaseContext( m_pParent->GetHWnd(), hImc );
if( GetPrimaryLanguage() == LANG_KOREAN || GetLanguage() == LANG_CHT && !GetImeId() )
{
s_CandList.dwSelection = ( DWORD ) - 1;
}
if( !s_bVerticalCand )
{
WCHAR wszCand[ 256 ] = L"";
s_CandList.nFirstSelected = 0;
s_CandList.nHoriSelectedLen = 0;
for( i = 0; i < MAX_CANDLIST; i++ )
{
WCHAR wszEntry[ 32 ];
if( s_CandList.awszCandidate[ i ][ 0 ] == L'\0' )
{
break;
}
swprintf_s( wszEntry, 32, L"%s ", s_CandList.awszCandidate[ i ] );
if( i == s_CandList.dwSelection )
{
s_CandList.nFirstSelected = lstrlenW( wszCand );
s_CandList.nHoriSelectedLen = lstrlenW( wszEntry ) - 1;
}
wcscat_s( wszCand, 256, wszEntry );
}
wszCand[ lstrlenW( wszCand ) - 1 ] = L'\0';
s_CandList.HoriCand.SetText( wszCand );
}
}
break;
}
case IMN_CLOSECANDIDATE:
{
s_CandList.bShowWindow = false;
if( !s_bShowReadingWindow )
{
s_CandList.dwCount = 0;
memset( s_CandList.awszCandidate, 0, sizeof( s_CandList.awszCandidate ) );
}
*pbTrapped = true;
break;
}
case IMN_PRIVATE:
{
DWORD dwId;
if( !s_CandList.bShowWindow )
{
GetPrivateReadingString();
}
dwId = GetImeId();
switch( dwId )
{
case IMEID_CHT_VER42:
case IMEID_CHT_VER43:
case IMEID_CHT_VER44:
case IMEID_CHS_VER41:
case IMEID_CHS_VER42:
if( ( lParam == 1 ) || ( lParam == 2 ) )
{
*pbTrapped = true;
}
break;
case IMEID_CHT_VER50:
case IMEID_CHT_VER51:
case IMEID_CHT_VER52:
case IMEID_CHT_VER60:
case IMEID_CHS_VER53:
if( (lParam == 16) || (lParam == 17) || (lParam == 26) || (lParam == 27) || (lParam == 28) )
{
*pbTrapped = true;
}
break;
}
}
break;
default:
*pbTrapped = true;
break;
}
break;
case WM_KEYUP:
case WM_SYSKEYUP:
if( !( lAlt & 0x80000000 ) && wParam != VK_MENU && ( GetAsyncKeyState( VK_MENU ) & 0x8000 ) == 0 )
{
PostMessageW( GetFocus(), WM_KEYUP, (WPARAM)VK_MENU, ( lAlt & 0x01ff0000 ) | 0xC0000001 );
}
else if( !( lCtrl & 0x80000000 ) && wParam != VK_CONTROL && ( GetAsyncKeyState( VK_CONTROL ) & 0x8000 ) == 0 )
{
PostMessageW( GetFocus(), WM_KEYUP, (WPARAM)VK_CONTROL, ( lCtrl & 0x01ff0000 ) | 0xC0000001 );
}
else if( !( lShift & 0x80000000 ) && wParam != VK_SHIFT && ( GetAsyncKeyState( VK_SHIFT ) & 0x8000 ) == 0 )
{
PostMessageW( GetFocus(), WM_KEYUP, (WPARAM)VK_SHIFT, ( lShift & 0x01ff0000 ) | 0xC0000001 );
}
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
switch ( wParam )
{
case VK_MENU:
lAlt = lParam;
break;
case VK_SHIFT:
lShift = lParam;
break;
case VK_CONTROL:
lCtrl = lParam;
break;
}
default:
return CEtUIEditBox::MsgProc( uMsg, wParam, lParam );
}
return *pbTrapped;
}
bool CEtUIIMEEditBox::HandleMouse( UINT uMsg, float fX, float fY, WPARAM wParam, LPARAM lParam )
{
if( !IsEnable() || !IsShow() || !IsKeyLock() )
{
return false;
}
switch( uMsg )
{
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
{
float fFontHeight = m_pParent->GetFontHeight( m_Template.m_vecElement[5].nFontIndex, m_Template.m_vecElement[5].nFontHeight );
//ID3DXFont *pFont = m_pParent->GetFont( m_Template.m_vecElement[5].nFontIndex, m_Template.m_vecElement[5].nFontHeight );
int nCompStrWidth = 0;
CEtFontMng& FontMng = CEtFontMng::GetInstance();
SUIElement* pElement = GetElement( 0 );
nCompStrWidth = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, s_CompString.GetTextSize() );
//s_CompString.CPtoX( s_CompString.GetTextSize(), FALSE, &nCompStrWidth );
if( ( s_fCompStringX <= fX ) && ( s_fCompStringY <= fY ) &&
( s_fCompStringX + nCompStrWidth / m_pParent->GetScreenWidth() > fX ) && ( s_fCompStringY + fFontHeight > fY ) )
{
HIMC hImc;
int nCharBodyHit, nCharHit;
int nTrail;
nCharBodyHit = FontMng.GetCaretFromCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight,
(int)((fX - s_fCompStringX) * m_pParent->GetScreenWidth()), nTrail );
//s_CompString.XtoCP( ( int )( ( fX - s_fCompStringX ) * m_pParent->GetScreenWidth() ), &nCharBodyHit, &nTrail );
if( ( nTrail ) && ( nCharBodyHit < s_CompString.GetTextSize() ) )
{
nCharHit = nCharBodyHit + 1;
}
else
{
nCharHit = nCharBodyHit;
}
hImc = _ImmGetContext( m_pParent->GetHWnd() );
if( !hImc )
{
return true;
}
_ImmNotifyIME( hImc, NI_CLOSECANDIDATE, 0, 0 );
_ImmReleaseContext( m_pParent->GetHWnd(), hImc );
switch( GetPrimaryLanguage() )
{
case LANG_JAPANESE:
if( s_nFirstTargetConv != -1 )
{
int nClauseClicked, nClauseSelected, nSendCount;
BYTE byVirtKey;
nClauseClicked = 0;
while( ( int )s_adwCompStringClause[ nClauseClicked + 1 ] <= nCharBodyHit )
{
nClauseClicked++;
}
nClauseSelected = 0;
while( ( int )s_adwCompStringClause[ nClauseSelected + 1 ] <= s_nFirstTargetConv )
{
nClauseSelected++;
}
if( nClauseClicked > nClauseSelected )
{
byVirtKey = VK_RIGHT;
}
else
{
byVirtKey = VK_LEFT;
}
nSendCount = abs( nClauseClicked - nClauseSelected );
while( nSendCount-- > 0 )
{
SendKey( byVirtKey );
}
return true;
}
case LANG_CHINESE:
{
BYTE byVirtKey;
int nSendCount;
if( nCharHit > s_nCompCaret )
{
byVirtKey = VK_RIGHT;
}
else
{
byVirtKey = VK_LEFT;
}
nSendCount = abs( nCharHit - s_nCompCaret );
while( nSendCount-- > 0 )
{
SendKey( byVirtKey );
}
break;
}
}
return true;
}
if( ( s_CandList.bShowWindow ) && ( s_CandList.CandidateCoord.IsInside( fX, fY ) ) )
{
if( s_bVerticalCand )
{
int nRow;
nRow = ( int )( ( fY - s_CandList.CandidateCoord.fY ) / fFontHeight );
if( nRow < ( int )s_CandList.dwCount )
{
switch( GetPrimaryLanguage() )
{
case LANG_CHINESE:
case LANG_KOREAN:
SendKey( ( BYTE ) ( '0' + nRow + 1 ) );
break;
case LANG_JAPANESE:
{
BYTE byVirtKey;
int nNumToHit, nStrike;
if( nRow > ( int )s_CandList.dwSelection )
{
byVirtKey = VK_DOWN;
}
else
{
byVirtKey = VK_UP;
}
nNumToHit = abs( ( int) ( nRow - s_CandList.dwSelection ) );
for( nStrike = 0; nStrike < nNumToHit; nStrike++ )
{
SendKey( byVirtKey );
}
SendKey( VK_RIGHT );
SendKey( VK_LEFT );
break;
}
}
}
}
else
{
int i, nCharHit, nTrail, nCandidate, nEntryStart;
nCharHit = FontMng.GetCaretFromCaretPos( s_CandList.HoriCand.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight,
(int)((fX - s_CandList.CandidateCoord.fX) * m_pParent->GetScreenWidth()), nTrail );
//s_CandList.HoriCand.XtoCP( ( int )( ( fX - s_CandList.CandidateCoord.fX ) * m_pParent->GetScreenWidth() ), &nCharHit, &nTrail );
nCandidate = s_CandList.dwCount - 1;
nEntryStart = 0;
for( i = 0; i < ( int )s_CandList.dwCount; i++ )
{
if( nCharHit >= nEntryStart )
{
nEntryStart += lstrlenW( s_CandList.awszCandidate[ i ] ) + 1;
}
else
{
nCandidate = i - 1;
break;
}
}
switch( GetPrimaryLanguage() )
{
case LANG_CHINESE:
case LANG_KOREAN:
SendKey( ( BYTE ) ( '0' + nCandidate + 1 ) );
break;
}
}
return true;
}
}
}
return CEtUIEditBox::HandleMouse( uMsg, fX, fY, wParam, lParam );
}
void CEtUIIMEEditBox::Focus( bool fFocus )
{
CEtUIEditBox::Focus( fFocus );
// <20>߱<EFBFBD> <20>Ϻ<EFBFBD> IME<4D><45> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ʒ<EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD> <20><> <20>޾<EFBFBD>ä<EFBFBD><C3A4> ĵ<><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
//
// <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ѿ<EFBFBD>Ű <20><>ȯ<EFBFBD><C8AF> <20>ȵȴٴ<C8B4> <20>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BFA1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>𸣰<EFBFBD><F0B8A3B0><EFBFBD><EFBFBD><EFBFBD>,
// <20>ؿܺ<D8BF><DCBA><EFBFBD><E5BFA1> <20><><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD> IME<4D><45> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><D8BE>ϰ<EFBFBD>, <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ߴ<EFBFBD> ĵ<><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD>, <20>Ʒ<EFBFBD> <20>ڵ带 <20><><EFBFBD><EFBFBD><EFBFBD>ؾ߸<D8BE> <20>Ѵ<EFBFBD>.
//
// EtInterface<63><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD> static bool <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ܺο<DCBA><CEBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>޾<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
if( CEtUIIME::s_bDisableIMEonKillFocus )
{
if( fFocus )
{
HIMC hImc;
if( s_bEnableImeSystem )
{
_ImmAssociateContext( m_pParent->GetHWnd(), s_hImcDef );
CheckToggleState();
}
else
{
_ImmAssociateContext( m_pParent->GetHWnd(), NULL );
}
hImc = _ImmGetContext( m_pParent->GetHWnd() );
if( hImc != NULL )
{
if( !s_bEnableImeSystem )
{
s_ImeState = IMEUI_STATE_OFF;
}
_ImmReleaseContext( m_pParent->GetHWnd(), hImc );
CheckToggleState();
}
}
else
{
FinalizeString( false );
_ImmAssociateContext( m_pParent->GetHWnd(), NULL );
}
}
}
void CEtUIIMEEditBox::PumpMessage()
{
MSG msg;
while( PeekMessageW( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if( !GetMessageW( &msg, NULL, 0, 0 ) )
{
PostQuitMessage( (int)msg.wParam );
return;
}
TranslateMessage( &msg );
DispatchMessageA( &msg );
}
}
void CEtUIIMEEditBox::UpdateRects()
{
float fTempWidth;
fTempWidth = m_Property.UICoord.fWidth;
if( m_Property.IMEEditBoxProperty.fIndicatorSize > 0.0f )
{
m_Property.UICoord.fWidth -= m_Property.IMEEditBoxProperty.fIndicatorSize + m_Property.IMEEditBoxProperty.fBorder * 2;
}
CEtUIEditBox::UpdateRects();
m_IndicatorCoord.SetCoord( m_Property.UICoord.Right(), m_Property.UICoord.fY, m_Property.IMEEditBoxProperty.fIndicatorSize + m_Property.IMEEditBoxProperty.fBorder * 2, m_Property.UICoord.fHeight );
m_Property.UICoord.fWidth = fTempWidth;
}
void CEtUIIMEEditBox::Show( bool bShow )
{
CEtUIControl::Show( bShow );
s_bHideCaret = false;
}
void CEtUIIMEEditBox::Render( float fElapsedTime )
{
if( !IsShow() )
{
return;
}
/* if( m_Property.IMEEditBoxProperty.fIndicatorSize <= 0.0f )
{
int i;
for( i = 0; i < 5; i++ )
{
SUICoord Coord;
Coord.SetCoord( 0.0f, 0.0f, 0.1f, 0.1f );
m_pParent->CalcTextRect( s_aszIndicator[ i ], &m_Template.m_vecElement[ 5 ], Coord );
m_Property.IMEEditBoxProperty.fIndicatorSize = max( m_Property.IMEEditBoxProperty.fIndicatorSize, Coord.fWidth );
}
UpdateRects();
}*/
SUIElement *pElement;
pElement = GetElement(0);
if( pElement )
{
m_fCompositionWidth = 0.0f;
if( m_bFocus && s_bHideCaret )
{
SUICoord CompCoord;
m_pParent->CalcTextRect( s_CompString.GetBuffer(), pElement, CompCoord );
m_fCompositionWidth = CompCoord.fWidth;
}
CEtUIEditBox::Render( fElapsedTime );
//ID3DXFont *pFont = m_pParent->GetFont( pElement->nFontIndex, pElement->nFontHeight );
//s_CompString.SetFont( pFont );
//s_CandList.HoriCand.SetFont( pFont );
}
if( CEtUIIME::s_bDisableIMEonIMEControl )
return;
if( m_bFocus )
{
RenderIndicator( fElapsedTime );
if( s_bHideCaret )
RenderComposition( fElapsedTime );
if( s_bShowReadingWindow )
{
RenderCandidateReadingWindow( fElapsedTime, true );
}
else if( s_CandList.bShowWindow )
{
RenderCandidateReadingWindow( fElapsedTime, false );
}
}
}
void CEtUIIMEEditBox::RenderCandidateReadingWindow( float fElapsedTime, bool bReading )
{
UINT i, nNumEntries;
SUICoord Coord;
DWORD dwTextColor, dwTextBkColor, dwSelTextColor, dwSelBkColor;
int nX, nXFirst, nXComp;
nNumEntries = MAX_CANDLIST;
if( bReading )
{
nNumEntries = 4;
}
CEtFontMng& FontMng = CEtFontMng::GetInstance();
SUIElement* pElement = GetElement( 0 );
nX = FontMng.GetCaretPos( m_Buffer.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, m_nCaret );
nXFirst = FontMng.GetCaretPos( m_Buffer.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, m_nFirstVisible );
//m_Buffer.CPtoX( m_nCaret, FALSE, &nX );
//m_Buffer.CPtoX( m_nFirstVisible, FALSE, &nXFirst );
if( bReading )
{
dwTextColor = m_Property.IMEEditBoxProperty.dwReadingTextColor;
dwTextBkColor = m_Property.IMEEditBoxProperty.dwReadingBackColor;
dwSelTextColor = m_Property.IMEEditBoxProperty.dwReadingSelTextColor;
dwSelBkColor = m_Property.IMEEditBoxProperty.dwReadingSelBackColor;
}
else
{
dwTextColor = m_Property.IMEEditBoxProperty.dwCandiTextColor;
dwTextBkColor = m_Property.IMEEditBoxProperty.dwCandiBackColor;
dwSelTextColor = m_Property.IMEEditBoxProperty.dwCandiSelTextColor;
dwSelBkColor = m_Property.IMEEditBoxProperty.dwCandiSelBackColor;
}
if( ( GetLanguage() == LANG_CHT ) && ( !GetImeId() ) )
{
nXComp = 0;
}
else
{
if( GetPrimaryLanguage() == LANG_JAPANESE )
{
nXComp = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, s_nFirstTargetConv );
//s_CompString.CPtoX( s_nFirstTargetConv, FALSE, &nXComp );
}
else
{
nXComp = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, s_nCompCaret );
//s_CompString.CPtoX( s_nCompCaret, FALSE, &nXComp );
}
}
//SUIElement *pElement = GetElement(0);
if( !pElement ) return;
float fWidthRequired = 0.0f;
float fHeightRequired = 0.0f;
float fSingleLineHeight = 0.0f;
if( ( s_bVerticalCand && !bReading ) || ( !s_bHorizontalReading && bReading ) )
{
for( i = 0; i < nNumEntries; i++ )
{
if( s_CandList.awszCandidate[ i ][ 0 ] == L'\0' )
{
break;
}
Coord.SetCoord( 0.0f, 0.0f, 0.0f, 0.0f );
m_pParent->CalcTextRect( s_CandList.awszCandidate[i], pElement, Coord );
fWidthRequired = max( fWidthRequired, Coord.fWidth );
fSingleLineHeight = max( fSingleLineHeight, Coord.fHeight );
}
fHeightRequired = fSingleLineHeight * nNumEntries;
}
else
{
Coord.SetCoord( 0.0f, 0.0f, 0.0f, 0.0f );
if( bReading )
{
m_pParent->CalcTextRect( s_wszReadingString, pElement, Coord );
}
else
{
m_pParent->CalcTextRect( s_CandList.HoriCand.GetBuffer(), pElement, Coord );
}
// <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>׸<EFBFBD><D7B8><EFBFBD> <20>ʰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>α<EFBFBD> <20><><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ش<EFBFBD>
Coord.fWidth += 0.01f;
Coord.fHeight += 0.01f;
fWidthRequired = Coord.fWidth;;
fSingleLineHeight = Coord.fHeight;
fHeightRequired = Coord.fHeight;
}
bool bHasPosition = false;
Coord.SetCoord( s_fCompStringX + FloatXCoord( nXComp ), s_fCompStringY + m_TextCoord.fHeight,
fWidthRequired, fHeightRequired );
if( Coord.Right() > m_pParent->Width() )
{
Coord.fX -= Coord.Right() - m_pParent->Width();
Coord.fWidth = m_pParent->Width() - Coord.fX;
}
if( Coord.Bottom() <= m_pParent->Height() )
{
bHasPosition = true;
}
else if( m_bForceBottomPosition )
{
bHasPosition = true;
}
if( !bHasPosition )
{
Coord.SetCoord( s_fCompStringX + FloatXCoord( nXComp ), s_fCompStringY - fHeightRequired, fWidthRequired, fHeightRequired );
if( Coord.Right() > m_pParent->Width() )
{
Coord.fX -= Coord.Right() - m_pParent->Width();
Coord.fWidth = m_pParent->Width();
}
if( Coord.fY >= 0.0f )
{
bHasPosition = true;
}
}
if( !bHasPosition )
{
int nXCompTrail;
nXCompTrail = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, s_nCompCaret );
//s_CompString.CPtoX( s_nCompCaret, TRUE, &nXCompTrail );
Coord.SetCoord( s_fCompStringX + FloatXCoord( nXCompTrail ), 0.0f, fWidthRequired, fHeightRequired );
if( Coord.Right() <= m_pParent->Width() )
{
bHasPosition = true;
}
}
if( !bHasPosition )
{
Coord.SetCoord( s_fCompStringX + FloatXCoord( nXComp ) - fWidthRequired, 0.0f, fWidthRequired, fHeightRequired );
if( Coord.Right() >= 0.0f )
{
bHasPosition = true;
}
}
if( !bHasPosition )
{
Coord.fX = 0.0f;
Coord.fWidth = fWidthRequired;
}
if( !bReading )
{
s_CandList.CandidateCoord = Coord;
}
m_pParent->DrawRect( Coord, dwTextBkColor );
if( ( s_bVerticalCand && !bReading ) || ( !s_bHorizontalReading && bReading ) )
{
for( i = 0; i < nNumEntries; i++ )
{
Coord.fHeight = fSingleLineHeight;
if( s_CandList.dwSelection == i )
{
m_pParent->DrawRect( Coord, dwSelBkColor );
m_pParent->DrawDlgText( s_CandList.awszCandidate[ i ], pElement, dwSelTextColor, Coord );
}
else
{
m_pParent->DrawDlgText( s_CandList.awszCandidate[ i ], pElement, dwTextColor, Coord );
}
Coord.fY += fSingleLineHeight;
}
}
else
{
if( bReading )
{
//m_pParent->DrawDlgText( s_wszReadingString, pElement, dwTextColor, Coord );
m_pParent->DrawDlgText( s_wszReadingString, pElement, dwTextColor, Coord, -1, -1, true );
}
else
{
m_pParent->DrawDlgText( s_CandList.HoriCand.GetBuffer(), pElement, dwTextColor, Coord, -1, -1, true/*, DT_VCENTER | DT_CENTER*/ );
}
if( !bReading )
{
int nXLeft, nXRight;
nXLeft = FontMng.GetCaretPos( s_CandList.HoriCand.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, s_CandList.nFirstSelected );
//s_CandList.HoriCand.CPtoX( s_CandList.nFirstSelected, FALSE, &nXLeft );
nXRight = FontMng.GetCaretPos( s_CandList.HoriCand.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight,
s_CandList.nFirstSelected + s_CandList.nHoriSelectedLen );
if( nXLeft != nXRight )
{
//s_CandList.HoriCand.CPtoX( s_CandList.nFirstSelected + s_CandList.nHoriSelectedLen, FALSE, &nXRight );
Coord.fWidth = FloatXCoord( nXRight - nXLeft );
Coord.fX += FloatXCoord( nXLeft );
m_pParent->DrawRect( Coord, dwSelBkColor );
m_pParent->DrawDlgText( s_CandList.HoriCand.GetBuffer() + s_CandList.nFirstSelected, pElement, dwSelTextColor, Coord, -1, -1, true );
}
}
}
}
void CEtUIIMEEditBox::RenderComposition( float fElapsedTime )
{
int nX, nXFirst;
CEtFontMng& FontMng = CEtFontMng::GetInstance();
SUIElement* pElement = GetElement( 0 );
nX = FontMng.GetCaretPos( m_Buffer.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, m_nCaret );
//m_Buffer.CPtoX( m_nCaret, FALSE, &nX );
nXFirst = FontMng.GetCaretPos( m_Buffer.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, m_nFirstVisible );
//m_Buffer.CPtoX( m_nFirstVisible, FALSE, &nXFirst );
SUICoord CompCoord, FirstCoord, CaretCoord;
//SUIElement *pElement = GetElement(0);
if( !pElement ) return;
CompCoord.SetCoord( m_TextCoord.fX + ( nX - nXFirst ) / m_pParent->GetScreenWidth(), m_TextCoord.fY, 0.1f, m_TextCoord.fHeight );
m_pParent->CalcTextRect( s_CompString.GetBuffer(), pElement, CompCoord );
//if( CompCoord.Right() > m_TextCoord.Right() )
//{
// CompCoord.fX += m_TextCoord.fX - CompCoord.fX;
// CompCoord.fY += CompCoord.fHeight;
//}
FirstCoord = CompCoord;
s_fCompStringX = CompCoord.fX;
s_fCompStringY = CompCoord.fY;
int nCharLeft;
const WCHAR *pwszComp;
DWORD dwTextColor;
dwTextColor = m_Property.IMEEditBoxProperty.dwCompTextColor;
pElement->FontColor.dwCurrentColor = dwTextColor;
pwszComp = s_CompString.GetBuffer();
nCharLeft = s_CompString.GetTextSize();
if( nCharLeft == 0 ) return;
while( 1 )
{
int nLastInLine, nTrail, nNumCharToDraw;
nLastInLine = FontMng.GetCaretFromCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight,
(int)((CompCoord.fX + CompCoord.fWidth - m_TextCoord.fX) * m_pParent->GetScreenWidth() + 0.0001f), nTrail ); // 23.9999<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 23<32><33><EFBFBD><EFBFBD> intȭ <20>Ǽ<EFBFBD> <20>׳<EFBFBD> 0.0001 <20><><EFBFBD><EFBFBD> <20>ø<EFBFBD>ó<EFBFBD><C3B3> <20>Ѵ<EFBFBD>.
if( 0 == nLastInLine )
nLastInLine = 1;
// Note: Trail <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31>.. <20><>Ʈ<EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ij<>̵<EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> Trail <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..
if( 0 != nTrail )
nLastInLine += 1;
//s_CompString.XtoCP( ( int )( ( m_TextCoord.Right() - CompCoord.fX ) * m_pParent->GetScreenWidth() ), &nLastInLine, &bTrail );
nNumCharToDraw = min( nCharLeft, nLastInLine );
m_pParent->CalcTextRect( pwszComp, pElement, CompCoord, nNumCharToDraw );
CompCoord.fHeight = m_TextCoord.fHeight;
if( GetPrimaryLanguage() == LANG_KOREAN )
{
if( m_bCaretOn )
{
m_pParent->DrawRect( CompCoord, m_Property.IMEEditBoxProperty.dwCompBackColor );
}
else
{
dwTextColor = pElement->FontColor.dwColor[ UI_STATE_NORMAL ];
}
}
else
{
m_pParent->DrawRect( CompCoord, m_Property.IMEEditBoxProperty.dwCompBackColor );
}
pElement->FontColor.dwCurrentColor = dwTextColor;
//CEtFontMng::GetInstance().EnableFreeType( false );
m_pParent->DrawDlgText( pwszComp, pElement, dwTextColor, CompCoord, nNumCharToDraw );
//CEtFontMng::GetInstance().EnableFreeType( true );
nCharLeft -= nNumCharToDraw;
pwszComp += nNumCharToDraw;
if( nCharLeft <= 0 )
{
break;
}
CompCoord.fX += m_TextCoord.fX - CompCoord.fX;
CompCoord.fY += CompCoord.fHeight;
}
//CompCoord = FirstCoord;
CompCoord.fX = FirstCoord.fX;
CompCoord.fY = FirstCoord.fY;
CompCoord.fWidth = FirstCoord.fWidth;
int nCharFirst;
BYTE *pAttr;
const WCHAR *pcComp;
nCharFirst = 0;
nXFirst = 0;
s_nFirstTargetConv = -1;
for( pcComp = s_CompString.GetBuffer(), pAttr = s_abyCompStringAttr; *pcComp != L'\0'; pcComp++, pAttr++ )
{
DWORD dwBkColor;
int nXLeft, nXRight;
nXLeft = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, int(pcComp - s_CompString.GetBuffer()) );
//s_CompString.CPtoX( ( int )( pcComp - s_CompString.GetBuffer() ), FALSE, &nXLeft );
nXRight = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, s_CompString.GetTextSize() );
//s_CompString.CPtoX( ( int )( pcComp - s_CompString.GetBuffer() ), TRUE, &nXRight );
if( m_bFirstVisibleOver == false && m_nTempCompSize == 0 )
{
if( nXRight - nXFirst > ( int )( ( m_TextCoord.Right() - CompCoord.fX ) * m_pParent->GetScreenWidth() ) )
{
CompCoord.fX += m_TextCoord.fX - CompCoord.fX;
CompCoord.fY += CompCoord.fHeight;
nCharFirst = ( int )( pcComp - s_CompString.GetBuffer() );
nXFirst = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, nCharFirst );
//s_CompString.CPtoX( nCharFirst, FALSE, &nXFirst );
}
}
if( s_nCompCaret == ( int )( pcComp - s_CompString.GetBuffer() ) )
{
CaretCoord = CompCoord;
CaretCoord.fX += ( nXLeft - nXFirst - 1 ) / m_pParent->GetScreenWidth();
CaretCoord.fWidth = 2.0f / m_pParent->GetScreenWidth();
}
if( *pAttr == ATTR_TARGET_CONVERTED )
{
pElement->FontColor.dwCurrentColor = m_dwCompTargetColor;
dwBkColor = m_dwCompTargetBkColor;
}
else
{
if( *pAttr == ATTR_TARGET_NOTCONVERTED )
{
pElement->FontColor.dwCurrentColor = m_dwCompTargetNonColor;
dwBkColor = m_dwCompTargetNonBkColor;
}
else
{
continue;
}
}
SUICoord TargetCoord;
TargetCoord.SetCoord( CompCoord.fX + ( nXLeft - nXFirst ) / m_pParent->GetScreenWidth(), CompCoord.fY, ( nXRight - nXLeft ) / m_pParent->GetScreenWidth(), CompCoord.fHeight );
m_pParent->DrawRect( TargetCoord, dwBkColor );
m_pParent->DrawDlgText( pcComp, pElement, pElement->FontColor.dwCurrentColor, TargetCoord, 1 );
if( s_nFirstTargetConv == -1 )
{
s_nFirstTargetConv = ( int )( pAttr - s_abyCompStringAttr );
}
}
if( m_bCaretOn )
{
if( s_nCompCaret == s_CompString.GetTextSize() )
{
nX = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, s_nCompCaret );
//s_CompString.CPtoX( s_nCompCaret, FALSE, &nX );
CaretCoord = CompCoord;
CaretCoord.fX += ( nX - nXFirst - 1 ) / m_pParent->GetScreenWidth();
CaretCoord.fWidth = 2.0f / m_pParent->GetScreenWidth();
}
m_pParent->DrawRect( CaretCoord, m_Property.IMEEditBoxProperty.dwCompCaretColor );
}
}
void CEtUIIMEEditBox::RenderIndicator( float fElapsedTime )
{
if( m_Property.IMEEditBoxProperty.fIndicatorSize <= 0.0f )
{
return;
}
UpdateBlendRate();
SUIElement *pElement;
SUICoord TempCoord;//, CalcCoord;
WCHAR *pwszIndicator;
pElement = GetElement(5);
pElement->TextureColor.Blend( UI_STATE_NORMAL, fElapsedTime, m_fBlendRate );
if( m_bExistTemplateTexture )
m_pParent->DrawSprite( m_Template.m_hTemplateTexture, pElement->TemplateUVCoord, pElement->TextureColor.dwCurrentColor, m_IndicatorCoord );
else
m_pParent->DrawSprite( pElement->UVCoord, pElement->TextureColor.dwCurrentColor, m_IndicatorCoord );
/* TempCoord = m_IndicatorCoord;
TempCoord.fX += m_Property.IMEEditBoxProperty.fSpace;
TempCoord.fY += m_Property.IMEEditBoxProperty.fSpace;
TempCoord.fWidth -= m_Property.IMEEditBoxProperty.fSpace * 2;
TempCoord.fHeight -= m_Property.IMEEditBoxProperty.fSpace * 2;
*/
pElement->FontColor.dwCurrentColor = m_Property.IMEEditBoxProperty.dwIndiTextColor;
if( ( s_ImeState == IMEUI_STATE_ON ) && ( s_bEnableImeSystem ) )
{
pwszIndicator = s_pwszCurrIndicator;
}
else
{
pwszIndicator = s_aszIndicator[ 0 ];
}
/* if( ( s_ImeState == IMEUI_STATE_ON ) && ( s_bEnableImeSystem ) )
{
pElement->FontColor.dwCurrentColor = m_dwIndicatorImeColor;
}
else
{
pElement->FontColor.dwCurrentColor = m_dwIndicatorEngColor;
}
if( s_bEnableImeSystem )
{
pwszIndicator = s_pwszCurrIndicator;
}
else
{
pwszIndicator = s_aszIndicator[ 0 ];
}
*/
TempCoord = m_IndicatorCoord;
m_pParent->CalcTextRect( pwszIndicator, pElement, TempCoord );
float fMidHeight = ( m_IndicatorCoord.fHeight - TempCoord.fHeight ) / 2.0f;
TempCoord.fX -= m_Property.IMEEditBoxProperty.fSpace;
TempCoord.fY = m_IndicatorCoord.fY + fMidHeight;
m_pParent->DrawDlgText( pwszIndicator, pElement, pElement->FontColor.dwCurrentColor, TempCoord );
}
void CEtUIIMEEditBox::TruncateCompString( bool bUseBackSpace, int iNewStrLen )
{
if( !s_bInsertOnType )
{
return;
}
int i, cc;
cc = ( int )wcslen( s_CompString.GetBuffer() );
assert( iNewStrLen == 0 || iNewStrLen >= cc );
for ( i = 0; i < cc - s_nCompCaret; i++ )
{
SendMessage( m_pParent->GetHWnd(), WM_KEYDOWN, VK_RIGHT, 0 );
}
SendMessage( m_pParent->GetHWnd(), WM_KEYUP, VK_RIGHT, 0 );
if( ( bUseBackSpace ) || ( m_bInsertMode ) )
{
iNewStrLen = 0;
}
if( iNewStrLen < cc )
{
for( i = 0; i < cc - iNewStrLen; i++ )
{
SendMessage( m_pParent->GetHWnd(), WM_KEYDOWN, VK_BACK, 0 );
SendMessageW( m_pParent->GetHWnd(), WM_CHAR, VK_BACK, 0 );
}
SendMessage( m_pParent->GetHWnd(), WM_KEYUP, VK_BACK, 0 );
}
else
{
iNewStrLen = cc;
}
for ( i = 0; i < iNewStrLen; i++ )
{
SendMessage( m_pParent->GetHWnd(), WM_KEYDOWN, VK_LEFT, 0 );
}
SendMessage( m_pParent->GetHWnd(), WM_KEYUP, VK_LEFT, 0 );
}
void CEtUIIMEEditBox::FinalizeString( bool bSend )
{
HIMC hImc;
static bool bProcessing = false;
hImc = _ImmGetContext( m_pParent->GetHWnd() );
if( hImc == NULL )
{
return;
}
if( bProcessing )
{
_ImmReleaseContext( m_pParent->GetHWnd(), hImc );
return;
}
bProcessing = true;
if( ( !s_bInsertOnType ) && ( bSend ) )
{
LONG lLength;
lLength = lstrlenW( s_CompString.GetBuffer() );
if( ( GetLanguage() == LANG_CHT ) && ( s_CompString[ lLength - 1 ] == 0x3000 ) )
{
s_CompString[ lLength - 1 ] = 0;
}
SendCompString();
}
TruncateCompString();
s_bHideCaret = false;
s_bShowReadingWindow = false;
ResetCompositionString();
_ImmNotifyIME( hImc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 );
_ImmNotifyIME( hImc, NI_CLOSECANDIDATE, 0, 0 );
_ImmReleaseContext( m_pParent->GetHWnd(), hImc );
bProcessing = false;
}
void CEtUIIMEEditBox::SendCompString()
{
for( int i = 0; i < lstrlenW( s_CompString.GetBuffer() ); i++ )
{
MsgProc( WM_CHAR, ( WPARAM )s_CompString[ i ], 0 );
}
}
void CEtUIIMEEditBox::PlaceCaret( int nCP )
{
int nX1, nX2, nCompSize(0);
m_bFirstVisibleOver = false;
m_nTempCompSize = 0;
CEtFontMng& FontMng = CEtFontMng::GetInstance();
SUIElement* pElement = GetElement( 0 );
nX1 = FontMng.GetCaretPos( m_Buffer.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, m_nFirstVisible );
//m_Buffer.CPtoX( m_nFirstVisible, FALSE, &nX1 );
nX2 = FontMng.GetCaretPos( m_Buffer.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, m_nCaret );
//m_Buffer.CPtoX( m_nCaret, FALSE, &nX2 );
nCompSize = FontMng.GetCaretPos( s_CompString.GetBuffer(), pElement->nFontIndex, pElement->nFontHeight, nCP );
//s_CompString.CPtoX( nCP, FALSE, &nCompSize );
int nTextWidth = (int)( m_TextCoord.fWidth * m_pParent->GetScreenWidth() );
if( (nX2-nX1+nCompSize) > nTextWidth )
{
int nTemp = m_Buffer.GetMaxEditBoxLength() - m_Buffer.GetTextSize();
int nCPNew1st(0);
if( nTemp < 3 )
++nCPNew1st;
else
nCPNew1st += 3;
// Note: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20>ʹ<EFBFBD> <20><><EFBFBD><20>ϼ<EFBFBD><CFBC><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20>о<D0BE><EEB3BB> <20>ϳ<EFBFBD><CFB3><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʰ<EFBFBD> <20>Ǵ<EFBFBD> <20><><EFBFBD><20><><EFBFBD>´<EFBFBD>.
// <20>ȱ׷<C8B1><D7B7><EFBFBD> m_nFirstVisible <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD≯<EFBFBD> <20>Ѿ<D1BE><EEB0A1> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD>.
if( m_nFirstVisible + nCPNew1st < (int)wcslen( m_Buffer.GetBuffer() ) )
m_nFirstVisible += nCPNew1st;
else
m_bFirstVisibleOver = true;
// <20>ƹ<EFBFBD><C6B9><EFBFBD><EFBFBD><EFBFBD> CustomUI<55><49><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> m_bFirstVisibleOver <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> ó<><C3B3><EFBFBD>Ѱ<EFBFBD> <20><>ü<EFBFBD><C3BC> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD> <20><><EFBFBD>Ƽ<EFBFBD>,
// <20><> <20><><EFBFBD>°<EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> ImmSetCompositionStringW<67>Լ<EFBFBD><D4BC><EFBFBD> ȣ<><C8A3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̷<EFBFBD> <20><><EFBFBD>ѵη<D1B5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
// <20>ƹ<EFBFBD><C6B9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD> FALSE<53><45> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
// <20><><EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD> ã<>ƺ<EFBFBD><C6BA><EFBFBD> <20>ȵȴٰ<C8B4> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><EEB6BB> <20><><EFBFBD>ľߵȴٰ<C8B4> <20><><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD> <20><>ã<EFBFBD>Ҵ<EFBFBD>.
// #30251 <20>ӼӸ<D3BC>[<5B><><EFBFBD>̵<EFBFBD>]<5D><> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڸ<EFBFBD> <20>Է<EFBFBD><D4B7><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
// <20><><EFBFBD>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD><EFBFBD> ª<><C2AA><EFBFBD><EFBFBD><EFBFBD>ٰ<EFBFBD> <20>ڲ<EFBFBD> <20><><EFBFBD>µȴٰ<C8B4> <20><><EFBFBD>ζ<EFBFBD> <20>ؼ<EFBFBD>, <20><><EFBFBD><EFBFBD> <20><>ƾ<EFBFBD><C6BE> <20>ٽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>غôµ<C3B4>,
// CustomUI<55><49><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> m_bFirstVisibleOver<65><72> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.. Custom UI<55><49> <20>޸<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD>ڸ<EFBFBD> <20>о<D0BE><EEB3BB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>׿<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>.(<28>׸<EFBFBD><D7B8><EFBFBD> <20>̰<EFBFBD> <20><> <20>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.)
// <20>̰<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><> <20>̷<EFBFBD><CCB7><EFBFBD> <20>Ǿ<EFBFBD><C7BE>ִµ<D6B4>, ÷<><C3B7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڰ<EFBFBD> <20><> <20>̷<EFBFBD><CCB7><EFBFBD> <20>˾Ҵ<CBBE>.
// <20>ٵ<EFBFBD> <20>غ<EFBFBD><D8BA>ϱ<EFBFBD>, <20>ѱ۸<D1B1> <20>̷<EFBFBD><CCB7><EFBFBD>,
// <20>Ϻ<EFBFBD><CFBA><EFBFBD>, <20>߱<EFBFBD><DFB1><EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD>ս<EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> 2<><32> <20>̻<EFBFBD><CCBB><EFBFBD> <20>͵<EFBFBD><CDB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD> <20>߰<EFBFBD>,
// <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴٰ<CAB4> Ȯ<><C8AE><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD><C7BE>߸<EFBFBD> <20>о<D0BE><EEB3BD>.
// <20>ٵ<EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD>״<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> <20>ʴ<EFBFBD>.
// <20>׷<EFBFBD><D7B7><EFBFBD> <20>Ʒ<EFBFBD><C6B7><EFBFBD> <20><><EFBFBD><EFBFBD> s_CompString <20>ذ<EFBFBD>å<EFBFBD><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
if( m_bFirstVisibleOver && (int)wcslen( s_CompString.GetBuffer() ) < 10 )
{
m_bFirstVisibleOver = false;
m_nTempCompSize = nCompSize;
}
}
}
void CEtUIIMEEditBox::ClearText()
{
CEtUIEditBox::ClearText();
ResetCompositionString();
}
void CEtUIIMEEditBox::CheckIMEToggleState()
{
CheckToggleState();
}
void CEtUIIMEEditBox::CancelIMEComposition()
{
HIMC hImc;
hImc = _ImmGetContext( m_pParent->GetHWnd() );
if( hImc == NULL )
return;
_ImmNotifyIME( hImc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 );
}
void CEtUIIMEEditBox::GetIMECompositionString(std::wstring& str)
{
HIMC hImc;
hImc = _ImmGetContext( m_pParent->GetHWnd() );
if( hImc == NULL )
return;
WCHAR wszCompStr[MAX_COMPSTRING_SIZE]={0};
LONG lRet = _ImmGetCompositionStringW( hImc, GCS_COMPSTR, wszCompStr, sizeof( wszCompStr ) );
if (lRet > 0)
{
lRet /= sizeof( WCHAR );
wszCompStr[lRet] = 0;
str = wszCompStr;
}
}
int CEtUIIMEEditBox::GetMaxChar() const
{
return m_Property.IMEEditBoxProperty.dwMaxChars;
}
void CEtUIIMEEditBox::SetMaxChar( DWORD dwChar )
{
m_Property.IMEEditBoxProperty.dwMaxChars = dwChar;
SetMaxEditLength( dwChar );
}